if ($_plage->debut <= $time_op && $temps_op <= $_plage->fin) {
                $plageOp = $_plage;
                break;
            }
        }
        // Recherche d'une intervension existante sinon création
        $operation = new COperation();
        $operation->sejour_id = $sejour->_id;
        $operation->chir_id = $mediuser->_id;
        $operation->plageop_id = $plageOp->_id;
        $operation->salle_id = $salle->_id;
        if (!$operation->plageop_id) {
            $operation->date = $date_op;
        }
        $operation->temp_operation = $temps_op;
        $operation->time_operation = $time_op;
        $operation->loadMatchingObject();
        $operation->libelle = $libelle;
        $operation->cote = $cote ? $cote : "inconnu";
        if ($msg = $operation->store()) {
            CAppUI::stepAjax($msg, UI_MSG_WARNING);
            $results["count_erreur"]++;
            continue;
        }
        $results["count_ok"]++;
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("results", $results);
$smarty->display("add_operation_csv.tpl");
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     if (is_array($this->_codes_ccam) && count($this->_codes_ccam)) {
         $this->codes_ccam = implode("|", $this->_codes_ccam);
     }
     if ($this->codes_ccam) {
         $this->codes_ccam = strtoupper($this->codes_ccam);
         $codes_ccam = explode("|", $this->codes_ccam);
         $XPosition = true;
         // @TODO: change it to use removeValue
         while ($XPosition !== false) {
             $XPosition = array_search("-", $codes_ccam);
             if ($XPosition !== false) {
                 array_splice($codes_ccam, $XPosition, 1);
             }
         }
         $this->codes_ccam = implode("|", $codes_ccam);
     }
     if ($this->_time_op !== null) {
         $this->temp_operation = $this->_time_op;
     }
     if ($this->_time_urgence !== null) {
         $this->time_operation = $this->_time_urgence;
     } elseif ($this->_horaire_voulu) {
         $this->horaire_voulu = $this->_horaire_voulu;
     }
     $this->completeField('rank', 'plageop_id');
     if ($this->_move) {
         $op = new COperation();
         $op->plageop_id = $this->plageop_id;
         switch ($this->_move) {
             case 'before':
                 $op->rank = $this->rank - 1;
                 if ($op->loadMatchingObject()) {
                     $op->rank = $this->rank;
                     $op->store(false);
                     $this->rank -= 1;
                 }
                 break;
             case 'after':
                 $op->rank = $this->rank + 1;
                 if ($op->loadMatchingObject()) {
                     $op->rank = $this->rank;
                     $op->store(false);
                     $this->rank += 1;
                 }
                 break;
             case 'out':
                 $this->rank = 0;
                 $this->time_operation = '00:00:00';
                 $this->pause = '00:00:00';
                 break;
             case 'last':
                 if ($op->loadMatchingObject('rank DESC')) {
                     $this->rank = $op->rank + 1;
                 }
                 break;
             default:
         }
         $this->_reorder_rank_voulu = true;
         $this->_move = null;
     }
 }
Exemple #3
0
 /**
  * Charge la première internvention du jour
  *
  * @param datetime $date Datetime de référence
  *
  * @return COperation
  */
 function loadRefCurrOperation($date)
 {
     if (!$this->_id) {
         return $this->_ref_curr_operation = new COperation();
     }
     $operation = new COperation();
     $operation->sejour_id = $this->_id;
     $operation->date = CMbDT::date($date);
     $operation->loadMatchingObject();
     return $this->_ref_curr_operation = $operation;
 }