Merge branch 'ticket-simplemulti_invoice' into develop

This commit is contained in:
Marion Muszynski 2016-07-04 17:51:51 +02:00
commit 6e2d4dff6e

View File

@ -108,6 +108,7 @@ class AdminInvoices extends AdminTab
echo '<th align="center">M1</th>';
/*<th align="center">M2</th>*/
echo '<th align="center">M2+</th>
<th align="center">Même marque</th>
<th align="center">All</th>
<th align="center">'. $this->l('Delay') .'</th>
</tr>';
@ -157,6 +158,7 @@ class AdminInvoices extends AdminTab
</a>
</td>*/
echo '<td align="center"><input id="multi_'. $sale['id_sale'].'" type="checkbox" name="multi2[]" value="'.$sale['id_sale'].'" '.(isset($_COOKIE['checked_sale_'.(int)$sale['id_sale']])?'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 onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printAll=1&id_sale='. $sale['id_sale'] .'&token='.$this->token.'">
<img src="../img/admin/pdf.gif" alt="">
@ -177,6 +179,9 @@ class AdminInvoices extends AdminTab
echo '<td align="center">
<input type="submit" name="submitPrintM2Plus" class="button" value="'.$this->l('Print M2+').'" />
</td>
<td align="center">
<input type="submit" name="submitPrintMPlus" class="button" value="'.$this->l('Print Même Marque').'" />
</td>
<td></td>
<td></td>
</tr>';
@ -489,6 +494,22 @@ class AdminInvoices extends AdminTab
$this->_errors[] = $this->l('No invoice found for these sales');
}
}
// print multi with same brand
elseif (Tools::isSubmit('submitPrintMPlus')) {
include_once(dirname(__FILE__).'/../../modules/privatesales/Sale.php');
$id_sales = Tools::getValue('multiPlus');
if (empty($id_sales) || (count($id_sales) < 2) ) {
$this->_errors[] = $this->l('You must select 2 sales minimum for print M2+');
} else {
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
$orders = Sale::getOrdersM2($statuts, $id_sales, Tools::getValue('date_from'), Tools::getValue('date_to'));
if(sizeof($orders)) {
Tools::redirectAdmin('pdf.php?privatesalesM2Plus&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');
}
}
// print M3
elseif (Tools::isSubmit('submitPrintM3')) {
include_once(dirname(__FILE__).'/../../modules/privatesales/Sale.php');