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 |
|
/** |
33 |
|
* |
34 |
|
* @return array |
35 |
|
*/ |
36 |
|
function get_var_sql_forminc__champs() { |
37 |
|
return array( |
38 |
|
"task", |
39 |
|
"type", |
40 |
|
"state", |
41 |
|
"object_id", |
42 |
|
"dossier", |
43 |
|
"json_payload", |
44 |
|
"timestamp_log", |
45 |
|
); |
46 |
|
} |
47 |
|
|
48 |
|
function setType(&$form, $maj) { |
49 |
|
parent::setType($form, $maj); |
50 |
|
// Récupération du mode de l'action |
51 |
|
$crud = $this->get_action_crud($maj); |
52 |
|
|
53 |
|
if ($maj < 2) { |
54 |
|
$form->setType("state", "select"); |
55 |
|
$form->setType("json_payload", "textarea"); |
56 |
|
} |
57 |
|
if ($maj == 3){ |
58 |
|
$form->setType('dossier', 'link'); |
59 |
|
$form->setType('json_payload', 'jsonprettyprint'); |
60 |
|
} |
61 |
|
|
62 |
|
} |
63 |
|
|
64 |
|
/** |
65 |
|
* |
66 |
|
*/ |
67 |
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
68 |
|
if($maj < 2) { |
69 |
|
$contenu=array(); |
70 |
|
|
71 |
|
$contenu[0][0]="draft"; |
72 |
|
$contenu[1][0]=_('draft'); |
73 |
|
$contenu[0][1]="new"; |
74 |
|
$contenu[1][1]=_('new'); |
75 |
|
$contenu[0][2]="pending"; |
76 |
|
$contenu[1][2]=_('pending'); |
77 |
|
$contenu[0][3]="done"; |
78 |
|
$contenu[1][3]=_('done'); |
79 |
|
$contenu[0][4]="archived"; |
80 |
|
$contenu[1][4]=_('archived'); |
81 |
|
$contenu[0][5]="error"; |
82 |
|
$contenu[1][5]=_('error'); |
83 |
|
$contenu[0][6]="debug"; |
84 |
|
$contenu[1][6]=_('debug'); |
85 |
|
|
86 |
|
$form->setSelect("state", $contenu); |
87 |
|
} |
88 |
|
|
89 |
|
if ($maj == 3) { |
90 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
91 |
|
"obj" => "dossier", |
92 |
|
"idx" => $form->val['dossier'], |
93 |
|
)); |
94 |
|
|
95 |
|
if($form->val['type'] == "creation_DA"){ |
96 |
|
$obj_link = 'dossier_autorisation'; |
97 |
|
} else { |
98 |
|
$obj_link = 'dossier_instruction'; |
99 |
|
} |
100 |
|
|
101 |
|
$params = array(); |
102 |
|
$params['obj'] = $obj_link; |
103 |
|
$params['libelle'] = $inst_dossier->getVal('dossier'); |
104 |
|
$params['title'] = "Consulter le dossier"; |
105 |
|
$params['idx'] = $form->val['dossier']; |
106 |
|
$form->setSelect("dossier", $params); |
107 |
|
} |
108 |
|
} |
109 |
|
|
110 |
|
/** |
111 |
|
* SETTER_FORM - setVal (setVal). |
112 |
|
* |
113 |
|
* @return void |
114 |
|
*/ |
115 |
|
function setVal(&$form, $maj, $validation, &$dnu1 = null, $dnu2 = null) { |
116 |
|
// parent::setVal($form, $maj, $validation); |
117 |
|
// |
118 |
|
$form->setVal('json_payload', $this->view_form_json(true)); |
119 |
|
} |
120 |
|
|
121 |
|
public function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
122 |
|
parent::verifier($val, $dnu1, $dnu2); |
123 |
|
// |
124 |
|
if (array_key_exists('timestamp_log', $this->valF) === true |
125 |
|
&& is_array(json_decode($this->valF['timestamp_log'], true)) === false) { |
126 |
|
// |
127 |
|
$this->correct = false; |
128 |
|
$this->addToMessage(sprintf( |
129 |
|
__("Le champ %s doit être dans un format JSON valide."), |
130 |
|
sprintf('<span class="bold">%s</span>', $this->getLibFromField('timestamp_log')) |
131 |
|
)); |
132 |
|
} |
133 |
|
} |
134 |
|
|
135 |
protected function task_exists(string $type, string $object_id) { |
protected function task_exists(string $type, string $object_id) { |
136 |
$query = sprintf(' |
$query = sprintf(' |
137 |
SELECT task |
SELECT task |
171 |
'timestamp_log' => $timestamp_log, |
'timestamp_log' => $timestamp_log, |
172 |
'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new', |
'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new', |
173 |
'object_id' => $params['val']['object_id'], |
'object_id' => $params['val']['object_id'], |
174 |
|
'dossier' => $params['val']['dossier'], |
175 |
|
'json_payload' => '{}', |
176 |
); |
); |
177 |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
178 |
|
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
179 |
|
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
180 |
|
} |
181 |
if ($task_exists !== false) { |
if ($task_exists !== false) { |
182 |
$inst_task = $this->f->get_inst__om_dbform(array( |
$inst_task = $this->f->get_inst__om_dbform(array( |
183 |
"obj" => "task", |
"obj" => "task", |
184 |
"idx" => $task_exists, |
"idx" => $task_exists, |
185 |
)); |
)); |
186 |
|
$update_state = $inst_task->getVal('state'); |
187 |
|
if (isset($params['update_val']['state']) === true) { |
188 |
|
$update_state = $params['update_val']['state']; |
189 |
|
} |
190 |
$update_params = array( |
$update_params = array( |
191 |
'val' => array( |
'val' => array( |
192 |
'state' => $inst_task->getVal('state'), |
'state' => $update_state, |
193 |
), |
), |
194 |
); |
); |
195 |
return $inst_task->update_task($update_params); |
return $inst_task->update_task($update_params); |
228 |
'timestamp_log' => $timestamp_log, |
'timestamp_log' => $timestamp_log, |
229 |
'state' => $params['val']['state'], |
'state' => $params['val']['state'], |
230 |
'object_id' => $this->getVal('object_id'), |
'object_id' => $this->getVal('object_id'), |
231 |
|
'dossier' => $this->getVal('dossier'), |
232 |
|
'json_payload' => $this->getVal('json_payload'), |
233 |
); |
); |
234 |
$update = $this->modifier($valF); |
$update = $this->modifier($valF); |
235 |
if ($update === false) { |
if ($update === false) { |
288 |
* |
* |
289 |
FROM %1$stask |
FROM %1$stask |
290 |
%2$s |
%2$s |
291 |
|
ORDER BY task ASC |
292 |
', |
', |
293 |
DB_PREFIXE, |
DB_PREFIXE, |
294 |
$where |
$where |
299 |
} |
} |
300 |
$list_tasks = array(); |
$list_tasks = array(); |
301 |
foreach ($res['result'] as $task) { |
foreach ($res['result'] as $task) { |
302 |
|
$task['timestamp_log'] = json_decode($task['timestamp_log'], true); |
303 |
|
$task['dossier'] = $task['object_id']; |
304 |
|
if ($this->get_lien_objet_by_type($task['type']) === 'document_numerise') { |
305 |
|
$val_dn = $this->get_document_numerise_data($task['object_id']); |
306 |
|
$task['dossier'] = $val_dn['dossier']; |
307 |
|
} |
308 |
$list_tasks[$task['task']] = $task; |
$list_tasks[$task['task']] = $task; |
309 |
} |
} |
310 |
printf(json_encode($list_tasks)); |
printf(json_encode($list_tasks)); |
316 |
"obj" => "dossier", |
"obj" => "dossier", |
317 |
"idx" => $dossier, |
"idx" => $dossier, |
318 |
)); |
)); |
319 |
$val_di = json_decode($inst_di->get_json_data(), true); |
$val_di = $inst_di->get_json_data(); |
320 |
|
if ($val_di['dossier_instruction_type_code'] === 'T') { |
321 |
|
$val_di['date_decision_transfert'] = $val_di['date_decision']; |
322 |
|
} |
323 |
unset($val_di['initial_dt']); |
unset($val_di['initial_dt']); |
324 |
unset($val_di['log_instructions']); |
unset($val_di['log_instructions']); |
325 |
return $val_di; |
return $val_di; |
331 |
"obj" => "dossier_autorisation", |
"obj" => "dossier_autorisation", |
332 |
"idx" => $da, |
"idx" => $da, |
333 |
)); |
)); |
334 |
$val_da = json_decode($inst_da->get_json_data(), true); |
$val_da = $inst_da->get_json_data(); |
335 |
return $val_da; |
return $val_da; |
336 |
} |
} |
337 |
|
|
347 |
'cerfa' => $inst_dt->getVal('cerfa'), |
'cerfa' => $inst_dt->getVal('cerfa'), |
348 |
); |
); |
349 |
$val_dt = array_merge($val_dt, $inst_dt->get_donnees_techniques_applicables()); |
$val_dt = array_merge($val_dt, $inst_dt->get_donnees_techniques_applicables()); |
350 |
|
if (isset($val_dt['am_exist_date']) === true) { |
351 |
|
$val_dt['am_exist_date_num'] = ''; |
352 |
|
if (is_numeric($val_dt['am_exist_date']) === true) { |
353 |
|
$val_dt['am_exist_date_num'] = $val_dt['am_exist_date']; |
354 |
|
} |
355 |
|
} |
356 |
|
// Correspond à la nomenclature de Plat'AU STATUT_INFO |
357 |
|
$val_dt['tax_statut_info'] = 'Déclaré'; |
358 |
|
// |
359 |
|
if ($inst_dt->is_tab_surf_ssdest_enabled() === true) { |
360 |
|
$fields_tab_surf_dest = $inst_dt->get_fields_tab_surf_dest(); |
361 |
|
foreach ($fields_tab_surf_dest as $field) { |
362 |
|
if (isset($val_dt[$field]) === true) { |
363 |
|
unset($val_dt[$field]); |
364 |
|
} |
365 |
|
} |
366 |
|
} else { |
367 |
|
$fields_tab_surf_ssdest = $inst_dt->get_fields_tab_surf_ssdest(); |
368 |
|
foreach ($fields_tab_surf_ssdest as $field) { |
369 |
|
if (isset($val_dt[$field]) === true) { |
370 |
|
unset($val_dt[$field]); |
371 |
|
} |
372 |
|
} |
373 |
|
} |
374 |
|
// Correspond à la nouvelle ligne CERFA v7 dans le DENSI imposition 1.2.3 |
375 |
|
if (isset($val_dt['tax_su_non_habit_surf2']) === true |
376 |
|
&& isset($val_dt['tax_su_non_habit_surf3']) === true |
377 |
|
&& (($val_dt['tax_su_non_habit_surf2'] !== null |
378 |
|
&& $val_dt['tax_su_non_habit_surf2'] !== '') |
379 |
|
|| ($val_dt['tax_su_non_habit_surf3'] !== null |
380 |
|
&& $val_dt['tax_su_non_habit_surf3'] !== ''))) { |
381 |
|
// |
382 |
|
$val_dt['tax_su_non_habit_surf8'] = intval($val_dt['tax_su_non_habit_surf2']) + intval($val_dt['tax_su_non_habit_surf3']); |
383 |
|
} |
384 |
|
if (isset($val_dt['tax_su_non_habit_surf_stat2']) === true |
385 |
|
&& isset($val_dt['tax_su_non_habit_surf_stat3']) === true |
386 |
|
&& (($val_dt['tax_su_non_habit_surf_stat2'] !== null |
387 |
|
&& $val_dt['tax_su_non_habit_surf_stat2'] !== '') |
388 |
|
|| ($val_dt['tax_su_non_habit_surf_stat3'] !== null |
389 |
|
&& $val_dt['tax_su_non_habit_surf_stat3'] !== ''))) { |
390 |
|
// |
391 |
|
$val_dt['tax_su_non_habit_surf_stat8'] = intval($val_dt['tax_su_non_habit_surf_stat2']) + intval($val_dt['tax_su_non_habit_surf_stat3']); |
392 |
|
} |
393 |
|
// Cas particulier d'un projet réduit à l'extension d'une habitation existante |
394 |
|
$particular_case = false; |
395 |
|
$fields_tab_crea_loc_hab = $inst_dt->get_fields_tab_crea_loc_hab(); |
396 |
|
foreach ($fields_tab_crea_loc_hab as $field) { |
397 |
|
if (isset($val_dt[$field]) === false |
398 |
|
|| (isset($val_dt[$field]) === true |
399 |
|
&& ($val_dt[$field] === null |
400 |
|
|| $val_dt[$field] === ''))) { |
401 |
|
// |
402 |
|
$particular_case = true; |
403 |
|
} |
404 |
|
} |
405 |
|
if ($particular_case === true) { |
406 |
|
if (isset($val_dt['tax_ext_pret']) === true |
407 |
|
&& $val_dt['tax_ext_pret'] === 'f') { |
408 |
|
// |
409 |
|
$val_dt['tax_su_princ_surf1'] = $val_dt['tax_surf_tot_cstr']; |
410 |
|
$val_dt['tax_su_princ_surf_stat1'] = $val_dt['tax_surf_loc_stat']; |
411 |
|
} |
412 |
|
if (isset($val_dt['tax_ext_pret']) === true |
413 |
|
&& $val_dt['tax_ext_pret'] === 't') { |
414 |
|
// |
415 |
|
if (isset($val_dt['tax_ext_desc']) === true) { |
416 |
|
if (preg_match('/[pP].*[lL].*[aA].*[iI]/', $val_dt['tax_ext_desc']) === 1 |
417 |
|
|| preg_match('/[lL].*[lL].*[tT].*[sS]/', $val_dt['tax_ext_desc']) === 1) { |
418 |
|
// |
419 |
|
$val_dt['tax_su_princ_surf2'] = $val_dt['tax_surf_tot_cstr']; |
420 |
|
$val_dt['tax_su_princ_surf_stat2'] = $val_dt['tax_surf_loc_stat']; |
421 |
|
} |
422 |
|
// if (preg_match('/[pP].*[tT].*[zZ]/', $val_dt['tax_ext_desc']) === 1) { |
423 |
|
// $val_dt['tax_su_princ_surf4'] = $val_dt['tax_surf_tot_cstr']; |
424 |
|
// $val_dt['tax_su_princ_surf_stat4'] = $val_dt['tax_surf_loc_stat']; |
425 |
|
// } |
426 |
|
// if (preg_match('/[pP].*[lL].*[uU].*[sS]/', $val_dt['tax_ext_desc']) === 1 |
427 |
|
// || preg_match('/[lL].*[eE].*[sS]/', $val_dt['tax_ext_desc']) === 1 |
428 |
|
// || preg_match('/[pP].*[sS].*[lL].*[aA]/', $val_dt['tax_ext_desc']) === 1 |
429 |
|
// || preg_match('/[pP].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1 |
430 |
|
// || preg_match('/[lL].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1) { |
431 |
|
// // |
432 |
|
// $val_dt['tax_su_princ_surf3'] = $val_dt['tax_surf_tot_cstr']; |
433 |
|
// $val_dt['tax_su_princ_surf_stat3'] = $val_dt['tax_surf_loc_stat']; |
434 |
|
// } |
435 |
|
} |
436 |
|
} |
437 |
|
} |
438 |
|
// Cas particulier de la surface taxable démolie |
439 |
|
if (isset($val_dt['tax_surf_tot_demo']) === true |
440 |
|
&& isset($val_dt['tax_surf_tax_demo']) === true |
441 |
|
&& ($val_dt['tax_surf_tot_demo'] === null |
442 |
|
|| $val_dt['tax_surf_tot_demo'] === '')) { |
443 |
|
// |
444 |
|
$val_dt['tax_surf_tot_demo'] = $val_dt['tax_surf_tax_demo']; |
445 |
|
} |
446 |
return $val_dt; |
return $val_dt; |
447 |
} |
} |
448 |
|
|
449 |
protected function get_external_uid($fk_idx, string $fk_idx_2) { |
protected function get_external_uid($fk_idx, string $fk_idx_2) { |
450 |
$inst_external_uid_da = $this->f->get_inst__by_other_idx(array( |
$inst_external_uid = $this->f->get_inst__by_other_idx(array( |
451 |
"obj" => "lien_id_interne_uid_externe", |
"obj" => "lien_id_interne_uid_externe", |
452 |
"fk_field" => 'object_id', |
"fk_field" => 'object_id', |
453 |
"fk_idx" => $fk_idx, |
"fk_idx" => $fk_idx, |
454 |
"fk_field_2" => 'object', |
"fk_field_2" => 'object', |
455 |
"fk_idx_2" => $fk_idx_2, |
"fk_idx_2" => $fk_idx_2, |
456 |
)); |
)); |
457 |
return $inst_external_uid_da->getVal('external_uid'); |
return $inst_external_uid->getVal('external_uid'); |
458 |
} |
} |
459 |
|
|
460 |
protected function get_demandeurs_data(string $dossier) { |
protected function get_demandeurs_data(string $dossier) { |
469 |
"obj" => "demandeur", |
"obj" => "demandeur", |
470 |
"idx" => $demandeur['demandeur'], |
"idx" => $demandeur['demandeur'], |
471 |
)); |
)); |
472 |
$val_demandeur[$demandeur['demandeur']] = json_decode($inst_demandeur->get_json_data(), true); |
$val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data(); |
473 |
$val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal']; |
$val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal']; |
474 |
} |
} |
475 |
return $val_demandeur; |
return $val_demandeur; |
476 |
} |
} |
477 |
|
|
478 |
protected function get_architecte_data($architecte = null) { |
protected function get_architecte_data($architecte = null) { |
479 |
$val_architecte = array(); |
$val_architecte = null; |
480 |
if ($architecte !== null |
if ($architecte !== null |
481 |
&& $architecte !== '') { |
&& $architecte !== '') { |
482 |
// |
// |
484 |
"obj" => "architecte", |
"obj" => "architecte", |
485 |
"idx" => $architecte, |
"idx" => $architecte, |
486 |
)); |
)); |
487 |
$val_architecte = json_decode($inst_architecte->get_json_data(), true); |
$val_architecte = $inst_architecte->get_json_data(); |
488 |
} |
} |
489 |
return $val_architecte; |
return $val_architecte; |
490 |
} |
} |
491 |
|
|
492 |
protected function get_instruction_data(string $dossier) { |
protected function get_instruction_data(string $dossier, $type = 'decision') { |
493 |
$val_instruction = array(); |
$val_instruction = null; |
494 |
|
$instruction_with_doc = null; |
495 |
$inst_di = $this->f->get_inst__om_dbform(array( |
$inst_di = $this->f->get_inst__om_dbform(array( |
496 |
"obj" => "dossier", |
"obj" => "dossier", |
497 |
"idx" => $dossier, |
"idx" => $dossier, |
498 |
)); |
)); |
499 |
|
$idx = null; |
500 |
|
if ($type === 'decision') { |
501 |
|
$idx = $inst_di->get_last_instruction_decision(); |
502 |
|
} |
503 |
|
if ($type === 'incompletude') { |
504 |
|
$idx = $inst_di->get_last_instruction_incompletude(); |
505 |
|
} |
506 |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
507 |
"obj" => "instruction", |
"obj" => "instruction", |
508 |
"idx" => $inst_di->get_last_instruction_decision(), |
"idx" => $idx, |
509 |
)); |
)); |
510 |
if (count($inst_instruction->val) > 0) { |
if (count($inst_instruction->val) > 0) { |
511 |
$val_instruction = json_decode($inst_instruction->get_json_data(), true); |
$val_instruction = array(); |
512 |
|
$instruction_data = $inst_instruction->get_json_data(); |
513 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
514 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
515 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
516 |
|
// |
517 |
|
$instruction_with_doc = $inst_instruction->getVal($inst_instruction->clePrimaire); |
518 |
|
} |
519 |
|
$inst_ev = $this->f->get_inst__om_dbform(array( |
520 |
|
"obj" => "evenement", |
521 |
|
"idx" => $inst_instruction->getVal('evenement'), |
522 |
|
)); |
523 |
|
if ($inst_ev->getVal('retour') === 't') { |
524 |
|
$instructions_related = $inst_instruction->get_related_instructions(); |
525 |
|
foreach ($instructions_related as $instruction) { |
526 |
|
if ($instruction !== null && $instruction !== '') { |
527 |
|
$inst_related_instruction = $this->f->get_inst__om_dbform(array( |
528 |
|
"obj" => "instruction", |
529 |
|
"idx" => $instruction, |
530 |
|
)); |
531 |
|
$instruction_data = $inst_related_instruction->get_json_data(); |
532 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
533 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
534 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
535 |
|
// |
536 |
|
$instruction_with_doc = $inst_related_instruction->getVal($inst_related_instruction->clePrimaire); |
537 |
|
} |
538 |
|
} |
539 |
|
} |
540 |
|
} |
541 |
|
if ($instruction_with_doc !== null) { |
542 |
|
// |
543 |
|
$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); |
544 |
|
} |
545 |
} |
} |
546 |
return $val_instruction; |
return $val_instruction; |
547 |
} |
} |
548 |
|
|
549 |
|
protected function sort_instruction_data(array $values, array $res) { |
550 |
|
$fields = array( |
551 |
|
"date_envoi_signature", |
552 |
|
"date_retour_signature", |
553 |
|
"date_envoi_rar", |
554 |
|
"date_retour_rar", |
555 |
|
"date_envoi_controle_legalite", |
556 |
|
"date_retour_controle_legalite", |
557 |
|
"signataire_arrete", |
558 |
|
"om_fichier_instruction", |
559 |
|
"tacite", |
560 |
|
"lettretype", |
561 |
|
); |
562 |
|
foreach ($values as $key => $value) { |
563 |
|
if (in_array($key, $fields) === true) { |
564 |
|
if (array_key_exists($key, $res) === false |
565 |
|
&& $value !== null |
566 |
|
&& $value !== '') { |
567 |
|
// |
568 |
|
$res[$key] = $value; |
569 |
|
} elseif ($key === 'tacite' |
570 |
|
&& $value === 't') { |
571 |
|
// |
572 |
|
$res[$key] = $value; |
573 |
|
} |
574 |
|
} |
575 |
|
} |
576 |
|
return $res; |
577 |
|
} |
578 |
|
|
579 |
protected function get_document_numerise_data(string $dn) { |
protected function get_document_numerise_data(string $dn) { |
580 |
$val_dn = array(); |
$val_dn = array(); |
581 |
$inst_dn = $this->f->get_inst__om_dbform(array( |
$inst_dn = $this->f->get_inst__om_dbform(array( |
582 |
"obj" => "document_numerise", |
"obj" => "document_numerise", |
583 |
"idx" => $dn, |
"idx" => $dn, |
584 |
)); |
)); |
585 |
$val_dn = json_decode($inst_dn->get_json_data(), true); |
$val_dn = $inst_dn->get_json_data(); |
586 |
$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')); |
587 |
|
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
588 |
|
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
589 |
return $val_dn; |
return $val_dn; |
590 |
} |
} |
591 |
|
|
592 |
protected function view_form_json() { |
protected function get_parcelles_data(string $object, string $idx) { |
593 |
|
$val_dp = array(); |
594 |
|
$inst_di = $this->f->get_inst__om_dbform(array( |
595 |
|
"obj" => $object, |
596 |
|
"idx" => $idx, |
597 |
|
)); |
598 |
|
$list_parcelles = $inst_di->get_parcelles(); |
599 |
|
$no_ordre = 1; |
600 |
|
foreach ($list_parcelles as $parcelle) { |
601 |
|
$val_dp[$parcelle[$object.'_parcelle']] = array( |
602 |
|
$object.'_parcelle' => $parcelle[$object.'_parcelle'], |
603 |
|
'libelle' => $parcelle['libelle'], |
604 |
|
'no_ordre' => $no_ordre, |
605 |
|
); |
606 |
|
$no_ordre++; |
607 |
|
} |
608 |
|
return $val_dp; |
609 |
|
} |
610 |
|
|
611 |
|
protected function view_form_json($in_field = false) { |
612 |
// Mise à jour des valeurs |
// Mise à jour des valeurs |
613 |
if ($this->f->get_submitted_get_value('valid') === 'true' |
if ($this->f->get_submitted_post_value('valid') === 'true' |
614 |
&& $this->f->get_submitted_get_value('state') !== null) { |
&& $this->f->get_submitted_post_value('state') !== null) { |
615 |
// |
// |
616 |
$params = array( |
$params = array( |
617 |
'val' => array( |
'val' => array( |
618 |
'state' => $this->f->get_submitted_get_value('state') |
'state' => $this->f->get_submitted_post_value('state') |
619 |
), |
), |
620 |
); |
); |
621 |
$update = $this->update_task($params); |
$update = $this->update_task($params); |
633 |
$this->f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
634 |
} |
} |
635 |
// |
// |
636 |
if ($this->f->get_submitted_get_value('valid') === 'true' |
if ($this->f->get_submitted_post_value('valid') === 'true' |
637 |
&& $this->f->get_submitted_get_value('external_uid') !== null) { |
&& $this->f->get_submitted_post_value('external_uid') !== null) { |
638 |
// |
// |
639 |
$inst_lien = $this->f->get_inst__om_dbform(array( |
$inst_lien = $this->f->get_inst__om_dbform(array( |
640 |
"obj" => "lien_id_interne_uid_externe", |
"obj" => "lien_id_interne_uid_externe", |
644 |
'lien_id_interne_uid_externe' => '', |
'lien_id_interne_uid_externe' => '', |
645 |
'object' => $this->get_lien_objet_by_type($this->getVal('type')), |
'object' => $this->get_lien_objet_by_type($this->getVal('type')), |
646 |
'object_id' => $this->getVal('object_id'), |
'object_id' => $this->getVal('object_id'), |
647 |
'external_uid' => $this->f->get_submitted_get_value('external_uid'), |
'external_uid' => $this->f->get_submitted_post_value('external_uid'), |
648 |
); |
); |
649 |
$add = $inst_lien->ajouter($valF); |
$add = $inst_lien->ajouter($valF); |
650 |
$message_class = "valid"; |
$message_class = "valid"; |
661 |
$this->f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
662 |
} |
} |
663 |
|
|
|
// Liste des valeurs à afficher |
|
|
$val = array(); |
|
|
// |
|
|
$val_task = array_combine($this->champs, $this->val); |
|
|
$val['task'] = $val_task; |
|
664 |
// |
// |
665 |
if ($this->getVal('type') === 'creation_DA') { |
if ($this->f->get_submitted_post_value('valid') === null) { |
666 |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
// Liste des valeurs à afficher |
667 |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation'); |
$val = array(); |
|
$val_external_uid = array(); |
|
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier_autorisation']['dossier_autorisation'], 'dossier_autorisation'); |
|
|
$val['external_uid'] = $val_external_uid; |
|
|
} |
|
|
// |
|
|
if ($this->getVal('type') === 'creation_DI' |
|
|
|| $this->getVal('type') === 'modification_DI') { |
|
668 |
// |
// |
669 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val_task = array_combine($this->champs, $this->val); |
670 |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction'); |
foreach ($val_task as $key => $value) { |
671 |
$val['demandeur'] = $this->get_demandeurs_data($val['dossier']['dossier']); |
$val_task[$key] = strip_tags($value); |
672 |
$val['architecte'] = $this->get_architecte_data($val['donnees_techniques']['architecte']); |
} |
673 |
$val_external_uid = array(); |
$val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true); |
674 |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
$val['task'] = $val_task; |
675 |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
// |
676 |
$val['external_uid'] = $val_external_uid; |
if ($this->getVal('type') === 'creation_DA') { |
677 |
} |
$val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id')); |
678 |
// |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation'); |
679 |
if ($this->getVal('type') === 'qualification_DI') { |
$val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']); |
680 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val_external_uid = array(); |
681 |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier']); |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier_autorisation']['dossier_autorisation'], 'dossier_autorisation'); |
682 |
$val_external_uid = array(); |
$val['external_uid'] = $val_external_uid; |
683 |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
} |
684 |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
// |
685 |
$val['external_uid'] = $val_external_uid; |
if ($this->getVal('type') === 'creation_DI' |
686 |
} |
|| $this->getVal('type') === 'modification_DI' |
687 |
// |
|| $this->getVal('type') === 'depot_DI') { |
688 |
if ($this->getVal('type') === 'ajout_piece') { |
// |
689 |
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
690 |
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
$val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction'); |
691 |
$val_external_uid = array(); |
$val['demandeur'] = $this->get_demandeurs_data($val['dossier']['dossier']); |
692 |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
$architecte = isset($val['donnees_techniques']['architecte']) === true ? $val['donnees_techniques']['architecte'] : null; |
693 |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
$val['architecte'] = $this->get_architecte_data($architecte); |
694 |
$val_external_uid['document_numerise'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'document_numerise'); |
$val['dossier_parcelle'] = $this->get_parcelles_data('dossier', $val['dossier']['dossier']); |
695 |
$val['external_uid'] = $val_external_uid; |
$val_external_uid = array(); |
696 |
} |
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
697 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
698 |
|
$val['external_uid'] = $val_external_uid; |
699 |
|
} |
700 |
|
// |
701 |
|
if ($this->getVal('type') === 'qualification_DI') { |
702 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
703 |
|
$val_external_uid = array(); |
704 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
705 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
706 |
|
$val['external_uid'] = $val_external_uid; |
707 |
|
} |
708 |
|
// |
709 |
|
if ($this->getVal('type') === 'ajout_piece') { |
710 |
|
$val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id')); |
711 |
|
$val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']); |
712 |
|
$val_external_uid = array(); |
713 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
714 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
715 |
|
$val_external_uid['document_numerise'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'document_numerise'); |
716 |
|
$val['external_uid'] = $val_external_uid; |
717 |
|
} |
718 |
|
// |
719 |
|
if ($this->getVal('type') === 'decision_DI') { |
720 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
721 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier']); |
722 |
|
$val_external_uid = array(); |
723 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
724 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
725 |
|
$val['external_uid'] = $val_external_uid; |
726 |
|
} |
727 |
|
// |
728 |
|
if ($this->getVal('type') === 'incompletude_DI') { |
729 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
730 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'incompletude'); |
731 |
|
$val_external_uid = array(); |
732 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
733 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
734 |
|
$val['external_uid'] = $val_external_uid; |
735 |
|
} |
736 |
|
// |
737 |
|
if ($this->getVal('type') === 'completude_DI') { |
738 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
739 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'completude'); |
740 |
|
$val_external_uid = array(); |
741 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
742 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
743 |
|
$val['external_uid'] = $val_external_uid; |
744 |
|
} |
745 |
|
|
746 |
// Liste des valeurs affichée en JSON |
if ($in_field === true) { |
747 |
printf(json_encode($val)); |
return json_encode($val, JSON_PRETTY_PRINT ,JSON_UNESCAPED_SLASHES); |
748 |
|
} else { |
749 |
|
// Liste des valeurs affichée en JSON |
750 |
|
printf(json_encode($val, JSON_UNESCAPED_SLASHES)); |
751 |
|
} |
752 |
|
} |
753 |
} |
} |
754 |
|
|
755 |
protected function get_lien_objet_by_type($type) { |
protected function get_lien_objet_by_type($type) { |
758 |
if ($type === 'creation_DA') { |
if ($type === 'creation_DA') { |
759 |
$objet = 'dossier_autorisation'; |
$objet = 'dossier_autorisation'; |
760 |
} |
} |
761 |
if ($type === 'creation_DI' || $type = 'modification_DI') { |
if ($type === 'creation_DI' |
762 |
|
|| $type === 'depot_DI' |
763 |
|
|| $type === 'modification_DI' |
764 |
|
|| $type === 'qualification_DI' |
765 |
|
|| $type === 'decision_DI' |
766 |
|
|| $type === 'incompletude_DI' |
767 |
|
|| $type === 'completude_DI') { |
768 |
|
// |
769 |
$objet = 'dossier'; |
$objet = 'dossier'; |
770 |
} |
} |
771 |
if ($type === 'ajout_piece') { |
if ($type === 'ajout_piece') { |
773 |
} |
} |
774 |
return $objet; |
return $objet; |
775 |
} |
} |
776 |
|
|
777 |
|
function setLayout(&$form, $maj) { |
778 |
|
$form->setBloc('json_payload', 'D', '', 'col_6'); |
779 |
|
$form->setFieldset('json_payload', 'DF', _("json_payload"), "collapsible, startClosed"); |
780 |
|
$form->setBloc('json_payload', 'F'); |
781 |
|
$form->setBloc('timestamp_log', 'DF', '', 'col_9'); |
782 |
|
} |
783 |
|
|
784 |
} |
} |