$stock_location = new CProductStockLocation(); $group_id = CGroups::loadCurrent()->_id; $classes = array("CGroups" => "Pharmacie", "CService" => CAppUI::tr("CService"), "CBlocOperatoire" => CAppUI::tr("CBlocOperatoire")); $ds = $stock_location->getDS(); $lists = array(); foreach ($classes as $_class => $_label) { $where = array("product_stock_location.object_class" => $ds->prepare("=?", $_class)); $ljoin = array(); switch ($_class) { case "CGroups": $where["product_stock_location.object_id"] = $ds->prepare("=?", $group_id); break; case "CService": $ljoin["service"] = "service.service_id = product_stock_location.object_id"; $where["service.group_id"] = $ds->prepare("=?", $group_id); break; case "CBlocOperatoire": $ljoin["bloc_operatoire"] = "bloc_operatoire.bloc_operatoire_id = product_stock_location.object_id"; $where["bloc_operatoire.group_id"] = $ds->prepare("=?", $group_id); break; default: // } $order = 'object_class, object_id, position, product_stock_location.name'; $lists[$_class] = $stock_location->loadList($where, $order, null, null, $ljoin); } // Création du template $smarty = new CSmartyDP(); $smarty->assign('lists', $lists); $smarty->assign('classes', $classes); $smarty->display('vw_idx_stock_location.tpl');
/** * Load locations * * @return CProductStockLocation[] */ function loadRelatedLocations() { $where = array("object_class" => "= 'CGroups'", "object_id" => "= '{$this->group_id}'"); $location = new CProductStockLocation(); return $this->_ref_related_locations = $location->loadList($where, "name"); }
<?php /** * $Id$ * * @package Mediboard * @subpackage Stock * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $owner_guid = CValue::get('owner_guid'); $exclude_location_id = CValue::get('exclude_location_id'); $parts = explode("-", $owner_guid); $where = array("object_class" => " = '{$parts[0]}'", "object_id" => " = '{$parts[1]}'"); if ($exclude_location_id) { $where["stock_location_id"] = " != '{$exclude_location_id}'"; } $location = new CProductStockLocation(); $locations = $location->loadList($where); // Smarty template $smarty = new CSmartyDP(); $smarty->assign('locations', $locations); $smarty->display('inc_autocomplete_related_locations.tpl');