13 |
const STATUS_ERROR = 'error'; |
const STATUS_ERROR = 'error'; |
14 |
const STATUS_DEBUG = 'debug'; |
const STATUS_DEBUG = 'debug'; |
15 |
const STATUS_ARCHIVED = 'archived'; |
const STATUS_ARCHIVED = 'archived'; |
16 |
|
const STATUS_CANCELED = 'canceled'; |
17 |
|
|
18 |
/** |
/** |
19 |
* Liste des types de tâche concernant les services instructeurs |
* Liste des types de tâche concernant les services instructeurs |
185 |
if($maj < 2) { |
if($maj < 2) { |
186 |
|
|
187 |
$contenu = array(); |
$contenu = array(); |
188 |
foreach(array('DRAFT', 'NEW', 'PENDING', 'DONE', 'ERROR', 'DEBUG') as $key) { |
foreach(array('DRAFT', 'NEW', 'PENDING', 'DONE', 'ERROR', 'DEBUG', 'ARCHIVED', 'CANCELED') as $key) { |
189 |
$const_name = 'STATUS_'.$key; |
$const_name = 'STATUS_'.$key; |
190 |
$const_value = constant("self::$const_name"); |
$const_value = constant("self::$const_name"); |
191 |
$contenu[0][] = $const_value; |
$contenu[0][] = $const_value; |
389 |
* @param bool $is_not_done [description] |
* @param bool $is_not_done [description] |
390 |
* @return [type] [description] |
* @return [type] [description] |
391 |
*/ |
*/ |
392 |
public function task_exists(string $type, string $object_id, bool $is_not_done = true) { |
public function task_exists(string $type, string $object_id, string $dossier = null, bool $is_not_done = true) { |
393 |
$query = sprintf(' |
$query = sprintf(' |
394 |
SELECT task |
SELECT task |
395 |
FROM %1$stask |
FROM %1$stask |
396 |
WHERE %2$s |
WHERE %2$s |
397 |
type = \'%3$s\' |
type = \'%3$s\' |
398 |
AND object_id = \'%4$s\' |
AND (object_id = \'%4$s\' |
399 |
|
%5$s) |
400 |
', |
', |
401 |
DB_PREFIXE, |
DB_PREFIXE, |
402 |
$is_not_done == true ? 'state != \''.self::STATUS_DONE.'\' AND' : '', |
$is_not_done == true ? 'state != \''.self::STATUS_DONE.'\' AND' : '', |
403 |
$type, |
$type, |
404 |
$object_id |
$object_id, |
405 |
|
$dossier !== null ? sprintf('OR dossier = \'%s\'', $dossier) : '' |
406 |
); |
); |
407 |
$res = $this->f->get_one_result_from_db_query($query); |
$res = $this->f->get_one_result_from_db_query($query); |
408 |
if ($res['result'] !== null && $res['result'] !== '') { |
if ($res['result'] !== null && $res['result'] !== '') { |
527 |
if($valF["stream"] == "output"){ |
if($valF["stream"] == "output"){ |
528 |
|
|
529 |
// TODO expliquer ce code |
// TODO expliquer ce code |
530 |
$task_exists = $this->task_exists($valF['type'], $valF['object_id']); |
$task_exists = $this->task_exists($valF['type'], $valF['object_id'], $valF['dossier']); |
531 |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
if ($valF['type'] === 'modification_DI' && $task_exists === false) { |
532 |
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
$task_exists = $this->task_exists('creation_DI', $valF['object_id']); |
533 |
} |
} |
534 |
if ($valF['type'] === 'modification_DA' && $task_exists === false) { |
if ($valF['type'] === 'modification_DA' && $task_exists === false) { |
535 |
$task_exists = $this->task_exists('creation_DA', $valF['object_id']); |
$task_exists = $this->task_exists('creation_DA', $valF['object_id']); |
536 |
} |
} |
537 |
|
if ($valF['type'] === 'ajout_piece') { |
538 |
|
$task_exists = $this->task_exists('ajout_piece', $valF['object_id']); |
539 |
|
} |
540 |
|
if ($valF['type'] === 'creation_consultation') { |
541 |
|
$task_exists = $this->task_exists('creation_consultation', $valF['object_id']); |
542 |
|
} |
543 |
if ($task_exists !== false) { |
if ($task_exists !== false) { |
544 |
$inst_task = $this->f->get_inst__om_dbform(array( |
$inst_task = $this->f->get_inst__om_dbform(array( |
545 |
"obj" => "task", |
"obj" => "task", |
1092 |
protected function view_form_json($in_field = false) { |
protected function view_form_json($in_field = false) { |
1093 |
// |
// |
1094 |
if ($this->f->get_submitted_post_value('valid') === null |
if ($this->f->get_submitted_post_value('valid') === null |
1095 |
&& $this->getVal('state') !== self::STATUS_DRAFT) { |
&& $this->getVal('state') !== self::STATUS_CANCELED) { |
1096 |
// Liste des valeurs à afficher |
// Liste des valeurs à afficher |
1097 |
$val = array(); |
$val = array(); |
1098 |
// |
// |