29 |
'ajout_piece', |
'ajout_piece', |
30 |
'add_piece', |
'add_piece', |
31 |
'creation_consultation', |
'creation_consultation', |
32 |
|
'modification_DA', |
33 |
'create_DI', |
'create_DI', |
34 |
); |
); |
35 |
|
|
40 |
'create_DI_for_consultation', |
'create_DI_for_consultation', |
41 |
'avis_consultation', |
'avis_consultation', |
42 |
'pec_metier_consultation', |
'pec_metier_consultation', |
43 |
|
'create_message', |
44 |
); |
); |
45 |
|
|
46 |
/** |
/** |
209 |
"idx" => $form->val['dossier'], |
"idx" => $form->val['dossier'], |
210 |
)); |
)); |
211 |
|
|
212 |
if($form->val['type'] == "creation_DA"){ |
if($form->val['type'] == "creation_DA" |
213 |
|
|| $form->val['type'] == "modification_DA"){ |
214 |
|
// |
215 |
$obj_link = 'dossier_autorisation'; |
$obj_link = 'dossier_autorisation'; |
216 |
} else { |
} else { |
217 |
$obj_link = 'dossier_instruction'; |
$obj_link = 'dossier_instruction'; |
381 |
return $ret && $this->correct; |
return $ret && $this->correct; |
382 |
} |
} |
383 |
|
|
384 |
protected function task_exists(string $type, string $object_id) { |
/** |
385 |
|
* [task_exists description] |
386 |
|
* @param string $type [description] |
387 |
|
* @param string $object_id [description] |
388 |
|
* @param bool $is_not_done [description] |
389 |
|
* @return [type] [description] |
390 |
|
*/ |
391 |
|
public function task_exists(string $type, string $object_id, bool $is_not_done = true) { |
392 |
$query = sprintf(' |
$query = sprintf(' |
393 |
SELECT task |
SELECT task |
394 |
FROM %1$stask |
FROM %1$stask |
395 |
WHERE state != \'%2$s\' |
WHERE %2$s |
396 |
AND type = \'%3$s\' |
type = \'%3$s\' |
397 |
AND object_id = \'%4$s\' |
AND object_id = \'%4$s\' |
398 |
', |
', |
399 |
DB_PREFIXE, |
DB_PREFIXE, |
400 |
self::STATUS_DONE, |
$is_not_done == true ? 'state != \''.self::STATUS_DONE.'\' AND' : '', |
401 |
$type, |
$type, |
402 |
$object_id |
$object_id |
403 |
); |
); |
528 |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
529 |
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
530 |
} |
} |
531 |
|
if ($valF['type'] === 'modification_DA' && $task_exists === false) { |
532 |
|
$task_exists = $this->task_exists('creation_DA', $valF['object_id']); |
533 |
|
} |
534 |
if ($task_exists !== false) { |
if ($task_exists !== false) { |
535 |
$inst_task = $this->f->get_inst__om_dbform(array( |
$inst_task = $this->f->get_inst__om_dbform(array( |
536 |
"obj" => "task", |
"obj" => "task", |
583 |
'type' => $this->getVal('type'), |
'type' => $this->getVal('type'), |
584 |
'timestamp_log' => $timestamp_log, |
'timestamp_log' => $timestamp_log, |
585 |
'state' => $params['val']['state'], |
'state' => $params['val']['state'], |
586 |
'object_id' => $this->getVal('object_id'), |
'object_id' => isset($params['object_id']) == true && $this->getVal('type') == 'create_DI' ? $params['object_id'] : $this->getVal('object_id'), |
587 |
'stream' => $this->getVal('stream'), |
'stream' => $this->getVal('stream'), |
588 |
'dossier' => $this->getVal('dossier'), |
'dossier' => $this->getVal('dossier'), |
589 |
'json_payload' => $this->getVal('json_payload'), |
'json_payload' => $this->getVal('json_payload'), |
1081 |
|
|
1082 |
protected function view_form_json($in_field = false) { |
protected function view_form_json($in_field = false) { |
1083 |
// |
// |
1084 |
if ($this->f->get_submitted_post_value('valid') === null) { |
if ($this->f->get_submitted_post_value('valid') === null |
1085 |
|
&& $this->getVal('state') !== self::STATUS_DRAFT) { |
1086 |
// Liste des valeurs à afficher |
// Liste des valeurs à afficher |
1087 |
$val = array(); |
$val = array(); |
1088 |
// |
// |
1093 |
$val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true); |
$val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true); |
1094 |
$val['task'] = $val_task; |
$val['task'] = $val_task; |
1095 |
// |
// |
1096 |
if ($this->getVal('type') === 'creation_DA') { |
if ($this->getVal('type') === 'creation_DA' |
1097 |
|
|| $this->getVal('type') === 'modification_DA') { |
1098 |
|
// |
1099 |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
1100 |
$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'); |
1101 |
$val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']); |
$val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']); |
1121 |
} |
} |
1122 |
// |
// |
1123 |
if ($this->getVal('type') === 'qualification_DI') { |
if ($this->getVal('type') === 'qualification_DI') { |
1124 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
1125 |
$val_external_uid = array(); |
$val_external_uid = array(); |
1126 |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
1127 |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
1317 |
*/ |
*/ |
1318 |
function get_objects_by_task_type($type, $stream = 'all') { |
function get_objects_by_task_type($type, $stream = 'all') { |
1319 |
$objects = array(); |
$objects = array(); |
1320 |
if (in_array($type, array('creation_DA', )) === true) { |
if (in_array($type, array('creation_DA', 'modification_DA', )) === true) { |
1321 |
$objects = array('dossier_autorisation', ); |
$objects = array('dossier_autorisation', ); |
1322 |
} |
} |
1323 |
if (in_array($type, array('creation_DI', 'depot_DI', 'notification_DI', 'qualification_DI', )) === true) { |
if (in_array($type, array('creation_DI', 'depot_DI', 'notification_DI', 'qualification_DI', )) === true) { |
1355 |
&& $stream === 'input') { |
&& $stream === 'input') { |
1356 |
$objects = array('avis_consultation', ); |
$objects = array('avis_consultation', ); |
1357 |
} |
} |
1358 |
|
if (in_array($type, array('create_message', )) === true |
1359 |
|
&& $stream === 'input') { |
1360 |
|
$objects = array('dossier_message', ); |
1361 |
|
} |
1362 |
return $objects; |
return $objects; |
1363 |
} |
} |
1364 |
|
|