$exchange_source->setRecipient($email); // Création du token $token = new CViewAccessToken(); $token->ttl_hours = 24; $token->user_id = $praticien->_id; $token->params = "m=planningOp&a=vw_edit_urgence&operation_id={$operation_id}"; if ($msg = $token->store()) { CAppUI::displayAjaxMsg($msg, UI_MSG_ERROR); } $url = $token->getUrl(); // Lien vers la DHE $subject = CAppUI::conf("reservation subject_mail"); $content = CAppUI::conf("reservation text_mail"); $from = array("[URL]", "[PRATICIEN - NOM]", "[PRATICIEN - PRENOM]", "[DATE INTERVENTION]", "[HEURE INTERVENTION]"); $to = array($url, $praticien->_user_last_name, $praticien->_user_first_name, CMbDT::dateToLocale(CMbDT::date($operation->_datetime_best)), CMbDT::transform($operation->_datetime_best, null, CAppUI::conf("time"))); $subject = str_replace($from, $to, $subject); $exchange_source->setSubject($subject); $content = str_replace($from, $to, $content); $content = nl2br(utf8_encode($content)); $exchange_source->setBody($content); $exchange_source->send(); $operation->envoi_mail = CMbDT::dateTime(); if ($msg = $operation->store()) { CAppUI::displayAjaxMsg($msg, UI_MSG_ERROR); } CAppUI::displayAjaxMsg("Message envoyé"); } catch (phpmailerException $e) { CAppUI::displayAjaxMsg($e->errorMessage(), UI_MSG_WARNING); } catch (CMbException $e) { $e->stepAjax(); }
/** * Mise à jour des horaires en fonction de l'ordre des operations, * et mise a jour des rank, de sorte qu'ils soient consecutifs * * @param int $action action * * @return bool */ function reorderOp($action = null) { $this->completeField("debut", "temps_inter_op", "date"); if (!count($this->_ref_operations)) { $with_cancelled = CAppUI::conf("dPplanningOp COperation save_rank_annulee_validee"); $this->loadRefsOperations($with_cancelled, "rank, rank_voulu, horaire_voulu", true); } $new_time = $this->debut; $plage_multipraticien = $this->spec_id && !$this->unique_chir; $prev_op = new COperation(); $i = 0; foreach ($this->_ref_operations as $op) { // Intervention deja validée ou si on veut valider if ($op->rank || $action & self::RANK_VALIDATE) { $op->rank = ++$i; // Creation des pauses si plage multi-praticien if ($plage_multipraticien && $action & self::RANK_VALIDATE) { if ($prev_op->_id) { $op->time_operation = max($new_time, $op->horaire_voulu); $prev_op->pause = CMbDT::subTime($new_time, $op->time_operation); $prev_op->store(false); } else { $op->time_operation = $new_time; } $prev_op = $op; } else { $op->time_operation = $new_time; } // Pour faire suivre un changement de salle if ($this->salle_id && $this->fieldModified("salle_id")) { $op->salle_id = $this->salle_id; } } elseif (!$plage_multipraticien && $action & self::RANK_REORDER && ($op->horaire_voulu || $this->_reorder_up_to_interv_id)) { // Plage monopraticien $op->rank_voulu = ++$i; $op->horaire_voulu = $new_time; } if ($this->_reorder_up_to_interv_id == $op->_id) { $this->_reorder_up_to_interv_id = null; } $op->updateFormFields(); $op->store(false); // Durée de l'operation // + durée entre les operations // + durée de pause $new_time = CMbDT::addTime($op->temp_operation, $new_time); $new_time = CMbDT::addTime($this->temps_inter_op, $new_time); $new_time = CMbDT::addTime($op->pause, $new_time); } return true; }
/** * @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; } }
<?php /** * $Id$ * * @package Mediboard * @subpackage PlanningOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $copy_operation_id = CValue::post("copy_operation_id"); $date = CValue::post("date"); $salle_id = CValue::post("salle_id"); $sejour_id = CValue::post("sejour_id"); $time_operation = CValue::post("time_operation"); $operation = new COperation(); $operation->load($copy_operation_id); $operation->_id = $operation->_time_urgence = null; $operation->date = $date; $operation->salle_id = $salle_id; $operation->sejour_id = $sejour_id; $operation->time_operation = $time_operation; $msg = $operation->store(); CAppUI::setMsg($msg ? $msg : CAppUI::tr("COperation-msg-modify"), $msg ? UI_MSG_ERROR : UI_MSG_OK); CAppUI::getMsg(); CApp::rip();