Payroll improvement:

Allow to fill the Description field on movement assigning the variable description in the payroll rule.
Integrate fix from 361 - harmless addition to Scriptlet (backward compatible) to allow registering description in payroll.
This commit is contained in:
Carlos Ruiz 2011-02-27 00:53:47 -05:00
parent 37d2ee07f5
commit 11b3d0bcf2
1 changed files with 22 additions and 0 deletions

View File

@ -67,6 +67,9 @@ public class Scriptlet
/** Default Result Variable Name */ /** Default Result Variable Name */
public static final String VARIABLE = "result"; public static final String VARIABLE = "result";
/** Default Description Variable Name */
public static final String DESCRIPTION_VARIABLE = "description";
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(Scriptlet.class); private static CLogger log = CLogger.getCLogger(Scriptlet.class);
@ -109,6 +112,8 @@ public class Scriptlet
private HashMap<String,Object> m_ctx; private HashMap<String,Object> m_ctx;
/** Result */ /** Result */
private Object m_result; private Object m_result;
/** Description */
private Object m_description;
/*************************************************************************/ /*************************************************************************/
@ -120,6 +125,7 @@ public class Scriptlet
public Exception execute() public Exception execute()
{ {
m_result = null; m_result = null;
m_description = null;
if (m_variable == null || m_variable.length() == 0 || m_script == null || m_script.length() == 0) if (m_variable == null || m_variable.length() == 0 || m_script == null || m_script.length() == 0)
{ {
IllegalArgumentException e = new IllegalArgumentException("No variable/script"); IllegalArgumentException e = new IllegalArgumentException("No variable/script");
@ -150,6 +156,13 @@ public class Scriptlet
e = new IllegalArgumentException("Result Variable not found - " + m_variable); e = new IllegalArgumentException("Result Variable not found - " + m_variable);
return e; return e;
} }
try
{
m_description = i.get (DESCRIPTION_VARIABLE);
}
catch (Exception e)
{
}
return null; return null;
} // execute } // execute
@ -406,6 +419,15 @@ public class Scriptlet
return m_result; return m_result;
} // getResult } // getResult
/**************************************************************************
* Get Description
* @return description or null
*/
public Object getDescription()
{
return m_description;
} // getResult
/** /**
* String Representation incl. Result * String Representation incl. Result
* @return Scipt * @return Scipt