/**
  * @see parent::mine()
  */
 function mine(COperation $operation)
 {
     parent::mine($operation);
     // to prevent importation logs perturbations (post-event creations)
     static $days_tolerance = 3;
     // Operation
     $this->date_operation = $operation->_datetime;
     $log = $operation->loadCreationLog();
     if (CMbDT::daysRelative($operation->_datetime, $log->date) < $days_tolerance) {
         $this->date_creation = $log->date;
     }
     $this->date_visite_anesth = $operation->date_visite_anesth;
     if ($operation->annulee) {
         $log = $operation->loadFirstLogForField("annulee");
         if (CMbDT::daysRelative($operation->_datetime, $log->date) < $days_tolerance) {
             $this->date_cancellation = $log->date;
         }
     }
     // Consult anesthesie
     $dossier = $operation->loadRefsConsultAnesth();
     $consult = $dossier->loadRefConsultation();
     if ($consult->_id) {
         $consult->loadRefPlageConsult();
         $this->date_consult_anesth = $consult->_datetime;
         $log = $consult->loadCreationLog();
         if (CMbDT::daysRelative($consult->_datetime, $log->date) < $days_tolerance) {
             $this->date_creation_consult_anesth = $log->date;
         }
     }
     // Consult chirurgie
     $consult = $operation->loadRefConsultChir();
     if ($consult->_id) {
         $consult->loadRefPlageConsult();
         $this->date_consult_chir = $consult->_datetime;
         $log = $consult->loadCreationLog();
         if (CMbDT::daysRelative($consult->_datetime, $log->date) < $days_tolerance) {
             $this->date_creation_consult_chir = $log->date;
         }
     }
 }
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkAdmin();
/** @var bool $automine */
$automine = CView::get("automine", "bool", true);
/** @var int $limit */
$limit = CView::get("limit", "num default|1", true);
CView::checkin();
$counts = COperationMiner::makeOperationCounts();
$miner_classes = CApp::getChildClasses("COperationMiner");
$miners = array();
foreach ($miner_classes as $_class) {
    /** @var COperationMiner $miner */
    $miner = new $_class();
    $miner->loadMatchingObject("date DESC");
    $miner->makeMineCounts();
    $miners[] = $miner;
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("counts", $counts);
$smarty->assign("miners", $miners);
$smarty->assign("automine", $automine);
$smarty->assign("limit", $limit);