I am using a Dependency file (for other needs) and want to 'require' that a Currency field has a positive value when the conditions are true.
However, normal 'Required' only seems to test that the field has content, and in the case of a Currency (number) field, this includes 0.00
I have tried including a check on the value in the trigger but that has no effect (normal Required works using the $account_type test)
Ideas welcome.
Thanks
Code in Dependency file:
$dependencies['Accounts']['required_feeslost'] = array(
'hooks' => array("edit"),
'trigger' => 'and(isInList($account_type, createList("2")), equal($symc_lost_fees_c, 0.00))',
'triggerFields' => array('account_type'),
'onload' => true,
//Actions is a list of actions to fire when the trigger is true
'actions' => array(
array(
'name' => 'SetRequired',
//The parameters passed in will depend on the action type set in 'name'
'params' => array(
'target' => 'symc_lost_fees_c',
'value' => 'true',
),
),
),
'notActions' => array(
array(
'name' => 'SetRequired',
//The parameters passed in will depend on the action type set in 'name'
'params' => array(
'target' => 'symc_lost_fees_c',
'value' => 'false',
),
),
),
);
I've also tried a variation on the above, based on some guidance in the Sugar Developer documentation, but still no joy
Switching the conditional logic to the Value line and testing the value of the field
$dependencies['Accounts']['required_feeslost'] = array(
'hooks' => array("edit"),
'trigger' => 'true',
'triggerFields' => array('account_type'),
'onload' => true,
//Actions is a list of actions to fire when the trigger is true
'actions' => array(
array(
'name' => 'SetRequired',
//The parameters passed in will depend on the action type set in 'name'
'params' => array(
'target' => 'symc_lost_fees_c',
'value' => 'and(isInList($account_type, createList("2")), not(greaterThan($symc_lost_fees_c, 0.00)))',
),
),
),
'notActions' => array(
array(
'name' => 'SetRequired',
//The parameters passed in will depend on the action type set in 'name'
'params' => array(
'target' => 'symc_lost_fees_c',
'value' => 'false',
),
),
),
);