suite update

This commit is contained in:
Marion Muszynski 2016-06-10 11:41:50 +02:00
parent dbe607dccc
commit 389356d129
2 changed files with 50 additions and 3 deletions

View File

@ -44,6 +44,7 @@ $functionArray = array(
'deliveryslips' => 'generateDeliverySlipsPDF',
'privatesales' => 'generateInvoicesPDFPrivateSales',
'privatesales48h' => 'generateInvoicesPDFPrivateSales48h',
'privatesales48hbis' => 'generateInvoicesPDFPrivateSales48hBis',
'privatesales2' => 'generateInvoicesPDFPrivateSales2',
'privatesalesM2' => 'generateInvoicesPDFPrivateMulti',
'privatesalesM2Bis' => 'generateInvoicesPDFPrivateM2Bis',
@ -112,6 +113,21 @@ function generateInvoicesPDFPrivateSales()
}
function generateInvoicesPDFPrivateSales48h()
{
if(Module::isInstalled('privatesales')) {
include(dirname(__FILE__).'/../modules/privatesales/Sale.php');
if($sale = new Sale((int) Tools::getValue('id_sale'))) {
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
$orders = $sale->getOrdersFromSale($statuts, FALSE, TRUE);
if(count($orders) == 0) {
die (Tools::displayError('No invoices found'));
}
PDF::multipleInvoices($orders, false, true, true);
}
}
}
function generateInvoicesPDFPrivateSales48hBis()
{
if(Module::isInstalled('privatesales')) {
include(dirname(__FILE__).'/../modules/privatesales/Sale.php');
@ -122,7 +138,7 @@ function generateInvoicesPDFPrivateSales48h()
die (Tools::displayError('No invoices found'));
}
$orders2 = $sale->getOrdersFromSale($statuts, FALSE, TRUE);
$orders2 = $sale->getOrdersFromSale($statuts, FALSE, FALSE);
if (!empty($orders2)) {
foreach ($orders2 as $key => $order) {
if (in_array($order, $orders)) {

View File

@ -101,8 +101,11 @@ class AdminInvoices extends AdminTab
<th align="center" width="50">'.$this->l('Id Sale').'</th>
<th>'.$this->l('Name sale').' (%ean)</th>
<th align="center">'.$this->l('Date start').'</th>
<th align="center">48h</th>
<th align="center">M1</th>
<th align="center">48h</th>';
if ($cookie->id_employee == 1) {
echo '<th align="center">48H bis</th>';
}
echo '<th align="center">M1</th>
<th align="center">M2</th>
<th align="center">M3+</th>
<th align="center">All</th>
@ -129,6 +132,17 @@ class AdminInvoices extends AdminTab
} else {
echo '-';
}
if ($cookie->id_employee == 1) {
echo '</td><td align="center">';
if ($sale['delivery_delay'] == 2
|| $sale['delivery_delay'] == 6) {
echo '<a onclick="this.target=\'_blank\'" href="'.$currentIndex.'&print48hbis=1&id_sale='. $sale['id_sale'] .'&token='.$this->token.'">
<img src="../img/admin/pdf.gif" alt="">
</a>';
} else {
echo '-';
}
}
echo '</td>
<td align="center">
<a onclick="this.target=\'_blank\'" href="'.$currentIndex.'&printM1=1&id_sale='. $sale['id_sale'] .'&token='.$this->token.'">
@ -373,6 +387,23 @@ class AdminInvoices extends AdminTab
}
$this->_errors[] = $this->l('No invoice found for this sale');
}
// print 48h bis (distinct multi)
elseif (Tools::getValue('print48hbis') == 1)
{
include_once(dirname(__FILE__).'/../../modules/privatesales/Sale.php');
if($sale = new Sale((int) Tools::getValue('id_sale'))) {
if(!in_array($sale->delivery_delay, array(2 ,6) )) {
$this->_errors[] = $this->l('This sale is not delivery 48h');
} else {
$statuts = array(17, Configuration::get('PS_OS_PAYMENT'));
$orders = $sale->getOrdersFromSale($statuts, FALSE, TRUE);
if(sizeof($orders)) {
Tools::redirectAdmin('pdf.php?privatesales48hbis&id_sale='.(int) $sale->id.'&token='.$this->token);
}
}
}
$this->_errors[] = $this->l('No invoice found for this sale');
}
// print printAll
elseif (Tools::getValue('printAll') == 1)
{