953 |
$this->valF['object_id'] = $new_values['object_id']; |
$this->valF['object_id'] = $new_values['object_id']; |
954 |
$this->valF['last_modification_date'] = date('Y-m-d'); |
$this->valF['last_modification_date'] = date('Y-m-d'); |
955 |
$this->valF['last_modification_time'] = date('H:i:s'); |
$this->valF['last_modification_time'] = date('H:i:s'); |
956 |
|
|
957 |
if ($val['stream'] === 'output' |
if ($val['stream'] === 'output' |
958 |
&& $val['type'] !== 'suppression_piece') { |
&& $val['type'] !== 'suppression_piece') { |
|
// Lorsque la task passe d'un état qui n'est pas "done" à l'état "done" |
|
|
if ($this->getVal("state") !== self::STATUS_DONE |
|
|
&& $this->valF['state'] === self::STATUS_DONE) { |
|
|
// |
|
|
$this->valF['json_payload'] = $this->view_form_json(true); |
|
|
} |
|
959 |
// Lorsque la task passe d'un état "done" à un état qui n'est pas "done" |
// Lorsque la task passe d'un état "done" à un état qui n'est pas "done" |
960 |
if ($this->getVal("state") === self::STATUS_DONE |
if ($this->getVal("state") === self::STATUS_DONE |
961 |
&& $this->valF['state'] !== self::STATUS_DONE) { |
&& $this->valF['state'] !== self::STATUS_DONE) { |
1077 |
* @return boolean |
* @return boolean |
1078 |
*/ |
*/ |
1079 |
public function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
public function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
1080 |
parent::triggermodifierapres($id, $dnu1, $val, $dnu2); |
$res = parent::triggermodifierapres($id, $dnu1, $val, $dnu2); |
1081 |
|
|
1082 |
|
if ($res !== false) { |
1083 |
|
if ($val['stream'] === 'output') { |
1084 |
|
// Si le type de la tache est suppression alors il faut gerer le state dans la payload figée. |
1085 |
|
if (in_array($val['type'], array('suppression_piece'))) { |
1086 |
|
$json_payload = json_decode($this->valF['json_payload']); |
1087 |
|
// Si le state de la payload est différent du nouveau state de la tache. |
1088 |
|
if ($json_payload->task->state !== $this->valF['state']) { |
1089 |
|
$json_payload->task->state = $this->valF['state']; |
1090 |
|
$task_val = array(); |
1091 |
|
// Avec la nouvelle payload. |
1092 |
|
$task_val['json_payload'] = json_encode($json_payload); |
1093 |
|
$res = $this->f->db->autoExecute( |
1094 |
|
sprintf('%s%s', DB_PREFIXE, "task"), |
1095 |
|
$task_val, |
1096 |
|
DB_AUTOQUERY_UPDATE, |
1097 |
|
sprintf("task = '%s'", $val['task']) |
1098 |
|
); |
1099 |
|
$this->f->addToLog(__METHOD__."(): db->autoexecute(\"".sprintf('%s%s', DB_PREFIXE, 'task')."\", ".print_r($task_val, true).", DB_AUTOQUERY_UPDATE, \"".sprintf("task = '%s'", $val['task'])."\");", VERBOSE_MODE); |
1100 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
1101 |
|
return false; |
1102 |
|
} |
1103 |
|
# Choix de l'autoExecute pour évité le double trigger de l'enregistrement de l'historique |
1104 |
|
# $instance_task->modifier($task_val); |
1105 |
|
} |
1106 |
|
} |
1107 |
|
if ($val['type'] !== 'suppression_piece') { |
1108 |
|
// Lorsque la task passe d'un état qui n'est pas "done" à l'état "done". |
1109 |
|
if ($this->getVal("state") !== self::STATUS_DONE |
1110 |
|
&& $this->valF['state'] === self::STATUS_DONE) { |
1111 |
|
if ($this->valF['json_payload'] == '{}' ) { |
1112 |
|
$this->valF['json_payload'] = $this->view_form_json(true); |
1113 |
|
} |
1114 |
|
$json_payload = json_decode($this->valF['json_payload']); |
1115 |
|
// Si le state de la payload est différent du nouveau state de la tache. |
1116 |
|
if ($json_payload->task->state !== $this->valF['state']) { |
1117 |
|
$json_payload->task->state = $this->valF['state']; |
1118 |
|
$task_val = array(); |
1119 |
|
// Avec la nouvelle payload. |
1120 |
|
$task_val['json_payload'] = json_encode($json_payload); |
1121 |
|
$res = $this->f->db->autoExecute( |
1122 |
|
sprintf('%s%s', DB_PREFIXE, "task"), |
1123 |
|
$task_val, |
1124 |
|
DB_AUTOQUERY_UPDATE, |
1125 |
|
sprintf("task = '%s'", $val['task']) |
1126 |
|
); |
1127 |
|
$this->f->addToLog(__METHOD__."(): db->autoexecute(\"".sprintf('%s%s', DB_PREFIXE, 'task')."\", ".print_r($task_val, true).", DB_AUTOQUERY_UPDATE, \"".sprintf("task = '%s'", $val['task'])."\");", VERBOSE_MODE); |
1128 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
1129 |
|
return false; |
1130 |
|
} |
1131 |
|
# Choix de l'autoExecute pour évité le double trigger de l'enregistrement de l'historique |
1132 |
|
# $instance_task->modifier($task_val); |
1133 |
|
} |
1134 |
|
} |
1135 |
|
} |
1136 |
|
} |
1137 |
|
} |
1138 |
|
|
1139 |
// Suivi des notificiations |
// Suivi des notificiations |
1140 |
// En cas de changement de l'état de la tâche de notification, alors |
// En cas de changement de l'état de la tâche de notification, alors |
1188 |
$inst_instruction->setParameter('maj', 175); |
$inst_instruction->setParameter('maj', 175); |
1189 |
$update_instruction = $inst_instruction->modifier($valF_instruction); |
$update_instruction = $inst_instruction->modifier($valF_instruction); |
1190 |
if ($update_instruction === false) { |
if ($update_instruction === false) { |
1191 |
$this->addToLog(__METHOD__."(): ".$inst_instruction->msg, DEBUG_MODE); |
$this->addToLog(__METHOD__."(): ".$inst_instruction->msg, VERBOSE_MODE); |
1192 |
return false; |
return false; |
1193 |
} |
} |
1194 |
} |
} |
1202 |
$inst_in->setParameter('maj', 1); |
$inst_in->setParameter('maj', 1); |
1203 |
$update_in = $inst_in->modifier($valF_in); |
$update_in = $inst_in->modifier($valF_in); |
1204 |
if ($update_in === false) { |
if ($update_in === false) { |
1205 |
$this->addToLog(__METHOD__."(): ".$inst_in->msg, DEBUG_MODE); |
$this->addToLog(__METHOD__."(): ".$inst_in->msg, VERBOSE_MODE); |
1206 |
return false; |
return false; |
1207 |
} |
} |
1208 |
} |
} |
1228 |
$inst_instruction->setParameter('maj', 1); |
$inst_instruction->setParameter('maj', 1); |
1229 |
$update_instruction = $inst_instruction->modifier($valF_instruction); |
$update_instruction = $inst_instruction->modifier($valF_instruction); |
1230 |
if ($update_instruction === false) { |
if ($update_instruction === false) { |
1231 |
$this->addToLog(__METHOD__."(): ".$inst_instruction->msg, DEBUG_MODE); |
$this->addToLog(__METHOD__."(): ".$inst_instruction->msg, VERBOSE_MODE); |
1232 |
return false; |
return false; |
1233 |
} |
} |
1234 |
} |
} |
2549 |
unset($val_task['timestamp_log_hidden']); |
unset($val_task['timestamp_log_hidden']); |
2550 |
$val['task'] = $val_task; |
$val['task'] = $val_task; |
2551 |
// |
// |
2552 |
if ($this->getVal('type') === 'creation_DA' |
if (in_array($this->getVal('type'), array('creation_DA', 'modification_DA'))) { |
|
|| $this->getVal('type') === 'modification_DA') { |
|
2553 |
// |
// |
2554 |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
2555 |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation'); |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation'); |
2558 |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation')); |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation')); |
2559 |
} |
} |
2560 |
// |
// |
2561 |
if ($this->getVal('type') === 'creation_DI' |
if (in_array($this->getVal('type'), array('creation_DI', 'modification_DI', 'depot_DI'))) { |
|
|| $this->getVal('type') === 'modification_DI' |
|
|
|| $this->getVal('type') === 'depot_DI') { |
|
2562 |
// |
// |
2563 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
2564 |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction'); |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction'); |
2576 |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier')); |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier')); |
2577 |
} |
} |
2578 |
// |
// |
2579 |
if ($this->getVal('type') === 'ajout_piece') { |
if (in_array($this->getVal('type'), array('ajout_piece', 'modification_piece', 'suppression_piece'))) { |
|
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
|
|
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
|
|
// Recupération des UID externes |
|
|
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier', 'piece')); |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'modification_piece') { |
|
|
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
|
|
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
|
|
// Recupération des UID externes |
|
|
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier', 'piece')); |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'suppression_piece') { |
|
2580 |
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
2581 |
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
2582 |
// Recupération des UID externes |
// Recupération des UID externes |
2594 |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier')); |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier')); |
2595 |
} |
} |
2596 |
// |
// |
2597 |
if ($this->getVal('type') === 'incompletude_DI') { |
if (in_array($this->getVal('type'), array('incompletude_DI', 'completude_DI'))) { |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
|
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
|
|
// Recupération des UID externes |
|
|
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier')); |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'completude_DI') { |
|
2598 |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2599 |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
2600 |
// Recupération des UID externes |
// Recupération des UID externes |
2601 |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier')); |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier')); |
2602 |
} |
} |
2603 |
// |
// |
2604 |
if ($this->getVal('type') === 'lettre_incompletude' |
if (in_array($this->getVal('type'), array('lettre_incompletude', 'lettre_majoration'))) { |
|
|| $this->getVal('type') === 'lettre_majoration') { |
|
2605 |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2606 |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
2607 |
$val['lettre_petitionnaire'] = $this->get_lettre_petitionnaire_data($val['dossier']['dossier'], $this->getVal('type')); |
$val['lettre_petitionnaire'] = $this->get_lettre_petitionnaire_data($val['dossier']['dossier'], $this->getVal('type')); |
2652 |
// Recupération des UID externes |
// Recupération des UID externes |
2653 |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier', 'decision')); |
$val['external_uids'] = $this->val_external_uid($val, array('dossier_autorisation', 'dossier', 'decision')); |
2654 |
} |
} |
2655 |
if ($this->getVal('type') === 'notification_instruction' |
if (in_array( |
2656 |
|| $this->getVal('type') === 'notification_recepisse' |
$this->getVal('type'), |
2657 |
|| $this->getVal('type') === 'notification_decision' |
array( |
2658 |
|| $this->getVal('type') === 'notification_service_consulte' |
'notification_instruction', |
2659 |
|| $this->getVal('type') === 'notification_tiers_consulte' |
'notification_recepisse', |
2660 |
|| $this->getVal('type') === 'notification_signataire') { |
'notification_decision', |
2661 |
|
'notification_service_consulte', |
2662 |
|
'notification_tiers_consulte', |
2663 |
|
'notification_signataire' |
2664 |
|
) |
2665 |
|
)) { |
2666 |
// |
// |
2667 |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2668 |
$dossier_id = isset($val['dossier']['dossier']) === true ? $val['dossier']['dossier'] : null; |
$dossier_id = isset($val['dossier']['dossier']) === true ? $val['dossier']['dossier'] : null; |