From 874849038c1cb0a91d6f210b5babcaaad924abf2 Mon Sep 17 00:00:00 2001 From: aFolletete Date: Fri, 13 Apr 2012 10:01:21 +0000 Subject: [PATCH] [-] BO : fixed bug #PSFV-504 - Even if the invoices management is disabled, you can create an invoice --- .../default/template/controllers/orders/_documents.tpl | 4 +++- controllers/admin/AdminOrdersController.php | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/orders/_documents.tpl b/admin-dev/themes/default/template/controllers/orders/_documents.tpl index 95b0570c8..29bddbbfa 100644 --- a/admin-dev/themes/default/template/controllers/orders/_documents.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_documents.tpl @@ -118,11 +118,13 @@ {/if} {/if} - {foreachelse} + {foreachelse}

{l s='No document is available'}

+ {if $invoice_management_active}

{l s='Generate invoice'}

+ {/if} {/foreach} diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 20e9400e3..4110ed96f 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -825,7 +825,9 @@ class AdminOrdersControllerCore extends AdminController } elseif (Tools::isSubmit('submitGenerateInvoice') && isset($order)) { - if ($order->hasInvoice()) + if (!Configuration::get('PS_INVOICE')) + $this->errors[] = Tools::displayError('Invoice management has been disabled'); + elseif ($order->hasInvoice()) $this->errors[] = Tools::displayError('This order already has an invoice'); else { @@ -1179,6 +1181,7 @@ class AdminOrdersControllerCore extends AdminController 'invoices_collection' => $order->getInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'payment_methods' => $payment_methods, + 'invoice_management_active' => Configuration::get('PS_INVOICE') ); return parent::renderView();