/**
  * @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);
 }
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Labo
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
// Chargement de l'item choisi
$siblingItems = array();
$prescriptionItem = new CPrescriptionLaboExamen();
$prescriptionItem->load(CValue::getOrSession("prescription_labo_examen_id"));
if ($prescriptionItem->loadRefs()) {
    $prescriptionItem->_ref_prescription_labo->loadRefsFwd();
    $siblingItems = $prescriptionItem->loadSiblings();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("prescriptionItem", $prescriptionItem);
$smarty->assign("siblingItems", $siblingItems);
$smarty->assign("time", time());
$smarty->display("inc_graph_resultats.tpl");