[-] BO : fixed bug #PSFV-504 - Even if the invoices management is disabled, you can create an invoice

This commit is contained in:
aFolletete committed 2012-04-13 10:01:21 +00:00
1 parent 9be1cb186a
commit 874849038c
2 files changed
+7 -2

No files matched your search

@@ -118,11 +118,13 @@
</tr> </tr>
{/if} {/if}
{/if} {/if}
{foreachelse} {foreachelse}
<tr> <tr>
<td colspan="5" class="center"> <td colspan="5" class="center">
<h3>{l s='No document is available'}</h3> <h3>{l s='No document is available'}</h3>
{if $invoice_management_active}
<p><a class="button" href="{$currentIndex}&viewOrder&submitGenerateInvoice&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">{l s='Generate invoice'}</a></p> <p><a class="button" href="{$currentIndex}&viewOrder&submitGenerateInvoice&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">{l s='Generate invoice'}</a></p>
{/if}
</td> </td>
</tr> </tr>
{/foreach} {/foreach}
+4 -1
View File
@@ -825,7 +825,9 @@ class AdminOrdersControllerCore extends AdminController
} }
elseif (Tools::isSubmit('submitGenerateInvoice') && isset($order)) 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'); $this->errors[] = Tools::displayError('This order already has an invoice');
else else
{ {
@@ -1179,6 +1181,7 @@ class AdminOrdersControllerCore extends AdminController
'invoices_collection' => $order->getInvoicesCollection(), 'invoices_collection' => $order->getInvoicesCollection(),
'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(), 'not_paid_invoices_collection' => $order->getNotPaidInvoicesCollection(),
'payment_methods' => $payment_methods, 'payment_methods' => $payment_methods,
'invoice_management_active' => Configuration::get('PS_INVOICE')
); );
return parent::renderView(); return parent::renderView();