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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9585 - (hide annotations)
Fri Oct 9 15:22:13 2020 UTC (4 years, 3 months ago) by gmalvolti
Original Path: branches/4.14.0-develop_demat/obj/task.class.php
File size: 30325 byte(s)
* Ajout de la colonne dossier dans la table et le listing de task
* Ajout de l'entré de menu Moniteur Plat'AU dans Administration > Options Avancées
* Ajout de la recherche avancée dans le listing de task
* Ajout du champ dossier dans les fonctions d'ajout de tâche

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 9482 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 gmalvolti 9585 function setType(&$form, $maj) {
33     parent::setType($form, $maj);
34     // Récupération du mode de l'action
35     $crud = $this->get_action_crud($maj);
36    
37     if ($maj < 2) {
38     $form->setType("state", "select");
39     }
40     }
41    
42     /**
43     *
44     */
45     function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) {
46     if($maj < 2) {
47     $contenu=array();
48    
49     $contenu[0][0]="draft";
50     $contenu[1][0]=_('draft');
51     $contenu[0][1]="new";
52     $contenu[1][1]=_('new');
53     $contenu[0][2]="pending";
54     $contenu[1][2]=_('pending');
55     $contenu[0][3]="done";
56     $contenu[1][3]=_('done');
57     $contenu[0][4]="archived";
58     $contenu[1][4]=_('archived');
59     $contenu[0][5]="error";
60     $contenu[1][5]=_('error');
61     $contenu[0][6]="debug";
62     $contenu[1][6]=_('debug');
63    
64     $form->setSelect("state", $contenu);
65     }
66     }
67    
68 softime 9482 public function verifier($val = array(), &$dnu1 = null, $dnu2 = null) {
69     parent::verifier($val, $dnu1, $dnu2);
70     //
71     if (array_key_exists('timestamp_log', $this->valF) === true
72     && is_array(json_decode($this->valF['timestamp_log'], true)) === false) {
73     //
74     $this->correct = false;
75     $this->addToMessage(sprintf(
76     __("Le champ %s doit être dans un format JSON valide."),
77     sprintf('<span class="bold">%s</span>', $this->getLibFromField('timestamp_log'))
78     ));
79     }
80     }
81    
82 softime 9395 protected function task_exists(string $type, string $object_id) {
83     $query = sprintf('
84     SELECT task
85     FROM %1$stask
86     WHERE state != \'%2$s\'
87     AND type = \'%3$s\'
88     AND object_id = \'%4$s\'
89     ',
90     DB_PREFIXE,
91     'done',
92     $type,
93     $object_id
94     );
95     $res = $this->f->get_one_result_from_db_query($query);
96     if ($res['result'] !== null && $res['result'] !== '') {
97     return $res['result'];
98     }
99     return false;
100     }
101    
102 softime 9293 /**
103     * TREATMENT - add_task
104     * Ajoute un enregistrement.
105     *
106     * @param array $params Tableau des paramètres
107     * @return boolean
108     */
109     public function add_task($params = array()) {
110     $this->begin_treatment(__METHOD__);
111     $timestamp_log = json_encode(array(
112     'creation_date' => date('Y-m-d H:i:s'),
113     ));
114     // Mise à jour du DI
115     $valF = array(
116     'task' => '',
117     'type' => $params['val']['type'],
118     'timestamp_log' => $timestamp_log,
119 softime 9385 'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new',
120 softime 9389 'object_id' => $params['val']['object_id'],
121 gmalvolti 9585 'dossier' => $params['val']['dossier'],
122 softime 9293 );
123 softime 9395 $task_exists = $this->task_exists($valF['type'], $valF['object_id']);
124 softime 9457 if ($valF['type'] === 'modification_DI' && $task_exists === false) {
125     $task_exists = $this->task_exists('creation_DI', $valF['object_id']);
126     }
127 softime 9395 if ($task_exists !== false) {
128     $inst_task = $this->f->get_inst__om_dbform(array(
129     "obj" => "task",
130     "idx" => $task_exists,
131     ));
132 softime 9414 $update_state = $inst_task->getVal('state');
133     if (isset($params['update_val']['state']) === true) {
134     $update_state = $params['update_val']['state'];
135     }
136 softime 9395 $update_params = array(
137     'val' => array(
138 softime 9414 'state' => $update_state,
139 softime 9395 ),
140     );
141     return $inst_task->update_task($update_params);
142     }
143 softime 9293 $add = $this->ajouter($valF);
144     if ($add === false) {
145     $this->addToLog($this->msg, DEBUG_MODE);
146     return $this->end_treatment(__METHOD__, false);
147     }
148     return $this->end_treatment(__METHOD__, true);
149     }
150    
151     /**
152     * TREATMENT - update_task
153     * Met à jour l'enregistrement instancié.
154     *
155     * @param array $params Tableau des paramètres
156     * @return boolean
157     */
158     public function update_task($params = array()) {
159     $this->begin_treatment(__METHOD__);
160     $timestamp_log = $this->get_timestamp_log();
161     if ($timestamp_log === false) {
162     $this->addToLog(__('XXX'), DEBUG_MODE);
163     return $this->end_treatment(__METHOD__, false);
164     }
165     array_push($timestamp_log, array(
166     'modification_date' => date('Y-m-d H:i:s'),
167     'state' => $params['val']['state'],
168     'prev_state' => $this->getVal('state'),
169     ));
170     $timestamp_log = json_encode($timestamp_log);
171     $valF = array(
172     'task' => $this->getVal($this->clePrimaire),
173     'type' => $this->getVal('type'),
174     'timestamp_log' => $timestamp_log,
175     'state' => $params['val']['state'],
176 softime 9389 'object_id' => $this->getVal('object_id'),
177 softime 9293 );
178     $update = $this->modifier($valF);
179     if ($update === false) {
180     $this->addToLog($this->msg, DEBUG_MODE);
181     return $this->end_treatment(__METHOD__, false);
182     }
183     return $this->end_treatment(__METHOD__, true);
184     }
185    
186     /**
187     * Récupère le journal d'horodatage dans le champ timestamp_log de
188     * l'enregistrement instancié.
189     *
190     * @param array $params Tableau des paramètres
191     * @return array sinon false en cas d'erreur
192     */
193     protected function get_timestamp_log($params = array()) {
194     $val = $this->getVal('timestamp_log');
195     if ($val === '') {
196     $val = json_encode(array());
197     }
198     if($this->isJson($val) === false) {
199     return false;
200     }
201     return json_decode($val, true);
202     }
203    
204     /**
205 softime 9330 * VIEW - view_json_data
206 softime 9293 * Affiche l'enregistrement dans le format JSON.
207     *
208     * @return void
209     */
210 softime 9330 public function view_json_data() {
211 softime 9293 $this->checkAccessibility();
212 softime 9330 $this->f->disableLog();
213 softime 9298 if ($this->getParameter('idx') !== ']'
214     && $this->getParameter('idx') !== '0') {
215     //
216     $this->view_form_json();
217     }
218     else {
219     $this->view_tab_json();
220     }
221     }
222    
223     protected function view_tab_json() {
224 softime 9304 $where = '';
225     if ($this->f->get_submitted_get_value('state') !== null
226     && $this->f->get_submitted_get_value('state') !== '') {
227     //
228     $where = sprintf(' WHERE state = \'%s\' ', $this->f->get_submitted_get_value('state'));
229     }
230 softime 9298 $query = sprintf('
231     SELECT
232     *
233     FROM %1$stask
234 softime 9304 %2$s
235 softime 9481 ORDER BY task ASC
236 softime 9298 ',
237 softime 9304 DB_PREFIXE,
238     $where
239 softime 9298 );
240     $res = $this->f->get_all_results_from_db_query($query, true);
241     if ($res['code'] === 'KO') {
242     return false;
243     }
244     $list_tasks = array();
245     foreach ($res['result'] as $task) {
246 softime 9404 $task['timestamp_log'] = json_decode($task['timestamp_log'], true);
247 softime 9490 $task['dossier'] = $task['object_id'];
248     if ($this->get_lien_objet_by_type($task['type']) === 'document_numerise') {
249     $val_dn = $this->get_document_numerise_data($task['object_id']);
250     $task['dossier'] = $val_dn['dossier'];
251     }
252 softime 9298 $list_tasks[$task['task']] = $task;
253     }
254     printf(json_encode($list_tasks));
255     }
256    
257 softime 9395 protected function get_dossier_data(string $dossier) {
258     $val_di = array();
259     $inst_di = $this->f->get_inst__om_dbform(array(
260     "obj" => "dossier",
261     "idx" => $dossier,
262     ));
263 softime 9404 $val_di = $inst_di->get_json_data();
264 softime 9396 if ($val_di['dossier_instruction_type_code'] === 'T') {
265     $val_di['date_decision_transfert'] = $val_di['date_decision'];
266     }
267 softime 9395 unset($val_di['initial_dt']);
268     unset($val_di['log_instructions']);
269     return $val_di;
270     }
271    
272     protected function get_dossier_autorisation_data(string $da) {
273     $val_da = array();
274     $inst_da = $this->f->get_inst__om_dbform(array(
275     "obj" => "dossier_autorisation",
276     "idx" => $da,
277     ));
278 softime 9404 $val_da = $inst_da->get_json_data();
279 softime 9395 return $val_da;
280     }
281    
282     protected function get_donnees_techniques_data(string $fk_idx, string $fk_field) {
283     $val_dt = array();
284     $inst_dt = $this->f->get_inst__by_other_idx(array(
285     "obj" => "donnees_techniques",
286     "fk_field" => $fk_field,
287     "fk_idx" => $fk_idx,
288     ));
289     $val_dt = array(
290     'donnees_techniques' => $inst_dt->getVal($inst_dt->clePrimaire),
291     'cerfa' => $inst_dt->getVal('cerfa'),
292     );
293     $val_dt = array_merge($val_dt, $inst_dt->get_donnees_techniques_applicables());
294 softime 9396 if (isset($val_dt['am_exist_date']) === true) {
295     $val_dt['am_exist_date_num'] = '';
296     if (is_numeric($val_dt['am_exist_date']) === true) {
297     $val_dt['am_exist_date_num'] = $val_dt['am_exist_date'];
298     }
299     }
300 softime 9403 // Correspond à la nomenclature de Plat'AU STATUT_INFO
301     $val_dt['tax_statut_info'] = 'Déclaré';
302 softime 9407 //
303     if ($inst_dt->is_tab_surf_ssdest_enabled() === true) {
304     $fields_tab_surf_dest = $inst_dt->get_fields_tab_surf_dest();
305     foreach ($fields_tab_surf_dest as $field) {
306     if (isset($val_dt[$field]) === true) {
307     unset($val_dt[$field]);
308     }
309     }
310     } else {
311     $fields_tab_surf_ssdest = $inst_dt->get_fields_tab_surf_ssdest();
312     foreach ($fields_tab_surf_ssdest as $field) {
313     if (isset($val_dt[$field]) === true) {
314     unset($val_dt[$field]);
315     }
316     }
317     }
318 softime 9409 // Correspond à la nouvelle ligne CERFA v7 dans le DENSI imposition 1.2.3
319 softime 9408 if (isset($val_dt['tax_su_non_habit_surf2']) === true
320 softime 9412 && isset($val_dt['tax_su_non_habit_surf3']) === true
321     && (($val_dt['tax_su_non_habit_surf2'] !== null
322     && $val_dt['tax_su_non_habit_surf2'] !== '')
323     || ($val_dt['tax_su_non_habit_surf3'] !== null
324     && $val_dt['tax_su_non_habit_surf3'] !== ''))) {
325 softime 9408 //
326     $val_dt['tax_su_non_habit_surf8'] = intval($val_dt['tax_su_non_habit_surf2']) + intval($val_dt['tax_su_non_habit_surf3']);
327     }
328     if (isset($val_dt['tax_su_non_habit_surf_stat2']) === true
329 softime 9412 && isset($val_dt['tax_su_non_habit_surf_stat3']) === true
330     && (($val_dt['tax_su_non_habit_surf_stat2'] !== null
331     && $val_dt['tax_su_non_habit_surf_stat2'] !== '')
332     || ($val_dt['tax_su_non_habit_surf_stat3'] !== null
333     && $val_dt['tax_su_non_habit_surf_stat3'] !== ''))) {
334 softime 9408 //
335     $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']);
336     }
337 softime 9409 // Cas particulier d'un projet réduit à l'extension d'une habitation existante
338     $particular_case = false;
339     $fields_tab_crea_loc_hab = $inst_dt->get_fields_tab_crea_loc_hab();
340     foreach ($fields_tab_crea_loc_hab as $field) {
341 softime 9438 if (isset($val_dt[$field]) === false
342     || (isset($val_dt[$field]) === true
343     && ($val_dt[$field] === null
344     || $val_dt[$field] === ''))) {
345 softime 9409 //
346     $particular_case = true;
347     }
348     }
349     if ($particular_case === true) {
350     if (isset($val_dt['tax_ext_pret']) === true
351     && $val_dt['tax_ext_pret'] === 'f') {
352     //
353     $val_dt['tax_su_princ_surf1'] = $val_dt['tax_surf_tot_cstr'];
354     $val_dt['tax_su_princ_surf_stat1'] = $val_dt['tax_surf_loc_stat'];
355     }
356     if (isset($val_dt['tax_ext_pret']) === true
357     && $val_dt['tax_ext_pret'] === 't') {
358     //
359     if (isset($val_dt['tax_ext_desc']) === true) {
360     if (preg_match('/[pP].*[lL].*[aA].*[iI]/', $val_dt['tax_ext_desc']) === 1
361     || preg_match('/[lL].*[lL].*[tT].*[sS]/', $val_dt['tax_ext_desc']) === 1) {
362     //
363     $val_dt['tax_su_princ_surf2'] = $val_dt['tax_surf_tot_cstr'];
364     $val_dt['tax_su_princ_surf_stat2'] = $val_dt['tax_surf_loc_stat'];
365     }
366     // if (preg_match('/[pP].*[tT].*[zZ]/', $val_dt['tax_ext_desc']) === 1) {
367     // $val_dt['tax_su_princ_surf4'] = $val_dt['tax_surf_tot_cstr'];
368     // $val_dt['tax_su_princ_surf_stat4'] = $val_dt['tax_surf_loc_stat'];
369     // }
370     // if (preg_match('/[pP].*[lL].*[uU].*[sS]/', $val_dt['tax_ext_desc']) === 1
371     // || preg_match('/[lL].*[eE].*[sS]/', $val_dt['tax_ext_desc']) === 1
372     // || preg_match('/[pP].*[sS].*[lL].*[aA]/', $val_dt['tax_ext_desc']) === 1
373     // || preg_match('/[pP].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1
374     // || preg_match('/[lL].*[lL].*[sS]/', $val_dt['tax_ext_desc']) === 1) {
375     // //
376     // $val_dt['tax_su_princ_surf3'] = $val_dt['tax_surf_tot_cstr'];
377     // $val_dt['tax_su_princ_surf_stat3'] = $val_dt['tax_surf_loc_stat'];
378     // }
379     }
380     }
381     }
382     // Cas particulier de la surface taxable démolie
383     if (isset($val_dt['tax_surf_tot_demo']) === true
384     && isset($val_dt['tax_surf_tax_demo']) === true
385     && ($val_dt['tax_surf_tot_demo'] === null
386     || $val_dt['tax_surf_tot_demo'] === '')) {
387     //
388     $val_dt['tax_surf_tot_demo'] = $val_dt['tax_surf_tax_demo'];
389     }
390 softime 9395 return $val_dt;
391     }
392    
393     protected function get_external_uid($fk_idx, string $fk_idx_2) {
394 softime 9404 $inst_external_uid = $this->f->get_inst__by_other_idx(array(
395 softime 9395 "obj" => "lien_id_interne_uid_externe",
396     "fk_field" => 'object_id',
397     "fk_idx" => $fk_idx,
398     "fk_field_2" => 'object',
399     "fk_idx_2" => $fk_idx_2,
400     ));
401 softime 9404 return $inst_external_uid->getVal('external_uid');
402 softime 9395 }
403    
404     protected function get_demandeurs_data(string $dossier) {
405     $val_demandeur = array();
406     $inst_di = $this->f->get_inst__om_dbform(array(
407     "obj" => "dossier",
408     "idx" => $dossier,
409     ));
410     $list_demandeurs = $inst_di->get_demandeurs();
411     foreach ($list_demandeurs as $demandeur) {
412     $inst_demandeur = $this->f->get_inst__om_dbform(array(
413     "obj" => "demandeur",
414     "idx" => $demandeur['demandeur'],
415 softime 9334 ));
416 softime 9404 $val_demandeur[$demandeur['demandeur']] = $inst_demandeur->get_json_data();
417 softime 9395 $val_demandeur[$demandeur['demandeur']]['petitionnaire_principal'] = $demandeur['petitionnaire_principal'];
418 softime 9334 }
419 softime 9395 return $val_demandeur;
420     }
421    
422     protected function get_architecte_data($architecte = null) {
423 softime 9408 $val_architecte = null;
424 softime 9395 if ($architecte !== null
425     && $architecte !== '') {
426 softime 9334 //
427 softime 9395 $inst_architecte = $this->f->get_inst__om_dbform(array(
428     "obj" => "architecte",
429     "idx" => $architecte,
430 softime 9334 ));
431 softime 9404 $val_architecte = $inst_architecte->get_json_data();
432 softime 9334 }
433 softime 9395 return $val_architecte;
434     }
435 softime 9334
436 softime 9457 protected function get_instruction_data(string $dossier, $type = 'decision') {
437 softime 9414 $val_instruction = null;
438 softime 9416 $instruction_with_doc = null;
439 softime 9395 $inst_di = $this->f->get_inst__om_dbform(array(
440     "obj" => "dossier",
441     "idx" => $dossier,
442     ));
443 softime 9457 $idx = null;
444     if ($type === 'decision') {
445     $idx = $inst_di->get_last_instruction_decision();
446     }
447     if ($type === 'incompletude') {
448     $idx = $inst_di->get_last_instruction_incompletude();
449     }
450 softime 9395 $inst_instruction = $this->f->get_inst__om_dbform(array(
451     "obj" => "instruction",
452 softime 9457 "idx" => $idx,
453 softime 9395 ));
454     if (count($inst_instruction->val) > 0) {
455 softime 9416 $val_instruction = array();
456     $instruction_data = $inst_instruction->get_json_data();
457     $val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction);
458     if ($instruction_data['om_fichier_instruction'] !== null
459     && $instruction_data['om_fichier_instruction'] !== '') {
460     //
461     $instruction_with_doc = $inst_instruction->getVal($inst_instruction->clePrimaire);
462     }
463 softime 9414 $inst_ev = $this->f->get_inst__om_dbform(array(
464     "obj" => "evenement",
465     "idx" => $inst_instruction->getVal('evenement'),
466     ));
467     if ($inst_ev->getVal('retour') === 't') {
468     $instructions_related = $inst_instruction->get_related_instructions();
469     foreach ($instructions_related as $instruction) {
470 softime 9416 if ($instruction !== null && $instruction !== '') {
471     $inst_related_instruction = $this->f->get_inst__om_dbform(array(
472     "obj" => "instruction",
473     "idx" => $instruction,
474     ));
475     $instruction_data = $inst_related_instruction->get_json_data();
476     $val_instruction = $this->sort_instruction_data($instruction_data, $val_instruction);
477     if ($instruction_data['om_fichier_instruction'] !== null
478     && $instruction_data['om_fichier_instruction'] !== '') {
479     //
480     $instruction_with_doc = $inst_related_instruction->getVal($inst_related_instruction->clePrimaire);
481     }
482     }
483 softime 9414 }
484     }
485 softime 9416 if ($instruction_with_doc !== null) {
486     //
487 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);
488 softime 9416 }
489 softime 9384 }
490 softime 9395 return $val_instruction;
491     }
492 softime 9334
493 softime 9416 protected function sort_instruction_data(array $values, array $res) {
494     $fields = array(
495     "date_envoi_signature",
496     "date_retour_signature",
497     "date_envoi_rar",
498     "date_retour_rar",
499     "date_envoi_controle_legalite",
500     "date_retour_controle_legalite",
501     "signataire_arrete",
502     "om_fichier_instruction",
503     "tacite",
504     );
505     foreach ($values as $key => $value) {
506     if (in_array($key, $fields) === true) {
507     if (array_key_exists($key, $res) === false
508     && $value !== null
509     && $value !== '') {
510     //
511     $res[$key] = $value;
512     } elseif ($key === 'tacite'
513     && $value === 't') {
514     //
515     $res[$key] = $value;
516     }
517     }
518     }
519     return $res;
520     }
521    
522 softime 9395 protected function get_document_numerise_data(string $dn) {
523     $val_dn = array();
524     $inst_dn = $this->f->get_inst__om_dbform(array(
525     "obj" => "document_numerise",
526     "idx" => $dn,
527     ));
528 softime 9404 $val_dn = $inst_dn->get_json_data();
529 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'));
530 softime 9403 // Correspond à la nomenclature Plat'AU NATURE_PIECE
531 softime 9457 $val_dn['nature'] = $val_dn['document_numerise_nature_libelle'];
532 softime 9395 return $val_dn;
533     }
534    
535 softime 9396 protected function get_parcelles_data(string $object, string $idx) {
536     $val_dp = array();
537     $inst_di = $this->f->get_inst__om_dbform(array(
538     "obj" => $object,
539     "idx" => $idx,
540     ));
541     $list_parcelles = $inst_di->get_parcelles();
542     $no_ordre = 1;
543     foreach ($list_parcelles as $parcelle) {
544     $val_dp[$parcelle[$object.'_parcelle']] = array(
545     $object.'_parcelle' => $parcelle[$object.'_parcelle'],
546     'libelle' => $parcelle['libelle'],
547     'no_ordre' => $no_ordre,
548     );
549     $no_ordre++;
550     }
551     return $val_dp;
552     }
553    
554 softime 9395 protected function view_form_json() {
555     // Mise à jour des valeurs
556 softime 9402 if ($this->f->get_submitted_post_value('valid') === 'true'
557     && $this->f->get_submitted_post_value('state') !== null) {
558 softime 9293 //
559     $params = array(
560     'val' => array(
561 softime 9402 'state' => $this->f->get_submitted_post_value('state')
562 softime 9293 ),
563     );
564     $update = $this->update_task($params);
565     $message_class = "valid";
566     $message = $this->msg;
567     if ($update === false) {
568     $this->addToLog($this->msg, DEBUG_MODE);
569     $message_class = "error";
570     $message = sprintf(
571     '%s %s',
572     __('Impossible de mettre à jour la tâche.'),
573     __('Veuillez contacter votre administrateur.')
574     );
575     }
576     $this->f->displayMessage($message_class, $message);
577 softime 9389 }
578 softime 9395 //
579 softime 9402 if ($this->f->get_submitted_post_value('valid') === 'true'
580     && $this->f->get_submitted_post_value('external_uid') !== null) {
581 softime 9385 //
582 softime 9389 $inst_lien = $this->f->get_inst__om_dbform(array(
583     "obj" => "lien_id_interne_uid_externe",
584     "idx" => ']',
585     ));
586     $valF = array(
587     'lien_id_interne_uid_externe' => '',
588     'object' => $this->get_lien_objet_by_type($this->getVal('type')),
589     'object_id' => $this->getVal('object_id'),
590 softime 9402 'external_uid' => $this->f->get_submitted_post_value('external_uid'),
591 softime 9389 );
592     $add = $inst_lien->ajouter($valF);
593     $message_class = "valid";
594     $message = $inst_lien->msg;
595     if ($add === false) {
596     $this->addToLog($inst_lien->msg, DEBUG_MODE);
597     $message_class = "error";
598     $message = sprintf(
599     '%s %s',
600     __("Impossible de mettre à jour le lien entre l'identifiant interne et l'identifiant de l'application externe."),
601     __('Veuillez contacter votre administrateur.')
602 softime 9385 );
603     }
604 softime 9389 $this->f->displayMessage($message_class, $message);
605 softime 9293 }
606 softime 9395
607     //
608 softime 9402 if ($this->f->get_submitted_post_value('valid') === null) {
609     // Liste des valeurs à afficher
610     $val = array();
611 softime 9395 //
612 softime 9402 $val_task = array_combine($this->champs, $this->val);
613 softime 9405 foreach ($val_task as $key => $value) {
614     $val_task[$key] = strip_tags($value);
615     }
616 softime 9404 $val_task['timestamp_log'] = json_decode($val_task['timestamp_log'], true);
617 softime 9402 $val['task'] = $val_task;
618     //
619     if ($this->getVal('type') === 'creation_DA') {
620     $val['dossier_autorisation'] = $this->get_dossier_autorisation_data($this->getVal('object_id'));
621     $val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_autorisation');
622     $val['dossier_autorisation_parcelle'] = $this->get_parcelles_data('dossier_autorisation', $val['dossier_autorisation']['dossier_autorisation']);
623     $val_external_uid = array();
624     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier_autorisation']['dossier_autorisation'], 'dossier_autorisation');
625     $val['external_uid'] = $val_external_uid;
626     }
627     //
628     if ($this->getVal('type') === 'creation_DI'
629 softime 9417 || $this->getVal('type') === 'modification_DI'
630     || $this->getVal('type') === 'depot_DI') {
631 softime 9402 //
632     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
633     $val['donnees_techniques'] = $this->get_donnees_techniques_data($this->getVal('object_id'), 'dossier_instruction');
634     $val['demandeur'] = $this->get_demandeurs_data($val['dossier']['dossier']);
635 softime 9403 $architecte = isset($val['donnees_techniques']['architecte']) === true ? $val['donnees_techniques']['architecte'] : null;
636     $val['architecte'] = $this->get_architecte_data($architecte);
637 softime 9402 $val['dossier_parcelle'] = $this->get_parcelles_data('dossier', $val['dossier']['dossier']);
638     $val_external_uid = array();
639     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
640     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
641     $val['external_uid'] = $val_external_uid;
642     }
643     //
644     if ($this->getVal('type') === 'qualification_DI') {
645     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
646     $val_external_uid = array();
647     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
648     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
649     $val['external_uid'] = $val_external_uid;
650     }
651     //
652     if ($this->getVal('type') === 'ajout_piece') {
653     $val['document_numerise'] = $this->get_document_numerise_data($this->getVal('object_id'));
654     $val['dossier'] = $this->get_dossier_data($val['document_numerise']['dossier']);
655     $val_external_uid = array();
656     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
657     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
658     $val_external_uid['document_numerise'] = $this->get_external_uid($val['document_numerise']['document_numerise'], 'document_numerise');
659     $val['external_uid'] = $val_external_uid;
660     }
661 softime 9414 //
662     if ($this->getVal('type') === 'decision_DI') {
663     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
664     $val['instruction'] = $this->get_instruction_data($val['dossier']['dossier']);
665     $val_external_uid = array();
666     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
667     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
668     $val['external_uid'] = $val_external_uid;
669     }
670 softime 9457 //
671     if ($this->getVal('type') === 'incompletude_DI') {
672     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
673     $val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'incompletude');
674     $val_external_uid = array();
675     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
676     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
677     $val['external_uid'] = $val_external_uid;
678     }
679 softime 9479 //
680 softime 9458 if ($this->getVal('type') === 'completude_DI') {
681     $val['dossier'] = $this->get_dossier_data($this->getVal('object_id'));
682     $val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'completude');
683     $val_external_uid = array();
684     $val_external_uid['dossier_autorisation'] = $this->get_external_uid($val['dossier']['dossier_autorisation'], 'dossier_autorisation');
685     $val_external_uid['dossier'] = $this->get_external_uid($val['dossier']['dossier'], 'dossier');
686     $val['external_uid'] = $val_external_uid;
687     }
688 softime 9402
689     // Liste des valeurs affichée en JSON
690 softime 9479 printf(json_encode($val, JSON_UNESCAPED_SLASHES));
691 softime 9395 }
692 softime 9293 }
693 softime 9385
694     protected function get_lien_objet_by_type($type) {
695     //
696     $objet = '';
697     if ($type === 'creation_DA') {
698     $objet = 'dossier_autorisation';
699     }
700 softime 9414 if ($type === 'creation_DI'
701 softime 9417 || $type === 'depot_DI'
702 softime 9414 || $type === 'modification_DI'
703     || $type === 'qualification_DI'
704 softime 9457 || $type === 'decision_DI'
705 softime 9458 || $type === 'incompletude_DI'
706     || $type === 'completude_DI') {
707 softime 9414 //
708 softime 9385 $objet = 'dossier';
709     }
710     if ($type === 'ajout_piece') {
711     $objet = 'document_numerise';
712     }
713     return $objet;
714     }
715 softime 9293 }

Properties

Name Value
svn:executable *

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26