<?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::checkEdit();
$endowment_id = CValue::get('endowment_id');
$endowment = new CProductEndowment();
$endowment->load($endowment_id);
$group = new CGroups();
/** @var CGroups[] $groups */
$groups = $group->loadListWithPerms();
foreach ($groups as $_group) {
    $_group->loadRefsServices();
}
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('endowment', $endowment);
$smarty->assign('groups', $groups);
$smarty->display('inc_duplicate_endowment.tpl');
<?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::checkEdit();
$endowment_id = CValue::getOrSession('endowment_id');
$endowment = new CProductEndowment();
if ($endowment->load($endowment_id)) {
    $items = $endowment->loadRefsEndowmentItems();
    $endowment->loadRefsNotes();
    $endowment->loadRefService();
    foreach ($items as $_item) {
        $_item->updateFormFields();
        $_item->_ref_product->loadRefStock();
    }
}
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('endowment', $endowment);
$smarty->assign("group_id", $endowment->_id ? $endowment->_ref_service->group_id : CGroups::loadCurrent()->_id);
$smarty->display('inc_form_endowment.tpl');
 /**
  * @see parent::getPerm()
  */
 function getPerm($permType)
 {
     $this->loadRefsFwd();
     return parent::getPerm($permType) && $this->_ref_endowment->getPerm($permType) && $this->_ref_product->getPerm($permType);
 }
Esempio n. 4
0
<?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();
$endowment_id = CValue::get('endowment_id');
$endowment = new CProductEndowment();
$endowment->load($endowment_id);
$endowment->loadRefsFwd();
$endowment->updateFormFields();
$endowment->loadRefsBack();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign('endowment', $endowment);
$smarty->display('print_endowment.tpl');
 *
 * @package    Mediboard
 * @subpackage Stock
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkEdit();
$endowment_id = CValue::getOrSession('endowment_id');
$start = intval(CValue::getOrSession('start'));
$keywords = CValue::getOrSession('keywords');
$letter = CValue::getOrSession('letter', "%");
$group_id = CGroups::loadCurrent()->_id;
$where = array("product_endowment.name" => $letter === "#" ? "RLIKE '^[^A-Z]'" : "LIKE '{$letter}%'", "service.group_id" => "= '{$group_id}'");
$ljoin = array("service" => "service.service_id = product_endowment.service_id");
$endowment = new CProductEndowment();
$endowment->load($endowment_id);
$list = $endowment->seek($keywords, $where, "{$start},25", true, $ljoin, "service.nom, product_endowment.name");
$total = $endowment->_totalSeek;
foreach ($list as $_item) {
    //$_item->loadRefs();
    $_item->countBackRefs("endowment_items");
}
// Smarty template
$smarty = new CSmartyDP();
$smarty->assign('list', $list);
$smarty->assign('total', $total);
$smarty->assign('start', $start);
$smarty->assign('endowment', $endowment);
$smarty->assign('letter', $letter);
$smarty->display('inc_endowments_list.tpl');