123 lines
2.7 KiB
PHP
Executable File
123 lines
2.7 KiB
PHP
Executable File
<?php
|
|
ini_set('memory_limit', '4096M');
|
|
ini_set('max_execution_time', 0);
|
|
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
|
include dirname(__FILE__).'/www/config/config.inc.php';
|
|
include dirname(__FILE__).'/www/modules/exports/exports/privatesales_accepted.php';
|
|
|
|
$date = $argv[1];
|
|
|
|
$file = fopen(dirname(__FILE__).'/extracts/sales_weekly_accepted/'.$date.'.csv', 'w');
|
|
fputcsv($file, array(
|
|
'id_sale',
|
|
'sale_title',
|
|
'id_order',
|
|
'id_customer',
|
|
'gender',
|
|
'email',
|
|
'firstname',
|
|
'lastname',
|
|
'shipping_firstname',
|
|
'shipping_lastname',
|
|
'shipping_street',
|
|
'shipping_street2',
|
|
'shipping_postcode',
|
|
'shipping_city',
|
|
'shipping_phone',
|
|
'shipping_phone_mobile',
|
|
'other_info',
|
|
'shipping_country',
|
|
'id_product',
|
|
'id_product_attribute',
|
|
'order_product_name',
|
|
'product_quantity',
|
|
'product_price_base_wo_taxes',
|
|
'tax_rate',
|
|
'product_name',
|
|
'product_combination',
|
|
'product_price_wo_taxes',
|
|
'product_price',
|
|
'wholesale_price',
|
|
'combination_wholesale_price',
|
|
'supplier_reference',
|
|
'quantity_refunded',
|
|
'quantity_returned',
|
|
'total_shipping',
|
|
'single',
|
|
'date',
|
|
'invoice_number',
|
|
'payment_type',
|
|
'order_state',
|
|
'version',
|
|
), ';', '"');
|
|
|
|
foreach(Db::getInstance()->ExecuteS('
|
|
SELECT `id_sale`
|
|
FROM `'._DB_PREFIX_.'privatesale`
|
|
WHERE `date_start` < "'.pSQL($argv[1]).' 00:00:00"
|
|
') as $row) {
|
|
$sale = new Sale($row['id_sale']);
|
|
$e = new CronExport('privatesales', array(
|
|
'headers' => array(
|
|
'id_sale',
|
|
'sale_title',
|
|
'id_order',
|
|
'id_customer',
|
|
'gender',
|
|
'email',
|
|
'firstname',
|
|
'lastname',
|
|
'shipping_firstname',
|
|
'shipping_lastname',
|
|
'shipping_street',
|
|
'shipping_street2',
|
|
'shipping_postcode',
|
|
'shipping_city',
|
|
'shipping_phone',
|
|
'shipping_phone_mobile',
|
|
'other_info',
|
|
'shipping_country',
|
|
'id_product',
|
|
'id_product_attribute',
|
|
'order_product_name',
|
|
'product_quantity',
|
|
'product_price_base_wo_taxes',
|
|
'tax_rate',
|
|
'product_name',
|
|
'product_combination',
|
|
'product_price_wo_taxes',
|
|
'product_price',
|
|
'wholesale_price',
|
|
'combination_wholesale_price',
|
|
'supplier_reference',
|
|
'quantity_refunded',
|
|
'quantity_returned',
|
|
'total_shipping',
|
|
'single',
|
|
'date',
|
|
'invoice_number',
|
|
'payment_type',
|
|
'order_state',
|
|
'version',
|
|
),
|
|
'postfix' => '_'.$id_sale.'_manual_accepted',
|
|
'dest_path' => '/../extracts/sales',
|
|
'params' => array(
|
|
'sale' => $sale,
|
|
'date_start' => date('Y-m-d 00:00:00', strtotime($argv[1].' 00:00:00') - 60*86400),
|
|
'date_end' => date('Y-m-d 23:59:59', strtotime($argv[1].' 00:00:00') - 1),
|
|
),
|
|
));
|
|
$e->run();
|
|
|
|
$export = fopen($e->filename, 'r');
|
|
fgets($export);
|
|
while(!feof($export)) {
|
|
fwrite($file, fgets($export));
|
|
}
|
|
fclose($export);
|
|
unlink($e->filename);
|
|
}
|
|
|
|
fclose($file);
|