if (isset($permissions["update_orders"]) && $permissions["update_orders"] == 1) { if (strlen($orders_ids) && strlen($status_id)) { $ids = explode(",", $orders_ids); for ($i = 0; $i < sizeof($ids); $i++) { update_order_status($ids[$i], $status_id, true, "", $status_error); if ($status_error) { $orders_errors .= $status_error . "<br>"; } } } } else { $orders_errors .= NOT_ALLOWED_UPDATE_ORDERS_MSG; } } elseif ($operation == "remove_orders") { if (isset($permissions["remove_orders"]) && $permissions["remove_orders"] == 1) { remove_orders($orders_ids); } else { $orders_errors .= NOT_ALLOWED_REMOVE_ORDERS_MSG; } } // prepare list values $sql = "SELECT status_id, status_name FROM " . $table_prefix . "order_statuses WHERE is_active=1 ORDER BY status_order, status_id"; $order_statuses = get_db_values($sql, array()); $countries = get_db_values("SELECT country_id, country_name FROM " . $table_prefix . "countries ORDER BY country_order, country_name ", array(array("", ""))); $categories = get_db_values("SELECT category_id, category_name FROM " . $table_prefix . "categories ORDER BY category_order ", array(array("", ""))); //Customization by Vital $states = get_db_values("SELECT state_id, state_name FROM " . $table_prefix . "states ORDER BY state_name ", array(array("", ""))); $cc_default_types = array(array("", ""), array("blank", WITHOUT_CARD_TYPE_MSG)); $credit_card_types = get_db_values("SELECT credit_card_id, credit_card_name FROM " . $table_prefix . "credit_cards ORDER BY credit_card_name", $cc_default_types); $export_options = array(array("", ALL_MSG), array("1", EXPORTED_MSG), array("0", NOT_EXPORTED_MSG)); if ($sitelist) {
if ($db->next_record()) { $is_placed = $db->f("is_placed"); $paid_status = $db->f("paid_status"); $transaction_id = $db->f("transaction_id"); if ($is_placed || $paid_status || strlen($transaction_id)) { $user_order_id = ""; } } else { $user_order_id = ""; } } if ($user_order_id) { $order_id = $user_order_id; $variables["order_id"] = $user_order_id; $r->set_value("order_id", $user_order_id); remove_orders($user_order_id, false); $order_added = $r->update_record(); } else { if ($db_type == "postgre") { $order_id = get_db_value(" SELECT NEXTVAL('seq_" . $table_prefix . "orders') "); $variables["order_id"] = $order_id; $r->change_property("order_id", USE_IN_INSERT, true); $r->set_value("order_id", $order_id); } $order_added = $r->insert_record(); } if ($order_added) { if (!$user_order_id) { if ($db_type == "mysql") { $order_id = get_db_value(" SELECT LAST_INSERT_ID() "); $r->set_value("order_id", $order_id);