67 |
"obj" => "task", |
"obj" => "task", |
68 |
"idx" => $task_exists, |
"idx" => $task_exists, |
69 |
)); |
)); |
70 |
|
$update_state = $inst_task->getVal('state'); |
71 |
|
if (isset($params['update_val']['state']) === true) { |
72 |
|
$update_state = $params['update_val']['state']; |
73 |
|
} |
74 |
$update_params = array( |
$update_params = array( |
75 |
'val' => array( |
'val' => array( |
76 |
'state' => $inst_task->getVal('state'), |
'state' => $update_state, |
77 |
), |
), |
78 |
); |
); |
79 |
return $inst_task->update_task($update_params); |
return $inst_task->update_task($update_params); |
180 |
} |
} |
181 |
$list_tasks = array(); |
$list_tasks = array(); |
182 |
foreach ($res['result'] as $task) { |
foreach ($res['result'] as $task) { |
183 |
|
$task['timestamp_log'] = json_decode($task['timestamp_log'], true); |
184 |
$list_tasks[$task['task']] = $task; |
$list_tasks[$task['task']] = $task; |
185 |
} |
} |
186 |
printf(json_encode($list_tasks)); |
printf(json_encode($list_tasks)); |
192 |
"obj" => "dossier", |
"obj" => "dossier", |
193 |
"idx" => $dossier, |
"idx" => $dossier, |
194 |
)); |
)); |
195 |
$val_di = json_decode($inst_di->get_json_data(), true); |
$val_di = $inst_di->get_json_data(); |
196 |
if ($val_di['dossier_instruction_type_code'] === 'T') { |
if ($val_di['dossier_instruction_type_code'] === 'T') { |
197 |
$val_di['date_decision_transfert'] = $val_di['date_decision']; |
$val_di['date_decision_transfert'] = $val_di['date_decision']; |
198 |
} |
} |
207 |
"obj" => "dossier_autorisation", |
"obj" => "dossier_autorisation", |
208 |
"idx" => $da, |
"idx" => $da, |
209 |
)); |
)); |
210 |
$val_da = json_decode($inst_da->get_json_data(), true); |
$val_da = $inst_da->get_json_data(); |
211 |
return $val_da; |
return $val_da; |
212 |
} |
} |
213 |
|
|
231 |
} |
} |
232 |
// Correspond à la nomenclature de Plat'AU STATUT_INFO |
// Correspond à la nomenclature de Plat'AU STATUT_INFO |
233 |
$val_dt['tax_statut_info'] = 'Déclaré'; |
$val_dt['tax_statut_info'] = 'Déclaré'; |
234 |
|
// |
235 |
|
if ($inst_dt->is_tab_surf_ssdest_enabled() === true) { |
236 |
|
$fields_tab_surf_dest = $inst_dt->get_fields_tab_surf_dest(); |
237 |
|
foreach ($fields_tab_surf_dest as $field) { |
238 |
|
if (isset($val_dt[$field]) === true) { |
239 |
|
unset($val_dt[$field]); |
240 |
|
} |
241 |
|
} |
242 |
|
} else { |
243 |
|
$fields_tab_surf_ssdest = $inst_dt->get_fields_tab_surf_ssdest(); |
244 |
|
foreach ($fields_tab_surf_ssdest as $field) { |
245 |
|
if (isset($val_dt[$field]) === true) { |
246 |
|
unset($val_dt[$field]); |
247 |
|
} |
248 |
|
} |
249 |
|
} |
250 |
|
// Correspond à la nouvelle ligne CERFA v7 dans le DENSI imposition 1.2.3 |
251 |
|
if (isset($val_dt['tax_su_non_habit_surf2']) === true |
252 |
|
&& isset($val_dt['tax_su_non_habit_surf3']) === true |
253 |
|
&& (($val_dt['tax_su_non_habit_surf2'] !== null |
254 |
|
&& $val_dt['tax_su_non_habit_surf2'] !== '') |
255 |
|
|| ($val_dt['tax_su_non_habit_surf3'] !== null |
256 |
|
&& $val_dt['tax_su_non_habit_surf3'] !== ''))) { |
257 |
|
// |
258 |
|
$val_dt['tax_su_non_habit_surf8'] = intval($val_dt['tax_su_non_habit_surf2']) + intval($val_dt['tax_su_non_habit_surf3']); |
259 |
|
} |
260 |
|
if (isset($val_dt['tax_su_non_habit_surf_stat2']) === true |
261 |
|
&& isset($val_dt['tax_su_non_habit_surf_stat3']) === true |
262 |
|
&& (($val_dt['tax_su_non_habit_surf_stat2'] !== null |
263 |
|
&& $val_dt['tax_su_non_habit_surf_stat2'] !== '') |
264 |
|
|| ($val_dt['tax_su_non_habit_surf_stat3'] !== null |
265 |
|
&& $val_dt['tax_su_non_habit_surf_stat3'] !== ''))) { |
266 |
|
// |
267 |
|
$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']); |
268 |
|
} |
269 |
|
// Cas particulier d'un projet réduit à l'extension d'une habitation existante |
270 |
|
$particular_case = false; |
271 |
|
$fields_tab_crea_loc_hab = $inst_dt->get_fields_tab_crea_loc_hab(); |
272 |
|
foreach ($fields_tab_crea_loc_hab as $field) { |
273 |
|
if (isset($field) === false |
274 |
|
|| (isset($field) === true |
275 |
|
&& $field !== null |
276 |
|
&& $field !== '')) { |
277 |
|
// |
278 |
|
$particular_case = true; |
279 |
|
} |
280 |
|
} |
281 |
|
if ($particular_case === true) { |
282 |
|
if (isset($val_dt['tax_ext_pret']) === true |
283 |
|
&& $val_dt['tax_ext_pret'] === 'f') { |
284 |
|
// |
285 |
|
$val_dt['tax_su_princ_surf1'] = $val_dt['tax_surf_tot_cstr']; |
286 |
|
$val_dt['tax_su_princ_surf_stat1'] = $val_dt['tax_surf_loc_stat']; |
287 |
|
} |
288 |
|
if (isset($val_dt['tax_ext_pret']) === true |
289 |
|
&& $val_dt['tax_ext_pret'] === 't') { |
290 |
|
// |
291 |
|
if (isset($val_dt['tax_ext_desc']) === true) { |
292 |
|
if (preg_match('/[pP].*[lL].*[aA].*[iI]/', $val_dt['tax_ext_desc']) === 1 |
293 |
|
|| preg_match('/[lL].*[lL].*[tT].*[sS]/', $val_dt['tax_ext_desc']) === 1) { |
294 |
|
// |
295 |
|
$val_dt['tax_su_princ_surf2'] = $val_dt['tax_surf_tot_cstr']; |
296 |
|
$val_dt['tax_su_princ_surf_stat2'] = $val_dt['tax_surf_loc_stat']; |
297 |
|
} |
298 |
|
// if (preg_match('/[pP].*[tT].*[zZ]/', $val_dt['tax_ext_desc']) === 1) { |
299 |
|
// $val_dt['tax_su_princ_surf4'] = $val_dt['tax_surf_tot_cstr']; |
300 |
|
// $val_dt['tax_su_princ_surf_stat4'] = $val_dt['tax_surf_loc_stat']; |
301 |
|
// } |
302 |
|
// if (preg_match('/[pP].*[lL].*[uU].*[sS]/', $val_dt['tax_ext_desc']) === 1 |
303 |
|
// || preg_match('/[lL].*[eE].*[sS]/', $val_dt['tax_ext_desc']) === 1 |
304 |
|
// || preg_match('/[pP].*[sS].*[lL].*[aA]/', $val_dt['tax_ext_desc']) === 1 |
305 |
|
// || preg_match('/[pP].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1 |
306 |
|
// || preg_match('/[lL].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1) { |
307 |
|
// // |
308 |
|
// $val_dt['tax_su_princ_surf3'] = $val_dt['tax_surf_tot_cstr']; |
309 |
|
// $val_dt['tax_su_princ_surf_stat3'] = $val_dt['tax_surf_loc_stat']; |
310 |
|
// } |
311 |
|
} |
312 |
|
} |
313 |
|
} |
314 |
|
// Cas particulier de la surface taxable démolie |
315 |
|
if (isset($val_dt['tax_surf_tot_demo']) === true |
316 |
|
&& isset($val_dt['tax_surf_tax_demo']) === true |
317 |
|
&& ($val_dt['tax_surf_tot_demo'] === null |
318 |
|
|| $val_dt['tax_surf_tot_demo'] === '')) { |
319 |
|
// |
320 |
|
$val_dt['tax_surf_tot_demo'] = $val_dt['tax_surf_tax_demo']; |
321 |
|
} |
322 |
return $val_dt; |
return $val_dt; |
323 |
} |
} |
324 |
|
|
325 |
protected function get_external_uid($fk_idx, string $fk_idx_2) { |
protected function get_external_uid($fk_idx, string $fk_idx_2) { |
326 |
$inst_external_uid_da = $this->f->get_inst__by_other_idx(array( |
$inst_external_uid = $this->f->get_inst__by_other_idx(array( |
327 |
"obj" => "lien_id_interne_uid_externe", |
"obj" => "lien_id_interne_uid_externe", |
328 |
"fk_field" => 'object_id', |
"fk_field" => 'object_id', |
329 |
"fk_idx" => $fk_idx, |
"fk_idx" => $fk_idx, |
330 |
"fk_field_2" => 'object', |
"fk_field_2" => 'object', |
331 |
"fk_idx_2" => $fk_idx_2, |
"fk_idx_2" => $fk_idx_2, |
332 |
)); |
)); |
333 |
return $inst_external_uid_da->getVal('external_uid'); |
return $inst_external_uid->getVal('external_uid'); |
334 |
} |
} |
335 |
|
|
336 |
protected function get_demandeurs_data(string $dossier) { |
protected function get_demandeurs_data(string $dossier) { |
345 |
"obj" => "demandeur", |
"obj" => "demandeur", |
346 |
"idx" => $demandeur['demandeur'], |
"idx" => $demandeur['demandeur'], |
347 |
)); |
)); |
348 |
$val_demandeur[$demandeur['demandeur']] = json_decode($inst_demandeur->get_json_data(), true); |
$val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data(); |
349 |
$val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal']; |
$val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal']; |
350 |
} |
} |
351 |
return $val_demandeur; |
return $val_demandeur; |
352 |
} |
} |
353 |
|
|
354 |
protected function get_architecte_data($architecte = null) { |
protected function get_architecte_data($architecte = null) { |
355 |
$val_architecte = array(); |
$val_architecte = null; |
356 |
if ($architecte !== null |
if ($architecte !== null |
357 |
&& $architecte !== '') { |
&& $architecte !== '') { |
358 |
// |
// |
360 |
"obj" => "architecte", |
"obj" => "architecte", |
361 |
"idx" => $architecte, |
"idx" => $architecte, |
362 |
)); |
)); |
363 |
$val_architecte = json_decode($inst_architecte->get_json_data(), true); |
$val_architecte = $inst_architecte->get_json_data(); |
364 |
} |
} |
365 |
return $val_architecte; |
return $val_architecte; |
366 |
} |
} |
367 |
|
|
368 |
protected function get_instruction_data(string $dossier) { |
protected function get_instruction_data(string $dossier) { |
369 |
$val_instruction = array(); |
$val_instruction = null; |
370 |
|
$instruction_with_doc = null; |
371 |
$inst_di = $this->f->get_inst__om_dbform(array( |
$inst_di = $this->f->get_inst__om_dbform(array( |
372 |
"obj" => "dossier", |
"obj" => "dossier", |
373 |
"idx" => $dossier, |
"idx" => $dossier, |
377 |
"idx" => $inst_di->get_last_instruction_decision(), |
"idx" => $inst_di->get_last_instruction_decision(), |
378 |
)); |
)); |
379 |
if (count($inst_instruction->val) > 0) { |
if (count($inst_instruction->val) > 0) { |
380 |
$val_instruction = json_decode($inst_instruction->get_json_data(), true); |
$val_instruction = array(); |
381 |
|
$instruction_data = $inst_instruction->get_json_data(); |
382 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
383 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
384 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
385 |
|
// |
386 |
|
$instruction_with_doc = $inst_instruction->getVal($inst_instruction->clePrimaire); |
387 |
|
} |
388 |
|
$inst_ev = $this->f->get_inst__om_dbform(array( |
389 |
|
"obj" => "evenement", |
390 |
|
"idx" => $inst_instruction->getVal('evenement'), |
391 |
|
)); |
392 |
|
if ($inst_ev->getVal('retour') === 't') { |
393 |
|
$instructions_related = $inst_instruction->get_related_instructions(); |
394 |
|
foreach ($instructions_related as $instruction) { |
395 |
|
if ($instruction !== null && $instruction !== '') { |
396 |
|
$inst_related_instruction = $this->f->get_inst__om_dbform(array( |
397 |
|
"obj" => "instruction", |
398 |
|
"idx" => $instruction, |
399 |
|
)); |
400 |
|
$instruction_data = $inst_related_instruction->get_json_data(); |
401 |
|
$val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction); |
402 |
|
if ($instruction_data['om_fichier_instruction'] !== null |
403 |
|
&& $instruction_data['om_fichier_instruction'] !== '') { |
404 |
|
// |
405 |
|
$instruction_with_doc = $inst_related_instruction->getVal($inst_related_instruction->clePrimaire); |
406 |
|
} |
407 |
|
} |
408 |
|
} |
409 |
|
} |
410 |
|
if ($instruction_with_doc !== null) { |
411 |
|
// |
412 |
|
$val_instruction['path'] = sprintf('%s/%s&snippet=%s&obj=%s&champ=%s&id=%s', $_SERVER['HTTP_HOST'], 'openads/app/index.php?module=form', 'file', 'instruction', 'om_fichier_instruction', $instruction_with_doc); |
413 |
|
} |
414 |
} |
} |
415 |
return $val_instruction; |
return $val_instruction; |
416 |
} |
} |
417 |
|
|
418 |
|
protected function sort_instruction_data(array $values, array $res) { |
419 |
|
$fields = array( |
420 |
|
"date_envoi_signature", |
421 |
|
"date_retour_signature", |
422 |
|
"date_envoi_rar", |
423 |
|
"date_retour_rar", |
424 |
|
"date_envoi_controle_legalite", |
425 |
|
"date_retour_controle_legalite", |
426 |
|
"signataire_arrete", |
427 |
|
"om_fichier_instruction", |
428 |
|
"tacite", |
429 |
|
); |
430 |
|
foreach ($values as $key => $value) { |
431 |
|
if (in_array($key, $fields) === true) { |
432 |
|
if (array_key_exists($key, $res) === false |
433 |
|
&& $value !== null |
434 |
|
&& $value !== '') { |
435 |
|
// |
436 |
|
$res[$key] = $value; |
437 |
|
} elseif ($key === 'tacite' |
438 |
|
&& $value === 't') { |
439 |
|
// |
440 |
|
$res[$key] = $value; |
441 |
|
} |
442 |
|
} |
443 |
|
} |
444 |
|
return $res; |
445 |
|
} |
446 |
|
|
447 |
protected function get_document_numerise_data(string $dn) { |
protected function get_document_numerise_data(string $dn) { |
448 |
$val_dn = array(); |
$val_dn = array(); |
449 |
$inst_dn = $this->f->get_inst__om_dbform(array( |
$inst_dn = $this->f->get_inst__om_dbform(array( |
450 |
"obj" => "document_numerise", |
"obj" => "document_numerise", |
451 |
"idx" => $dn, |
"idx" => $dn, |
452 |
)); |
)); |
453 |
$val_dn = json_decode($inst_dn->get_json_data(), true); |
$val_dn = $inst_dn->get_json_data(); |
454 |
$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/%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')); |
455 |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
456 |
$val_dn['nature'] = 'Initiale'; |
$val_dn['nature'] = 'Initiale'; |
535 |
$val = array(); |
$val = array(); |
536 |
// |
// |
537 |
$val_task = array_combine($this->champs, $this->val); |
$val_task = array_combine($this->champs, $this->val); |
538 |
|
foreach ($val_task as $key => $value) { |
539 |
|
$val_task[$key] = strip_tags($value); |
540 |
|
} |
541 |
|
$val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true); |
542 |
$val['task'] = $val_task; |
$val['task'] = $val_task; |
543 |
// |
// |
544 |
if ($this->getVal('type') === 'creation_DA') { |
if ($this->getVal('type') === 'creation_DA') { |
551 |
} |
} |
552 |
// |
// |
553 |
if ($this->getVal('type') === 'creation_DI' |
if ($this->getVal('type') === 'creation_DI' |
554 |
|| $this->getVal('type') === 'modification_DI') { |
|| $this->getVal('type') === 'modification_DI' |
555 |
|
|| $this->getVal('type') === 'depot_DI') { |
556 |
// |
// |
557 |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
558 |
$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'); |
568 |
// |
// |
569 |
if ($this->getVal('type') === 'qualification_DI') { |
if ($this->getVal('type') === 'qualification_DI') { |
570 |
$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']); |
|
571 |
$val_external_uid = array(); |
$val_external_uid = array(); |
572 |
$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'); |
573 |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
583 |
$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'); |
584 |
$val['external_uid'] = $val_external_uid; |
$val['external_uid'] = $val_external_uid; |
585 |
} |
} |
586 |
|
// |
587 |
|
if ($this->getVal('type') === 'decision_DI') { |
588 |
|
$val['dossier'] = $this->get_dossier_data($this->getVal('object_id')); |
589 |
|
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier']); |
590 |
|
$val_external_uid = array(); |
591 |
|
$val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation'); |
592 |
|
$val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier'); |
593 |
|
$val['external_uid'] = $val_external_uid; |
594 |
|
} |
595 |
|
|
596 |
// Liste des valeurs affichée en JSON |
// Liste des valeurs affichée en JSON |
597 |
printf(json_encode($val)); |
printf(json_encode($val)); |
604 |
if ($type === 'creation_DA') { |
if ($type === 'creation_DA') { |
605 |
$objet = 'dossier_autorisation'; |
$objet = 'dossier_autorisation'; |
606 |
} |
} |
607 |
if ($type === 'creation_DI' || $type = 'modification_DI') { |
if ($type === 'creation_DI' |
608 |
|
|| $type === 'depot_DI' |
609 |
|
|| $type === 'modification_DI' |
610 |
|
|| $type === 'qualification_DI' |
611 |
|
|| $type === 'decision_DI') { |
612 |
|
// |
613 |
$objet = 'dossier'; |
$objet = 'dossier'; |
614 |
} |
} |
615 |
if ($type === 'ajout_piece') { |
if ($type === 'ajout_piece') { |