536 |
*/ |
*/ |
537 |
function updateDate($champ) { |
function updateDate($champ) { |
538 |
|
|
539 |
// Vérification de la possibilité de modifier les dates si déjà éditées |
//Si le retourformulaire est "dossier_instruction" |
540 |
if($this->valF[$champ] != "" AND !$this->f->user_is_admin) { |
if ($this->retourformulaire == "dossier_instruction") { |
541 |
// si l'utilisateur n'est pas un admin |
|
542 |
if($this->getVal($champ) != "" AND $this->getVal($champ) != $this->valF[$champ]) { |
// Vérification de la possibilité de modifier les dates si déjà éditées |
543 |
$this->correct = false; |
if($this->valF[$champ] != "" AND !$this->f->user_is_admin) { |
544 |
$this->addToMessage(_("Les dates de suivis ne peuvent etre modifiees")); |
// si l'utilisateur n'est pas un admin |
545 |
|
if($this->getVal($champ) != "" AND $this->getVal($champ) != $this->valF[$champ]) { |
546 |
|
$this->correct = false; |
547 |
|
$this->addToMessage(_("Les dates de suivis ne peuvent etre modifiees")); |
548 |
|
} |
549 |
} |
} |
550 |
} |
} |
551 |
// Vérification de la possibilité d'ajouter des dates si le document est finalisé |
|
552 |
if($this->valF[$champ] != "" |
// |
|
AND $this->getVal($champ) == "" |
|
|
AND $this->valF["om_final_instruction"] === false) { |
|
|
|
|
|
$this->correct = false; |
|
|
$this->addToMessage(_("Les dates de suivis ne peuvent etre |
|
|
modifiees si le document n'est pas finalise")); |
|
|
} |
|
553 |
return true; |
return true; |
554 |
} |
} |
555 |
|
|
1185 |
die($action->getMessage()); |
die($action->getMessage()); |
1186 |
} |
} |
1187 |
|
|
|
// Récupération de tous les paramètres de l'événement sélectionné |
|
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
|
|
WHERE evenement=".$this->valF['evenement']; |
|
|
$res = $db->query($sql); |
|
|
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
|
|
if (database::isError($res)) { |
|
|
die($res->getMessage()); |
|
|
} |
|
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
|
// Récupération du type d'événement |
|
|
$type_evmt = $row['type']; |
|
|
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
|
|
if ($this->getVal('date_retour_signature') == "" AND |
|
|
$this->valF['date_retour_signature'] != "" AND |
|
|
$row['evenement_retour_signature'] != "") { |
|
|
$new_instruction = new instruction("]", $db, $DEBUG); |
|
|
// Création d'un tableau avec la liste des champs de l'instruction |
|
|
foreach($new_instruction->champs as $champ) { |
|
|
$valNewInstr[$champ] = ""; |
|
|
} |
|
|
// Définition des valeurs de la nouvelle instruction |
|
|
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
|
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
|
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
|
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
|
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
|
|
} |
|
|
// Si la date de retour AR est éditée on vérifie si il existe un événement automatique |
|
|
if ($this->getVal('date_retour_rar') == "" AND |
|
|
$this->valF['date_retour_rar'] != "" AND |
|
|
$row['evenement_retour_ar'] != "" ) { |
|
|
$new_instruction = new instruction("]", $db, $DEBUG); |
|
|
// Création d'un tableau avec la liste des champs de l'instruction |
|
|
foreach($new_instruction->champs as $champ) { |
|
|
$valNewInstr[$champ] = ""; |
|
|
} |
|
|
// Définition des valeurs de la nouvelle instruction |
|
|
$valNewInstr["evenement"] = $row['evenement_retour_ar']; |
|
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
|
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
|
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
|
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
|
|
} |
|
|
} |
|
|
|
|
1188 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
1189 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
1190 |
WHERE action='".$action."'"; |
WHERE action='".$action."'"; |
1231 |
// On met à jour le dossier |
// On met à jour le dossier |
1232 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$cle = " dossier='".$this->valF['dossier']."'"; |
1233 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
1234 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog("triggermodifierapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
1235 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
1236 |
die($res->getMessage()); |
die($res->getMessage()); |
1237 |
} |
} |
1239 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
1240 |
} |
} |
1241 |
|
|
1242 |
|
// Récupération de tous les paramètres de l'événement sélectionné |
1243 |
|
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
1244 |
|
WHERE evenement=".$this->valF['evenement']; |
1245 |
|
$res = $db->query($sql); |
1246 |
|
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1247 |
|
if (database::isError($res)) { |
1248 |
|
die($res->getMessage()); |
1249 |
|
} |
1250 |
|
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
1251 |
|
// Si la date de retour signature est éditée on vérifie si il existe un événement automatique |
1252 |
|
if ($this->getVal('date_retour_signature') == "" AND |
1253 |
|
$this->valF['date_retour_signature'] != "" AND |
1254 |
|
$row['evenement_retour_signature'] != "") { |
1255 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1256 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1257 |
|
foreach($new_instruction->champs as $champ) { |
1258 |
|
$valNewInstr[$champ] = ""; |
1259 |
|
} |
1260 |
|
// Définition des valeurs de la nouvelle instruction |
1261 |
|
$valNewInstr["evenement"] = $row['evenement_retour_signature']; |
1262 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1263 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1264 |
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
1265 |
|
$valNewInstr["date_envoi_signature"] = $this->f->formatDate($this->valF['date_envoi_signature']); |
1266 |
|
$valNewInstr["date_retour_signature"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1267 |
|
$valNewInstr["date_envoi_rar"] = $this->f->formatDate($this->valF['date_envoi_rar']); |
1268 |
|
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1269 |
|
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
1270 |
|
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
1271 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1272 |
|
} |
1273 |
|
// Si la date de retour AR est éditée on vérifie si il existe un événement automatique |
1274 |
|
if ($this->getVal('date_retour_rar') == "" AND |
1275 |
|
$this->valF['date_retour_rar'] != "" AND |
1276 |
|
$row['evenement_retour_ar'] != "" ) { |
1277 |
|
$new_instruction = new instruction("]", $db, $DEBUG); |
1278 |
|
// Création d'un tableau avec la liste des champs de l'instruction |
1279 |
|
foreach($new_instruction->champs as $champ) { |
1280 |
|
$valNewInstr[$champ] = ""; |
1281 |
|
} |
1282 |
|
// Définition des valeurs de la nouvelle instruction |
1283 |
|
$valNewInstr["evenement"] = $row['evenement_retour_ar']; |
1284 |
|
$valNewInstr["destinataire"] = $this->valF['destinataire']; |
1285 |
|
$valNewInstr["dossier"] = $this->valF['dossier']; |
1286 |
|
$valNewInstr["date_evenement"] = date("d/m/Y"); |
1287 |
|
$valNewInstr["date_envoi_signature"] = $this->f->formatDate($this->valF['date_envoi_signature']); |
1288 |
|
$valNewInstr["date_retour_signature"] = $this->f->formatDate($this->valF['date_retour_signature']); |
1289 |
|
$valNewInstr["date_envoi_rar"] = $this->f->formatDate($this->valF['date_envoi_rar']); |
1290 |
|
$valNewInstr["date_retour_rar"] = $this->f->formatDate($this->valF['date_retour_rar']); |
1291 |
|
$valNewInstr["date_envoi_controle_legalite"] = $this->f->formatDate($this->valF['date_envoi_controle_legalite']); |
1292 |
|
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
1293 |
|
$new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
1294 |
|
} |
1295 |
|
} |
1296 |
|
|
1297 |
/** |
/** |
1298 |
* REFERENTIEL ARRETE |
* REFERENTIEL ARRETE |
1299 |
*/ |
*/ |
1346 |
donnees_techniques.dossier_instruction = dossier.dossier |
donnees_techniques.dossier_instruction = dossier.dossier |
1347 |
WHERE instruction.instruction = ".$this->valF['instruction']; |
WHERE instruction.instruction = ".$this->valF['instruction']; |
1348 |
$resArrete = $this->db->query($sqlArrete); |
$resArrete = $this->db->query($sqlArrete); |
1349 |
$this->f->addToLog("triggerModifierApres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
$this->f->addToLog("triggermodifierapres(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
1350 |
if ( database::isError($resArrete)){ |
if ( database::isError($resArrete)){ |
1351 |
die(); |
die(); |
1352 |
} |
} |