/** * @see parent::check() */ function check() { // Data checking $msg = null; if (!$this->_id) { if (!$this->plageconsult_id) { $msg .= "Plage de consultation non valide<br />"; } return $msg . parent::check(); } $this->loadOldObject(); $this->loadRefsReglements(); $this->completeField("sejour_id", "plageconsult_id"); if ($this->_check_bounds) { if ($this->sejour_id && !$this->_forwardRefMerging) { $this->loadRefPlageConsult(); $sejour = $this->loadRefSejour(); if ($sejour->type != "consult" && ($this->_date < CMbDT::date($sejour->entree) || CMbDT::date($this->_date) > $sejour->sortie)) { $msg .= "Consultation en dehors du séjour<br />"; return $msg . parent::check(); } } } /** @var self $old */ $old = $this->_old; // Dévalidation avec règlement déjà effectué if ($this->fieldModified("valide", "0")) { // Bien tester sur _old car valide = 0 s'accompagne systématiquement d'un facture_id = 0 if (count($old->loadRefFacture()->loadRefsReglements())) { $msg .= "Vous ne pouvez plus dévalider le tarif, des règlements de factures ont déjà été effectués"; } } if (!($this->_merging || $this->_mergeDeletion) && $old->valide === "1" && $this->valide === "1") { // Modification du tarif déjà validé if ($this->fieldModified("secteur1") || $this->fieldModified("secteur2") || $this->fieldModified("total_assure") || $this->fieldModified("total_amc") || $this->fieldModified("total_amo") || $this->fieldModified("du_patient") || $this->fieldModified("du_tiers")) { $msg .= "Vous ne pouvez plus modifier le tarif, il est déjà validé"; } } return $msg . parent::check(); }
/** * @see parent::check() */ function check() { // Has to be done first to check and repair fields before further checking if ($msg = parent::check()) { return $msg; } $pathos = new CDiscipline(); // Test de la pathologies if ($this->pathologie != null && !in_array($this->pathologie, $pathos->_specs["categorie"]->_list)) { return "Pathologie non disponible"; } // Test de coherence de date avec les interventions if ($this->_check_bounds) { $this->completeField("entree_prevue"); $this->completeField("sortie_prevue"); $entree = $this->entree_prevue; $sortie = $this->sortie_prevue; if ($entree !== null && $sortie !== null && !$this->_skip_date_consistencies) { $entree = CMbDT::date($entree); $sortie = CMbDT::date($sortie); $this->makeDatesOperations(); if (!$this->entree_reelle) { foreach ($this->_dates_operations as $operation_id => $date_operation) { if ($this->_curr_op_id == $operation_id) { $date_operation = $this->_curr_op_date; } if (!CMbRange::in($date_operation, $entree, $sortie)) { return "Intervention du '{$date_operation}' en dehors des nouvelles dates du séjour du '{$entree}' au '{$sortie}'"; } } } if (!$this->entree_reelle && $this->type == "consult") { $this->makeDatesConsultations(); foreach ($this->_dates_consultations as $date_consultation) { if (!CMbRange::in($date_consultation, $entree, $sortie)) { return "Consultations en dehors des nouvelles dates du séjour."; } } } } $this->completeField("entree_reelle", "annule"); if ($this->fieldModified("annule", "1")) { $max_cancel_time = CAppUI::conf("dPplanningOp CSejour max_cancel_time"); if (CMbDT::dateTime("+ {$max_cancel_time} HOUR", $this->entree_reelle) < CMbDT::dateTime()) { return "Impossible d'annuler un dossier ayant une entree réelle depuis plus de {$max_cancel_time} heures.<br />"; } } if (!$this->_merging && !$this->_forwardRefMerging) { foreach ($this->getCollisions() as $collision) { return "Collision avec le séjour du '{$collision->entree}' au '{$collision->sortie}'"; } } } return null; }