예제 #1
0
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("handled");
     if (!$this->creation_date) {
         $this->creation_date = CMbDT::dateTime();
         if ($this->_id) {
             $this->creation_date = $this->loadFirstLog()->date;
         }
     }
     if ($this->fieldModified("handled", "1") || $this->handled && !$this->handled_date && !$this->handled_user_id) {
         $this->handled_date = CMbDT::dateTime();
         $this->handled_user_id = CMediusers::get()->_id;
         if ($this->handled) {
             $last_log = $this->loadLastLog();
             $this->handled_date = $last_log->date;
             $this->handled_user_id = $last_log->user_id;
         }
     }
     if ($this->fieldModified("handled", "0")) {
         $this->handled_date = $this->handled_user_id = "";
     }
     if ($msg = parent::store()) {
         return $msg;
     }
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     // Standard store
     if ($msg = parent::store()) {
         return $msg;
     }
     $this->loadRefFacture();
     return null;
 }
예제 #3
0
 /**
  * Redefinition du store
  * 
  * @return void|string
  **/
 function store()
 {
     if (!$this->_id && $this->object_class && $this->object_id) {
         $this->_ref_object = new $this->object_class();
         $this->_ref_object->load($this->object_id);
         $this->_ref_object->loadRefPatient();
         $this->_ref_object->loadRefPraticien();
         $this->_ref_object->loadRefsObjects();
         $this->_ref_object->loadRefsReglements();
         $this->_ref_object->loadRefsRelances();
         $this->date = CMbDT::date();
         $this->du_patient = $this->_ref_object->_du_restant_patient + $this->_ref_object->_reglements_total_patient;
         $this->du_tiers = $this->_ref_object->_du_restant_tiers + $this->_ref_object->_reglements_total_tiers;
         $der_relance = $this->_ref_object->_ref_last_relance;
         if ($der_relance->_id) {
             if ($der_relance->statut == "inactive") {
                 return "La derniere relance est inactive";
             }
             if ($der_relance->etat != "regle") {
                 $this->numero = $der_relance->numero + 1;
                 $der_relance->etat = "renouvelle";
                 $der_relance->store();
             } else {
                 return "La derniere relance est reglee";
             }
         }
         if (!$this->numero) {
             $this->numero = 1;
         }
         switch ($this->numero) {
             case "1":
                 $this->du_patient += CAppUI::conf("dPfacturation CRelance add_first_relance");
                 $this->statut = "first";
                 break;
             case "2":
                 $this->du_patient += CAppUI::conf("dPfacturation CRelance add_second_relance");
                 $this->statut = "second";
                 break;
             case "3":
                 $this->du_patient += CAppUI::conf("dPfacturation CRelance add_third_relance");
                 $this->statut = "third";
                 break;
         }
     }
     // Standard store
     if ($msg = parent::store()) {
         return $msg;
     }
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     $uf = $this->loadRefUniteFonctionnelle();
     if (count($this->getAffDates($this->loadTargetObject(), $uf->type, $uf->date_debut, $uf->date_fin))) {
         return "Collision d'affection d'unité foncitonnelle";
     }
     return parent::store();
 }
예제 #5
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if ($msg = parent::store()) {
         return $msg;
     }
     return $this->updateMontant();
 }
예제 #6
0
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("etat_envoi");
     $this->completeField("object_class");
     $this->completeField("object_id");
     if ($msg = $this->handleSend()) {
         return $msg;
     }
     return parent::store();
 }
예제 #7
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if (!$this->_id) {
         $this->datetime_create = "now";
     }
     if (!$this->_id && !$this->last_update) {
         $this->last_update = "now";
     }
     return parent::store();
 }
예제 #8
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if (!$this->_id && $this->object_class && $this->object_id && empty($this->comments)) {
         $this->loadTargetObject();
         if ($this->object_class == "COperation") {
             if ($this->_septic) {
                 $this->comments = "Déstérilisé";
             } else {
                 $this->_ref_object->loadRefSejour();
                 $this->_ref_object->_ref_sejour->loadNDA();
                 $num_dos = $this->_ref_object->_ref_sejour->_NDA;
                 $this->comments = "Numéro de séjour: {$num_dos}";
             }
         }
     }
     if (!$this->_id && !$this->address_id) {
         $group = $this->loadRefGroup();
         if ($group->pharmacie_id) {
             $this->address_class = "CFunctions";
             $this->address_id = $group->pharmacie_id;
         } else {
             $this->address_class = "CGroups";
             $this->address_id = $this->group_id;
         }
     }
     // gestion des bons de commandes n'ayant pas de lignes renouvelables
     $this->completeField("object_id", "object_class", "comments");
     if ($this->_order && ($this->object_id || strpos(self::$_return_form_label, $this->comments) === 0) && $this->countRenewedItems() == 0) {
         $this->received = 1;
     }
     if (!$this->_id && empty($this->order_number)) {
         $this->order_number = uniqid(rand());
         if ($msg = parent::store()) {
             return $msg;
         }
         $this->order_number = $this->getUniqueNumber();
     }
     return parent::store();
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     $this->completeField("codes_cim");
     $this->_codes_cim = $this->codes_cim ? explode("|", $this->codes_cim) : array();
     if ($this->_added_code_cim) {
         $da = CCodeCIM10::get($this->_added_code_cim);
         if (!$da->exist) {
             CAppUI::setMsg("Le code CIM saisi n'est pas valide", UI_MSG_WARNING);
             return null;
         }
         $this->_codes_cim[] = $this->_added_code_cim;
     }
     if ($this->_deleted_code_cim) {
         CMbArray::removeValue($this->_deleted_code_cim, $this->_codes_cim);
     }
     $this->codes_cim = implode("|", array_unique($this->_codes_cim));
     $this->completeField("object_id", "object_class");
     if ($this->object_class == "CPatient" && $this->fieldModified("codes_cim")) {
         DSHM::remKeys("alertes-*-CPatient-" . $this->object_id);
     }
     return parent::store();
 }
예제 #10
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if (!$this->_id) {
         $this->datetime_create = CMbDT::dateTime();
         $this->owner_id = CMediusers::get()->_id;
     }
     return parent::store();
 }
예제 #11
0
 /**
  * Redéfinition du store
  * 
  * @return string|null
  */
 function store()
 {
     // Standard store
     if ($msg = parent::store()) {
         return $msg;
     }
     return $this->acquiteFacture();
 }
 function store()
 {
     $msg_alerte = "";
     $manual_alerts = CAppUI::conf("soins Observations manual_alerts", CGroups::loadCurrent());
     if ($manual_alerts) {
         $this->completeField("degre", "text");
         if (!$this->_id || $this->fieldModified("text") || $this->fieldModified("degre")) {
             $msg_alerte = CAppUI::tr("CObservationMedicale-degre") . ": " . $this->getFormattedValue("degre") . "\n" . $this->text;
         }
     }
     if ($msg = parent::store()) {
         return $msg;
     }
     if ($manual_alerts) {
         $this->loadRefAlerte();
         if ($msg_alerte) {
             $this->_ref_alerte->handled = 0;
             $this->_ref_alerte->comments = $msg_alerte;
             if ($msg = $this->_ref_alerte->store()) {
                 return $msg;
             }
         }
     }
     return null;
 }
예제 #13
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if ($msg = $this->check()) {
         return $msg;
     }
     if ($this->_undo) {
         $this->_undo = null;
         return $this->undo();
     }
     return parent::store();
 }
예제 #14
0
 /**
  * @see parent::store()
  */
 function store()
 {
     if ($msg = $this->check()) {
         return $msg;
     }
     $new_object = !$this->_id;
     $now = CMbDT::dateTime();
     if ($new_object) {
         $this->group_id = CGroups::loadCurrent()->_id;
         $this->datetime_create = $now;
         $this->owner_id = CMediusers::get()->_id;
     }
     $this->datetime_edit = $now;
     if ($msg = parent::store()) {
         return $msg;
     }
     // Links
     if ($new_object) {
         $fields = array("object" => array("object_class", "object_id"), "ref1" => array("reference_class", "reference_id"), "ref2" => array("reference2_class", "reference2_id"), "add" => array("additional_class", "additional_id"));
         foreach ($fields as $_level => $_field) {
             if ($this->{$_field[0]} && $this->{$_field[1]}) {
                 $link = new CExLink();
                 $link->object_class = $this->{$_field[0]};
                 $link->object_id = $this->{$_field[1]};
                 $link->group_id = $this->group_id;
                 $link->ex_object_id = $this->_id;
                 $link->ex_class_id = $this->_ex_class_id;
                 $link->level = $_level;
                 if ($msg = $link->store()) {
                     return $msg;
                 }
             }
         }
     }
     return null;
 }
 /**
  * @see parent::store()
  */
 function store()
 {
     // Si une cible est définie, on Unlock la précédente transmission sur la même cible
     // (classe ATC ou catégorie de prescription)
     $this->completeField("sejour_id", "libelle_ATC", "object_id", "object_class");
     if ($this->libelle_ATC || $this->object_id && $this->object_class) {
         $trans = new CTransmissionMedicale();
         if ($this->libelle_ATC) {
             $trans->libelle_ATC = $this->libelle_ATC;
         } else {
             if ($this->object_id && $this->object_class) {
                 $trans->object_class = $this->object_class;
                 $trans->object_id = $this->object_id;
             }
         }
         $trans->sejour_id = $this->sejour_id;
         $trans->locked = 1;
         $trans->loadMatchingObject("transmission_medicale_id DESC");
         if ($trans->_id && $trans->_id != $this->_id) {
             $trans->locked = 0;
             $trans->store();
         }
     }
     return parent::store();
 }