[0005214] Stock Check Sheet: changed option name to less confusing for shortages...
[fa-stable.git] / gl / bank_transfer.php
index 7b987636a16162d005e06a133bba6b247720013e..79195b5c99b6df06467232aa987338c6440c6314 100644 (file)
@@ -87,14 +87,13 @@ function gl_payment_controls($trans_no)
                        $_POST['target_amount'] = price_format($to_trans['amount']);
                        $_POST['amount'] = price_format(-$from_trans['amount']);
                } else {
-                       $_POST['ref'] = $Refs->get_next(ST_BANKTRANSFER);
+                       $_POST['ref'] = $Refs->get_next(ST_BANKTRANSFER, null, get_post('DatePaid'));
                        $_POST['memo_'] = '';
                        $_POST['FromBankAccount'] = 0;
                        $_POST['ToBankAccount'] = 0;
                        $_POST['amount'] = 0;
                }
        }
-       $home_currency = get_company_currency();
 
        start_form();
 
@@ -115,7 +114,8 @@ function gl_payment_controls($trans_no)
        }
     date_row(_("Transfer Date:"), 'DatePaid', '', true, 0, 0, 0, null, true);
 
-       ref_row(_("Reference:"), 'ref', '', $_POST['ref']);
+    ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKTRANSFER, null, get_post('DatePaid')), false, ST_BANKTRANSFER,
+       array('date' => get_post('DatePaid')));
 
        table_section(2);
 
@@ -232,15 +232,8 @@ function check_valid_entries($trans_no)
                set_focus('charge');
                return false;
        }
-       if (!$Refs->is_valid($_POST['ref'])) 
-       {
-               display_error(_("You must enter a reference."));
-               set_focus('ref');
-               return false;
-       }
 
-       if (! $trans_no && ! is_new_reference($_POST['ref'], ST_BANKTRANSFER)) {
-               display_error(_("The entered reference is already in use."));
+       if (!check_reference($_POST['ref'], ST_BANKTRANSFER, $trans_no)) {
                set_focus('ref');
                return false;
        }