28 |
'incompletude_DI', |
'incompletude_DI', |
29 |
'completude_DI', |
'completude_DI', |
30 |
'ajout_piece', |
'ajout_piece', |
31 |
|
'modification_piece', |
32 |
|
'suppression_piece', |
33 |
'add_piece', |
'add_piece', |
34 |
'creation_consultation', |
'creation_consultation', |
35 |
'modification_DA', |
'modification_DA', |
356 |
case "add_piece": |
case "add_piece": |
357 |
$value_type = __('Ajout pièce (entrant)'); |
$value_type = __('Ajout pièce (entrant)'); |
358 |
break; |
break; |
359 |
|
case "modification_piece": |
360 |
|
$value_type = __('Modification pièce (sortant)'); |
361 |
|
break; |
362 |
|
case "suppression_piece": |
363 |
|
$value_type = __('Suppression pièce (sortant)'); |
364 |
|
break; |
365 |
case "depot_DI": |
case "depot_DI": |
366 |
$value_type = __('Dépôt DI'); |
$value_type = __('Dépôt DI'); |
367 |
break; |
break; |
554 |
// parent::setVal($form, $maj, $validation); |
// parent::setVal($form, $maj, $validation); |
555 |
// |
// |
556 |
if ($this->getVal('stream') == "output" |
if ($this->getVal('stream') == "output" |
557 |
|
&& $this->getVal('type') !== 'suppression_piece' |
558 |
&& ($this->getVal('state') !== self::STATUS_DONE |
&& ($this->getVal('state') !== self::STATUS_DONE |
559 |
|| $this->getVal('json_payload') === "{}")) { |
|| $this->getVal('json_payload') === "{}")) { |
560 |
// |
// |
886 |
$this->valF['object_id'] = $new_values['object_id']; |
$this->valF['object_id'] = $new_values['object_id']; |
887 |
$this->valF['last_modification_date'] = date('Y-m-d'); |
$this->valF['last_modification_date'] = date('Y-m-d'); |
888 |
$this->valF['last_modification_time'] = date('H:i:s'); |
$this->valF['last_modification_time'] = date('H:i:s'); |
889 |
if ($val['stream'] === 'output') { |
if ($val['stream'] === 'output' |
890 |
|
&& $val['type'] !== 'suppression_piece') { |
891 |
// Lorsque la task passe d'un état qui n'est pas "done" à l'état "done" |
// Lorsque la task passe d'un état qui n'est pas "done" à l'état "done" |
892 |
if ($this->getVal("state") !== self::STATUS_DONE |
if ($this->getVal("state") !== self::STATUS_DONE |
893 |
&& $this->valF['state'] === self::STATUS_DONE) { |
&& $this->valF['state'] === self::STATUS_DONE) { |
1260 |
// On se réfère à la tâche de type 'ajout piece' de l'object id |
// On se réfère à la tâche de type 'ajout piece' de l'object id |
1261 |
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'ajout_piece'"))); |
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'ajout_piece'"))); |
1262 |
} |
} |
1263 |
|
if ($valF['type'] === 'modification_piece') { |
1264 |
|
// On se réfère à la tâche de type 'modification piece' de l'object id |
1265 |
|
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'modification_piece'"))); |
1266 |
|
} |
1267 |
|
if ($valF['type'] === 'suppression_piece') { |
1268 |
|
// On se réfère à la tâche de type 'suppression piece' de l'object id |
1269 |
|
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'suppression_piece'"))); |
1270 |
|
} |
1271 |
if ($valF['type'] === 'creation_consultation') { |
if ($valF['type'] === 'creation_consultation') { |
1272 |
// On se réfère à la tâche de type 'creation consultation' de l'object id |
// On se réfère à la tâche de type 'creation consultation' de l'object id |
1273 |
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'creation_consultation'"))); |
$task_exists = $this->task_exists_multi_search(array_merge($search_values_common, $search_values_specifics, array("type = 'creation_consultation'"))); |
1307 |
} |
} |
1308 |
$add = $this->ajouter($valF); |
$add = $this->ajouter($valF); |
1309 |
$this->addToLog(__METHOD__."(): retour de l'ajout de tâche: ".var_export($add, true), VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): retour de l'ajout de tâche: ".var_export($add, true), VERBOSE_MODE); |
1310 |
|
|
1311 |
|
// Création de la payload JSON dans le cas ou nous avons un suppression d'objet |
1312 |
|
if ($stream === 'output' |
1313 |
|
&& $add === true |
1314 |
|
&& isset($valF['type']) === true |
1315 |
|
&& strpos($valF['type'], 'suppression_piece') !== false) { |
1316 |
|
$inst_task_empty = $this->f->get_inst__om_dbform(array( |
1317 |
|
"obj" => "task", |
1318 |
|
"idx" => 0, |
1319 |
|
)); |
1320 |
|
// Vérification de l'éxistence d'une tache de suppression de pièce |
1321 |
|
$task_exists = $inst_task_empty->task_exists('suppression_piece', $valF['object_id']); |
1322 |
|
$valF['task'] = $task_exists; |
1323 |
|
$inst_task = $this->f->get_inst__om_dbform(array( |
1324 |
|
"obj" => "task", |
1325 |
|
"idx" => $task_exists, |
1326 |
|
)); |
1327 |
|
$valF['json_payload'] = $inst_task->view_form_json(true); |
1328 |
|
$update = $this->modifier($valF); |
1329 |
|
if ($update === false) { |
1330 |
|
$this->addToLog(__METHOD__."(): ".$this->msg, DEBUG_MODE); |
1331 |
|
return $this->end_treatment(__METHOD__, false); |
1332 |
|
} |
1333 |
|
} |
1334 |
|
|
1335 |
if ($add === false) { |
if ($add === false) { |
1336 |
$this->addToLog(__METHOD__."(): ".$this->msg, DEBUG_MODE); |
$this->addToLog(__METHOD__."(): ".$this->msg, DEBUG_MODE); |
1337 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
1456 |
$query = sprintf(' |
$query = sprintf(' |
1457 |
SELECT |
SELECT |
1458 |
DISTINCT (task.task), |
DISTINCT (task.task), |
1459 |
|
task.type, |
1460 |
task.object_id, |
task.object_id, |
1461 |
task.dossier, |
task.dossier, |
1462 |
task.stream, |
task.stream, |
1488 |
} |
} |
1489 |
$list_tasks = array(); |
$list_tasks = array(); |
1490 |
foreach ($res['result'] as $task) { |
foreach ($res['result'] as $task) { |
|
if ($task['type'] === 'ajout_piece') { |
|
|
$val_dn = $this->get_document_numerise_data($task['object_id']); |
|
|
} |
|
1491 |
if ($task['stream'] === 'output') { |
if ($task['stream'] === 'output') { |
1492 |
$task['external_uids'] = array_merge( |
$task['external_uids'] = array_merge( |
1493 |
$this->get_all_external_uids($task['dossier'], array(), $category !== null ? $category : $task['category']), |
$this->get_all_external_uids($task['dossier'], array(), $category !== null ? $category : $task['category']), |
1972 |
|
|
1973 |
protected function get_document_numerise_data(string $dn) { |
protected function get_document_numerise_data(string $dn) { |
1974 |
$val_dn = array(); |
$val_dn = array(); |
1975 |
$inst_dn = $this->f->get_inst__om_dbform(array( |
$qres = $this->f->get_all_results_from_db_query( |
1976 |
"obj" => "document_numerise", |
sprintf( |
1977 |
"idx" => $dn, |
'SELECT |
1978 |
)); |
document_numerise.document_numerise, |
1979 |
$val_dn = $inst_dn->get_json_data(); |
document_numerise.uid, |
1980 |
|
document_numerise.dossier, |
1981 |
|
document_numerise.nom_fichier, |
1982 |
|
document_numerise.date_creation, |
1983 |
|
document_numerise.document_numerise_type, |
1984 |
|
document_numerise.uid_dossier_final, |
1985 |
|
document_numerise.document_numerise_nature, |
1986 |
|
document_numerise.uid_thumbnail, |
1987 |
|
document_numerise.description_type, |
1988 |
|
document_numerise.document_travail, |
1989 |
|
document_numerise_type.code AS document_numerise_type_code, |
1990 |
|
document_numerise_type.libelle AS document_numerise_type_libelle, |
1991 |
|
document_numerise_nature.code AS document_numerise_nature_code, |
1992 |
|
document_numerise_nature.libelle AS document_numerise_nature_libelle, |
1993 |
|
document_numerise_nature.libelle AS nature |
1994 |
|
FROM |
1995 |
|
%1$sdocument_numerise |
1996 |
|
LEFT JOIN %1$sdocument_numerise_type |
1997 |
|
ON document_numerise.document_numerise_type = document_numerise_type.document_numerise_type |
1998 |
|
LEFT JOIN %1$sdocument_numerise_nature |
1999 |
|
ON document_numerise.document_numerise_nature = document_numerise_nature.document_numerise_nature |
2000 |
|
WHERE |
2001 |
|
document_numerise.document_numerise = %2$s', |
2002 |
|
DB_PREFIXE, |
2003 |
|
intval($dn) |
2004 |
|
), |
2005 |
|
array( |
2006 |
|
"origin" => __METHOD__, |
2007 |
|
) |
2008 |
|
); |
2009 |
|
if ($qres["result"] !== null |
2010 |
|
&& $qres["result"] !== "" |
2011 |
|
&& count($qres["result"]) > 0) { |
2012 |
|
// |
2013 |
|
$val_dn = $qres["result"][0]; |
2014 |
|
} |
2015 |
$val_dn['path'] = sprintf('%s&snippet=%s&obj=%s&champ=%s&id=%s', 'app/index.php?module=form', 'file', 'document_numerise', 'uid', $this->getVal('object_id')); |
$val_dn['path'] = sprintf('%s&snippet=%s&obj=%s&champ=%s&id=%s', 'app/index.php?module=form', 'file', 'document_numerise', 'uid', $this->getVal('object_id')); |
|
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
|
|
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
|
2016 |
return $val_dn; |
return $val_dn; |
2017 |
} |
} |
2018 |
|
|
2193 |
$val['external_uids'] = $val_external_uid; |
$val['external_uids'] = $val_external_uid; |
2194 |
} |
} |
2195 |
// |
// |
2196 |
|
if ($this->getVal('type') === 'modification_piece') { |
2197 |
|
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
2198 |
|
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
2199 |
|
$val_external_uid = array(); |
2200 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2201 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2202 |
|
$val_external_uid['piece'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'piece'); |
2203 |
|
$val['external_uids'] = $val_external_uid; |
2204 |
|
} |
2205 |
|
// |
2206 |
|
if ($this->getVal('type') === 'suppression_piece') { |
2207 |
|
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
2208 |
|
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
2209 |
|
$val_external_uid = array(); |
2210 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
2211 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
2212 |
|
$val_external_uid['piece'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'piece'); |
2213 |
|
$val['external_uids'] = $val_external_uid; |
2214 |
|
} |
2215 |
|
// |
2216 |
if ($this->getVal('type') === 'decision_DI') { |
if ($this->getVal('type') === 'decision_DI') { |
2217 |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
2218 |
$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'))); |
2538 |
&& $stream === 'output') { |
&& $stream === 'output') { |
2539 |
$objects = array('prescription', ); |
$objects = array('prescription', ); |
2540 |
} |
} |
2541 |
if (in_array($type, array('ajout_piece', 'add_piece', )) === true) { |
if (in_array($type, array('ajout_piece', 'add_piece', 'modification_piece', 'suppression_piece', )) === true) { |
2542 |
$objects = array('piece', ); |
$objects = array('piece', ); |
2543 |
} |
} |
2544 |
if (in_array($type, array('creation_consultation', )) === true) { |
if (in_array($type, array('creation_consultation', )) === true) { |
2585 |
if (in_array($type, array('creation_DA', 'modification_DA', )) === true) { |
if (in_array($type, array('creation_DA', 'modification_DA', )) === true) { |
2586 |
$tables = array('dossier_autorisation', ); |
$tables = array('dossier_autorisation', ); |
2587 |
} |
} |
2588 |
if (in_array($type, array('creation_DI', 'depot_DI', )) === true) { |
if (in_array($type, array('creation_DI', 'depot_DI', 'modification_DI',)) === true) { |
2589 |
$tables = array('dossier', ); |
$tables = array('dossier', ); |
2590 |
} |
} |
2591 |
if (in_array($type, array('qualification_DI', )) === true) { |
if (in_array($type, array('qualification_DI', )) === true) { |
2622 |
&& $stream === 'output') { |
&& $stream === 'output') { |
2623 |
$tables = array('instruction', ); |
$tables = array('instruction', ); |
2624 |
} |
} |
2625 |
if (in_array($type, array('ajout_piece', 'add_piece', )) === true) { |
if (in_array($type, array('ajout_piece', 'add_piece', 'modification_piece', 'suppression_piece', )) === true) { |
2626 |
$tables = array('document_numerise', ); |
$tables = array('document_numerise', ); |
2627 |
} |
} |
2628 |
if (in_array($type, array('creation_consultation', )) === true) { |
if (in_array($type, array('creation_consultation', )) === true) { |