本文整理汇总了PHP中OrderDetail::getQuantityUserByID_dish方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderDetail::getQuantityUserByID_dish方法的具体用法?PHP OrderDetail::getQuantityUserByID_dish怎么用?PHP OrderDetail::getQuantityUserByID_dish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderDetail
的用法示例。
在下文中一共展示了OrderDetail::getQuantityUserByID_dish方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reduceOrderInPendingOrder
public function reduceOrderInPendingOrder()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$json = array();
$json['status_code'] = 1;
$id_user = isset($_GET['id_user']) ? addslashes($_GET['id_user']) : "";
if (!$id_user) {
Generic::errorMsg("Please login!");
}
$id_order = isset($_GET['id_order']) ? addslashes($_GET['id_order']) : "";
if (!$id_order) {
Generic::errorMsg("ID Order not found!");
}
$id_dish = isset($_GET['id_dish']) ? addslashes($_GET['id_dish']) : "";
if (!$id_dish) {
Generic::errorMsg("ID Dish not found!");
}
$objOrder = new MasterOrderModel();
$objOrder->getByID($id_order);
$objOrderDetail = new OrderDetail();
$isLeader = false;
// getcurrent qty dr iddish
$currQuantity = OrderDetail::getQuantityUserByID_dish($id_dish, $id_order, $id_user);
// pr($currQuantity);
//TODO CHECK apakah userId ini adalah leader, kalau iya set $isLeader = true
if ($id_user == $objOrder->id_user) {
$isLeader = true;
}
if ($isLeader) {
} else {
$objOrderDetail->getOrderDetailsByIDOrderAndUserID($id_order, $id_user);
//TODO kalau sudah 0 ERROR message, else Kurangi quantity order sendiri
}
if ($currQuantity < 0) {
Generic::errorMsg("remove order failed!");
//TODO kalau sum order semua user dengan dish ini 0, ERROR message
//TODO kalau order sendiri 0, kurangi order orang lain
//TODO, else Kurangi quantity order sendiri
} elseif ($currQuantity == 0) {
Generic::errorMsg("remove order failed!");
} else {
$id = $this->addOrderDetails($id_order, $id_user, $id_dish, $currQuantity - 1);
if (!$id) {
Generic::errorMsg("remove order failed!");
}
}
$objOrder = new MasterOrderModel();
$objOrder->getByID($id_order);
$invoice = $this->calcRechnung($objOrder->id_restaurant, $id_order);
$this->setInvoiceInOrder($objOrder, $invoice);
$objOrder->load = 1;
$id_updateOrder = $objOrder->save();
if (!$id_updateOrder) {
Generic::errorMsg("Update Order failed!");
}
$json['results']['messages'] = "Success";
$json['results']['invoice'] = $invoice;
echo json_encode($json);
die;
}