Divide by 0 fix on zero order_prices in new supplier invoice
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 20 Mar 2008 11:49:55 +0000 (11:49 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 20 Mar 2008 11:49:55 +0000 (11:49 +0000)
purchasing/supplier_invoice_grns.php

index 95c345192056b535f22fea52fa7d48f5d563cd8b..3ba94c099f260d489b8802d05857a1c5f5b195f7 100644 (file)
@@ -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;
+                   }
                }
        }