コード例 #1
0
 $orderRows = array();
 // grab the packages
 $sql = "\n\tSELECT \n\t\t  distinct p.package_id\n\t\t, p.customer_id\n\tFROM \n\t\tpackages p\n\t\tjoin packages_orders po on po.package_id = p.package_id\n\t\tjoin orders o on o.order_id = po.order_id\n\tWHERE \n\t\tp.sent is null\n\t\tand p.fulfillment_id = ?i\n\t\tAND FIND_IN_SET('test', `o`.`flags`)=0 ";
 $packages = $msql->getInd('package_id', $sql, $fulfillmentModel->fulfillment_id);
 foreach ($packages as $p) {
     $package = new Package();
     $package->loadFullPackage($p['package_id']);
     $orderRows = array_merge($orderRows, $package->getPackageCustom($fulfillmentModel, $firstRow));
     unset($package);
     $firstRow = false;
 }
 //var_dump($orderRows); exit;
 if (!$orderRows) {
     continue;
 }
 $filePath = Csv::saveCsvCustom($orderRows, $fulfillmentModel);
 echo $filePath . '<br>';
 // do we need to zip the file?
 if ($fulfillmentModel->fulfillment_zip) {
     $phpFilePath = AF::path('zip', array('files', 'csv'));
     $fp = AF::path('', array('files', 'csv'));
     system('/usr/bin/php-cli ' . $phpFilePath . ' ' . $fulfillmentModel->csvFileName . ' ' . $fp . ' > /home/pinnacle/er4.txt');
     $filePath = $fp . $fulfillmentModel->csvFileName . '.zip';
     echo $filePath . '<br>';
 }
 // M.Scully - disabled this by passing ?test in the url
 if (!isset($_GET['test'])) {
     $fulfillmentModel->filePath = $filePath;
     if ($fulfillmentModel->uploadToFulfillment()) {
         foreach ($packages as $p) {
             $package = new Package();