21 |
); |
); |
22 |
} |
} |
23 |
|
|
24 |
|
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 |
|
/** |
33 |
|
* |
34 |
|
* @return array |
35 |
|
*/ |
36 |
|
function get_var_sql_forminc__champs() { |
37 |
|
return array( |
38 |
|
"task", |
39 |
|
"type", |
40 |
|
"state", |
41 |
|
"object_id", |
42 |
|
"dossier", |
43 |
|
"timestamp_log", |
44 |
|
); |
45 |
|
} |
46 |
|
|
47 |
|
function setType(&$form, $maj) { |
48 |
|
parent::setType($form, $maj); |
49 |
|
// Récupération du mode de l'action |
50 |
|
$crud = $this->get_action_crud($maj); |
51 |
|
|
52 |
|
if ($maj < 2) { |
53 |
|
$form->setType("state", "select"); |
54 |
|
} |
55 |
|
if ($maj == 3){ |
56 |
|
$form->setType('dossier', 'link'); |
57 |
|
} |
58 |
|
|
59 |
|
} |
60 |
|
|
61 |
|
/** |
62 |
|
* |
63 |
|
*/ |
64 |
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
65 |
|
if($maj < 2) { |
66 |
|
$contenu=array(); |
67 |
|
|
68 |
|
$contenu[0][0]="draft"; |
69 |
|
$contenu[1][0]=_('draft'); |
70 |
|
$contenu[0][1]="new"; |
71 |
|
$contenu[1][1]=_('new'); |
72 |
|
$contenu[0][2]="pending"; |
73 |
|
$contenu[1][2]=_('pending'); |
74 |
|
$contenu[0][3]="done"; |
75 |
|
$contenu[1][3]=_('done'); |
76 |
|
$contenu[0][4]="archived"; |
77 |
|
$contenu[1][4]=_('archived'); |
78 |
|
$contenu[0][5]="error"; |
79 |
|
$contenu[1][5]=_('error'); |
80 |
|
$contenu[0][6]="debug"; |
81 |
|
$contenu[1][6]=_('debug'); |
82 |
|
|
83 |
|
$form->setSelect("state", $contenu); |
84 |
|
} |
85 |
|
|
86 |
|
if ($maj == 3) { |
87 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
88 |
|
"obj" => "dossier", |
89 |
|
"idx" => $form->val['dossier'], |
90 |
|
)); |
91 |
|
|
92 |
|
if($form->val['type'] == "creation_DA"){ |
93 |
|
$obj_link = 'dossier_autorisation'; |
94 |
|
} else { |
95 |
|
$obj_link = 'dossier_instruction'; |
96 |
|
} |
97 |
|
|
98 |
|
$params = array(); |
99 |
|
$params['obj'] = $obj_link; |
100 |
|
$params['libelle'] = $inst_dossier->getVal('dossier'); |
101 |
|
$params['title'] = "Consulter le dossier"; |
102 |
|
$params['idx'] = $form->val['dossier']; |
103 |
|
$form->setSelect("dossier", $params); |
104 |
|
} |
105 |
|
} |
106 |
|
|
107 |
|
public function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
108 |
|
parent::verifier($val, $dnu1, $dnu2); |
109 |
|
// |
110 |
|
if (array_key_exists('timestamp_log', $this->valF) === true |
111 |
|
&& is_array(json_decode($this->valF['timestamp_log'], true)) === false) { |
112 |
|
// |
113 |
|
$this->correct = false; |
114 |
|
$this->addToMessage(sprintf( |
115 |
|
__("Le champ %s doit être dans un format JSON valide."), |
116 |
|
sprintf('<span class="bold">%s</span>', $this->getLibFromField('timestamp_log')) |
117 |
|
)); |
118 |
|
} |
119 |
|
} |
120 |
|
|
121 |
protected function task_exists(string $type, string $object_id) { |
protected function task_exists(string $type, string $object_id) { |
122 |
$query = sprintf(' |
$query = sprintf(' |
123 |
SELECT task |
SELECT task |
157 |
'timestamp_log' => $timestamp_log, |
'timestamp_log' => $timestamp_log, |
158 |
'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new', |
'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new', |
159 |
'object_id' => $params['val']['object_id'], |
'object_id' => $params['val']['object_id'], |
160 |
|
'dossier' => $params['val']['dossier'], |
161 |
); |
); |
162 |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
163 |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
213 |
'timestamp_log' => $timestamp_log, |
'timestamp_log' => $timestamp_log, |
214 |
'state' => $params['val']['state'], |
'state' => $params['val']['state'], |
215 |
'object_id' => $this->getVal('object_id'), |
'object_id' => $this->getVal('object_id'), |
216 |
|
'dossier' => $this->getVal('dossier'), |
217 |
); |
); |
218 |
$update = $this->modifier($valF); |
$update = $this->modifier($valF); |
219 |
if ($update === false) { |
if ($update === false) { |
272 |
* |
* |
273 |
FROM %1$stask |
FROM %1$stask |
274 |
%2$s |
%2$s |
275 |
|
ORDER BY task ASC |
276 |
', |
', |
277 |
DB_PREFIXE, |
DB_PREFIXE, |
278 |
$where |
$where |
284 |
$list_tasks = array(); |
$list_tasks = array(); |
285 |
foreach ($res['result'] as $task) { |
foreach ($res['result'] as $task) { |
286 |
$task['timestamp_log'] = json_decode($task['timestamp_log'], true); |
$task['timestamp_log'] = json_decode($task['timestamp_log'], true); |
287 |
|
$task['dossier'] = $task['object_id']; |
288 |
|
if ($this->get_lien_objet_by_type($task['type']) === 'document_numerise') { |
289 |
|
$val_dn = $this->get_document_numerise_data($task['object_id']); |
290 |
|
$task['dossier'] = $val_dn['dossier']; |
291 |
|
} |
292 |
$list_tasks[$task['task']] = $task; |
$list_tasks[$task['task']] = $task; |
293 |
} |
} |
294 |
printf(json_encode($list_tasks)); |
printf(json_encode($list_tasks)); |
524 |
} |
} |
525 |
if ($instruction_with_doc !== null) { |
if ($instruction_with_doc !== null) { |
526 |
// |
// |
527 |
$val_instruction['path'] = sprintf('%s&snippet=%s&obj=%s&champ=%s&id=%s', 'openads/app/index.php?module=form', 'file', 'instruction', 'om_fichier_instruction', $instruction_with_doc); |
$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); |
528 |
} |
} |
529 |
} |
} |
530 |
return $val_instruction; |
return $val_instruction; |
566 |
"idx" => $dn, |
"idx" => $dn, |
567 |
)); |
)); |
568 |
$val_dn = $inst_dn->get_json_data(); |
$val_dn = $inst_dn->get_json_data(); |
569 |
$val_dn['path'] = sprintf('%s&snippet=%s&obj=%s&champ=%s&id=%s', 'openads/app/index.php?module=form', 'file', 'document_numerise', 'uid', $this->getVal('object_id')); |
$val_dn['path'] = sprintf('%s&snippet=%s&obj=%s&champ=%s&id=%s', 'app/index.php?module=form', 'file', 'document_numerise', 'uid', $this->getVal('object_id')); |
570 |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
571 |
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
572 |
return $val_dn; |
return $val_dn; |