Credit note can be posted without customer selected when search customer List is...
[fa-stable.git] / purchasing / supplier_invoice.php
index a21d0c9123d846c8f98ab1c8903472e7d6e3bde5..d3cef151f0c9717f509b2785006930d5cec14b40 100644 (file)
@@ -170,6 +170,13 @@ function check_data()
 {
        global $Refs;
 
+       if (!get_post('supplier_id')) 
+       {
+               display_error(_("There is no supplier selected."));
+               set_focus('supplier_id');
+               return false;
+       } 
+
        if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
        {
                display_error(_("The invoice cannot be processed because the there are no items or values on the invoice.  Invoices are expected to have a charge."));
@@ -295,20 +302,10 @@ function commit_item_data($n)
 {
        if (check_item_data($n))
        {
-       if (input_num('this_quantity_inv'.$n) >= ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]))
-       {
-               $complete = true;
-       }
-       else
-       {
-               $complete = false;
-       }
-
                $_SESSION['supp_trans']->add_grn_to_trans($n, $_POST['po_detail_item'.$n],
                        $_POST['item_code'.$n], $_POST['item_description'.$n], $_POST['qty_recd'.$n],
                        $_POST['prev_quantity_inv'.$n], input_num('this_quantity_inv'.$n),
-                       $_POST['order_price'.$n], input_num('ChgPrice'.$n), $complete,
-                       $_POST['std_cost_unit'.$n], "");
+                       $_POST['order_price'.$n], input_num('ChgPrice'.$n));
                reset_tax_input();
        }
 }
@@ -411,7 +408,7 @@ if ($id != -1 || $id2 != -1)
        $Ajax->activate('inv_tot');
 }
 
-if (get_post('AddGLCodeToTrans'))
+if (get_post('AddGLCodeToTrans') || get_post('update'))
        $Ajax->activate('inv_tot');
 
 br();