Merge branch 'ticket-12391-DiscountForNoneOrder_part2' into develop

This commit is contained in:
Marion Muszynski 2017-02-23 12:59:33 +01:00
commit f8e4622179

View File

@ -142,28 +142,30 @@ class AdminAntConfigurations extends AdminTab
HelperFormBootstrap::displayErrors($this->l('Veuillez choisir une categorie'));
}
} elseif(Tools::isSubmit('submitExportDiscount')){
HelperFormBootstrap::displayWarning($this->l('L\'outils n\'est pas encore disponible'));
// $results = DB::getInstance()->ExecuteS('
// SELECT dh.`id_customer`, dh.`date_add` as `date_generate`,o.`id_order`, dh.`name`, o.`value`
// FROM `'._DB_PREFIX_.'ant_discount_history` dh
// LEFT JOIN `'._DB_PREFIX_.'order_discount` o ON (o.`id_discount` = dh.`id_discount`)
// WHERE 1
// ');
// if($results) {
// $row_definition = array(
// 'id_customer' => 'Client ID',
// 'id_order' => 'Commande ID',
// 'name' => 'Bon de réduction',
// 'value' => 'Valeur',
// 'date_generate' => 'Date de génération',
// );
// header("Content-Type: text/csv; charset=UTF-8");
// header("Content-Disposition: attachment;filename=export-".date('dmYHi').".csv;");
// $this->exportCsv($cmd);
// die();
// } else {
// HelperFormBootstrap::displayWarning($this->l('Aucun résultat trouvé'));
// }
$results = DB::getInstance()->ExecuteS('
SELECT dh.`id_customer`, dh.`date_add` as `date_generate`,od.`id_order`, dh.`code`, od.`value`, o.`total_paid_real`,o.`date_add` as `date_order`
FROM `'._DB_PREFIX_.'ant_discount_history` dh
LEFT JOIN `'._DB_PREFIX_.'order_discount` od ON (od.`id_discount` = dh.`id_discount`)
LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = od.`id_order`)
WHERE 1
');
if($results) {
$row_definition = array(
'id_customer' => 'Client ID',
'id_order' => 'Commande ID',
'name' => 'Bon de réduction',
'value' => 'Valeur Bon',
'total_paid_real' => 'Total Commande',
'date_generate' => 'Date création du bon',
'date_order' => 'Date Commande',
);
header("Content-Type: text/csv; charset=UTF-8");
header("Content-Disposition: attachment;filename=export-".date('dmYHi').".csv;");
$this->exportCsv($results, $row_definition);
die();
} else {
HelperFormBootstrap::displayWarning($this->l('Aucun résultat trouvé'));
}
}
}