/** * @see parent::delete() */ function delete() { $this->loadRefCodageCCAM(); if ($msg = parent::delete()) { return $msg; } if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) { $this->loadRefCodageCCAM(); if (isset($this->_ref_codage_ccam)) { if ($this->_ref_codage_ccam->_id) { $this->_ref_codage_ccam->updateRule(true); } } $this->_ref_codage_ccam->store(); } return null; }
/** * Return the CCodageCCAM linked to the given codable and practitioner, and create it if it not exists * * @param CCodable $codable The codable object * @param integer $praticien_id The practitioner id * @param integer $activite Is the CCodage concern anesthesia activities or other activities * @param date $date The date * * @return CCodageCCAM */ public static function get($codable, $praticien_id, $activite = 1, $date = null) { if (!$date) { switch ($codable->_class) { case 'CConsultation': $codable->loadRefPlageConsult(); $date = $codable->_date; break; case 'COperation': $date = $codable->date; break; case 'CSejour': return new CCodageCCAM(); } } $codage_ccam = new CCodageCCAM(); $codage_ccam->codable_class = $codable->_class; $codage_ccam->codable_id = $codable->_id; $codage_ccam->praticien_id = $praticien_id; $codage_ccam->loadPraticien(); $codage_ccam->activite_anesth = $activite == 4 && $codage_ccam->_ref_praticien->isAnesth() ? 1 : 0; $codage_ccam->date = $date; $codage_ccam->loadMatchingObject(); if (!$codage_ccam->_id) { $codage_ccam->_apply_rules = false; $codage_ccam->store(); } return $codage_ccam; }
} $date = CValue::post('date', $codage->_ref_codable->sortie); $days = CMbDT::daysRelative($codage->date . ' 00:00:00', CMbDT::format($date, '%Y-%m-%d 00:00:00')); for ($i = 1; $i <= $days; $i++) { $_date = CMbDT::date("+{$i} DAYS", $codage->date); $_codage = new CCodageCCAM(); $_codage->praticien_id = $codage->praticien_id; $_codage->codable_class = $codage->codable_class; $_codage->codable_id = $codage->codable_id; $_codage->date = $_date; $_codage->loadMatchingObject(); if ($codage->association_mode == 'user_choice') { $_codage->association_mode = $codage->association_mode; $_codage->association_rule = $codage->association_rule; } $_codage->store(); foreach ($actes as $_acte_id) { if (array_key_exists($_acte_id, $codage->_ref_actes_ccam)) { $_acte = $codage->_ref_actes_ccam[$_acte_id]; /* Si il n'y a pas d'acte non coté pour ce code ccam, on l'ajoute au codable */ $key = "{$_acte->code_acte}-{$_acte->code_activite}-{$_acte->code_phase}"; if (array_key_exists($key, $uncoded_acts)) { $uncoded_acts[$key] = $uncoded_acts[$key] - 1; if ($uncoded_acts[$key] == 0) { unset($uncoded_acts[$key]); } } else { $codable->codes_ccam .= "|{$_acte->code_acte}"; $codable->store(); $codable->updateFormFields(); }