/[openfoncier]/trunk/obj/task.class.php
ViewVC logotype

Annotation of /trunk/obj/task.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9481 - (hide annotations)
Tue Aug 25 09:23:01 2020 UTC (4 years, 5 months ago) by softime
Original Path: branches/4.14.0-develop_demat/obj/task.class.php
File size: 28146 byte(s)
* WIP Démat : ajoute un tri à la vue tab JSON pour task

1 softime 9293 <?php
2     //$Id$
3     //gen openMairie le 14/04/2020 14:11
4    
5     require_once "../gen/obj/task.class.php";
6    
7     class task extends task_gen {
8    
9     /**
10     * Définition des actions disponibles sur la classe.
11     *
12     * @return void
13     */
14     public function init_class_actions() {
15     parent::init_class_actions();
16     //
17     $this->class_actions[998] = array(
18 softime 9330 "identifier" => "json_data",
19     "view" => "view_json_data",
20 softime 9293 "permission_suffix" => "consulter",
21     );
22     }
23    
24 softime 9395 protected function task_exists(string $type, string $object_id) {
25     $query = sprintf('
26     SELECT task
27     FROM %1$stask
28     WHERE state != \'%2$s\'
29     AND type = \'%3$s\'
30     AND object_id = \'%4$s\'
31     ',
32     DB_PREFIXE,
33     'done',
34     $type,
35     $object_id
36     );
37     $res = $this->f->get_one_result_from_db_query($query);
38     if ($res['result'] !== null && $res['result'] !== '') {
39     return $res['result'];
40     }
41     return false;
42     }
43    
44 softime 9293 /**
45     * TREATMENT - add_task
46     * Ajoute un enregistrement.
47     *
48     * @param array $params Tableau des paramètres
49     * @return boolean
50     */
51     public function add_task($params = array()) {
52     $this->begin_treatment(__METHOD__);
53     $timestamp_log = json_encode(array(
54     'creation_date' => date('Y-m-d H:i:s'),
55     ));
56     // Mise à jour du DI
57     $valF = array(
58     'task' => '',
59     'type' => $params['val']['type'],
60     'timestamp_log' => $timestamp_log,
61 softime 9385 'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new',
62 softime 9389 'object_id' => $params['val']['object_id'],
63 softime 9293 );
64 softime 9395 $task_exists = $this->task_exists($valF['type'], $valF['object_id']);
65 softime 9457 if ($valF['type'] === 'modification_DI' && $task_exists === false) {
66     $task_exists = $this->task_exists('creation_DI', $valF['object_id']);
67     }
68 softime 9395 if ($task_exists !== false) {
69     $inst_task = $this->f->get_inst__om_dbform(array(
70     "obj" => "task",
71     "idx" => $task_exists,
72     ));
73 softime 9414 $update_state = $inst_task->getVal('state');
74     if (isset($params['update_val']['state']) === true) {
75     $update_state = $params['update_val']['state'];
76     }
77 softime 9395 $update_params = array(
78     'val' => array(
79 softime 9414 'state' => $update_state,
80 softime 9395 ),
81     );
82     return $inst_task->update_task($update_params);
83     }
84 softime 9293 $add = $this->ajouter($valF);
85     if ($add === false) {
86     $this->addToLog($this->msg, DEBUG_MODE);
87     return $this->end_treatment(__METHOD__, false);
88     }
89     return $this->end_treatment(__METHOD__, true);
90     }
91    
92     /**
93     * TREATMENT - update_task
94     * Met à jour l'enregistrement instancié.
95     *
96     * @param array $params Tableau des paramètres
97     * @return boolean
98     */
99     public function update_task($params = array()) {
100     $this->begin_treatment(__METHOD__);
101     $timestamp_log = $this->get_timestamp_log();
102     if ($timestamp_log === false) {
103     $this->addToLog(__('XXX'), DEBUG_MODE);
104     return $this->end_treatment(__METHOD__, false);
105     }
106     array_push($timestamp_log, array(
107     'modification_date' => date('Y-m-d H:i:s'),
108     'state' => $params['val']['state'],
109     'prev_state' => $this->getVal('state'),
110     ));
111     $timestamp_log = json_encode($timestamp_log);
112     $valF = array(
113     'task' => $this->getVal($this->clePrimaire),
114     'type' => $this->getVal('type'),
115     'timestamp_log' => $timestamp_log,
116     'state' => $params['val']['state'],
117 softime 9389 'object_id' => $this->getVal('object_id'),
118 softime 9293 );
119     $update = $this->modifier($valF);
120     if ($update === false) {
121     $this->addToLog($this->msg, DEBUG_MODE);
122     return $this->end_treatment(__METHOD__, false);
123     }
124     return $this->end_treatment(__METHOD__, true);
125     }
126    
127     /**
128     * Récupère le journal d'horodatage dans le champ timestamp_log de
129     * l'enregistrement instancié.
130     *
131     * @param array $params Tableau des paramètres
132     * @return array sinon false en cas d'erreur
133     */
134     protected function get_timestamp_log($params = array()) {
135     $val = $this->getVal('timestamp_log');
136     if ($val === '') {
137     $val = json_encode(array());
138     }
139     if($this->isJson($val) === false) {
140     return false;
141     }
142     return json_decode($val, true);
143     }
144    
145     /**
146 softime 9330 * VIEW - view_json_data
147 softime 9293 * Affiche l'enregistrement dans le format JSON.
148     *
149     * @return void
150     */
151 softime 9330 public function view_json_data() {
152 softime 9293 $this->checkAccessibility();
153 softime 9330 $this->f->disableLog();
154 softime 9298 if ($this->getParameter('idx') !== ']'
155     && $this->getParameter('idx') !== '0') {
156     //
157     $this->view_form_json();
158     }
159     else {
160     $this->view_tab_json();
161     }
162     }
163    
164     protected function view_tab_json() {
165 softime 9304 $where = '';
166     if ($this->f->get_submitted_get_value('state') !== null
167     && $this->f->get_submitted_get_value('state') !== '') {
168     //
169     $where = sprintf(' WHERE state = \'%s\' ', $this->f->get_submitted_get_value('state'));
170     }
171 softime 9298 $query = sprintf('
172     SELECT
173     *
174     FROM %1$stask
175 softime 9304 %2$s
176 softime 9481 ORDER BY task ASC
177 softime 9298 ',
178 softime 9304 DB_PREFIXE,
179     $where
180 softime 9298 );
181     $res = $this->f->get_all_results_from_db_query($query, true);
182     if ($res['code'] === 'KO') {
183     return false;
184     }
185     $list_tasks = array();
186     foreach ($res['result'] as $task) {
187 softime 9404 $task['timestamp_log'] = json_decode($task['timestamp_log'], true);
188 softime 9298 $list_tasks[$task['task']] = $task;
189     }
190     printf(json_encode($list_tasks));
191     }
192    
193 softime 9395 protected function get_dossier_data(string $dossier) {
194     $val_di = array();
195     $inst_di = $this->f->get_inst__om_dbform(array(
196     "obj" => "dossier",
197     "idx" => $dossier,
198     ));
199 softime 9404 $val_di = $inst_di->get_json_data();
200 softime 9396 if ($val_di['dossier_instruction_type_code'] === 'T') {
201     $val_di['date_decision_transfert'] = $val_di['date_decision'];
202     }
203 softime 9395 unset($val_di['initial_dt']);
204     unset($val_di['log_instructions']);
205     return $val_di;
206     }
207    
208     protected function get_dossier_autorisation_data(string $da) {
209     $val_da = array();
210     $inst_da = $this->f->get_inst__om_dbform(array(
211     "obj" => "dossier_autorisation",
212     "idx" => $da,
213     ));
214 softime 9404 $val_da = $inst_da->get_json_data();
215 softime 9395 return $val_da;
216     }
217    
218     protected function get_donnees_techniques_data(string $fk_idx, string $fk_field) {
219     $val_dt = array();
220     $inst_dt = $this->f->get_inst__by_other_idx(array(
221     "obj" => "donnees_techniques",
222     "fk_field" => $fk_field,
223     "fk_idx" => $fk_idx,
224     ));
225     $val_dt = array(
226     'donnees_techniques' => $inst_dt->getVal($inst_dt->clePrimaire),
227     'cerfa' => $inst_dt->getVal('cerfa'),
228     );
229     $val_dt = array_merge($val_dt, $inst_dt->get_donnees_techniques_applicables());
230 softime 9396 if (isset($val_dt['am_exist_date']) === true) {
231     $val_dt['am_exist_date_num'] = '';
232     if (is_numeric($val_dt['am_exist_date']) === true) {
233     $val_dt['am_exist_date_num'] = $val_dt['am_exist_date'];
234     }
235     }
236 softime 9403 // Correspond à la nomenclature de Plat'AU STATUT_INFO
237     $val_dt['tax_statut_info'] = 'Déclaré';
238 softime 9407 //
239     if ($inst_dt->is_tab_surf_ssdest_enabled() === true) {
240     $fields_tab_surf_dest = $inst_dt->get_fields_tab_surf_dest();
241     foreach ($fields_tab_surf_dest as $field) {
242     if (isset($val_dt[$field]) === true) {
243     unset($val_dt[$field]);
244     }
245     }
246     } else {
247     $fields_tab_surf_ssdest = $inst_dt->get_fields_tab_surf_ssdest();
248     foreach ($fields_tab_surf_ssdest as $field) {
249     if (isset($val_dt[$field]) === true) {
250     unset($val_dt[$field]);
251     }
252     }
253     }
254 softime 9409 // Correspond à la nouvelle ligne CERFA v7 dans le DENSI imposition 1.2.3
255 softime 9408 if (isset($val_dt['tax_su_non_habit_surf2']) === true
256 softime 9412 && 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 softime 9408 //
262     $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
265 softime 9412 && 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 softime 9408 //
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']);
272     }
273 softime 9409 // Cas particulier d'un projet réduit à l'extension d'une habitation existante
274     $particular_case = false;
275     $fields_tab_crea_loc_hab = $inst_dt->get_fields_tab_crea_loc_hab();
276     foreach ($fields_tab_crea_loc_hab as $field) {
277 softime 9438 if (isset($val_dt[$field]) === false
278     || (isset($val_dt[$field]) === true
279     && ($val_dt[$field] === null
280     || $val_dt[$field] === ''))) {
281 softime 9409 //
282     $particular_case = true;
283     }
284     }
285     if ($particular_case === true) {
286     if (isset($val_dt['tax_ext_pret']) === true
287     && $val_dt['tax_ext_pret'] === 'f') {
288     //
289     $val_dt['tax_su_princ_surf1'] = $val_dt['tax_surf_tot_cstr'];
290     $val_dt['tax_su_princ_surf_stat1'] = $val_dt['tax_surf_loc_stat'];
291     }
292     if (isset($val_dt['tax_ext_pret']) === true
293     && $val_dt['tax_ext_pret'] === 't') {
294     //
295     if (isset($val_dt['tax_ext_desc']) === true) {
296     if (preg_match('/[pP].*[lL].*[aA].*[iI]/', $val_dt['tax_ext_desc']) === 1
297     || preg_match('/[lL].*[lL].*[tT].*[sS]/', $val_dt['tax_ext_desc']) === 1) {
298     //
299     $val_dt['tax_su_princ_surf2'] = $val_dt['tax_surf_tot_cstr'];
300     $val_dt['tax_su_princ_surf_stat2'] = $val_dt['tax_surf_loc_stat'];
301     }
302     // if (preg_match('/[pP].*[tT].*[zZ]/', $val_dt['tax_ext_desc']) === 1) {
303     // $val_dt['tax_su_princ_surf4'] = $val_dt['tax_surf_tot_cstr'];
304     // $val_dt['tax_su_princ_surf_stat4'] = $val_dt['tax_surf_loc_stat'];
305     // }
306     // if (preg_match('/[pP].*[lL].*[uU].*[sS]/', $val_dt['tax_ext_desc']) === 1
307     // || preg_match('/[lL].*[eE].*[sS]/', $val_dt['tax_ext_desc']) === 1
308     // || preg_match('/[pP].*[sS].*[lL].*[aA]/', $val_dt['tax_ext_desc']) === 1
309     // || preg_match('/[pP].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1
310     // || preg_match('/[lL].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1) {
311     // //
312     // $val_dt['tax_su_princ_surf3'] = $val_dt['tax_surf_tot_cstr'];
313     // $val_dt['tax_su_princ_surf_stat3'] = $val_dt['tax_surf_loc_stat'];
314     // }
315     }
316     }
317     }
318     // Cas particulier de la surface taxable démolie
319     if (isset($val_dt['tax_surf_tot_demo']) === true
320     && isset($val_dt['tax_surf_tax_demo']) === true
321     && ($val_dt['tax_surf_tot_demo'] === null
322     || $val_dt['tax_surf_tot_demo'] === '')) {
323     //
324     $val_dt['tax_surf_tot_demo'] = $val_dt['tax_surf_tax_demo'];
325     }
326 softime 9395 return $val_dt;
327     }
328    
329     protected function get_external_uid($fk_idx, string $fk_idx_2) {
330 softime 9404 $inst_external_uid = $this->f->get_inst__by_other_idx(array(
331 softime 9395 "obj" => "lien_id_interne_uid_externe",
332     "fk_field" => 'object_id',
333     "fk_idx" => $fk_idx,
334     "fk_field_2" => 'object',
335     "fk_idx_2" => $fk_idx_2,
336     ));
337 softime 9404 return $inst_external_uid->getVal('external_uid');
338 softime 9395 }
339    
340     protected function get_demandeurs_data(string $dossier) {
341     $val_demandeur = array();
342     $inst_di = $this->f->get_inst__om_dbform(array(
343     "obj" => "dossier",
344     "idx" => $dossier,
345     ));
346     $list_demandeurs = $inst_di->get_demandeurs();
347     foreach ($list_demandeurs as $demandeur) {
348     $inst_demandeur = $this->f->get_inst__om_dbform(array(
349     "obj" => "demandeur",
350     "idx" => $demandeur['demandeur'],
351 softime 9334 ));
352 softime 9404 $val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data();
353 softime 9395 $val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal'];
354 softime 9334 }
355 softime 9395 return $val_demandeur;
356     }
357    
358     protected function get_architecte_data($architecte = null) {
359 softime 9408 $val_architecte = null;
360 softime 9395 if ($architecte !== null
361     && $architecte !== '') {
362 softime 9334 //
363 softime 9395 $inst_architecte = $this->f->get_inst__om_dbform(array(
364     "obj" => "architecte",
365     "idx" => $architecte,
366 softime 9334 ));
367 softime 9404 $val_architecte = $inst_architecte->get_json_data();
368 softime 9334 }
369 softime 9395 return $val_architecte;
370     }
371 softime 9334
372 softime 9457 protected function get_instruction_data(string $dossier, $type = 'decision') {
373 softime 9414 $val_instruction = null;
374 softime 9416 $instruction_with_doc = null;
375 softime 9395 $inst_di = $this->f->get_inst__om_dbform(array(
376     "obj" => "dossier",
377     "idx" => $dossier,
378     ));
379 softime 9457 $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 softime 9395 $inst_instruction = $this->f->get_inst__om_dbform(array(
387     "obj" => "instruction",
388 softime 9457 "idx" => $idx,
389 softime 9395 ));
390     if (count($inst_instruction->val) > 0) {
391 softime 9416 $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 softime 9414 $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 softime 9416 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 softime 9414 }
420     }
421 softime 9416 if ($instruction_with_doc !== null) {
422     //
423 softime 9480 $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 softime 9416 }
425 softime 9384 }
426 softime 9395 return $val_instruction;
427     }
428 softime 9334
429 softime 9416 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 softime 9395 protected function get_document_numerise_data(string $dn) {
459     $val_dn = array();
460     $inst_dn = $this->f->get_inst__om_dbform(array(
461     "obj" => "document_numerise",
462     "idx" => $dn,
463     ));
464 softime 9404 $val_dn = $inst_dn->get_json_data();
465 softime 9480 $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 softime 9403 // Correspond à la nomenclature Plat'AU NATURE_PIECE
467 softime 9457 $val_dn['nature'] = $val_dn['document_numerise_nature_libelle'];
468 softime 9395 return $val_dn;
469     }
470    
471 softime 9396 protected function get_parcelles_data(string $object, string $idx) {
472     $val_dp = array();
473     $inst_di = $this->f->get_inst__om_dbform(array(
474     "obj" => $object,
475     "idx" => $idx,
476     ));
477     $list_parcelles = $inst_di->get_parcelles();
478     $no_ordre = 1;
479     foreach ($list_parcelles as $parcelle) {
480     $val_dp[$parcelle[$object.'_parcelle']] = array(
481     $object.'_parcelle' => $parcelle[$object.'_parcelle'],
482     'libelle' => $parcelle['libelle'],
483     'no_ordre' => $no_ordre,
484     );
485     $no_ordre++;
486     }
487     return $val_dp;
488     }
489    
490 softime 9395 protected function view_form_json() {
491     // Mise à jour des valeurs
492 softime 9402 if ($this->f->get_submitted_post_value('valid') === 'true'
493     && $this->f->get_submitted_post_value('state') !== null) {
494 softime 9293 //
495     $params = array(
496     'val' => array(
497 softime 9402 'state' => $this->f->get_submitted_post_value('state')
498 softime 9293 ),
499     );
500     $update = $this->update_task($params);
501     $message_class = "valid";
502     $message = $this->msg;
503     if ($update === false) {
504     $this->addToLog($this->msg, DEBUG_MODE);
505     $message_class = "error";
506     $message = sprintf(
507     '%s %s',
508     __('Impossible de mettre à jour la tâche.'),
509     __('Veuillez contacter votre administrateur.')
510     );
511     }
512     $this->f->displayMessage($message_class, $message);
513 softime 9389 }
514 softime 9395 //
515 softime 9402 if ($this->f->get_submitted_post_value('valid') === 'true'
516     && $this->f->get_submitted_post_value('external_uid') !== null) {
517 softime 9385 //
518 softime 9389 $inst_lien = $this->f->get_inst__om_dbform(array(
519     "obj" => "lien_id_interne_uid_externe",
520     "idx" => ']',
521     ));
522     $valF = array(
523     'lien_id_interne_uid_externe' => '',
524     'object' => $this->get_lien_objet_by_type($this->getVal('type')),
525     'object_id' => $this->getVal('object_id'),
526 softime 9402 'external_uid' => $this->f->get_submitted_post_value('external_uid'),
527 softime 9389 );
528     $add = $inst_lien->ajouter($valF);
529     $message_class = "valid";
530     $message = $inst_lien->msg;
531     if ($add === false) {
532     $this->addToLog($inst_lien->msg, DEBUG_MODE);
533     $message_class = "error";
534     $message = sprintf(
535     '%s %s',
536     __("Impossible de mettre à jour le lien entre l'identifiant interne et l'identifiant de l'application externe."),
537     __('Veuillez contacter votre administrateur.')
538 softime 9385 );
539     }
540 softime 9389 $this->f->displayMessage($message_class, $message);
541 softime 9293 }
542 softime 9395
543     //
544 softime 9402 if ($this->f->get_submitted_post_value('valid') === null) {
545     // Liste des valeurs à afficher
546     $val = array();
547 softime 9395 //
548 softime 9402 $val_task = array_combine($this->champs, $this->val);
549 softime 9405 foreach ($val_task as $key => $value) {
550     $val_task[$key] = strip_tags($value);
551     }
552 softime 9404 $val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true);
553 softime 9402 $val['task'] = $val_task;
554     //
555     if ($this->getVal('type') === 'creation_DA') {
556     $val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id'));
557     $val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation');
558     $val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']);
559     $val_external_uid = array();
560     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier_autorisation']['dossier_autorisation'], 'dossier_autorisation');
561     $val['external_uid'] = $val_external_uid;
562     }
563     //
564     if ($this->getVal('type') === 'creation_DI'
565 softime 9417 || $this->getVal('type') === 'modification_DI'
566     || $this->getVal('type') === 'depot_DI') {
567 softime 9402 //
568     $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');
570     $val['demandeur'] = $this->get_demandeurs_data($val['dossier']['dossier']);
571 softime 9403 $architecte = isset($val['donnees_techniques']['architecte']) === true ? $val['donnees_techniques']['architecte'] : null;
572     $val['architecte'] = $this->get_architecte_data($architecte);
573 softime 9402 $val['dossier_parcelle'] = $this->get_parcelles_data('dossier', $val['dossier']['dossier']);
574     $val_external_uid = array();
575     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
576     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
577     $val['external_uid'] = $val_external_uid;
578     }
579     //
580     if ($this->getVal('type') === 'qualification_DI') {
581     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
582     $val_external_uid = array();
583     $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');
585     $val['external_uid'] = $val_external_uid;
586     }
587     //
588     if ($this->getVal('type') === 'ajout_piece') {
589     $val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id'));
590     $val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']);
591     $val_external_uid = array();
592     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
593     $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');
595     $val['external_uid'] = $val_external_uid;
596     }
597 softime 9414 //
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 softime 9457 //
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 softime 9479 //
616 softime 9458 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 softime 9402
625     // Liste des valeurs affichée en JSON
626 softime 9479 printf(json_encode($val, JSON_UNESCAPED_SLASHES));
627 softime 9395 }
628 softime 9293 }
629 softime 9385
630     protected function get_lien_objet_by_type($type) {
631     //
632     $objet = '';
633     if ($type === 'creation_DA') {
634     $objet = 'dossier_autorisation';
635     }
636 softime 9414 if ($type === 'creation_DI'
637 softime 9417 || $type === 'depot_DI'
638 softime 9414 || $type === 'modification_DI'
639     || $type === 'qualification_DI'
640 softime 9457 || $type === 'decision_DI'
641 softime 9458 || $type === 'incompletude_DI'
642     || $type === 'completude_DI') {
643 softime 9414 //
644 softime 9385 $objet = 'dossier';
645     }
646     if ($type === 'ajout_piece') {
647     $objet = 'document_numerise';
648     }
649     return $objet;
650     }
651 softime 9293 }

Properties

Name Value
svn:executable *

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26