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 |
|
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 |
|
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 |
protected function task_exists(string $type, string $object_id) { |
protected function task_exists(string $type, string $object_id) { |
83 |
$query = sprintf(' |
$query = sprintf(' |
84 |
SELECT task |
SELECT task |
118 |
'timestamp_log' => $timestamp_log, |
'timestamp_log' => $timestamp_log, |
119 |
'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new', |
'state' => isset($params['val']['state']) === true ? $params['val']['state'] : 'new', |
120 |
'object_id' => $params['val']['object_id'], |
'object_id' => $params['val']['object_id'], |
121 |
|
'dossier' => $params['val']['dossier'], |
122 |
); |
); |
123 |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
124 |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
232 |
* |
* |
233 |
FROM %1$stask |
FROM %1$stask |
234 |
%2$s |
%2$s |
235 |
|
ORDER BY task ASC |
236 |
', |
', |
237 |
DB_PREFIXE, |
DB_PREFIXE, |
238 |
$where |
$where |
244 |
$list_tasks = array(); |
$list_tasks = array(); |
245 |
foreach ($res['result'] as $task) { |
foreach ($res['result'] as $task) { |
246 |
$task['timestamp_log'] = json_decode($task['timestamp_log'], true); |
$task['timestamp_log'] = json_decode($task['timestamp_log'], true); |
247 |
|
$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 |
$list_tasks[$task['task']] = $task; |
$list_tasks[$task['task']] = $task; |
253 |
} |
} |
254 |
printf(json_encode($list_tasks)); |
printf(json_encode($list_tasks)); |
484 |
} |
} |
485 |
if ($instruction_with_doc !== null) { |
if ($instruction_with_doc !== null) { |
486 |
// |
// |
487 |
$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); |
488 |
} |
} |
489 |
} |
} |
490 |
return $val_instruction; |
return $val_instruction; |
526 |
"idx" => $dn, |
"idx" => $dn, |
527 |
)); |
)); |
528 |
$val_dn = $inst_dn->get_json_data(); |
$val_dn = $inst_dn->get_json_data(); |
529 |
$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')); |
530 |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
// Correspond à la nomenclature Plat'AU NATURE_PIECE |
531 |
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
$val_dn['nature'] = $val_dn['document_numerise_nature_libelle']; |
532 |
return $val_dn; |
return $val_dn; |