/[openfoncier]/trunk/obj/consultation.class.php
ViewVC logotype

Contents of /trunk/obj/consultation.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 429 - (show annotations)
Mon Sep 24 15:08:54 2012 UTC (12 years, 4 months ago) by nhaye
File size: 3776 byte(s)
Régénération suite à la migration d'OM 4.3.0

1 <?php
2 //$Id$
3 //gen openMairie le 10/02/2011 20:32
4 require_once ("../gen/obj/consultation.class.php");
5
6 class consultation extends consultation_gen {
7
8 function consultation($id,&$db,$debug) {
9 $this->constructeur($id,$db,$debug);
10 }// fin constructeur
11
12 function setValFAjout($val){
13 $this->valF['service'] = $val['service'];
14 }
15 function setvalF($val){
16 parent::setvalF($val);
17 // cles secondaires numerique (contrainte integrite pgsql)
18 if($val['avis']=='') $this->valF['avis']= null;
19 }
20 function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){
21 if ($validation==0) {
22 if ($maj == 0){
23 $form->setVal("dossier", $idxformulaire);
24 }
25 }
26 }
27
28 function setType(&$form,$maj) {
29 if ($maj < 2) { //ajouter et modifier [add and modify]
30 if($maj==0){ // add
31 $form->setType('date_envoi', 'date2');
32 $form->setType('service', 'select');
33 $form->setType('date_limite', 'hidden');
34 $form->setType('date_retour', 'hidden');
35 $form->setType('avis', 'hidden');
36 }else{ // modify
37 $form->setType('date_envoi', 'hiddenstaticdate');
38 $form->setType('service', 'selectdisabled');
39 $form->setType('date_limite', 'date2');
40 $form->setType('date_retour', 'date2');
41 $form->setType('avis', 'select');
42 }
43 $form->setType('consultation', 'hiddenstatic');
44 $form->setType('dossier', 'hiddenstatic');
45 }else{ // supprimer
46 $form->setType('consultation', 'hiddenstatic');
47 $form->setType('dossier', 'hiddenstatic');
48 }
49 }
50
51 // TRIGGER AVANT MODIFICATION DE DONNEES
52 // trigger before modification data
53 function triggerajouter($id,&$db,$val,$DEBUG) {
54 // mise a jour instruction avec evenement [return delay]
55 if (!$this->valF['date_envoi']==""){
56 $sql= "select delai from ".DB_PREFIXE."service where service ='".$this->valF['service']."'";
57 $delai = $db->getOne($sql);
58 $this->valF['date_limite'] = $this->moisdate($this->valF['date_envoi'],$delai);
59 $this->msg=$this->msg."<br>"._("delai")." ".
60 _("retour")." ".$delai." "._("mois")." -> ".
61 _("retour")." ".$this->valF['date_limite']."<br>";
62 }
63 }
64
65 // =============================================
66 // calcul de date avec ajout de mois (delais)
67 // [add months (delay) and calculation final date]
68 // limite ? => voir fonction instruction
69 // =============================================
70 function moisdate($date,$delaimois) {
71 // rajout de mois à une date (moins de 12)
72 $temp = explode("-" , $date);
73 $jour = (int) $temp[2];
74 $mois = (int) $temp[1];
75 $annee = (int) $temp[0];
76 $mois=$mois+$delaimois;
77 // calcul mois annee
78 if($mois>12){
79 $mois=$mois-12;
80 $annee=$annee+1;
81 }
82 // Calcul du nombre de jours dans le mois sélectionné
83 switch($mois) {
84 case "2":
85 if ($annee % 4 == 0 && $annee % 100 != 0 || $annee % 400 == 0)
86 $jourmax = 29;
87 else
88 $jourmax = 28;
89 break;
90 case "4":
91 case "6":
92 case "9":
93 case "11":
94 $jourmax = 30;
95 break;
96 default:
97 $jourmax = 31;
98 }
99 if ($jour > $jourmax)
100 $jour = $jourmax;
101 return $annee."-".$mois."-".$jour ;
102 }
103
104 }// fin classe
105 ?>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26