示例#1
0
 /**
  * Find the next occurence of similar Plageconsult
  * using the _type_repeat form field
  *
  * @return int Number of weeks jumped
  */
 function becomeNext()
 {
     $week_jumped = 0;
     switch ($this->_type_repeat) {
         case "octuple":
             $this->date = CMbDT::date("+8 WEEK", $this->date);
             // 8
             $week_jumped += 8;
             break;
         case "septuple":
             $this->date = CMbDT::date("+7 WEEK", $this->date);
             // 7
             $week_jumped += 7;
             break;
         case "sextuple":
             $this->date = CMbDT::date("+6 WEEK", $this->date);
             // 6
             $week_jumped += 6;
             break;
         case "quintuple":
             $this->date = CMbDT::date("+5 WEEK", $this->date);
             // 5
             $week_jumped += 5;
             break;
         case "quadruple":
             $this->date = CMbDT::date("+4 WEEK", $this->date);
             // 4
             $week_jumped += 4;
             break;
         case "triple":
             $this->date = CMbDT::date("+3 WEEK", $this->date);
             // 3
             $week_jumped += 3;
             break;
         case "double":
             $this->date = CMbDT::date("+2 WEEK", $this->date);
             // 2
             $week_jumped += 2;
             break;
         case "simple":
             $this->date = CMbDT::date("+1 WEEK", $this->date);
             // 1
             $week_jumped++;
             break;
         case "sameweek":
             $week_number = CMbDate::weekNumberInMonth($this->date);
             $next_month = CMbDate::monthNumber(CMbDT::date("+1 MONTH", $this->date));
             $i = 0;
             do {
                 $this->date = CMbDT::date("+1 WEEK", $this->date);
                 $week_jumped++;
                 $i++;
             } while ($i < 10 && CMbDate::monthNumber($this->date) < $next_month || CMbDate::weekNumberInMonth($this->date) != $week_number);
             break;
         default:
             return ++$week_jumped;
     }
     // Stockage des champs modifiés
     $debut = $this->debut;
     $fin = $this->fin;
     $freq = $this->freq;
     $libelle = $this->libelle;
     if ($this->_propagation) {
         $locked = $this->locked;
         $pour_tiers = $this->pour_tiers;
     }
     $color = $this->color;
     $desistee = $this->desistee;
     $remplacant_id = $this->remplacant_id;
     $pour_compte_id = $this->pour_compte_id;
     // Recherche de la plage suivante
     $where["date"] = "= '{$this->date}'";
     $where["chir_id"] = "= '{$this->chir_id}'";
     $where[] = "`debut` = '{$this->debut}' OR `fin` = '{$this->fin}'";
     if (!$this->loadObject($where)) {
         $this->plageconsult_id = null;
     }
     // Remise en place des champs modifiés
     $this->debut = $debut;
     $this->fin = $fin;
     $this->freq = $freq;
     $this->libelle = $libelle;
     if ($this->_propagation) {
         $this->locked = $locked;
         $this->pour_tiers = $pour_tiers;
     }
     $this->color = $color;
     $this->desistee = $desistee;
     $this->remplacant_id = $remplacant_id;
     $this->pour_compte_id = $pour_compte_id;
     $this->updateFormFields();
     return $week_jumped;
 }
示例#2
0
 /**
  * find the next plageop according
  * to the current plageop parameters
  * return the number of weeks jumped
  *
  * @param int $init_salle_id              Salle initiale
  * @param int $init_chir_id               Chirurgien intial
  * @param int $init_spec_id               Spécialité intiale
  * @param int $init_secondary_function_id Spécialité secondaire initiale
  *
  * @return int
  */
 function becomeNext($init_salle_id = null, $init_chir_id = null, $init_spec_id = null, $init_secondary_function_id = null)
 {
     $week_jumped = 0;
     if (!$this->_type_repeat) {
         $this->_type_repeat = "simple";
     }
     switch ($this->_type_repeat) {
         case "quadruple":
             $this->date = CMbDT::date("+4 WEEK", $this->date);
             $week_jumped += 4;
             break;
         case "triple":
             $this->date = CMbDT::date("+3 WEEK", $this->date);
             $week_jumped += 3;
             break;
         case "double":
             $this->date = CMbDT::date("+2 WEEK", $this->date);
             $week_jumped += 2;
             break;
         case "simple":
             $this->date = CMbDT::date("+1 WEEK", $this->date);
             $week_jumped++;
             break;
         case "sameweek":
             $week_number = CMbDate::weekNumberInMonth($this->date);
             $next_month = CMbDate::monthNumber(CMbDT::date("+1 MONTH", $this->date));
             $i = 0;
             do {
                 $this->date = CMbDT::date("+1 WEEK", $this->date);
                 $week_jumped++;
                 $i++;
             } while ($i < 10 && CMbDate::monthNumber($this->date) < $next_month || CMbDate::weekNumberInMonth($this->date) != $week_number);
             break;
     }
     // Stockage des champs modifiés
     $salle_id = $this->salle_id;
     $chir_id = $this->chir_id;
     $spec_id = $this->spec_id;
     $secondary_function_id = $this->secondary_function_id === null ? "" : $this->secondary_function_id;
     $debut = $this->debut;
     $fin = $this->fin;
     $temps_inter_op = $this->temps_inter_op;
     $max_intervention = $this->max_intervention;
     $anesth_id = $this->anesth_id;
     $delay_repl = $this->delay_repl;
     $spec_repl_id = $this->spec_repl_id;
     $type_repeat = $this->_type_repeat;
     $unique_chir = $this->unique_chir;
     // Recherche de la plage suivante
     $where = array();
     $where["date"] = "= '{$this->date}'";
     $where[] = "`debut` = '{$this->debut}' OR `fin` = '{$this->fin}'";
     $where["salle_id"] = $init_salle_id ? "= '{$init_salle_id}'" : "= '{$this->salle_id}'";
     if ($chir_id || $init_chir_id) {
         $where["chir_id"] = $init_chir_id ? "= '{$init_chir_id}'" : "= '{$chir_id}'";
     } else {
         $where["spec_id"] = $init_spec_id ? "= '{$init_spec_id}'" : "= '{$spec_id}'";
     }
     if ($secondary_function_id || $init_secondary_function_id) {
         $where["secondary_function_id"] = $init_secondary_function_id ? "= '{$init_secondary_function_id}'" : "= '{$secondary_function_id}'";
     }
     $plages = $this->loadList($where);
     if (count($plages) > 0) {
         $this->load(reset($plages)->plageop_id);
     } else {
         $this->plageop_id = null;
     }
     if (!$this->chir_id) {
         $this->chir_id = "";
     }
     if (!$this->spec_id) {
         $this->spec_id = "";
     }
     // Remise en place des champs modifiés
     $this->salle_id = $salle_id;
     $this->chir_id = $chir_id;
     $this->secondary_function_id = $secondary_function_id;
     $this->spec_id = $spec_id;
     $this->debut = $debut;
     $this->fin = $fin;
     $this->temps_inter_op = $temps_inter_op;
     $this->max_intervention = $max_intervention;
     $this->anesth_id = $anesth_id;
     $this->delay_repl = $delay_repl;
     $this->spec_repl_id = $spec_repl_id;
     $this->_type_repeat = $type_repeat;
     $this->unique_chir = $unique_chir;
     $this->updateFormFields();
     return $week_jumped;
 }