Hello people. When creating a rule based workflow module accounts dates I wanted to use a module related to the conditions of workflow fields. When saving the workflow dates such conditions disappear. Only it happens when a related module , and only when the “Type” is “Value” . In all other cases not fail.
In principle I see that fails to save , because in the DB date format type of user ( d / m / Y) instead of typing in DB format ( Ymd ) , but do not know if it can be failing elsewhere . I found that the error is stored in the modules file / AOW_Conditions / AOW_Condition.php.
In line method save_lines approximately 90 says:
} else if($field_def[‘name’] === ‘value’ && $post_data[$key.‘value_type’][$i] === ‘Value’) {
$post_data[$key.$field_def[‘name’]][$i] = fixUpFormatting($_REQUEST[‘flow_module’], $condition->field, $post_data[$key.$field_def[‘name’]][$i]);
}
The method is fixUpFormatting that will convert the date to the correct format (or in the case of decimal , too). Its parameters are : 1. the magnitude of the field , field name 2 , 3. The value of the field . In your case should go 1. ’ related Modulo ’ 2. ‘Campo fecha’3 . 31/12/2013 , but instead is going 1. Accounts 2. ’ fecha’3 field . 31/12/2013 thus not finding the Accounts module Expiration field , the conversion fails and the value is not converted in the DB . Wrong is where it says $ _REQUEST [’ flow_module '] , because each field can be Workflow belonging to different module : not all fields will be the Accounts module.
Insert code
if the array after the adding the following else
else if($field_def[‘name’] === ‘value’ && $post_data[$key.‘value_type’][$i] === ‘Value’) {
$condition_module = getConditionModule($_REQUEST[$key.‘module_path’][$i][0]);
if (!empty($condition_module))
$post_data[$key.$field_def[‘name’]][$i] = fixUpFormatting($condition_module, $condition->field, $post_data[$key.$field_def[‘name’]][$i]);
outside the class AOW_Condition add the following code
function getConditionModule($module_name){
global $app_list_strings;
if (isset($app_list_strings['moduleList'][$module_name])){
return $module_name;
} else {
$focus = BeanFactory::getBean($_REQUEST['flow_module']);
$focus->load_relationship($module_name);
return $focus->$module_name->getRelatedModuleName();
}
}
all that piece of code helps bring the name of the module related correctamete and so it helps to insert the date correctly . I hope that is helpful .
Thank You So Much