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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9457 - (hide annotations)
Wed Aug 12 16:07:30 2020 UTC (4 years, 5 months ago) by softime
Original Path: branches/4.14.0-develop_demat/obj/task.class.php
File size: 27469 byte(s)
* WIP Demat : création task incompletude + oubli du commit r9450

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 9298 ',
177 softime 9304 DB_PREFIXE,
178     $where
179 softime 9298 );
180     $res = $this->f->get_all_results_from_db_query($query, true);
181     if ($res['code'] === 'KO') {
182     return false;
183     }
184     $list_tasks = array();
185     foreach ($res['result'] as $task) {
186 softime 9404 $task['timestamp_log'] = json_decode($task['timestamp_log'], true);
187 softime 9298 $list_tasks[$task['task']] = $task;
188     }
189     printf(json_encode($list_tasks));
190     }
191    
192 softime 9395 protected function get_dossier_data(string $dossier) {
193     $val_di = array();
194     $inst_di = $this->f->get_inst__om_dbform(array(
195     "obj" => "dossier",
196     "idx" => $dossier,
197     ));
198 softime 9404 $val_di = $inst_di->get_json_data();
199 softime 9396 if ($val_di['dossier_instruction_type_code'] === 'T') {
200     $val_di['date_decision_transfert'] = $val_di['date_decision'];
201     }
202 softime 9395 unset($val_di['initial_dt']);
203     unset($val_di['log_instructions']);
204     return $val_di;
205     }
206    
207     protected function get_dossier_autorisation_data(string $da) {
208     $val_da = array();
209     $inst_da = $this->f->get_inst__om_dbform(array(
210     "obj" => "dossier_autorisation",
211     "idx" => $da,
212     ));
213 softime 9404 $val_da = $inst_da->get_json_data();
214 softime 9395 return $val_da;
215     }
216    
217     protected function get_donnees_techniques_data(string $fk_idx, string $fk_field) {
218     $val_dt = array();
219     $inst_dt = $this->f->get_inst__by_other_idx(array(
220     "obj" => "donnees_techniques",
221     "fk_field" => $fk_field,
222     "fk_idx" => $fk_idx,
223     ));
224     $val_dt = array(
225     'donnees_techniques' => $inst_dt->getVal($inst_dt->clePrimaire),
226     'cerfa' => $inst_dt->getVal('cerfa'),
227     );
228     $val_dt = array_merge($val_dt, $inst_dt->get_donnees_techniques_applicables());
229 softime 9396 if (isset($val_dt['am_exist_date']) === true) {
230     $val_dt['am_exist_date_num'] = '';
231     if (is_numeric($val_dt['am_exist_date']) === true) {
232     $val_dt['am_exist_date_num'] = $val_dt['am_exist_date'];
233     }
234     }
235 softime 9403 // Correspond à la nomenclature de Plat'AU STATUT_INFO
236     $val_dt['tax_statut_info'] = 'Déclaré';
237 softime 9407 //
238     if ($inst_dt->is_tab_surf_ssdest_enabled() === true) {
239     $fields_tab_surf_dest = $inst_dt->get_fields_tab_surf_dest();
240     foreach ($fields_tab_surf_dest as $field) {
241     if (isset($val_dt[$field]) === true) {
242     unset($val_dt[$field]);
243     }
244     }
245     } else {
246     $fields_tab_surf_ssdest = $inst_dt->get_fields_tab_surf_ssdest();
247     foreach ($fields_tab_surf_ssdest as $field) {
248     if (isset($val_dt[$field]) === true) {
249     unset($val_dt[$field]);
250     }
251     }
252     }
253 softime 9409 // Correspond à la nouvelle ligne CERFA v7 dans le DENSI imposition 1.2.3
254 softime 9408 if (isset($val_dt['tax_su_non_habit_surf2']) === true
255 softime 9412 && isset($val_dt['tax_su_non_habit_surf3']) === true
256     && (($val_dt['tax_su_non_habit_surf2'] !== null
257     && $val_dt['tax_su_non_habit_surf2'] !== '')
258     || ($val_dt['tax_su_non_habit_surf3'] !== null
259     && $val_dt['tax_su_non_habit_surf3'] !== ''))) {
260 softime 9408 //
261     $val_dt['tax_su_non_habit_surf8'] = intval($val_dt['tax_su_non_habit_surf2']) + intval($val_dt['tax_su_non_habit_surf3']);
262     }
263     if (isset($val_dt['tax_su_non_habit_surf_stat2']) === true
264 softime 9412 && isset($val_dt['tax_su_non_habit_surf_stat3']) === true
265     && (($val_dt['tax_su_non_habit_surf_stat2'] !== null
266     && $val_dt['tax_su_non_habit_surf_stat2'] !== '')
267     || ($val_dt['tax_su_non_habit_surf_stat3'] !== null
268     && $val_dt['tax_su_non_habit_surf_stat3'] !== ''))) {
269 softime 9408 //
270     $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']);
271     }
272 softime 9409 // Cas particulier d'un projet réduit à l'extension d'une habitation existante
273     $particular_case = false;
274     $fields_tab_crea_loc_hab = $inst_dt->get_fields_tab_crea_loc_hab();
275     foreach ($fields_tab_crea_loc_hab as $field) {
276 softime 9438 if (isset($val_dt[$field]) === false
277     || (isset($val_dt[$field]) === true
278     && ($val_dt[$field] === null
279     || $val_dt[$field] === ''))) {
280 softime 9409 //
281     $particular_case = true;
282     }
283     }
284     if ($particular_case === true) {
285     if (isset($val_dt['tax_ext_pret']) === true
286     && $val_dt['tax_ext_pret'] === 'f') {
287     //
288     $val_dt['tax_su_princ_surf1'] = $val_dt['tax_surf_tot_cstr'];
289     $val_dt['tax_su_princ_surf_stat1'] = $val_dt['tax_surf_loc_stat'];
290     }
291     if (isset($val_dt['tax_ext_pret']) === true
292     && $val_dt['tax_ext_pret'] === 't') {
293     //
294     if (isset($val_dt['tax_ext_desc']) === true) {
295     if (preg_match('/[pP].*[lL].*[aA].*[iI]/', $val_dt['tax_ext_desc']) === 1
296     || preg_match('/[lL].*[lL].*[tT].*[sS]/', $val_dt['tax_ext_desc']) === 1) {
297     //
298     $val_dt['tax_su_princ_surf2'] = $val_dt['tax_surf_tot_cstr'];
299     $val_dt['tax_su_princ_surf_stat2'] = $val_dt['tax_surf_loc_stat'];
300     }
301     // if (preg_match('/[pP].*[tT].*[zZ]/', $val_dt['tax_ext_desc']) === 1) {
302     // $val_dt['tax_su_princ_surf4'] = $val_dt['tax_surf_tot_cstr'];
303     // $val_dt['tax_su_princ_surf_stat4'] = $val_dt['tax_surf_loc_stat'];
304     // }
305     // if (preg_match('/[pP].*[lL].*[uU].*[sS]/', $val_dt['tax_ext_desc']) === 1
306     // || preg_match('/[lL].*[eE].*[sS]/', $val_dt['tax_ext_desc']) === 1
307     // || preg_match('/[pP].*[sS].*[lL].*[aA]/', $val_dt['tax_ext_desc']) === 1
308     // || preg_match('/[pP].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1
309     // || preg_match('/[lL].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1) {
310     // //
311     // $val_dt['tax_su_princ_surf3'] = $val_dt['tax_surf_tot_cstr'];
312     // $val_dt['tax_su_princ_surf_stat3'] = $val_dt['tax_surf_loc_stat'];
313     // }
314     }
315     }
316     }
317     // Cas particulier de la surface taxable démolie
318     if (isset($val_dt['tax_surf_tot_demo']) === true
319     && isset($val_dt['tax_surf_tax_demo']) === true
320     && ($val_dt['tax_surf_tot_demo'] === null
321     || $val_dt['tax_surf_tot_demo'] === '')) {
322     //
323     $val_dt['tax_surf_tot_demo'] = $val_dt['tax_surf_tax_demo'];
324     }
325 softime 9395 return $val_dt;
326     }
327    
328     protected function get_external_uid($fk_idx, string $fk_idx_2) {
329 softime 9404 $inst_external_uid = $this->f->get_inst__by_other_idx(array(
330 softime 9395 "obj" => "lien_id_interne_uid_externe",
331     "fk_field" => 'object_id',
332     "fk_idx" => $fk_idx,
333     "fk_field_2" => 'object',
334     "fk_idx_2" => $fk_idx_2,
335     ));
336 softime 9404 return $inst_external_uid->getVal('external_uid');
337 softime 9395 }
338    
339     protected function get_demandeurs_data(string $dossier) {
340     $val_demandeur = array();
341     $inst_di = $this->f->get_inst__om_dbform(array(
342     "obj" => "dossier",
343     "idx" => $dossier,
344     ));
345     $list_demandeurs = $inst_di->get_demandeurs();
346     foreach ($list_demandeurs as $demandeur) {
347     $inst_demandeur = $this->f->get_inst__om_dbform(array(
348     "obj" => "demandeur",
349     "idx" => $demandeur['demandeur'],
350 softime 9334 ));
351 softime 9404 $val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data();
352 softime 9395 $val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal'];
353 softime 9334 }
354 softime 9395 return $val_demandeur;
355     }
356    
357     protected function get_architecte_data($architecte = null) {
358 softime 9408 $val_architecte = null;
359 softime 9395 if ($architecte !== null
360     && $architecte !== '') {
361 softime 9334 //
362 softime 9395 $inst_architecte = $this->f->get_inst__om_dbform(array(
363     "obj" => "architecte",
364     "idx" => $architecte,
365 softime 9334 ));
366 softime 9404 $val_architecte = $inst_architecte->get_json_data();
367 softime 9334 }
368 softime 9395 return $val_architecte;
369     }
370 softime 9334
371 softime 9457 protected function get_instruction_data(string $dossier, $type = 'decision') {
372 softime 9414 $val_instruction = null;
373 softime 9416 $instruction_with_doc = null;
374 softime 9395 $inst_di = $this->f->get_inst__om_dbform(array(
375     "obj" => "dossier",
376     "idx" => $dossier,
377     ));
378 softime 9457 $idx = null;
379     if ($type === 'decision') {
380     $idx = $inst_di->get_last_instruction_decision();
381     }
382     if ($type === 'incompletude') {
383     $idx = $inst_di->get_last_instruction_incompletude();
384     }
385 softime 9395 $inst_instruction = $this->f->get_inst__om_dbform(array(
386     "obj" => "instruction",
387 softime 9457 "idx" => $idx,
388 softime 9395 ));
389     if (count($inst_instruction->val) > 0) {
390 softime 9416 $val_instruction = array();
391     $instruction_data = $inst_instruction->get_json_data();
392     $val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction);
393     if ($instruction_data['om_fichier_instruction'] !== null
394     && $instruction_data['om_fichier_instruction'] !== '') {
395     //
396     $instruction_with_doc = $inst_instruction->getVal($inst_instruction->clePrimaire);
397     }
398 softime 9414 $inst_ev = $this->f->get_inst__om_dbform(array(
399     "obj" => "evenement",
400     "idx" => $inst_instruction->getVal('evenement'),
401     ));
402     if ($inst_ev->getVal('retour') === 't') {
403     $instructions_related = $inst_instruction->get_related_instructions();
404     foreach ($instructions_related as $instruction) {
405 softime 9416 if ($instruction !== null && $instruction !== '') {
406     $inst_related_instruction = $this->f->get_inst__om_dbform(array(
407     "obj" => "instruction",
408     "idx" => $instruction,
409     ));
410     $instruction_data = $inst_related_instruction->get_json_data();
411     $val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction);
412     if ($instruction_data['om_fichier_instruction'] !== null
413     && $instruction_data['om_fichier_instruction'] !== '') {
414     //
415     $instruction_with_doc = $inst_related_instruction->getVal($inst_related_instruction->clePrimaire);
416     }
417     }
418 softime 9414 }
419     }
420 softime 9416 if ($instruction_with_doc !== null) {
421     //
422     $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);
423     }
424 softime 9384 }
425 softime 9395 return $val_instruction;
426     }
427 softime 9334
428 softime 9416 protected function sort_instruction_data(array $values, array $res) {
429     $fields = array(
430     "date_envoi_signature",
431     "date_retour_signature",
432     "date_envoi_rar",
433     "date_retour_rar",
434     "date_envoi_controle_legalite",
435     "date_retour_controle_legalite",
436     "signataire_arrete",
437     "om_fichier_instruction",
438     "tacite",
439     );
440     foreach ($values as $key => $value) {
441     if (in_array($key, $fields) === true) {
442     if (array_key_exists($key, $res) === false
443     && $value !== null
444     && $value !== '') {
445     //
446     $res[$key] = $value;
447     } elseif ($key === 'tacite'
448     && $value === 't') {
449     //
450     $res[$key] = $value;
451     }
452     }
453     }
454     return $res;
455     }
456    
457 softime 9395 protected function get_document_numerise_data(string $dn) {
458     $val_dn = array();
459     $inst_dn = $this->f->get_inst__om_dbform(array(
460     "obj" => "document_numerise",
461     "idx" => $dn,
462     ));
463 softime 9404 $val_dn = $inst_dn->get_json_data();
464 softime 9395 $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'));
465 softime 9403 // Correspond à la nomenclature Plat'AU NATURE_PIECE
466 softime 9457 $val_dn['nature'] = $val_dn['document_numerise_nature_libelle'];
467 softime 9395 return $val_dn;
468     }
469    
470 softime 9396 protected function get_parcelles_data(string $object, string $idx) {
471     $val_dp = array();
472     $inst_di = $this->f->get_inst__om_dbform(array(
473     "obj" => $object,
474     "idx" => $idx,
475     ));
476     $list_parcelles = $inst_di->get_parcelles();
477     $no_ordre = 1;
478     foreach ($list_parcelles as $parcelle) {
479     $val_dp[$parcelle[$object.'_parcelle']] = array(
480     $object.'_parcelle' => $parcelle[$object.'_parcelle'],
481     'libelle' => $parcelle['libelle'],
482     'no_ordre' => $no_ordre,
483     );
484     $no_ordre++;
485     }
486     return $val_dp;
487     }
488    
489 softime 9395 protected function view_form_json() {
490     // Mise à jour des valeurs
491 softime 9402 if ($this->f->get_submitted_post_value('valid') === 'true'
492     && $this->f->get_submitted_post_value('state') !== null) {
493 softime 9293 //
494     $params = array(
495     'val' => array(
496 softime 9402 'state' => $this->f->get_submitted_post_value('state')
497 softime 9293 ),
498     );
499     $update = $this->update_task($params);
500     $message_class = "valid";
501     $message = $this->msg;
502     if ($update === false) {
503     $this->addToLog($this->msg, DEBUG_MODE);
504     $message_class = "error";
505     $message = sprintf(
506     '%s %s',
507     __('Impossible de mettre à jour la tâche.'),
508     __('Veuillez contacter votre administrateur.')
509     );
510     }
511     $this->f->displayMessage($message_class, $message);
512 softime 9389 }
513 softime 9395 //
514 softime 9402 if ($this->f->get_submitted_post_value('valid') === 'true'
515     && $this->f->get_submitted_post_value('external_uid') !== null) {
516 softime 9385 //
517 softime 9389 $inst_lien = $this->f->get_inst__om_dbform(array(
518     "obj" => "lien_id_interne_uid_externe",
519     "idx" => ']',
520     ));
521     $valF = array(
522     'lien_id_interne_uid_externe' => '',
523     'object' => $this->get_lien_objet_by_type($this->getVal('type')),
524     'object_id' => $this->getVal('object_id'),
525 softime 9402 'external_uid' => $this->f->get_submitted_post_value('external_uid'),
526 softime 9389 );
527     $add = $inst_lien->ajouter($valF);
528     $message_class = "valid";
529     $message = $inst_lien->msg;
530     if ($add === false) {
531     $this->addToLog($inst_lien->msg, DEBUG_MODE);
532     $message_class = "error";
533     $message = sprintf(
534     '%s %s',
535     __("Impossible de mettre à jour le lien entre l'identifiant interne et l'identifiant de l'application externe."),
536     __('Veuillez contacter votre administrateur.')
537 softime 9385 );
538     }
539 softime 9389 $this->f->displayMessage($message_class, $message);
540 softime 9293 }
541 softime 9395
542     //
543 softime 9402 if ($this->f->get_submitted_post_value('valid') === null) {
544     // Liste des valeurs à afficher
545     $val = array();
546 softime 9395 //
547 softime 9402 $val_task = array_combine($this->champs, $this->val);
548 softime 9405 foreach ($val_task as $key => $value) {
549     $val_task[$key] = strip_tags($value);
550     }
551 softime 9404 $val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true);
552 softime 9402 $val['task'] = $val_task;
553     //
554     if ($this->getVal('type') === 'creation_DA') {
555     $val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id'));
556     $val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation');
557     $val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']);
558     $val_external_uid = array();
559     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier_autorisation']['dossier_autorisation'], 'dossier_autorisation');
560     $val['external_uid'] = $val_external_uid;
561     }
562     //
563     if ($this->getVal('type') === 'creation_DI'
564 softime 9417 || $this->getVal('type') === 'modification_DI'
565     || $this->getVal('type') === 'depot_DI') {
566 softime 9402 //
567     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
568     $val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction');
569     $val['demandeur'] = $this->get_demandeurs_data($val['dossier']['dossier']);
570 softime 9403 $architecte = isset($val['donnees_techniques']['architecte']) === true ? $val['donnees_techniques']['architecte'] : null;
571     $val['architecte'] = $this->get_architecte_data($architecte);
572 softime 9402 $val['dossier_parcelle'] = $this->get_parcelles_data('dossier', $val['dossier']['dossier']);
573     $val_external_uid = array();
574     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
575     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
576     $val['external_uid'] = $val_external_uid;
577     }
578     //
579     if ($this->getVal('type') === 'qualification_DI') {
580     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
581     $val_external_uid = array();
582     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
583     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
584     $val['external_uid'] = $val_external_uid;
585     }
586     //
587     if ($this->getVal('type') === 'ajout_piece') {
588     $val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id'));
589     $val['dossier'] = $this->get_dossier_data($val['document_numerise']['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['document_numerise'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'document_numerise');
594     $val['external_uid'] = $val_external_uid;
595     }
596 softime 9414 //
597     if ($this->getVal('type') === 'decision_DI') {
598     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
599     $val['instruction'] = $this->get_instruction_data($val['dossier']['dossier']);
600     $val_external_uid = array();
601     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
602     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
603     $val['external_uid'] = $val_external_uid;
604     }
605 softime 9457 //
606     if ($this->getVal('type') === 'incompletude_DI') {
607     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
608     $val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'incompletude');
609     $val_external_uid = array();
610     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
611     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
612     $val['external_uid'] = $val_external_uid;
613     }
614 softime 9402
615     // Liste des valeurs affichée en JSON
616     printf(json_encode($val));
617 softime 9395 }
618 softime 9293 }
619 softime 9385
620     protected function get_lien_objet_by_type($type) {
621     //
622     $objet = '';
623     if ($type === 'creation_DA') {
624     $objet = 'dossier_autorisation';
625     }
626 softime 9414 if ($type === 'creation_DI'
627 softime 9417 || $type === 'depot_DI'
628 softime 9414 || $type === 'modification_DI'
629     || $type === 'qualification_DI'
630 softime 9457 || $type === 'decision_DI'
631     || $type === 'incompletude_DI') {
632 softime 9414 //
633 softime 9385 $objet = 'dossier';
634     }
635     if ($type === 'ajout_piece') {
636     $objet = 'document_numerise';
637     }
638     return $objet;
639     }
640 softime 9293 }

Properties

Name Value
svn:executable *

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26