// Fix problems with display of PDF with multishop #PSFV-643 admin/pdf.php is now deprecated
This commit is contained in:
+10
-146
@@ -26,9 +26,14 @@
|
||||
*/
|
||||
|
||||
define('_PS_ADMIN_DIR_', getcwd());
|
||||
|
||||
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
|
||||
|
||||
/**
|
||||
* @deprecated 1.5.0
|
||||
* This file is deprecated, please use AdminPdfController instead
|
||||
*/
|
||||
Tools::displayFileAsDeprecated();
|
||||
|
||||
if (!Context::getContext()->employee->id)
|
||||
Tools::redirectAdmin('index.php?controller=AdminLogin');
|
||||
|
||||
@@ -44,153 +49,12 @@ $function_array = array(
|
||||
'id_supply_order' => 'generateSupplyOrderFormPDF'
|
||||
);
|
||||
|
||||
$pdf_controller = new AdminPdfController();
|
||||
foreach ($function_array as $var => $function)
|
||||
if (isset($_GET[$var]))
|
||||
{
|
||||
call_user_func($function);
|
||||
die;
|
||||
$pdf_controller->{'process'.$function}();
|
||||
exit;
|
||||
}
|
||||
|
||||
function generateSupplyOrderFormPDF()
|
||||
{
|
||||
if (!Tools::isSubmit('id_supply_order'))
|
||||
die (Tools::displayError('Missing supply order ID'));
|
||||
|
||||
$id_supply_order = (int)Tools::getValue('id_supply_order');
|
||||
$supply_order = new SupplyOrder($id_supply_order);
|
||||
|
||||
if (!Validate::isLoadedObject($supply_order))
|
||||
die(Tools::displayError('Cannot find this supply order in the database'));
|
||||
|
||||
generatePDF($supply_order, PDF::TEMPLATE_SUPPLY_ORDER_FORM);
|
||||
}
|
||||
|
||||
function generateInvoicePDF()
|
||||
{
|
||||
if (Tools::isSubmit('id_order'))
|
||||
generateInvoicePDFByIdOrder(Tools::getValue('id_order'));
|
||||
elseif (Tools::isSubmit('id_order_invoice'))
|
||||
generateInvoicePDFByIdOrderInvoice(Tools::getValue('id_order_invoice'));
|
||||
else
|
||||
die (Tools::displayError('Missing order ID or invoice order ID'));
|
||||
exit;
|
||||
}
|
||||
|
||||
function generateInvoicePDFByIdOrder($id_order)
|
||||
{
|
||||
$order = new Order((int)$id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
|
||||
$order_invoice_list = $order->getInvoicesCollection();
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
|
||||
generatePDF($order_invoice_list, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateInvoicePDFByIdOrderInvoice($id_order_invoice)
|
||||
{
|
||||
$order_invoice = new OrderInvoice((int)$id_order_invoice);
|
||||
if (!Validate::isLoadedObject($order_invoice))
|
||||
die(Tools::displayError('Cannot find order invoice in database'));
|
||||
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => array($order_invoice)));
|
||||
generatePDF($order_invoice, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateOrderSlipPDF()
|
||||
{
|
||||
$orderSlip = new OrderSlip((int)Tools::getValue('id_order_slip'));
|
||||
$order = new Order((int)$orderSlip->id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
$order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
|
||||
|
||||
generatePDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP);
|
||||
}
|
||||
|
||||
function generateDeliverySlipPDF()
|
||||
{
|
||||
if (Tools::isSubmit('id_order'))
|
||||
generateDeliverySlipPDFByIdOrder((int)Tools::getValue('id_order'));
|
||||
elseif (Tools::isSubmit('id_order_invoice'))
|
||||
generateDeliverySlipPDFByIdOrderInvoice((int)Tools::getValue('id_order_invoice'));
|
||||
elseif (Tools::isSubmit('id_delivery'))
|
||||
{
|
||||
$order = Order::getByDelivery((int)Tools::getValue('id_delivery'));
|
||||
generateDeliverySlipPDFByIdOrder((int)$order->id);
|
||||
}
|
||||
else
|
||||
die (Tools::displayError('Missing order ID or invoice order ID'));
|
||||
exit;
|
||||
}
|
||||
|
||||
function generateDeliverySlipPDFByIdOrder($id_order)
|
||||
{
|
||||
$order = new Order((int)$id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
throw new PrestaShopException('Can\'t load Order object');
|
||||
|
||||
$order_invoice_collection = $order->getInvoicesCollection();
|
||||
generatePDF($order_invoice_collection, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
function generateDeliverySlipPDFByIdOrderInvoice($id_order_invoice)
|
||||
{
|
||||
$order_invoice = new OrderInvoice((int)$id_order_invoice);
|
||||
if (!Validate::isLoadedObject($order_invoice))
|
||||
throw new PrestaShopException('Can\'t load Order Invoice object');
|
||||
|
||||
generatePDF($order_invoice, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
function generateInvoicesPDF()
|
||||
{
|
||||
$order_invoice_collection = OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
|
||||
if (!count($order_invoice_collection))
|
||||
die(Tools::displayError('No invoices found'));
|
||||
|
||||
generatePDF($order_invoice_collection, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateInvoicesPDF2()
|
||||
{
|
||||
$order_invoice_collection = array();
|
||||
foreach (explode('-', Tools::getValue('id_order_state')) as $id_order_state)
|
||||
if (is_array($order_invoices = OrderInvoice::getByStatus((int)$id_order_state)))
|
||||
$order_invoice_collection = array_merge($order_invoices, $order_invoice_collection);
|
||||
|
||||
if (!count($order_invoice_collection))
|
||||
die(Tools::displayError('No invoices found'));
|
||||
|
||||
generatePDF($order_invoice_collection, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
function generateOrderSlipsPDF()
|
||||
{
|
||||
$id_order_slips_list = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
if (!count($id_order_slips_list))
|
||||
die (Tools::displayError('No order slips found'));
|
||||
|
||||
$order_slips = array();
|
||||
foreach ($id_order_slips_list as $id_order_slips)
|
||||
$order_slips[] = new OrderSlip((int)$id_order_slips);
|
||||
|
||||
generatePDF($order_slips, PDF::TEMPLATE_ORDER_SLIP);
|
||||
}
|
||||
|
||||
function generateDeliverySlipsPDF()
|
||||
{
|
||||
$order_invoice_collection = OrderInvoice::getByDeliveryDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
|
||||
if (!count($order_invoice_collection))
|
||||
die(Tools::displayError('No invoices found'));
|
||||
|
||||
generatePDF($order_invoice_collection, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
function generatePDF($object, $template)
|
||||
{
|
||||
$pdf = new PDF($object, $template, Context::getContext()->smarty);
|
||||
$pdf->render();
|
||||
}
|
||||
exit;
|
||||
@@ -58,12 +58,15 @@
|
||||
{l s='Credit Slip'}
|
||||
{/if}</td>
|
||||
<td class="document_number">
|
||||
<a target="_blank" href="
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
pdf.php?{if isset($document->is_delivery)}delivery{else}pdf{/if}&id_order_invoice={$document->id}
|
||||
{if isset($document->is_delivery)}
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateDeliverySlipPDF&id_order_invoice={$document->id}">
|
||||
{else}
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order_invoice={$document->id}">
|
||||
{/if}
|
||||
{elseif get_class($document) eq 'OrderSlip'}
|
||||
pdf.php?id_order_slip={$document->id}
|
||||
{/if}">
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateOrderSlipPDF&id_order_slip={$document->id}">
|
||||
{/if}
|
||||
{if get_class($document) eq 'OrderInvoice'}
|
||||
{if isset($document->is_delivery)}
|
||||
#{Configuration::get('PS_DELIVERY_PREFIX', $current_id_lang)}{'%06d'|sprintf:$document->delivery_number}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{* Generate HTML code for printing Invoice Icon with link *}
|
||||
<span style="width:20px; margin-right:5px;">
|
||||
{if ($order_state->invoice && $order->invoice_number)}
|
||||
<a target="_blank" href="pdf.php?id_order={$order->id}&pdf"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order={$order->id}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
{else}
|
||||
-
|
||||
{/if}
|
||||
@@ -36,7 +36,7 @@
|
||||
{* Generate HTML code for printing Delivery Icon with link *}
|
||||
<span style="width:20px;">
|
||||
{if ($order_state->delivery && $order->delivery_number)}
|
||||
<a target="_blank" href="pdf.php?id_order={$order->id}&delivery"><img src="../img/admin/delivery.gif" alt="delivery" /></a>
|
||||
<a target="_blank" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateDeliverySlipPDF&id_order={$order->id}"><img src="../img/admin/delivery.gif" alt="delivery" /></a>
|
||||
{else}
|
||||
-
|
||||
{/if}
|
||||
|
||||
@@ -64,15 +64,19 @@
|
||||
<div class="bloc-command">
|
||||
<div class="button-command">
|
||||
{if (count($invoices_collection))}
|
||||
<a class="button" href="pdf.php?id_order={$order->id}&pdf" target="_blank"><img src="../img/admin/charged_ok.gif" alt="{l s='View invoice'}" /> {l s='View invoice'}</a>
|
||||
<a class="button" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order={$order->id}" target="_blank">
|
||||
<img src="../img/admin/charged_ok.gif" alt="{l s='View invoice'}" /> {l s='View invoice'}
|
||||
</a>
|
||||
{else}
|
||||
<img src="../img/admin/charged_ko.gif" alt="{l s='No invoice'}" /> {l s='No invoice'}
|
||||
<img src="../img/admin/charged_ko.gif" alt="{l s='No invoice'}" /> {l s='No invoice'}
|
||||
{/if}
|
||||
|
|
||||
{if (($currentState && $currentState->delivery) || $order->delivery_number)}
|
||||
<a class="button" href="pdf.php?id_order={$order->id}&delivery" target="_blank"><img src="../img/admin/delivery.gif" alt="{l s='View delivery slip'}" /> {l s='View delivery slip'}</a>
|
||||
<a class="button" href="{$link->getAdminLink('AdminPdf')}&submitAction=generateDeliverySlipPDF&id_order={$order->id}" target="_blank">
|
||||
<img src="../img/admin/delivery.gif" alt="{l s='View delivery slip'}" /> {l s='View delivery slip'}
|
||||
</a>
|
||||
{else}
|
||||
<img src="../img/admin/delivery_ko.gif" alt="{l s='No delivery slip'}" /> {l s='No delivery slip'}
|
||||
<img src="../img/admin/delivery_ko.gif" alt="{l s='No delivery slip'}" /> {l s='No delivery slip'}
|
||||
{/if}
|
||||
|
|
||||
<a class="button" href="javascript:window.print()"><img src="../img/admin/printer.gif" alt="{l s='Print order'}" title="{l s='Print order'}" /> {l s='Print order'}</a>
|
||||
|
||||
@@ -26,5 +26,5 @@
|
||||
|
||||
{* Generate HTML code for printing Invoice Icon with link *}
|
||||
<span style="width:20px; margin-right:5px;">
|
||||
<a href="pdf.php?id_order_invoice={$id_invoice}&pdf"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
<a href="{$link->getAdminLink('AdminPdf')}&submitAction=generateInvoicePDF&id_order_invoice={$id_invoice}"><img src="../img/admin/tab-invoice.gif" alt="invoice" /></a>
|
||||
</span>
|
||||
+1
-1
@@ -68,7 +68,7 @@ $(document).ready(function() {
|
||||
<img src="../img/admin/pdf.gif" alt="{l s='Supply Order State'}">
|
||||
{l s='Print the supply order form'}
|
||||
</legend>
|
||||
<a href="pdf.php?id_supply_order={$supply_order->id}" target="_blank" title="Export as PDF">{l s='Click here to download the supply order form'}.</a>
|
||||
<a href="{$link->getAdminLink('AdminPdf')}&submitAction=generateSupplyOrderFormPDF&id_supply_order={$supply_order->id}" target="_blank" title="Export as PDF">{l s='Click here to download the supply order form'}.</a>
|
||||
</fieldset>
|
||||
{/if}
|
||||
|
||||
|
||||
Vendored
+2
@@ -122,6 +122,8 @@
|
||||
'AdminPPreferencesControllerCore' => 'controllers/admin/AdminPPreferencesController.php',
|
||||
'AdminPaymentController' => 'override/controllers/admin/AdminPaymentController.php',
|
||||
'AdminPaymentControllerCore' => 'controllers/admin/AdminPaymentController.php',
|
||||
'AdminPdfController' => '',
|
||||
'AdminPdfControllerCore' => 'controllers/admin/AdminPdfController.php',
|
||||
'AdminPerformanceController' => 'override/controllers/admin/AdminPerformanceController.php',
|
||||
'AdminPerformanceControllerCore' => 'controllers/admin/AdminPerformanceController.php',
|
||||
'AdminPreferencesController' => 'override/controllers/admin/AdminPreferencesController.php',
|
||||
|
||||
@@ -110,7 +110,7 @@ class AdminDeliverySlipControllerCore extends AdminController
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (count(OrderInvoice::getByDeliveryDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'))))
|
||||
Tools::redirectAdmin('pdf.php?deliveryslips&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generateDeliverySlipsPDF&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')));
|
||||
else
|
||||
$this->errors[] = Tools::displayError('No delivery slip found for this period');
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ class AdminInvoicesControllerCore extends AdminController
|
||||
if (!count($this->errors))
|
||||
{
|
||||
if (count(OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'))))
|
||||
Tools::redirectAdmin('pdf.php?invoices&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicesPDF&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')));
|
||||
|
||||
$this->errors[] = $this->l('No invoice found for this period');
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class AdminInvoicesControllerCore extends AdminController
|
||||
{
|
||||
foreach ($status_array as $id_order_state)
|
||||
if (count(OrderInvoice::getByStatus((int)$id_order_state)))
|
||||
Tools::redirectAdmin('pdf.php?invoices2&id_order_state='.implode('-', $status_array).'&token='.$this->token);
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicesPDF2&id_order_state='.implode('-', $status_array));
|
||||
|
||||
$this->errors[] = $this->l('No invoice found for this status');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2012 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
ing*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2012 PrestaShop SA
|
||||
* @version Release: $Revision$
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminPdfControllerCore extends AdminController
|
||||
{
|
||||
public function postProcess()
|
||||
{
|
||||
parent::postProcess();
|
||||
|
||||
// We want to be sure that displaying PDF is the last thing this controller will do
|
||||
exit;
|
||||
}
|
||||
|
||||
public function processGenerateInvoicePdf()
|
||||
{
|
||||
if (Tools::isSubmit('id_order'))
|
||||
$this->generateInvoicePDFByIdOrder(Tools::getValue('id_order'));
|
||||
elseif (Tools::isSubmit('id_order_invoice'))
|
||||
$this->generateInvoicePDFByIdOrderInvoice(Tools::getValue('id_order_invoice'));
|
||||
else
|
||||
die (Tools::displayError('Missing order ID or invoice order ID'));
|
||||
}
|
||||
|
||||
public function processGenerateOrderSlipPDF()
|
||||
{
|
||||
$orderSlip = new OrderSlip((int)Tools::getValue('id_order_slip'));
|
||||
$order = new Order((int)$orderSlip->id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
$order->products = OrderSlip::getOrdersSlipProducts($orderSlip->id, $order);
|
||||
|
||||
$this->generatePDF($orderSlip, PDF::TEMPLATE_ORDER_SLIP);
|
||||
}
|
||||
|
||||
public function processGenerateDeliverySlipPDF()
|
||||
{
|
||||
if (Tools::isSubmit('id_order'))
|
||||
$this->generateDeliverySlipPDFByIdOrder((int)Tools::getValue('id_order'));
|
||||
elseif (Tools::isSubmit('id_order_invoice'))
|
||||
$this->generateDeliverySlipPDFByIdOrderInvoice((int)Tools::getValue('id_order_invoice'));
|
||||
elseif (Tools::isSubmit('id_delivery'))
|
||||
{
|
||||
$order = Order::getByDelivery((int)Tools::getValue('id_delivery'));
|
||||
$this->generateDeliverySlipPDFByIdOrder((int)$order->id);
|
||||
}
|
||||
else
|
||||
die (Tools::displayError('Missing order ID or invoice order ID'));
|
||||
}
|
||||
|
||||
public function processGenerateInvoicesPDF()
|
||||
{
|
||||
$order_invoice_collection = OrderInvoice::getByDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
|
||||
if (!count($order_invoice_collection))
|
||||
die(Tools::displayError('No invoices found'));
|
||||
|
||||
$this->generatePDF($order_invoice_collection, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
public function processGenerateInvoicesPDF2()
|
||||
{
|
||||
$order_invoice_collection = array();
|
||||
foreach (explode('-', Tools::getValue('id_order_state')) as $id_order_state)
|
||||
if (is_array($order_invoices = OrderInvoice::getByStatus((int)$id_order_state)))
|
||||
$order_invoice_collection = array_merge($order_invoices, $order_invoice_collection);
|
||||
|
||||
if (!count($order_invoice_collection))
|
||||
die(Tools::displayError('No invoices found'));
|
||||
|
||||
$this->generatePDF($order_invoice_collection, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
public function processGenerateOrderSlipsPDF()
|
||||
{
|
||||
$id_order_slips_list = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
if (!count($id_order_slips_list))
|
||||
die (Tools::displayError('No order slips found'));
|
||||
|
||||
$order_slips = array();
|
||||
foreach ($id_order_slips_list as $id_order_slips)
|
||||
$order_slips[] = new OrderSlip((int)$id_order_slips);
|
||||
|
||||
$this->generatePDF($order_slips, PDF::TEMPLATE_ORDER_SLIP);
|
||||
}
|
||||
|
||||
public function processGenerateDeliverySlipsPDF()
|
||||
{
|
||||
$order_invoice_collection = OrderInvoice::getByDeliveryDateInterval(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
|
||||
if (!count($order_invoice_collection))
|
||||
die(Tools::displayError('No invoices found'));
|
||||
|
||||
$this->generatePDF($order_invoice_collection, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
public function processGenerateSupplyOrderFormPDF()
|
||||
{
|
||||
if (!Tools::isSubmit('id_supply_order'))
|
||||
die (Tools::displayError('Missing supply order ID'));
|
||||
|
||||
$id_supply_order = (int)Tools::getValue('id_supply_order');
|
||||
$supply_order = new SupplyOrder($id_supply_order);
|
||||
|
||||
if (!Validate::isLoadedObject($supply_order))
|
||||
die(Tools::displayError('Cannot find this supply order in the database'));
|
||||
|
||||
$this->generatePDF($supply_order, PDF::TEMPLATE_SUPPLY_ORDER_FORM);
|
||||
}
|
||||
|
||||
public function generateDeliverySlipPDFByIdOrder($id_order)
|
||||
{
|
||||
$order = new Order((int)$id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
throw new PrestaShopException('Can\'t load Order object');
|
||||
|
||||
$order_invoice_collection = $order->getInvoicesCollection();
|
||||
$this->generatePDF($order_invoice_collection, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
public function generateDeliverySlipPDFByIdOrderInvoice($id_order_invoice)
|
||||
{
|
||||
$order_invoice = new OrderInvoice((int)$id_order_invoice);
|
||||
if (!Validate::isLoadedObject($order_invoice))
|
||||
throw new PrestaShopException('Can\'t load Order Invoice object');
|
||||
|
||||
$this->generatePDF($order_invoice, PDF::TEMPLATE_DELIVERY_SLIP);
|
||||
}
|
||||
|
||||
public function generateInvoicePDFByIdOrder($id_order)
|
||||
{
|
||||
$order = new Order((int)$id_order);
|
||||
if (!Validate::isLoadedObject($order))
|
||||
die(Tools::displayError('Cannot find order in database'));
|
||||
|
||||
$order_invoice_list = $order->getInvoicesCollection();
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => $order_invoice_list));
|
||||
$this->generatePDF($order_invoice_list, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
public function generateInvoicePDFByIdOrderInvoice($id_order_invoice)
|
||||
{
|
||||
$order_invoice = new OrderInvoice((int)$id_order_invoice);
|
||||
if (!Validate::isLoadedObject($order_invoice))
|
||||
die(Tools::displayError('Cannot find order invoice in database'));
|
||||
|
||||
Hook::exec('actionPDFInvoiceRender', array('order_invoice_list' => array($order_invoice)));
|
||||
$this->generatePDF($order_invoice, PDF::TEMPLATE_INVOICE);
|
||||
}
|
||||
|
||||
public function generatePDF($object, $template)
|
||||
{
|
||||
$pdf = new PDF($object, $template, Context::getContext()->smarty);
|
||||
$pdf->render();
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
if ($searchType == 4)
|
||||
{
|
||||
if ((int)$this->query && Validate::isUnsignedInt((int)$this->query) && ($invoice = Order::getInvoice((int)$this->query)))
|
||||
Tools::redirectAdmin('pdf.php?id_order='.(int)($invoice['id_order']).'&pdf');
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generateInvoicePDF&id_order='.(int)($invoice['id_order']));
|
||||
$this->errors[] = Tools::displayError('No invoice found with this ID:').' '.Tools::htmlentitiesUTF8($this->query);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,7 @@ class AdminSlipControllerCore extends AdminController
|
||||
{
|
||||
$order_slips = OrderSlip::getSlipsIdByDate(Tools::getValue('date_from'), Tools::getValue('date_to'));
|
||||
if (count($order_slips))
|
||||
Tools::redirectAdmin(
|
||||
'pdf.php?slips&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')).'&token='.$this->token);
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminPdf').'&submitAction=generateOrderSlipsPDF&date_from='.urlencode(Tools::getValue('date_from')).'&date_to='.urlencode(Tools::getValue('date_to')));
|
||||
$this->errors[] = $this->l('No order slips found for this period');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1906,7 +1906,7 @@ class AdminSupplyOrdersControllerCore extends AdminController
|
||||
|
||||
$content = '<span style="width:20px; margin-right:5px;">';
|
||||
if ($supply_order_state->editable == false)
|
||||
$content .= '<a href="pdf.php?id_supply_order='.(int)$supply_order->id.'" title="'.$this->l('Export as PDF').'"><img src="../img/admin/pdf.gif" alt=""/></a>';
|
||||
$content .= '<a href="'.$this->context->link->getAdminLink('AdminPdf').'&submitAction=generateSupplyOrderFormPDF&id_supply_order='.(int)$supply_order->id.'" title="'.$this->l('Export as PDF').'"><img src="../img/admin/pdf.gif" alt=""/></a>';
|
||||
else
|
||||
$content .= '-';
|
||||
$content .= '</span>';
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
class AdminTab extends AdminTabCore
|
||||
{
|
||||
}
|
||||
<?php
|
||||
|
||||
abstract class AdminTab extends AdminTabCore
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
class FrontController extends FrontControllerCore
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
class AdminAccountingConfigurationController extends AdminAccountingConfigurationControllerCore
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
class AdminPdfController extends AdminPdfControllerCore
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user