public function testRemoveValueHasRightReturn() { $array = array(); $this->assertEquals(0, $this->stub->removeValue(0, $array)); $array = array("key1" => "value1", "key2" => "value2", "key3" => "value3"); $this->assertEquals(1, $this->stub->removeValue("value2", $array)); $array = array("key1" => "value1", "key2" => "value1", "key3" => "value3"); $this->assertEquals(2, $this->stub->removeValue("value1", $array)); }
function addAudiogramme($values, $value_name, $title, $mark_color, $mark_type, $mark_file = null, $line = true) { $frequences = CExamAudio::$frequences; $root = CAppUI::conf("root_dir"); $image_file = "{$root}/images/icons/{$mark_file}"; // Empty plot case $datay = $values; CMbArray::removeValue("", $datay); if (!count($datay)) { return; } $words = explode(" ", $this->title->t); $cote = $words[1]; $labels = array(); $jscalls = array(); // Remove empty values to connect distant points $datax = array(); $datay = array(); foreach ($values as $key => $value) { if ($value !== "" && $value !== null) { $frequence = $frequences[$key]; $jstitle = strtr($title, "\n", " "); $labels[] = "Modifier la valeur {$value}dB pour {$jstitle} à {$frequence}"; $jscalls[] = "javascript:changeTonalValue('{$cote}','{$value_name}',{$key})"; $datay[] = -intval($value); $datax[] = "{$key}"; // Needs to be a string when null } } $p1 = new LinePlot($datay, $datax); $p1->mark->SetType($mark_type, $image_file, 1.0); $this->Add($p1); // Create the first line $p1->SetColor($mark_color); $p1->SetCenter(); $p1->SetLegend($title); $p1->SetWeight($line ? 1 : -10); $p1->SetCSIMTargets($jscalls, $labels); // Marks $p1->mark->SetColor($mark_color); $p1->mark->SetFillColor("{$mark_color}@0.6"); $p1->mark->SetWidth(4); }
function addAudiogramme($values, $mark_color) { $pressions = CExamAudio::$pressions; // Empty plot case $datay = $values; CMbArray::removeValue("", $datay); if (!count($datay)) { return; } $title = $this->title->t; $words = explode(" ", $title); $cote = $words[1]; $labels = array(); $jscalls = array(); // Remove empty values to connect distant points $datax = array(); $datay = array(); foreach ($values as $key => $value) { if ($value !== "" && $value !== null) { $pression = $pressions[$key]; $jstitle = strtr($title, "\n", " "); $labels[] = "Modifier l'admittance {$value} ml pour {$jstitle} à la pression {$pression} mm H²0"; $jscalls[] = "javascript:changeTympanValue('{$cote}',{$key})"; $datay[] = $value; $datax[] = "{$key}"; // Needs to be a string when null } } $p1 = new LinePlot($datay, $datax); // Create the first line $p1->SetColor($mark_color); $p1->SetCenter(); $p1->SetWeight(1); $p1->SetCSIMTargets($jscalls, $labels); // Marks $p1->mark->SetType(MARK_FILLEDCIRCLE); $p1->mark->SetColor($mark_color); $p1->mark->SetFillColor("{$mark_color}@0.6"); $p1->mark->SetWidth(4); $this->Add($p1); }
$_object->_disabled = true; } $_selected = reset($extid); } } } // Selected object IS selected (!) $_selected->_selected = true; // Check merge /** @var CMbObject $result */ $result = new $objects_class(); $checkMerge = $result->checkMerge($objects); // Merge trivial fields foreach (array_keys($result->getPlainFields()) as $field) { $values = CMbArray::pluck($objects, $field); CMbArray::removeValue("", $values); // No values if (!count($values)) { $statuses[$field] = "none"; continue; } $result->{$field} = reset($values); // One unique value if (count($values) == 1) { $statuses[$field] = "unique"; continue; } // Multiple values $statuses[$field] = count(array_unique($values)) == 1 ? "duplicate" : "multiple"; } $result->updateFormFields();
/** * Vérification du code ccam * * @return string|null */ function checkCodeCcam() { $codes_ccam = explode("|", $this->codes_ccam); CMbArray::removeValue("", $codes_ccam); foreach ($codes_ccam as $_code_ccam) { if (!preg_match("/^[A-Z]{4}[0-9]{3}(-[0-9](-[0-9])?)?\$/i", $_code_ccam)) { return "Le code CCAM '{$_code_ccam}' n'est pas valide"; } } return null; }
/** * Count the exchanges for the all sejours * * @param CMbObject[] $objects CMbObject * @param String $type Type * @param String $subtype Sous type * * @return void */ static function massCountExchanges($objects, $type = null, $subtype = null) { if (!count($objects)) { return null; } $object = current($objects); $object_ids = CMbArray::pluck($objects, $object->_spec->key); $object_ids = array_unique($object_ids); CMbArray::removeValue("", $object_ids); if (!count($object_ids)) { return null; } $where = array("object_id" => CSQLDataSource::prepareIn($object_ids), "object_class" => "= '{$object->_class}'"); if ($type) { $where["type"] = "= '{$type}'"; } if ($subtype) { $where["sous_type"] = "= '{$subtype}'"; } $count_exchanges = array(); foreach (CExchangeDataFormat::getAll() as $_data_format) { /** @var CExchangeDataFormat $data_format */ $data_format = new $_data_format(); if (!$data_format->hasTable()) { continue; } $table_exchange = $data_format->_spec->table; $count_exchanges[$table_exchange] = $data_format->countMultipleList($where, null, "object_id", null, array("object_id")); } foreach ($count_exchanges as $_exchange => $_counts) { foreach ($_counts as $_value) { $total = $_value["total"]; $object_id = $_value["object_id"]; if (!isset($objects[$object_id]->_nb_exchanges_by_format[$_exchange])) { $objects[$object_id]->_nb_exchanges_by_format[$_exchange] = 0; } $objects[$object_id]->_nb_exchanges_by_format[$_exchange] += $total; $objects[$object_id]->_nb_exchanges += $total; } } }
$_type_admission = CValue::getOrSession("_type_admission", "ambucomp"); $filter_function = CValue::getOrSession("filter_function"); $date = CValue::getOrSession("date"); $granularite = CValue::getOrSession("granularite"); $readonly = CValue::getOrSession("readonly", 0); $duree_uscpo = CValue::getOrSession("duree_uscpo", "0"); $isolement = CValue::getOrSession("isolement", "0"); $prestation_id = CValue::getOrSession("prestation_id", ""); $item_prestation_id = CValue::getOrSession("item_prestation_id"); $group_id = CGroups::loadCurrent()->_id; if (CAppUI::conf("dPhospi prestations systeme_prestations", $group_id) == "standard") { CValue::setSession("prestation_id", ""); $prestation_id = ""; } if (is_array($services_ids)) { CMbArray::removeValue("", $services_ids); } $where = array(); $where["annule"] = "= '0'"; $where["sejour.group_id"] = "= '{$group_id}'"; $where[] = "(sejour.type != 'seances' && affectation.affectation_id IS NULL) || sejour.type = 'seances'"; $where["sejour.service_id"] = "IS NULL " . (is_array($services_ids) && count($services_ids) ? "OR `sejour`.`service_id` " . CSQLDataSource::prepareIn($services_ids) : ""); $order = null; switch ($triAdm) { case "date_entree": $order = "entree ASC, sortie ASC"; break; case "praticien": $order = "users_mediboard.function_id, users.user_last_name, users.user_first_name"; break; case "patient":
$filter->_specialite = CValue::get("_specialite", 0); $filter->convalescence = CValue::get("convalescence", 0); $filter->consult_accomp = CValue::get("consult_accomp", 0); $filter->_admission = CValue::get("_admission", "heure"); $filter->_ccam_libelle = CValue::get("_ccam_libelle", "1"); $filter->_coordonnees = CValue::get("_coordonnees", 0); $filter->_notes = CValue::get("_notes", 0); $filter->_nb_days = CValue::get("_nb_days", 0); $filter->_by_date = CValue::get("_by_date", 0); if ($filter->_nb_days) { $filter->_date_max = CMbDT::date("+{$filter->_nb_days} days", CMbDT::date($filter->_date_min)) . " 21:00:00"; } $filter->_service = explode(",", $filter->_service); $filter->praticien_id = explode(",", $filter->praticien_id); CMbArray::removeValue(0, $filter->praticien_id); CMbArray::removeValue(0, $filter->_service); $total = 0; $sejours = new CSejour(); $sejourReq = new CRequest(); $sejourReq->addLJoinClause("patients", "patients.patient_id = sejour.patient_id"); $sejourReq->addLJoinClause("users", "users.user_id = sejour.praticien_id"); $sejourReq->addWhereClause("sejour.{$filter->_horodatage}", "BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'"); $sejourReq->addWhereClause("sejour.group_id", "= '{$group->_id}'"); $sejourReq->addWhereClause("sejour.annule", "= '0'"); // On supprime les sejours d'urgence $sejourReq->addWhereClause("sejour.type", "!= 'urg'"); // Clause de filtre par spécialité / chir if ($filter->_specialite or $filter->praticien_id) { $speChirs = new CMediusers(); $speChirs = $speChirs->loadList(array("function_id" => "= '{$filter->_specialite}'")); if (count($filter->praticien_id)) {
$values = array(); if (isset($_POST["_CListeChoix"])) { $listes = $_POST["_CListeChoix"]; foreach ($listes as $list_id => $options) { $options = array_map(array('CMbString', 'htmlEntities'), $options); $list = new CListeChoix(); $list->load($list_id); $is_empty = false; if ($check_to_empty_field && isset($_POST["_empty_list"][$list_id]) || !$check_to_empty_field && !isset($_POST["_empty_list"][$list_id])) { $values[] = ""; $is_empty = true; } else { if ($options === array(0 => "undef")) { continue; } CMbArray::removeValue("undef", $options); $values[] = nl2br(implode(", ", $options)); } $nom = CMbString::htmlEntities($list->nom, ENT_QUOTES); if ($is_empty) { $fields[] = "<span class=\"name\">[Liste - " . $nom . "]</span>"; } else { $fields[] = "[Liste - " . $nom . "]"; } } } $_POST["_source"] = str_ireplace($fields, $values, $_POST["_source"]); // Si purge_field est valué, on effectue l'opération de nettoyage des lignes if (isset($_POST["purge_field"]) && $_POST["purge_field"] != "") { $purge_field = $_POST["purge_field"]; $purge_field = str_replace("/", "\\/", $purge_field);
/** * @see parent::store() */ function store() { $this->completeField("codes_cim"); $this->_codes_cim = $this->codes_cim ? explode("|", $this->codes_cim) : array(); if ($this->_added_code_cim) { $da = CCodeCIM10::get($this->_added_code_cim); if (!$da->exist) { CAppUI::setMsg("Le code CIM saisi n'est pas valide", UI_MSG_WARNING); return null; } $this->_codes_cim[] = $this->_added_code_cim; } if ($this->_deleted_code_cim) { CMbArray::removeValue($this->_deleted_code_cim, $this->_codes_cim); } $this->codes_cim = implode("|", array_unique($this->_codes_cim)); $this->completeField("object_id", "object_class"); if ($this->object_class == "CPatient" && $this->fieldModified("codes_cim")) { DSHM::remKeys("alertes-*-CPatient-" . $this->object_id); } return parent::store(); }
* * @package Mediboard * @subpackage soins * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $group = CGroups::loadCurrent(); $service_id = CValue::getOrSession("service_id"); $real_time = CValue::getOrSession("real_time", 0); $categories_id_pancarte = CValue::getOrSession("categories_id_pancarte"); if ($service_id == "NP") { $service_id = ""; } if (is_array($categories_id_pancarte)) { CMbArray::removeValue("", $categories_id_pancarte); } $cond = array(); // Chargement du service $service = new CService(); $service->load($service_id); // Si le service en session n'est pas dans l'etablissement courant if (CGroups::loadCurrent()->_id != $service->group_id) { $service_id = ""; $service = new CService(); } $date = CValue::getOrSession("debut"); $prescription_id = CValue::get("prescription_id"); // Chargement des configs de services if (!$service_id) { $service_id = "none";
/** * Remove a token in the string * * @param string $string The string to reduce * @param string $glue Implode/explode like glue * @param string $token Token to remove * * @return string */ static function removeToken($string, $glue, $token) { $tokens = explode($glue, $string); CMbArray::removeValue($token, $tokens); return implode($glue, $tokens); }
/** * parse the raw version * * @param String $raw raw message * @param String $country_code country code * * @return void */ private function parseRawVersion($raw, $country_code = null) { $parts = explode($this->componentSeparator, $raw); CMbArray::removeValue("", $parts); $this->version = $parts[0]; // Version spécifique française spécifiée if (count($parts) > 1) { $this->type = $parts[1]; } // Dans le cas où la version passée est incorrecte on met par défaut 2.3 if (!in_array($this->version, self::$versions)) { $this->version = CAppUI::conf("hprimsante default_version"); } }
/** * Pre-serialize magic method * * @return array Property keys to be serialized */ function __sleep() { $vars = get_object_vars($this); unset($vars["_class"]); unset($vars["_spec"]); unset($vars["_props"]); unset($vars["_specs"]); unset($vars["_backProps"]); unset($vars["_backSpecs"]); unset($vars["_ref_module"]); // Non strict value Removing would purge empty arrays CMbArray::removeValue(null, $vars, true); CMbArray::removeValue("", $vars, true); return array_keys($vars); }
private function parseRawVersion($raw, $country_code = null) { $parts = explode($this->componentSeparator, $raw); CMbArray::removeValue("", $parts); $this->version = $version = $parts[0]; $actor = $this->actor; $configs = new CHL7Config(); if ($actor instanceof CInteropSender) { $exchange_hl7v2 = new CExchangeHL7v2(); $configs = $exchange_hl7v2->getConfigs($actor->_guid); } // On privilégie le code du pays sur l'acteur d'intégration $country_code = $configs->country_code ? $configs->country_code : $country_code; // Recherche depuis le code du pays switch ($country_code) { case "FRA": case "FR": $this->i18n_code = "FR"; $this->extension = $version = "FR_2.3"; break; default: } // Version spécifique française spécifiée if (!$country_code && count($parts) > 1) { $this->i18n_code = $parts[1]; $this->extension = $version = "{$parts['1']}_{$parts['2']}"; } // Dans le cas où la version passée est incorrecte on met par défaut 2.5 if (!in_array($version, self::$versions)) { $this->version = CAppUI::conf("hl7 default_version"); } }
/** * @param array $params tableau des parametres * - object : Objet * - field : Nom du champ a afficher (le champs doit avoir des specs sinon "spec" non optionnel) * - prop : {optionnel} Specification du champs, par defaut, celle de la classe * - separator : {optionnel} Séparation entre les champs de type "radio" [default: ""] * - cycle : {optionnel} Cycle de répétition du séparateur (pour les enums en type radio) [default: "1"] * - typeEnum : {optionnel} Type d'affichage des enums (values : "select", "radio") [default: "select"] * - emptyLabel : {optionnel} Ajout d'un "option" en amont des valeurs ayant pour value "" * - class : {optionnel} Permet de donner une classe aux champs * - hidden : {optionnel} Permet de forcer le type "hidden" * - canNull : {optionnel} Permet de passer outre le notNull de la spécification * @param self &$smarty The Smarty object */ function mb_field($params, &$smarty) { if (CAppUI::conf("readonly")) { //$params["readonly"] = 1; } require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars'); if (null == ($object = CMbArray::extract($params, "object"))) { $class = CMbArray::extract($params, "class", null, true); $object = new $class(); } $field = CMbArray::extract($params, "field", null, true); $prop = CMbArray::extract($params, "prop"); $canNull = CMbArray::extract($params, "canNull"); if (null !== ($value = CMbArray::extract($params, "value"))) { $object->{$field} = $value; } // Get spec, may create it $spec = $prop !== null ? CMbFieldSpecFact::getSpec($object, $field, $prop) : $object->_specs[$field]; if ($canNull === "true" || $canNull === true) { $spec->notNull = 0; $tabSpec = explode(" ", $spec->prop); CMbArray::removeValue("notNull", $tabSpec); $spec->prop = implode(" ", $tabSpec); } if ($canNull === "false" || $canNull === false) { $spec->notNull = 1; $spec->prop = "canNull notNull {$spec->prop}"; } // If protection enabled if (CAppUI::conf("csrf_protection") && self::$is_open) { $static = CMbArray::extract($params, "static", false); if ($static) { self::$csrf_values[$field] = $object->{$field}; } } return $spec->getFormElement($object, $params); }
static function getServicesIdsPref($services_ids = array()) { // Détection du changement d'établissement $group_id = CValue::get("g"); if (!$services_ids || $group_id) { $group_id = $group_id ? $group_id : CGroups::loadCurrent()->_id; $pref_services_ids = json_decode(CAppUI::pref("services_ids_hospi")); // Si la préférence existe, alors on la charge if (isset($pref_services_ids->{"g{$group_id}"})) { $services_ids = $pref_services_ids->{"g{$group_id}"}; $services_ids = explode("|", $services_ids); CMbArray::removeValue("", $services_ids); } else { $service = new CService(); $where = array(); $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $where["cancelled"] = "= '0'"; $services_ids = array_keys($service->loadListWithPerms(PERM_READ, $where, "externe, nom")); } } if (is_array($services_ids)) { CMbArray::removeValue("", $services_ids); } global $m; $save_m = $m; foreach (array("dPhospi", "dPadmissions") as $_module) { $m = $_module; CValue::setSession("services_ids", $services_ids); } $m = $save_m; return $services_ids; }
/** * $Id$ * * @package Mediboard * @subpackage SalleOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $object_guid = CValue::get("object_guid"); $type_group = CValue::get("type_group"); $validateur_ids = CValue::get("validateur_ids"); if (!is_array($validateur_ids)) { $validateur_ids = explode("-", $validateur_ids); CMbArray::removeValue("", $validateur_ids); } if (count($validateur_ids)) { // Pas utiliser IN car on les souhaite dans l'ordre spécifié $validateurs = array(); foreach ($validateur_ids as $_id) { $validateur = new CMediusers(); $validateur->load($_id); $validateurs[$_id] = $validateur; } } else { $validateurs = array(); } $object = CMbObject::loadFromGuid($object_guid); // Chargement des 3 check lists de l'OMS $check_lists = array();
/** * Mass load mechanism for forward references of an object collection * * @param self[] $objects Array of objects * @param string $field Field to load * @param string $object_class Restrict to explicit object class in case of meta reference * @param bool $keep_sorted Keep the same order as the one in $objects * * @return self[] Loaded collection, null if unavailable, with ids as keys of guids for meta references */ static function massLoadFwdRef($objects, $field, $object_class = null, $keep_sorted = false) { if (!count($objects)) { return array(); } $object = reset($objects); $spec = $object->_specs[$field]; if (!$spec instanceof CRefSpec) { trigger_error("Can't mass load not ref '{$field}' for class '{$object->_class}'", E_USER_WARNING); return null; } $meta = $spec->meta; if ($object_class && !$spec->meta) { trigger_error("Mass load with object class is unavailable for non meta ref '{$field}' in class '{$object->_class}'", E_USER_WARNING); return null; } // Delegated mass load forward references by meta class then append in global array with guid as keys if ($meta && !$object_class) { $object_classes = array(); foreach ($objects as $_object) { $object_classes[$_object->{$meta}] = true; } $fwd_objects = array(); foreach (array_keys($object_classes) as $_object_class) { // Merge array_values to get rid of non integer keys $fwd_objects = array_merge($fwd_objects, array_values(self::massLoadFwdRef($objects, $field, $_object_class))); } // Final array has guids for keys; return array_combine(CMbArray::pluck($fwd_objects, "_guid"), $fwd_objects); } // No existing class if (!self::classExists($spec->class)) { return null; } /** @var self $fwd */ $class = CValue::first($object_class, $spec->class); $fwd = self::getInstance($class); // Inactive module if (!$fwd->_ref_module) { return null; } // Get the ids $fwd_ids = array(); if ($object_class) { foreach ($objects as $_object) { if ($_object->{$meta} == $object_class) { $fwd_ids[] = $_object->{$field}; } } } else { $fwd_ids = CMbArray::pluck($objects, $field); } // Trim real ids $fwd_ids = array_unique($fwd_ids); CMbArray::removeValue("", $fwd_ids); // Only run when there's something to look for if (!count($fwd_ids)) { return array(); } $where[$fwd->_spec->key] = CSQLDataSource::prepareIn($fwd_ids); $list = $fwd->loadList($where); if (!$keep_sorted) { return $list; } $list_sorted = array(); foreach ($fwd_ids as $_fwd_id) { $list_sorted[$_fwd_id] = $list[$_fwd_id]; } return $list_sorted; }
/** * $Id$ * * @category Pmsi * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @link http://www.mediboard.org */ CCanDo::checkRead(); $ds = CSQLDataSource::get("std"); $filterFunction = CValue::get("filterFunction"); $type = CValue::get("_type_admission"); $service_id = CValue::get("service_id"); $service_id = explode(",", $service_id); CMbArray::removeValue("", $service_id); $prat_id = CValue::get("prat_id"); $order_way = CValue::get("order_way", "ASC"); $order_col = CValue::get("order_col", "patient_id"); $tri_recept = CValue::get("tri_recept"); $tri_complet = CValue::get("tri_complet"); $date = CValue::getOrSession("date", CMbDT::date()); $month_min = CMbDT::date("first day of +0 month", $date); $lastmonth = CMbDT::date("last day of -1 month", $date); $nextmonth = CMbDT::date("first day of +1 month", $date); $bank_holidays = CMbDate::getHolidays($date); $group = CGroups::loadCurrent(); $where = array(); $leftjoin = array(); // Initialisation du tableau de jours $days = array();
/** * Merge two domains EAI * * @category EAI * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $domains_id = CValue::get("domains_id"); if (!is_array($domains_id)) { $domains_id = explode("-", $domains_id); } CMbArray::removeValue("", $domains_id); $domains = array(); $checkMerge = array(); if (count($domains_id) != 2) { $checkMerge[] = CAppUI::tr("mergeTooFewObjects"); } foreach ($domains_id as $domain_id) { $domain = new CDomain(); // the CMbObject is loaded if (!$domain->load($domain_id)) { CAppUI::setMsg("Chargement impossible de l'objet [{$domain_id}]", UI_MSG_ERROR); continue; } $domain->loadRefIncrementer(); $domain->loadRefActor(); $domains[] = $domain;
/** * $Id$ * * @package Mediboard * @subpackage PlanningOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $sejour_id = CValue::get("sejour_id"); $operation_id = CValue::get("operation_id"); $operateur_ids = CValue::get("operateur_ids"); if (!is_array($operateur_ids)) { $operateur_ids = explode("-", $operateur_ids); CMbArray::removeValue("", $operateur_ids); } if (count($operateur_ids)) { $operateur = new CMediusers(); $where = array("user_id" => "IN(" . implode(",", $operateur_ids) . ")"); $operateurs = $operateur->loadList($where); } else { $operateurs = array(); } $poses = array(); if ($operation_id) { $interv = new COperation(); $interv->load($operation_id); $poses = $interv->loadRefsPosesDispVasc(true); } elseif ($sejour_id) { $sejour = new CSejour();
CApp::setTimeLimit(600); $count_min = CValue::post("count_min", 1); $merge_dates = CValue::post("merge_dates", 0); $dry_run = CValue::post("dry_run"); // Ignore handlers global $dPconfig; $dPconfig["object_handlers"] = array(); CMbObject::$useObjectCache = false; $correspondant = new CCorrespondantPatient(); $fields = array_keys($correspondant->getPlainFields()); $spec = $correspondant->_spec; // Don't group by key... of course CMbArray::removeValue($spec->key, $fields); // Don't group by date if ($merge_dates) { CMbArray::removeValue("date_debut", $fields); } $select = $fields; $select["TOTAL"] = "COUNT(*)"; $select["IDS"] = "GROUP_CONCAT(CAST({$spec->key} AS CHAR))"; $orderby = "TOTAL DESC"; $count_min = max(1, $count_min); $having = array("TOTAL" => $spec->ds->prepare("> ?", $count_min)); $where = array("patient_id" => "IS NOT NULL"); $request = new CRequest(); $request->addSelect($select); $request->addTable($spec->table); $request->addGroup($fields); $request->addWhere($where); $request->addOrder($orderby); $request->addHaving($having);
/** * @see parent::updateFormFields() */ function updateFormFields() { parent::updateFormFields(); $this->_modificateurs = str_split($this->modificateurs); CMbArray::removeValue("", $this->_modificateurs); $this->_dents = explode("|", $this->position_dentaire); $this->_shortview = $this->code_acte; $this->_view = "{$this->code_acte}-{$this->code_activite}-{$this->code_phase}-{$this->modificateurs}"; $this->_anesth = $this->code_activite == 4; // Remboursement exceptionnel $code = CDatedCodeCCAM::get($this->code_acte, $this->execution); $this->_rembex = $this->rembourse && $code->remboursement == 3 ? '1' : '0'; }
/** * Store Acte * * @param String[] $data Value * @param String $type CCAM or NGAP * @param CSejour $sejour Sejour * @param CPatient $patient Patient * @param String $tag Tag * * @return String|CActe; */ function storeActe($data, $type, $sejour, $patient, $tag) { $code_acte = "code"; if ($type == "CCAM") { $field_object = "codes_ccam"; $code_acte = "code_acte"; } $action = $data["action"]; $idex = CIdSante400::getMatch("CActe{$type}", $tag, $data["idSourceActe{$type}"]); $executant_id = $data["executant_id"]; if ($idex->_id) { $class = "CActe{$type}"; /** @var CActeCCAM|CActeNGAP $acte */ $acte = new $class(); $acte->load($idex->object_id); $object = $acte->loadTargetObject(); if ($action === "suppression") { if ($type == "CCAM") { $code = $acte->{$code_acte}; $replace = explode("|", $object->{$field_object}); CMbArray::removeValue($code, $replace); $object->{$field_object} = $replace ? implode("|", $replace) : ""; } if ($msg = $this->deleteActe($acte, $object, $idex)) { return $msg; } return $acte; } /** @var CActeCCAM|CActeNGAP $new_acte */ $new_acte = $this->{"createActe{$type}"}($data["acte{$type}"], $object, $executant_id); $modification = $new_acte->{$code_acte} != $acte->{$code_acte}; if ($modification) { if ($type == "CCAM") { $new_code = preg_replace("#{$acte}->{$code_acte}#", $new_acte->{$code_acte}, $object->{$field_object}, 1); $object->{$field_object} = $new_code; } if ($msg = $this->deleteActe($acte, $object, $idex)) { return $msg; } $acte = new $class(); } $acte->extendsWith($new_acte, true); if ($msg = $acte->store()) { return $msg; } if ($modification) { $idex->setObject($acte); if ($msg = $idex->store()) { return $msg; } } return $acte; } if ($action !== "création") { return "{$action} impossible car l'acte n'a pas été trouvé"; } $date = CMbDT::date($data["acte{$type}"]["date"]); $object = $this->getObject($date, $executant_id, $patient->_id); $object = $object ? $object : $sejour; /** @var CActe $acte */ $acte = $this->{"createActe{$type}"}($data["acte{$type}"], $object, $executant_id); if ($type == "CCAM") { $object->{$field_object} .= $object->{$field_object} ? "|{$acte->{$code_acte}}" : $acte->{$code_acte}; } if ($msg = $object->store()) { return $msg; } if ($msg = $acte->store()) { return $msg; } $idex = new CIdSante400(); $idex->id400 = $data["idSourceActe{$type}"]; $idex->tag = $tag; $idex->setObject($acte); if ($msg = $idex->store()) { return $msg; } return $acte; }
/** * Impression d'une sélection de documents * * @category CompteRendu * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:\$ * @link http://www.mediboard.org */ $nbDoc = CView::get("nbDoc", "str"); CView::checkin(); $documents = array(); $pdf = new CMbPDFMerger(); CMbArray::removeValue("0", $nbDoc); if (!count($nbDoc)) { CAppUI::stepAjax("Aucun document à imprimer !"); CApp::rip(); } $compte_rendu = new CCompteRendu(); $where = array("compte_rendu_id" => CSQLDataSource::prepareIn(array_keys($nbDoc))); /** @var $_compte_rendu CCompteRendu */ foreach ($compte_rendu->loadList($where) as $_compte_rendu) { $_compte_rendu->date_print = CMbDT::dateTime(); $_compte_rendu->store(); $_compte_rendu->makePDFpreview(1); $nb_print = $nbDoc[$_compte_rendu->_id]; for ($i = 1; $i <= $nb_print; $i++) { $pdf->addPDF($_compte_rendu->_ref_file->_file_path); }
/** * Remove a table in the module * * @param string $table Table name * * @return void */ function dropTable($table) { CMbArray::removeValue($table, $this->tables); }
/** * Recherche de codes CCAM * * @param string $code Codes partiels à chercher * @param string $keys Mot clés à chercher * @param int $max_length Longueur maximum du code * @param string $where Autres paramètres where * * @return array Tableau d'actes */ function findCodes($code = '', $keys = '', $max_length = null, $where = null) { $ds = $this->_spec->ds; $query = "SELECT CODE, LIBELLELONG\n FROM p_acte\n WHERE DATEFIN = '00000000' "; $keywords = explode(" ", $keys); $codes = explode(" ", $code); CMbArray::removeValue("", $keywords); CMbArray::removeValue("", $codes); if ($keys != "") { $listLike = array(); $codeLike = array(); foreach ($keywords as $value) { $listLike[] = "LIBELLELONG LIKE '%" . addslashes($value) . "%'"; } if ($code != "") { // Combiner la recherche de code et libellé foreach ($codes as $value) { $codeLike[] = "CODE LIKE '" . addslashes($value) . "%'"; } $query .= " AND ( ("; $query .= implode(" OR ", $codeLike); $query .= ") OR ("; } else { // Ou uniquement le libellé $query .= " AND ("; } $query .= implode(" AND ", $listLike); if ($code != "") { $query .= ") ) "; } } if ($code && !$keys) { // Ou uniquement le code $codeLike = array(); foreach ($codes as $value) { $codeLike[] = "CODE LIKE '" . addslashes($value) . "%'"; } $query .= "AND " . implode(" OR ", $codeLike); } if ($max_length) { $query .= " AND LENGTH(CODE) < {$max_length} "; } if ($where) { $query .= "AND " . $where; } $query .= " ORDER BY CODE LIMIT 0 , 100"; $result = $ds->exec($query); $master = array(); $i = 0; while ($row = $ds->fetchArray($result)) { $master[$i]["LIBELLELONG"] = $row["LIBELLELONG"]; $master[$i]["CODE"] = $row["CODE"]; $i++; } return $master; }
<?php /** * $Id$ * * @package Mediboard * @subpackage developpement * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $files = array("style/mediboard/forms.css"); $files = array_merge($files, glob("modules/*/css/main.css")); $button_classes = array(); foreach ($files as $_file) { $forms_css = file_get_contents($_file); $matches = array(); preg_match_all('/a\\.button\\.([^\\:]+)\\:before/', $forms_css, $matches); $button_classes = array_merge($button_classes, $matches[1]); } CMbArray::removeValue("rtl", $button_classes); // Création du template $smarty = new CSmartyDP(); $smarty->assign('button_classes', array_values($button_classes)); $smarty->display('css_test.tpl');
/** * @see parent::updateFormFields() */ function updateFormFields() { parent::updateFormFields(); $this->_view = $this->name; $this->_departments = explode("|", $this->departments); CMbArray::removeValue("", $this->_departments); if (count($this->_departments)) { $this->_view .= " (" . implode(", ", $this->_departments) . ")"; } $this->_is_supplier = $this->countBackRefs("product_references") > 0; $this->_is_manufacturer = $this->countBackRefs("products") > 0; }