本文整理汇总了PHP中order::set方法的典型用法代码示例。如果您正苦于以下问题:PHP order::set方法的具体用法?PHP order::set怎么用?PHP order::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类order
的用法示例。
在下文中一共展示了order::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mods_create_order
function mods_create_order($start_data)
{
$id = (int) $start_data['id'];
$old = new order($id);
// requantify the old order
$old->data['quantity'] = $old->data['quantity'] - $start_data['quantity'];
if (class_exists('stock_object')) {
$stock = new stock_object();
$stock->silent = true;
$stock->remove_from_waiter($old->id, $old->data['quantity']);
}
$err = $old->set();
if ($err) {
return 1;
}
// quantity set error
// creates the new order;
$arr['quantity'] = 0;
$newid = orders_create($ord->data['dishid'], $arr);
if ($newid == 0) {
return 1;
}
// order not created
$newid = (int) $newid;
$new = new order($newid);
$olddata = $old->data;
// copies old order's data
// now unsets some vars that we don't want to copy
unset($olddata['id']);
unset($olddata['associated_id']);
unset($olddata['price']);
unset($olddata['timestamp']);
$new->data = $olddata;
//first set() without quantity for stock function
$new->data['quantity'] = 0;
$err = $new->set();
$new->data['quantity'] = $start_data['quantity'];
if (class_exists('stock_object')) {
$stock = new stock_object();
$stock->silent = true;
$stock->remove_from_waiter($new->id, $new->data['quantity']);
}
$err = $new->set();
if ($err) {
return 1;
}
// Now we set $start_data[id] to the new order, because we're going to work on it, and leave the old one
$GLOBALS['start_data']['id'] = $new->id;
return 0;
}
示例2: orders_update
function orders_update($start_data)
{
global $tpl;
$id = (int) $start_data['id'];
$ord = new order($id);
if (!isset($start_data['suspend'])) {
$start_data['suspend'] = 0;
}
if (!isset($start_data['extra_care'])) {
$start_data['extra_care'] = 0;
}
if (isset($start_data['price'])) {
$start_data['price'] = eq_to_number($start_data['price']);
}
// forces extra_care = 1 for generic dishes
$dishid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], "orders", "dishid", $start_data['id']);
$generic = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], "dishes", "generic", $dishid);
if ($generic && $start_data['price'] == 0) {
$start_data['extra_care'] = '1';
} elseif ($generic && $start_data['price']) {
$start_data['extra_care'] = '0';
}
// toplist update code
if (!isset($start_data['quantity'])) {
$start_data['quantity'] = 0;
}
// insert all the modules interfaces for order creation here
toplist_update($ord->data['dishid'], $ord->data['quantity'], $start_data['quantity']);
if (class_exists('stock_object')) {
$stock = new stock_object();
$stock->silent = true;
$stock->remove_from_waiter($id, $start_data['quantity']);
}
// end interfaces
// real update
$ord->data = $start_data;
$err = $ord->set();
unset($ord);
return $err;
}
示例3: copy
function copy($dest = 0)
{
if (!$dest || !$dest->exists()) {
$dest = new order();
$create = true;
}
$this->get();
$dest->data = $this->data;
unset($dest->data['id']);
unset($dest->data['associated_id']);
unset($dest->data['price']);
unset($dest->data['timestamp']);
if ($create) {
$id = $dest->create();
} else {
$dest->set();
}
return $dest->id;
}