1 |
<?php |
<?php |
2 |
/** |
/** |
3 |
|
* DBFORM - 'instruction' - Surcharge gen. |
4 |
|
* |
5 |
* specific : |
* specific : |
6 |
* - cle secondaire |
* - cle secondaire |
7 |
* destruction autorisée que pour le dernier evenement |
* destruction autorisée que pour le dernier evenement |
14 |
* - function mois_date : pour ajouter des mois a une date |
* - function mois_date : pour ajouter des mois a une date |
15 |
* [add months (delay) and calculation final date] |
* [add months (delay) and calculation final date] |
16 |
* - voir script_lang.js : bible ... |
* - voir script_lang.js : bible ... |
17 |
* |
* |
18 |
* @package openfoncier |
* @package openfoncier |
19 |
* @version SVN : $Id$ |
* @version SVN : $Id$ |
20 |
*/ |
*/ |
29 |
var $abstract_type = array( |
var $abstract_type = array( |
30 |
"om_fichier_instruction" => "file", |
"om_fichier_instruction" => "file", |
31 |
); |
); |
32 |
|
|
|
var $retourformulaire; // specific |
|
|
var $idxformulaire; // specific |
|
33 |
var $valEvenement; |
var $valEvenement; |
34 |
var $restriction_valid = null; |
var $restriction_valid = null; |
35 |
// Tableau contenant une partie des métadonnées arrêtés |
// Tableau contenant une partie des métadonnées arrêtés |
88 |
), |
), |
89 |
); |
); |
90 |
|
|
91 |
function __construct($id, &$db, $debug) { |
/** |
92 |
$this->constructeur($id, $db, $debug); |
* Flag pour identifier la reprise de l'instruction d'un dossier. |
93 |
} |
* Le statut de l'état passe de "cloture" à "encours". |
94 |
|
* |
95 |
|
* @var boolean |
96 |
|
*/ |
97 |
|
var $di_reopened = null; |
98 |
|
|
99 |
// {{{ Gestion de la confidentialité des données spécifiques |
// {{{ Gestion de la confidentialité des données spécifiques |
100 |
|
|
247 |
); |
); |
248 |
|
|
249 |
// ACTION - 180 - pdf_lettre_rar |
// ACTION - 180 - pdf_lettre_rar |
250 |
// Génère PDF sur bordereaux de lettres RAR |
// Génère PDF sur bordereaux de lettres AR |
251 |
$this->class_actions[180] = array( |
$this->class_actions[180] = array( |
252 |
"identifier" => "pdf_lettre_rar", |
"identifier" => "pdf_lettre_rar", |
253 |
"view" => "view_pdf_lettre_rar", |
"view" => "view_pdf_lettre_rar", |
294 |
"view" => "view_generate_suivi_bordereaux", |
"view" => "view_generate_suivi_bordereaux", |
295 |
"permission_suffix" => "consulter", |
"permission_suffix" => "consulter", |
296 |
); |
); |
297 |
|
|
298 |
|
// ACTION - 777 - pdf_temp |
299 |
|
// Crée un PDF temporaire et affiche son contenu en base64 |
300 |
|
$this->class_actions[777] = array( |
301 |
|
"identifier" => "pdf_temp", |
302 |
|
"view" => "view_pdf_temp", |
303 |
|
"permission_suffix" => "modifier", |
304 |
|
"condition" => array("can_user_access_dossier_contexte_modification"), |
305 |
|
); |
306 |
|
|
307 |
|
// ACTION - 701 |
308 |
|
$this->class_actions[701] = array( |
309 |
|
"identifier" => "enable-edition-integrale", |
310 |
|
"portlet" => array( |
311 |
|
"type" => "action-direct-with-confirmation", |
312 |
|
"libelle" => _("Rédaction libre"), |
313 |
|
"order" => 50, |
314 |
|
"class" => "redac-libre-16", |
315 |
|
), |
316 |
|
"view" => "formulaire", |
317 |
|
"method" => "enable_edition_integrale", |
318 |
|
"permission_suffix" => "modifier", |
319 |
|
"condition" => array( |
320 |
|
"is_editable", |
321 |
|
"is_finalizable_without_bypass", |
322 |
|
"can_user_access_dossier_contexte_modification", |
323 |
|
"is_edition_integrale_not_enabled", |
324 |
|
"is_option_redaction_libre_enabled", |
325 |
|
"has_an_edition", |
326 |
|
), |
327 |
|
); |
328 |
|
// ACTION - 702 |
329 |
|
$this->class_actions[702] = array( |
330 |
|
"identifier" => "disable-edition-integrale", |
331 |
|
"portlet" => array( |
332 |
|
"type" => "action-direct-with-confirmation", |
333 |
|
"libelle" => _("Rédaction par compléments"), |
334 |
|
"order" => 50, |
335 |
|
"class" => "redac-complement-16", |
336 |
|
), |
337 |
|
"view" => "formulaire", |
338 |
|
"method" => "disable_edition_integrale", |
339 |
|
"permission_suffix" => "modifier", |
340 |
|
"condition" => array( |
341 |
|
"is_editable", |
342 |
|
"is_finalizable_without_bypass", |
343 |
|
"can_user_access_dossier_contexte_modification", |
344 |
|
"is_edition_integrale_enabled", |
345 |
|
"is_option_redaction_libre_enabled", |
346 |
|
"has_an_edition", |
347 |
|
), |
348 |
|
); |
349 |
|
// ACTION - 300 - evenement_has_an_edition_json |
350 |
|
// |
351 |
|
$this->class_actions[300] = array( |
352 |
|
"identifier" => "evenement_has_an_edition_json", |
353 |
|
"view" => "view_evenement_has_an_edition_json", |
354 |
|
"permission_suffix" => "consulter", |
355 |
|
); |
356 |
} |
} |
357 |
|
|
358 |
|
/** |
359 |
|
* Clause select pour la requête de sélection des données de l'enregistrement. |
360 |
|
* |
361 |
|
* @return array |
362 |
|
*/ |
363 |
|
function get_var_sql_forminc__champs() { |
364 |
|
return array( |
365 |
|
"instruction", |
366 |
|
"destinataire", |
367 |
|
"instruction.evenement", |
368 |
|
"date_evenement", |
369 |
|
"instruction.lettretype", |
370 |
|
"signataire_arrete", |
371 |
|
"flag_edition_integrale", |
372 |
|
"om_final_instruction_utilisateur", |
373 |
|
"date_finalisation_courrier", |
374 |
|
"date_envoi_signature", |
375 |
|
"date_envoi_rar", |
376 |
|
"date_envoi_controle_legalite", |
377 |
|
|
378 |
|
"date_retour_signature", |
379 |
|
"date_retour_rar", |
380 |
|
"date_retour_controle_legalite", |
381 |
|
|
382 |
|
"numero_arrete", |
383 |
|
|
384 |
|
"complement_om_html", |
385 |
|
"'' as bible_auto", |
386 |
|
"'' as bible", |
387 |
|
"complement2_om_html", |
388 |
|
"'' as bible2", |
389 |
|
"complement3_om_html", |
390 |
|
"'' as bible3", |
391 |
|
"complement4_om_html", |
392 |
|
"'' as bible4", |
393 |
|
|
394 |
|
"titre_om_htmletat", |
395 |
|
"corps_om_htmletatex", |
396 |
|
|
397 |
|
"'' as btn_preview", |
398 |
|
"'' as btn_redaction", |
399 |
|
|
400 |
|
"'' as btn_refresh", |
401 |
|
"'' as live_preview", |
402 |
|
|
403 |
|
"dossier", |
404 |
|
"instruction.action", |
405 |
|
"instruction.delai", |
406 |
|
"instruction.etat", |
407 |
|
"instruction.autorite_competente", |
408 |
|
"instruction.accord_tacite", |
409 |
|
"instruction.delai_notification", |
410 |
|
"instruction.avis_decision", |
411 |
|
"archive_delai", |
412 |
|
"archive_accord_tacite", |
413 |
|
"archive_etat", |
414 |
|
"archive_avis", |
415 |
|
"archive_date_complet", |
416 |
|
"archive_date_rejet", |
417 |
|
"archive_date_limite", |
418 |
|
"archive_date_notification_delai", |
419 |
|
"archive_date_decision", |
420 |
|
"archive_date_validite", |
421 |
|
"archive_date_achevement", |
422 |
|
"archive_date_conformite", |
423 |
|
"archive_date_chantier", |
424 |
|
"archive_date_dernier_depot", |
425 |
|
"date_depot", |
426 |
|
"complement5_om_html", |
427 |
|
"'' as bible5", |
428 |
|
"complement6_om_html", |
429 |
|
"'' as bible6", |
430 |
|
"complement7_om_html", |
431 |
|
"'' as bible7", |
432 |
|
"complement8_om_html", |
433 |
|
"'' as bible8", |
434 |
|
"complement9_om_html", |
435 |
|
"'' as bible9", |
436 |
|
"complement10_om_html", |
437 |
|
"'' as bible10", |
438 |
|
"complement11_om_html", |
439 |
|
"'' as bible11", |
440 |
|
"complement12_om_html", |
441 |
|
"complement13_om_html", |
442 |
|
"complement14_om_html", |
443 |
|
"complement15_om_html", |
444 |
|
"archive_incompletude", |
445 |
|
"archive_incomplet_notifie", |
446 |
|
"archive_evenement_suivant_tacite", |
447 |
|
"archive_evenement_suivant_tacite_incompletude", |
448 |
|
"archive_etat_pendant_incompletude", |
449 |
|
"archive_date_limite_incompletude", |
450 |
|
"archive_delai_incompletude", |
451 |
|
"archive_autorite_competente", |
452 |
|
"code_barres", |
453 |
|
"om_fichier_instruction", |
454 |
|
"om_final_instruction", |
455 |
|
"om_fichier_instruction_dossier_final", |
456 |
|
"document_numerise", |
457 |
|
"duree_validite_parametrage", |
458 |
|
"duree_validite", |
459 |
|
"created_by_commune", |
460 |
|
"archive_date_cloture_instruction", |
461 |
|
"archive_date_premiere_visite", |
462 |
|
"archive_date_derniere_visite", |
463 |
|
"archive_date_contradictoire", |
464 |
|
"archive_date_retour_contradictoire", |
465 |
|
"archive_date_ait", |
466 |
|
"archive_date_transmission_parquet", |
467 |
|
"archive_dossier_instruction_type", |
468 |
|
"archive_date_affichage", |
469 |
|
); |
470 |
|
} |
471 |
|
|
472 |
|
/** |
473 |
|
* CONDITION - is_edition_integrale_enabled |
474 |
|
* |
475 |
|
* Vérifie que la rédaction libre est activée sur l'instruction en cours. |
476 |
|
* |
477 |
|
* @return boolean |
478 |
|
*/ |
479 |
|
function is_edition_integrale_enabled() { |
480 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
481 |
|
return true; |
482 |
|
} |
483 |
|
return false; |
484 |
|
} |
485 |
|
|
486 |
|
/** |
487 |
|
* CONDITION - is_edition_integrale_not_enabled |
488 |
|
* |
489 |
|
* Vérifie que la rédaction libre est désactivée sur l'instruction en cours. |
490 |
|
* |
491 |
|
* @return boolean |
492 |
|
*/ |
493 |
|
function is_edition_integrale_not_enabled() { |
494 |
|
return !$this->is_edition_integrale_enabled(); |
495 |
|
} |
496 |
|
|
497 |
|
/** |
498 |
|
* CONDITION - is_option_redaction_libre_enabled |
499 |
|
* |
500 |
|
* Vérifie que l'option de rédaction libre est activée. |
501 |
|
* |
502 |
|
* @return boolean |
503 |
|
*/ |
504 |
|
function is_option_redaction_libre_enabled() { |
505 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
506 |
|
return $this->f->is_option_redaction_libre_enabled($collectivite_di); |
507 |
|
} |
508 |
|
|
509 |
|
/** |
510 |
|
* TREATMENT - disable_edition_integrale. |
511 |
|
* |
512 |
|
* Cette methode permet de passer la consultation en "lu" |
513 |
|
* |
514 |
|
* @return boolean true si maj effectué false sinon |
515 |
|
*/ |
516 |
|
function disable_edition_integrale() { |
517 |
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
518 |
|
// dites de TREATMENT. |
519 |
|
$this->begin_treatment(__METHOD__); |
520 |
|
$this->correct = true; |
521 |
|
$valF = array( |
522 |
|
"flag_edition_integrale" => false, |
523 |
|
"titre_om_htmletat" => null, |
524 |
|
"corps_om_htmletatex" => null, |
525 |
|
); |
526 |
|
$res = $this->f->db->autoExecute( |
527 |
|
DB_PREFIXE.$this->table, |
528 |
|
$valF, |
529 |
|
DB_AUTOQUERY_UPDATE, |
530 |
|
$this->clePrimaire."=".$this->getVal($this->clePrimaire) |
531 |
|
); |
532 |
|
if ($this->f->isDatabaseError($res, true)) { |
533 |
|
// Appel de la methode de recuperation des erreurs |
534 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
535 |
|
$this->correct = false; |
536 |
|
// Termine le traitement |
537 |
|
return $this->end_treatment(__METHOD__, false); |
538 |
|
} else { |
539 |
|
$this->addToMessage(_("Rédaction par compléments activé.")); |
540 |
|
return $this->end_treatment(__METHOD__, true); |
541 |
|
} |
542 |
|
|
543 |
|
// Termine le traitement |
544 |
|
return $this->end_treatment(__METHOD__, false); |
545 |
|
} |
546 |
|
|
547 |
|
/** |
548 |
|
* TREATMENT - enable_edition_integrale. |
549 |
|
* |
550 |
|
* Cette methode permet de passer la consultation en "lu" |
551 |
|
* |
552 |
|
* @return boolean true si maj effectué false sinon |
553 |
|
*/ |
554 |
|
function enable_edition_integrale() { |
555 |
|
// Cette méthode permet d'exécuter une routine en début des méthodes |
556 |
|
// dites de TREATMENT. |
557 |
|
$this->begin_treatment(__METHOD__); |
558 |
|
$this->correct = true; |
559 |
|
|
560 |
|
// Récupère la collectivite du dossier d'instruction |
561 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
562 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
563 |
|
// |
564 |
|
$params = array( |
565 |
|
"specific" => array( |
566 |
|
"corps" => array( |
567 |
|
"mode" => "get", |
568 |
|
) |
569 |
|
), |
570 |
|
); |
571 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
572 |
|
$corps = $result['pdf_output']; |
573 |
|
// |
574 |
|
$params = array( |
575 |
|
"specific" => array( |
576 |
|
"titre" => array( |
577 |
|
"mode" => "get", |
578 |
|
) |
579 |
|
), |
580 |
|
); |
581 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
582 |
|
$titre = $result['pdf_output']; |
583 |
|
// |
584 |
|
$valF = array( |
585 |
|
"flag_edition_integrale" => true, |
586 |
|
"titre_om_htmletat" => $titre, |
587 |
|
"corps_om_htmletatex" => $corps, |
588 |
|
); |
589 |
|
$res = $this->f->db->autoExecute( |
590 |
|
DB_PREFIXE.$this->table, |
591 |
|
$valF, |
592 |
|
DB_AUTOQUERY_UPDATE, |
593 |
|
$this->clePrimaire."=".$this->getVal($this->clePrimaire) |
594 |
|
); |
595 |
|
if ($this->f->isDatabaseError($res, true)) { |
596 |
|
// Appel de la methode de recuperation des erreurs |
597 |
|
$this->erreur_db($res->getDebugInfo(), $res->getMessage(), ''); |
598 |
|
$this->correct = false; |
599 |
|
// Termine le traitement |
600 |
|
return $this->end_treatment(__METHOD__, false); |
601 |
|
} else { |
602 |
|
$this->addToMessage(_("Rédaction libre activé.")); |
603 |
|
return $this->end_treatment(__METHOD__, true); |
604 |
|
} |
605 |
|
|
606 |
|
// Termine le traitement |
607 |
|
return $this->end_treatment(__METHOD__, false); |
608 |
|
} |
609 |
|
|
610 |
/** |
/** |
611 |
* Cette méthode permet de récupérer le dossier d'autorisation d'un dossier |
* Cette méthode permet de récupérer le dossier d'autorisation d'un dossier |
619 |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
$sql = "select dossier_autorisation from ".DB_PREFIXE."dossier "; |
620 |
$sql .= " where dossier='".$id."'"; |
$sql .= " where dossier='".$id."'"; |
621 |
// |
// |
622 |
$dossier_autorisation = $this->db->getOne($sql); |
$dossier_autorisation = $this->f->db->getOne($sql); |
623 |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->addToLog("getNumDemandeAutorFromDossier(): db->getone(\"".$sql."\")", VERBOSE_MODE); |
624 |
database::isError($dossier_autorisation); |
database::isError($dossier_autorisation); |
625 |
// |
// |
629 |
// }}} |
// }}} |
630 |
|
|
631 |
function setType(&$form, $maj) { |
function setType(&$form, $maj) { |
632 |
// |
// Récupération du mode de l'action |
633 |
parent::setType($form, $maj); |
$crud = $this->get_action_crud($maj); |
634 |
// On cache tous les champs |
// Récupère la collectivité du dossier d'instruction |
635 |
// XXX |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
636 |
$form->setType('complement5_om_html', 'hidden'); |
|
637 |
$form->setType('bible5', 'hidden'); |
// Cache tous les champs |
638 |
$form->setType('complement6_om_html', 'hidden'); |
foreach ($this->champs as $value) { |
639 |
$form->setType('bible6', 'hidden'); |
$form->setType($value, 'hidden'); |
640 |
$form->setType('complement7_om_html', 'hidden'); |
} |
641 |
$form->setType('bible7', 'hidden'); |
|
642 |
$form->setType('complement8_om_html', 'hidden'); |
// MODE AJOUTER |
643 |
$form->setType('bible8', 'hidden'); |
if ($this->getParameter('maj') == 0) { |
644 |
$form->setType('complement9_om_html', 'hidden'); |
$form->setType("date_evenement", "date"); |
645 |
$form->setType('bible9', 'hidden'); |
if ($this->is_in_context_of_foreign_key("evenement", $this->getParameter("retourformulaire"))) { |
646 |
$form->setType('complement10_om_html', 'hidden'); |
$form->setType("evenement", "selecthiddenstatic"); |
647 |
$form->setType('bible10', 'hidden'); |
} else { |
648 |
$form->setType('complement11_om_html', 'hidden'); |
$form->setType("evenement", "select"); |
649 |
$form->setType('bible11', 'hidden'); |
} |
650 |
$form->setType('complement12_om_html', 'hidden'); |
if ($this->is_in_context_of_foreign_key("signataire_arrete", $this->getParameter("retourformulaire"))) { |
651 |
$form->setType('bible12', 'hidden'); |
$form->setType("signataire_arrete", "selecthiddenstatic"); |
652 |
$form->setType('complement13_om_html', 'hidden'); |
} else { |
653 |
$form->setType('bible13', 'hidden'); |
$form->setType("signataire_arrete", "select"); |
654 |
$form->setType('complement14_om_html', 'hidden'); |
} |
655 |
$form->setType('bible14', 'hidden'); |
if ($this->is_option_redaction_libre_enabled() === true) { |
656 |
$form->setType('complement15_om_html', 'hidden'); |
$form->setType("flag_edition_integrale", "select"); |
657 |
$form->setType('bible15', 'hidden'); |
} |
658 |
// |
} |
659 |
$form->setType('delai', 'hidden'); |
|
660 |
$form->setType('etat', 'hidden'); |
// MODE MODIFIER |
661 |
$form->setType('accord_tacite', 'hidden'); |
if ($this->getParameter('maj') == 1) { |
662 |
$form->setType('action', 'hidden'); |
$form->setType("date_evenement", "date"); |
663 |
$form->setType('delai_notification', 'hidden'); |
$form->setType("evenement", "selecthiddenstatic"); |
664 |
$form->setType('avis_decision', 'hidden'); |
if ($this->has_an_edition() === true) { |
665 |
$form->setType('autorite_competente', 'hidden'); |
$form->setType('lettretype', 'hiddenstatic'); |
666 |
// |
if ($this->is_in_context_of_foreign_key("signataire_arrete", $this->getParameter("retourformulaire"))) { |
667 |
$form->setType('archive_delai', 'hidden'); |
$form->setType("signataire_arrete", "selecthiddenstatic"); |
668 |
$form->setType('archive_etat', 'hidden'); |
} else { |
669 |
$form->setType('archive_accord_tacite', 'hidden'); |
$form->setType("signataire_arrete", "select"); |
670 |
$form->setType('archive_avis', 'hidden'); |
} |
671 |
$form->setType('archive_date_complet', 'hiddendate'); |
if ($this->getVal("flag_edition_integrale") == "t") { |
672 |
$form->setType('archive_date_dernier_depot', 'hiddendate'); |
$form->setType("titre_om_htmletat", "htmlEtat"); |
673 |
$form->setType('archive_date_rejet', 'hiddendate'); |
$form->setType("corps_om_htmletatex", "htmlEtatEx"); |
674 |
$form->setType('archive_date_limite', 'hiddendate'); |
} else { |
675 |
$form->setType('archive_date_notification_delai', 'hiddendate'); |
$form->setType("complement_om_html", "html"); |
676 |
$form->setType('archive_date_decision', 'hiddendate'); |
$form->setType("complement2_om_html", "html"); |
677 |
$form->setType('archive_date_validite', 'hiddendate'); |
$form->setType("complement3_om_html", "html"); |
678 |
$form->setType('archive_date_achevement', 'hiddendate'); |
$form->setType("complement4_om_html", "html"); |
679 |
$form->setType('archive_date_conformite', 'hiddendate'); |
$form->setType('bible_auto', 'httpclick'); |
680 |
$form->setType('archive_date_chantier', 'hiddendate'); |
$form->setType('bible', 'httpclick'); |
681 |
$form->setType('archive_autorite_competente','hidden'); |
$form->setType('bible2', 'httpclick'); |
682 |
$form->setType('date_depot','hidden'); |
$form->setType('bible3', 'httpclick'); |
683 |
// |
$form->setType('bible4', 'httpclick'); |
684 |
$form->setType('numero_arrete', 'hidden'); |
} |
685 |
// |
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true) { |
686 |
$form->setType('code_barres', 'hidden'); |
// |
687 |
|
$form->setType('btn_refresh', 'httpclickbutton'); |
688 |
// |
$form->setType('btn_preview', 'httpclickbutton'); |
689 |
$form->setType('archive_incompletude','hidden'); |
$form->setType('btn_redaction', 'httpclickbutton'); |
690 |
$form->setType('archive_incomplet_notifie','hidden'); |
$form->setType('live_preview', 'pdf'); |
691 |
$form->setType('archive_evenement_suivant_tacite','hidden'); |
} |
692 |
$form->setType('archive_evenement_suivant_tacite_incompletude','hidden'); |
|
|
$form->setType('archive_etat_pendant_incompletude','hidden'); |
|
|
$form->setType('archive_date_limite_incompletude','hiddendate'); |
|
|
$form->setType('archive_delai_incompletude','hidden'); |
|
|
|
|
|
// |
|
|
$form->setType('archive_date_cloture_instruction','hidden'); |
|
|
$form->setType('archive_date_premiere_visite','hidden'); |
|
|
$form->setType('archive_date_derniere_visite','hidden'); |
|
|
$form->setType('archive_date_contradictoire','hidden'); |
|
|
$form->setType('archive_date_retour_contradictoire','hidden'); |
|
|
$form->setType('archive_date_ait','hiddendate'); |
|
|
$form->setType('archive_date_transmission_parquet','hidden'); |
|
|
|
|
|
// |
|
|
$form->setType('duree_validite','hidden'); |
|
|
$form->setType('duree_validite_parametrage','hidden'); |
|
|
|
|
|
// |
|
|
$form->setType('created_by_commune','hidden'); |
|
|
// |
|
|
// gestion du champ "finalisé par" |
|
|
if ($this->getVal("om_final_instruction") == 't') { |
|
|
$form->setType('om_final_instruction_utilisateur', 'static'); |
|
|
} else { |
|
|
$form->setType('om_final_instruction_utilisateur', 'hidden'); |
|
|
} |
|
|
// |
|
|
if ($maj < 2 || $maj == 125) { //ajouter, modifier et suivi des dates |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('lettretype', 'hiddenstatic'); |
|
|
$form->setType('complement_om_html', 'html'); |
|
|
$form->setType('complement2_om_html', 'html'); |
|
|
$form->setType('complement3_om_html', 'html'); |
|
|
$form->setType('complement4_om_html', 'html'); |
|
|
$form->setType('bible_auto', 'httpclick'); |
|
|
$form->setType('bible', 'httpclick'); |
|
|
$form->setType('bible2', 'httpclick'); |
|
|
$form->setType('bible3', 'httpclick'); |
|
|
$form->setType('bible4', 'httpclick'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('libelle', 'hiddenstatic'); |
|
|
$form->setType('signataire_arrete','select'); |
|
|
$form->setType('date_envoi_signature','datedisabled'); |
|
|
$form->setType('date_retour_signature','datedisabled'); |
|
|
$form->setType('date_envoi_rar','datedisabled'); |
|
|
$form->setType('date_retour_rar','datedisabled'); |
|
|
$form->setType('date_envoi_controle_legalite','datedisabled'); |
|
|
$form->setType('date_retour_controle_legalite','datedisabled'); |
|
|
$form->setType('date_finalisation_courrier','datedisabled'); |
|
|
|
|
|
if($maj==0){ // ajouter |
|
|
$form->setType('instruction', 'hidden'); |
|
|
$form->setType('lettretype', 'hidden'); |
|
|
$form->setType('evenement', 'select'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
|
}else{ // modifier et suivi des dates |
|
|
$form->setType('instruction', 'hiddenstatic'); |
|
|
$form->setType('evenement', 'selecthiddenstatic'); |
|
|
//$form->setType('date_evenement', 'hiddenstaticdate'); |
|
|
$form->setType('date_evenement', 'date2'); |
|
693 |
// necessaire pour calcul de date en modification |
// necessaire pour calcul de date en modification |
694 |
//$form->setType('delai', 'hiddenstatic'); |
//$form->setType('delai', 'hiddenstatic'); |
695 |
// les administrateurs technique et fonctionnel peuvent |
// les administrateurs technique et fonctionnel peuvent |
696 |
// modifier tous les champs de date |
// modifier tous les champs de date |
697 |
// si l'instruction a déjà été finalisée au moins une fois |
// si l'instruction a déjà été finalisée au moins une fois |
698 |
if (($this->f->isAccredited(array(get_class($this), get_class($this)."modification_dates"), "OR") |
if (($this->f->isAccredited(array($this->get_absolute_class_name(), $this->get_absolute_class_name()."modification_dates"), "OR") |
699 |
|| $this->f->isAccredited(array('instruction', 'instruction_modification_dates'), "OR")) |
|| $this->f->isAccredited(array('instruction', 'instruction_modification_dates'), "OR")) |
700 |
&& $this->getVal("date_finalisation_courrier") != '') { |
&& $this->getVal("date_finalisation_courrier") != '') { |
701 |
|
// |
702 |
$form->setType('date_envoi_signature', 'date'); |
$form->setType('date_envoi_signature', 'date'); |
703 |
$form->setType('date_retour_signature', 'date'); |
$form->setType('date_retour_signature', 'date'); |
704 |
$form->setType('date_envoi_rar', 'date'); |
$form->setType('date_envoi_rar', 'date'); |
706 |
$form->setType('date_envoi_controle_legalite', 'date'); |
$form->setType('date_envoi_controle_legalite', 'date'); |
707 |
$form->setType('date_retour_controle_legalite', 'date'); |
$form->setType('date_retour_controle_legalite', 'date'); |
708 |
$form->setType('date_finalisation_courrier', 'date'); |
$form->setType('date_finalisation_courrier', 'date'); |
|
// suivi des dates |
|
|
if ($maj == 125) { |
|
|
$form->setType('date_evenement', 'hiddenstaticdate'); |
|
|
$form->setType('complement_om_html', 'hiddenstatic'); |
|
|
$form->setType('complement2_om_html', 'hiddenstatic'); |
|
|
$form->setType('complement3_om_html', 'hiddenstatic'); |
|
|
$form->setType('complement4_om_html', 'hiddenstatic'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
$form->setType('bible3', 'hidden'); |
|
|
$form->setType('bible4', 'hidden'); |
|
|
$form->setType('signataire_arrete','selecthiddenstatic'); |
|
|
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
|
|
} |
|
709 |
} |
} |
710 |
} |
} |
|
} elseif($maj==2){ |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
$form->setType('bible3', 'hidden'); |
|
|
$form->setType('bible4', 'hidden'); |
|
|
}else { |
|
|
$form->setType('destinataire', 'hidden'); |
|
|
$form->setType('dossier', 'hidden'); |
|
|
$form->setType('bible_auto', 'hidden'); |
|
|
$form->setType('bible', 'hidden'); |
|
|
$form->setType('bible2', 'hidden'); |
|
|
$form->setType('bible3', 'hidden'); |
|
|
$form->setType('bible4', 'hidden'); |
|
|
} |
|
|
|
|
|
//Cache les champs pour la finalisation |
|
|
$form->setType('om_fichier_instruction', 'hidden'); |
|
|
$form->setType('om_final_instruction', 'hidden'); |
|
|
// Cache le document arrêté |
|
|
$form->setType('document_numerise', 'hidden'); |
|
|
|
|
|
//Masquer les champs date_envoi_controle_legalite et |
|
|
//date_retour_controle_legalite si ce n'est pas un arrêté et si ce n'est |
|
|
//pas un utilisateur ayant le droit spécifique |
|
|
if ( !is_numeric($this->getVal("avis_decision"))&& |
|
|
!$this->f->isAccredited(array("instruction", "instruction_modification_dates"), "OR")){ |
|
|
|
|
|
$form->setType("date_envoi_controle_legalite", "hiddendate"); |
|
|
$form->setType("date_retour_controle_legalite", "hiddendate"); |
|
711 |
} |
} |
712 |
|
|
713 |
// Pour les actions finalize, unfinalize et notifier_commune |
// MODE CONSULTER + SUPPRIMER + SUIVI DES DATES 125 |
714 |
if($maj == 100 || $maj == 110 || $maj == 210) { |
if ($this->getParameter('maj') == 3 |
715 |
// |
|| $this->getParameter('maj') == 2 |
716 |
foreach ($this->champs as $value) { |
|| $this->getParameter('maj') == 125) { |
717 |
// Cache tous les champs |
// |
718 |
$form->setType($value, 'hidden'); |
$form->setType("date_evenement", "datestatic"); |
719 |
|
$form->setType("evenement", "selecthiddenstatic"); |
720 |
|
if ($this->has_an_edition() === true) { |
721 |
|
$form->setType('lettretype', 'hiddenstatic'); |
722 |
|
$form->setType("signataire_arrete", "selecthiddenstatic"); |
723 |
|
if ($this->getVal("om_final_instruction") == 't') { |
724 |
|
$form->setType('om_final_instruction_utilisateur', 'textareastatic'); |
725 |
|
} else { |
726 |
|
$form->setType('om_final_instruction_utilisateur', 'hidden'); |
727 |
|
} |
728 |
|
} |
729 |
|
} |
730 |
|
|
731 |
|
// MODE CONSULTER + SUPPRIMER |
732 |
|
if ($this->getParameter('maj') == 3 || $this->getParameter('maj') == 2) { |
733 |
|
if ($this->has_an_edition() === true) { |
734 |
|
if ($this->getVal("flag_edition_integrale") == "t") { |
735 |
|
$form->setType("titre_om_htmletat", "htmlstatic"); |
736 |
|
$form->setType("corps_om_htmletatex", "htmlstatic"); |
737 |
|
} else { |
738 |
|
$form->setType("complement_om_html", "htmlstatic"); |
739 |
|
$form->setType("complement2_om_html", "htmlstatic"); |
740 |
|
$form->setType("complement3_om_html", "htmlstatic"); |
741 |
|
$form->setType("complement4_om_html", "htmlstatic"); |
742 |
|
} |
743 |
} |
} |
744 |
|
$form->setType('date_envoi_signature', 'datestatic'); |
745 |
|
$form->setType('date_retour_signature', 'datestatic'); |
746 |
|
$form->setType('date_envoi_rar', 'datestatic'); |
747 |
|
$form->setType('date_retour_rar', 'datestatic'); |
748 |
|
$form->setType('date_envoi_controle_legalite', 'datestatic'); |
749 |
|
$form->setType('date_retour_controle_legalite', 'datestatic'); |
750 |
|
$form->setType('date_finalisation_courrier', 'datestatic'); |
751 |
|
} |
752 |
|
|
753 |
|
// MODE SUIVI DES DATES 125 |
754 |
|
if ($this->getParameter('maj') == 125) { |
755 |
|
$form->setType("date_evenement", "hiddenstaticdate"); |
756 |
|
$form->setType('om_final_instruction_utilisateur', 'hiddenstatic'); |
757 |
|
$form->setType('date_envoi_signature', 'date'); |
758 |
|
$form->setType('date_retour_signature', 'date'); |
759 |
|
$form->setType('date_envoi_rar', 'date'); |
760 |
|
$form->setType('date_retour_rar', 'date'); |
761 |
|
$form->setType('date_envoi_controle_legalite', 'date'); |
762 |
|
$form->setType('date_retour_controle_legalite', 'date'); |
763 |
|
$form->setType('date_finalisation_courrier', 'date'); |
764 |
|
} |
765 |
|
} |
766 |
|
|
767 |
|
function setOnchange(&$form,$maj){ |
768 |
|
parent::setOnchange($form,$maj); |
769 |
|
|
770 |
|
// MODE AJOUTER |
771 |
|
if ($this->getParameter('maj') == 0) { |
772 |
|
$form->setOnchange("evenement", "manage_instruction_evenement_lettretype(this.value, '".addslashes($this->getParameter('idxformulaire'))."');"); |
773 |
} |
} |
774 |
} |
} |
775 |
|
|
776 |
function setSelect(&$form, $maj,&$db,$debug) { |
function evenement_has_an_edition($evenement_id) { |
777 |
|
$evenement = $this->get_inst_evenement($evenement_id); |
778 |
|
$lettretype = $evenement->getVal('lettretype'); |
779 |
|
if ($lettretype !== '' && $lettretype !== null) { |
780 |
|
return true; |
781 |
|
} |
782 |
|
return false; |
783 |
|
} |
784 |
|
|
785 |
|
function view_evenement_has_an_edition_json() { |
786 |
|
$json_return = array( |
787 |
|
"lettretype" => $this->evenement_has_an_edition($this->f->get_submitted_get_value('evenement_id')), |
788 |
|
"option_redaction_libre_enabled" => $this->is_option_redaction_libre_enabled(), |
789 |
|
); |
790 |
|
echo json_encode($json_return); |
791 |
|
} |
792 |
|
|
793 |
|
/** |
794 |
|
* |
795 |
|
* @return string |
796 |
|
*/ |
797 |
|
function get_var_sql_forminc__sql_signataire_arrete() { |
798 |
|
return "SELECT |
799 |
|
signataire_arrete.signataire_arrete, |
800 |
|
CONCAT(signataire_arrete.prenom, ' ', signataire_arrete.nom) |
801 |
|
FROM ".DB_PREFIXE."signataire_arrete |
802 |
|
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
803 |
|
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
804 |
|
} |
805 |
|
|
806 |
|
/** |
807 |
|
* |
808 |
|
* @return string |
809 |
|
*/ |
810 |
|
function get_var_sql_forminc__sql_signataire_arrete_by_id() { |
811 |
|
return "SELECT |
812 |
|
signataire_arrete.signataire_arrete, |
813 |
|
CONCAT(signataire_arrete.prenom, ' ', signataire_arrete.nom) |
814 |
|
FROM ".DB_PREFIXE."signataire_arrete |
815 |
|
WHERE signataire_arrete.signataire_arrete = <idx>"; |
816 |
|
} |
817 |
|
|
818 |
|
/** |
819 |
|
* |
820 |
|
* @return string |
821 |
|
*/ |
822 |
|
function get_var_sql_forminc__sql_signataire_arrete_by_di() { |
823 |
|
return "SELECT |
824 |
|
signataire_arrete.signataire_arrete, |
825 |
|
CONCAT(signataire_arrete.prenom, ' ', signataire_arrete.nom) |
826 |
|
FROM ".DB_PREFIXE."signataire_arrete |
827 |
|
LEFT JOIN ".DB_PREFIXE."om_collectivite ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
828 |
|
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) |
829 |
|
AND (om_collectivite.niveau = '2' OR signataire_arrete.om_collectivite = <collectivite_di>) |
830 |
|
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
831 |
|
} |
832 |
|
|
833 |
|
/** |
834 |
|
* |
835 |
|
* @return string |
836 |
|
*/ |
837 |
|
function get_var_sql_forminc__sql_signataire_arrete_defaut() { |
838 |
|
return "SELECT |
839 |
|
signataire_arrete.signataire_arrete, |
840 |
|
CONCAT(signataire_arrete.prenom, ' ', signataire_arrete.nom) |
841 |
|
FROM ".DB_PREFIXE."signataire_arrete |
842 |
|
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) AND signataire_arrete.defaut IS TRUE |
843 |
|
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
844 |
|
} |
845 |
|
|
846 |
|
/** |
847 |
|
* |
848 |
|
* @return string |
849 |
|
*/ |
850 |
|
function get_var_sql_forminc__sql_signataire_arrete_defaut_by_di() { |
851 |
|
return "SELECT |
852 |
|
signataire_arrete.signataire_arrete, |
853 |
|
CONCAT(signataire_arrete.prenom, ' ', signataire_arrete.nom) |
854 |
|
FROM ".DB_PREFIXE."signataire_arrete |
855 |
|
LEFT JOIN ".DB_PREFIXE."om_collectivite ON signataire_arrete.om_collectivite = om_collectivite.om_collectivite |
856 |
|
WHERE ((signataire_arrete.om_validite_debut IS NULL AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE)) OR (signataire_arrete.om_validite_debut <= CURRENT_DATE AND (signataire_arrete.om_validite_fin IS NULL OR signataire_arrete.om_validite_fin > CURRENT_DATE))) AND signataire_arrete.defaut IS TRUE |
857 |
|
AND (om_collectivite.niveau = '2' OR signataire_arrete.om_collectivite = <collectivite_di>) |
858 |
|
ORDER BY signataire_arrete.prenom, signataire_arrete.nom"; |
859 |
|
} |
860 |
|
|
861 |
|
/** |
862 |
|
* SETTER_FORM - setSelect. |
863 |
|
* |
864 |
|
* @return void |
865 |
|
*/ |
866 |
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
867 |
|
//parent::setSelect($form, $maj); |
868 |
/** |
/** |
869 |
* On ne surcharge pas la méthode parent car une requête sur la table |
* On ne surcharge pas la méthode parent car une requête sur la table |
870 |
* dossier est mauvaise pour les performances, car la requête qui |
* dossier est mauvaise pour les performances, car la requête qui |
872 |
* champs action, avis_decision et etat ne sont pas utilisés comme des |
* champs action, avis_decision et etat ne sont pas utilisés comme des |
873 |
* select |
* select |
874 |
*/ |
*/ |
|
if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"); |
|
|
elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"); |
|
|
|
|
875 |
//// action |
//// action |
876 |
//$this->init_select($form, $db, $maj, $debug, "action", |
//$this->init_select($form, $this->f->db, $maj, null, "action", |
877 |
// $sql_action, $sql_action_by_id, false); |
// $sql_action, $sql_action_by_id, false); |
878 |
|
|
879 |
//// avis_decision |
//// avis_decision |
880 |
//$this->init_select($form, $db, $maj, $debug, "avis_decision", |
//$this->init_select($form, $this->f->db, $maj, null, "avis_decision", |
881 |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
// $sql_avis_decision, $sql_avis_decision_by_id, false); |
882 |
|
|
883 |
//// dossier |
//// dossier |
884 |
//$this->init_select($form, $db, $maj, $debug, "dossier", |
//$this->init_select($form, $this->f->db, $maj, null, "dossier", |
885 |
// $sql_dossier, $sql_dossier_by_id, false); |
// $sql_dossier, $sql_dossier_by_id, false); |
886 |
|
|
887 |
//// etat |
//// etat |
888 |
//$this->init_select($form, $db, $maj, $debug, "etat", |
//$this->init_select($form, $this->f->db, $maj, null, "etat", |
889 |
// $sql_etat, $sql_etat_by_id, false); |
// $sql_etat, $sql_etat_by_id, false); |
890 |
|
|
891 |
//// evenement |
//// evenement |
892 |
//$this->init_select($form, $db, $maj, $debug, "evenement", |
//$this->init_select($form, $this->f->db, $maj, null, "evenement", |
893 |
// $sql_evenement, $sql_evenement_by_id, false); |
// $sql_evenement, $sql_evenement_by_id, false); |
894 |
|
|
895 |
// signataire_arrete |
// signataire_arrete |
905 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
906 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
907 |
// on recupère les signataires de la multicollectivité et de celle du DI |
// on recupère les signataires de la multicollectivité et de celle du DI |
908 |
require_once "../obj/dossier_instruction.class.php"; |
$di = $this->f->get_inst__om_dbform(array( |
909 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, $debug); |
"obj" => "dossier_instruction", |
910 |
$sql_signataire_arrete_by_di = str_replace('<collectivite_di>', $di->getVal("om_collectivite"), $sql_signataire_arrete_by_di); |
"idx" => $this->getParameter('idxformulaire'), |
911 |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
)); |
912 |
$sql_signataire_arrete_by_di, $sql_signataire_arrete_by_id, true); |
$sql_signataire_arrete_by_di = str_replace( |
913 |
|
'<collectivite_di>', |
914 |
|
$di->getVal("om_collectivite"), |
915 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_di") |
916 |
|
); |
917 |
|
$this->init_select( |
918 |
|
$form, |
919 |
|
$this->f->db, |
920 |
|
$maj, |
921 |
|
null, |
922 |
|
"signataire_arrete", |
923 |
|
$sql_signataire_arrete_by_di, |
924 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_id"), |
925 |
|
true |
926 |
|
); |
927 |
} else { |
} else { |
928 |
$this->init_select($form, $db, $maj, $debug, "signataire_arrete", |
$this->init_select( |
929 |
$sql_signataire_arrete, $sql_signataire_arrete_by_id, true); |
$form, |
930 |
|
$this->f->db, |
931 |
|
$maj, |
932 |
|
null, |
933 |
|
"signataire_arrete", |
934 |
|
$this->get_var_sql_forminc__sql("signataire_arrete"), |
935 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_by_id"), |
936 |
|
true |
937 |
|
); |
938 |
} |
} |
939 |
|
|
940 |
/** |
/** |
959 |
INNER JOIN ".DB_PREFIXE."transition |
INNER JOIN ".DB_PREFIXE."transition |
960 |
ON evenement.evenement = transition.evenement |
ON evenement.evenement = transition.evenement |
961 |
AND dossier.etat=transition.etat |
AND dossier.etat=transition.etat |
962 |
WHERE dossier.dossier='".$this->idxformulaire."' "; |
WHERE dossier.dossier='".$this->getParameter("idxformulaire")."' "; |
963 |
|
|
964 |
// Si changement de décision par instructeur commune |
// Si changement de décision par instructeur commune |
965 |
if($this->f->isUserInstructeur() === true |
if($this->f->isUserInstructeur() === true |
966 |
&& $this->getDivisionFromDossier($this->idxformulaire) != $_SESSION["division"] |
&& $this->getDivisionFromDossier($this->getParameter("idxformulaire")) != $_SESSION["division"] |
967 |
&& $this->isInstrCanChangeDecision($this->idxformulaire) === true) { |
&& $this->isInstrCanChangeDecision($this->getParameter("idxformulaire")) === true) { |
968 |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
$sql .= "AND evenement.type IN ('arrete', 'changement_decision') "; |
969 |
} |
} |
970 |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
$sql .= "ORDER BY evenement.libelle, evenement.action"; |
971 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
972 |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->query(\"".$sql."\");", VERBOSE_MODE); |
973 |
if (database::isError($res)) { |
if (database::isError($res)) { |
974 |
die($res->getMessage()); |
die($res->getMessage()); |
983 |
$contenu[1][] = $row[1]; |
$contenu[1][] = $row[1]; |
984 |
} |
} |
985 |
$form->setSelect("evenement", $contenu); |
$form->setSelect("evenement", $contenu); |
986 |
|
|
987 |
} else { |
} else { |
988 |
$sql = "SELECT |
$sql = "SELECT |
989 |
evenement.libelle as lib |
evenement.libelle as lib |
990 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
991 |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
WHERE evenement.evenement=".$this->getVal("evenement").""; |
992 |
$res = $db->getone($sql); |
$res = $this->f->db->getone($sql); |
993 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
994 |
if (database::isError($res)) { |
if (database::isError($res)) { |
995 |
die($res->getMessage()); |
die($res->getMessage()); |
1020 |
// lien bible4 |
// lien bible4 |
1021 |
$contenu = array(_("bible")); |
$contenu = array(_("bible")); |
1022 |
$form->setSelect("bible4",$contenu); |
$form->setSelect("bible4",$contenu); |
1023 |
|
|
1024 |
|
if ($maj == 1) { |
1025 |
|
$base64 = $this->init_pdf_temp(); |
1026 |
|
$form->setSelect('live_preview', array('base64'=>$base64)); |
1027 |
|
$form->setSelect("btn_refresh", array(_('Prévisualiser'))); |
1028 |
|
$form->setSelect("btn_preview", array(_('Prévisualiser >>'))); |
1029 |
|
$form->setSelect("btn_redaction", array(_('<< Rédiger'))); |
1030 |
|
} |
1031 |
|
|
1032 |
|
// Selection du type de rédaction à l'ajout |
1033 |
|
$content = array( |
1034 |
|
0 => array('f', 't', ), |
1035 |
|
1 => array(_('Rédaction par compléments'), _('Rédaction libre'), ), |
1036 |
|
); |
1037 |
|
$form->setSelect('flag_edition_integrale', $content); |
1038 |
} |
} |
1039 |
|
|
1040 |
function cleSecondaire($id, &$db, $val, $DEBUG) { |
function cleSecondaire($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
1041 |
// |
// |
1042 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
parent::cleSecondaire($id, $dnu1, $val); |
1043 |
|
|
1044 |
$id = $this->getVal($this->clePrimaire); |
$id = $this->getVal($this->clePrimaire); |
1045 |
|
|
1051 |
LEFT JOIN ".DB_PREFIXE."demande |
LEFT JOIN ".DB_PREFIXE."demande |
1052 |
ON demande.demande_type = demande_type.demande_type |
ON demande.demande_type = demande_type.demande_type |
1053 |
WHERE demande.instruction_recepisse = ".$id; |
WHERE demande.instruction_recepisse = ".$id; |
1054 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
1055 |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1056 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1057 |
die($res->getMessage()); |
die($res->getMessage()); |
1067 |
$sql = "SELECT demande |
$sql = "SELECT demande |
1068 |
FROM ".DB_PREFIXE."demande |
FROM ".DB_PREFIXE."demande |
1069 |
WHERE instruction_recepisse = ".$id; |
WHERE instruction_recepisse = ".$id; |
1070 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
1071 |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("cleSecondaire(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1072 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1073 |
die($res->getMessage()); |
die($res->getMessage()); |
1075 |
|
|
1076 |
//Si c'est un événement d'instruction lié à une demande |
//Si c'est un événement d'instruction lié à une demande |
1077 |
if ($res != null || $res != ""){ |
if ($res != null || $res != ""){ |
1078 |
|
$demande = $this->f->get_inst__om_dbform(array( |
1079 |
require_once "../obj/demande.class.php"; |
"obj" => "demande", |
1080 |
$demande = new demande($res, $this->db, DEBUG); |
"idx" => $res, |
1081 |
|
)); |
1082 |
|
|
1083 |
//On met à jour la demande en supprimant la liaison vers |
//On met à jour la demande en supprimant la liaison vers |
1084 |
//l'événement d'instruction |
//l'événement d'instruction |
1089 |
} |
} |
1090 |
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
$valF['date_demande']=$demande->dateDBToForm($valF['date_demande']); |
1091 |
$valF['instruction_recepisse']=NULL; |
$valF['instruction_recepisse']=NULL; |
1092 |
$ret = $demande->modifier($valF, $this->db, DEBUG); |
$ret = $demande->modifier($valF); |
1093 |
} |
} |
1094 |
|
|
1095 |
/** |
/** |
1102 |
// concerne le dossier en cours |
// concerne le dossier en cours |
1103 |
$sql = "SELECT max(instruction) |
$sql = "SELECT max(instruction) |
1104 |
FROM ".DB_PREFIXE."instruction |
FROM ".DB_PREFIXE."instruction |
1105 |
WHERE dossier ='".$this->idxformulaire."'"; |
WHERE dossier ='".$this->getParameter("idxformulaire")."'"; |
1106 |
$dernierevenement = $db->getOne($sql); |
$dernierevenement = $this->f->db->getOne($sql); |
1107 |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("setSelect(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
1108 |
if (database::isError($dernierevenement)) { |
if (database::isError($dernierevenement)) { |
1109 |
die($dernierevenement->getMessage()); |
die($dernierevenement->getMessage()); |
1153 |
return true; |
return true; |
1154 |
} |
} |
1155 |
|
|
1156 |
/*Met des valeurs par défaut dans certains des sous-formulaire*/ |
/** |
1157 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
* SETTER_FORM - setValsousformulaire (setVal). |
1158 |
|
* |
1159 |
|
* @return void |
1160 |
|
*/ |
1161 |
|
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
1162 |
|
// parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire); |
1163 |
|
// |
1164 |
|
$this->retourformulaire = $retourformulaire; |
1165 |
// |
// |
|
$this->retourformulaire=$retourformulaire; |
|
|
$this->idxformulaire=$idxformulaire; |
|
|
// Ajout |
|
1166 |
if ($maj == 0) { |
if ($maj == 0) { |
1167 |
$form->setVal("destinataire", $idxformulaire); |
$form->setVal("destinataire", $this->getParameter("idxformulaire")); |
1168 |
$form->setVal("dossier", $idxformulaire); |
$form->setVal("dossier", $this->getParameter("idxformulaire")); |
1169 |
} |
} |
1170 |
// |
// |
1171 |
$this->set_form_default_values($form, $maj, $validation); |
$this->set_form_default_values($form, $maj, $validation); |
1172 |
} |
} |
1173 |
|
|
1174 |
/** |
/** |
1175 |
* Permet de pré-remplir les valeurs des formulaires. |
* SETTER_FORM - set_form_default_values (setVal). |
1176 |
* |
* |
1177 |
* @param [object] $form formulaire |
* @return void |
|
* @param [integer] $maj mode |
|
|
* @param [integer] $validation validation |
|
1178 |
*/ |
*/ |
1179 |
function set_form_default_values(&$form, $maj, $validation) { |
function set_form_default_values(&$form, $maj, $validation) { |
1180 |
|
// |
|
// Ajout |
|
1181 |
if ($maj == 0) { |
if ($maj == 0) { |
|
if(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc.php"); |
|
|
elseif(file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc")) |
|
|
include ("../sql/".OM_DB_PHPTYPE."/".$this->table.".form.inc"); |
|
1182 |
// si contexte DI |
// si contexte DI |
1183 |
if ($this->getParameter("retourformulaire") == "dossier" |
if ($this->getParameter("retourformulaire") == "dossier" |
1184 |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
|| $this->getParameter("retourformulaire") == "dossier_instruction" |
1191 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_mes_recours" |
1192 |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
|| $this->getParameter("retourformulaire") == "dossier_contentieux_tous_recours") { |
1193 |
// on recupère les signataires de la multicollectivité et de celle du DI |
// on recupère les signataires de la multicollectivité et de celle du DI |
1194 |
require_once "../obj/dossier_instruction.class.php"; |
$di = $this->f->get_inst__om_dbform(array( |
1195 |
$di = new dossier_instruction($this->getParameter('idxformulaire'), $db, DEBUG); |
"obj" => "dossier_instruction", |
1196 |
$sql = str_replace('<collectivite_di>', $di->getVal("om_collectivite"), $sql_signataire_arrete_defaut_by_di); |
"idx" => $this->getParameter("idxformulaire"), |
1197 |
|
)); |
1198 |
|
$sql = str_replace( |
1199 |
|
"<collectivite_di>", |
1200 |
|
$di->getVal("om_collectivite"), |
1201 |
|
$this->get_var_sql_forminc__sql("signataire_arrete_defaut_by_di") |
1202 |
|
); |
1203 |
} else { |
} else { |
1204 |
$sql = $sql_signataire_arrete_defaut; |
$sql = $this->get_var_sql_forminc__sql("signataire_arrete_defaut"); |
1205 |
} |
} |
|
// Date du jour |
|
|
$form->setVal("date_evenement", date('Y-m-d')); |
|
|
|
|
|
// Exécution de la requête |
|
1206 |
$res = $this->f->db->query($sql); |
$res = $this->f->db->query($sql); |
1207 |
$this->f->addToLog("setVal(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__."(): db->query(\"".$sql."\")", VERBOSE_MODE); |
1208 |
if ( database::isError($res)){ |
$this->f->isDatabaseError($res); |
|
die(); |
|
|
} |
|
|
|
|
1209 |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$row = $res->fetchrow(DB_FETCHMODE_ASSOC); |
1210 |
|
if (isset($row["signataire_arrete"]) |
1211 |
if (isset($row['signataire_arrete']) && is_numeric($row['signataire_arrete'])){ |
&& is_numeric($row["signataire_arrete"])) { |
1212 |
$form->setVal("signataire_arrete",$row['signataire_arrete']); |
// |
1213 |
|
$form->setVal("signataire_arrete", $row["signataire_arrete"]); |
1214 |
} |
} |
1215 |
|
// Date du jour |
1216 |
|
$form->setVal("date_evenement", date("Y-m-d")); |
1217 |
} |
} |
1218 |
|
// |
|
// Ajout et modification |
|
1219 |
if ($maj == 0 || $maj == 1 || $maj == 125) { |
if ($maj == 0 || $maj == 1 || $maj == 125) { |
1220 |
$form->setVal("bible_auto","bible_auto()"); |
$form->setVal("bible_auto", "bible_auto()"); |
1221 |
$form->setVal("bible","bible(1)"); |
$form->setVal("bible", "bible(1)"); |
1222 |
$form->setVal("bible2","bible(2)"); |
$form->setVal("bible2", "bible(2)"); |
1223 |
$form->setVal("bible3","bible(3)"); |
$form->setVal("bible3", "bible(3)"); |
1224 |
$form->setVal("bible4","bible(4)"); |
$form->setVal("bible4", "bible(4)"); |
1225 |
|
} |
1226 |
|
// |
1227 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
1228 |
|
if ($maj == 1 |
1229 |
|
&& $this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
1230 |
|
&& $this->has_an_edition() === true) { |
1231 |
|
// |
1232 |
|
$form->setVal("live_preview", $this->getVal($this->clePrimaire)); |
1233 |
|
$form->setVal("btn_refresh", "reload_pdf_viewer()"); |
1234 |
|
$form->setVal("btn_preview", "show_instr_preview()"); |
1235 |
|
$form->setVal("btn_redaction", "show_instr_redaction()"); |
1236 |
} |
} |
1237 |
} |
} |
1238 |
|
|
|
|
|
1239 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
1240 |
if ( $maj < 2 OR $maj == 3 OR $maj == 125 ) { |
$form->setBloc('evenement','D',"","sousform-instruction-action-".$maj); |
|
/*Champ sur lequel s'ouvre le bloc 1 */ |
|
|
$form->setBloc('evenement','D',"","col_12"); |
|
1241 |
|
|
1242 |
$form->setFieldset('evenement','D',_('Evenement')); |
$form->setFieldset('evenement','D',_('Evenement')); |
1243 |
$form->setFieldset('om_final_instruction_utilisateur','F',''); |
$form->setFieldset('om_final_instruction_utilisateur','F',''); |
1244 |
|
|
1245 |
$form->setBloc('om_final_instruction_utilisateur','F'); |
$form->setBloc('om_final_instruction_utilisateur','F'); |
1246 |
|
|
1247 |
$form->setBloc('date_finalisation_courrier','D',"","col_12"); |
$form->setBloc('date_finalisation_courrier','D',"",""); |
1248 |
|
|
1249 |
$form->setFieldset('date_finalisation_courrier','D',_('Dates')); |
$form->setFieldset('date_finalisation_courrier','D',_('Dates')); |
1250 |
$form->setBloc('date_finalisation_courrier','D',"","col_6"); |
$form->setBloc('date_finalisation_courrier','D',"","col_6"); |
1251 |
$form->setBloc('date_envoi_controle_legalite','F'); |
$form->setBloc('date_envoi_controle_legalite','F'); |
1252 |
|
|
1253 |
$form->setBloc('signataire_arrete','D',"","col_6"); |
$form->setBloc('date_retour_signature','D',"","col_6"); |
1254 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
1255 |
$form->setFieldset('date_retour_controle_legalite','F',''); |
$form->setFieldset('date_retour_controle_legalite','F',''); |
1256 |
|
|
1257 |
$form->setBloc('date_retour_controle_legalite','F'); |
$form->setBloc('date_retour_controle_legalite','F'); |
1258 |
|
|
1259 |
$form->setBloc('complement_om_html','D',"","col_12"); |
if ($maj == 1) { |
1260 |
|
// Récupère la collectivité du dossier d'instruction |
1261 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
1262 |
|
|
1263 |
|
// |
1264 |
|
if ($this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
1265 |
|
&& $this->has_an_edition() === true) { |
1266 |
|
// |
1267 |
|
$form->setBloc('complement_om_html','D',"","container_instr_edition"); |
1268 |
|
$form->setBloc('complement_om_html','D',"","hidelabel box_instr_edition redaction_instr_edition"); |
1269 |
|
$form->setBloc('complement_om_html','D',"","box_instr_edition_main"); |
1270 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
1271 |
|
$form->setFieldset('bible','F',''); |
1272 |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
1273 |
|
$form->setFieldset('bible2','F',''); |
1274 |
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
1275 |
|
$form->setFieldset('bible3','F',''); |
1276 |
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
1277 |
|
$form->setFieldset('bible4','F',''); |
1278 |
|
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
1279 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
1280 |
|
$form->setBloc('corps_om_htmletatex','F'); |
1281 |
|
$form->setBloc('btn_preview','DF',"","box_instr_edition_btn"); |
1282 |
|
$form->setBloc('btn_preview','F'); |
1283 |
|
$form->setBloc('btn_redaction','D', '',"hidelabel box_instr_edition preview_instr_edition"); |
1284 |
|
$form->setBloc('btn_redaction','DF',"","box_instr_edition_btn"); |
1285 |
|
$form->setFieldset('btn_refresh','D',_('Prévisualisation'), "box_instr_edition_main"); |
1286 |
|
$form->setFieldset('live_preview','F'); |
1287 |
|
$form->setBloc('live_preview','F'); |
1288 |
|
$form->setBloc('live_preview','F'); |
1289 |
|
} else { |
1290 |
|
$form->setBloc('complement_om_html','D',"","hidelabel"); |
1291 |
|
$form->setFieldset('complement_om_html','D',_('Complement')); |
1292 |
|
$form->setFieldset('bible','F',''); |
1293 |
|
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
1294 |
|
$form->setFieldset('bible2','F',''); |
1295 |
|
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
1296 |
|
$form->setFieldset('bible3','F',''); |
1297 |
|
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
1298 |
|
$form->setFieldset('bible4','F',''); |
1299 |
|
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
1300 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
1301 |
|
$form->setBloc('corps_om_htmletatex','F'); |
1302 |
|
} |
1303 |
|
} else { |
1304 |
|
$form->setBloc('complement_om_html','D',"","hidelabel"); |
1305 |
$form->setFieldset('complement_om_html','D',_('Complement')); |
$form->setFieldset('complement_om_html','D',_('Complement')); |
1306 |
$form->setFieldset('bible','F',''); |
$form->setFieldset('bible','F',''); |
|
$form->setBloc('bible','F'); |
|
|
|
|
|
$form->setBloc('complement2_om_html','D',"","col_12"); |
|
1307 |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
$form->setFieldset('complement2_om_html','D',_('Complement 2')); |
1308 |
$form->setFieldset('bible2','F',''); |
$form->setFieldset('bible2','F',''); |
|
$form->setBloc('bible2','F'); |
|
|
|
|
|
$form->setBloc('complement3_om_html','D',"","col_12"); |
|
1309 |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
$form->setFieldset('complement3_om_html','D',_('Complement 3')); |
1310 |
$form->setFieldset('bible3','F',''); |
$form->setFieldset('bible3','F',''); |
|
$form->setBloc('bible3','F'); |
|
|
|
|
|
$form->setBloc('complement4_om_html','D',"","col_12"); |
|
1311 |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
$form->setFieldset('complement4_om_html','D',_('Complement 4')); |
1312 |
$form->setFieldset('bible4','F',''); |
$form->setFieldset('bible4','F',''); |
1313 |
$form->setBloc('bible4','F'); |
$form->setFieldset('titre_om_htmletat','DF',_('Titre'), 'startClosed'); |
1314 |
|
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
1315 |
|
$form->setBloc('corps_om_htmletatex','F'); |
1316 |
} |
} |
1317 |
} |
} |
1318 |
|
|
1325 |
$form->setLib('bible2', ""); |
$form->setLib('bible2', ""); |
1326 |
$form->setLib('bible3', ""); |
$form->setLib('bible3', ""); |
1327 |
$form->setLib('bible4', ""); |
$form->setLib('bible4', ""); |
1328 |
|
$form->setLib('btn_refresh', ""); |
1329 |
|
$form->setLib('btn_preview', ""); |
1330 |
|
$form->setLib('btn_redaction', ""); |
1331 |
|
$form->setLib('live_preview', ""); |
1332 |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
$form->setLib('om_final_instruction_utilisateur', _("finalise par")); |
1333 |
|
$form->setLib('date_envoi_rar', __("date_envoi_ar")); |
1334 |
|
$form->setLib('date_retour_rar', __("date_notification")); |
1335 |
|
|
1336 |
|
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
1337 |
|
// ajout et que l'option de rédaction libre est activée sur la |
1338 |
|
// collectivité du dossier |
1339 |
|
if ($maj === '0' && $this->is_option_redaction_libre_enabled() === true) { |
1340 |
|
// |
1341 |
|
$help_text_template = '%s <span class="info-16" title="%s"></span>'; |
1342 |
|
$help_text = _("Attention: le passage du mode 'Rédaction libre' à celui de 'Rédaction par compléments' fait perdre toute la rédaction manuelle effectuée."); |
1343 |
|
$form->setLib('flag_edition_integrale', sprintf($help_text_template, _("Type de rédaction"), $help_text)); |
1344 |
|
} |
1345 |
|
else { |
1346 |
|
$form->setLib('flag_edition_integrale', _("Type de rédaction")); |
1347 |
|
} |
1348 |
|
|
1349 |
|
// Ajout d'une infobulle d'aide lorsque le formulaire est en mode |
1350 |
|
// modification et que l'option de prévisualisation de l'édition est |
1351 |
|
// activée sur la collectivité du dossier |
1352 |
|
if ($maj === '1' |
1353 |
|
&& $this->f->is_option_preview_pdf_enabled($this->get_dossier_instruction_om_collectivite()) === true) { |
1354 |
|
// |
1355 |
|
$help_text_template = '%s <span class="info-16" title="%s"></span>'; |
1356 |
|
$help_text = _("Attention la modification de la valeur de ce champ n'est pas prise en compte dans la prévisualisation. Pour que cette valeur soit mise à jour, il suffit de valider le formulaire."); |
1357 |
|
$form->setLib('date_evenement', sprintf($help_text_template, _('date_evenement'), $help_text)); |
1358 |
|
$form->setLib('signataire_arrete', sprintf($help_text_template, _('signataire_arrete'), $help_text)); |
1359 |
|
} |
1360 |
} |
} |
1361 |
|
|
1362 |
function triggerajouter($id, &$db, $val, $DEBUG) { |
/** |
1363 |
|
* TRIGGER - triggerajouter. |
1364 |
|
* |
1365 |
|
* @return boolean |
1366 |
|
*/ |
1367 |
|
function triggerajouter($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
1368 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
1369 |
/** |
/** |
1370 |
* Le code suivant permet de récupérer des valeurs des tables evenement |
* Le code suivant permet de récupérer des valeurs des tables evenement |
1371 |
* et dossier pour les stocker dans l'instruction : |
* et dossier pour les stocker dans l'instruction : |
1402 |
// Récupération de tous les paramètres de l'événement sélectionné |
// Récupération de tous les paramètres de l'événement sélectionné |
1403 |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
1404 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
1405 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
1406 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1407 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1408 |
die($res->getMessage()); |
die($res->getMessage()); |
1409 |
} |
} |
1444 |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
1445 |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
1446 |
WHERE dossier='".$this->valF['dossier']."'"; |
WHERE dossier='".$this->valF['dossier']."'"; |
1447 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
1448 |
$this->addToLog("triggerajouter(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1449 |
if (database::isError($res)) { |
if (database::isError($res)) { |
1450 |
die($res->getMessage()); |
die($res->getMessage()); |
1451 |
} |
} |
1460 |
LEFT JOIN ".DB_PREFIXE."dossier |
LEFT JOIN ".DB_PREFIXE."dossier |
1461 |
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
ON dossier.dossier_autorisation = dossier_autorisation.dossier_autorisation |
1462 |
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
WHERE dossier.dossier='".$this->valF['dossier']."'"; |
1463 |
$duree_validite_parametrage = $db->getOne($sql); |
$duree_validite_parametrage = $this->f->db->getOne($sql); |
1464 |
$this->addToLog("triggerajouter(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
1465 |
database::isError($duree_validite_parametrage); |
database::isError($duree_validite_parametrage); |
1466 |
if ($duree_validite_parametrage != '') { |
if ($duree_validite_parametrage != '') { |
1467 |
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
$this->valF['duree_validite_parametrage']= $duree_validite_parametrage; |
1660 |
$sql = "SELECT retour |
$sql = "SELECT retour |
1661 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
1662 |
WHERE evenement = ".$evenement; |
WHERE evenement = ".$evenement; |
1663 |
$retour = $this->db->getOne($sql); |
$retour = $this->f->db->getOne($sql); |
1664 |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1665 |
if (database::isError($retour)) { |
if (database::isError($retour)) { |
1666 |
die($retour->getMessage()); |
die($retour->getMessage()); |
1691 |
WHERE |
WHERE |
1692 |
evenement =".$evenement; |
evenement =".$evenement; |
1693 |
|
|
1694 |
$restriction = $this->db->getOne($sql); |
$restriction = $this->f->db->getOne($sql); |
1695 |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("verifier(): db->query(\"".$sql."\");", VERBOSE_MODE); |
1696 |
if (database::isError($restriction)) { |
if (database::isError($restriction)) { |
1697 |
die($restriction->getMessage()); |
die($restriction->getMessage()); |
1777 |
"regle_date_retour_contradictoire", |
"regle_date_retour_contradictoire", |
1778 |
"regle_date_ait", |
"regle_date_ait", |
1779 |
"regle_date_transmission_parquet", |
"regle_date_transmission_parquet", |
1780 |
|
"regle_date_affichage", |
1781 |
); |
); |
1782 |
// Tableau des champs de type numérique |
// Tableau des champs de type numérique |
1783 |
$rule_type_numeric = array( |
$rule_type_numeric = array( |
1805 |
'regle_donnees_techniques4', |
'regle_donnees_techniques4', |
1806 |
'regle_donnees_techniques5', |
'regle_donnees_techniques5', |
1807 |
); |
); |
1808 |
|
// Tableau des champs simple |
1809 |
|
$rule_type_simple = array( |
1810 |
|
"regle_dossier_instruction_type", |
1811 |
|
); |
1812 |
|
|
1813 |
// Définit le type du champ |
// Définit le type du champ |
1814 |
if (in_array($rule_name, $rule_type_date) == true) { |
if (in_array($rule_name, $rule_type_date) == true) { |
1829 |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
1830 |
$type = 'text'; |
$type = 'text'; |
1831 |
} |
} |
1832 |
|
if (in_array($rule_name, $rule_type_simple) === true) { |
1833 |
|
$type = 'simple'; |
1834 |
|
} |
1835 |
|
|
1836 |
// Si c'est un type spécifique ou booléen alors il n'a qu'un opérande |
// Si c'est un type spécifique ou booléen alors il n'a qu'un opérande |
1837 |
// Récupère directement la valeur de l'opérande |
// Récupère directement la valeur de l'opérande |
1910 |
// Retourne la chaîne de caractère |
// Retourne la chaîne de caractère |
1911 |
return $res_text; |
return $res_text; |
1912 |
} |
} |
1913 |
|
if ($type === 'simple') { |
1914 |
|
// Retourne la valeur du champs rule |
1915 |
|
return $rule; |
1916 |
|
} |
1917 |
} |
} |
1918 |
|
|
1919 |
|
|
1956 |
$donnees_techniques = $this->getDonneesTechniques(); |
$donnees_techniques = $this->getDonneesTechniques(); |
1957 |
} |
} |
1958 |
// |
// |
1959 |
require_once "../obj/donnees_techniques.class.php"; |
$this->inst_donnees_techniques = $this->f->get_inst__om_dbform(array( |
1960 |
$this->inst_donnees_techniques = new donnees_techniques($donnees_techniques); |
"obj" => "donnees_techniques", |
1961 |
|
"idx" => $donnees_techniques, |
1962 |
|
)); |
1963 |
} |
} |
1964 |
// |
// |
1965 |
return $this->inst_donnees_techniques; |
return $this->inst_donnees_techniques; |
1977 |
$sql = "SELECT donnees_techniques |
$sql = "SELECT donnees_techniques |
1978 |
FROM ".DB_PREFIXE."donnees_techniques |
FROM ".DB_PREFIXE."donnees_techniques |
1979 |
WHERE dossier_instruction ='".$this->valF["dossier"]."'"; |
WHERE dossier_instruction ='".$this->valF["dossier"]."'"; |
1980 |
$donnees_techniques = $this->db->getOne($sql); |
$donnees_techniques = $this->f->db->getOne($sql); |
1981 |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatut() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
1982 |
if ( database::isError($donnees_techniques)){ |
if ( database::isError($donnees_techniques)){ |
1983 |
die(); |
die(); |
1986 |
return $donnees_techniques; |
return $donnees_techniques; |
1987 |
} |
} |
1988 |
|
|
|
|
|
1989 |
/** |
/** |
1990 |
* TRIGGER - triggerajouterapres. |
* TRIGGER - triggerajouterapres. |
1991 |
* |
* |
1996 |
* |
* |
1997 |
* @return boolean |
* @return boolean |
1998 |
*/ |
*/ |
1999 |
function triggerajouterapres($id, &$db, $val, $DEBUG) { |
function triggerajouterapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2000 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2001 |
|
|
2002 |
// On a besoin de l'instance du dossier lié à l'événement d'instruction |
// On a besoin de l'instance du dossier lié à l'événement d'instruction |
2003 |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
|
|
|
2004 |
// Instance de la classe evenement |
// Instance de la classe evenement |
2005 |
$inst_evenement = $this->get_inst_evenement($this->valF['evenement']); |
$inst_evenement = $this->get_inst_evenement($this->valF['evenement']); |
2006 |
|
// Instance de l'état courant du dossier d'instruction |
2007 |
|
$inst_current_etat = $this->f->get_inst__om_dbform(array( |
2008 |
|
"obj" => "etat", |
2009 |
|
"idx" => $inst_di->get_id_etat(), |
2010 |
|
)); |
2011 |
|
|
2012 |
/** |
/** |
2013 |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
* Mise à jour des valeurs du dossier en fonction des valeurs calculées |
2016 |
// état de complétude actuel du dossier |
// état de complétude actuel du dossier |
2017 |
$incompletude = ($inst_di->getVal('incompletude') == 't' ? true : false); |
$incompletude = ($inst_di->getVal('incompletude') == 't' ? true : false); |
2018 |
// Initialisation |
// Initialisation |
2019 |
$valF = ""; |
$valF = array(); |
2020 |
$valF_dt = ""; |
$valF_dt = array(); |
2021 |
// |
// |
2022 |
if($incompletude === FALSE) { |
if($incompletude === FALSE) { |
2023 |
// Si l'événement d'instruction est de type incompletude |
// Si l'événement d'instruction est de type incompletude |
2052 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
2053 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
2054 |
WHERE action='".$this->valF['action']."'"; |
WHERE action='".$this->valF['action']."'"; |
2055 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2056 |
$this->addToLog("triggerajouterapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2057 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2058 |
die($res->getMessage()); |
die($res->getMessage()); |
2059 |
} |
} |
2154 |
if ($row['regle_date_transmission_parquet'] !== '') { |
if ($row['regle_date_transmission_parquet'] !== '') { |
2155 |
$valF['date_transmission_parquet'] = $this->regle($row['regle_date_transmission_parquet'], 'regle_date_transmission_parquet'); |
$valF['date_transmission_parquet'] = $this->regle($row['regle_date_transmission_parquet'], 'regle_date_transmission_parquet'); |
2156 |
} |
} |
2157 |
|
if ($row['regle_dossier_instruction_type'] !== '') { |
2158 |
|
$valF['dossier_instruction_type'] = $this->regle($row['regle_dossier_instruction_type'], 'regle_dossier_instruction_type'); |
2159 |
|
} |
2160 |
|
// La date d'affichage est modifiée seulement si le champ n'est pas |
2161 |
|
// renseigné |
2162 |
|
if ($row['regle_date_affichage'] !== '' |
2163 |
|
&& ($inst_di->getVal('date_affichage') === '' |
2164 |
|
|| $inst_di->getVal('date_affichage') === null)) { |
2165 |
|
// |
2166 |
|
$valF['date_affichage'] = $this->regle($row['regle_date_affichage'], 'regle_date_affichage'); |
2167 |
|
} |
2168 |
} |
} |
2169 |
|
|
2170 |
// Si l'événement a un événement suivant tacite |
// Si l'événement a un événement suivant tacite |
2181 |
} |
} |
2182 |
} |
} |
2183 |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
2184 |
if ($valF_dt != "") { |
if (count($valF_dt) > 0) { |
2185 |
$dt_id = $this->getDonneesTechniques(); |
$dt_id = $this->getDonneesTechniques(); |
2186 |
// On met à jour le dossier |
// On met à jour le dossier |
2187 |
$cle = " donnees_techniques='".$dt_id."'"; |
$cle = " donnees_techniques='".$dt_id."'"; |
2188 |
$res1 = $db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $this->f->db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
2189 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
2190 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
2191 |
die($res->getMessage()); |
die($res->getMessage()); |
2192 |
} |
} |
2193 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2194 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2195 |
} |
} |
2196 |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
2197 |
if ($valF != "") { |
if (count($valF) > 0) { |
2198 |
// On met à jour le dossier |
// On met à jour le dossier |
2199 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$cle = " dossier='".$this->valF['dossier']."'"; |
2200 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $this->f->db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
2201 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
2202 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
2203 |
die($res->getMessage()); |
die($res->getMessage()); |
2204 |
} |
} |
2205 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2206 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2207 |
} |
} |
2208 |
|
|
2209 |
/** |
/** |
2239 |
$this->addToMessage(_("Notification (105) du référentiel ERP OK.")); |
$this->addToMessage(_("Notification (105) du référentiel ERP OK.")); |
2240 |
} |
} |
2241 |
|
|
2242 |
|
// Si le mode en rédaction intégrale est activé |
2243 |
|
if (isset($this->valF['flag_edition_integrale']) === true |
2244 |
|
&& $this->valF['flag_edition_integrale'] === true) { |
2245 |
|
$redactionIntegraleValF = array(); |
2246 |
|
|
2247 |
|
// Récupère la collectivite du dossier d'instruction |
2248 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
2249 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
2250 |
|
// Récupère le corps de la lettre type |
2251 |
|
$params = array( |
2252 |
|
"specific" => array( |
2253 |
|
"corps" => array( |
2254 |
|
"mode" => "get", |
2255 |
|
) |
2256 |
|
), |
2257 |
|
); |
2258 |
|
$result = $this->compute_pdf_output('lettretype', $this->valF['lettretype'], $collectivite, $id, $params); |
2259 |
|
$redactionIntegraleValF['corps_om_htmletatex'] = $result['pdf_output']; |
2260 |
|
// Récupère le titre de la lettre type |
2261 |
|
$params = array( |
2262 |
|
"specific" => array( |
2263 |
|
"titre" => array( |
2264 |
|
"mode" => "get", |
2265 |
|
) |
2266 |
|
), |
2267 |
|
); |
2268 |
|
$result = $this->compute_pdf_output('lettretype', $this->valF['lettretype'], $collectivite, $id, $params); |
2269 |
|
$redactionIntegraleValF['titre_om_htmletat'] = $result['pdf_output']; |
2270 |
|
|
2271 |
|
// mise à jour en base de données |
2272 |
|
$res = $this->f->db->autoExecute( |
2273 |
|
DB_PREFIXE.$this->table, |
2274 |
|
$redactionIntegraleValF, |
2275 |
|
DB_AUTOQUERY_UPDATE, |
2276 |
|
$this->clePrimaire."=".$id |
2277 |
|
); |
2278 |
|
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE.'.'.$this->table."\", ".print_r($redactionIntegraleValF, true).", DB_AUTOQUERY_UPDATE, \"".$this->clePrimaire."=".$id."\");", VERBOSE_MODE); |
2279 |
|
if ($this->f->isDatabaseError($res, true) === true) { |
2280 |
|
return false; |
2281 |
|
} |
2282 |
|
} |
2283 |
|
|
2284 |
|
/** |
2285 |
|
* Finalisation automatique de l'instruction si le paramétrage de l'événement l'autorise |
2286 |
|
*/ |
2287 |
|
// Si la finalisation automatique de l'événement est activée |
2288 |
|
// ET si l'instruction n'a pas déjà été finalisée |
2289 |
|
// ET s'il existe une lettre type associée |
2290 |
|
if ($inst_evenement->getVal('finaliser_automatiquement') === 't' |
2291 |
|
&& $inst_evenement->getVal('om_final_instruction') !== 't' |
2292 |
|
&& $inst_evenement->getVal('lettretype') !== '' |
2293 |
|
&& $inst_evenement->getVal('lettretype') !== null) { |
2294 |
|
|
2295 |
|
// On instancie l'instruction |
2296 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
2297 |
|
"obj" => "instruction", |
2298 |
|
"idx" => $this->valF[$this->clePrimaire], |
2299 |
|
)); |
2300 |
|
|
2301 |
|
// On finalise l'instruction dans le contexte de finalisation : action 100 |
2302 |
|
$inst_instruction->setParameter('maj', 100); |
2303 |
|
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
2304 |
|
|
2305 |
|
// Une erreur de finalisation renvoie 'false' : ajout dans les logs |
2306 |
|
// et dans le message d'erreur |
2307 |
|
if ($finalize === false) { |
2308 |
|
$this->f->addToLog(__METHOD__."() : ERROR - Impossible de finaliser l'instruction.", DEBUG_MODE); |
2309 |
|
$this->addToMessage(_("Erreur lors de la finalisation de l'instruction. Contactez votre administrateur.")); |
2310 |
|
return false; |
2311 |
|
} |
2312 |
|
} |
2313 |
|
|
2314 |
|
/** |
2315 |
|
* Finalisation automatique des instructions tacites ou retours. |
2316 |
|
*/ |
2317 |
|
// Si l'option de finalisation automatique des instructions tacites ou |
2318 |
|
// retours est activée et l'événement d'instruction a une lettre type |
2319 |
|
// associée |
2320 |
|
$collectivite_di = $this->get_dossier_instruction_om_collectivite($val['dossier']); |
2321 |
|
if ($this->f->is_option_finalisation_auto_enabled($collectivite_di) === true |
2322 |
|
&& $inst_evenement->getVal('lettretype') !== '' |
2323 |
|
&& $inst_evenement->getVal('lettretype') !== null) { |
2324 |
|
|
2325 |
|
// Rècupère l'identifiant de l'événement |
2326 |
|
$evenement_id = $inst_evenement->getVal($inst_evenement->clePrimaire); |
2327 |
|
|
2328 |
|
// Si l'événement d'instruction est identifié comme un événement |
2329 |
|
// retour |
2330 |
|
// OU l'événement d'instruction est l'événement suivant tacite du |
2331 |
|
// dossier d'instruction (incomplétude prise en compte) |
2332 |
|
// ET l'événement d'instruction n'a pas déjà été finalisé |
2333 |
|
if (($inst_evenement->getVal("retour") === 't' |
2334 |
|
|| ($inst_di->getVal('evenement_suivant_tacite_incompletude') === $evenement_id |
2335 |
|
|| $inst_di->getVal('evenement_suivant_tacite') === $evenement_id)) |
2336 |
|
&& ($inst_evenement->getVal('om_final_instruction') !== 't')) { |
2337 |
|
|
2338 |
|
// Finalise l'instruction |
2339 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
2340 |
|
"obj" => "instruction", |
2341 |
|
"idx" => $this->valF[$this->clePrimaire], |
2342 |
|
)); |
2343 |
|
$inst_instruction->setParameter('maj', 100); |
2344 |
|
$finalize = $inst_instruction->finalize($inst_instruction->valF); |
2345 |
|
if ($finalize === false) { |
2346 |
|
// |
2347 |
|
return false; |
2348 |
|
} |
2349 |
|
} |
2350 |
|
} |
2351 |
|
|
2352 |
|
/** |
2353 |
|
* Mise à jour de la version de clôture *version_clos* du dossier si et |
2354 |
|
* seulement si l'instruction met à jour l'état du dossier. |
2355 |
|
*/ |
2356 |
|
if (isset($valF['etat']) === true |
2357 |
|
&& $valF['etat'] !== null |
2358 |
|
&& $valF['etat'] !== '') { |
2359 |
|
// Instanciation de l'état appliqué sur le dossier par l'instruction |
2360 |
|
$inst_etat = $this->f->get_inst__om_dbform(array( |
2361 |
|
"obj" => "etat", |
2362 |
|
"idx" => $valF['etat'], |
2363 |
|
)); |
2364 |
|
// |
2365 |
|
$update_version_clos = null; |
2366 |
|
// En cas d'instruction qui clôture le dossier |
2367 |
|
if ($inst_etat->getVal('statut') === 'cloture') { |
2368 |
|
$update_version_clos = $inst_di->update_version_clos('up'); |
2369 |
|
} |
2370 |
|
// En cas d'instruction qui rouvre le dossier |
2371 |
|
if ($inst_current_etat->getVal('statut') === 'cloture' |
2372 |
|
&& $inst_etat->getVal('statut') !== 'cloture') { |
2373 |
|
// |
2374 |
|
$update_version_clos = $inst_di->update_version_clos('down'); |
2375 |
|
// |
2376 |
|
$params = array( |
2377 |
|
'di_reopened' => true, |
2378 |
|
); |
2379 |
|
} |
2380 |
|
// |
2381 |
|
if ($update_version_clos === false) { |
2382 |
|
$this->f->addToLog(sprintf( |
2383 |
|
"%s() : ERREUR - %s %s", |
2384 |
|
__METHOD__, |
2385 |
|
sprintf( |
2386 |
|
__("Impossible de mettre à jour la version de clôture du dossier d'instruction %s."), |
2387 |
|
$inst_di->getVal($inst_di->clePrimaire) |
2388 |
|
), |
2389 |
|
sprintf( |
2390 |
|
__("L'instruction tente d'appliquer l'état %s."), |
2391 |
|
$inst_etat->getVal($inst_etat->clePrimaire) |
2392 |
|
) |
2393 |
|
)); |
2394 |
|
$this->addToMessage(sprintf( |
2395 |
|
"%s %s", |
2396 |
|
__("Erreur lors de la mise à jour de la version de clôture du dossier d'instruction."), |
2397 |
|
__("Veuillez contacter votre administrateur.") |
2398 |
|
)); |
2399 |
|
return false; |
2400 |
|
} |
2401 |
|
} |
2402 |
|
|
2403 |
|
/** |
2404 |
|
* Mise à jour de la date de dernière modification du dossier |
2405 |
|
*/ |
2406 |
|
$inst_di->update_last_modification_date(); |
2407 |
|
|
2408 |
/** |
/** |
2409 |
* Mise à jour des données du DA. |
* Mise à jour des données du DA. |
2410 |
*/ |
*/ |
|
// |
|
2411 |
$inst_da = $inst_di->get_inst_dossier_autorisation(); |
$inst_da = $inst_di->get_inst_dossier_autorisation(); |
2412 |
// |
$params['di_id'] = $this->valF['dossier']; |
2413 |
if ($inst_da->majDossierAutorisation() === false) { |
if ($inst_da->majDossierAutorisation($params) === false) { |
2414 |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
2415 |
$this->correct = false; |
$this->correct = false; |
2416 |
return false; |
return false; |
2423 |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
2424 |
} |
} |
2425 |
|
|
2426 |
function triggermodifierapres($id,&$db,$val,$DEBUG) { |
/** |
2427 |
|
* TRIGGER - triggermodifierapres. |
2428 |
|
* |
2429 |
|
* @return boolean |
2430 |
|
*/ |
2431 |
|
function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2432 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2433 |
/** |
/** |
2434 |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
* L'objectif ici est d'effectuer les recalculs de date dans le dossier |
2435 |
* si la date de l'evenement est modifiee |
* si la date de l'evenement est modifiee |
2436 |
*/ |
*/ |
2437 |
// Initialisation |
// Initialisation |
2438 |
$valF = ""; |
$valF = array(); |
2439 |
$valF_dt = ""; |
$valF_dt = array(); |
2440 |
// Initialisation du type d'événement |
// Initialisation du type d'événement |
2441 |
$type_evmt = ""; |
$type_evmt = ""; |
2442 |
// Récupération de l'action correspondante à l'événement |
// Récupération de l'action correspondante à l'événement |
2443 |
$sql = "SELECT action |
$sql = "SELECT action |
2444 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
2445 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
2446 |
$action = $db->getOne($sql); |
$action = $this->f->db->getOne($sql); |
2447 |
$this->addToLog("triggermodifierapres(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getone(\"".$sql."\");", VERBOSE_MODE); |
2448 |
if (database::isError($action)) { |
if (database::isError($action)) { |
2449 |
die($action->getMessage()); |
die($action->getMessage()); |
2450 |
} |
} |
2452 |
// Récupération des paramètres de l'action |
// Récupération des paramètres de l'action |
2453 |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
$sql = "SELECT * FROM ".DB_PREFIXE."action |
2454 |
WHERE action='".$action."'"; |
WHERE action='".$action."'"; |
2455 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2456 |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2457 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2458 |
die($res->getMessage()); |
die($res->getMessage()); |
2459 |
} |
} |
2525 |
if ($row['regle_donnees_techniques5'] !== '') { |
if ($row['regle_donnees_techniques5'] !== '') { |
2526 |
$valF_dt[$row['cible_regle_donnees_techniques5']] = $this->regle($row['regle_donnees_techniques5'], 'regle_donnees_techniques5'); |
$valF_dt[$row['cible_regle_donnees_techniques5']] = $this->regle($row['regle_donnees_techniques5'], 'regle_donnees_techniques5'); |
2527 |
} |
} |
2528 |
|
if ($row['regle_dossier_instruction_type'] !== '') { |
2529 |
|
$valF['dossier_instruction_type'] = $this->regle($row['regle_dossier_instruction_type'], 'regle_dossier_instruction_type'); |
2530 |
|
} |
2531 |
} |
} |
2532 |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
// Si des valeurs de données techniques ont été calculées alors on met à jour l'enregistrement |
2533 |
if ($valF_dt != "") { |
if (count($valF_dt) > 0) { |
2534 |
$dt_id = $this->getDonneesTechniques(); |
$dt_id = $this->getDonneesTechniques(); |
2535 |
// On met à jour le dossier |
// On met à jour le dossier |
2536 |
$cle = " donnees_techniques='".$dt_id."'"; |
$cle = " donnees_techniques='".$dt_id."'"; |
2537 |
$res1 = $db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $this->f->db->autoExecute(DB_PREFIXE.'donnees_techniques', $valF_dt, DB_AUTOQUERY_UPDATE, $cle); |
2538 |
$this->addToLog("triggerajouterapres(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE."donnees_techniques\", ".print_r($valF_dt, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
2539 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
2540 |
die($res->getMessage()); |
die($res->getMessage()); |
2541 |
} |
} |
2542 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2543 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2544 |
} |
} |
2545 |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
// Si des valeurs ont été calculées alors on met à jour l'enregistrement |
2546 |
if ($valF != "") { |
if (count($valF) > 0) { |
2547 |
// On met à jour le dossier |
// On met à jour le dossier |
2548 |
$cle = " dossier='".$this->valF['dossier']."'"; |
$cle = " dossier='".$this->valF['dossier']."'"; |
2549 |
$res1 = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$res1 = $this->f->db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
2550 |
$this->addToLog("triggermodifierapres(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
2551 |
if (database::isError($res1)) { |
if (database::isError($res1)) { |
2552 |
die($res->getMessage()); |
die($res->getMessage()); |
2553 |
} |
} |
2554 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2555 |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_('enregistrement')." ".$this->valF['dossier']." "._('table')." dossier [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2556 |
} |
} |
2557 |
|
|
2558 |
$restriction = $this->get_restriction($val['evenement']); |
$restriction = $this->get_restriction($val['evenement']); |
2562 |
// Récupération de tous les paramètres de l'événement sélectionné |
// Récupération de tous les paramètres de l'événement sélectionné |
2563 |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
$sql = "SELECT * FROM ".DB_PREFIXE."evenement |
2564 |
WHERE evenement=".$this->valF['evenement']; |
WHERE evenement=".$this->valF['evenement']; |
2565 |
$res = $db->query($sql); |
$res = $this->f->db->query($sql); |
2566 |
$this->addToLog("triggermodifierapres(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->query(\"".$sql."\");", VERBOSE_MODE); |
2567 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2568 |
die($res->getMessage()); |
die($res->getMessage()); |
2569 |
} |
} |
2573 |
if ($this->getVal('date_retour_signature') == "" AND |
if ($this->getVal('date_retour_signature') == "" AND |
2574 |
$this->valF['date_retour_signature'] != "" AND |
$this->valF['date_retour_signature'] != "" AND |
2575 |
$row['evenement_retour_signature'] != "") { |
$row['evenement_retour_signature'] != "") { |
2576 |
$new_instruction = new instruction("]", $db, $DEBUG); |
$new_instruction = $this->f->get_inst__om_dbform(array( |
2577 |
|
"obj" => "instruction", |
2578 |
|
"idx" => "]", |
2579 |
|
)); |
2580 |
// Création d'un tableau avec la liste des champs de l'instruction |
// Création d'un tableau avec la liste des champs de l'instruction |
2581 |
foreach($new_instruction->champs as $champ) { |
foreach($new_instruction->champs as $champ) { |
2582 |
$valNewInstr[$champ] = ""; |
$valNewInstr[$champ] = ""; |
2595 |
$new_instruction->setParameter("maj", 0); |
$new_instruction->setParameter("maj", 0); |
2596 |
$new_instruction->class_actions[0]["identifier"] = |
$new_instruction->class_actions[0]["identifier"] = |
2597 |
"retour signature de l'instruction $current_id"; |
"retour signature de l'instruction $current_id"; |
2598 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr); |
2599 |
|
|
2600 |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
2601 |
//de restriction |
//de restriction |
2602 |
if ($retour == false && !$new_instruction->restriction_valid){ |
if ($retour == false && !$new_instruction->restriction_valid){ |
2603 |
$error_message = $this->get_restriction_error_message($restriction); |
$error_message = $this->get_restriction_error_message($restriction); |
2604 |
$this->f->displayMessage("error", $error_message); |
$this->f->displayMessage("error", $error_message); |
2605 |
$this->addToLog("triggermodifierapres() : evenement retour ". |
$this->addToLog(__METHOD__."(): evenement retour ". |
2606 |
"instruction ".$this->valF[$this->clePrimaire]." : ". |
"instruction ".$this->valF[$this->clePrimaire]." : ". |
2607 |
$new_instruction->msg); |
$new_instruction->msg); |
2608 |
} |
} |
2618 |
$this->valF['date_retour_rar'] != "") { |
$this->valF['date_retour_rar'] != "") { |
2619 |
|
|
2620 |
if($row['evenement_retour_ar'] != "") { |
if($row['evenement_retour_ar'] != "") { |
2621 |
$new_instruction = new instruction("]", $db, $DEBUG); |
$new_instruction = $this->f->get_inst__om_dbform(array( |
2622 |
|
"obj" => "instruction", |
2623 |
|
"idx" => "]", |
2624 |
|
)); |
2625 |
// Création d'un tableau avec la liste des champs de l'instruction |
// Création d'un tableau avec la liste des champs de l'instruction |
2626 |
foreach($new_instruction->champs as $champ) { |
foreach($new_instruction->champs as $champ) { |
2627 |
$valNewInstr[$champ] = ""; |
$valNewInstr[$champ] = ""; |
2639 |
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
$valNewInstr["date_retour_controle_legalite"] = $this->f->formatDate($this->valF['date_retour_controle_legalite']); |
2640 |
$new_instruction->setParameter("maj", 0); |
$new_instruction->setParameter("maj", 0); |
2641 |
$new_instruction->class_actions[0]["identifier"] = |
$new_instruction->class_actions[0]["identifier"] = |
2642 |
"retour RAR de l'instruction $current_id"; |
"notification de l'instruction $current_id"; |
2643 |
$retour = $new_instruction->ajouter($valNewInstr,$db, $DEBUG); |
$retour = $new_instruction->ajouter($valNewInstr); |
2644 |
|
|
2645 |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
//Si une erreur s'est produite et qu'il s'agit d'un problème |
2646 |
//de restriction |
//de restriction |
2648 |
$error_message = $this->get_restriction_error_message($restriction); |
$error_message = $this->get_restriction_error_message($restriction); |
2649 |
$this->f->displayMessage("error", $error_message); |
$this->f->displayMessage("error", $error_message); |
2650 |
$this->addToLog( |
$this->addToLog( |
2651 |
"triggermodifierapres() : evenement retour instruction ". |
__METHOD__."(): evenement retour instruction ". |
2652 |
$this->valF[$this->clePrimaire]." : ". |
$this->valF[$this->clePrimaire]." : ". |
2653 |
$new_instruction->msg |
$new_instruction->msg |
2654 |
); |
); |
2667 |
$this->valF['archive_date_notification_delai'] == "")) { |
$this->valF['archive_date_notification_delai'] == "")) { |
2668 |
$valFIncomp['incomplet_notifie'] = true; |
$valFIncomp['incomplet_notifie'] = true; |
2669 |
$cle = " dossier='".$val['dossier']."'"; |
$cle = " dossier='".$val['dossier']."'"; |
2670 |
$resIncomp = $db->autoExecute( |
$resIncomp = $this->f->db->autoExecute( |
2671 |
DB_PREFIXE.'dossier', |
DB_PREFIXE.'dossier', |
2672 |
$valFIncomp, |
$valFIncomp, |
2673 |
DB_AUTOQUERY_UPDATE, |
DB_AUTOQUERY_UPDATE, |
2674 |
$cle |
$cle |
2675 |
); |
); |
2676 |
$this->addToLog( |
$this->addToLog( |
2677 |
"triggersupprimer(): db->autoexecute(\"". |
__METHOD__."(): db->autoexecute(\"". |
2678 |
DB_PREFIXE."dossier\", ".print_r($valFIncomp, true). |
DB_PREFIXE."dossier\", ".print_r($valFIncomp, true). |
2679 |
", DB_AUTOQUERY_UPDATE, \"".$cle."\");", |
", DB_AUTOQUERY_UPDATE, \"".$cle."\");", |
2680 |
VERBOSE_MODE |
VERBOSE_MODE |
2687 |
} |
} |
2688 |
} |
} |
2689 |
|
|
2690 |
|
/** |
2691 |
|
* Mise à jour de la date de dernière modification du dossier |
2692 |
|
* d'instruction |
2693 |
|
*/ |
2694 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
2695 |
|
$inst_di->update_last_modification_date(); |
2696 |
|
|
2697 |
// Mise à jour des données du dossier d'autorisation |
// Mise à jour des données du dossier d'autorisation |
2698 |
require_once "../obj/dossier_autorisation.class.php"; |
$da = $this->f->get_inst__om_dbform(array( |
2699 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($this->valF['dossier']), $this->db, DEBUG); |
"obj" => "dossier_autorisation", |
2700 |
if($da->majDossierAutorisation() === false) { |
"idx" => $this->getNumDemandeAutorFromDossier($this->valF['dossier']), |
2701 |
|
)); |
2702 |
|
$params = array( |
2703 |
|
'di_id' => $this->getVal('dossier'), |
2704 |
|
); |
2705 |
|
if($da->majDossierAutorisation($params) === false) { |
2706 |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
2707 |
$this->correct = false; |
$this->correct = false; |
2708 |
return false; |
return false; |
2709 |
} |
} |
2710 |
|
|
2711 |
return $this->add_log_to_dossier($id, $val); |
return $this->add_log_to_dossier($id, $val); |
2712 |
} |
} |
2713 |
|
|
2714 |
function triggersupprimer($id,&$db,$val,$DEBUG) { |
/** |
2715 |
|
* TRIGGER - triggersupprimer. |
2716 |
|
* |
2717 |
|
* @return boolean |
2718 |
|
*/ |
2719 |
|
function triggersupprimer($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2720 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2721 |
/** |
/** |
2722 |
* L'objectif ici est de repositionner les valeurs récupérées en |
* L'objectif ici est de repositionner les valeurs récupérées en |
2723 |
* archive dans le dossier d'instruction avant de supprimer l'événement |
* archive dans le dossier d'instruction avant de supprimer l'événement |
2861 |
if ($val['archive_date_transmission_parquet'] !== '') { |
if ($val['archive_date_transmission_parquet'] !== '') { |
2862 |
$valF['date_transmission_parquet'] = $val['archive_date_transmission_parquet']; |
$valF['date_transmission_parquet'] = $val['archive_date_transmission_parquet']; |
2863 |
} |
} |
2864 |
|
// Type du dossier d'instruction |
2865 |
|
if ($val['archive_dossier_instruction_type'] !== '' && $val['archive_dossier_instruction_type'] !== null) { |
2866 |
|
$valF['dossier_instruction_type'] = $val['archive_dossier_instruction_type']; |
2867 |
|
} |
2868 |
|
// Spécificité de la date d'affichage, la valeur du champ du dossier |
2869 |
|
// n'est pas remplacée par celle de l'archive de l'instruction. |
2870 |
|
|
2871 |
|
// Récupère l'état actuel du dossier d'instruction |
2872 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
2873 |
|
$inst_current_etat = $this->f->get_inst__om_dbform(array( |
2874 |
|
"obj" => "etat", |
2875 |
|
"idx" => $inst_di->get_id_etat(), |
2876 |
|
)); |
2877 |
|
|
2878 |
// On met à jour le dossier |
// On met à jour le dossier |
2879 |
$cle = " dossier='".$val['dossier']."'"; |
$cle = " dossier='".$val['dossier']."'"; |
2880 |
$res = $db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
$res = $this->f->db->autoExecute(DB_PREFIXE.'dossier', $valF, DB_AUTOQUERY_UPDATE, $cle); |
2881 |
$this->addToLog("triggersupprimer(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->autoexecute(\"".DB_PREFIXE."dossier\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$cle."\");", VERBOSE_MODE); |
2882 |
if (database::isError($res)) { |
if (database::isError($res)) { |
2883 |
die($res->getMessage()); |
die($res->getMessage()); |
2884 |
} |
} |
2885 |
|
|
2886 |
|
/** |
2887 |
|
* Mise à jour de la version de clôture *version_clos* du dossier si et |
2888 |
|
* seulement si l'instruction met à jour l'état du dossier. |
2889 |
|
*/ |
2890 |
|
if ($valF['etat'] !== null |
2891 |
|
&& $valF['etat'] !== '') { |
2892 |
|
// Instanciation de l'état archivé appliqué sur le dossier |
2893 |
|
$inst_etat = $this->f->get_inst__om_dbform(array( |
2894 |
|
"obj" => "etat", |
2895 |
|
"idx" => $valF['etat'], |
2896 |
|
)); |
2897 |
|
// |
2898 |
|
$update_version_clos = null; |
2899 |
|
// En cas de clôture du dossier par l'état archivé |
2900 |
|
if ($inst_etat->getVal('statut') === 'cloture') { |
2901 |
|
$update_version_clos = $inst_di->update_version_clos('up'); |
2902 |
|
} |
2903 |
|
// En cas de réouverture du dossier par l'état archivé |
2904 |
|
if ($inst_current_etat->getVal('statut') === 'cloture' |
2905 |
|
&& $inst_etat->getVal('statut') !== 'cloture') { |
2906 |
|
// |
2907 |
|
$update_version_clos = $inst_di->update_version_clos('down'); |
2908 |
|
// |
2909 |
|
$this->set_att_di_reopened(true); |
2910 |
|
} |
2911 |
|
// |
2912 |
|
if ($update_version_clos === false) { |
2913 |
|
$this->f->addToLog(sprintf( |
2914 |
|
"%s() : ERREUR - %s %s", |
2915 |
|
__METHOD__, |
2916 |
|
sprintf( |
2917 |
|
__("Impossible de mettre à jour la version de clôture du dossier d'instruction %s."), |
2918 |
|
$inst_di->getVal($inst_di->clePrimaire) |
2919 |
|
), |
2920 |
|
sprintf( |
2921 |
|
__("L'instruction tente d'appliquer l'état %s."), |
2922 |
|
$inst_etat->getVal($inst_etat->clePrimaire) |
2923 |
|
) |
2924 |
|
)); |
2925 |
|
$this->addToMessage(sprintf( |
2926 |
|
"%s %s", |
2927 |
|
__("Erreur lors de la mise à jour de la version de clôture du dossier d'instruction."), |
2928 |
|
__("Veuillez contacter votre administrateur.") |
2929 |
|
)); |
2930 |
|
return false; |
2931 |
|
} |
2932 |
|
} |
2933 |
|
|
2934 |
// Affichage d'informations à l'utilisateur |
// Affichage d'informations à l'utilisateur |
2935 |
$this->addToMessage(_("Suppression de l'instruction")." [".$db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_("Suppression de l'instruction")." [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
2936 |
|
|
2937 |
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
2938 |
} |
} |
2939 |
|
|
2940 |
function triggersupprimerapres($id,&$db,$val,$DEBUG) { |
/** |
2941 |
|
* TRIGGER - triggersupprimerapres. |
2942 |
|
* |
2943 |
|
* @return boolean |
2944 |
|
*/ |
2945 |
|
function triggersupprimerapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2946 |
|
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2947 |
|
/** |
2948 |
|
* Mise à jour de la date de dernière modification du dossier |
2949 |
|
* d'instruction |
2950 |
|
*/ |
2951 |
|
$inst_di = $this->get_inst_dossier($this->getVal('dossier')); |
2952 |
|
$inst_di->update_last_modification_date(); |
2953 |
|
|
2954 |
// Mise à jour des données du dossier d'autorisation |
/** |
2955 |
require_once "../obj/dossier_autorisation.class.php"; |
* Mise à jour des données du dossier d'autorisation |
2956 |
$da = new dossier_autorisation($this->getNumDemandeAutorFromDossier($val["dossier"]), $this->db, DEBUG); |
*/ |
2957 |
if($da->majDossierAutorisation() === false) { |
$da = $this->f->get_inst__om_dbform(array( |
2958 |
|
"obj" => "dossier_autorisation", |
2959 |
|
"idx" => $this->getNumDemandeAutorFromDossier($val["dossier"]), |
2960 |
|
)); |
2961 |
|
$params = array( |
2962 |
|
'di_id' => $this->getVal('dossier'), |
2963 |
|
'di_reopened' => $this->get_att_di_reopened(), |
2964 |
|
); |
2965 |
|
if($da->majDossierAutorisation($params) === false) { |
2966 |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
$this->addToMessage(_("Erreur lors de la mise a jour des donnees du dossier d'autorisation. Contactez votre administrateur.")); |
2967 |
$this->correct = false; |
$this->correct = false; |
2968 |
return false; |
return false; |
2969 |
} |
} |
2970 |
|
|
2971 |
|
// |
2972 |
$val['evenement'] = $this->getVal('evenement'); |
$val['evenement'] = $this->getVal('evenement'); |
2973 |
return $this->add_log_to_dossier($id, $val); |
return $this->add_log_to_dossier($id, $val); |
2974 |
} |
} |
2975 |
|
|
2976 |
/** |
/** |
2977 |
|
* Permet de mettre la valeur passée en paramètre dans l'attribut de classe |
2978 |
|
* "di_reopened". |
2979 |
|
* |
2980 |
|
* @param boolean $val |
2981 |
|
*/ |
2982 |
|
function set_att_di_reopened($val) { |
2983 |
|
$this->di_reopened = $val; |
2984 |
|
} |
2985 |
|
|
2986 |
|
/** |
2987 |
|
* Permet de récupérer la valeur de l'attribut de classe "di_reopened". |
2988 |
|
* |
2989 |
|
* @return boolean |
2990 |
|
*/ |
2991 |
|
function get_att_di_reopened() { |
2992 |
|
return $this->di_reopened; |
2993 |
|
} |
2994 |
|
|
2995 |
|
/** |
2996 |
* Permet de composer un message d'erreur sur restriction non valide en |
* Permet de composer un message d'erreur sur restriction non valide en |
2997 |
* fonction du contexte. |
* fonction du contexte. |
2998 |
* |
* |
3031 |
} |
} |
3032 |
|
|
3033 |
/** |
/** |
3034 |
* Vérifie la restriction sur l'événement. |
* @return void |
|
* |
|
|
* @param array $val valeurs du formulaire |
|
|
* @param database $db handler database |
|
|
* @param boolean $DEBUG NA |
|
|
* |
|
|
* @return [type] [description] |
|
3035 |
*/ |
*/ |
3036 |
function verifier($val = array(), &$db, $DEBUG) { |
function verifier($val = array(), &$dnu1 = null, $dnu2 = null) { |
3037 |
parent::verifier($val, $db, $DEBUG); |
parent::verifier($val); |
3038 |
|
// |
3039 |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
if ( isset($val['evenement']) && is_numeric($val['evenement'])){ |
3040 |
$restriction = $this->get_restriction($val['evenement']); |
$restriction = $this->get_restriction($val['evenement']); |
3041 |
|
|
3144 |
|
|
3145 |
// |
// |
3146 |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
3147 |
|
|
3148 |
|
// |
3149 |
|
$params = array( |
3150 |
|
"specific" => array(), |
3151 |
|
); |
3152 |
|
// Si la rédaction libre est activée sur l'instruction |
3153 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
3154 |
|
$params["specific"]["corps"] = array( |
3155 |
|
"mode" => "set", |
3156 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
3157 |
|
); |
3158 |
|
$params["specific"]["titre"] = array( |
3159 |
|
"mode" => "set", |
3160 |
|
"value" => $this->getVal("titre_om_htmletat"), |
3161 |
|
); |
3162 |
|
} |
3163 |
// Génération du PDF |
// Génération du PDF |
3164 |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite); |
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
3165 |
$pdf_output = $result['pdf_output']; |
$pdf_output = $result['pdf_output']; |
3166 |
|
|
3167 |
//Métadonnées du document |
//Métadonnées du document |
3178 |
$sql = "SELECT type |
$sql = "SELECT type |
3179 |
FROM ".DB_PREFIXE."evenement |
FROM ".DB_PREFIXE."evenement |
3180 |
WHERE evenement = ".$this->getVal("evenement"); |
WHERE evenement = ".$this->getVal("evenement"); |
3181 |
$typeEvenement = $this->db->getOne($sql); |
$typeEvenement = $this->f->db->getOne($sql); |
3182 |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
3183 |
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
if ($this->f->isDatabaseError($typeEvenement, true) === true) { |
3184 |
$this->correct = false; |
$this->correct = false; |
3220 |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
if ($uid == '' || $uid == 'OP_FAILURE' ) { |
3221 |
$this->correct = false; |
$this->correct = false; |
3222 |
$this->addToMessage($file_msg_error); |
$this->addToMessage($file_msg_error); |
3223 |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid), DEBUG_MODE); |
3224 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
3225 |
} |
} |
3226 |
|
|
3257 |
$val['archive_date_retour_contradictoire'] = $this->dateDBToForm($val['archive_date_retour_contradictoire']); |
$val['archive_date_retour_contradictoire'] = $this->dateDBToForm($val['archive_date_retour_contradictoire']); |
3258 |
$val['archive_date_ait'] = $this->dateDBToForm($val['archive_date_ait']); |
$val['archive_date_ait'] = $this->dateDBToForm($val['archive_date_ait']); |
3259 |
$val['archive_date_transmission_parquet'] = $this->dateDBToForm($val['archive_date_transmission_parquet']); |
$val['archive_date_transmission_parquet'] = $this->dateDBToForm($val['archive_date_transmission_parquet']); |
3260 |
|
$val['archive_date_affichage'] = $this->dateDBToForm($val['archive_date_affichage']); |
3261 |
$this->setvalF($val); |
$this->setvalF($val); |
3262 |
|
|
3263 |
// Verification de la validite des donnees |
// Verification de la validite des donnees |
3264 |
$this->verifier($this->val, $this->db, DEBUG); |
$this->verifier($this->val); |
3265 |
// Si les verifications precedentes sont correctes, on procede a |
// Si les verifications precedentes sont correctes, on procede a |
3266 |
// la modification, sinon on ne fait rien et on retourne une erreur |
// la modification, sinon on ne fait rien et on retourne une erreur |
3267 |
if ($this->correct === true) { |
if ($this->correct === true) { |
3295 |
|
|
3296 |
// Execution de la requête de modification des donnees de l'attribut |
// Execution de la requête de modification des donnees de l'attribut |
3297 |
// valF de l'objet dans l'attribut table de l'objet |
// valF de l'objet dans l'attribut table de l'objet |
3298 |
$res = $this->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
$res = $this->f->db->autoExecute(DB_PREFIXE.$this->table, $valF, |
3299 |
DB_AUTOQUERY_UPDATE, $this->getCle($id_inst)); |
DB_AUTOQUERY_UPDATE, $this->getCle($id_inst)); |
3300 |
$this->addToLog(__METHOD__."() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id_inst)."\")", VERBOSE_MODE); |
$this->addToLog(__METHOD__."() : db->autoExecute(\"".DB_PREFIXE.$this->table."\", ".print_r($valF, true).", DB_AUTOQUERY_UPDATE, \"".$this->getCle($id_inst)."\")", VERBOSE_MODE); |
3301 |
// |
// |
3316 |
} |
} |
3317 |
// L'appel de verifier() a déjà positionné correct à false |
// L'appel de verifier() a déjà positionné correct à false |
3318 |
// et défini un message d'erreur. |
// et défini un message d'erreur. |
3319 |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid)); |
$this->addToLog(sprintf($log_msg_error, $id_inst, $uid), DEBUG_MODE); |
3320 |
return $this->end_treatment(__METHOD__, false); |
return $this->end_treatment(__METHOD__, false); |
3321 |
} |
} |
3322 |
|
|
3423 |
// Requête sql |
// Requête sql |
3424 |
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
$sql = "SELECT libelle FROM ".DB_PREFIXE."evenement |
3425 |
WHERE evenement=".$evenement; |
WHERE evenement=".$evenement; |
3426 |
$evenement_libelle = $this->db->getOne($sql); |
$evenement_libelle = $this->f->db->getOne($sql); |
3427 |
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("getTitle(): db->getOne(\"".$sql."\");", VERBOSE_MODE); |
3428 |
if (database::isError($evenement_libelle)) { |
if (database::isError($evenement_libelle)) { |
3429 |
die(); |
die(); |
3485 |
LEFT JOIN ".DB_PREFIXE."groupe |
LEFT JOIN ".DB_PREFIXE."groupe |
3486 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
3487 |
WHERE dossier.dossier = '".$dossier."'"; |
WHERE dossier.dossier = '".$dossier."'"; |
3488 |
$res = $this->db->query($sql); |
$res = $this->f->db->query($sql); |
3489 |
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
$this->f->addToLog("getSpecificMetadata() : db->query(".$sql.")", VERBOSE_MODE); |
3490 |
if ( database::isError($res)){ |
if ( database::isError($res)){ |
3491 |
die(); |
die(); |
3530 |
ON |
ON |
3531 |
dossier.etat = etat.etat |
dossier.etat = etat.etat |
3532 |
WHERE dossier ='".$idx."'"; |
WHERE dossier ='".$idx."'"; |
3533 |
$statut = $this->db->getOne($sql); |
$statut = $this->f->db->getOne($sql); |
3534 |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("getStatutAutorisationDossier() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
3535 |
if ( database::isError($statut)){ |
if ( database::isError($statut)){ |
3536 |
die(); |
die(); |
3551 |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
// Récupération de toutes les valeurs du dossier d'instruction en cours |
3552 |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
$sql = "SELECT * FROM ".DB_PREFIXE."dossier |
3553 |
WHERE dossier='".$this->valF['dossier']."'"; |
WHERE dossier='".$this->valF['dossier']."'"; |
3554 |
$res = $this->db->query($sql); |
$res = $this->f->db->query($sql); |
3555 |
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->addToLog("get_dossier_actual(): db->query(\"".$sql."\");", VERBOSE_MODE); |
3556 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
3557 |
|
|
3584 |
$return['archive_date_limite_incompletude'] = $row['date_limite_incompletude']; |
$return['archive_date_limite_incompletude'] = $row['date_limite_incompletude']; |
3585 |
$return['archive_delai_incompletude'] = $row['delai_incompletude']; |
$return['archive_delai_incompletude'] = $row['delai_incompletude']; |
3586 |
$return['archive_autorite_competente'] = $row['autorite_competente']; |
$return['archive_autorite_competente'] = $row['autorite_competente']; |
3587 |
|
$return['archive_dossier_instruction_type'] = $row['dossier_instruction_type']; |
3588 |
$return['duree_validite'] = $row['duree_validite']; |
$return['duree_validite'] = $row['duree_validite']; |
3589 |
$return['date_depot'] = $row['date_depot']; |
$return['date_depot'] = $row['date_depot']; |
3590 |
$return['archive_date_cloture_instruction'] = $row['date_cloture_instruction']; |
$return['archive_date_cloture_instruction'] = $row['date_cloture_instruction']; |
3594 |
$return['archive_date_retour_contradictoire'] = $row['date_retour_contradictoire']; |
$return['archive_date_retour_contradictoire'] = $row['date_retour_contradictoire']; |
3595 |
$return['archive_date_ait'] = $row['date_ait']; |
$return['archive_date_ait'] = $row['date_ait']; |
3596 |
$return['archive_date_transmission_parquet'] = $row['date_transmission_parquet']; |
$return['archive_date_transmission_parquet'] = $row['date_transmission_parquet']; |
3597 |
|
$return['archive_date_affichage'] = $row['date_affichage']; |
3598 |
} |
} |
3599 |
|
|
3600 |
// Retour de la fonction |
// Retour de la fonction |
3622 |
ON instruction.evenement = evenement.evenement |
ON instruction.evenement = evenement.evenement |
3623 |
WHERE instruction.instruction = $idx"; |
WHERE instruction.instruction = $idx"; |
3624 |
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog("checkEvenementNonVerrouillable() : db->getOne(\"".$sql."\")", VERBOSE_MODE); |
3625 |
$res = $this->db->getOne($sql); |
$res = $this->f->db->getOne($sql); |
3626 |
$this->f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
3627 |
|
|
3628 |
// Si le retour de la requête est true |
// Si le retour de la requête est true |
3732 |
if ($row['date_transmission_parquet'] != '') { |
if ($row['date_transmission_parquet'] != '') { |
3733 |
$this->valF['archive_date_transmission_parquet']= $row['date_transmission_parquet']; |
$this->valF['archive_date_transmission_parquet']= $row['date_transmission_parquet']; |
3734 |
} |
} |
3735 |
|
// |
3736 |
|
if ($row['dossier_instruction_type'] != '') { |
3737 |
|
$this->valF['archive_dossier_instruction_type']= $row['dossier_instruction_type']; |
3738 |
|
} |
3739 |
|
if ($row['date_affichage'] != '') { |
3740 |
|
$this->valF['archive_date_affichage']= $row['date_affichage']; |
3741 |
|
} |
3742 |
} |
} |
3743 |
|
|
3744 |
// {{{ |
// {{{ |
3888 |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
LEFT JOIN ".DB_PREFIXE."donnees_techniques ON |
3889 |
donnees_techniques.dossier_instruction = dossier.dossier |
donnees_techniques.dossier_instruction = dossier.dossier |
3890 |
WHERE instruction.instruction = ".$this->getVal("instruction"); |
WHERE instruction.instruction = ".$this->getVal("instruction"); |
3891 |
$resArrete = $this->db->query($sqlArrete); |
$resArrete = $this->f->db->query($sqlArrete); |
3892 |
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
$this->f->addToLog("getArreteMetadata(): db->query(\"".$sqlArrete."\");", VERBOSE_MODE); |
3893 |
if ( database::isError($resArrete)){ |
if ( database::isError($resArrete)){ |
3894 |
die(); |
die(); |
3908 |
// Récupère la valeur du champ lettretype |
// Récupère la valeur du champ lettretype |
3909 |
$lettretype = $this->getVal("lettretype"); |
$lettretype = $this->getVal("lettretype"); |
3910 |
// Si le champ est vide |
// Si le champ est vide |
3911 |
if (empty($lettretype)) { |
if ($lettretype !== '' && $lettretype !== null) { |
3912 |
// |
// |
3913 |
return false; |
return true; |
3914 |
} |
} |
3915 |
|
|
3916 |
// |
// |
3917 |
return true; |
return false; |
3918 |
} |
} |
3919 |
|
|
3920 |
/** |
/** |
3926 |
*/ |
*/ |
3927 |
function is_editable() { |
function is_editable() { |
3928 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
3929 |
$bypass = $this->f->isAccredited(get_class($this)."_modifier_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_modifier_bypass"); |
3930 |
// |
// |
3931 |
if ($bypass == true) { |
if ($bypass == true) { |
3932 |
// |
// |
3949 |
return true; |
return true; |
3950 |
} |
} |
3951 |
|
|
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
|
|
// décision peut être changée par la commune. |
|
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
|
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
|
|
return true; |
|
|
} |
|
|
|
|
3952 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
3953 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
3954 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
3963 |
/** |
/** |
3964 |
* CONDITION - is_deletable. |
* CONDITION - is_deletable. |
3965 |
* |
* |
3966 |
* Condition pour lma modification. |
* Condition pour la suppression. |
3967 |
* |
* |
3968 |
* @return boolean |
* @return boolean |
3969 |
*/ |
*/ |
3970 |
function is_deletable() { |
function is_deletable() { |
3971 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass intégral |
3972 |
$bypass = $this->f->isAccredited(get_class($this)."_supprimer_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_supprimer_bypass"); |
3973 |
// |
// |
3974 |
if ($bypass == true) { |
if ($bypass == true) { |
3975 |
|
|
3978 |
} |
} |
3979 |
|
|
3980 |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
// Si l'utilisateur est un intructeur qui ne correspond pas à la |
3981 |
// division du dossier |
// division du dossier et si l'utilisateur n'a pas la permission bypass |
3982 |
if ($this->is_instructeur_from_division_dossier() !== true) { |
// de la division |
3983 |
|
if ($this->is_instructeur_from_division_dossier() === false |
3984 |
|
&& $this->f->isAccredited($this->get_absolute_class_name()."_supprimer_bypass_division") === false) { |
3985 |
|
|
3986 |
// |
// |
3987 |
return false; |
return false; |
3990 |
// l'événement est-il le dernier ? |
// l'événement est-il le dernier ? |
3991 |
$dernier_evenement = false; |
$dernier_evenement = false; |
3992 |
// instanciation dossier |
// instanciation dossier |
3993 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
3994 |
$dossier = new dossier($this->getVal('dossier'), $this->db, DEBUG); |
"obj" => "dossier", |
3995 |
|
"idx" => $this->getVal('dossier'), |
3996 |
|
)); |
3997 |
// récupération dernier événement |
// récupération dernier événement |
3998 |
$id_dernier_evenement = $dossier->get_dernier_evenement(); |
$id_dernier_evenement = $dossier->get_dernier_evenement(); |
3999 |
if ($id_dernier_evenement == $this->getVal($this->clePrimaire)) { |
if ($id_dernier_evenement == $this->getVal($this->clePrimaire)) { |
4044 |
*/ |
*/ |
4045 |
function is_addable() { |
function is_addable() { |
4046 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
4047 |
$bypass = $this->f->isAccredited(get_class($this)."_ajouter_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_ajouter_bypass"); |
4048 |
// |
// |
4049 |
if ($bypass == true) { |
if ($bypass == true) { |
4050 |
|
|
4072 |
*/ |
*/ |
4073 |
function is_finalizable() { |
function is_finalizable() { |
4074 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
4075 |
$bypass = $this->f->isAccredited(get_class($this)."_finaliser_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_finaliser_bypass"); |
4076 |
// |
// |
4077 |
if ($bypass == true) { |
if ($bypass == true) { |
4078 |
// |
// |
4095 |
return true; |
return true; |
4096 |
} |
} |
4097 |
|
|
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
|
|
// décision peut être changée par la commune. |
|
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
|
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
|
|
return true; |
|
|
} |
|
|
|
|
4098 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
4099 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
4100 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
4137 |
*/ |
*/ |
4138 |
function is_unfinalizable(){ |
function is_unfinalizable(){ |
4139 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
4140 |
$bypass = $this->f->isAccredited(get_class($this)."_definaliser_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_definaliser_bypass"); |
4141 |
// |
// |
4142 |
if ($bypass == true) { |
if ($bypass == true) { |
4143 |
// |
// |
4160 |
return true; |
return true; |
4161 |
} |
} |
4162 |
|
|
|
// Si l'utilisateur est instructeur de la commune du dossier et que la |
|
|
// décision peut être changée par la commune. |
|
|
if ($this->is_instructeur_from_collectivite_dossier() === true and |
|
|
$this->isInstrCanChangeDecision($this->getVal('dossier')) === true) { |
|
|
return true; |
|
|
} |
|
|
|
|
4163 |
// Si l'utilisateur est instructeur de la commune du dossier et que |
// Si l'utilisateur est instructeur de la commune du dossier et que |
4164 |
// l'instruction est créée par un instructeur de la commune |
// l'instruction est créée par un instructeur de la commune |
4165 |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
if ($this->is_instructeur_from_collectivite_dossier() === true and |
4253 |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
if ($this->f->isCollectiviteMono($_SESSION['collectivite']) === true) { |
4254 |
$sql .= " AND dossier.om_collectivite=".$_SESSION['collectivite']; |
$sql .= " AND dossier.om_collectivite=".$_SESSION['collectivite']; |
4255 |
} |
} |
4256 |
$res = $this->db->getone($sql); |
$res = $this->f->db->getone($sql); |
4257 |
if (database::isError($res)) { |
if (database::isError($res)) { |
4258 |
die(); |
die(); |
4259 |
} |
} |
4283 |
} |
} |
4284 |
|
|
4285 |
// Contrôle si l'utilisateur possède un bypass |
// Contrôle si l'utilisateur possède un bypass |
4286 |
$bypass = $this->f->isAccredited(get_class($this)."_modification_dates_bypass"); |
$bypass = $this->f->isAccredited($this->get_absolute_class_name()."_modification_dates_bypass"); |
4287 |
if ($bypass === true) { |
if ($bypass === true) { |
4288 |
return true; |
return true; |
4289 |
} |
} |
4290 |
|
|
4291 |
// On vérifie en premier lieu que le DI n'est pas clôturé |
// Permission de modifier le suivi des dates sur un dossier cloturé pour |
4292 |
|
// un utilisateur lié à un instructeur |
4293 |
|
$perm_moni_dates_d_closed = $this->f->isAccredited($this->get_absolute_class_name()."_modification_dates_cloture"); |
4294 |
|
|
4295 |
|
// On vérifie en premier lieu que le DI n'est pas clôturé et que |
4296 |
|
// l'utilisateur ne possède pas la permission de modifier le suivi des |
4297 |
|
// dates sur un dossier clôturé |
4298 |
$inst_dossier = $this->get_inst_dossier(); |
$inst_dossier = $this->get_inst_dossier(); |
4299 |
if ($inst_dossier->getStatut() === 'cloture') { |
if ($inst_dossier->getStatut() === 'cloture' |
4300 |
|
&& $perm_moni_dates_d_closed === false) { |
4301 |
// |
// |
4302 |
return false; |
return false; |
4303 |
} |
} |
4417 |
&& $this->getVal("om_final_instruction") != null) { |
&& $this->getVal("om_final_instruction") != null) { |
4418 |
|
|
4419 |
// Ouvre le document |
// Ouvre le document |
4420 |
$lien = '../spg/file.php?obj='.$this->table.'&'. |
$lien = '../app/index.php?module=form&snippet=file&obj='.$this->table.'&'. |
4421 |
'champ=om_fichier_instruction&id='.$this->getVal($this->clePrimaire); |
'champ=om_fichier_instruction&id='.$this->getVal($this->clePrimaire); |
4422 |
// |
// |
4423 |
header("Location: ".$lien); |
header("Location: ".$lien); |
4436 |
"mode" => "previsualisation", |
"mode" => "previsualisation", |
4437 |
), |
), |
4438 |
); |
); |
4439 |
|
// Si la rédaction libre est activée sur l'instruction |
4440 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
4441 |
|
$params["specific"]["corps"] = array( |
4442 |
|
"mode" => "set", |
4443 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
4444 |
|
); |
4445 |
|
$params["specific"]["titre"] = array( |
4446 |
|
"mode" => "set", |
4447 |
|
"value" => $this->getVal("titre_om_htmletat"), |
4448 |
|
); |
4449 |
|
} |
4450 |
|
|
4451 |
// Génération du PDF |
// Génération du PDF |
4452 |
$result = $this->compute_pdf_output('lettretype', $this->getVal("lettretype"), $collectivite, null, $params); |
$result = $this->compute_pdf_output('lettretype', $this->getVal("lettretype"), $collectivite, null, $params); |
4461 |
/** |
/** |
4462 |
* Récupère la collectivité du dossier d'instruction. |
* Récupère la collectivité du dossier d'instruction. |
4463 |
* |
* |
4464 |
|
* @param string $dossier_instruction_id Identifiant du DI. |
4465 |
|
* |
4466 |
* @return integer |
* @return integer |
4467 |
*/ |
*/ |
4468 |
function get_dossier_instruction_om_collectivite() { |
function get_dossier_instruction_om_collectivite($dossier_instruction_id = null) { |
4469 |
|
|
4470 |
|
// Si l'identifiant n'est pas renseigné |
4471 |
|
if ($dossier_instruction_id === null) { |
4472 |
|
// Récupère la valeur |
4473 |
|
if ($this->getVal('dossier') !== null && $this->getVal('dossier') !== '') { |
4474 |
|
$dossier_instruction_id = $this->getVal('dossier'); |
4475 |
|
} elseif ($this->getParameter('idxformulaire') !== null |
4476 |
|
&& $this->getParameter('idxformulaire') !== '') { |
4477 |
|
// |
4478 |
|
$dossier_instruction_id = $this->getParameter('idxformulaire'); |
4479 |
|
} elseif ($this->f->get_submitted_get_value('idxformulaire') !== null |
4480 |
|
&& $this->f->get_submitted_get_value('idxformulaire') !== '') { |
4481 |
|
// |
4482 |
|
$dossier_instruction_id = $this->f->get_submitted_get_value('idxformulaire'); |
4483 |
|
} |
4484 |
|
} |
4485 |
|
|
4486 |
// |
// |
4487 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier_instruction = $this->f->get_inst__om_dbform(array( |
4488 |
$dossier_instruction = new dossier_instruction($this->getVal('dossier'), $this->f->db, false); |
"obj" => "dossier_instruction", |
4489 |
|
"idx" => $dossier_instruction_id, |
4490 |
|
)); |
4491 |
|
|
4492 |
// |
// |
4493 |
return $dossier_instruction->getVal('om_collectivite'); |
return $dossier_instruction->getVal('om_collectivite'); |
4504 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
4505 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
4506 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
4507 |
/** |
/** |
4508 |
* Affichage de la structure HTML |
* Affichage de la structure HTML |
4509 |
*/ |
*/ |
4510 |
// |
// |
4511 |
if ($f->isAjaxRequest()) { |
if ($this->f->isAjaxRequest()) { |
4512 |
// |
// |
4513 |
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
header("Content-type: text/html; charset=".HTTPCHARSET.""); |
4514 |
} else { |
} else { |
4515 |
// |
// |
4516 |
$f->setFlag("htmlonly"); |
$this->f->setFlag("htmlonly"); |
4517 |
$f->display(); |
$this->f->display(); |
4518 |
} |
} |
4519 |
// |
// |
4520 |
$f->displayStartContent(); |
$this->f->displayStartContent(); |
4521 |
// |
// |
4522 |
$f->setTitle(_("Liste des éléments de la bible en lien avec un evenement")); |
$this->f->setTitle(_("Liste des éléments de la bible en lien avec un evenement")); |
4523 |
$f->displayTitle(); |
$this->f->displayTitle(); |
4524 |
|
|
4525 |
/** |
/** |
4526 |
* |
* |
4527 |
*/ |
*/ |
4528 |
// |
// |
4529 |
($f->get_submitted_get_value("ev") ? $evenement = $f->get_submitted_get_value("ev") : $evenement = ""); |
($this->f->get_submitted_get_value("ev") ? $evenement = $this->f->get_submitted_get_value("ev") : $evenement = ""); |
4530 |
$evenement = intval($evenement); |
$evenement = intval($evenement); |
4531 |
// |
// |
4532 |
($f->get_submitted_get_value("idx") ? $idx = $f->get_submitted_get_value("idx") : $idx = ""); |
($this->f->get_submitted_get_value("idx") ? $idx = $this->f->get_submitted_get_value("idx") : $idx = ""); |
4533 |
// Récupération du code du type de DA |
// Récupération du code du type de DA |
4534 |
$code_da_type = ''; |
$code_da_type = ''; |
4535 |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
4536 |
$code_da_type = $matches[0]; |
$code_da_type = $matches[0]; |
4537 |
} |
} |
4538 |
// |
// |
4539 |
($f->get_submitted_get_value("complement") ? $complement = $f->get_submitted_get_value("complement") : $complement = "1"); |
($this->f->get_submitted_get_value("complement") ? $complement = $this->f->get_submitted_get_value("complement") : $complement = "1"); |
4540 |
|
|
4541 |
// Récupération de la collectivité du dossier |
// Récupération de la collectivité du dossier |
4542 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
4543 |
$dossier = new dossier($idx, $f->db, DEBUG); |
"obj" => "dossier", |
4544 |
|
"idx" => $idx, |
4545 |
|
)); |
4546 |
|
|
4547 |
/** |
/** |
4548 |
* |
* |
4554 |
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
ON bible.dossier_autorisation_type=dossier_autorisation_type.dossier_autorisation_type |
4555 |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
LEFT JOIN ".DB_PREFIXE."om_collectivite |
4556 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
4557 |
WHERE evenement=".$evenement." |
WHERE (evenement=".$evenement." OR evenement IS NULL) |
4558 |
AND complement=".$complement." |
AND (complement=".$complement." OR complement IS NULL) |
4559 |
AND (bible.dossier_autorisation_type IS NULL |
AND (bible.dossier_autorisation_type IS NULL |
4560 |
OR dossier_autorisation_type.code ='".$code_da_type."') |
OR dossier_autorisation_type.code ='".$code_da_type."') |
4561 |
AND (om_collectivite.niveau = '2' |
AND (om_collectivite.niveau = '2' |
4562 |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").") |
4563 |
ORDER BY bible_lib ASC"; |
ORDER BY bible_lib ASC"; |
4564 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
4565 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\");", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\");", VERBOSE_MODE); |
4566 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4567 |
// |
// |
4568 |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
echo "<form method=\"post\" name=\"f3\" action=\"#\">\n"; |
4569 |
// |
// |
4595 |
echo "\t</table>\n"; |
echo "\t</table>\n"; |
4596 |
// |
// |
4597 |
echo "<div class=\"formControls\">\n"; |
echo "<div class=\"formControls\">\n"; |
4598 |
$f->layout->display_form_button(array( |
$this->f->layout->display_form_button(array( |
4599 |
"value" => _("Valider"), |
"value" => _("Valider"), |
4600 |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
"onclick" => "bible_return('f2', 'complement".($complement == "1" ? "" : $complement)."_om_html'); return false;", |
4601 |
)); |
)); |
4602 |
$f->displayLinkJsCloseWindow(); |
$this->f->displayLinkJsCloseWindow(); |
4603 |
echo "</div>\n"; |
echo "</div>\n"; |
4604 |
|
|
4605 |
} else { |
} else { |
4606 |
// |
// |
4607 |
$message_class = "error"; |
$message_class = "error"; |
4608 |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
$message = _("Aucun element dans la bible pour l'evenement")." : ".$evenement; |
4609 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
4610 |
// |
// |
4611 |
echo "<div class=\"formControls\">\n"; |
echo "<div class=\"formControls\">\n"; |
4612 |
$f->displayLinkJsCloseWindow(); |
$this->f->displayLinkJsCloseWindow(); |
4613 |
echo "</div>\n"; |
echo "</div>\n"; |
4614 |
} |
} |
4615 |
// |
// |
4619 |
* Affichage de la structure HTML |
* Affichage de la structure HTML |
4620 |
*/ |
*/ |
4621 |
// |
// |
4622 |
$f->displayEndContent(); |
$this->f->displayEndContent(); |
4623 |
} |
} |
4624 |
|
|
4625 |
/** |
/** |
4632 |
function view_bible_auto() { |
function view_bible_auto() { |
4633 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
4634 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
|
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
4635 |
// |
// |
4636 |
$f->disableLog(); |
$this->f->disableLog(); |
4637 |
|
|
4638 |
$formatDate="AAAA-MM-JJ"; |
$formatDate="AAAA-MM-JJ"; |
4639 |
|
|
4640 |
// Récupération des paramètres |
// Récupération des paramètres |
4641 |
$idx = $f->get_submitted_get_value('idx'); |
$idx = $this->f->get_submitted_get_value('idx'); |
4642 |
$evenement = $f->get_submitted_get_value('ev'); |
$evenement = $this->f->get_submitted_get_value('ev'); |
4643 |
|
|
4644 |
// Initialisation de la variable de retour |
// Initialisation de la variable de retour |
4645 |
$retour['complement_om_html'] = ''; |
$retour['complement_om_html'] = ''; |
4647 |
$retour['complement3_om_html'] = ''; |
$retour['complement3_om_html'] = ''; |
4648 |
$retour['complement4_om_html'] = ''; |
$retour['complement4_om_html'] = ''; |
4649 |
// Vérification d'une consultation liée à l'événement |
// Vérification d'une consultation liée à l'événement |
4650 |
$consultation = $f->db->getOne( |
$consultation = $this->f->db->getOne( |
4651 |
"select consultation from ".DB_PREFIXE."evenement where evenement=".$evenement |
"select consultation from ".DB_PREFIXE."evenement where evenement=".$evenement |
4652 |
); |
); |
4653 |
$f->isDatabaseError($consultation); |
$this->f->isDatabaseError($consultation); |
4654 |
// Si consultation liée, récupération du retour d'avis |
// Si consultation liée, récupération du retour d'avis |
4655 |
if($consultation=='Oui'){ |
if($consultation=='Oui'){ |
4656 |
$sql="select date_retour,avis_consultation.libelle as avis_consultation, |
$sql="select date_retour,avis_consultation.libelle as avis_consultation, |
4659 |
on consultation.service =service.service |
on consultation.service =service.service |
4660 |
left join ".DB_PREFIXE."avis_consultation on |
left join ".DB_PREFIXE."avis_consultation on |
4661 |
consultation.avis_consultation = avis_consultation.avis_consultation |
consultation.avis_consultation = avis_consultation.avis_consultation |
4662 |
where dossier ='".$idx."'"; |
where dossier ='".$idx."' and consultation.visible"; |
4663 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
4664 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4665 |
// Récupération des consultations |
// Récupération des consultations |
4666 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
4667 |
$correct=false; |
$correct=false; |
4686 |
$temp=$temp." du ".$date_retour_f; |
$temp=$temp." du ".$date_retour_f; |
4687 |
} |
} |
4688 |
// Concaténation des retours d'avis de consultation |
// Concaténation des retours d'avis de consultation |
4689 |
$retour['complement_om_html'] .= $temp; |
$retour['complement_om_html'] .= $temp . "<br/><br/>"; |
4690 |
} // while |
} // while |
4691 |
|
|
4692 |
} // consultation |
} // consultation |
4693 |
// Récupération des bibles automatiques pour le champ complement_om_html |
// Récupération des bibles automatiques pour le champ complement_om_html |
4694 |
$retour['complement_om_html'] .= $this->getBible($f, $evenement, $idx, '1'); |
$retour['complement_om_html'] .= $this->getBible($evenement, $idx, '1'); |
4695 |
// Récupération des bibles automatiques pour le champ complement2_om_html |
// Récupération des bibles automatiques pour le champ complement2_om_html |
4696 |
$retour['complement2_om_html'] .= $this->getBible($f, $evenement, $idx, '2'); |
$retour['complement2_om_html'] .= $this->getBible($evenement, $idx, '2'); |
4697 |
// Récupération des bibles automatiques pour le champ complement3_om_html |
// Récupération des bibles automatiques pour le champ complement3_om_html |
4698 |
$retour['complement3_om_html'] .= $this->getBible($f, $evenement, $idx, '3'); |
$retour['complement3_om_html'] .= $this->getBible($evenement, $idx, '3'); |
4699 |
// Récupération des bibles automatiques pour le champ complement4_om_html |
// Récupération des bibles automatiques pour le champ complement4_om_html |
4700 |
$retour['complement4_om_html'] .= $this->getBible($f, $evenement, $idx, '4'); |
$retour['complement4_om_html'] .= $this->getBible($evenement, $idx, '4'); |
4701 |
|
|
4702 |
|
|
4703 |
|
|
4705 |
} |
} |
4706 |
|
|
4707 |
/** |
/** |
4708 |
|
* VIEW - view_pdf_temp |
4709 |
|
* |
4710 |
|
* @return void |
4711 |
|
*/ |
4712 |
|
function view_pdf_temp() { |
4713 |
|
$this->checkAccessibility(); |
4714 |
|
// Utilisation de $_POST pour ne pas que les textes soient altérés. |
4715 |
|
$this->f->set_submitted_value(); |
4716 |
|
$merge_fields = array(); |
4717 |
|
// |
4718 |
|
if (array_key_exists('c1', $_POST) === true) { |
4719 |
|
$merge_fields['[complement_instruction]'] = urldecode($_POST['c1']); |
4720 |
|
$merge_fields['[complement1_instruction]'] = urldecode($_POST['c1']); |
4721 |
|
} |
4722 |
|
if (array_key_exists('c2', $_POST) === true) { |
4723 |
|
$merge_fields['[complement2_instruction]'] = urldecode($_POST['c2']); |
4724 |
|
} |
4725 |
|
if (array_key_exists('c3', $_POST) === true) { |
4726 |
|
$merge_fields['[complement3_instruction]'] = urldecode($_POST['c3']); |
4727 |
|
} |
4728 |
|
if (array_key_exists('c4', $_POST) === true) { |
4729 |
|
$merge_fields['[complement4_instruction]'] = urldecode($_POST['c4']); |
4730 |
|
} |
4731 |
|
$params = array( |
4732 |
|
"watermark" => true, |
4733 |
|
"specific" => array( |
4734 |
|
"merge_fields" => $merge_fields, |
4735 |
|
), |
4736 |
|
); |
4737 |
|
// |
4738 |
|
if (array_key_exists('corps', $_POST) === true) { |
4739 |
|
$params["specific"]["corps"] = array( |
4740 |
|
"mode" => "set", |
4741 |
|
"value" => urldecode($_POST['corps']), |
4742 |
|
); |
4743 |
|
} |
4744 |
|
if (array_key_exists('titre', $_POST) === true) { |
4745 |
|
$params["specific"]["titre"] = array( |
4746 |
|
"mode" => "set", |
4747 |
|
"value" => urldecode($_POST['titre']), |
4748 |
|
); |
4749 |
|
} |
4750 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
4751 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
4752 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
4753 |
|
$retour = array( |
4754 |
|
'base' => base64_encode($result['pdf_output']), |
4755 |
|
); |
4756 |
|
echo json_encode($retour); |
4757 |
|
} |
4758 |
|
|
4759 |
|
/** |
4760 |
|
* Dans le contexte de prévisualisation des éditions, génère le rendu du |
4761 |
|
* PDF sans prise en compte de la valeur des compléments et le retourne en |
4762 |
|
* base 64. |
4763 |
|
* |
4764 |
|
* @return string Rendu PDF converti en base 64. |
4765 |
|
*/ |
4766 |
|
function init_pdf_temp() { |
4767 |
|
$params = array( |
4768 |
|
"watermark" => true, |
4769 |
|
); |
4770 |
|
// Si la rédaction libre est activée sur l'instruction |
4771 |
|
if ($this->getVal("flag_edition_integrale") == 't') { |
4772 |
|
$params["specific"]["corps"] = array( |
4773 |
|
"mode" => "set", |
4774 |
|
"value" => $this->getVal("corps_om_htmletatex"), |
4775 |
|
); |
4776 |
|
$params["specific"]["titre"] = array( |
4777 |
|
"mode" => "set", |
4778 |
|
"value" => $this->getVal("titre_om_htmletat"), |
4779 |
|
); |
4780 |
|
} |
4781 |
|
$dossier_instruction_om_collectivite = $this->get_dossier_instruction_om_collectivite(); |
4782 |
|
$collectivite = $this->f->getCollectivite($dossier_instruction_om_collectivite); |
4783 |
|
$result = $this->compute_pdf_output('lettretype', $this->getVal('lettretype'), $collectivite, null, $params); |
4784 |
|
|
4785 |
|
return base64_encode($result['pdf_output']); |
4786 |
|
} |
4787 |
|
|
4788 |
|
/** |
4789 |
* Récupération des éléments de bible. |
* Récupération des éléments de bible. |
4790 |
* |
* |
|
* @param utils $f handler de om_application |
|
4791 |
* @param integer $event id de l'événement |
* @param integer $event id de l'événement |
4792 |
* @param string $idx id du dossier |
* @param string $idx id du dossier |
4793 |
* @param integer $compnb numéro du champ complement |
* @param integer $compnb numéro du champ complement |
4794 |
* |
* |
4795 |
* @return string Chaîne de texte à insérer dans le champ complement |
* @return string Chaîne de texte à insérer dans le champ complement |
4796 |
*/ |
*/ |
4797 |
function getBible($f, $event, $idx, $compnb) { |
function getBible($event, $idx, $compnb) { |
4798 |
// Récupération de la collectivité du dossier |
// Récupération de la collectivité du dossier |
4799 |
require_once "../obj/dossier.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
4800 |
$dossier = new dossier($idx, $f->db, DEBUG); |
"obj" => "dossier", |
4801 |
|
"idx" => $idx, |
4802 |
|
)); |
4803 |
// Récupération du code du type de DA |
// Récupération du code du type de DA |
4804 |
$code_da_type = ''; |
$code_da_type = ''; |
4805 |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
if (preg_match('/[A-Za-z]{2,3}/', $idx, $matches) !== false) { |
4813 |
LEFT JOIN |
LEFT JOIN |
4814 |
".DB_PREFIXE."om_collectivite |
".DB_PREFIXE."om_collectivite |
4815 |
ON bible.om_collectivite = om_collectivite.om_collectivite |
ON bible.om_collectivite = om_collectivite.om_collectivite |
4816 |
WHERE evenement =".$event." and |
WHERE (evenement =".$event." or evenement IS NULL) and |
4817 |
complement=".$compnb." and |
(complement=".$compnb." OR complement IS NULL) and |
4818 |
automatique='Oui' and |
automatique='Oui' and |
4819 |
(dossier_autorisation_type.code ='".$code_da_type."' or |
(dossier_autorisation_type.code ='".$code_da_type."' or |
4820 |
bible.dossier_autorisation_type IS NULL) and |
bible.dossier_autorisation_type IS NULL) and |
4821 |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
(om_collectivite.niveau = '2' OR bible.om_collectivite = ".$dossier->getVal("om_collectivite").")"; |
4822 |
|
|
4823 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
4824 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4825 |
$temp = ""; |
$temp = ""; |
4826 |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){ |
4827 |
// Remplacement des retours à la ligne par des br |
// Remplacement des retours à la ligne par des br |
4828 |
$temp .= preg_replace( |
$temp .= preg_replace( |
4829 |
'#(\\\r|\\\r\\\n|\\\n)#', '<br/>', $row['contenu'] |
'#(\\\r|\\\r\\\n|\\\n)#', '<br/>', $row['contenu'] |
4830 |
); |
); |
4831 |
|
// Ajout d'un saut de ligne entre chaque bible. |
4832 |
|
$temp .= '<br/>'; |
4833 |
} // fin while |
} // fin while |
4834 |
return $temp; |
return $temp; |
4835 |
} |
} |
4847 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
4848 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
4849 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
4850 |
/** |
/** |
4851 |
* Validation du formulaire |
* Validation du formulaire |
4852 |
*/ |
*/ |
4853 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
4854 |
if ($f->get_submitted_post_value("validation") !== null) { |
if ($this->f->get_submitted_post_value("validation") !== null) { |
4855 |
// Si un bordereau à été sélectionné |
// Si un bordereau à été sélectionné |
4856 |
if ($f->get_submitted_post_value("bordereau") !== null && $f->get_submitted_post_value("bordereau") == "" ) { |
if ($this->f->get_submitted_post_value("bordereau") !== null && $this->f->get_submitted_post_value("bordereau") == "" ) { |
4857 |
// Si aucun bordereau n'a été sélectionné |
// Si aucun bordereau n'a été sélectionné |
4858 |
$message_class = "error"; |
$message_class = "error"; |
4859 |
$message = _("Veuillez selectionner un bordereau."); |
$message = _("Veuillez selectionner un bordereau."); |
4860 |
} |
} |
4861 |
// Sinon si les dates ne sont pas valide |
// Sinon si les dates ne sont pas valide |
4862 |
elseif (($f->get_submitted_post_value("date_bordereau_debut") !== null |
elseif (($this->f->get_submitted_post_value("date_bordereau_debut") !== null |
4863 |
&& $f->get_submitted_post_value("date_bordereau_debut") == "") |
&& $this->f->get_submitted_post_value("date_bordereau_debut") == "") |
4864 |
|| ($f->get_submitted_post_value("date_bordereau_fin") !== null |
|| ($this->f->get_submitted_post_value("date_bordereau_fin") !== null |
4865 |
&& $f->get_submitted_post_value("date_bordereau_fin") == "")) { |
&& $this->f->get_submitted_post_value("date_bordereau_fin") == "")) { |
4866 |
// Si aucune date n'a été saisie |
// Si aucune date n'a été saisie |
4867 |
$message_class = "error"; |
$message_class = "error"; |
4868 |
$message = _("Veuillez saisir une date valide."); |
$message = _("Veuillez saisir une date valide."); |
4869 |
} |
} |
4870 |
|
// Sinon si les dates ne sont pas valides |
4871 |
|
elseif ($this->f->get_submitted_post_value("bordereau") === "bordereau_avis_maire_prefet" |
4872 |
|
&& $this->f->getParameter("id_evenement_bordereau_avis_maire_prefet") == null) { |
4873 |
|
// Si aucune date n'a été saisie |
4874 |
|
$message_class = "error"; |
4875 |
|
$message = _("Erreur de parametrage. Contactez votre administrateur."); |
4876 |
|
} |
4877 |
// Affiche le message de validation |
// Affiche le message de validation |
4878 |
else { |
else { |
4879 |
// On récupère le libellé du bordereau pour l'afficher à l'utilisateur |
// On récupère le libellé du bordereau pour l'afficher à l'utilisateur |
4880 |
$sql = "SELECT om_etat.libelle |
$sql = "SELECT om_etat.libelle |
4881 |
FROM ".DB_PREFIXE."om_etat |
FROM ".DB_PREFIXE."om_etat |
4882 |
WHERE om_etat.id = '".$f->get_submitted_post_value("bordereau")."'"; |
WHERE om_etat.id = '".$this->f->get_submitted_post_value("bordereau")."'"; |
4883 |
$res = $f->db->getone($sql); |
$res = $this->f->db->getone($sql); |
4884 |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
4885 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4886 |
// |
// |
4887 |
$message_class = "valid"; |
$message_class = "valid"; |
4888 |
$message = _("Cliquez sur le lien ci-dessous pour telecharger votre bordereau"); |
$message = _("Cliquez sur le lien ci-dessous pour telecharger votre bordereau"); |
4889 |
$message .= " : <br/><br/>"; |
$message .= " : <br/><br/>"; |
4890 |
$message .= "<a class='om-prev-icon pdf-16'"; |
$message .= "<a class='om-prev-icon pdf-16'"; |
4891 |
$message .= " title=\""._("Bordereau")."\""; |
$message .= " title=\""._("Bordereau")."\""; |
4892 |
$message .= "href='../scr/form.php?obj=instruction"; |
$message .= "href='".OM_ROUTE_FORM."&obj=instruction"; |
4893 |
$message .= "&action=220"; |
$message .= "&action=220"; |
4894 |
$message .= "&idx=0"; |
$message .= "&idx=0"; |
4895 |
$message .= "&type_bordereau=".$f->get_submitted_post_value("bordereau"); |
$message .= "&type_bordereau=".$this->f->get_submitted_post_value("bordereau"); |
4896 |
$message .= "&date_bordereau_debut=".$f->get_submitted_post_value("date_bordereau_debut"); |
$message .= "&date_bordereau_debut=".$this->f->get_submitted_post_value("date_bordereau_debut"); |
4897 |
$message .= "&date_bordereau_fin=".$f->get_submitted_post_value("date_bordereau_fin"); |
$message .= "&date_bordereau_fin=".$this->f->get_submitted_post_value("date_bordereau_fin"); |
4898 |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
// Si l'utilisateur est MULTI alors on ajoute le paramètre collectivite |
4899 |
if ($f->get_submitted_post_value("om_collectivite") !== null) { |
if ($this->f->get_submitted_post_value("om_collectivite") !== null) { |
4900 |
$message .= "&collectivite=".$f->get_submitted_post_value("om_collectivite"); |
$message .= "&collectivite=".$this->f->get_submitted_post_value("om_collectivite"); |
4901 |
} |
} |
4902 |
$message .= "'"." target='_blank'>"; |
$message .= "'"." target='_blank'>"; |
4903 |
$message .= $res." "._("du")." ".$f->get_submitted_post_value("date_bordereau_debut") |
$message .= $res." "._("du")." ".$this->f->get_submitted_post_value("date_bordereau_debut") |
4904 |
." "._("au")." ".$f->get_submitted_post_value("date_bordereau_fin"); |
." "._("au")." ".$this->f->get_submitted_post_value("date_bordereau_fin"); |
4905 |
$message .= "</a>"; |
$message .= "</a>"; |
4906 |
} |
} |
4907 |
} |
} |
4911 |
*/ |
*/ |
4912 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
4913 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
4914 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
4915 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
4916 |
// Ouverture du formulaire |
// Ouverture du formulaire |
4917 |
printf("\t<form"); |
printf("\t<form"); |
4918 |
printf(" method=\"post\""); |
printf(" method=\"post\""); |
4921 |
printf(">\n"); |
printf(">\n"); |
4922 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
4923 |
$champs = array("date_bordereau_debut", "date_bordereau_fin", "bordereau"); |
$champs = array("date_bordereau_debut", "date_bordereau_fin", "bordereau"); |
4924 |
// Si l'utilisateur est d'une collectivité de niveau 2 on affiche un select |
// Si l'utilisateur est d'une collectivité de niveau 2 on affiche un select |
4925 |
// collectivité dans le formulaire |
// collectivité dans le formulaire |
4926 |
if($_SESSION["niveau"] == 2) { |
if ($_SESSION["niveau"] == 2) { |
4927 |
array_push($champs, "om_collectivite"); |
array_push($champs, "om_collectivite"); |
4928 |
} |
} |
4929 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
4930 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
4931 |
|
"validation" => 0, |
4932 |
|
"maj" => 0, |
4933 |
|
"champs" => $champs, |
4934 |
|
)); |
4935 |
// Paramétrage du champ date_bordereau_debut |
// Paramétrage du champ date_bordereau_debut |
4936 |
$form->setLib("date_bordereau_debut", _("date_bordereau_debut")); |
$form->setLib("date_bordereau_debut", _("date_bordereau_debut")); |
4937 |
$form->setType("date_bordereau_debut", "date"); |
$form->setType("date_bordereau_debut", "date"); |
4953 |
$form->setType("bordereau", "select"); |
$form->setType("bordereau", "select"); |
4954 |
$form->setRequired("bordereau"); |
$form->setRequired("bordereau"); |
4955 |
// Valeurs des champs |
// Valeurs des champs |
4956 |
if ($f->get_submitted_post_value("validation") !== null) { |
if ($this->f->get_submitted_post_value("validation") !== null) { |
4957 |
$form->setVal("date_bordereau_debut", $f->get_submitted_post_value("date_bordereau_debut")); |
$form->setVal("date_bordereau_debut", $this->f->get_submitted_post_value("date_bordereau_debut")); |
4958 |
$form->setVal("date_bordereau_fin", $f->get_submitted_post_value("date_bordereau_fin")); |
$form->setVal("date_bordereau_fin", $this->f->get_submitted_post_value("date_bordereau_fin")); |
4959 |
$form->setVal("bordereau", $f->get_submitted_post_value("bordereau")); |
$form->setVal("bordereau", $this->f->get_submitted_post_value("bordereau")); |
4960 |
$form->setVal("om_collectivite", $f->get_submitted_post_value("om_collectivite")); |
$form->setVal("om_collectivite", $this->f->get_submitted_post_value("om_collectivite")); |
4961 |
} |
} |
4962 |
// Données du select - On récupère ici la liste de tous les états disponibles |
// Données du select - On récupère ici la liste de tous les états disponibles |
4963 |
// dans la table om_etat qui ont un id qui commence par la cahine de caractères |
// dans la table om_etat qui ont un id qui commence par la cahine de caractères |
4966 |
FROM ".DB_PREFIXE."om_etat |
FROM ".DB_PREFIXE."om_etat |
4967 |
WHERE om_etat.id LIKE 'bordereau_%' |
WHERE om_etat.id LIKE 'bordereau_%' |
4968 |
ORDER BY om_etat.id"; |
ORDER BY om_etat.id"; |
4969 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
4970 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
4971 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4972 |
// Données du select |
// Données du select |
4973 |
$contenu = array( |
$contenu = array( |
4974 |
0 => array("", ), |
0 => array("", ), |
4979 |
$contenu[1][] = $row['libelle']; |
$contenu[1][] = $row['libelle']; |
4980 |
} |
} |
4981 |
$form->setSelect("bordereau", $contenu); |
$form->setSelect("bordereau", $contenu); |
4982 |
// |
// |
4983 |
if($_SESSION["niveau"] == 2) { |
if ($_SESSION["niveau"] == 2) { |
4984 |
$form->setLib("om_collectivite", _("collectivite")); |
$form->setLib("om_collectivite", _("collectivite")); |
4985 |
$form->setType("om_collectivite", "select"); |
$form->setType("om_collectivite", "select"); |
4986 |
|
|
4987 |
// Données du select - On récupère ici la liste de tous toutes les collectivités |
// Données du select - On récupère ici la liste de tous toutes les collectivités |
4988 |
// de niveau 1 |
// de niveau 1 |
4989 |
$sql = "SELECT om_collectivite, libelle |
$sql = "SELECT om_collectivite, libelle |
4990 |
FROM ".DB_PREFIXE."om_collectivite |
FROM ".DB_PREFIXE."om_collectivite |
4991 |
WHERE niveau = '1' ORDER BY libelle"; |
WHERE niveau = '1' ORDER BY libelle"; |
4992 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
4993 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
4994 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
4995 |
// La valeur par défaut du select est Toutes |
// La valeur par défaut du select est Toutes |
4996 |
$list_collectivites = array( |
$list_collectivites = array( |
4997 |
0 => array("", ), |
0 => array("", ), |
4998 |
1 => array(_("toutes")) |
1 => array(_("toutes")) |
4999 |
); |
); |
|
|
|
|
$id_colls = ""; |
|
|
// On stocke dans $id_colls l'id de toutes les collectivités de niveau 1 séparées |
|
|
// par des virgules, pour un traitement plus facile dans la requête de sous-état |
|
|
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
|
|
if ($id_colls != "") { |
|
|
$id_colls .= ","; |
|
|
} |
|
|
$id_colls .= $row['om_collectivite']; |
|
|
$list_collectivites[0][] = $row['om_collectivite']; |
|
|
$list_collectivites[1][] = $row['libelle']; |
|
|
} |
|
|
// On affecte la liste d'identifiants à l'option Toutes |
|
|
$list_collectivites[0][0] = $id_colls ; |
|
|
$form->setSelect("om_collectivite", $list_collectivites); |
|
|
} |
|
5000 |
|
|
5001 |
|
$id_colls = ""; |
5002 |
|
// On stocke dans $id_colls l'id de toutes les collectivités de niveau 1 séparées |
5003 |
|
// par des virgules, pour un traitement plus facile dans la requête de sous-état |
5004 |
|
while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { |
5005 |
|
if ($id_colls != "") { |
5006 |
|
$id_colls .= ","; |
5007 |
|
} |
5008 |
|
$id_colls .= $row['om_collectivite']; |
5009 |
|
$list_collectivites[0][] = $row['om_collectivite']; |
5010 |
|
$list_collectivites[1][] = $row['libelle']; |
5011 |
|
} |
5012 |
|
// On affecte la liste d'identifiants à l'option Toutes |
5013 |
|
$list_collectivites[0][0] = $id_colls ; |
5014 |
|
$form->setSelect("om_collectivite", $list_collectivites); |
5015 |
|
} |
5016 |
// Affichage du formulaire |
// Affichage du formulaire |
5017 |
$form->entete(); |
$form->entete(); |
5018 |
$form->afficher($champs, 0, false, false); |
$form->afficher($champs, 0, false, false); |
5019 |
$form->enpied(); |
$form->enpied(); |
5020 |
// Affichage du bouton |
// Affichage du bouton |
5021 |
printf("\t<div class=\"formControls\">\n"); |
printf("\t<div class=\"formControls\">\n"); |
5022 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
5023 |
printf("\t</div>\n"); |
printf("\t</div>\n"); |
5024 |
// Fermeture du formulaire |
// Fermeture du formulaire |
5025 |
printf("\t</form>\n"); |
printf("\t</form>\n"); |
|
|
|
5026 |
} |
} |
5027 |
|
|
5028 |
|
|
5051 |
/** |
/** |
5052 |
* VIEW - view_suivi_envoi_lettre_rar. |
* VIEW - view_suivi_envoi_lettre_rar. |
5053 |
* |
* |
5054 |
* Vu pour imprimer les RAR. |
* Vue pour imprimer les AR. |
5055 |
* |
* |
5056 |
* @return void |
* @return void |
5057 |
*/ |
*/ |
5059 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
5060 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
5061 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
5062 |
// |
// |
5063 |
if ($f->get_submitted_post_value("date") !== null) { |
if ($this->f->get_submitted_post_value("date") !== null) { |
5064 |
$date = $f->get_submitted_post_value("date"); |
$date = $this->f->get_submitted_post_value("date"); |
5065 |
} else { |
} else { |
5066 |
$date = ""; |
$date = ""; |
5067 |
} |
} |
5068 |
// |
// |
5069 |
if ($f->get_submitted_post_value("liste_code_barres_instruction") !== null) { |
if ($this->f->get_submitted_post_value("liste_code_barres_instruction") !== null) { |
5070 |
$liste_code_barres_instruction = $f->get_submitted_post_value("liste_code_barres_instruction"); |
$liste_code_barres_instruction = $this->f->get_submitted_post_value("liste_code_barres_instruction"); |
5071 |
} else { |
} else { |
5072 |
$liste_code_barres_instruction = ""; |
$liste_code_barres_instruction = ""; |
5073 |
} |
} |
5093 |
* Validation du formulaire |
* Validation du formulaire |
5094 |
*/ |
*/ |
5095 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
5096 |
if ($f->get_submitted_post_value('validation') !== null) { |
if ($this->f->get_submitted_post_value('validation') !== null) { |
5097 |
// |
// |
5098 |
if (empty($date) || empty($liste_code_barres_instruction)) { |
if (empty($date) || empty($liste_code_barres_instruction)) { |
5099 |
// |
// |
5101 |
$message = _("Tous les champs doivent etre remplis."); |
$message = _("Tous les champs doivent etre remplis."); |
5102 |
} else { |
} else { |
5103 |
// Création d'un tableau d'instruction |
// Création d'un tableau d'instruction |
5104 |
$liste = explode("\r\n", $f->get_submitted_post_value("liste_code_barres_instruction")); |
$liste = explode("\r\n", $this->f->get_submitted_post_value("liste_code_barres_instruction")); |
5105 |
// |
// |
5106 |
foreach ($liste as $code_barres) { |
foreach ($liste as $code_barres) { |
5107 |
// On enlève les éventuels espaces saisis |
// On enlève les éventuels espaces saisis |
5123 |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
5124 |
INNER JOIN ".DB_PREFIXE."groupe |
INNER JOIN ".DB_PREFIXE."groupe |
5125 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
|
AND groupe.code != 'CTX' |
|
5126 |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
5127 |
$nbInstr = $f->db->getone($sql); |
|
5128 |
$f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
// Ajout d'un filtre sur les groupes auxquels l'utilisateur a accès |
5129 |
$f->isDatabaseError($nbInstr); |
$group_clause = array(); |
5130 |
|
foreach ($_SESSION["groupe"] as $key => $value) { |
5131 |
|
$group_clause[$key] = "(groupe.code = '".$key."'"; |
5132 |
|
if($value["confidentiel"] !== true) { |
5133 |
|
$group_clause[$key] .= " AND dossier_autorisation_type.confidentiel IS NOT TRUE"; |
5134 |
|
} |
5135 |
|
$group_clause[$key] .= ")"; |
5136 |
|
} |
5137 |
|
$conditions = implode(" OR ", $group_clause); |
5138 |
|
$sql .= " AND (" . $conditions . ")"; |
5139 |
|
|
5140 |
|
$nbInstr = $this->f->db->getone($sql); |
5141 |
|
$this->f->addToLog(__METHOD__.": db->getone(\"".$sql."\")", VERBOSE_MODE); |
5142 |
|
$this->f->isDatabaseError($nbInstr); |
5143 |
// |
// |
5144 |
if ($nbInstr == "1") { |
if ($nbInstr == "1") { |
5145 |
// Récupération de la date d'envoi de l'instruction bippé |
// Récupération de la date d'envoi de l'instruction bippé |
5146 |
$sql = "SELECT to_char(date_envoi_rar,'DD/MM/YYYY') as date_envoi_rar, instruction FROM ".DB_PREFIXE."instruction WHERE code_barres='".$code_barres."'"; |
$sql = "SELECT to_char(date_envoi_rar,'DD/MM/YYYY') as date_envoi_rar, instruction FROM ".DB_PREFIXE."instruction WHERE code_barres='".$code_barres."'"; |
5147 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
5148 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
5149 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
5150 |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
5151 |
// Si pas de date ou correspond à la date du formulaire on |
// Si pas de date ou correspond à la date du formulaire on |
5152 |
// effectue le traitement |
// effectue le traitement |
5153 |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
if ($row["date_envoi_rar"] == "" || $row["date_envoi_rar"] == $date) { |
5154 |
|
$instr = $this->f->get_inst__om_dbform(array( |
5155 |
require_once '../obj/instruction.class.php'; |
"obj" => "instruction", |
5156 |
require_once '../obj/dossier.class.php'; |
"idx" => $row['instruction'], |
5157 |
|
)); |
|
$instr = new instruction($row['instruction'], $f->db, DEBUG); |
|
5158 |
$valF = array(); |
$valF = array(); |
5159 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
5160 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
5163 |
# Si on peut consulter les dossiers et que le dossier n'existe pas déjà dans la liste |
# Si on peut consulter les dossiers et que le dossier n'existe pas déjà dans la liste |
5164 |
if ($isAccredited === true |
if ($isAccredited === true |
5165 |
&& array_key_exists($instr->getVal("dossier"), $dossierTab) === false) { |
&& array_key_exists($instr->getVal("dossier"), $dossierTab) === false) { |
5166 |
$dossier = new dossier($instr->getVal("dossier")); |
$dossier = $this->f->get_inst__om_dbform(array( |
5167 |
|
"obj" => "dossier", |
5168 |
|
"idx" => $instr->getVal("dossier"), |
5169 |
|
)); |
5170 |
if ($dossier->is_user_from_allowed_collectivite()){ |
if ($dossier->is_user_from_allowed_collectivite()){ |
5171 |
$dossierTab[$instr->getVal("dossier")] = $dossier; |
$dossierTab[$instr->getVal("dossier")] = $dossier; |
5172 |
} else { |
} else { |
5220 |
$instr->setParameter('maj', 1); |
$instr->setParameter('maj', 1); |
5221 |
$instr->class_actions[1]["identifier"] = |
$instr->class_actions[1]["identifier"] = |
5222 |
"envoi lettre RAR (depuis le menu suivi des pièces)"; |
"envoi lettre RAR (depuis le menu suivi des pièces)"; |
5223 |
if ($instr->modifier($valF, $f->db, DEBUG) == true) { |
if ($instr->modifier($valF) == true) { |
5224 |
$id4Gen[] = $code_barres; |
$id4Gen[] = $code_barres; |
5225 |
$nbLettres ++; |
$nbLettres ++; |
5226 |
} else { |
} else { |
5275 |
*/ |
*/ |
5276 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
5277 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
5278 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
5279 |
} |
} |
5280 |
// Affichage du message d'erreur |
// Affichage du message d'erreur |
5281 |
if(!empty($error)) { |
if(!empty($error)) { |
5282 |
$f->displayMessage("error", $error); |
$this->f->displayMessage("error", $error); |
5283 |
} |
} |
5284 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
5285 |
if ($nbLettres > 0) { |
if ($nbLettres > 0) { |
5291 |
echo _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
echo _("Cliquez sur le lien ci-dessous pour telecharger votre document"); |
5292 |
echo " : \n<br/><br/>"; |
echo " : \n<br/><br/>"; |
5293 |
echo "\n<a class='om-prev-icon pdf-16'"; |
echo "\n<a class='om-prev-icon pdf-16'"; |
5294 |
echo "\n title=\""._("imprimer les RAR")."\""; |
echo "\n title=\""._("imprimer les AR")."\""; |
5295 |
echo "\n href=\"../scr/form.php?obj=instruction&action=180&idx=0&liste=".implode(",",$id4Gen)."\""; |
echo "\n href=\"".OM_ROUTE_FORM."&obj=instruction&action=180&idx=0&liste=".implode(",",$id4Gen)."\""; |
5296 |
echo "\n target='_blank'>"; |
echo "\n target='_blank'>"; |
5297 |
echo _("Telecharger le document pour")." ".$nbLettres." "._("RAR"); |
echo _("Telecharger le document pour")." ".$nbLettres." "._("AR"); |
5298 |
echo "\n</a>"; |
echo "\n</a>"; |
5299 |
echo "\n</span>"; |
echo "\n</span>"; |
5300 |
echo "\n</p>"; |
echo "\n</p>"; |
5316 |
echo "\n<br/>"; |
echo "\n<br/>"; |
5317 |
} |
} |
5318 |
foreach ($dossierTab as $dossier) { |
foreach ($dossierTab as $dossier) { |
5319 |
|
|
5320 |
|
$inst_da = $this->get_inst_common("dossier_autorisation", $dossier->getVal('dossier_autorisation')); |
5321 |
|
$inst_datd = $this->get_inst_common("dossier_autorisation_type_detaille", $inst_da->getVal('dossier_autorisation_type_detaille')); |
5322 |
|
$code_datd = $inst_datd->getVal('code'); |
5323 |
|
|
5324 |
|
$obj = "dossier_instruction"; |
5325 |
|
if ($code_datd === 'REC' OR $code_datd === 'REG') { |
5326 |
|
$obj = "dossier_contentieux_tous_recours"; |
5327 |
|
} |
5328 |
|
if ($code_datd === 'IN') { |
5329 |
|
$obj = "dossier_contentieux_toutes_infractions"; |
5330 |
|
} |
5331 |
|
|
5332 |
echo "\n<div class=\"bloc group\">"; |
echo "\n<div class=\"bloc group\">"; |
5333 |
echo "\n<div class=\"field field-type-text\">"; |
echo "\n<div class=\"field field-type-text\">"; |
5334 |
|
|
5335 |
echo "\n<p>"; |
echo "\n<p>"; |
5336 |
echo "\n<span class='text'>"; |
echo "\n<span class='text'>"; |
5337 |
echo "\n<a class=\"om-icon om-icon-16 consult-16\" title=\"" . _('Consulter') . "\""; |
echo "\n<a class=\"om-icon om-icon-16 consult-16\" title=\"" . _('Consulter') . "\""; |
5338 |
echo "\n href=\"../scr/form.php?obj=dossier_instruction&action=3&idx="; |
echo "\n href=\"".OM_ROUTE_FORM."&obj=dossier_instruction&action=3&idx="; |
5339 |
echo $dossier->getVal("dossier"); |
echo $dossier->getVal("dossier"); |
5340 |
echo "\">"; |
echo "\">"; |
5341 |
echo "\n</a>"; |
echo "\n</a>"; |
5342 |
|
|
5343 |
echo "\n<a title=\""._("Consulter")."\" style=\"vertical-align:middle;\""; |
echo "\n<a title=\""._("Consulter")."\" style=\"vertical-align:middle;\""; |
5344 |
echo " href=\"../scr/form.php?obj=dossier_instruction&action=3&idx="; |
echo " href=\"".OM_ROUTE_FORM."&obj="; |
5345 |
|
echo $obj; |
5346 |
|
echo "&action=3&idx="; |
5347 |
echo $dossier->getVal("dossier"); |
echo $dossier->getVal("dossier"); |
5348 |
echo "\">"; |
echo "\">"; |
5349 |
echo $dossier->getVal("dossier_libelle"); |
echo $dossier->getVal("dossier_libelle"); |
5360 |
echo "\n</div>"; |
echo "\n</div>"; |
5361 |
echo "\n</div>"; |
echo "\n</div>"; |
5362 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
5363 |
// Ouverture du formulaire |
// Ouverture du formulaire |
5364 |
echo "\t<form"; |
echo "\t<form"; |
5365 |
echo " method=\"post\""; |
echo " method=\"post\""; |
5369 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
5370 |
$champs = array("date", "liste_code_barres_instruction"); |
$champs = array("date", "liste_code_barres_instruction"); |
5371 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
5372 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
5373 |
|
"validation" => 0, |
5374 |
|
"maj" => 0, |
5375 |
|
"champs" => $champs, |
5376 |
|
)); |
5377 |
// Paramétrage du champ date du formulaire |
// Paramétrage du champ date du formulaire |
5378 |
$form->setLib("date", _("Date")."* :"); |
$form->setLib("date", _("Date")."* :"); |
5379 |
$form->setType("date", "date"); |
$form->setType("date", "date"); |
5393 |
$form->enpied(); |
$form->enpied(); |
5394 |
// Affichage du bouton |
// Affichage du bouton |
5395 |
echo "\t<div class=\"formControls\">\n"; |
echo "\t<div class=\"formControls\">\n"; |
5396 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
5397 |
echo "\t</div>\n"; |
echo "\t</div>\n"; |
5398 |
// Fermeture du formulaire |
// Fermeture du formulaire |
5399 |
echo "\t</form>\n"; |
echo "\t</form>\n"; |
5410 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
5411 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
5412 |
|
|
|
// XXX APP |
|
|
|
|
|
$f = $this->f; |
|
|
|
|
5413 |
// Récupération des valeur passées en POST ou GET |
// Récupération des valeur passées en POST ou GET |
5414 |
if($f->get_submitted_post_value("type_mise_a_jour") !== null) { |
if($this->f->get_submitted_post_value("type_mise_a_jour") !== null) { |
5415 |
$type_mise_a_jour = $f->get_submitted_post_value("type_mise_a_jour"); |
$type_mise_a_jour = $this->f->get_submitted_post_value("type_mise_a_jour"); |
5416 |
} elseif($f->get_submitted_get_value('type_mise_a_jour') !== null) { |
} elseif($this->f->get_submitted_get_value('type_mise_a_jour') !== null) { |
5417 |
$type_mise_a_jour = $f->get_submitted_get_value('type_mise_a_jour'); |
$type_mise_a_jour = $this->f->get_submitted_get_value('type_mise_a_jour'); |
5418 |
} else { |
} else { |
5419 |
$type_mise_a_jour = ""; |
$type_mise_a_jour = ""; |
5420 |
} |
} |
5421 |
if($f->get_submitted_post_value('date') !== null) { |
if($this->f->get_submitted_post_value('date') !== null) { |
5422 |
$date = $f->get_submitted_post_value('date'); |
$date = $this->f->get_submitted_post_value('date'); |
5423 |
} elseif($f->get_submitted_get_value('date') !== null) { |
} elseif($this->f->get_submitted_get_value('date') !== null) { |
5424 |
$date = $f->get_submitted_get_value('date'); |
$date = $this->f->get_submitted_get_value('date'); |
5425 |
} else { |
} else { |
5426 |
$date = ""; |
$date = ""; |
5427 |
} |
} |
5428 |
if($f->get_submitted_post_value('code_barres') !== null) { |
if($this->f->get_submitted_post_value('code_barres') !== null) { |
5429 |
$code_barres = $f->get_submitted_post_value('code_barres'); |
$code_barres = $this->f->get_submitted_post_value('code_barres'); |
5430 |
} elseif($f->get_submitted_get_value('code_barres') !== null) { |
} elseif($this->f->get_submitted_get_value('code_barres') !== null) { |
5431 |
$code_barres = $f->get_submitted_get_value('code_barres'); |
$code_barres = $this->f->get_submitted_get_value('code_barres'); |
5432 |
} else { |
} else { |
5433 |
$code_barres = ""; |
$code_barres = ""; |
5434 |
} |
} |
5440 |
$liste_champs=array(); |
$liste_champs=array(); |
5441 |
|
|
5442 |
// Si le formulaire a été validé |
// Si le formulaire a été validé |
5443 |
if ($f->get_submitted_post_value('validation') !== null) { |
if ($this->f->get_submitted_post_value('validation') !== null) { |
5444 |
if(!empty($type_mise_a_jour) and !empty($date) and !empty($code_barres)) { |
if(!empty($type_mise_a_jour) and !empty($date) and !empty($code_barres)) { |
5445 |
|
|
5446 |
// Vérification de l'existence de l'instruction |
// Vérification de l'existence de l'instruction |
5456 |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
ON dossier_autorisation_type_detaille.dossier_autorisation_type = dossier_autorisation_type.dossier_autorisation_type |
5457 |
INNER JOIN ".DB_PREFIXE."groupe |
INNER JOIN ".DB_PREFIXE."groupe |
5458 |
ON dossier_autorisation_type.groupe = groupe.groupe |
ON dossier_autorisation_type.groupe = groupe.groupe |
|
AND groupe.code != 'CTX' |
|
5459 |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
WHERE code_barres='".$this->f->db->escapesimple($code_barres)."'"; |
5460 |
$res = $f->db->query($sql); |
|
5461 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
// Ajout d'un filtre sur les groupes auxquels l'utilisateur a accès |
5462 |
$f->isDatabaseError($res); |
$group_clause = array(); |
5463 |
|
foreach ($_SESSION["groupe"] as $key => $value) { |
5464 |
|
$group_clause[$key] = "(groupe.code = '".$key."'"; |
5465 |
|
if($value["confidentiel"] !== true) { |
5466 |
|
$group_clause[$key] .= " AND dossier_autorisation_type.confidentiel IS NOT TRUE"; |
5467 |
|
} |
5468 |
|
$group_clause[$key] .= ")"; |
5469 |
|
} |
5470 |
|
$conditions = implode(" OR ", $group_clause); |
5471 |
|
$sql .= " AND (" . $conditions . ")"; |
5472 |
|
|
5473 |
|
|
5474 |
|
$res = $this->f->db->query($sql); |
5475 |
|
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
5476 |
|
$this->f->isDatabaseError($res); |
5477 |
|
|
5478 |
if($res->numrows() == 1) { |
if($res->numrows() == 1) { |
5479 |
$liste_champs = explode(";", $type_mise_a_jour); |
$liste_champs = explode(";", $type_mise_a_jour); |
5480 |
// Mise à jour des dates après l'écran de verification |
// Mise à jour des dates après l'écran de verification |
5481 |
if($f->get_submitted_post_value('is_valid') !== null and $f->get_submitted_post_value('is_valid') == "true") { |
if($this->f->get_submitted_post_value('is_valid') !== null and $this->f->get_submitted_post_value('is_valid') == "true") { |
|
require_once '../obj/instruction.class.php'; |
|
5482 |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
$row =& $res->fetchRow(DB_FETCHMODE_ASSOC); |
5483 |
$instr = new instruction($row['instruction'], $f->db, DEBUG); |
$instr = $this->f->get_inst__om_dbform(array( |
5484 |
|
"obj" => "instruction", |
5485 |
|
"idx" => $row['instruction'], |
5486 |
|
)); |
5487 |
$valF = array(); |
$valF = array(); |
5488 |
foreach($instr->champs as $id => $champ) { |
foreach($instr->champs as $id => $champ) { |
5489 |
$valF[$champ] = $instr->val[$id]; |
$valF[$champ] = $instr->val[$id]; |
5526 |
$code_barres = ""; |
$code_barres = ""; |
5527 |
|
|
5528 |
//Désactivation de l'autocommit |
//Désactivation de l'autocommit |
5529 |
$f->db->autoCommit(false); |
$this->f->db->autoCommit(false); |
5530 |
|
|
5531 |
//On modifie les valeurs de l'instruction |
//On modifie les valeurs de l'instruction |
5532 |
$instr->setParameter('maj', 170); |
$instr->setParameter('maj', 170); |
5533 |
$instr->class_actions[170]["identifier"] = |
$instr->class_actions[170]["identifier"] = |
5534 |
"mise à jour des dates (depuis le menu suivi des pièces)"; |
"mise à jour des dates (depuis le menu suivi des pièces)"; |
5535 |
$retour = $instr->modifier($valF, $f->db, DEBUG); |
$retour = $instr->modifier($valF); |
5536 |
|
|
5537 |
//Si une erreur s'est produite, on défait les modifications |
//Si une erreur s'est produite, on défait les modifications |
5538 |
//qui ont été faites |
//qui ont été faites |
5541 |
} |
} |
5542 |
//Sinon, on valide en base de données les modifications |
//Sinon, on valide en base de données les modifications |
5543 |
else { |
else { |
5544 |
$f->db->commit(); |
$this->f->db->commit(); |
5545 |
} |
} |
5546 |
|
|
5547 |
// Variable correct retourné depuis la classe instruction |
// Variable correct retourné depuis la classe instruction |
5582 |
INNER JOIN ".DB_PREFIXE."evenement ON |
INNER JOIN ".DB_PREFIXE."evenement ON |
5583 |
instruction.evenement=evenement.evenement |
instruction.evenement=evenement.evenement |
5584 |
WHERE code_barres='".$code_barres."'"; |
WHERE code_barres='".$code_barres."'"; |
5585 |
$resInfo = $f->db->query($sqlInfo); |
$resInfo = $this->f->db->query($sqlInfo); |
5586 |
$f->isDatabaseError($resInfo); |
$this->f->isDatabaseError($resInfo); |
5587 |
$infos = $resInfo->fetchRow(DB_FETCHMODE_ASSOC); |
$infos = $resInfo->fetchRow(DB_FETCHMODE_ASSOC); |
5588 |
|
|
5589 |
// Vérification de la non modification des dates de suivi |
// Vérification de la non modification des dates de suivi |
5608 |
*/ |
*/ |
5609 |
// Affichage du message de validation ou d'erreur |
// Affichage du message de validation ou d'erreur |
5610 |
if (isset($message) && isset($message_class) && $message != "") { |
if (isset($message) && isset($message_class) && $message != "") { |
5611 |
$f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
5612 |
} |
} |
5613 |
// Affichage du message d'erreur |
// Affichage du message d'erreur |
5614 |
if(!empty($error)) { |
if(!empty($error)) { |
5615 |
$f->displayMessage("error", $error); |
$this->f->displayMessage("error", $error); |
5616 |
} |
} |
5617 |
|
|
5618 |
// Affichage du message de validation de la saisie |
// Affichage du message de validation de la saisie |
5619 |
if($correct === true) { |
if($correct === true) { |
5620 |
$f->displayMessage("ok", _("Saisie enregistree")); |
$this->f->displayMessage("ok", _("Saisie enregistree")); |
5621 |
} |
} |
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
5622 |
// Ouverture du formulaire |
// Ouverture du formulaire |
5623 |
echo "\t<form"; |
echo "\t<form"; |
5624 |
echo " method=\"post\""; |
echo " method=\"post\""; |
5636 |
$champs = array("type_mise_a_jour", "date", "code_barres"); |
$champs = array("type_mise_a_jour", "date", "code_barres"); |
5637 |
} |
} |
5638 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
5639 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
5640 |
|
"validation" => 0, |
5641 |
|
"maj" => 0, |
5642 |
|
"champs" => $champs, |
5643 |
|
)); |
5644 |
// Paramétrage des champs du formulaire |
// Paramétrage des champs du formulaire |
5645 |
// Parametrage du champ type_mise_a_jour |
// Parametrage du champ type_mise_a_jour |
5646 |
$form->setLib("type_mise_a_jour", _("Date a mettre a jour")."* :"); |
$form->setLib("type_mise_a_jour", _("Date a mettre a jour")."* :"); |
5670 |
$contenu[1][4] = _("date de retour de controle de legalite"); |
$contenu[1][4] = _("date de retour de controle de legalite"); |
5671 |
|
|
5672 |
$contenu[0][5] = "date_retour_rar"; |
$contenu[0][5] = "date_retour_rar"; |
5673 |
$contenu[1][5] = _("date de retour de l'AR"); |
$contenu[1][5] = __("date de notification du correspondant"); |
5674 |
|
|
5675 |
$form->setSelect("type_mise_a_jour", $contenu); |
$form->setSelect("type_mise_a_jour", $contenu); |
5676 |
|
|
5730 |
$form->setType("autorite_competente", "static"); |
$form->setType("autorite_competente", "static"); |
5731 |
$form->setVal("autorite_competente", $infos['autorite_competente']); |
$form->setVal("autorite_competente", $infos['autorite_competente']); |
5732 |
|
|
5733 |
// Parametrage des libellés d'envoi avec RAR |
// Parametrage des libellés d'envoi avec AR |
5734 |
$form->setLib("date_envoi_rar", _("date_envoi_rar")." :"); |
$form->setLib("date_envoi_rar", __("date_envoi_ar")." :"); |
5735 |
$form->setLib("date_retour_rar", _("date_retour_rar")." :"); |
$form->setLib("date_retour_rar", __("date_notification")." :"); |
5736 |
|
|
5737 |
$form->setLib("date_envoi_signature", _("date_envoi_signature")." :"); |
$form->setLib("date_envoi_signature", _("date_envoi_signature")." :"); |
5738 |
$form->setLib("date_retour_signature", _("date_retour_signature")." :"); |
$form->setLib("date_retour_signature", _("date_retour_signature")." :"); |
5766 |
echo "\t<div class=\"formControls\">\n"; |
echo "\t<div class=\"formControls\">\n"; |
5767 |
// |
// |
5768 |
if(!$date_error) { |
if(!$date_error) { |
5769 |
$f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
$this->f->layout->display_form_button(array("value" => _("Valider"), "name" => "validation")); |
5770 |
} |
} |
5771 |
// Si pas sur l'écran de validation |
// Si pas sur l'écran de validation |
5772 |
if(isset($infos)) { |
if(isset($infos)) { |
5773 |
echo "<a class=\"retour\" href=\"../scr/form.php?obj=instruction_suivi_mise_a_jour_des_dates&action=170&idx=0"; |
echo "<a class=\"retour\" href=\"".OM_ROUTE_FORM."&obj=instruction_suivi_mise_a_jour_des_dates&action=170&idx=0"; |
5774 |
echo "&type_mise_a_jour=".$type_mise_a_jour."&date=".$date."&code_barres=".$code_barres; |
echo "&type_mise_a_jour=".$type_mise_a_jour."&date=".$date."&code_barres=".$code_barres; |
5775 |
echo "\">Retour</a>"; |
echo "\">Retour</a>"; |
5776 |
} |
} |
5787 |
function view_pdf_lettre_rar() { |
function view_pdf_lettre_rar() { |
5788 |
// Vérification de l'accessibilité sur l'élément |
// Vérification de l'accessibilité sur l'élément |
5789 |
$this->checkAccessibility(); |
$this->checkAccessibility(); |
5790 |
|
// |
5791 |
|
$this->f->disableLog(); |
5792 |
|
|
5793 |
// XXX APP |
if($this->f->get_submitted_get_value('liste') != null) { |
5794 |
|
$listeCodeBarres = explode(',',$this->f->get_submitted_get_value('liste')); |
|
$f = $this->f; |
|
|
|
|
|
$f->disableLog(); |
|
|
|
|
|
if($f->get_submitted_get_value('liste') != null) { |
|
|
$listeCodeBarres = explode(',',$f->get_submitted_get_value('liste')); |
|
5795 |
|
|
5796 |
// Classe permettant la mise en page de l'édition pdf |
// Classe permettant la mise en page de l'édition pdf |
5797 |
require_once "../obj/pdf_lettre_rar.class.php"; |
require_once "../obj/pdf_lettre_rar.class.php"; |
5798 |
$pdf_lettre_rar = new pdf_lettre_rar('P', 'mm', 'A4'); |
$pdf_lettre_rar = new pdf_lettre_rar('P', 'mm', 'A4'); |
5799 |
// Initialisation de la mise en page |
// Initialisation de la mise en page |
5800 |
$pdf_lettre_rar->init($f); |
$pdf_lettre_rar->init($this->f); |
5801 |
|
|
5802 |
foreach ($listeCodeBarres as $code_barres) { |
foreach ($listeCodeBarres as $code_barres) { |
5803 |
|
|
5804 |
|
// On récupère le dossier |
5805 |
|
$sql = "SELECT dossier |
5806 |
|
FROM " . DB_PREFIXE . "instruction |
5807 |
|
WHERE code_barres = '" . $code_barres . "'"; |
5808 |
|
$dossier = $this->f->db->getOne($sql); |
5809 |
|
$this->f->addToLog(__METHOD__."(): db->getOne(\"".$sql."\")", VERBOSE_MODE); |
5810 |
|
$this->f->isDatabaseError($dossier); |
5811 |
|
$inst_dossier = $this->f->get_inst__om_dbform(array( |
5812 |
|
"obj" => "dossier", |
5813 |
|
"idx" => $dossier, |
5814 |
|
)); |
5815 |
|
|
5816 |
|
// En fonction du type de dossier, on récupère un demandeur différent dans les requêtes |
5817 |
|
$groupe = $inst_dossier->get_type_affichage_formulaire(); |
5818 |
|
switch ($groupe) { |
5819 |
|
case 'CTX IN': |
5820 |
|
$sql_demandeur = "(lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='plaignant')"; |
5821 |
|
break; |
5822 |
|
case 'CTX RE': |
5823 |
|
$sql_demandeur = "(lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='requerant')"; |
5824 |
|
break; |
5825 |
|
case 'ADS': |
5826 |
|
case 'DPC': |
5827 |
|
default: |
5828 |
|
$sql_demandeur = "((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') OR demandeur.type_demandeur='delegataire')"; |
5829 |
|
break; |
5830 |
|
} |
5831 |
|
|
5832 |
// Test si l'evenement est de type arrete et si un délégataire a été nommé |
// Test si l'evenement est de type arrete et si un délégataire a été nommé |
5833 |
$sql = "SELECT |
$sql = "SELECT |
5834 |
dossier.dossier_libelle, |
dossier.dossier_libelle, |
5854 |
inner join ".DB_PREFIXE."demandeur on |
inner join ".DB_PREFIXE."demandeur on |
5855 |
demandeur.demandeur=lien_dossier_demandeur.demandeur |
demandeur.demandeur=lien_dossier_demandeur.demandeur |
5856 |
WHERE code_barres='".$code_barres."' |
WHERE code_barres='".$code_barres."' |
5857 |
AND ((lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire') |
AND " . $sql_demandeur . " |
|
OR demandeur.type_demandeur='delegataire') |
|
5858 |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
GROUP BY dossier.dossier_libelle, evenement.type, phase.code, division.libelle"; |
5859 |
|
|
5860 |
$res = $f->db->query($sql); |
$res = $this->f->db->query($sql); |
5861 |
$f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sql."\")", VERBOSE_MODE); |
5862 |
$f->isDatabaseError($res); |
$this->f->isDatabaseError($res); |
5863 |
$testDemandeur = $res->fetchrow(DB_FETCHMODE_ASSOC); |
$testDemandeur = $res->fetchrow(DB_FETCHMODE_ASSOC); |
5864 |
|
|
5865 |
|
|
5908 |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
if($testDemandeur['type'] != 'arrete' AND $testDemandeur['nbdemandeur'] > 1) { |
5909 |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
$sqlAdresse .= " AND demandeur.type_demandeur='delegataire'"; |
5910 |
} else { |
} else { |
5911 |
$sqlAdresse .= " AND lien_dossier_demandeur.petitionnaire_principal IS TRUE AND demandeur.type_demandeur='petitionnaire'"; |
$sqlAdresse .= " AND demandeur.type_demandeur='petitionnaire' AND lien_dossier_demandeur.petitionnaire_principal IS TRUE"; |
5912 |
} |
} |
5913 |
|
|
5914 |
$resAdresse = $f->db->query($sqlAdresse); |
$resAdresse = $this->f->db->query($sqlAdresse); |
5915 |
$adresse_dest = $resAdresse->fetchrow(DB_FETCHMODE_ASSOC); |
$adresse_dest = $resAdresse->fetchrow(DB_FETCHMODE_ASSOC); |
5916 |
$f->addToLog(__METHOD__.": db->query(\"".$sqlAdresse."\")", VERBOSE_MODE); |
$this->f->addToLog(__METHOD__.": db->query(\"".$sqlAdresse."\")", VERBOSE_MODE); |
5917 |
$f->isDatabaseError($resAdresse); |
$this->f->isDatabaseError($resAdresse); |
5918 |
|
|
5919 |
// Création adresse destinataire sans ligne vide |
// Création adresse destinataire sans ligne vide |
5920 |
$adresse_destinataire = array(); |
$adresse_destinataire = array(); |
5944 |
$specifique_content[] = $testDemandeur['dossier_libelle']; |
$specifique_content[] = $testDemandeur['dossier_libelle']; |
5945 |
$specifique_content[] = "|||||".$adresse_dest['code_barres']."|||||"; |
$specifique_content[] = "|||||".$adresse_dest['code_barres']."|||||"; |
5946 |
unset($adresse_dest['code_barres']); |
unset($adresse_dest['code_barres']); |
|
|
|
5947 |
// Ajout d'une page aux pdf |
// Ajout d'une page aux pdf |
5948 |
$pdf_lettre_rar->addLetter($adresse_destinataire, $specifique_content, $testDemandeur['code_phase']); |
$pdf_lettre_rar->addLetter($adresse_destinataire, $specifique_content, $testDemandeur['code_phase']); |
5949 |
|
|
5950 |
} |
} |
5951 |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
5952 |
require_once PATH_OPENMAIRIE."om_edition.class.php"; |
$om_edition = $this->f->get_inst__om_edition(); |
|
$om_edition = new edition(); |
|
5953 |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
5954 |
} |
} |
5955 |
} |
} |
6012 |
$message .= "<a class='om-prev-icon pdf-16'"; |
$message .= "<a class='om-prev-icon pdf-16'"; |
6013 |
$message .= " id=\"generer_bordereau_envoi_maire\""; |
$message .= " id=\"generer_bordereau_envoi_maire\""; |
6014 |
$message .= " title=\""._("Bordereau")."\""; |
$message .= " title=\""._("Bordereau")."\""; |
6015 |
$message .= " href='../scr/form.php?obj=instruction"; |
$message .= " href='".OM_ROUTE_FORM."&obj=instruction"; |
6016 |
$message .= "&action=200"; |
$message .= "&action=200"; |
6017 |
$message .= "&idx=".$id_instruction."'"; |
$message .= "&idx=".$id_instruction."'"; |
6018 |
$message .= " target='_blank'>"; |
$message .= " target='_blank'>"; |
6053 |
$this->f->displayMessage($message_class, $message); |
$this->f->displayMessage($message_class, $message); |
6054 |
} |
} |
6055 |
|
|
|
// Inclusion de la classe de gestion des formulaires |
|
|
require_once "../obj/om_formulaire.class.php"; |
|
6056 |
// Ouverture du formulaire |
// Ouverture du formulaire |
6057 |
$datasubmit = $this->getDataSubmit(); |
$datasubmit = $this->getDataSubmit(); |
6058 |
echo "\n<!-- ########## START DBFORM ########## -->\n"; |
echo "\n<!-- ########## START DBFORM ########## -->\n"; |
6069 |
$champs = array("code_barres","date"); |
$champs = array("code_barres","date"); |
6070 |
|
|
6071 |
// Création d'un nouvel objet de type formulaire |
// Création d'un nouvel objet de type formulaire |
6072 |
$form = new formulaire(NULL, 0, 0, $champs); |
$form = $this->f->get_inst__om_formulaire(array( |
6073 |
|
"validation" => 0, |
6074 |
|
"maj" => 0, |
6075 |
|
"champs" => $champs, |
6076 |
|
)); |
6077 |
|
|
6078 |
$template_required_label = '%s *'; |
$template_required_label = '%s *'; |
6079 |
// Parametrage du champ code_barres |
// Parametrage du champ code_barres |
6179 |
// Begin |
// Begin |
6180 |
$this->begin_treatment(__METHOD__); |
$this->begin_treatment(__METHOD__); |
6181 |
// Requête |
// Requête |
6182 |
$res = $this->db->autoExecute( |
$res = $this->f->db->autoExecute( |
6183 |
DB_PREFIXE.$this->table, |
DB_PREFIXE.$this->table, |
6184 |
$valF, |
$valF, |
6185 |
DB_AUTOQUERY_UPDATE, |
DB_AUTOQUERY_UPDATE, |
6198 |
* validation du formulaire d'ajout. |
* validation du formulaire d'ajout. |
6199 |
* @param array $val tableau des valeurs retournées par le formulaire |
* @param array $val tableau des valeurs retournées par le formulaire |
6200 |
*/ |
*/ |
6201 |
function setValFAjout($val) { |
function setValFAjout($val = array()) { |
6202 |
// Mise à jour du flag created_by_commune lors d'un changement de décision |
// Mise à jour du flag created_by_commune lors d'un changement de décision |
6203 |
// par un utilisateur de commune sur un dossier instruit par la comcom |
// par un utilisateur de commune sur un dossier instruit par la comcom |
6204 |
if ($this->isInstrCanChangeDecision($this->valF["dossier"])) { |
if ($this->isInstrCanChangeDecision($this->valF["dossier"])) { |
6205 |
$this->valF['created_by_commune'] = true; |
$this->valF['created_by_commune'] = true; |
6206 |
} |
} |
6207 |
|
|
6208 |
|
// |
6209 |
|
if ($this->evenement_has_an_edition($this->valF['evenement']) === false) { |
6210 |
|
if (isset($this->valF['flag_edition_integrale']) === true) { |
6211 |
|
unset($this->valF['flag_edition_integrale']); |
6212 |
|
} |
6213 |
|
if (isset($this->valF['signataire_arrete']) === true) { |
6214 |
|
unset($this->valF['signataire_arrete']); |
6215 |
|
} |
6216 |
|
} |
6217 |
} |
} |
6218 |
|
|
6219 |
|
|
6478 |
*/ |
*/ |
6479 |
public function formater_modele($modele, $id_di, $id_inst) { |
public function formater_modele($modele, $id_di, $id_inst) { |
6480 |
// Création du lien d'accès direct à l'instruction |
// Création du lien d'accès direct à l'instruction |
6481 |
$url_inst = PATH_BASE_URL.'spg/direct_link.php?obj=dossier_instruction&action=3'. |
$url_inst = PATH_BASE_URL.'app/index.php?module=form&direct_link=true&obj=dossier_instruction&action=3'. |
6482 |
'&direct_field=dossier&direct_form=instruction&direct_action=3&direct_idx='.$id_inst; |
'&direct_field=dossier&direct_form=instruction&direct_action=3&direct_idx='.$id_inst; |
6483 |
$url_inst = '<a href="'.$url_inst.'">'.$url_inst.'</a>'; |
$url_inst = '<a href="'.$url_inst.'">'.$url_inst.'</a>'; |
6484 |
// Remplacement des champs de fusion |
// Remplacement des champs de fusion |
6580 |
$this->f->get_submitted_get_value('idxformulaire') : $id_dossier = ""); |
$this->f->get_submitted_get_value('idxformulaire') : $id_dossier = ""); |
6581 |
// |
// |
6582 |
if ($id_dossier !== "") { |
if ($id_dossier !== "") { |
6583 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
6584 |
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
"obj" => "dossier_instruction", |
6585 |
|
"idx" => $id_dossier, |
6586 |
|
)); |
6587 |
// |
// |
6588 |
return $dossier->can_user_access_dossier(); |
return $dossier->can_user_access_dossier(); |
6589 |
} |
} |
6603 |
$id_dossier = $this->getVal('dossier'); |
$id_dossier = $this->getVal('dossier'); |
6604 |
// |
// |
6605 |
if ($id_dossier !== "" && $id_dossier !== null) { |
if ($id_dossier !== "" && $id_dossier !== null) { |
6606 |
require_once "../obj/dossier_instruction.class.php"; |
$dossier = $this->f->get_inst__om_dbform(array( |
6607 |
$dossier = new dossier_instruction($id_dossier, $f->db, DEBUG); |
"obj" => "dossier_instruction", |
6608 |
|
"idx" => $id_dossier, |
6609 |
|
)); |
6610 |
// |
// |
6611 |
return $dossier->can_user_access_dossier(); |
return $dossier->can_user_access_dossier(); |
6612 |
} |
} |
6613 |
return false; |
return false; |
6614 |
} |
} |
6615 |
|
|
6616 |
}// fin classe |
/** |
6617 |
|
* Retourne le lien de retour (VIEW formulaire et VIEW sousformulaire). |
6618 |
|
* |
6619 |
|
* @param string $view Appel dans le contexte de la vue 'formulaire' ou de |
6620 |
|
* la vue 'sousformulaire'. |
6621 |
|
* |
6622 |
|
* @return string |
6623 |
|
*/ |
6624 |
|
function get_back_link($view = "formulaire") { |
6625 |
|
// |
6626 |
|
$href = parent::get_back_link($view); |
6627 |
|
// |
6628 |
|
$crud = $this->get_action_crud(); |
6629 |
|
|
6630 |
|
// Redirection vers le formulaire de modification à la validation du |
6631 |
|
// formulaire d'ajout si l'événement associé possède une lettre type |
6632 |
|
if (($crud === 'create' |
6633 |
|
|| ($crud === null |
6634 |
|
&& $this->getParameter('maj') == 0)) |
6635 |
|
&& $this->correct == true |
6636 |
|
&& $this->evenement_has_an_edition($this->valF['evenement']) === true) { |
6637 |
|
|
6638 |
|
// On instancie l'instruction |
6639 |
|
$inst_instruction = $this->f->get_inst__om_dbform(array( |
6640 |
|
"obj" => "instruction", |
6641 |
|
"idx" => $this->valF[$this->clePrimaire], |
6642 |
|
)); |
6643 |
|
|
6644 |
|
// Si l'instruction n'est pas finalisée automatiquement |
6645 |
|
if ($inst_instruction->getVal('om_final_instruction') !== 't') { |
6646 |
|
$href = str_replace("&action=3", "&action=1", $href); |
6647 |
|
// |
6648 |
|
if (strpos($href, "&retour=tab") !== false) { |
6649 |
|
$href = str_replace("&retour=tab", "&retour= form", $href); |
6650 |
|
} else { |
6651 |
|
$href .= "&retour=form"; |
6652 |
|
} |
6653 |
|
} |
6654 |
|
} |
6655 |
|
|
6656 |
?> |
// |
6657 |
|
return $href; |
6658 |
|
} |
6659 |
|
|
6660 |
|
}// fin classe |