function updateFormFields()
 {
     parent::updateFormFields();
     $this->_hour_deb = CMbDT::transform($this->debut, null, "%H");
     $this->_hour_fin = CMbDT::transform($this->fin, null, "%H");
     // State rules
     if ($this->paye == 1) {
         $this->_state = self::PAYED;
     } elseif ($this->date < CMbDT::date()) {
         $this->_state = self::OUT;
     } elseif ($this->prat_id) {
         if (CMbDT::date("+ 15 DAYS") > $this->date) {
             $this->_state = self::BLOCKED;
         } else {
             $this->_state = self::BUSY;
         }
     } elseif (CMbDT::date("+ 1 MONTH") < $this->date) {
         $this->_state = self::FREEB;
     } else {
         $this->_state = self::FREE;
     }
 }
Exemplo n.º 2
0
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("pour_compte_id", "chir_id");
     $change_pour_compte = $this->fieldModified("pour_compte_id");
     if ($msg = parent::store()) {
         return $msg;
     }
     if ($change_pour_compte) {
         $consults = $this->loadRefsConsultations();
         foreach ($consults as $_consult) {
             $facture = $_consult->loadRefFacture();
             $facture->praticien_id = $this->pour_compte_id ? $this->pour_compte_id : $this->chir_id;
             $facture->store();
         }
     }
     // pause
     if ($this->_update_pause && $this->_pause && $this->_pause_repeat_time) {
         $consult = new CConsultation();
         $where = array();
         $where["plageconsult_id"] = " = '{$this->_id}' ";
         $where["patient_id"] = " IS NULL";
         $consult->loadObject($where);
         $consult->plageconsult_id = $this->_id;
         $consult->heure = $this->_pause;
         $consult->duree = $this->_pause_repeat_time;
         $consult->chrono = 16;
         $consult->_hour = null;
         $consult->_min = null;
         if ($msg = $consult->store()) {
             CAppUI::stepAjax($msg, UI_MSG_WARNING);
         }
     }
     return null;
 }
Exemplo n.º 3
0
 /**
  * @see parent::getPerm()
  */
 function getPerm($permType)
 {
     if (!$this->_id) {
         return parent::getPerm($permType);
     }
     if (!$this->_ref_salle) {
         $this->loadRefSalle();
     }
     if ($this->chir_id && !$this->_ref_chir) {
         $this->loadRefChir();
     }
     if ($this->spec_id && !$this->_ref_spec) {
         $this->loadRefSpec();
     }
     $pratPerm = false;
     // Test de Permission
     if ($this->chir_id) {
         $pratPerm = $this->_ref_chir->getPerm($permType);
     } elseif ($this->spec_id) {
         $pratPerm = $this->_ref_spec->getPerm($permType);
     }
     return $this->_ref_salle->getPerm($permType) && $pratPerm;
 }