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; }
} else { $_SESSION['go_back_to_cat'] = 0; orders_list(); } break; case 'edit': orders_edit($start_data); break; case 'update': if ($start_data['quantity'] == 0) { $err = orders_delete($start_data); status_report('DELETION', $err); orders_list(); break; } $err = orders_update($start_data); status_report('UPDATE', $err); $last_mod = order_get_last_modified(); if ($last_mod && isset($_SESSION['go_back_to_cat']) && $_SESSION['go_back_to_cat']) { $ord = new order((int) $last_mod); $dish = new dish($ord->data['dishid']); $list['category'] = $dish->data['category']; $list['priority'] = $ord->data['priority']; dish_list($list); } else { orders_list(); } break; case 'price_modify': order_price_modify($start_data['id']); break;