423 |
type = \'%3$s\' |
type = \'%3$s\' |
424 |
AND (object_id = \'%4$s\' |
AND (object_id = \'%4$s\' |
425 |
%5$s) |
%5$s) |
426 |
|
AND state != \'%6$s\' |
427 |
', |
', |
428 |
DB_PREFIXE, |
DB_PREFIXE, |
429 |
$is_not_done == true ? 'state != \''.self::STATUS_DONE.'\' AND' : '', |
$is_not_done == true ? 'state != \''.self::STATUS_DONE.'\' AND' : '', |
430 |
$type, |
$type, |
431 |
$object_id, |
$object_id, |
432 |
$dossier !== null ? sprintf('OR dossier = \'%s\'', $dossier) : '' |
$dossier !== null ? sprintf('OR dossier = \'%s\'', $dossier) : '', |
433 |
|
self::STATUS_CANCELED |
434 |
); |
); |
435 |
$res = $this->f->get_one_result_from_db_query($query); |
$res = $this->f->get_one_result_from_db_query($query); |
436 |
if ($res['result'] !== null && $res['result'] !== '') { |
if ($res['result'] !== null && $res['result'] !== '') { |
440 |
} |
} |
441 |
|
|
442 |
/** |
/** |
443 |
|
* Permet la recherche multi-critères des tasks. |
444 |
|
* |
445 |
|
* @param array $search_values Chaque entrée du tableau est une ligne dans le WHERE |
446 |
|
* @return mixed Retourne le résultat de la requête ou false |
447 |
|
*/ |
448 |
|
public function task_exists_multi_search(array $search_values) { |
449 |
|
$query = sprintf(' |
450 |
|
SELECT task |
451 |
|
FROM %1$stask |
452 |
|
%2$s |
453 |
|
%3$s |
454 |
|
', |
455 |
|
DB_PREFIXE, |
456 |
|
empty($search_values) === false ? ' WHERE ' : '', |
457 |
|
implode(' AND ', $search_values) |
458 |
|
); |
459 |
|
$res = $this->f->get_all_results_from_db_query($query); |
460 |
|
if (count($res['result']) > 0) { |
461 |
|
return $res['result']; |
462 |
|
} |
463 |
|
return false; |
464 |
|
} |
465 |
|
|
466 |
|
/** |
467 |
* TRIGGER - triggerajouter. |
* TRIGGER - triggerajouter. |
468 |
* |
* |
469 |
* @param string $id |
* @param string $id |
1212 |
return $res; |
return $res; |
1213 |
} |
} |
1214 |
|
|
1215 |
|
/** |
1216 |
|
* Permet de définir si l'instruction passée en paramètre est une instruction |
1217 |
|
* récépissé d'une demande et si la demande en question a générée un dossier d'instruction. |
1218 |
|
* |
1219 |
|
* @param integer $instruction Identifiant de l'instruction |
1220 |
|
* @return boolean |
1221 |
|
*/ |
1222 |
|
protected function is_demande_instruction_recepisse_without_dossier($instruction) { |
1223 |
|
$query = sprintf(' |
1224 |
|
SELECT demande_type.dossier_instruction_type |
1225 |
|
FROM %1$sdemande |
1226 |
|
INNER JOIN %1$sdemande_type ON demande.demande_type = demande_type.demande_type |
1227 |
|
WHERE demande.instruction_recepisse = %2$s |
1228 |
|
', |
1229 |
|
DB_PREFIXE, |
1230 |
|
$instruction |
1231 |
|
); |
1232 |
|
$res = $this->f->get_one_result_from_db_query( |
1233 |
|
$query, |
1234 |
|
true |
1235 |
|
); |
1236 |
|
if ($res['code'] === 'KO') { |
1237 |
|
return null; |
1238 |
|
} |
1239 |
|
if ($res['result'] === '') { |
1240 |
|
return true; |
1241 |
|
} |
1242 |
|
return false; |
1243 |
|
} |
1244 |
|
|
1245 |
protected function get_document_numerise_data(string $dn) { |
protected function get_document_numerise_data(string $dn) { |
1246 |
$val_dn = array(); |
$val_dn = array(); |
1247 |
$inst_dn = $this->f->get_inst__om_dbform(array( |
$inst_dn = $this->f->get_inst__om_dbform(array( |
1403 |
if ($this->getVal('type') === 'decision_DI') { |
if ($this->getVal('type') === 'decision_DI') { |
1404 |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
$val['dossier'] = $this->get_dossier_data($this->getVal('dossier')); |
1405 |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $this->getVal('object_id'))); |
1406 |
|
$val['instruction']['final'] = 't'; |
1407 |
if (isset($val['instruction']['signataire_arrete']) === true) { |
if (isset($val['instruction']['signataire_arrete']) === true) { |
1408 |
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
$val['signataire_arrete'] = $this->get_signataire_arrete_data($val['instruction']['signataire_arrete']); |
1409 |
} |
} |
1474 |
$val['demandeur'] = $this->get_demandeurs_data($this->getVal('dossier')); |
$val['demandeur'] = $this->get_demandeurs_data($this->getVal('dossier')); |
1475 |
$val['instruction_notification'] = $this->get_instruction_notification_data($this->getVal('category'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
$val['instruction_notification'] = $this->get_instruction_notification_data($this->getVal('category'), 'with-id', array('with-id' => $this->getVal('object_id'))); |
1476 |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $val['instruction_notification']['instruction'])); |
$val['instruction'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $val['instruction_notification']['instruction'])); |
1477 |
|
// Précise qu'il s'agit d'une instruction final si l'instruction est liée à une |
1478 |
|
// demande dont le type ne génère pas de dossier |
1479 |
|
if ($this->is_demande_instruction_recepisse_without_dossier($val['instruction_notification']['instruction']) === true) { |
1480 |
|
$val['instruction']['final'] = 't'; |
1481 |
|
} |
1482 |
|
// |
1483 |
if ($val['instruction_notification']['instruction_annexe'] != '') { |
if ($val['instruction_notification']['instruction_annexe'] != '') { |
1484 |
$val['instruction_annexe'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $val['instruction_notification']['instruction_annexe'])); |
$val['instruction_annexe'] = $this->get_instruction_data($val['dossier']['dossier'], 'with-id', array('with-id' => $val['instruction_notification']['instruction_annexe'])); |
1485 |
} |
} |
1486 |
$val_external_uid = array(); |
$val_external_uid = array(); |
1487 |
$val_external_uid['demande'] = $this->get_external_uid($val['dossier']['dossier'], 'demande'); |
// Affiche l'identifiant externe lié à l'instruction si cette combinaison existe, sinon celui lié au dossier |
1488 |
|
$val_external_uid['demande'] = $this->get_external_uid($val['instruction_notification']['instruction'], 'demande') !== '' ? $this->get_external_uid($val['instruction_notification']['instruction'], 'demande') : $this->get_external_uid($val['dossier']['dossier'], 'demande'); |
1489 |
$val['external_uids'] = $val_external_uid; |
$val['external_uids'] = $val_external_uid; |
1490 |
} |
} |
1491 |
// |
// |