21 |
); |
); |
22 |
} |
} |
23 |
|
|
24 |
|
public function setvalF($val = array()) { |
25 |
|
parent::setvalF($val); |
26 |
|
// |
27 |
|
if (array_key_exists('timestamp_log', $val) === true) { |
28 |
|
$this->valF['timestamp_log'] = str_replace("'", '"', $val['timestamp_log']); |
29 |
|
} |
30 |
|
} |
31 |
|
|
32 |
|
public function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
33 |
|
parent::verifier($val, $dnu1, $dnu2); |
34 |
|
// |
35 |
|
if (array_key_exists('timestamp_log', $this->valF) === true |
36 |
|
&& is_array(json_decode($this->valF['timestamp_log'], true)) === false) { |
37 |
|
// |
38 |
|
$this->correct = false; |
39 |
|
$this->addToMessage(sprintf( |
40 |
|
__("Le champ %s doit être dans un format JSON valide."), |
41 |
|
sprintf('<span class="bold">%s</span>', $this->getLibFromField('timestamp_log')) |
42 |
|
)); |
43 |
|
} |
44 |
|
} |
45 |
|
|
46 |
protected function task_exists(string $type, string $object_id) { |
protected function task_exists(string $type, string $object_id) { |
47 |
$query = sprintf(' |
$query = sprintf(' |
48 |
SELECT task |
SELECT task |
84 |
'object_id' => $params['val']['object_id'], |
'object_id' => $params['val']['object_id'], |
85 |
); |
); |
86 |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
87 |
|
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
88 |
|
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
89 |
|
} |
90 |
if ($task_exists !== false) { |
if ($task_exists !== false) { |
91 |
$inst_task = $this->f->get_inst__om_dbform(array( |
$inst_task = $this->f->get_inst__om_dbform(array( |
92 |
"obj" => "task", |
"obj" => "task", |
195 |
* |
* |
196 |
FROM %1$stask |
FROM %1$stask |
197 |
%2$s |
%2$s |
198 |
|
ORDER BY task ASC |
199 |
', |
', |
200 |
DB_PREFIXE, |
DB_PREFIXE, |
201 |
$where |
$where |
296 |
$particular_case = false; |
$particular_case = false; |
297 |
$fields_tab_crea_loc_hab = $inst_dt->get_fields_tab_crea_loc_hab(); |
$fields_tab_crea_loc_hab = $inst_dt->get_fields_tab_crea_loc_hab(); |
298 |
foreach ($fields_tab_crea_loc_hab as $field) { |
foreach ($fields_tab_crea_loc_hab as $field) { |
299 |
if (isset($field) === false |
if (isset($val_dt[$field]) === false |
300 |
|| (isset($field) === true |
|| (isset($val_dt[$field]) === true |
301 |
&& $field !== null |
&& ($val_dt[$field] === null |
302 |
&& $field !== '')) { |
|| $val_dt[$field] === ''))) { |
303 |
// |
// |
304 |
$particular_case = true; |
$particular_case = true; |
305 |
} |
} |
373 |
)); |
)); |
374 |
$val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data(); |
$val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data(); |
375 |
$val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal']; |
$val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal']; |
|
// Valeur par défaut pour expériementation sequence 1 |
|
|
$val_demandeur[$demandeur['demandeur']]['commerciale'] = 'f'; |
|
376 |
} |
} |
377 |
return $val_demandeur; |
return $val_demandeur; |
378 |
} |
} |
391 |
return $val_architecte; |
return $val_architecte; |
392 |
} |
} |
393 |
|
|
394 |
protected function get_instruction_data(string $dossier) { |
protected function get_instruction_data(string $dossier, $type = 'decision') { |
395 |
$val_instruction = null; |
$val_instruction = null; |
396 |
|
$instruction_with_doc = null; |
397 |
$inst_di = $this->f->get_inst__om_dbform(array( |
$inst_di = $this->f->get_inst__om_dbform(array( |
398 |
"obj" => "dossier", |
"obj" => "dossier", |
399 |
"idx" => $dossier, |
"idx" => $dossier, |
400 |
)); |
)); |
401 |
|
$idx = null; |
402 |
|
if ($type === 'decision') { |
403 |
|
$idx = $inst_di->get_last_instruction_decision(); |
404 |
|
} |
405 |
|
if ($type === 'incompletude') { |
406 |
|
$idx = $inst_di->get_last_instruction_incompletude(); |
407 |
|
} |
408 |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
409 |
"obj" => "instruction", |
"obj" => "instruction", |
410 |
"idx" => $inst_di->get_last_instruction_decision(), |
"idx" => $idx, |
411 |
)); |
)); |
412 |
if (count($inst_instruction->val) > 0) { |
if (count($inst_instruction->val) > 0) { |
413 |
$val_instruction[$inst_instruction->getVal($inst_instruction->clePrimaire)] = $inst_instruction->get_json_data(); |
$val_instruction = array(); |
414 |
|
$instruction_data = $inst_instruction->get_json_data(); |
415 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
416 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
417 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
418 |
|
// |
419 |
|
$instruction_with_doc = $inst_instruction->getVal($inst_instruction->clePrimaire); |
420 |
|
} |
421 |
$inst_ev = $this->f->get_inst__om_dbform(array( |
$inst_ev = $this->f->get_inst__om_dbform(array( |
422 |
"obj" => "evenement", |
"obj" => "evenement", |
423 |
"idx" => $inst_instruction->getVal('evenement'), |
"idx" => $inst_instruction->getVal('evenement'), |
425 |
if ($inst_ev->getVal('retour') === 't') { |
if ($inst_ev->getVal('retour') === 't') { |
426 |
$instructions_related = $inst_instruction->get_related_instructions(); |
$instructions_related = $inst_instruction->get_related_instructions(); |
427 |
foreach ($instructions_related as $instruction) { |
foreach ($instructions_related as $instruction) { |
428 |
$inst_related_instruction = $this->f->get_inst__om_dbform(array( |
if ($instruction !== null && $instruction !== '') { |
429 |
"obj" => "instruction", |
$inst_related_instruction = $this->f->get_inst__om_dbform(array( |
430 |
"idx" => $instruction, |
"obj" => "instruction", |
431 |
)); |
"idx" => $instruction, |
432 |
$val_instruction[$instruction] = $inst_related_instruction->get_json_data(); |
)); |
433 |
|
$instruction_data = $inst_related_instruction->get_json_data(); |
434 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
435 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
436 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
437 |
|
// |
438 |
|
$instruction_with_doc = $inst_related_instruction->getVal($inst_related_instruction->clePrimaire); |
439 |
|
} |
440 |
|
} |
441 |
} |
} |
442 |
} |
} |
443 |
|
if ($instruction_with_doc !== null) { |
444 |
|
// |
445 |
|
$val_instruction['path'] = sprintf('%s&snippet=%s&obj=%s&champ=%s&id=%s', 'app/index.php?module=form', 'file', 'instruction', 'om_fichier_instruction', $instruction_with_doc); |
446 |
|
} |
447 |
} |
} |
448 |
return $val_instruction; |
return $val_instruction; |
449 |
} |
} |
450 |
|
|
451 |
|
protected function sort_instruction_data(array $values, array $res) { |
452 |
|
$fields = array( |
453 |
|
"date_envoi_signature", |
454 |
|
"date_retour_signature", |
455 |
|
"date_envoi_rar", |
456 |
|
"date_retour_rar", |
457 |
|
"date_envoi_controle_legalite", |
458 |
|
"date_retour_controle_legalite", |
459 |
|
"signataire_arrete", |
460 |
|
"om_fichier_instruction", |
461 |
|
"tacite", |
462 |
|
); |
463 |
|
foreach ($values as $key => $value) { |
464 |
|
if (in_array($key, $fields) === true) { |
465 |
|
if (array_key_exists($key, $res) === false |
466 |
|
&& $value !== null |
467 |
|
&& $value !== '') { |
468 |
|
// |
469 |
|
$res[$key] = $value; |
470 |
|
} elseif ($key === 'tacite' |
471 |
|
&& $value === 't') { |
472 |
|
// |
473 |
|
$res[$key] = $value; |
474 |
|
} |
475 |
|
} |
476 |
|
} |
477 |
|
return $res; |
478 |
|
} |
479 |
|
|
480 |
protected function get_document_numerise_data(string $dn) { |
protected function get_document_numerise_data(string $dn) { |
481 |
$val_dn = array(); |
$val_dn = array(); |
482 |
$inst_dn = $this->f->get_inst__om_dbform(array( |
$inst_dn = $this->f->get_inst__om_dbform(array( |
484 |
"idx" => $dn, |
"idx" => $dn, |
485 |
)); |
)); |
486 |
$val_dn = $inst_dn->get_json_data(); |
$val_dn = $inst_dn->get_json_data(); |
487 |
$val_dn['path'] = sprintf('%s/%s&snippet=%s&obj=%s&champ=%s&id=%s', $_SERVER['HTTP_HOST'], 'openads/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')); |
488 |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
489 |
$val_dn['nature'] = 'Initiale'; |
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
490 |
return $val_dn; |
return $val_dn; |
491 |
} |
} |
492 |
|
|
584 |
} |
} |
585 |
// |
// |
586 |
if ($this->getVal('type') === 'creation_DI' |
if ($this->getVal('type') === 'creation_DI' |
587 |
|| $this->getVal('type') === 'modification_DI') { |
|| $this->getVal('type') === 'modification_DI' |
588 |
|
|| $this->getVal('type') === 'depot_DI') { |
589 |
// |
// |
590 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
591 |
$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'); |
625 |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
626 |
$val['external_uid'] = $val_external_uid; |
$val['external_uid'] = $val_external_uid; |
627 |
} |
} |
628 |
|
// |
629 |
|
if ($this->getVal('type') === 'incompletude_DI') { |
630 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
631 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'incompletude'); |
632 |
|
$val_external_uid = array(); |
633 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
634 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
635 |
|
$val['external_uid'] = $val_external_uid; |
636 |
|
} |
637 |
|
// |
638 |
|
if ($this->getVal('type') === 'completude_DI') { |
639 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
640 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'completude'); |
641 |
|
$val_external_uid = array(); |
642 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
643 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
644 |
|
$val['external_uid'] = $val_external_uid; |
645 |
|
} |
646 |
|
|
647 |
// Liste des valeurs affichée en JSON |
// Liste des valeurs affichée en JSON |
648 |
printf(json_encode($val)); |
printf(json_encode($val, JSON_UNESCAPED_SLASHES)); |
649 |
} |
} |
650 |
} |
} |
651 |
|
|
656 |
$objet = 'dossier_autorisation'; |
$objet = 'dossier_autorisation'; |
657 |
} |
} |
658 |
if ($type === 'creation_DI' |
if ($type === 'creation_DI' |
659 |
|
|| $type === 'depot_DI' |
660 |
|| $type === 'modification_DI' |
|| $type === 'modification_DI' |
661 |
|| $type === 'qualification_DI' |
|| $type === 'qualification_DI' |
662 |
|| $type === 'decision_DI') { |
|| $type === 'decision_DI' |
663 |
|
|| $type === 'incompletude_DI' |
664 |
|
|| $type === 'completude_DI') { |
665 |
// |
// |
666 |
$objet = 'dossier'; |
$objet = 'dossier'; |
667 |
} |
} |