Merge branch 'ticket/r15782-stats'

This commit is contained in:
Michael RICOIS 2018-02-06 15:50:33 +01:00
commit a3c2e56824
4 changed files with 11 additions and 8 deletions

View File

@ -23,14 +23,21 @@ switch ($action) {
$start = Tools::getValue('date_export_begin');
$end = Tools::getValue('date_export_end');
$path = dirname(__FILE__) . '/export';
$filename = 'export-remb-'.$start.'-'.$end.'.csv';
$file = $path . '/' . $filename;
if (file_exists($file)) {
unlink($file);
}
if (empty($start) || empty($end)) {
$url = '';
} else {
$url = Tools::getShopDomain(true) . '/modules/stats_logistic/ajax.php?action=check&token='.Tools::getValue('token');
}
$cmd = dirname(__FILE__).'/bin/export.php --start '.$start.' --end '.$end.'';
exec('php '.$cmd.' &');
$cmd = dirname(__FILE__).'/bin/export.php --start '.$start.' --end '.$end;
exec("php ".$cmd." > /dev/null &");
// Always return checkin url
echo json_encode(array(

View File

@ -9,7 +9,6 @@ $_SERVER['SERVER_PORT'] = 443;
require_once __DIR__ . '/../../../config/config.inc.php';
require_once __DIR__ . '/../stats_logistic.php';
if (!Tools::isCli()){
exit();
}

View File

@ -15,7 +15,7 @@ class StatsLogistic
{
$this->date_export_begin = $start;
$this->date_export_end = $end;
$fname = 'export-remb-'.$this->date_export_begin.'-'.$this->date_export_end.'.csv';
$result = null;
$sale_ids = $this->getSales();
@ -180,7 +180,7 @@ class StatsLogistic
}
}
}
$fname = 'export-remb-'.$this->date_export_begin.'-'.$this->date_export_end.'.csv';
if ($result !== null) {
$this->exportCSV($result, $fname);
} else {

View File

@ -27,11 +27,8 @@ $(function(){
}
$('form').submit(function(e) {
e.preventDefault();
$(this).find('input#submitExport').attr('disabled', 'disabled');
url = $(this).attr('action');
console.log(url);
console.log($(this).serialize());
$.post(url, $(this).serialize(), function (data, textStatus) {
if (data.url != '') {
url = data.url;