/** * @see parent::store() */ function store() { if ($this->fieldModified("content") || !$this->last_modified) { $this->last_modified = CMbDT::dateTime(); } return parent::store(); }
/** * @see parent::store() */ function store() { if (!$this->_id) { $this->group_id = CGroups::loadCurrent()->_id; } return parent::store(); }
/** * @see parent::store() */ function store() { if ($msg = parent::store()) { return $msg; } if ($this->_duplicate && $this->_type_has) { $this->duplicate(); } }
/** * @see parent::store() */ function store() { if (!$this->creation_datetime) { $this->creation_datetime = CMbDT::dateTime(); } if ($msg = parent::store()) { return $msg; } }
/** * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message * * @param CMbObject $object Objet à enregister * * @return void */ function storeObject($object) { $title = $object->_id ? "-msg-modify" : "-msg-create"; if ($msg = $object->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); echo CAppUI::getMsg(); CApp::rip(); } CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK); }
/** * @see parent::store() */ function store() { $is_new = !$this->_id; if ($msg = parent::store()) { return $msg; } if ($is_new || $this->fieldModified("name")) { CExObject::clearLocales(); } return null; }
/** * @see parent::store() */ function store() { $this->completeField("datetime_start"); if (!$this->datetime_start) { $this->datetime_start = CMbDT::dateTime(); } if (!$this->_id) { $rand = CMbSecurity::getRandomString(16); $this->hash = CMbSecurity::hash(CMbSecurity::SHA1, $rand); } return parent::store(); }
/** * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message * * @param CMbObject $object Objet à enregister * * @return void */ function storeObject($object) { $title = $object->_id ? "-msg-modify" : "-msg-create"; if ($msg = $object->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); echo CAppUI::getMsg(); // Il peut y avoir un msg de retour postérieur à la création de l'objet // On continue donc le processus de création de la naissance //CApp::rip(); } CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK); }
/** * @see parent::store() */ function store() { if (!$this->_id) { $this->updatePlainFields(); $etat_dent = new CEtatDent(); $etat_dent->dent = $this->dent; $etat_dent->dossier_medical_id = $this->dossier_medical_id; if ($etat_dent->loadMatchingObject()) { $this->_id = $etat_dent->_id; } } return parent::store(); }
/** * @see parent::store() */ function store() { $this->completeField("operation_id"); if ($this->_id && $this->etat != "a_commander") { if (CMediusers::get()->_id == $this->loadRefOperation()->chir_id) { $this->etat = "modify"; } } // Standard storage if ($msg = parent::store()) { return $msg; } }
/** * @see parent::store() */ function store() { // Transfert de séjours vers un autre technicien if ($this->_transfer_id) { foreach ($this->loadRefsSejours(CMbDT::date()) as $_sejour) { $bilan = $_sejour->loadRefBilanSSR(); $bilan->technicien_id = $this->_transfer_id; if ($msg = $bilan->store()) { return $msg; } } } return parent::store(); }
/** * @see parent::store() */ function store() { $create = $this->_id; // Standard store if ($msg = parent::store()) { return $msg; } if (!$create && count($this->_factures)) { //$this->completeField("journal_id"); foreach ($this->_factures as $facture) { $link = new CJournalLiaison(); $link->journal_id = $this->journal_id; $link->object_id = $facture->_id; $link->object_class = $facture->_class; if ($msg = $link->store()) { return $msg; } } } }
/** * Stores a CMbObject from a hash * * @param array $hash The associative array * @param boolean $force Force the object re-importation * * @return string The store message */ function storeMbObject($hash, $force = false) { $db_id = $this->getId($hash); $object = $this->getMbObject($db_id); // If object was already imported if (!$force && $object->_id) { return null; } $this->mapHashToMbObject($hash, $object); if (isset($this->_mb_object->_failed)) { return; } $this->_mb_object->repair(); if ($msg = $this->_mb_object->store()) { CAppUI::setMsg($msg, UI_MSG_WARNING); return $msg; } else { CAppUI::setMsg("{$this->_mb_object->_class}-msg-create"); } self::$_count_stored++; return self::storeIdExt($this->_mb_object, $this->getId($hash)); }
/** * Delete acte * * @param CActe $acte Acte * @param CMbObject $object Object * @param CIdSante400 $idex Idex * * @return String|null */ function deleteActe($acte, $object, $idex) { if ($msg = $idex->delete()) { return $msg; } if ($msg = $acte->delete()) { return $msg; } if ($msg = $object->store()) { return $msg; } return null; }
/** * @see parent::store() */ function store() { if ($this instanceof CSejour || $this instanceof COperation) { global $can; $this->loadOldObject(); $this->completeField("cloture_activite_1", "cloture_activite_4", 'codes_ccam'); if (!$can->admin && CAppUI::conf("dPsalleOp CActeCCAM signature") && ($this->cloture_activite_1 || $this->cloture_activite_4) && $this->fieldModified("codes_ccam") && strcmp($this->codes_ccam, $this->_old->codes_ccam)) { $new_code = substr($this->codes_ccam, strlen($this->_old->codes_ccam) + 1); $code_ccam = new CDatedCodeCCAM($new_code); $code_ccam->getRemarques(); $activites = $code_ccam->getActivites(); if (isset($activites[1]) && $this->cloture_activite_1) { CAppUI::setMsg("Impossible de rajouter un code : l'activité 1 est clôturée", UI_MSG_ERROR); echo CAppUI::getMsg(); CApp::rip(); } if (isset($activites[4]) && $this->cloture_activite_4) { CAppUI::setMsg("Impossible de rajouter un code : l'activité 4 est clôturée", UI_MSG_ERROR); echo CAppUI::getMsg(); CApp::rip(); } } } // Standard store if ($msg = parent::store()) { return $msg; } if ($this->_delete_actes && $this->_id) { if ($msg = $this->deleteActes()) { return $msg; } } return null; }
/** * @see parent::store() */ function store() { if ($this->_unvalidate) { $this->valid_user_id = ""; $this->date_validation = ""; $this->service_valid_user_id = ""; $this->service_date_validation = ""; $this->qualite_user_id = ""; $this->qualite_date_validation = ""; $this->_unvalidate = null; } return parent::store(); }
/** * @see parent::store */ function store() { if (!$this->_id) { $transf_rule = new CEAITransformationRule(); $transf_rule->eai_transformation_ruleset_id = $this->eai_transformation_ruleset_id; $this->rank = $transf_rule->countMatchingList() + 1; } return parent::store(); }
/** * @see parent::store() */ function store() { CExObject::$_locales_cache_enabled = false; if ($msg = parent::store()) { return $msg; } if ($this->_compute_view) { $this->loadView(); } return null; }
public function store() { /* Set the default value for activite_anesth because the framework doesn't set it before checking the uniques constraints */ if (!$this->_id && !$this->activite_anesth) { $this->activite_anesth = '0'; } /* Create the CCodageCCAM for the anesthesia activity if the practitioner is an anesthesist */ if (!$this->_id && !$this->activite_anesth) { $this->loadPraticien(); if ($this->_ref_praticien->isAnesth()) { $this->loadCodable(); self::get($this->_ref_codable, $this->praticien_id, 4, $this->date); } } return parent::store(); }
/** * @see parent::store() */ function store() { // RHS already charged $this->completeField("rhs_id"); $rhs = $this->loadRefRHS(); if ($rhs->facture) { return "{$this->_class}-failed-rhs-facture"; } // Delete if total is 0 $this->completeField("qty_mon", "qty_tue", "qty_wed", "qty_thu", "qty_thu", "qty_fri", "qty_sat", "qty_sun"); $this->updateFormFields(); if ($this->_id && $this->_qty_total == 0) { return $this->delete(); } return parent::store(); }
/** * @see parent::store() */ function store() { // S'il ne reste plus qu'un seul champ et que sa valeur est passée à vide, // alors on supprime la constante. if ($this->_id && ($this->fieldModified("taille") || $this->fieldModified("poids")) || !$this->_id && ($this->taille || $this->poids)) { $this->completeField("patient_id"); DSHM::remKeys("alertes-*-CPatient-" . $this->patient_id); } if ($this->_id) { $this->loadOldObject(); /* Pour permettre la suppression du poids et de _poids_g */ if (!$this->_poids_g && $this->_old->poids) { $this->poids = $this->_poids_g; } if (!$this->poids && $this->_old->poids) { $this->_poids_g = $this->poids; } if ($this->poids != $this->_old->poids && $this->_poids_g != $this->poids * 1000) { $this->_poids_g = $this->poids * 1000; } } if (!$this->_id) { if (!$this->user_id) { $this->user_id = CMediusers::get()->_id; } if (!$this->creation_date) { $this->creation_date = CMbDT::dateTime(); } if ($this->datetime == 'now') { $this->datetime = $this->creation_date; } } if (!$this->_id && !$this->_new_constantes_medicales) { $this->updatePlainFields(); $constante = new CConstantesMedicales(); $constante->patient_id = $this->patient_id; $constante->context_class = $this->context_class; $constante->context_id = $this->context_id; if ($constante->loadMatchingObject()) { foreach (CConstantesMedicales::$list_constantes as $type => $params) { if (empty($this->{$type}) && !empty($constante->{$type})) { $this->{$type} = $constante->{$type}; } } $this->_id = $constante->_id; } } return parent::store(); }
function store() { $this->updatePlainFields(); if (!$this->_no_synchro) { $service = $this->getService(); $where = array(); $where["date"] = $this->_spec->ds->prepare("= %", $this->date); $where["service_id"] = $this->_spec->ds->prepare("= %", $service->_id); $where["typerepas_id"] = $this->_spec->ds->prepare("= %", $this->typerepas_id); $validationrepas = new CValidationRepas(); $validationrepas->loadObject($where); if ($validationrepas->validationrepas_id) { $validationrepas->modif = 1; $validationrepas->store(); $this->modif = 1; } } return parent::store(); }
/** * @see parent::store() */ function store() { if ($this->_duplicate == 1) { $this->duplicate(); return; } if ($msg = parent::store()) { return $msg; } if ($this->_links) { $current_links = $this->loadRefTypeLinks(); // Suppression des liens ayant un object class pas cohérent ou dont l'ID n'est pas dans la liste foreach ($current_links as $_link_object) { if (($this->type == "ouverture_salle" || $this->type == "fermeture_salle") && $_link_object->object_class != "CSalle" || ($this->type == "ouverture_sspi" || $this->type == "ouverture_preop") && $_link_object->object_class != "CBlocOperatoire" || !in_array("{$_link_object->object_class}-{$_link_object->object_id}", $this->_links)) { $_link_object->delete(); } } // Creation des liens manquants foreach ($this->_links[$this->type] as $_object_guid) { list($_object_class, $_object_id) = explode("-", $_object_guid); // Exclude types from other class if ($this->type == "ouverture_salle" && $_object_class != "CSalle" || ($this->type == "ouverture_sspi" || $this->type == "ouverture_preop") && $_object_class != "CBlocOperatoire" || $this->type == "intervention") { continue; } $new_link = new CDailyCheckListTypeLink(); $new_link->object_class = $_object_class; $new_link->object_id = $_object_id == "none" ? "" : $_object_id; // "" is important here ! $new_link->list_type_id = $this->_id; $new_link->loadMatchingObject(); // Should never match $new_link->store(); } } return null; }
/** * @see parent::store() */ function store() { if (!$this->_id && $this->rpu_id) { $echelle = new self(); $echelle->rpu_id = $this->rpu_id; $echelle->loadMatchingObject(); $this->_id = $echelle->_id; } $glasgow = null; if ($this->fieldModified("ouverture_yeux") || $this->fieldModified("rep_motrice") || $this->fieldModified("rep_verbale")) { $glasgow = $this->calculGlasgow(); } // Standard Store if ($msg = parent::store()) { return $msg; } if ($glasgow != null) { $sejour = $this->loadRefRPU()->loadRefSejour(); $constante = new CConstantesMedicales(); $constante->_new_constantes_medicales = 1; $constante->patient_id = $sejour->loadRefPatient()->_id; $constante->context_class = $sejour->_class; $constante->context_id = $sejour->_id; $constante->glasgow = $glasgow; $constante->datetime = 'now'; if ($msg = $constante->store()) { return $msg; } } return null; }
/** * @see parent::store() */ function store() { // Save owner and creation date if (!$this->_id) { if (!$this->creation_date) { $this->creation_date = CMbDT::dateTime(); } if (!$this->owner_id) { $this->owner_id = CMediusers::get()->_id; } } return parent::store(); }
/** * @see parent::store() */ function store() { $this->completeField("code", 'quantity', 'unit_quantity'); if (!$this->quantity) { $this->quantity = 1; } if ($this->unit_quantity == 0) { $this->unit_quantity = ''; } if ($this->code !== null && (!$this->_id || $this->fieldModified("code"))) { $this->code_canonical = preg_replace("/[^0-9a-z]/i", "", $this->code); } $cc = trim($this->classe_comptable, "0\n\r\t "); if (preg_match('/^\\d+$/', $cc)) { $this->classe_comptable = str_pad($cc, 9, "0", STR_PAD_RIGHT); } else { $this->classe_comptable = ""; } if ($this->fieldModified("cancelled", 1)) { $references = $this->loadRefsReferences(); foreach ($references as $_ref) { $_ref->cancelled = 1; $_ref->store(); } } $create_stock_quantity = $this->_create_stock_quantity; if ($msg = parent::store()) { return $msg; } if ($create_stock_quantity) { $stock = $this->loadRefStock(); $stock->quantity = $create_stock_quantity; $stock->order_threshold_min = $stock->quantity; $group = CGroups::loadCurrent(); $stock->location_id = CProductStockLocation::getDefaultLocation($group, $this)->_id; if ($msg = $stock->store()) { CAppUI::setMsg($msg, UI_MSG_WARNING); } $this->_create_stock_quantity = null; } return null; }
/** * store function * * @return null|string */ function store() { if ($this->password === "") { $this->password = null; } else { if ($this->fieldModified("password") || !$this->_id) { $this->password = $this->encryptString(); } } $this->updateEncryptedFields(); return parent::store(); }
/** * @see parent::store() * * @return null|string */ function store() { $this->generateIV(); /* * Lorsque le trousseau existe et que la phrase est modifiée * Charge tous les mots de passe et les re-chiffre */ foreach ($this->loadRefsCategories() as $_category) { foreach ($_category->loadRefsPasswords() as $_password) { $_password->renew(CValue::sessionAbs("passphrase"), $this->_passphrase); } } $this->sample = $this->encrypt(); if ($msg = parent::store()) { return $msg; } }
/** * @see parent::store() */ function store() { if ($this->_move && $this->_id) { $this->completeField("ex_class_id"); $groups = $this->loadRefExClass()->loadRefsGroups(); $groups_ids = array_keys($groups); $self_index = array_search($this->_id, $groups_ids); $signs = array("before" => -1, "after" => +1); $sign = Cvalue::read($signs, $this->_move); // Si signe valide et que l'index existe if ($sign && isset($groups_ids[$self_index + $sign])) { list($groups_ids[$self_index + $sign], $groups_ids[$self_index]) = array($groups_ids[$self_index], $groups_ids[$self_index + $sign]); $new_groups = array(); foreach ($groups_ids as $id) { $new_groups[$id] = $groups[$id]; } $i = 1; foreach ($new_groups as $_group) { if ($_group->_id == $this->_id) { $this->rank = $i; } else { $_group->rank = $i; $_group->store(); } $i++; } } } return parent::store(); }
/** * @see parent::store() */ function store() { // Création idex sur le mouvement (movement_type + original_trigger_code + object_guid + tag (mvt_id)) $this->last_update = CMbDT::dateTime(); return parent::store(); }