62 |
'object_id' => $params['val']['object_id'], |
'object_id' => $params['val']['object_id'], |
63 |
); |
); |
64 |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
65 |
|
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
66 |
|
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
67 |
|
} |
68 |
if ($task_exists !== false) { |
if ($task_exists !== false) { |
69 |
$inst_task = $this->f->get_inst__om_dbform(array( |
$inst_task = $this->f->get_inst__om_dbform(array( |
70 |
"obj" => "task", |
"obj" => "task", |
71 |
"idx" => $task_exists, |
"idx" => $task_exists, |
72 |
)); |
)); |
73 |
|
$update_state = $inst_task->getVal('state'); |
74 |
|
if (isset($params['update_val']['state']) === true) { |
75 |
|
$update_state = $params['update_val']['state']; |
76 |
|
} |
77 |
$update_params = array( |
$update_params = array( |
78 |
'val' => array( |
'val' => array( |
79 |
'state' => $inst_task->getVal('state'), |
'state' => $update_state, |
80 |
), |
), |
81 |
); |
); |
82 |
return $inst_task->update_task($update_params); |
return $inst_task->update_task($update_params); |
173 |
* |
* |
174 |
FROM %1$stask |
FROM %1$stask |
175 |
%2$s |
%2$s |
176 |
|
ORDER BY task ASC |
177 |
', |
', |
178 |
DB_PREFIXE, |
DB_PREFIXE, |
179 |
$where |
$where |
253 |
} |
} |
254 |
// Correspond à la nouvelle ligne CERFA v7 dans le DENSI imposition 1.2.3 |
// Correspond à la nouvelle ligne CERFA v7 dans le DENSI imposition 1.2.3 |
255 |
if (isset($val_dt['tax_su_non_habit_surf2']) === true |
if (isset($val_dt['tax_su_non_habit_surf2']) === true |
256 |
&& isset($val_dt['tax_su_non_habit_surf3']) === true) { |
&& isset($val_dt['tax_su_non_habit_surf3']) === true |
257 |
|
&& (($val_dt['tax_su_non_habit_surf2'] !== null |
258 |
|
&& $val_dt['tax_su_non_habit_surf2'] !== '') |
259 |
|
|| ($val_dt['tax_su_non_habit_surf3'] !== null |
260 |
|
&& $val_dt['tax_su_non_habit_surf3'] !== ''))) { |
261 |
// |
// |
262 |
$val_dt['tax_su_non_habit_surf8'] = intval($val_dt['tax_su_non_habit_surf2']) + intval($val_dt['tax_su_non_habit_surf3']); |
$val_dt['tax_su_non_habit_surf8'] = intval($val_dt['tax_su_non_habit_surf2']) + intval($val_dt['tax_su_non_habit_surf3']); |
263 |
} |
} |
264 |
if (isset($val_dt['tax_su_non_habit_surf_stat2']) === true |
if (isset($val_dt['tax_su_non_habit_surf_stat2']) === true |
265 |
&& isset($val_dt['tax_su_non_habit_surf_stat3']) === true) { |
&& isset($val_dt['tax_su_non_habit_surf_stat3']) === true |
266 |
|
&& (($val_dt['tax_su_non_habit_surf_stat2'] !== null |
267 |
|
&& $val_dt['tax_su_non_habit_surf_stat2'] !== '') |
268 |
|
|| ($val_dt['tax_su_non_habit_surf_stat3'] !== null |
269 |
|
&& $val_dt['tax_su_non_habit_surf_stat3'] !== ''))) { |
270 |
// |
// |
271 |
$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']); |
$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']); |
272 |
} |
} |
274 |
$particular_case = false; |
$particular_case = false; |
275 |
$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(); |
276 |
foreach ($fields_tab_crea_loc_hab as $field) { |
foreach ($fields_tab_crea_loc_hab as $field) { |
277 |
if (isset($field) === false |
if (isset($val_dt[$field]) === false |
278 |
|| (isset($field) === true |
|| (isset($val_dt[$field]) === true |
279 |
&& $field !== null |
&& ($val_dt[$field] === null |
280 |
&& $field !== '')) { |
|| $val_dt[$field] === ''))) { |
281 |
// |
// |
282 |
$particular_case = true; |
$particular_case = true; |
283 |
} |
} |
351 |
)); |
)); |
352 |
$val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data(); |
$val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data(); |
353 |
$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'; |
|
354 |
} |
} |
355 |
return $val_demandeur; |
return $val_demandeur; |
356 |
} |
} |
369 |
return $val_architecte; |
return $val_architecte; |
370 |
} |
} |
371 |
|
|
372 |
protected function get_instruction_data(string $dossier) { |
protected function get_instruction_data(string $dossier, $type = 'decision') { |
373 |
$val_instruction = array(); |
$val_instruction = null; |
374 |
|
$instruction_with_doc = null; |
375 |
$inst_di = $this->f->get_inst__om_dbform(array( |
$inst_di = $this->f->get_inst__om_dbform(array( |
376 |
"obj" => "dossier", |
"obj" => "dossier", |
377 |
"idx" => $dossier, |
"idx" => $dossier, |
378 |
)); |
)); |
379 |
|
$idx = null; |
380 |
|
if ($type === 'decision') { |
381 |
|
$idx = $inst_di->get_last_instruction_decision(); |
382 |
|
} |
383 |
|
if ($type === 'incompletude') { |
384 |
|
$idx = $inst_di->get_last_instruction_incompletude(); |
385 |
|
} |
386 |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
$inst_instruction = $this->f->get_inst__om_dbform(array( |
387 |
"obj" => "instruction", |
"obj" => "instruction", |
388 |
"idx" => $inst_di->get_last_instruction_decision(), |
"idx" => $idx, |
389 |
)); |
)); |
390 |
if (count($inst_instruction->val) > 0) { |
if (count($inst_instruction->val) > 0) { |
391 |
$val_instruction = $inst_instruction->get_json_data(); |
$val_instruction = array(); |
392 |
|
$instruction_data = $inst_instruction->get_json_data(); |
393 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
394 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
395 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
396 |
|
// |
397 |
|
$instruction_with_doc = $inst_instruction->getVal($inst_instruction->clePrimaire); |
398 |
|
} |
399 |
|
$inst_ev = $this->f->get_inst__om_dbform(array( |
400 |
|
"obj" => "evenement", |
401 |
|
"idx" => $inst_instruction->getVal('evenement'), |
402 |
|
)); |
403 |
|
if ($inst_ev->getVal('retour') === 't') { |
404 |
|
$instructions_related = $inst_instruction->get_related_instructions(); |
405 |
|
foreach ($instructions_related as $instruction) { |
406 |
|
if ($instruction !== null && $instruction !== '') { |
407 |
|
$inst_related_instruction = $this->f->get_inst__om_dbform(array( |
408 |
|
"obj" => "instruction", |
409 |
|
"idx" => $instruction, |
410 |
|
)); |
411 |
|
$instruction_data = $inst_related_instruction->get_json_data(); |
412 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
413 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
414 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
415 |
|
// |
416 |
|
$instruction_with_doc = $inst_related_instruction->getVal($inst_related_instruction->clePrimaire); |
417 |
|
} |
418 |
|
} |
419 |
|
} |
420 |
|
} |
421 |
|
if ($instruction_with_doc !== null) { |
422 |
|
// |
423 |
|
$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); |
424 |
|
} |
425 |
} |
} |
426 |
return $val_instruction; |
return $val_instruction; |
427 |
} |
} |
428 |
|
|
429 |
|
protected function sort_instruction_data(array $values, array $res) { |
430 |
|
$fields = array( |
431 |
|
"date_envoi_signature", |
432 |
|
"date_retour_signature", |
433 |
|
"date_envoi_rar", |
434 |
|
"date_retour_rar", |
435 |
|
"date_envoi_controle_legalite", |
436 |
|
"date_retour_controle_legalite", |
437 |
|
"signataire_arrete", |
438 |
|
"om_fichier_instruction", |
439 |
|
"tacite", |
440 |
|
); |
441 |
|
foreach ($values as $key => $value) { |
442 |
|
if (in_array($key, $fields) === true) { |
443 |
|
if (array_key_exists($key, $res) === false |
444 |
|
&& $value !== null |
445 |
|
&& $value !== '') { |
446 |
|
// |
447 |
|
$res[$key] = $value; |
448 |
|
} elseif ($key === 'tacite' |
449 |
|
&& $value === 't') { |
450 |
|
// |
451 |
|
$res[$key] = $value; |
452 |
|
} |
453 |
|
} |
454 |
|
} |
455 |
|
return $res; |
456 |
|
} |
457 |
|
|
458 |
protected function get_document_numerise_data(string $dn) { |
protected function get_document_numerise_data(string $dn) { |
459 |
$val_dn = array(); |
$val_dn = array(); |
460 |
$inst_dn = $this->f->get_inst__om_dbform(array( |
$inst_dn = $this->f->get_inst__om_dbform(array( |
462 |
"idx" => $dn, |
"idx" => $dn, |
463 |
)); |
)); |
464 |
$val_dn = $inst_dn->get_json_data(); |
$val_dn = $inst_dn->get_json_data(); |
465 |
$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')); |
466 |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
467 |
$val_dn['nature'] = 'Initiale'; |
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
468 |
return $val_dn; |
return $val_dn; |
469 |
} |
} |
470 |
|
|
562 |
} |
} |
563 |
// |
// |
564 |
if ($this->getVal('type') === 'creation_DI' |
if ($this->getVal('type') === 'creation_DI' |
565 |
|| $this->getVal('type') === 'modification_DI') { |
|| $this->getVal('type') === 'modification_DI' |
566 |
|
|| $this->getVal('type') === 'depot_DI') { |
567 |
// |
// |
568 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
569 |
$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'); |
579 |
// |
// |
580 |
if ($this->getVal('type') === 'qualification_DI') { |
if ($this->getVal('type') === 'qualification_DI') { |
581 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier']); |
|
582 |
$val_external_uid = array(); |
$val_external_uid = array(); |
583 |
$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'); |
584 |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
594 |
$val_external_uid['document_numerise'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'document_numerise'); |
$val_external_uid['document_numerise'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'document_numerise'); |
595 |
$val['external_uid'] = $val_external_uid; |
$val['external_uid'] = $val_external_uid; |
596 |
} |
} |
597 |
|
// |
598 |
|
if ($this->getVal('type') === 'decision_DI') { |
599 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
600 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier']); |
601 |
|
$val_external_uid = array(); |
602 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
603 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
604 |
|
$val['external_uid'] = $val_external_uid; |
605 |
|
} |
606 |
|
// |
607 |
|
if ($this->getVal('type') === 'incompletude_DI') { |
608 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
609 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'incompletude'); |
610 |
|
$val_external_uid = array(); |
611 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
612 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
613 |
|
$val['external_uid'] = $val_external_uid; |
614 |
|
} |
615 |
|
// |
616 |
|
if ($this->getVal('type') === 'completude_DI') { |
617 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
618 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'completude'); |
619 |
|
$val_external_uid = array(); |
620 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
621 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
622 |
|
$val['external_uid'] = $val_external_uid; |
623 |
|
} |
624 |
|
|
625 |
// Liste des valeurs affichée en JSON |
// Liste des valeurs affichée en JSON |
626 |
printf(json_encode($val)); |
printf(json_encode($val, JSON_UNESCAPED_SLASHES)); |
627 |
} |
} |
628 |
} |
} |
629 |
|
|
633 |
if ($type === 'creation_DA') { |
if ($type === 'creation_DA') { |
634 |
$objet = 'dossier_autorisation'; |
$objet = 'dossier_autorisation'; |
635 |
} |
} |
636 |
if ($type === 'creation_DI' || $type === 'modification_DI') { |
if ($type === 'creation_DI' |
637 |
|
|| $type === 'depot_DI' |
638 |
|
|| $type === 'modification_DI' |
639 |
|
|| $type === 'qualification_DI' |
640 |
|
|| $type === 'decision_DI' |
641 |
|
|| $type === 'incompletude_DI' |
642 |
|
|| $type === 'completude_DI') { |
643 |
|
// |
644 |
$objet = 'dossier'; |
$objet = 'dossier'; |
645 |
} |
} |
646 |
if ($type === 'ajout_piece') { |
if ($type === 'ajout_piece') { |