From 3b17c0a9c6a20e8d4bf3fccc4c8215f9c16f674c Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Thu, 20 Mar 2008 11:49:55 +0000 Subject: [PATCH] Divide by 0 fix on zero order_prices in new supplier invoice --- purchasing/supplier_invoice_grns.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/purchasing/supplier_invoice_grns.php b/purchasing/supplier_invoice_grns.php index 95c34519..3ba94c09 100644 --- a/purchasing/supplier_invoice_grns.php +++ b/purchasing/supplier_invoice_grns.php @@ -47,12 +47,15 @@ function check_data() if ($check_price_charged_vs_order_price == True) { - if (input_num('ChgPrice')/$_POST['order_price'] > - (1 + (sys_prefs::over_charge_allowance() / 100))) - { + if ($_POST['order_price']!=input_num('ChgPrice')) { + if ($_POST['order_price']==0 || + input_num('ChgPrice')/$_POST['order_price'] > + (1 + (sys_prefs::over_charge_allowance() / 100))) + { display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") . _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%"); return false; + } } } -- 2.30.2