Remove glob

This commit is contained in:
Michael RICOIS 2018-01-31 10:50:00 +01:00
parent a6cf9bd87f
commit a71a5c9eac

View File

@ -47,7 +47,7 @@ class AdminStatsLogistic extends AdminTab
//$product_ids = $ps->getProducts();
$product_ids = $this->getProducts((int)$sale['id_sale']);
if(!$product_ids){
if (!$product_ids) {
continue;
}
$products = $this->getSaleDetails($product_ids);
@ -203,11 +203,6 @@ class AdminStatsLogistic extends AdminTab
}
if ($result) {
$fname = 'export-remb-'.$this->date_export_begin.'-'.$this->date_export_end.'.csv';
foreach(glob(dirname(__FILE__).'/*.csv') as $filename) {
if ($fname == $filename) {
unlink($filename);
}
}
$this->exportCSV($result, $fname);
echo '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/stats_logistic/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
} else {
@ -742,7 +737,7 @@ class AdminStatsLogistic extends AdminTab
public function getSales()
{
return Db::getInstance()->ExecuteS('
SELECT p.`id_sale`, p.`date_start`, l.`name` as title
SELECT DISTINCT p.`id_sale`, p.`date_start`, l.`name` as title
FROM `'._DB_PREFIX_.'privatesale` p
LEFT JOIN `ps_privatesale_category` c ON (c.`id_sale` = p.`id_sale`)
LEFT JOIN `ps_category_lang` l ON (l.`id_category` = p.`id_category`)
@ -912,7 +907,7 @@ class AdminStatsLogistic extends AdminTab
$data[] = $value;
}
}
fputcsv ($fp,array_map('utf8_decode',array_values($data)),$delim);
fputcsv ($fp, array_map('utf8_decode', array_values($data)), $delim);
}
fclose($fp);
}