482 |
} |
} |
483 |
|
|
484 |
/** |
/** |
485 |
|
* TRIGGER - triggermodifierapres. |
486 |
|
* |
487 |
|
* @param string $id |
488 |
|
* @param null &$dnu1 @deprecated Ne pas utiliser. |
489 |
|
* @param array $val Tableau des valeurs brutes. |
490 |
|
* @param null $dnu2 @deprecated Ne pas utiliser. |
491 |
|
* |
492 |
|
* @return boolean |
493 |
|
*/ |
494 |
|
public function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
495 |
|
parent::triggermodifierapres($id, $dnu1, $val, $dnu2); |
496 |
|
|
497 |
|
// Suivi des notificiations |
498 |
|
if (isset($val['category']) === true |
499 |
|
&& $val['category'] === 'portal' |
500 |
|
&& isset($val['type']) === true |
501 |
|
&& ($val['type'] === 'notification_recepisse' |
502 |
|
|| $val['type'] === 'notification_instruction' |
503 |
|
|| $val['type'] === 'notification_decision')) { |
504 |
|
// |
505 |
|
if (isset($this->valF['state']) === true |
506 |
|
&& $this->valF['state'] !== $this->getVal('state')) { |
507 |
|
// |
508 |
|
$inst_in = $this->f->get_inst__om_dbform(array( |
509 |
|
"obj" => "instruction_notification", |
510 |
|
"idx" => $val['object_id'], |
511 |
|
)); |
512 |
|
$valF = array(); |
513 |
|
foreach ($inst_in->champs as $champ) { |
514 |
|
$valF[$champ] = $inst_in->getVal($champ); |
515 |
|
} |
516 |
|
// Pas de date sur le suivi des notifications depuis un portail |
517 |
|
$valF['date_envoi'] = null; |
518 |
|
$valF['date_premier_acces'] = null; |
519 |
|
if ($this->valF['state'] === self::STATUS_DONE) { |
520 |
|
$valF['statut'] = __("envoyé"); |
521 |
|
$valF['commentaire'] = __("Notification traitée"); |
522 |
|
} |
523 |
|
if ($this->valF['state'] === self::STATUS_ERROR) { |
524 |
|
$valF['statut'] = __("échec"); |
525 |
|
$valF['commentaire'] = __("Le traitement de la notification a échoué"); |
526 |
|
} |
527 |
|
$inst_in->setParameter('maj', 1); |
528 |
|
$update = $inst_in->modifier($valF); |
529 |
|
if ($update === false) { |
530 |
|
$this->addToLog(__METHOD__."(): ".$inst_in->msg, DEBUG_MODE); |
531 |
|
return false; |
532 |
|
} |
533 |
|
} |
534 |
|
} |
535 |
|
|
536 |
|
// |
537 |
|
return true; |
538 |
|
} |
539 |
|
|
540 |
|
/** |
541 |
* TREATMENT - add_task |
* TREATMENT - add_task |
542 |
* Ajoute un enregistrement. |
* Ajoute un enregistrement. |
543 |
* |
* |