本文整理汇总了PHP中Inventory::movement_last_values方法的典型用法代码示例。如果您正苦于以下问题:PHP Inventory::movement_last_values方法的具体用法?PHP Inventory::movement_last_values怎么用?PHP Inventory::movement_last_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::movement_last_values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cancel
/**
* cancel cancels a movement on an inventory object
*
* @param int $did entry-id for the inventoryitem
* @return string html-string with the form
*/
private function cancel($did)
{
// check rights
if (Rights::check_rights($did, 'inventory')) {
// pagecaption
$this->tpl->assign('pagecaption', parent::lang('class.InventoryView#page#caption#cancel'));
// get inventory-object
$inventory = new Inventory($did);
// get preset
$preset = $inventory->get_preset();
// get fields
$fields = $preset->get_fields();
// check owned
if ($inventory->get_owned() == 'givento') {
// smarty-template
$sC = new JudoIntranetSmarty();
// prepare return
$return = '';
$form = new HTML_QuickForm2('confirm', 'post', array('name' => 'confirm', 'action' => 'inventory.php?id=cancel&did=' . $did));
// add button
$form->addElement('submit', 'yes', array('value' => parent::lang('class.InventoryView#cancel#form#yes')));
// smarty-link
$link = array('params' => '', 'href' => 'inventory.php?id=my', 'title' => parent::lang('class.InventoryView#cancel#title#cancel'), 'content' => parent::lang('class.InventoryView#cancel#form#cancel'));
$sC->assign('link', $link);
$sC->assign('spanparams', 'id="cancel"');
$sC->assign('message', parent::lang('class.InventoryView#cancel#message#confirm'));
$sC->assign('form', $form);
// validate
if ($form->validate()) {
// smarty
$sC->assign('message', parent::lang('class.InventoryView#cancel#message#done'));
$sC->assign('form', '');
// movement to db
$insert_id = $this->movement_to_db('taken', $inventory->get_id());
// get values of last movement and values to db
$last_values = $inventory->movement_last_values();
$this->values_to_db($insert_id, $fields, $last_values);
}
// return
return $sC->fetch('smarty.confirmation.tpl');
} else {
// error
$errno = $GLOBALS['Error']->error_raised('NotGiven', $this->get('id'), $did);
$GLOBALS['Error']->handle_error($errno);
return $GLOBALS['Error']->to_html($errno);
}
} else {
// error
$errno = $GLOBALS['Error']->error_raised('NotAuthorized', $this->get('id'), $did);
$GLOBALS['Error']->handle_error($errno);
return $GLOBALS['Error']->to_html($errno);
}
}