/** * Get target object * * @return CMbObject */ function getObject() { if (!$this->object) { $this->object = CStoredObject::loadFromGuid($this->object_guid); } if ($this->object) { $this->object->loadComplete(); } return $this->object; }
/** * @see parent::loadComplete() */ function loadComplete() { parent::loadComplete(); $this->loadClassification(); $this->loadRealisateurDeep(); }
/** * @see parent::loadComplete() */ function loadComplete() { parent::loadComplete(); $this->loadLastConsult(); }
/** * @see parent::loadComplete() */ function loadComplete() { parent::loadComplete(); $this->loadRefSejour()->loadComplete(); }
/** * @see parent::loadComplete() */ function loadComplete() { parent::loadComplete(); $this->_ref_consultation->loadRefsExamsComp(); $this->_ref_consultation->loadRefsExamNyha(); $this->_ref_consultation->loadRefsExamPossum(); $this->loadRefOperation(); $dossier_medical = $this->_ref_sejour->loadRefDossierMedical(); $dossier_medical->loadRefsAntecedents(); $dossier_medical->loadRefstraitements(); $patient = $this->loadRefPatient(); $dossier_medical = $patient->loadRefDossierMedical(); $dossier_medical->loadRefsAntecedents(); $dossier_medical->loadRefstraitements(); // Chargement des actes CCAM foreach ($this->_ref_consultation->loadRefsActesCCAM() as $_acte) { $_acte->loadRefsFwd(); } }
/** * attention aux dates, il faut surement checker le log de derniere modif des champs du concept * * @fixme pas trop optimisé */ function getReportedValues(CExClassEvent $event) { $ex_class = $this->_ref_ex_class; $fields = $ex_class->loadRefsAllFields(true); if ($this->_id) { return $fields; } self::$_multiple_load = true; CExClassField::$_load_lite = true; $this->loadRefsLinks(); $latest_ex_objects = array($ex_class->getLatestExObject($this->_ref_object), $ex_class->getLatestExObject($this->_ref_reference_object_1), $ex_class->getLatestExObject($this->_ref_reference_object_2)); if ($this->_ref_object->_id) { $this->_ref_object->loadComplete(); } if ($this->_ref_reference_object_1->_id) { $this->_ref_reference_object_1->loadComplete(); } if ($this->_ref_reference_object_2->_id) { $this->_ref_reference_object_2->loadComplete(); } CStoredObject::massLoadFwdRef($fields, "ex_group_id"); $all_concepts = CStoredObject::massLoadFwdRef($fields, "concept_id"); $all_back_fields = CStoredObject::massLoadBackRefs($all_concepts, "class_fields"); $ex_groups = CStoredObject::massLoadFwdRef($all_back_fields, "ex_group_id"); CStoredObject::massLoadFwdRef($ex_groups, "ex_class_id"); // Cache de concepts $concepts = array(); $ex_classes = array(); // on cherche les champs reportés de l'objet courant foreach ($fields as $_field) { $field_name = $_field->name; $this->_reported_fields[$field_name] = null; // valeur par défaut $spec_obj = $_field->getSpecObject(); $this->{$field_name} = CExClassField::unescapeProp($spec_obj->default); $_concept = null; if ($_field->concept_id) { $_concept = $_field->loadRefConcept(); } // si champ pas reporté, on passe au suivant if (!($_field->report_class || $_field->concept_id && $_concept->native_field)) { continue; } // Native fields if ($_concept && $_concept->native_field) { list($_class, $_path) = explode(" ", $_concept->native_field, 2); if (isset($this->_preview)) { $this->_reported_fields[$field_name] = new $_class(); $this->{$field_name} = "Test"; } else { if ($this->_ref_object->_class == $_class) { $_object = $this->_ref_object; } elseif ($this->_ref_reference_object_1->_class == $_class) { $_object = $this->_ref_reference_object_1; } elseif ($this->_ref_reference_object_2->_class == $_class) { $_object = $this->_ref_reference_object_2; } list($_object, $_path) = CExClassConstraint::getFieldAndObjectStatic($_object, $_path); $_resolved = CExClassConstraint::resolveObjectFieldStatic($_object, $_path); $_obj = $_resolved["object"]; $_field_name = $_resolved["field"]; $this->_reported_fields[$field_name] = $_object; $this->{$field_name} = $_obj->{$_field_name}; } if ($this->{$field_name}) { continue; } } $_report_class = $_field->report_class; // si champ basé sur un concept, il faut parcourir // tous les formulaires qui ont un champ du meme concept if ($_field->concept_id) { if (!isset($concepts[$_field->concept_id])) { $_concept_fields = $_concept->loadRefClassFields(); foreach ($_concept_fields as $_concept_field) { if (!isset($ex_classes[$_concept_field->ex_group_id])) { $ex_classes[$_concept_field->ex_group_id] = $_concept_field->loadRefExClass(); } else { $_concept_field->_ref_ex_class = $ex_classes[$_concept_field->ex_group_id]; } } $concepts[$_field->concept_id] = array($_concept, $_concept_fields); } else { list(, $_concept_fields) = $concepts[$_field->concept_id]; } /** @var CExObject $_latest */ $_latest = null; $_latest_value = null; // on regarde tous les champs du concept foreach ($_concept_fields as $_concept_field) { $_ex_class = $_concept_field->_ref_ex_class; $_concept_latest = null; if ($this->_ref_object->_class == $_report_class) { $_concept_latest = $_ex_class->getLatestExObject($this->_ref_object); } elseif ($this->_ref_reference_object_1->_class == $_report_class) { $_concept_latest = $_ex_class->getLatestExObject($this->_ref_reference_object_1); } elseif ($this->_ref_reference_object_2->_class == $_report_class) { $_concept_latest = $_ex_class->getLatestExObject($this->_ref_reference_object_2); } // si pas d'objet precedemment enregistré if (!$_concept_latest || !$_concept_latest->_id || $_concept_latest->{$_concept_field->name} == "") { continue; } if (!$_latest) { $_latest = $_concept_latest; $_latest_value = $_latest->{$_concept_field->name}; } else { $_date = $_concept_latest->getEditDate(); if ($_date > $_latest->getEditDate()) { $_latest = $_concept_latest; $_latest_value = $_latest->{$_concept_field->name}; } } } if ($_latest) { $_latest->loadTargetObject()->loadComplete(); $this->_reported_fields[$field_name] = $_latest; $this->{$field_name} = self::typeSetSpecIntersect($_field, $_latest_value); } } else { $escape = true; foreach ($latest_ex_objects as $_latest_ex_object) { if ($_latest_ex_object->_id) { $escape = false; break; } } if ($escape) { continue; } /** @var CMbObject $_base */ /* * Comprendre pourquoi parfois il n'y a pas de $_latest_ex_object */ $_base = null; foreach ($latest_ex_objects as $_latest_ex_object) { if (!$_latest_ex_object) { continue; } if ($_latest_ex_object->_ref_reference_object_1 && $_latest_ex_object->_ref_reference_object_1->_class == $_report_class) { $_base = $_latest_ex_object->_ref_reference_object_1; break; } elseif ($_latest_ex_object->_ref_reference_object_2 && $_latest_ex_object->_ref_reference_object_2->_class == $_report_class) { $_base = $_latest_ex_object->_ref_reference_object_2; break; } elseif ($_latest_ex_object->_ref_object && $_latest_ex_object->_ref_object->_class == $_report_class) { $_base = $_latest_ex_object->_ref_object; break; } } if ($this->_ref_object->_id && !$_base) { //$_field_view = CAppUI::tr("$this->_class-$_field->name"); //CAppUI::setMsg("Report de données impossible pour le champ '$_field_view'", UI_MSG_WARNING); continue; } if ($_base->{$field_name} == "") { continue; } $_base->loadTargetObject()->loadComplete(); $_base->loadLastLog(); $this->_reported_fields[$field_name] = $_base; $this->{$field_name} = self::typeSetSpecIntersect($_field, $_base->{$field_name}); } } self::$_multiple_load = false; CExClassField::$_load_lite = false; return $fields; }