本文整理汇总了PHP中order::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP order::delete方法的具体用法?PHP order::delete怎么用?PHP order::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类order
的用法示例。
在下文中一共展示了order::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orders_delete
function orders_delete($start_data)
{
global $tpl;
$id = (int) $start_data['id'];
$ord = new order($id);
if (!$ord->data['deleted'] && $ord->data['printed'] && $ord->data['dishid'] != SERVICE_ID) {
if ($err = print_ticket($id, true)) {
return $err;
}
}
if (CONF_DEBUG_DONT_DELETE) {
return 0;
}
// was as follows, but it's better to never delete an order if the table is still open
if ($ord->data['dishid'] != SERVICE_ID) {
$start_data['deleted'] = 1;
$start_data['paid'] = 1;
$start_data['suspend'] = 0;
$start_data['printed'] = '0000-00-00 00:00:00';
$start_data['price'] = 0;
$err = orders_update($start_data);
} else {
// insert all the modules interfaces for order creation here
toplist_delete($ord->data['dishid'], $ord->data['quantity']);
if (class_exists('stock_object')) {
$stock = new stock_object();
$stock->silent = true;
$stock->remove_from_waiter($id, 0);
}
$err = $ord->delete();
}
unset($ord);
return $err;
}
示例2: mods_create_ingreds
function mods_create_ingreds($ord, $ingredid, $operation)
{
$query = "SELECT * FROM `orders` WHERE `associated_id`='" . $ord->id . "' AND `ingredid` = '" . $ingredid . "'";
$res = common_query($query, __FILE__, __LINE__);
if (!$res) {
return mysql_errno();
}
$antiop = $operation * -1;
// if order is found and is opposite to the wanted one, we simply delete it,
// otherwise we create the wanted order
if (mysql_num_rows($res)) {
$arr = mysql_fetch_array($res);
if ($arr['operation'] == $antiop) {
$ord_ingid = (int) $arr['id'];
$ord_ing = new order($ord_ingid);
if (class_exists('stock_object')) {
$stock = new stock_object();
$stock->silent = true;
$stock->remove_from_waiter($ord_ing->id, 0);
}
if ($err = $ord_ing->delete()) {
return $err;
}
}
} else {
$ord_ing = new order();
$ord_ing->data = $ord->data;
// now unsets some vars that we don't want to copy
unset($ord_ing->data['id']);
unset($ord_ing->data['associated_id']);
unset($ord_ing->data['price']);
unset($ord_ing->data['timestamp']);
// set quantity to 0 to start with empty order (for stock function)
$ord_ing->data['quantity'] = 0;
$ord_ing->data['dishid'] = MOD_ID;
$ord_ing->data['ingredid'] = $ingredid;
$ord_ing->data['associated_id'] = $ord->id;
$err = $ord_ing->create();
$ord_ing->data['operation'] = $operation;
$ord_ing->data['quantity'] = $ord->data['quantity'];
if (class_exists('stock_object')) {
$stock = new stock_object();
$stock->silent = true;
$stock->remove_from_waiter($ord_ing->id, $ord->data['quantity']);
}
$err += $ord_ing->set();
if ($err) {
return 1;
}
}
return 0;
}