58 lines
1.4 KiB
PHP
Executable File
58 lines
1.4 KiB
PHP
Executable File
#!/usr/bin/php
|
|
<?php
|
|
|
|
//require 'vendor/autoload.php';
|
|
require("../../config/config.php");
|
|
|
|
define('FRONKDB_SQLDEBUG',false);
|
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
|
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|
|
|
$me = new User(1);
|
|
|
|
$folder = __DIR__."/import/";
|
|
$csvname = "magenta-missing_rml_pno_order_ids.csv";
|
|
$filename = $folder.$csvname;
|
|
|
|
$db = FronkDB::singleton();
|
|
|
|
$log = mfLoghandler::singleton();
|
|
|
|
$input = fopen($filename, "r");
|
|
|
|
echo "order_id;cam_id;rml_order_code;rml_status\n";
|
|
|
|
$l = 0;
|
|
while($csv = fgetcsv($input, 0, ";")) {
|
|
$l++;
|
|
if($l == 1) continue;
|
|
|
|
if(!trim($csv[0])) {
|
|
continue;
|
|
}
|
|
|
|
$ext_order_id = $db->escape($csv[0]);
|
|
$ext_cam_id = $db->escape($csv[1]);
|
|
$ucode = "";
|
|
|
|
$res = $db->select("Preorder", "*", "addon_data LIKE '%$ext_order_id%'");
|
|
if(!$db->num_rows($res)) {
|
|
file_put_contents("php://stderr", "!!! No order found for $ext_order_id\n");
|
|
} elseif($db->num_rows($res) > 1) {
|
|
file_put_contents("php://stderr", "!!! Multiple orders found for $ext_order_id!\n");
|
|
} else {
|
|
$order = $db->fetch_object($res);
|
|
$ucode = $order->ucode;
|
|
}
|
|
$status = "";
|
|
if($order->deleted) {
|
|
$status = "canceled";
|
|
}
|
|
|
|
echo "$ext_order_id;$ext_cam_id;$ucode;$status\n";
|
|
}
|
|
|