$class_jo->doCancelOrders($item_id, '1', 'auto-set'); $items_canceled[] = $item_id; } logThis(" = Auto cancel order"); $orders_canceled[] = $orders_id; } //Set auto cancel items as confirmed if (count($items_canceled) > 0) { $class_jo->confirmOrderDelivery($items_canceled); logThis(" = Auto confirm canceled orders"); } } $files_imported++; $done_filename = TRADEBYTE_ARCHIVE_ORDERS_PATH . $o_file['filename']; //SET AS FILES IMPORTED AND MOVE IT TO archive $class_jd->updateDownloadImported($o_file['jng_sp_download_id']); rename($xml_filename, $done_filename); } else { logThis('- Failed to locate file'); $subject = 'IMPORTANT & URGENT: Import Order from Tradebyte Failed'; $send_message = 'Manobo FAILED TO LOCATE BELOW FILE: '; $send_message .= '<br />' . $xml_filename; $send_message .= '<br /><br />Please check root cause and make sure new orders are imported!'; tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $send_message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false); $file_not_exist[] = $xml_filename; } $orders_created_total = count($orders_created); if ($orders_created_total > 0) { //SP handle by Tradebyte needs no confirmation, //so mark orders as confirmed directly $class_jo->confirmOrders($orders_created, $import_date);
} $plength = $plength / 10; } } $article_id = $product->getArticleIDFromLength($plength); } $ean_no = $product->getEAN($article_id); } Order::createNewSalesPartnerOrderItem($order_id, $product_id, $article_id, $ean_no, $external_item_id, $billing_product_code, $billing_text, $ordered_quantity, $price, $price_after_provision, $item_count, $item_count, $external_item_count); $prev_order_no = $order_no; } } } closeOrderImport($order_id, $import_date, $item_count, $total_price); fclose($file_handler); $class_jd->updateDownloadImported($download_id); //Backup uploaded file $backup_path = SP_LAZADAID_ARCHIVE_PATH . 'raw/' . date('Y') . '/'; if (!is_dir($backup_path)) { mkdir($backup_path, 0750); } $backup_location = $backup_path . $file['name']; if (is_file($backup_location)) { $filename_split = explode('.', $file['name']); $filename_ext = array_pop($filename_split); $filename_new = implode('.', $filename_split) . '-' . time() . '.' . $filename_ext; $backup_location = $backup_path . $filename_new; } move_uploaded_file($file['tmp_name'], $backup_location); $error_message = array(); if ($error_shipping_region || $error_billing_region) {