Optimized database indexes.
[fa-stable.git] / purchasing / supplier_payment.php
index 713d0122ffda7fc292716b9cf3a767bf1fea960e..68ed1c8f61b8762878d9c9528c21ebc1bc93d2c4 100644 (file)
@@ -28,7 +28,7 @@ if ($use_date_picker)
 
 add_js_file('payalloc.js');
 
-page(_("Supplier Payment Entry"), false, false, "", $js);
+page(_($help_context = "Supplier Payment Entry"), false, false, "", $js);
 
 if (isset($_GET['supplier_id']))
 {
@@ -102,10 +102,13 @@ function check_inputs()
                return false;
        }
 
-       if (isset($_POST['charge']) && input_num('charge') > 0 && get_company_pref('bank_charge_act') == '') {
-               display_error(_("The Bank Charge Account has not been set in System and General GL Setup."));
-               set_focus('charge');
-               return false;
+       if (isset($_POST['charge']) && input_num('charge') > 0) {
+               $charge_acct = get_company_pref('bank_charge_act');
+               if (get_gl_account($charge_acct) == false) {
+                       display_error(_("The Bank Charge Account has not been set in System and General GL Setup."));
+                       set_focus('charge');
+                       return false;
+               }       
        }
 
        if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 0.000001))
@@ -161,7 +164,11 @@ function check_inputs()
        }
 
        $_SESSION['alloc']->amount = -input_num('amount');
-       return check_allocations();
+
+       if (isset($_POST["TotalNumberOfAllocs"]))
+               return check_allocations();
+       else
+               return true;
 }
 
 //----------------------------------------------------------------------------------------