/** * $Id: inc_personnel.php 20938 2013-11-13 11:02:47Z aurelie17 $ * * @package Mediboard * @subpackage bloodSalvage * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 20938 $ */ function loadAffected(&$blood_salvage_id, &$list_nurse_sspi, &$tabAffected, &$timingAffect) { $affectation = new CAffectationPersonnel(); $affectation->object_class = "CBloodSalvage"; $affectation->object_id = $blood_salvage_id; $tabAffected = $affectation->loadMatchingList(); foreach ($tabAffected as $key => $affect) { if (array_key_exists($affect->personnel_id, $list_nurse_sspi)) { unset($list_nurse_sspi[$affect->personnel_id]); } $affect->_ref_personnel->loadRefUser(); } // Initialisations des tableaux des timings foreach ($tabAffected as $key => $affectation) { $timingAffect[$affectation->_id]["_debut"] = array(); $timingAffect[$affectation->_id]["_fin"] = array(); } // Remplissage des tableaux des timings foreach ($tabAffected as $id => $affectation) { foreach ($timingAffect[$affectation->_id] as $key => $value) { for ($i = -10; $i < 10 && $affectation->{$key} !== null; $i++) { $timingAffect[$affectation->_id][$key][] = CMbDT::time("{$i} minutes", $affectation->{$key}); } } } }
function managePersonnel($obj) { global $_iade_id, $_aideop_id, $_op_panseuse_id, $_sagefemme_id, $_manipulateur_id, $del_personnel; if ($_iade_id) { $affectation_personnel = new CAffectationPersonnel(); $affectation_personnel->object_class = $obj->_class; $affectation_personnel->object_id = $obj->_id; $affectation_personnel->personnel_id = $_iade_id; if ($msg = $affectation_personnel->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("IADE ajoutée", UI_MSG_OK); } } if ($_aideop_id) { $affectation_personnel = new CAffectationPersonnel(); $affectation_personnel->object_class = $obj->_class; $affectation_personnel->object_id = $obj->_id; $affectation_personnel->personnel_id = $_aideop_id; if ($msg = $affectation_personnel->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("Aide opératoire ajoutée", UI_MSG_OK); } } if ($_op_panseuse_id) { $affectation_personnel = new CAffectationPersonnel(); $affectation_personnel->object_class = $obj->_class; $affectation_personnel->object_id = $obj->_id; $affectation_personnel->personnel_id = $_op_panseuse_id; if ($msg = $affectation_personnel->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("Panseuse ajoutée", UI_MSG_OK); } } if ($_sagefemme_id) { $affectation_personnel = new CAffectationPersonnel(); $affectation_personnel->object_class = $obj->_class; $affectation_personnel->object_id = $obj->_id; $affectation_personnel->personnel_id = $_sagefemme_id; if ($msg = $affectation_personnel->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("Sage femme ajoutée", UI_MSG_OK); } } if ($_manipulateur_id) { $affectation_personnel = new CAffectationPersonnel(); $affectation_personnel->object_class = $obj->_class; $affectation_personnel->object_id = $obj->_id; $affectation_personnel->personnel_id = $_manipulateur_id; if ($msg = $affectation_personnel->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("Manipulateur ajouté", UI_MSG_OK); } } foreach ($del_personnel as $_personnel_id) { if ($_personnel_id) { $affectation_personnel = new CAffectationPersonnel(); $affectation_personnel->object_class = $obj->_class; $affectation_personnel->object_id = $obj->_id; $affectation_personnel->personnel_id = $_personnel_id; $affectation_personnel->loadMatchingObject(); if ($affectation_personnel->_id) { if ($msg = $affectation_personnel->delete()) { CAppui::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("Personnel supprimé"); } } } } }
* @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ * @link http://www.mediboard.org */ $step = CValue::get("step", 0); $aff_pers = new CAffectationPersonnel(); $where = array(); $where["object_class"] = "= 'CPlageOp'"; $affs = $aff_pers->loadList($where, null, "{$step},1000"); /**@var $_aff CAffectationPersonnel */ foreach ($affs as $_aff) { $plage = $_aff->loadRefObject(); $ops = $plage->loadBackIds("operations"); foreach ($ops as $_op) { $affectation = new CAffectationPersonnel(); $whereAff = array(); $whereAff["personnel_id"] = "= '{$_aff->personnel_id}'"; $whereAff["object_class"] = "= 'COperation'"; $whereAff["object_id"] = "= '{$_op}'"; $whereAff["parent_affectation_id"] = "IS NULL"; if ($affectation->loadObject($whereAff)) { $affectation->parent_affectation_id = $_aff->_id; $msg = $affectation->store(); CAppUI::stepAjax($msg ? $msg : "Affectation modifiée", $msg ? UI_MSG_ERROR : UI_MSG_OK); } } } CAppui::js('if (' . count($affs) . ' > 0) { $V(getForm("Configure").step, parseInt($V(getForm("Configure").step))+1000); affUpdate();
/** * Trouve les affectations avec cible et personnel identique * * @return array Liste des siblings */ function getSiblings() { // Version complete $clone = new CAffectationPersonnel(); $clone->load($this->_id); $clone->extendsWith($this); // Filtre exact $sibling = new CAffectationPersonnel(); $sibling->object_class = $clone->object_class; $sibling->object_id = $clone->object_id; $sibling->personnel_id = $clone->personnel_id; // Chargement des siblings $siblings = $sibling->loadMatchingList(); unset($siblings[$this->_id]); return $siblings; }
// Chargement de l'operation selectionnee $operation_id = CValue::getOrSession("operation_id"); $selOp = new COperation(); $selOp->load($operation_id); $plageOp = $selOp->loadRefPlageOp(); $listPers = $selOp->loadPersonnelDisponible(); // Creation du tableau d'affectation de personnel $tabPersonnel = array(); $plageOp->loadAffectationsPersonnel(); $affectations_personnel = $plageOp->_ref_affectations_personnel; $affectations_plage = array_merge($affectations_personnel["iade"], $affectations_personnel["op"], $affectations_personnel["op_panseuse"], $affectations_personnel["sagefemme"], $affectations_personnel["manipulateur"]); // Tableau de stockage des affectations $tabPersonnel["plage"] = array(); $tabPersonnel["operation"] = array(); foreach ($affectations_plage as $key => $affectation_personnel) { $affectation = new CAffectationPersonnel(); $affectation->setObject($selOp); $affectation->personnel_id = $affectation_personnel->personnel_id; $affectation->parent_affectation_id = $affectation_personnel->_id; $affectation->loadMatchingObject(); if (!$affectation->_id) { $affectation->parent_affectation_id = $affectation_personnel->_id; } $affectation->loadRefPersonnel(); $affectation->_ref_personnel->loadRefUser(); $affectation->_ref_personnel->_ref_user->loadRefFunction(); $tabPersonnel["plage"][$affectation->personnel_id] = $affectation; } // Chargement du de l'operation $affectations_personnel = $selOp->_ref_affectations_personnel; $affectations_operation = array_merge($affectations_personnel["iade"], $affectations_personnel["op"], $affectations_personnel["op_panseuse"], $affectations_personnel["sagefemme"], $affectations_personnel["manipulateur"]);
$mediuser = new CMediusers(); $listUsers[$personnel->user_id] = $mediuser->load($personnel->user_id); } // Calcul des personnel_ids pour chaque user $where = array(); foreach ($listUsers as $key => $user) { $personnel = new CPersonnel(); $where["user_id"] = " = '{$key}'"; $personnels = $personnel->loadList($where); foreach ($personnels as $keyPers => $_personnel) { $listPers[$key][$_personnel->emplacement] = $_personnel->_id; } } $listAffectations = array(); // Chargement de la liste des affectations pour le filtre $filter = new CAffectationPersonnel(); $filter->object_id = $object_id; $filter->object_class = $object_class; $where = array(); if ($object_id) { $where["object_id"] = " = '{$object_id}'"; } if ($object_class) { $where["object_class"] = " = '{$object_class}'"; } if ($list) { $where["personnel_id"] = CSQLDataSource::prepareIn($list); } // Chargement des 50 dernieres affectations de personnel $order = "affect_id DESC"; $limit = "0, 50";
<?php /** * $Id:$ * * @package Mediboard * @subpackage dPpersonnel * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision:$ */ global $can; $can->needsAdmin(); $affectation = new CAffectationPersonnel(); $ds = $affectation->_spec->ds; $query = "CREATE TEMPORARY TABLE `affectations_multiples` AS (\r\n SELECT COUNT(*) AS `affect_count`, `object_class`, `object_id`, `personnel_id`\r\n FROM `affectation_personnel` \r\n GROUP BY `object_class`, `object_id`, `personnel_id`)"; $ds->exec($query); $query = "SELECT * \r\n FROM `affectations_multiples`\r\n WHERE `affect_count` > 1\r\n ORDER BY `affect_count` DESC"; $multiples = $ds->loadList($query); $objects = array(); $personnels = array(); foreach ($multiples as &$_multiple) { $affectation->object_class = $_multiple["object_class"]; $affectation->object_id = $_multiple["object_id"]; $affectation->personnel_id = $_multiple["personnel_id"]; $affectation->_ref_object = null; $affectation->loadTargetObject(); $_multiple["object"] = $affectation->_ref_object; $affectation->loadRefPersonnel(); $_multiple["personnel"] = $affectation->_ref_personnel; $_multiple["affectations"] = $affectation->loadMatchingList();