Transaction references extended with parametrized patterns, added check_reference...
[fa-stable.git] / purchasing / po_entry_items.php
index 1ab8e66309f88e2fc8a829e66f1f28aec9e929e7..a4afb367dce2194cc7c1b7e12c243770ec64ed1d 100644 (file)
@@ -31,7 +31,7 @@ set_page_security( @$_SESSION['PO']->trans_type,
 );
 
 $js = '';
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
        $js .= get_js_open_window(900, 500);
 if (user_use_date_picker())
        $js .= get_js_date_picker();
@@ -353,22 +353,14 @@ function can_commit()
 
        if (!$_SESSION['PO']->order_no) 
        {
-       if (!$Refs->is_valid(get_post('ref'))) 
+       if (!check_reference(get_post('ref'), $_SESSION['PO']->trans_type))
        {
-               display_error(_("There is no reference entered for this purchase order."));
-                       set_focus('ref');
-               return false;
-       } 
-
-       if (!is_new_reference(get_post('ref'), $_SESSION['PO']->trans_type)) 
-       {
-               display_error(_("The entered reference is already in use."));
                        set_focus('ref');
                return false;
        }
        }
 
-       if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE && !$Refs->is_valid(get_post('supp_ref'))) 
+       if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE && empty(trim(get_post('supp_ref'))))
        {
                display_error(_("You must enter a supplier's invoice reference."));
                set_focus('supp_ref');
@@ -472,13 +464,8 @@ display_po_items($_SESSION['PO']);
 
 start_table(TABLESTYLE2);
 
-if (list_updated('tax_algorithm')) {
-       $_SESSION['PO']->tax_algorithm = $_POST['tax_algorithm'];
-    $Ajax->activate('items_table');
-}
 
 if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE) {
-       tax_algorithm_list_row(_("Tax algorithm:"), 'tax_algorithm', null, true);
        cash_accounts_list_row(_("Payment:"), 'cash_account', null, false, _('Delayed'));
 }
 
@@ -515,4 +502,3 @@ div_end();
 
 end_form();
 end_page();
-?>