Merge branch 'ticket11985-invoiceMR'

This commit is contained in:
Marion Muszynski 2017-07-04 17:51:54 +02:00
commit ec2f428160

View File

@ -223,20 +223,20 @@ class AdminInvoices extends AdminTab
<td align="center"><p style="padding:0px;color: #565485;font-size:12px;">'. $date->format('Y-m-d') .'</p></td>
</td>
<td align="center">
<a title="Facture - La Poste" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=lp&token='.$this->token.'">
<a title="Facture - La Poste" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=lp&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to').'">
<span class="text-yellow anticon anticon-file-pdf" style="cursor:pointer;"></span>
</a>
<a title="Facture - Mondial Relay" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=mr&token='.$this->token.'">
<a title="Facture - Mondial Relay" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=mr&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to').'">
<span class="text-red-light anticon anticon-file-pdf" style="cursor:pointer;"></span>
</a>
</td>
<td align="center"><input id="multi_'. $sale['id_sale'].'" type="checkbox" name="multi2[]" value="'.$sale['id_sale'].'" '.(in_array((int)$sale['id_sale'], $id_sales)?'checked':'').'/></td>
<td align="center"><input id="multi_plus_'. $sale['id_sale'].'" type="checkbox" name="multiPlus[]" value="'.$sale['id_sale'].'"/></td>
<td align="center">
<a title="Facture - La Poste" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=lp&token='.$this->token.'">
<a title="Facture - La Poste" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=lp&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to').'">
<span class="text-yellow anticon anticon-file-pdf" style="cursor:pointer;"></span>
</a>
<a title="Facture - Mondial Relay" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=mr&token='.$this->token.'">
<a title="Facture - Mondial Relay" onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&gift=1&carrier=mr&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to').'">
<span class="text-red-light anticon anticon-file-pdf" style="cursor:pointer;"></span>
</a>
</td>
@ -527,6 +527,19 @@ class AdminInvoices extends AdminTab
public function display()
{
if(Tools::getIsset('getSales') && Tools::getValue('date_from') && Tools::getValue('date_to')) {
include_once(dirname(__FILE__).'/../../modules/privatesales/Sale.php');
if (!Validate::isDate(Tools::getValue('date_from')))
$this->_errors[] = $this->l('Invalid from date');
if (!Validate::isDate(Tools::getValue('date_to')))
$this->_errors[] = $this->l('Invalid end date');
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
$sales = Sale::getSalesByDateBis($statuts, Tools::getValue('date_from'), Tools::getValue('date_to'));
if($sales) {
$this->print_sales = $sales;
}
}
$this->displayForm();
$this->displayOptionsList();
}
@ -625,7 +638,7 @@ class AdminInvoices extends AdminTab
}
}
}
$this->_errors[] = $this->l('No invoice found for this sale');
Tools::redirectAdmin('index.php?tab=AdminInvoices&getSales=1&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to'));
}
// print M1
elseif (Tools::getValue('printM1') == 1)
@ -643,7 +656,7 @@ class AdminInvoices extends AdminTab
}
}
}
$this->_errors[] = $this->l('No invoice found for this sale');
Tools::redirectAdmin('index.php?tab=AdminInvoices&getSales=1&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to'));
}
// print M2
elseif (Tools::getValue('printM2') == 1)
@ -670,7 +683,7 @@ class AdminInvoices extends AdminTab
if(sizeof($orders)) {
Tools::redirectAdmin('pdf.php?privatesalesM2Bis&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
}
$this->_errors[] = $this->l('No invoice found for these sales');
Tools::redirectAdmin('index.php?tab=AdminInvoices&getSales=1&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to'));
}
}
// print multi (M2+)
@ -693,7 +706,7 @@ class AdminInvoices extends AdminTab
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&carrier='.$carrier.'&token='.$this->token);
}
}
$this->_errors[] = $this->l('No invoice found for these sales');
Tools::redirectAdmin('index.php?tab=AdminInvoices&getSales=1&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to'));
}
}
// print multi with same brand
@ -714,7 +727,7 @@ class AdminInvoices extends AdminTab
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&id_sale='.implode(',', $id_sales) .'&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&carrier='.$carrier.'&token='.$this->token);
}
}
$this->_errors[] = $this->l('No invoice found for these sales');
Tools::redirectAdmin('index.php?tab=AdminInvoices&getSales=1&token='.$this->token.'&date_from='.Tools::getValue('date_from').'&date_to='.Tools::getValue('date_to'));
}
}
// print M3