include_once($path_to_root . "/gl/includes/gl_ui.inc");
$js = "";
-if ($use_popup_windows)
+if ($SysPrefs->use_popup_windows)
$js .= get_js_open_window(800, 500);
if (user_use_date_picker())
$js .= get_js_date_picker();
$_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();
}
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);
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;
}