/**
  * Load value unit
  *
  * @return CObservationValueUnit
  */
 function loadRefValueUnit()
 {
     return $this->_ref_value_unit = CObservationValueUnit::get($this->value_unit_id);
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkAdmin();
$unit_id = CValue::getOrSession("value_unit_id");
$type_id = CValue::getOrSession("value_type_id");
$unit = new CObservationValueUnit();
$unit->load($unit_id);
if (!$unit->_id) {
    $unit->coding_system = "MB";
} else {
    $unit->loadRefsNotes();
}
$units = $unit->loadList(null, "coding_system, code");
$type = new CObservationValueType();
$type->load($type_id);
if (!$type->_id) {
    $type->coding_system = "MB";
} else {
    $type->loadRefsNotes();
}
$types = $type->loadList(null, "coding_system, code");
// Création du template
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_view = $this->value . " " . CObservationValueUnit::get($this->unit_id)->_view;
 }
 /**
  * Get unit
  *
  * @param DOMNode            $node   DOM node
  * @param CObservationResult $result Result
  *
  * @return string
  */
 function getUnits(DOMNode $node, CObservationResult $result)
 {
     $identifier = $this->queryTextNode("OBX.6/CE.1", $node);
     $text = $this->queryTextNode("OBX.6/CE.2", $node);
     $coding_system = $this->queryTextNode("OBX.6/CE.3", $node);
     $unit_type = new CObservationValueUnit();
     $result->unit_id = $unit_type->loadMatch($identifier, $coding_system, $text);
 }