Merge branch 'ticket-10884' into develop

This commit is contained in:
Marion Muszynski 2016-09-15 11:14:30 +02:00
commit 4354f166be

View File

@ -55,11 +55,18 @@ class AdminPrivateSalesLogistique extends AdminTab {
$id_lang = Tools::getValue('export_id_lang', $cookie->id_lang);
if ($id_category = (int) Tools::getValue('export_category')) {
$this->getSaleExport($id_category,$id_lang);
$this->getSaleExport($id_category, $id_lang);
} elseif (Tools::getValue('date_start') && Tools::getValue('date_end')) {
$date_start = Tools::getValue('date_start');
$date_end = Tools::getValue('date_end');
$this->getSaleExportsByDate($date_start,$date_end,$id_lang);
$this->getSaleExportsByDate($date_start, $date_end, $id_lang);
} else {
$this->html .= '<p class="error">Vous devez choisir une vente ou une période</p>';
}
}
}
@ -168,11 +175,11 @@ class AdminPrivateSalesLogistique extends AdminTab {
</script>';
}
public function _displayBeforeContent()
public function _displayAfterContent()
{
global $cookie;
$this->html .= '
<p><br /></p>
</fieldset><p><br /></p>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<fieldset><legend><img src="/modules/bulkupdate/logo.gif" alt="" title="" />'.$this->l('Export').'</legend>
<label>'.$this->l('Select a category to export:').'</label>
@ -277,8 +284,8 @@ class AdminPrivateSalesLogistique extends AdminTab {
global $currentIndex;
$this->_postProcess();
$this->_displayHeader();
$this->_displayBeforeContent();
$this->_displayContent();
$this->_displayAfterContent();
echo $this->html;
}
@ -631,7 +638,7 @@ class AdminPrivateSalesLogistique extends AdminTab {
SELECT c.id_category
FROM `'._DB_PREFIX_.'privatesale` p
LEFT JOIN `'._DB_PREFIX_.'privatesale_category` c ON c.id_sale = p.id_sale
WHERE date_start BETWEEN "'. $date_start .' 00:00:00" AND "'. $date_end .' 00:00:00"
WHERE date_start BETWEEN "'. $date_start .' 00:00:00" AND "'. $date_end .' 23:59:59"
ORDER BY c.id_sale DESC
');
@ -646,11 +653,10 @@ class AdminPrivateSalesLogistique extends AdminTab {
$products = array_unique($products);
if(count($products) > 20000){
$this->html .= '<p class="conf">Choisir une plage moins grande. <br /> Export > 20000 produits</p>';
continue;
$this->html .= '<p class="error">Choisir une plage moins grande. <br /> Export > 20000 produits</p>';
exit;
};
$privatesale = Sale::getSaleFromCategory((int) $id_category);
$fname = date( "Ymd", strtotime($date_start)).'-'.date( "Ymd", strtotime($date_end)).'.csv';
foreach(glob(dirname(__FILE__).'/*.csv') as $filename) {
if ($fname == $filename) {
@ -799,7 +805,7 @@ class AdminPrivateSalesLogistique extends AdminTab {
ON o.`id_order` = d.`id_order`
LEFT JOIN `'._DB_PREFIX_.'order_history` h
ON h.`id_order` = d.`id_order`
WHERE d.`product_id` = '.(int) $p->id.'
WHERE d.`product_id` = '.(int) $p->id.'
AND d.`product_attribute_id` = '.(int) $k.'
AND h.`id_order_state` = 2
');
@ -900,6 +906,7 @@ class AdminPrivateSalesLogistique extends AdminTab {
fclose($f);
$this->html .= '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/privatesales_logistique/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
}
public function getSaleExport($id_category=0,$id_lang=0)
{
global $link, $cookie;