Beispiel #1
0
 function save_lines($post_data, $parent, $key = '')
 {
     require_once 'modules/AOW_WorkFlow/aow_utils.php';
     $line_count = count($post_data[$key . 'field']);
     $j = 0;
     for ($i = 0; $i < $line_count; ++$i) {
         if ($post_data[$key . 'deleted'][$i] == 1) {
             $this->mark_deleted($post_data[$key . 'id'][$i]);
         } else {
             $field = new AOR_Field();
             foreach ($this->field_defs as $field_def) {
                 if (isset($post_data[$key . $field_def['name']][$i])) {
                     if (is_array($post_data[$key . $field_def['name']][$i])) {
                         $post_data[$key . $field_def['name']][$i] = base64_encode(serialize($post_data[$key . $field_def['name']][$i]));
                     } else {
                         if ($field_def['name'] == 'value') {
                             $post_data[$key . $field_def['name']][$i] = fixUpFormatting($_REQUEST['report_module'], $field->field, $post_data[$key . $field_def['name']][$i]);
                         }
                     }
                     $field->{$field_def}['name'] = $post_data[$key . $field_def['name']][$i];
                 }
             }
             if (trim($field->field) != '') {
                 $field->aor_report_id = $parent->id;
                 $field->save();
             }
         }
     }
 }
Beispiel #2
0
 function save_lines($post_data, $parent, $key = '')
 {
     require_once 'modules/AOW_WorkFlow/aow_utils.php';
     $line_count = count($post_data[$key . 'field']);
     $j = 0;
     for ($i = 0; $i < $line_count; ++$i) {
         if ($post_data[$key . 'deleted'][$i] == 1) {
             $this->mark_deleted($post_data[$key . 'id'][$i]);
         } else {
             $condition = new AOR_Condition();
             foreach ($this->field_defs as $field_def) {
                 if (isset($post_data[$key . $field_def['name']][$i])) {
                     if (is_array($post_data[$key . $field_def['name']][$i])) {
                         switch ($condition->value_type) {
                             case 'Date':
                                 $post_data[$key . $field_def['name']][$i] = base64_encode(serialize($post_data[$key . $field_def['name']][$i]));
                             default:
                                 $post_data[$key . $field_def['name']][$i] = encodeMultienumValue($post_data[$key . $field_def['name']][$i]);
                         }
                     } else {
                         if ($field_def['name'] == 'value') {
                             $post_data[$key . $field_def['name']][$i] = fixUpFormatting($_REQUEST['report_module'], $condition->field, $post_data[$key . $field_def['name']][$i]);
                         } else {
                             if ($field_def['name'] == 'parameter') {
                                 $post_data[$key . $field_def['name']][$i] = isset($post_data[$key . $field_def['name']][$i]);
                             } else {
                                 if ($field_def['name'] == 'module_path') {
                                     $post_data[$key . $field_def['name']][$i] = base64_encode(serialize(explode(":", $post_data[$key . $field_def['name']][$i])));
                                 }
                             }
                         }
                     }
                     $condition->{$field_def}['name'] = $post_data[$key . $field_def['name']][$i];
                 } else {
                     if ($field_def['name'] == 'parameter') {
                         $condition->{$field_def}['name'] = 0;
                     }
                 }
             }
             // Period must be saved as a string instead of a base64 encoded datetime.
             // Overwriting value
             if ($condition->value_type == 'Period') {
                 $condition->value = base64_encode($_POST['aor_conditions_value'][$i]);
                 //                    $condition->value = $_POST['aor_conditions_value'][$i];
             }
             if (trim($condition->field) != '') {
                 $condition->condition_order = ++$j;
                 $condition->aor_report_id = $parent->id;
                 $condition->save();
             }
         }
     }
 }
Beispiel #3
0
 function save_lines($post_data, $parent, $key = '')
 {
     require_once 'modules/AOW_WorkFlow/aow_utils.php';
     $line_count = count($post_data[$key . 'field']);
     $j = 0;
     for ($i = 0; $i < $line_count; ++$i) {
         if ($post_data[$key . 'deleted'][$i] == 1) {
             $this->mark_deleted($post_data[$key . 'id'][$i]);
         } else {
             $field = new AOR_Field();
             $field->group_display = false;
             if ($key == 'aor_fields_') {
                 foreach ($post_data['aor_fields_group_display'] as $gdKey => $gdValue) {
                     if ($gdValue == $i) {
                         $field->group_display = $gdKey + 1;
                         break;
                     }
                 }
             }
             foreach ($this->field_defs as $field_def) {
                 if (is_array($post_data[$key . $field_def['name']])) {
                     if ($field_def['name'] != 'group_display' && isset($post_data[$key . $field_def['name']][$i])) {
                         if (is_array($post_data[$key . $field_def['name']][$i])) {
                             $post_data[$key . $field_def['name']][$i] = base64_encode(serialize($post_data[$key . $field_def['name']][$i]));
                         } else {
                             if ($field_def['name'] == 'value') {
                                 $post_data[$key . $field_def['name']][$i] = fixUpFormatting($_REQUEST['report_module'], $field->field, $post_data[$key . $field_def['name']][$i]);
                             }
                         }
                         if ($field_def['name'] == 'module_path') {
                             $post_data[$key . $field_def['name']][$i] = base64_encode(serialize(explode(":", $post_data[$key . $field_def['name']][$i])));
                         }
                         $field->{$field_def}['name'] = $post_data[$key . $field_def['name']][$i];
                     }
                 } else {
                     if (is_null($post_data[$key . $field_def['name']])) {
                         // do nothing
                     } else {
                         throw new Exception('illegal type in post data at key ' . $key . $field_def['name'] . ' ' . gettype($post_data[$key . $field_def['name']]));
                     }
                 }
             }
             if (trim($field->field) != '') {
                 $field->aor_report_id = $parent->id;
                 $field->save();
             }
         }
     }
 }
Beispiel #4
0
 function save_lines($post_data, $parent, $key = '')
 {
     require_once 'modules/AOW_WorkFlow/aow_utils.php';
     $line_count = count($post_data[$key . 'field']);
     $j = 0;
     for ($i = 0; $i < $line_count; ++$i) {
         if ($post_data[$key . 'deleted'][$i] == 1) {
             $this->mark_deleted($post_data[$key . 'id'][$i]);
         } else {
             $condition = new AOW_Condition();
             foreach ($this->field_defs as $field_def) {
                 if (isset($post_data[$key . $field_def['name']][$i])) {
                     if (is_array($post_data[$key . $field_def['name']][$i])) {
                         if ($field_def['name'] == 'module_path') {
                             $post_data[$key . $field_def['name']][$i] = base64_encode(serialize($post_data[$key . $field_def['name']][$i]));
                         } else {
                             switch ($condition->value_type) {
                                 case 'Date':
                                     $post_data[$key . $field_def['name']][$i] = base64_encode(serialize($post_data[$key . $field_def['name']][$i]));
                                 default:
                                     $post_data[$key . $field_def['name']][$i] = encodeMultienumValue($post_data[$key . $field_def['name']][$i]);
                             }
                         }
                     } 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]);
                         }
                     }
                     $condition->{$field_def}['name'] = $post_data[$key . $field_def['name']][$i];
                 }
             }
             if (trim($condition->field) != '') {
                 $condition->condition_order = ++$j;
                 $condition->assigned_user_id = $parent->assigned_user_id;
                 $condition->aow_workflow_id = $parent->id;
                 $condition->save();
             }
         }
     }
 }
Beispiel #5
0
 function save_lines($post_data, $parent, $key = '')
 {
     require_once 'modules/AOW_WorkFlow/aow_utils.php';
     $line_count = count($post_data[$key . 'field']);
     $j = 0;
     for ($i = 0; $i < $line_count; ++$i) {
         if ($post_data[$key . 'deleted'][$i] == 1) {
             $this->mark_deleted($post_data[$key . 'id'][$i]);
         } else {
             $condition = new AOR_Condition();
             foreach ($this->field_defs as $field_def) {
                 $field_name = $field_def['name'];
                 if (isset($post_data[$key . $field_name][$i])) {
                     if (is_array($post_data[$key . $field_name][$i])) {
                         switch ($condition->value_type) {
                             case 'Date':
                                 $post_data[$key . $field_name][$i] = base64_encode(serialize($post_data[$key . $field_name][$i]));
                                 break;
                             default:
                                 $post_data[$key . $field_name][$i] = encodeMultienumValue($post_data[$key . $field_name][$i]);
                         }
                     } else {
                         if ($field_name == 'value' && $post_data[$key . 'value_type'][$i] === 'Value') {
                             $post_data[$key . $field_name][$i] = fixUpFormatting($_REQUEST['report_module'], $condition->field, $post_data[$key . $field_name][$i]);
                         } else {
                             if ($field_name == 'parameter') {
                                 $post_data[$key . $field_name][$i] = isset($post_data[$key . $field_name][$i]);
                             } else {
                                 if ($field_name == 'module_path') {
                                     $post_data[$key . $field_name][$i] = base64_encode(serialize(explode(":", $post_data[$key . $field_name][$i])));
                                 }
                             }
                         }
                     }
                     if ($field_name == 'parenthesis' && $post_data[$key . $field_name][$i] == 'END') {
                         if (!isset($lastParenthesisStartConditionId)) {
                             throw new Exception('a closure parenthesis has no starter pair');
                         }
                         $condition->parenthesis = $lastParenthesisStartConditionId;
                     } else {
                         $condition->{$field_name} = $post_data[$key . $field_name][$i];
                     }
                 } else {
                     if ($field_name == 'parameter') {
                         $condition->{$field_name} = 0;
                     }
                 }
             }
             // Period must be saved as a string instead of a base64 encoded datetime.
             // Overwriting value
             if ((!isset($condition->parenthesis) || !$condition->parenthesis) && isset($condition->value_type) && $condition->value_type == 'Period') {
                 $condition->value = base64_encode($_POST['aor_conditions_value'][$i]);
             }
             if (trim($condition->field) != '' || $condition->parenthesis) {
                 if (isset($_POST['aor_conditions_order'][$i])) {
                     $condition->condition_order = (int) $_POST['aor_conditions_order'][$i];
                 } else {
                     $condition->condition_order = ++$j;
                 }
                 $condition->aor_report_id = $parent->id;
                 $conditionId = $condition->save();
                 if ($condition->parenthesis == 'START') {
                     $lastParenthesisStartConditionId = $conditionId;
                 }
             }
         }
     }
 }