/**
  * @see parent::check()
  */
 function check()
 {
     if ($this->fieldModified("content", "")) {
         return "CContentHTML-failed-emptytext";
     }
     return parent::check();
 }
Пример #2
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     $this->completeField("conge_id", "replacer_id");
     $this->loadRefConge();
     if ($this->_ref_conge->user_id == $this->replacer_id) {
         return "{$this->_class}-failed-same_user";
     }
     return null;
 }
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     // Check unique item
     $other = new CPackItemExamenLabo();
     $other->pack_examens_labo_id = $this->pack_examens_labo_id;
     $other->examen_labo_id = $this->examen_labo_id;
     $other->loadMatchingObject();
     if ($other->_id && $other->_id != $this->_id) {
         return "{$this->_class}-unique-conflict";
     }
     return null;
 }
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     if ($this->hasAncestor($this)) {
         return "Cyclic catalog creation";
     }
     // Checks whether there is a sibling catalogue in the same hierarchy
     $root = $this->getRootCatalogue();
     foreach ($this->getSiblings() as $_sibling) {
         $_root = $_sibling->getRootCatalogue();
         if ($root->_id == $_root->_id) {
             return "CCatalogue-sibling-conflict ({$this->identifiant})";
         }
     }
     return null;
 }
Пример #5
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     // Check unique affectation_id except absence (leave / return from leave)
     if ($this->movement_type != "AABS" && $this->movement_type != "RABS") {
         $movement = new self();
         $this->completeField("affectation_id");
         $movement->movement_type = $this->movement_type;
         $movement->affectation_id = $this->affectation_id;
         $movement->cancel = 0;
         $movement->loadMatchingObject();
         if ($this->affectation_id && $movement->_id && $this->_id != $movement->_id) {
             return CAppUI::tr("{$this->_class}-failed-affectation_id") . " : {$this->affectation_id}";
         }
     }
     return null;
 }
Пример #6
0
 /**
  * @see parent::check()
  */
 function check()
 {
     parent::check();
     $this->completeField("domain_id", "object_class", "group_id");
     // Recherche si on a pas déjà un établissement du domaine pour un type d'objet différent
     $ljoin = array("domain" => "domain.domain_id = group_domain.domain_id");
     $group_domain = new CGroupDomain();
     // Recherche si on a un établissement du domaine déjà en master avec le même type d'objet et le même établissement
     if ($this->master) {
         $where = array("master" => " = '1'", "object_class" => " = '{$this->object_class}'", "group_id" => " = '{$this->group_id}'", "domain.active" => " = '1'");
         if ($group_domain->countList($where, null, $ljoin) > 0) {
             return "CGroupDomain-master_already_exist";
         }
     }
     $where = array("domain.domain_id" => " = '{$this->domain_id}'", "incrementer_id" => "IS NOT NULL", "object_class" => " != '{$this->object_class}'", "domain.active" => " = '1'");
     if ($group_domain->countList($where, null, $ljoin) > 0) {
         return "CGroupDomain-object_class_already_exist";
     }
 }
Пример #7
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     $this->completeField("operation_id", "sejour_maman_id", "grossesse_id");
     // Operation has to be part of sejour
     if ($this->operation_id) {
         $operation = $this->loadRefOperation();
         if ($operation->sejour_id != $this->sejour_maman_id) {
             return "failed-operation-notin-sejour";
         }
     }
     // Sejour has to be part of grossesse
     $sejour = $this->loadRefSejourMaman();
     if ($sejour->grossesse_id != $this->grossesse_id) {
         return "failed-sejour-maman-notin-grossesse";
     }
     return null;
 }
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     // Check unique item
     $other = new CPrescriptionLaboExamen();
     $clone = null;
     if ($this->_id) {
         $clone = new CPrescriptionLaboExamen();
         $clone->load($this->_id);
     } else {
         $clone = $this;
     }
     $other->prescription_labo_id = $clone->prescription_labo_id;
     $other->examen_labo_id = $clone->examen_labo_id;
     $other->loadMatchingObject();
     if ($other->_id && $other->_id != $this->_id) {
         return "{$this->_class}-unique-conflict";
     }
     // Check prescription status
     $clone->loadRefPrescription();
     $clone->_ref_prescription_labo->loadRefsBack();
     if ($clone->_ref_prescription_labo->_status >= CPrescriptionLabo::VALIDEE) {
         return "Prescription déjà validée";
     }
     // Get the analysis to check resultat
     if (!$this->examen_labo_id) {
         if (!$clone) {
             $clone = new CPrescriptionLaboExamen();
             $clone->load($this->_id);
         }
         $this->examen_labo_id = $clone->examen_labo_id;
     }
     // Check resultat according to type
     $this->loadRefExamen();
     $resultTest = CMbFieldSpecFact::getSpec($this, "resultat", $this->_ref_examen_labo->type);
     return $resultTest->checkPropertyValue($this);
 }
Пример #9
0
 function check()
 {
     $msg = parent::check();
     if (!$msg) {
         $where = array();
         $where["date"] = $this->_spec->ds->prepare("= %", $this->date);
         $where["affectation_id"] = $this->_spec->ds->prepare("= %", $this->affectation_id);
         $where["typerepas_id"] = $this->_spec->ds->prepare("= %", $this->typerepas_id);
         if ($this->repas_id) {
             $where["repas_id"] = $this->_spec->ds->prepare("!= %", $this->repas_id);
         }
         $select = "count(`" . $this->_spec->key . "`) AS `total`";
         $sql = new CRequest();
         $sql->addTable($this->_spec->table);
         $sql->addSelect($select);
         $sql->addWhere($where);
         $nbRepas = $this->_spec->ds->loadResult($sql->makeSelect());
         if ($nbRepas) {
             $msg .= "Un repas a déjà été créé, vous ne pouvez pas en créer un nouveau.";
         }
     }
     return $msg;
 }
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     /* Check if the object has been properly loaded,
        to avoid blocking the merges of a context (CSejour, COperation, CPatient, CConsultation) */
     if ($this->_id && $this->datetime) {
         // Verifie si au moins une des valeurs est remplie
         $ok = false;
         foreach (CConstantesMedicales::$list_constantes as $const => $params) {
             if ($const[0] == '_') {
                 continue;
             }
             $this->completeField($const);
             if (array_key_exists('formfields', $params)) {
                 foreach ($params['formfields'] as $_formfield) {
                     if ($this->{$_formfield} !== "" && $this->{$_formfield} !== null) {
                         $ok = true;
                         break 2;
                     }
                 }
             } elseif ($this->{$const} !== "" && $this->{$const} !== null) {
                 $ok = true;
                 break;
             }
         }
         if (!$ok) {
             return CAppUI::tr("CConstantesMedicales-min_one_constant");
         }
     }
     return null;
 }
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     if ($msg = $this->checkCollisions()) {
         return $msg;
     }
     return null;
 }
Пример #12
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     //a message flag as sent cannot be archived
     if ($this->sent && $this->archived) {
         return "CUserMail-msg-AMessageSentCannotBeArchived";
     }
 }
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     if ($this->fieldModified("host_class")) {
         $count_constraints = $this->countBackRefs("constraints");
         if ($count_constraints > 0) {
             return "Impossible de changer le type d'objet hôte de ce formulaire car il possède {$count_constraints} contrainte(s)";
         }
     }
     return null;
 }
Пример #14
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($this->_forwardRefMerging) {
         return null;
     }
     // Vérouillage d'un événement traité
     $this->completeField("realise", "annule", "nb_patient_seance", "nb_intervenant_seance");
     $this->_traite = $this->realise || $this->annule;
     if ($this->_traite && !$this->_traitement) {
         return "Evénément déjà traité (réalisé ou annulé)";
     }
     // Evénement dans les bornes du séjour
     $this->completeField("sejour_id", "debut");
     $sejour = $this->loadRefSejour();
     // Vérifier seulement les jours car les sorties peuvent être imprécises pour les hospit de jours
     if ($sejour->_id && $this->debut) {
         $date_debut = CMbDT::date($this->debut);
         $date_entree = CMbDT::date(CMbDT::date($sejour->entree));
         $date_sortie = CMbDT::date(CMbDT::date($sejour->sortie));
         if (!CMbRange::in($date_debut, $date_entree, $date_sortie)) {
             return "Evenement SSR en dehors des dates du séjour";
         }
     }
     // Cas de la réalisation des événements SSR
     $this->loadRefTherapeute();
     // Si le therapeute n'est pas defini, c'est
     if ($this->therapeute_id) {
         $therapeute = $this->_ref_therapeute;
     } else {
         // Chargement du therapeute de la seance
         $evt_seance = new CEvenementSSR();
         $evt_seance->load($this->seance_collective_id);
         $evt_seance->loadRefTherapeute();
         $therapeute = $evt_seance->_ref_therapeute;
     }
     if ($this->fieldModified("realise")) {
         // Si le thérapeute n'a pas d'identifiant CdARR
         if (!$therapeute->code_intervenant_cdarr) {
             return CAppUI::tr("CMediusers-code_intervenant_cdarr-none");
         }
         $therapeute->loadRefIntervenantCdARR();
         $code_intervenant_cdarr = $therapeute->_ref_intervenant_cdarr->code;
         // Création du RHS au besoins
         $rhs = $this->getRHS();
         if (!$rhs->_id) {
             $rhs->store();
         }
         if ($rhs->facture == 1) {
             CAppUI::stepAjax(CAppUI::tr("CRHS.charged"), UI_MSG_WARNING);
         }
         $this->loadView();
         // Complétion de la ligne RHS
         foreach ($this->loadRefsActesCdARR() as $_acte_cdarr) {
             $ligne = new CLigneActivitesRHS();
             $ligne->rhs_id = $rhs->_id;
             $ligne->executant_id = $therapeute->_id;
             $ligne->code_activite_cdarr = $_acte_cdarr->code;
             $ligne->code_intervenant_cdarr = $code_intervenant_cdarr;
             $ligne->loadMatchingObject();
             $ligne->crementDay($this->debut, $this->realise ? "inc" : "dec");
             $ligne->auto = "1";
             $ligne->store();
         }
         foreach ($this->loadRefsActesCsARR() as $_acte_csarr) {
             $ligne = new CLigneActivitesRHS();
             $ligne->rhs_id = $rhs->_id;
             $ligne->executant_id = $therapeute->_id;
             $ligne->code_activite_csarr = $_acte_csarr->code;
             $ligne->code_intervenant_cdarr = $code_intervenant_cdarr;
             $ligne->modulateurs = $_acte_csarr->modulateurs;
             $ligne->phases = $_acte_csarr->phases;
             $ligne->nb_patient_seance = $this->nb_patient_seance;
             $ligne->nb_intervenant_seance = $this->nb_intervenant_seance;
             $ligne->loadMatchingObject();
             $ligne->crementDay($this->debut, $this->realise ? "inc" : "dec");
             $ligne->auto = "1";
             $ligne->store();
         }
     }
     return parent::check();
 }
Пример #15
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = $this->checkExecutionLine()) {
         return $msg;
     }
     return parent::check();
 }
Пример #16
0
 /**
  * @see parent::check();
  */
 function check()
 {
     $msg = "Deux points ont la même abscisse dans l'audiogramme vocal de l'oreille ";
     if (!$this->checkAbscisse($this->_gauche_vocale)) {
         return $msg . "gauche";
     }
     if (!$this->checkAbscisse($this->_droite_vocale)) {
         return $msg . "droite";
     }
     return parent::check();
 }
Пример #17
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($this->date_monday && CMbDT::format($this->date_monday, "%w") != "1") {
         return CAppUI::tr("CRHS-failed-monday", $this->date_monday);
     }
     return parent::check();
 }
 /**
  * check before store
  *
  * @return string
  */
 function check()
 {
     $source = self::get($this->name, null, true);
     if ($source->_id && $source->_id != $this->_id) {
         $this->active = 0;
     }
     return parent::check();
 }
Пример #19
0
 /**
  * Vérifie l'unicité d'une aide à la saisie
  * 
  * @return string
  */
 function check()
 {
     $msg = "";
     $ds = $this->_spec->ds;
     $where = array();
     if ($this->user_id) {
         $where["user_id"] = $ds->prepare("= %", $this->user_id);
     } else {
         if ($this->function_id) {
             $where["function_id"] = $ds->prepare("= %", $this->function_id);
         } else {
             $where["group_id"] = $ds->prepare("= %", $this->group_id);
         }
     }
     $where["class"] = $ds->prepare("= %", $this->class);
     $where["field"] = $ds->prepare("= %", $this->field);
     $where["depend_value_1"] = $ds->prepare("= %", $this->depend_value_1);
     $where["depend_value_2"] = $ds->prepare("= %", $this->depend_value_2);
     $where["text"] = $ds->prepare("= %", $this->text);
     $where["aide_id"] = $ds->prepare("!= %", $this->aide_id);
     $sql = new CRequest();
     $sql->addSelect("count(aide_id)");
     $sql->addTable("aide_saisie");
     $sql->addWhere($where);
     $nb_result = $ds->loadResult($sql->makeSelect());
     if ($nb_result) {
         $msg .= "Cette aide existe déjà<br />";
     }
     return $msg . parent::check();
 }
Пример #20
0
 /**
  * @see parent::check()
  */
 function check()
 {
     //Si on merge le dossier médical et que le type n'existe pas
     if ($this->_forwardRefMerging && in_array($this->type, CAntecedent::$non_types) || !in_array($this->type, CAntecedent::$types) || $this->fieldModified("annule", "1")) {
         return null;
     }
     return parent::check();
 }
Пример #21
0
 /**
  * @see parent::check()
  */
 function check()
 {
     $msg = null;
     $ds = $this->_spec->ds;
     if (!$this->perm_object_id) {
         $where = array();
         $where["user_id"] = $ds->prepare("= %", $this->user_id);
         $where["object_class"] = $ds->prepare("= %", $this->object_class);
         if ($this->object_id) {
             $where["object_id"] = $ds->prepare("= %", $this->object_id);
         } else {
             $where["object_id"] = "IS NULL";
         }
         $query = new CRequest();
         $query->addSelect("count(perm_object_id)");
         $query->addTable("perm_object");
         $query->addWhere($where);
         $nb_result = $ds->loadResult($query->makeSelect());
         if ($nb_result) {
             $msg .= "Une permission sur cet objet existe déjà.<br />";
         }
     }
     return $msg . parent::check();
 }
Пример #22
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if (!$this->_forwardRefMerging) {
         $patient_link = new self();
         $patient_link->patient_id1 = $this->patient_id2;
         $patient_link->patient_id2 = $this->patient_id1;
         if ($patient_link->countMatchingList() > 0) {
             //todo trad
             return "Lien déjà existant";
         }
     }
     return parent::check();
 }
Пример #23
0
 /**
  * @see parent::check()
  */
 function check()
 {
     return parent::check();
 }
Пример #24
0
 /**
  * @see parent::check()
  */
 public function check()
 {
     $this->completeField('codable_class', 'codable_id', 'praticien_id', 'association_mode', 'association_rule', 'locked', 'activite_anesth', 'date');
     $this->loadOldObject();
     $codable = $this->loadCodable();
     if ($codable->_class == 'CConsultation') {
         $codable->loadRefPlageConsult();
         if ($this->date != $codable->_date) {
             return 'Impossible de créer un codage CCAM a une date différente de celle de la consultation';
         }
     }
     if ($codable->_class == 'COperation') {
         if ($this->date != $codable->date) {
             return 'Impossible de créer un codage CCAM a une date différente de celle de l\'intervention';
         }
     }
     if ($this->_old->locked && $this->locked && !CModule::getCanDo('dPpmsi')->edit) {
         return "Codage verrouillé";
     }
     if (!$this->_id || $this->fieldModified('association_mode', 'auto')) {
         $this->guessRule();
     }
     if (!$this->_id || $this->fieldModified('association_rule')) {
         $this->applyRuleToActes();
     }
     return parent::check();
 }
Пример #25
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if (!$this->_merging) {
         if ($msg = $this->hasCollisions()) {
             return $msg;
         }
     }
     return parent::check();
 }
Пример #26
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = $this->checkCodeCcam()) {
         return $msg;
     }
     if (!$this->_forwardRefMerging && !$this->_merging && CAppUI::conf("dPccam CCodable use_getMaxCodagesActes")) {
         if ($this->_old && $this->codes_ccam != $this->_old->codes_ccam) {
             if ($msg = $this->getMaxCodagesActes()) {
                 return $msg;
             }
         }
     }
     return parent::check();
 }
Пример #27
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     if (!$this->parent_id) {
         return null;
     }
     $tag = $this;
     while ($tag->parent_id) {
         $parent = $tag->loadRefParent();
         if ($parent->_id == $this->_id) {
             return "Récursivité détectée, un des ancêtres du tag est lui-même";
         }
         $tag = $parent;
     }
     return null;
 }
Пример #28
0
 /**
  * @see parent::check()
  */
 function check()
 {
     if ($msg = parent::check()) {
         return $msg;
     }
     // Checks whether there is a sibling examen in the same hierarchy
     $root = $this->getRootCatalogue();
     foreach ($this->getSiblings() as $_sibling) {
         $_root = $_sibling->getRootCatalogue();
         if ($root->_id == $_root->_id) {
             return "CExamenLabo-sibling-conflict";
         }
     }
     return null;
 }
Пример #29
0
 /**
  * check before store
  *
  * @return null|string
  */
 function check()
 {
     $this->completeField("date_debut", "date_fin", "user_id");
     $plage_conge = new CPlageConge();
     $plage_conge->user_id = $this->user_id;
     $plages_conge = $plage_conge->loadMatchingList();
     unset($plages_conge[$this->_id]);
     /** @var $plages_conge CPlageConge[] */
     foreach ($plages_conge as $_plage) {
         if (CMbRange::collides($this->date_debut, $this->date_fin, $_plage->date_debut, $_plage->date_fin)) {
             return CAppUI::tr("CPlageConge-conflit %s", $_plage->_view);
         }
     }
     return parent::check();
 }