39 |
'notification_service_consulte', |
'notification_service_consulte', |
40 |
'notification_tiers_consulte', |
'notification_tiers_consulte', |
41 |
'notification_depot_demat', |
'notification_depot_demat', |
42 |
'notification_commune' |
'notification_commune', |
43 |
|
'lettre_incompletude', |
44 |
|
'lettre_majoration' |
45 |
); |
); |
46 |
|
|
47 |
/** |
/** |
62 |
); |
); |
63 |
|
|
64 |
/** |
/** |
65 |
|
* Liste des types de tâche pouvant avoir des documents associés |
66 |
|
*/ |
67 |
|
const TASK_WITH_DOCUMENT = array( |
68 |
|
'add_piece', |
69 |
|
'avis_consultation', |
70 |
|
'pec_metier_consultation' |
71 |
|
); |
72 |
|
|
73 |
|
/** |
74 |
* Catégorie de la tâche |
* Catégorie de la tâche |
75 |
*/ |
*/ |
76 |
var $category = PLATAU; |
var $category = PLATAU; |
398 |
case "incompletude_DI": |
case "incompletude_DI": |
399 |
$value_type = __('incomplétude DI'); |
$value_type = __('incomplétude DI'); |
400 |
break; |
break; |
401 |
|
case "lettre_incompletude": |
402 |
|
$value_type = __('Lettre au pétitionnaire d\'incompletude'); |
403 |
|
break; |
404 |
|
case "lettre_majoration": |
405 |
|
$value_type = __('Lettre au pétitionnaire de majoration'); |
406 |
|
break; |
407 |
} |
} |
408 |
|
|
409 |
$contenu_type[1][] = $value_type; |
$contenu_type[1][] = $value_type; |
434 |
) { |
) { |
435 |
$external_uid = $json_payload['external_uids']['dossier']; |
$external_uid = $json_payload['external_uids']['dossier']; |
436 |
} elseif (array_key_exists('external_uids', $json_payload) |
} elseif (array_key_exists('external_uids', $json_payload) |
437 |
&& array_key_exists('dossier', $json_payload['external_uids'])) { |
&& array_key_exists('demande', $json_payload['external_uids'])) { |
438 |
$external_uid = $json_payload['external_uids']['dossier']; |
$external_uid = $json_payload['external_uids']['demande']; |
439 |
} |
} |
440 |
// Recherche l'external uid dans la base de données pour récupèrer le numéro de |
// Recherche l'external uid dans la base de données pour récupèrer le numéro de |
441 |
// DI / DA correspondant. On stocke le numéro de dossier dans la propriété val |
// DI / DA correspondant. On stocke le numéro de dossier dans la propriété val |
536 |
// parent::setVal($form, $maj, $validation); |
// parent::setVal($form, $maj, $validation); |
537 |
// |
// |
538 |
if ($this->getVal('stream') == "output" |
if ($this->getVal('stream') == "output" |
539 |
&& $this->getVal('state') !== self::STATUS_DONE) { |
&& ($this->getVal('state') !== self::STATUS_DONE |
540 |
|
|| $this->getVal('json_payload') === "{}")) { |
541 |
// |
// |
542 |
$form->setVal('json_payload', $this->view_form_json(true)); |
$form->setVal('json_payload', $this->view_form_json(true)); |
543 |
} else { |
} else { |
544 |
$form->setVal('json_payload', json_encode(json_decode($this->getVal('json_payload'), true), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); |
$form->setVal('json_payload', json_encode(json_decode($this->getVal('json_payload'), true), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); |
545 |
} |
} |
546 |
|
// Gestion du contenu de l'historique |
547 |
|
if ($this->getVal('timestamp_log') !== '' |
548 |
|
&& $this->getVal('timestamp_log') !== null) { |
549 |
|
// |
550 |
|
$form->setVal('timestamp_log', $this->getVal('timestamp_log')); |
551 |
|
} |
552 |
} |
} |
553 |
|
|
554 |
function setLib(&$form, $maj) { |
function setLib(&$form, $maj) { |
755 |
FROM %1$stask |
FROM %1$stask |
756 |
%2$s |
%2$s |
757 |
%3$s |
%3$s |
758 |
|
ORDER BY task ASC |
759 |
', |
', |
760 |
DB_PREFIXE, |
DB_PREFIXE, |
761 |
empty($search_values) === false ? ' WHERE ' : '', |
empty($search_values) === false ? ' WHERE ' : '', |
867 |
$this->valF['last_modification_date'] = date('Y-m-d'); |
$this->valF['last_modification_date'] = date('Y-m-d'); |
868 |
$this->valF['last_modification_time'] = date('H:i:s'); |
$this->valF['last_modification_time'] = date('H:i:s'); |
869 |
if ($val['stream'] === 'output') { |
if ($val['stream'] === 'output') { |
870 |
$this->valF['json_payload'] = "{}"; |
// Lorsque la task passe d'un état qui n'est pas "done" à l'état "done" |
871 |
if ($this->getVal("state") !== self::STATUS_DONE |
if ($this->getVal("state") !== self::STATUS_DONE |
872 |
&& $this->valF['state'] === self::STATUS_DONE) { |
&& $this->valF['state'] === self::STATUS_DONE) { |
873 |
// |
// |
874 |
$this->valF['json_payload'] = $this->view_form_json(true); |
$this->valF['json_payload'] = $this->view_form_json(true); |
875 |
} |
} |
876 |
|
// Lorsque la task passe d'un état "done" à un état qui n'est pas "done" |
877 |
|
if ($this->getVal("state") === self::STATUS_DONE |
878 |
|
&& $this->valF['state'] !== self::STATUS_DONE) { |
879 |
|
// |
880 |
|
$this->valF['json_payload'] = "{}"; |
881 |
|
} |
882 |
} |
} |
883 |
|
|
884 |
return true; |
return true; |
1044 |
$valF_instruction['date_envoi_rar'] = date('d/m/Y'); |
$valF_instruction['date_envoi_rar'] = date('d/m/Y'); |
1045 |
$valF_instruction['date_retour_rar'] = date('d/m/Y', strtotime('now + 1 day')); |
$valF_instruction['date_retour_rar'] = date('d/m/Y', strtotime('now + 1 day')); |
1046 |
// Action spécifique pour identifier que la modification |
// Action spécifique pour identifier que la modification |
1047 |
// est une nootification de demandeur |
// est une notification de demandeur |
1048 |
$inst_instruction->setParameter('maj', 175); |
$inst_instruction->setParameter('maj', 175); |
1049 |
$update_instruction = $inst_instruction->modifier($valF_instruction); |
$update_instruction = $inst_instruction->modifier($valF_instruction); |
1050 |
if ($update_instruction === false) { |
if ($update_instruction === false) { |
1137 |
// Si la tâche est de type ajout_piece et de stream input alors on ajoute le fichier |
// Si la tâche est de type ajout_piece et de stream input alors on ajoute le fichier |
1138 |
// et on ajoute l'uid dans le champ json_payload avant l'ajout de la tâche |
// et on ajoute l'uid dans le champ json_payload avant l'ajout de la tâche |
1139 |
if (isset($params['val']['type']) |
if (isset($params['val']['type']) |
1140 |
&& ($params['val']['type'] == "add_piece" || $params['val']['type'] == "avis_consultation") |
&& in_array($params['val']['type'], self::TASK_WITH_DOCUMENT) |
1141 |
&& isset($params['val']['stream']) |
&& isset($params['val']['stream']) |
1142 |
&& $params['val']['stream'] == "input" ) { |
&& $params['val']['stream'] == "input" ) { |
1143 |
// |
// |
1173 |
} |
} |
1174 |
} |
} |
1175 |
|
|
1176 |
// Mise à jour du DI |
// Valeurs de la tâche |
1177 |
$valF = array( |
$valF = array( |
1178 |
'task' => '', |
'task' => '', |
1179 |
'type' => $params['val']['type'], |
'type' => $params['val']['type'], |
1191 |
'comment' => null, |
'comment' => null, |
1192 |
); |
); |
1193 |
|
|
1194 |
// tâche sortante |
// Gestion de la mise à jour des tâches sortantes |
1195 |
$typeNonConcerne = array( |
$typeNonConcerne = array( |
1196 |
'notification_recepisse', |
'notification_recepisse', |
1197 |
'notification_instruction', |
'notification_instruction', |
1201 |
); |
); |
1202 |
if ($valF["stream"] == "output" |
if ($valF["stream"] == "output" |
1203 |
&& ! in_array($valF['type'], $typeNonConcerne)) { |
&& ! in_array($valF['type'], $typeNonConcerne)) { |
1204 |
// TODO expliquer ce code |
// Vérification de l'existance d'une tâche pour l'objet concerné |
1205 |
$task_exists = $this->task_exists($valF['type'], $valF['object_id'], $valF['dossier']); |
// La vérification diffère en fonction de certains types de tâche |
1206 |
|
$search_values_common = array( |
1207 |
|
sprintf('state != \'%s\'', self::STATUS_CANCELED), |
1208 |
|
sprintf('state != \'%s\'', self::STATUS_DONE), |
1209 |
|
); |
1210 |
|
$search_values_others = array( |
1211 |
|
sprintf('type = \'%s\'', $valF['type']), |
1212 |
|
sprintf('(object_id = \'%s\' OR dossier = \'%s\')', $valF['object_id'], $valF['dossier']), |
1213 |
|
); |
1214 |
|
$search_values_specifics = array( |
1215 |
|
sprintf('object_id = \'%s\'', $valF['object_id']), |
1216 |
|
); |
1217 |
|
|
1218 |
|
// Recherche multi-critères sur les tâches |
1219 |
|
// Si l'object id/dossier à des tâches de type $valF['type'] qui lui est associé |
1220 |
|
// Et que ces tâches ont des statut différents de canceled et done |
1221 |
|
// Alors on récupère ces tâches |
1222 |
|
// Sinon return false |
1223 |
|
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_others)); |
1224 |
|
|
1225 |
|
// S'il n'existe pas de tâche de type 'modification DI' pour l'object id/dossier |
1226 |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
1227 |
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
// On se réfère à la tâche de type 'creation DI' de l'object id |
1228 |
|
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'creation_DI'"))); |
1229 |
} |
} |
1230 |
|
// S'il n'existe pas de tâche de type 'modification DA' pour l'object id/dossier |
1231 |
if ($valF['type'] === 'modification_DA' && $task_exists === false) { |
if ($valF['type'] === 'modification_DA' && $task_exists === false) { |
1232 |
$task_exists = $this->task_exists('creation_DA', $valF['object_id']); |
// On se réfère à la tâche de type 'creation DA' de l'object id |
1233 |
|
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'creation_DA'"))); |
1234 |
} |
} |
1235 |
if ($valF['type'] === 'ajout_piece') { |
if ($valF['type'] === 'ajout_piece') { |
1236 |
$task_exists = $this->task_exists('ajout_piece', $valF['object_id']); |
// On se réfère à la tâche de type 'ajout piece' de l'object id |
1237 |
|
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'ajout_piece'"))); |
1238 |
} |
} |
1239 |
if ($valF['type'] === 'creation_consultation') { |
if ($valF['type'] === 'creation_consultation') { |
1240 |
$task_exists = $this->task_exists('creation_consultation', $valF['object_id']); |
// On se réfère à la tâche de type 'creation consultation' de l'object id |
1241 |
|
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'creation_consultation'"))); |
1242 |
} |
} |
1243 |
|
// S'il existe une tâche pour l'objet concerné, pas d'ajout de nouvelle |
1244 |
|
// tâche mais mise à jour de l'existante |
1245 |
if ($task_exists !== false) { |
if ($task_exists !== false) { |
1246 |
$inst_task = $this->f->get_inst__om_dbform(array( |
// Plusieurs tâches pourraient exister, elles sont contôler par ordre croissant |
1247 |
"obj" => "task", |
foreach ($task_exists as $task) { |
1248 |
"idx" => $task_exists, |
$inst_task = $this->f->get_inst__om_dbform(array( |
1249 |
)); |
"obj" => "task", |
1250 |
$update_state = $inst_task->getVal('state'); |
"idx" => $task['task'], |
1251 |
if (isset($params['update_val']['state']) === true) { |
)); |
1252 |
$update_state = $params['update_val']['state']; |
$update_state = $inst_task->getVal('state'); |
1253 |
} |
if (isset($params['update_val']['state']) === true) { |
1254 |
$update_params = array( |
$update_state = $params['update_val']['state']; |
1255 |
'val' => array( |
} |
1256 |
'state' => $update_state, |
$object_id = $inst_task->getVal('object_id'); |
1257 |
), |
if (!empty($valF['object_id'])) { |
1258 |
'object_id' => $valF['object_id'], |
$object_id = $valF['object_id']; |
1259 |
); |
} |
1260 |
return $inst_task->update_task($update_params); |
// Pour être mise à jour, la tâche existante ne doit pas être en cours de traitement |
1261 |
|
$task_pending = $inst_task->getVal('state') === self::STATUS_PENDING |
1262 |
|
&& $update_state === self::STATUS_PENDING |
1263 |
|
&& $inst_task->getVal('object_id') !== $object_id; |
1264 |
|
if ($task_pending === false) { |
1265 |
|
$update_params = array( |
1266 |
|
'val' => array( |
1267 |
|
'state' => $update_state, |
1268 |
|
), |
1269 |
|
'object_id' => $object_id, |
1270 |
|
); |
1271 |
|
return $inst_task->update_task($update_params); |
1272 |
|
} |
1273 |
|
} |
1274 |
} |
} |
1275 |
} |
} |
1276 |
$add = $this->ajouter($valF); |
$add = $this->ajouter($valF); |
1307 |
'creation_time' => $this->getVal('creation_time'), |
'creation_time' => $this->getVal('creation_time'), |
1308 |
'last_modification_date' => date('Y-m-d'), |
'last_modification_date' => date('Y-m-d'), |
1309 |
'last_modification_time' => date('H:i:s'), |
'last_modification_time' => date('H:i:s'), |
1310 |
'comment' => $this->getVal('comment'), |
'comment' => isset($params['comment']) == true ? $params['comment'] : $this->getVal('comment'), |
1311 |
); |
); |
1312 |
$update = $this->modifier($valF); |
$update = $this->modifier($valF); |
1313 |
if ($update === false) { |
if ($update === false) { |
1536 |
if (isset($val_dt['tax_ext_pret']) === true |
if (isset($val_dt['tax_ext_pret']) === true |
1537 |
&& $val_dt['tax_ext_pret'] === 'f') { |
&& $val_dt['tax_ext_pret'] === 'f') { |
1538 |
// |
// |
1539 |
$val_dt['tax_su_princ_surf1'] = $val_dt['tax_surf_tot_cstr']; |
$val_dt['tax_su_princ_surf1'] = isset($val_dt['tax_surf_tot_cstr']) === true ? $val_dt['tax_surf_tot_cstr'] : ''; |
1540 |
$val_dt['tax_su_princ_surf_stat1'] = $val_dt['tax_surf_loc_stat']; |
$val_dt['tax_su_princ_surf_stat1'] = isset($val_dt['tax_surf_loc_stat']) === true ? $val_dt['tax_surf_loc_stat'] : ''; |
1541 |
} |
} |
1542 |
if (isset($val_dt['tax_ext_pret']) === true |
if (isset($val_dt['tax_ext_pret']) === true |
1543 |
&& $val_dt['tax_ext_pret'] === 't') { |
&& $val_dt['tax_ext_pret'] === 't') { |
1546 |
if (preg_match('/[pP].*[lL].*[aA].*[iI]/', $val_dt['tax_ext_desc']) === 1 |
if (preg_match('/[pP].*[lL].*[aA].*[iI]/', $val_dt['tax_ext_desc']) === 1 |
1547 |
|| preg_match('/[lL].*[lL].*[tT].*[sS]/', $val_dt['tax_ext_desc']) === 1) { |
|| preg_match('/[lL].*[lL].*[tT].*[sS]/', $val_dt['tax_ext_desc']) === 1) { |
1548 |
// |
// |
1549 |
$val_dt['tax_su_princ_surf2'] = $val_dt['tax_surf_tot_cstr']; |
$val_dt['tax_su_princ_surf2'] = isset($val_dt['tax_surf_tot_cstr']) === true ? $val_dt['tax_surf_tot_cstr'] : ''; |
1550 |
$val_dt['tax_su_princ_surf_stat2'] = $val_dt['tax_surf_loc_stat']; |
$val_dt['tax_su_princ_surf_stat2'] = isset($val_dt['tax_surf_loc_stat']) === true ? $val_dt['tax_surf_loc_stat'] : ''; |
1551 |
} |
} |
1552 |
// if (preg_match('/[pP].*[tT].*[zZ]/', $val_dt['tax_ext_desc']) === 1) { |
// if (preg_match('/[pP].*[tT].*[zZ]/', $val_dt['tax_ext_desc']) === 1) { |
1553 |
// $val_dt['tax_su_princ_surf4'] = $val_dt['tax_surf_tot_cstr']; |
// $val_dt['tax_su_princ_surf4'] = $val_dt['tax_surf_tot_cstr']; |
1786 |
return $val_in; |
return $val_in; |
1787 |
} |
} |
1788 |
|
|
1789 |
|
/** |
1790 |
|
* Récupère les informations concernant la lettre au pétitionnaire. |
1791 |
|
* |
1792 |
|
* @param string identifiant du dossier |
1793 |
|
* @param string type de tâche |
1794 |
|
* @param array paramètre supplémentaire permettant de récupérer les informations |
1795 |
|
* |
1796 |
|
* @return array information concernant la lettre au pétitionnaire |
1797 |
|
*/ |
1798 |
|
protected function get_lettre_petitionnaire_data($dossier, $type, $extra_params = array()) { |
1799 |
|
// Si la date limite de notification n'a pas été dépassé le type de lettre est 1 |
1800 |
|
// Si la date a été dépassé et qu'il s'agit d'une demande de pièce le type est 3 |
1801 |
|
// Si la date a été dépassé et qu'il s'agit d'une prolongation le type est 4 |
1802 |
|
// Le type de document dépend du type de pièce |
1803 |
|
$nomTypeLettre = ''; |
1804 |
|
$nomTypeDocument = ''; |
1805 |
|
if ($type === 'lettre_incompletude') { |
1806 |
|
$nomTypeLettre = '3'; |
1807 |
|
$nomTypeDocument = '4'; |
1808 |
|
} elseif ($type === 'lettre_majoration') { |
1809 |
|
$nomTypeLettre = '4'; |
1810 |
|
$nomTypeDocument = '6'; |
1811 |
|
} |
1812 |
|
|
1813 |
|
$inst_di = $this->f->get_inst__om_dbform(array( |
1814 |
|
"obj" => "dossier", |
1815 |
|
"idx" => $dossier, |
1816 |
|
)); |
1817 |
|
$date_limite_notification = DateTime::createFromFormat('Y-m-d', $inst_di->getVal('date_notification_delai')); |
1818 |
|
$aujourdhui = new DateTime(); |
1819 |
|
if (! $date_limite_notification instanceof DateTime) { |
1820 |
|
$nomTypeLettre = ''; |
1821 |
|
$nomTypeDocument = ''; |
1822 |
|
} elseif ($aujourdhui < $date_limite_notification) { |
1823 |
|
$nomTypeLettre = '1'; |
1824 |
|
$nomTypeDocument = '3'; |
1825 |
|
} |
1826 |
|
|
1827 |
|
return array( |
1828 |
|
'nomEtatLettre' => '3', |
1829 |
|
'nomModaliteNotifMetier' => '4', |
1830 |
|
'nomTypeLettre' => $nomTypeLettre, |
1831 |
|
'nomTypeDocument' => $nomTypeDocument |
1832 |
|
); |
1833 |
|
} |
1834 |
|
|
1835 |
protected function sort_instruction_data(array $values, array $res) { |
protected function sort_instruction_data(array $values, array $res) { |
1836 |
$fields = array( |
$fields = array( |
1837 |
"date_evenement", |
"date_evenement", |
1942 |
)); |
)); |
1943 |
$ad = $inst_di->getVal('avis_decision'); |
$ad = $inst_di->getVal('avis_decision'); |
1944 |
$val_ad = array(); |
$val_ad = array(); |
1945 |
if ($ad !== null) { |
if ($ad !== null && trim($ad) !== '') { |
1946 |
$inst_ad = $this->f->get_inst__om_dbform(array( |
$inst_ad = $this->f->get_inst__om_dbform(array( |
1947 |
"obj" => "avis_decision", |
"obj" => "avis_decision", |
1948 |
"idx" => $ad, |
"idx" => $ad, |
2004 |
|
|
2005 |
protected function view_form_json($in_field = false) { |
protected function view_form_json($in_field = false) { |
2006 |
// |
// |
2007 |
if ($this->f->get_submitted_post_value('valid') === null |
$check_state = isset($this->valF['state']) === true ? $this->valF['state'] : $this->getVal('state'); |
2008 |
&& $this->getVal('state') !== self::STATUS_CANCELED) { |
if ($check_state !== self::STATUS_CANCELED) { |
2009 |
// Liste des valeurs à afficher |
// Liste des valeurs à afficher |
2010 |
$val = array(); |
$val = array(); |
2011 |
// |
// |
2013 |
foreach ($val_task as $key => $value) { |
foreach ($val_task as $key => $value) { |
2014 |
$val_task[$key] = strip_tags($value); |
$val_task[$key] = strip_tags($value); |
2015 |
} |
} |
2016 |
$val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true); |
|
2017 |
unset($val_task['timestamp_log_hidden']); |
// Vérifie pour les tâches dont l'affichage de la payload est calculée si l'objet |
2018 |
$val['task'] = $val_task; |
// de référence de la tâche existe. |
2019 |
// |
$objectRefExist = true; |
2020 |
if ($this->getVal('type') === 'creation_DA' |
if ($val_task['stream'] === 'output' |
2021 |
|| $this->getVal('type') === 'modification_DA') { |
&& (empty($val_task['json_payload']) || $val_task['json_payload'] === '{}')) { |
2022 |
// |
$objectRefExist = $this->does_referenced_object_exist( |
2023 |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
$val_task['object_id'], |
2024 |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation'); |
$val_task['type'] |
2025 |
$val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']); |
); |
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier_autorisation']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'creation_DI' |
|
|
|| $this->getVal('type') === 'modification_DI' |
|
|
|| $this->getVal('type') === 'depot_DI') { |
|
|
// |
|
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
|
|
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction'); |
|
|
$val['demandeur'] = $this->get_demandeurs_data($val['dossier']['dossier']); |
|
|
$architecte = isset($val['donnees_techniques']['architecte']) === true ? $val['donnees_techniques']['architecte'] : null; |
|
|
$val['architecte'] = $this->get_architecte_data($architecte); |
|
|
$val['dossier_parcelle'] = $this->get_parcelles_data('dossier', $val['dossier']['dossier']); |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'qualification_DI') { |
|
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'ajout_piece') { |
|
|
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
|
|
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val_external_uid['piece'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'piece'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'decision_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'))); |
|
|
$val['instruction']['final'] = 't'; |
|
|
if (isset($val['instruction']['signataire_arrete']) === true) { |
|
|
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
|
|
} |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'incompletude_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'))); |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === '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'))); |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'pec_metier_consultation') { |
|
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
|
|
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val_external_uid['dossier_consultation'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier_consultation'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'avis_consultation') { |
|
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
|
|
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
|
|
$val['avis_decision'] = $this->get_avis_decision_data($this->getVal('dossier')); |
|
|
if (isset($val['instruction']['signataire_arrete']) === true) { |
|
|
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
|
|
} |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val_external_uid['dossier_consultation'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier_consultation'); |
|
|
$val_external_uid['avis_dossier_consultation'] = $this->get_external_uid($this->getVal('object_id'), 'avis_dossier_consultation'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// XXX WIP |
|
|
if ($this->getVal('type') === 'creation_consultation') { |
|
|
// |
|
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
|
|
$val['consultation'] = $this->get_consultation_data($this->getVal('object_id')); |
|
|
$val['service'] = $this->get_service_data($val['consultation']['service']); |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
2026 |
} |
} |
2027 |
// |
|
2028 |
if ($this->getVal('type') === 'envoi_CL') { |
// Si l'objet de référence n'existe pas log le numéro de la tâche concerné et |
2029 |
|
// renvoie une payload contenant le message d'erreur. |
2030 |
|
// Sinon constitue la payload du json. |
2031 |
|
if (! $objectRefExist) { |
2032 |
|
$this->f->addToLog( |
2033 |
|
sprintf( |
2034 |
|
__('Impossible de récupérer la payload car l\'objet de réference n\'existe pas pour la tâche : %s'), |
2035 |
|
$val_task['task'] |
2036 |
|
), |
2037 |
|
DEBUG_MODE |
2038 |
|
); |
2039 |
|
$val = __('Impossible de recuperer la payload car l\'objet de reference n\'existe pas.'); |
2040 |
|
} else { |
2041 |
|
|
2042 |
|
$val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true); |
2043 |
|
unset($val_task['timestamp_log_hidden']); |
2044 |
|
$val['task'] = $val_task; |
2045 |
// |
// |
2046 |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
if ($this->getVal('type') === 'creation_DA' |
2047 |
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
|| $this->getVal('type') === 'modification_DA') { |
2048 |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($val['dossier']['dossier_autorisation']); |
// |
2049 |
$val_external_uid = array(); |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
2050 |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation'); |
2051 |
$val_external_uid['dossier'] = $this->get_external_uid($this->getVal('dossier'), 'dossier'); |
$val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']); |
2052 |
$val_external_uid['decision'] = $this->get_external_uid($this->getVal('object_id'), 'instruction'); |
$val_external_uid = array(); |
2053 |
if ($val_external_uid['decision'] === '') { |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier_autorisation']['dossier_autorisation'], 'dossier_autorisation'); |
2054 |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
$val['external_uids'] = $val_external_uid; |
|
"obj" => "instruction", |
|
|
"idx" => $this->getVal('object_id'), |
|
|
)); |
|
|
$val_external_uid['decision'] = $this->get_external_uid($inst_instruction->get_related_instructions_next('retour_signature'), 'instruction'); |
|
2055 |
} |
} |
2056 |
$val['external_uids'] = $val_external_uid; |
// |
2057 |
} |
if ($this->getVal('type') === 'creation_DI' |
2058 |
if ($this->getVal('type') === 'notification_instruction' |
|| $this->getVal('type') === 'modification_DI' |
2059 |
|| $this->getVal('type') === 'notification_recepisse' |
|| $this->getVal('type') === 'depot_DI') { |
2060 |
|| $this->getVal('type') === 'notification_decision' |
// |
2061 |
|| $this->getVal('type') === 'notification_service_consulte' |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
2062 |
|| $this->getVal('type') === 'notification_tiers_consulte') { |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction'); |
2063 |
// |
$val['demandeur'] = $this->get_demandeurs_data($val['dossier']['dossier']); |
2064 |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
$architecte = isset($val['donnees_techniques']['architecte']) === true ? $val['donnees_techniques']['architecte'] : null; |
2065 |
$dossier_id = isset($val['dossier']['dossier']) === true ? $val['dossier']['dossier'] : null; |
$val['architecte'] = $this->get_architecte_data($architecte); |
2066 |
$val['demandeur'] = $this->get_demandeurs_data($dossier_id); |
$val['dossier_parcelle'] = $this->get_parcelles_data('dossier', $val['dossier']['dossier']); |
2067 |
$val['instruction_notification'] = $this->get_instruction_notification_data($this->getVal('category'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
$val_external_uid = array(); |
2068 |
$instruction_id = isset($val['instruction_notification']['instruction']) === true ? $val['instruction_notification']['instruction'] : null; |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2069 |
$instruction_annexes = isset($val['instruction_notification']['annexes']) === true ? $val['instruction_notification']['annexes'] : null; |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2070 |
$val['instruction'] = $this->get_instruction_data($dossier_id, 'with-id', array('with-id' => $instruction_id)); |
$val['external_uids'] = $val_external_uid; |
2071 |
// Précise qu'il s'agit d'une instruction final si l'instruction est liée à une |
} |
2072 |
// demande dont le type ne génère pas de dossier |
// |
2073 |
if ($this->is_demande_instruction_recepisse_without_dossier($instruction_id) === true) { |
if ($this->getVal('type') === 'qualification_DI') { |
2074 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2075 |
|
$val_external_uid = array(); |
2076 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2077 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2078 |
|
$val['external_uids'] = $val_external_uid; |
2079 |
|
} |
2080 |
|
// |
2081 |
|
if ($this->getVal('type') === 'ajout_piece') { |
2082 |
|
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
2083 |
|
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
2084 |
|
$val_external_uid = array(); |
2085 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2086 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2087 |
|
$val_external_uid['piece'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'piece'); |
2088 |
|
$val['external_uids'] = $val_external_uid; |
2089 |
|
} |
2090 |
|
// |
2091 |
|
if ($this->getVal('type') === 'decision_DI') { |
2092 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2093 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
2094 |
$val['instruction']['final'] = 't'; |
$val['instruction']['final'] = 't'; |
2095 |
|
if (isset($val['instruction']['signataire_arrete']) === true) { |
2096 |
|
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
2097 |
|
} |
2098 |
|
$val_external_uid = array(); |
2099 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2100 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2101 |
|
$val['external_uids'] = $val_external_uid; |
2102 |
|
} |
2103 |
|
// |
2104 |
|
if ($this->getVal('type') === 'incompletude_DI') { |
2105 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2106 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
2107 |
|
$val_external_uid = array(); |
2108 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2109 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2110 |
|
$val['external_uids'] = $val_external_uid; |
2111 |
|
} |
2112 |
|
// |
2113 |
|
if ($this->getVal('type') === 'completude_DI') { |
2114 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2115 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
2116 |
|
$val_external_uid = array(); |
2117 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2118 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2119 |
|
$val['external_uids'] = $val_external_uid; |
2120 |
|
} |
2121 |
|
// |
2122 |
|
if ($this->getVal('type') === 'lettre_incompletude' |
2123 |
|
|| $this->getVal('type') === 'lettre_majoration') { |
2124 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2125 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
2126 |
|
$val['lettre_petitionnaire'] = $this->get_lettre_petitionnaire_data($val['dossier']['dossier'], $this->getVal('type')); |
2127 |
|
$val_external_uid = array(); |
2128 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2129 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2130 |
|
$val['external_uids'] = $val_external_uid; |
2131 |
|
} |
2132 |
|
// |
2133 |
|
if ($this->getVal('type') === 'pec_metier_consultation') { |
2134 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2135 |
|
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
2136 |
|
$val_external_uid = array(); |
2137 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2138 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2139 |
|
$val_external_uid['dossier_consultation'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier_consultation'); |
2140 |
|
$val['external_uids'] = $val_external_uid; |
2141 |
|
} |
2142 |
|
// |
2143 |
|
if ($this->getVal('type') === 'avis_consultation') { |
2144 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2145 |
|
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
2146 |
|
$val['avis_decision'] = $this->get_avis_decision_data($this->getVal('dossier')); |
2147 |
|
if (isset($val['instruction']['signataire_arrete']) === true) { |
2148 |
|
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
2149 |
|
} |
2150 |
|
$val_external_uid = array(); |
2151 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2152 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2153 |
|
$val_external_uid['dossier_consultation'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier_consultation'); |
2154 |
|
$val_external_uid['avis_dossier_consultation'] = $this->get_external_uid($this->getVal('object_id'), 'avis_dossier_consultation'); |
2155 |
|
$val['external_uids'] = $val_external_uid; |
2156 |
|
} |
2157 |
|
// XXX WIP |
2158 |
|
if ($this->getVal('type') === 'creation_consultation') { |
2159 |
|
// |
2160 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2161 |
|
$val['consultation'] = $this->get_consultation_data($this->getVal('object_id')); |
2162 |
|
$val['service'] = $this->get_service_data($val['consultation']['service']); |
2163 |
|
$val_external_uid = array(); |
2164 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2165 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2166 |
|
$val['external_uids'] = $val_external_uid; |
2167 |
|
} |
2168 |
|
// |
2169 |
|
if ($this->getVal('type') === 'envoi_CL') { |
2170 |
|
// |
2171 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2172 |
|
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
2173 |
|
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($val['dossier']['dossier_autorisation']); |
2174 |
|
$val_external_uid = array(); |
2175 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2176 |
|
$val_external_uid['dossier'] = $this->get_external_uid($this->getVal('dossier'), 'dossier'); |
2177 |
|
$val_external_uid['decision'] = $this->get_external_uid($this->getVal('object_id'), 'instruction'); |
2178 |
|
if ($val_external_uid['decision'] === '') { |
2179 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
2180 |
|
"obj" => "instruction", |
2181 |
|
"idx" => $this->getVal('object_id'), |
2182 |
|
)); |
2183 |
|
$val_external_uid['decision'] = $this->get_external_uid($inst_instruction->get_related_instructions_next('retour_signature'), 'instruction'); |
2184 |
|
} |
2185 |
|
$val['external_uids'] = $val_external_uid; |
2186 |
|
} |
2187 |
|
if ($this->getVal('type') === 'notification_instruction' |
2188 |
|
|| $this->getVal('type') === 'notification_recepisse' |
2189 |
|
|| $this->getVal('type') === 'notification_decision' |
2190 |
|
|| $this->getVal('type') === 'notification_service_consulte' |
2191 |
|
|| $this->getVal('type') === 'notification_tiers_consulte') { |
2192 |
|
// |
2193 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2194 |
|
$dossier_id = isset($val['dossier']['dossier']) === true ? $val['dossier']['dossier'] : null; |
2195 |
|
$val['demandeur'] = $this->get_demandeurs_data($dossier_id); |
2196 |
|
$val['instruction_notification'] = $this->get_instruction_notification_data($this->getVal('category'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
2197 |
|
$instruction_id = isset($val['instruction_notification']['instruction']) === true ? $val['instruction_notification']['instruction'] : null; |
2198 |
|
$instruction_annexes = isset($val['instruction_notification']['annexes']) === true ? $val['instruction_notification']['annexes'] : null; |
2199 |
|
$val['instruction'] = $this->get_instruction_data($dossier_id, 'with-id', array('with-id' => $instruction_id)); |
2200 |
|
// Précise qu'il s'agit d'une instruction final si l'instruction est liée à une |
2201 |
|
// demande dont le type ne génère pas de dossier |
2202 |
|
if ($this->is_demande_instruction_recepisse_without_dossier($instruction_id) === true) { |
2203 |
|
$val['instruction']['final'] = 't'; |
2204 |
|
} |
2205 |
|
$val_external_uid = array(); |
2206 |
|
// Affiche l'identifiant externe lié à l'instruction si cette combinaison existe, sinon celui lié au dossier |
2207 |
|
$val_external_uid['demande'] = $this->get_external_uid($instruction_id, 'demande') !== '' ? $this->get_external_uid($instruction_id, 'demande') : $this->get_external_uid($dossier_id, 'demande'); |
2208 |
|
$val_external_uid['demande (instruction)'] = $this->get_external_uid($instruction_id, 'demande', PORTAL, 'ASC'); |
2209 |
|
$val_external_uid['instruction_notification'] = $this->get_external_uid($this->getVal('object_id'), 'instruction_notification', PORTAL); |
2210 |
|
$val['external_uids'] = $val_external_uid; |
2211 |
|
} |
2212 |
|
// |
2213 |
|
if ($this->getVal('type') === 'prescription') { |
2214 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2215 |
|
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
2216 |
|
$val['avis_decision'] = $this->get_avis_decision_data($this->getVal('dossier')); |
2217 |
|
if (isset($val['instruction']['signataire_arrete']) === true) { |
2218 |
|
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
2219 |
|
} |
2220 |
|
$val_external_uid = array(); |
2221 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2222 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2223 |
|
$val_external_uid['dossier_consultation'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier_consultation'); |
2224 |
|
$val_external_uid['prescription'] = $this->get_external_uid($this->getVal('object_id'), 'prescription'); |
2225 |
|
$val['external_uids'] = $val_external_uid; |
2226 |
} |
} |
|
$val_external_uid = array(); |
|
|
// Affiche l'identifiant externe lié à l'instruction si cette combinaison existe, sinon celui lié au dossier |
|
|
$val_external_uid['demande'] = $this->get_external_uid($instruction_id, 'demande') !== '' ? $this->get_external_uid($instruction_id, 'demande') : $this->get_external_uid($dossier_id, 'demande'); |
|
|
$val_external_uid['demande (instruction)'] = $this->get_external_uid($instruction_id, 'demande', PORTAL, 'ASC'); |
|
|
$val_external_uid['instruction_notification'] = $this->get_external_uid($this->getVal('object_id'), 'instruction_notification', PORTAL); |
|
|
$val['external_uids'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'prescription') { |
|
|
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
|
|
$val['instruction'] = $this->get_instruction_data($this->getVal('dossier'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
|
|
$val['avis_decision'] = $this->get_avis_decision_data($this->getVal('dossier')); |
|
|
if (isset($val['instruction']['signataire_arrete']) === true) { |
|
|
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
|
|
} |
|
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
|
|
$val_external_uid['dossier_consultation'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier_consultation'); |
|
|
$val_external_uid['prescription'] = $this->get_external_uid($this->getVal('object_id'), 'prescription'); |
|
|
$val['external_uids'] = $val_external_uid; |
|
2227 |
} |
} |
2228 |
|
|
2229 |
if ($in_field === true) { |
if ($in_field === true) { |
2245 |
'state' => $this->f->get_submitted_post_value('state') |
'state' => $this->f->get_submitted_post_value('state') |
2246 |
), |
), |
2247 |
); |
); |
2248 |
|
if ($this->f->get_submitted_post_value('comment') !== null) { |
2249 |
|
$params['comment'] = $this->f->get_submitted_post_value('comment'); |
2250 |
|
} |
2251 |
$update = $this->update_task($params); |
$update = $this->update_task($params); |
2252 |
$message_class = "valid"; |
$message_class = "valid"; |
2253 |
$message = $this->msg; |
$message = $this->msg; |
2321 |
$result = $this->add_task(array( |
$result = $this->add_task(array( |
2322 |
'val' => array( |
'val' => array( |
2323 |
'stream' => 'input', |
'stream' => 'input', |
2324 |
'json_payload' => html_entity_decode($this->f->get_submitted_post_value('json_payload')), |
'json_payload' => html_entity_decode($this->f->get_submitted_post_value('json_payload'), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401), |
2325 |
'type' => $this->f->get_submitted_post_value('type'), |
'type' => $this->f->get_submitted_post_value('type'), |
2326 |
'category' => $this->f->get_submitted_post_value('category'), |
'category' => $this->f->get_submitted_post_value('category'), |
2327 |
) |
) |
2347 |
function setLayout(&$form, $maj) { |
function setLayout(&$form, $maj) { |
2348 |
// |
// |
2349 |
$form->setBloc('json_payload', 'D', '', 'col_6'); |
$form->setBloc('json_payload', 'D', '', 'col_6'); |
2350 |
$form->setFieldset('json_payload', 'DF', __("json_payload"), "collapsible, startClosed"); |
$fieldset_title_payload = __("json_payload (calculée)"); |
2351 |
|
if ($this->getVal('json_payload') !== "{}") { |
2352 |
|
$fieldset_title_payload = __("json_payload"); |
2353 |
|
} |
2354 |
|
$form->setFieldset('json_payload', 'DF', $fieldset_title_payload, "collapsible, startClosed"); |
2355 |
$form->setBloc('json_payload', 'F'); |
$form->setBloc('json_payload', 'F'); |
2356 |
$form->setBloc('timestamp_log', 'DF', __("historique"), 'col_9 timestamp_log_jsontotab'); |
$form->setBloc('timestamp_log', 'DF', __("historique"), 'col_9 timestamp_log_jsontotab'); |
2357 |
} |
} |
2380 |
&& $stream === 'input') { |
&& $stream === 'input') { |
2381 |
$objects = array('dossier', 'dossier_autorisation', 'demande', ); |
$objects = array('dossier', 'dossier_autorisation', 'demande', ); |
2382 |
} |
} |
2383 |
if (in_array($type, array('decision_DI', 'incompletude_DI', 'completude_DI', )) === true) { |
if (in_array($type, array( |
2384 |
|
'decision_DI', |
2385 |
|
'incompletude_DI', |
2386 |
|
'completude_DI', |
2387 |
|
'lettre_incompletude', |
2388 |
|
'lettre_majoration' |
2389 |
|
)) === true) { |
2390 |
$objects = array('instruction', ); |
$objects = array('instruction', ); |
2391 |
} |
} |
2392 |
if (in_array($type, array('envoi_CL', )) === true) { |
if (in_array($type, array('envoi_CL', )) === true) { |
2463 |
&& $stream === 'input') { |
&& $stream === 'input') { |
2464 |
$tables = array('dossier', 'dossier_autorisation', 'demande', ); |
$tables = array('dossier', 'dossier_autorisation', 'demande', ); |
2465 |
} |
} |
2466 |
if (in_array($type, array('decision_DI', 'incompletude_DI', 'completude_DI', )) === true) { |
if (in_array($type, array( |
2467 |
|
'decision_DI', |
2468 |
|
'incompletude_DI', |
2469 |
|
'completude_DI', |
2470 |
|
'lettre_incompletude', |
2471 |
|
'lettre_majoration' |
2472 |
|
)) === true) { |
2473 |
$tables = array('instruction', ); |
$tables = array('instruction', ); |
2474 |
} |
} |
2475 |
|
if (in_array($type, array('envoi_CL', )) === true) { |
2476 |
|
$objects = array('instruction', ); |
2477 |
|
} |
2478 |
if (in_array($type, array('pec_metier_consultation', )) === true |
if (in_array($type, array('pec_metier_consultation', )) === true |
2479 |
&& $stream === 'output') { |
&& $stream === 'output') { |
2480 |
$tables = array('instruction', ); |
$tables = array('instruction', ); |
2520 |
return $tables; |
return $tables; |
2521 |
} |
} |
2522 |
|
|
2523 |
|
/** |
2524 |
|
* Vérifie si l'objet référencé par la tâche existe en base de données. |
2525 |
|
* |
2526 |
|
* Récupère la liste des tables de référence associé à la tâche à partir |
2527 |
|
* du type de tâche et de son flux (input ou output). |
2528 |
|
* Pour chaque table potentiellement référencé par la tâche on essaye d'instancier |
2529 |
|
* l'objet correspondant à partir de l'identifiant de l'objet de référence de la tâche. |
2530 |
|
* Si l'élément instancié existe renvoie true sinon renvoie false. |
2531 |
|
* |
2532 |
|
* @param string|integer $taskObjectId : identifiant de l'objet de référence de la tâche |
2533 |
|
* @param string $taskType : type de la tâche |
2534 |
|
* @param string $taskStream : flux entrant (output - valeur par défaut) ou sortant (input) |
2535 |
|
* @return boolean |
2536 |
|
*/ |
2537 |
|
protected function does_referenced_object_exist($taskObjectId, string $taskType, string $taskStream = 'output') { |
2538 |
|
$refTables = $this->get_tables_by_task_type($taskType, $taskStream); |
2539 |
|
if (empty($refTables) === true) { |
2540 |
|
$this->f->addToLog( |
2541 |
|
sprintf( |
2542 |
|
__("Impossible de vérifier si l'objet de référence existe, car le type de task '%s' n'a pas de correspondance avec une table dans la méthode %s."), |
2543 |
|
$taskType, |
2544 |
|
"get_tables_by_task_type()" |
2545 |
|
), |
2546 |
|
DEBUG_MODE |
2547 |
|
); |
2548 |
|
return true; |
2549 |
|
} |
2550 |
|
foreach ($refTables as $table) { |
2551 |
|
$inst = $this->f->get_inst__om_dbform(array( |
2552 |
|
'obj' => $table, |
2553 |
|
'idx' => $taskObjectId |
2554 |
|
)); |
2555 |
|
if ($inst->exists() === true) { |
2556 |
|
return true; |
2557 |
|
} |
2558 |
|
} |
2559 |
|
return false; |
2560 |
|
} |
2561 |
|
|
2562 |
} |
} |