mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Warn user before auto-creating credit
This commit is contained in:
parent
6ab5ae0df3
commit
f164d9d92e
@ -2650,6 +2650,7 @@ $LANG = array(
|
|||||||
'expired_white_label' => 'The white label license has expired',
|
'expired_white_label' => 'The white label license has expired',
|
||||||
'return_to_login' => 'Return to Login',
|
'return_to_login' => 'Return to Login',
|
||||||
'convert_products_tip' => 'Note: add a custom field named ":name" to see the exchange rate.',
|
'convert_products_tip' => 'Note: add a custom field named ":name" to see the exchange rate.',
|
||||||
|
'amount_greater_than_balance' => 'The amount is greater than the invoice balance, a credit will be created with the remaining amount.',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
{!! Former::open($url)
|
{!! Former::open($url)
|
||||||
->addClass('col-lg-10 col-lg-offset-1 warn-on-exit main-form')
|
->addClass('col-lg-10 col-lg-offset-1 warn-on-exit main-form')
|
||||||
->onsubmit('onFormSubmit(event)')
|
->onsubmit('return onFormSubmit(event)')
|
||||||
->method($method)
|
->method($method)
|
||||||
->rules(array(
|
->rules(array(
|
||||||
'client' => 'required',
|
'client' => 'required',
|
||||||
@ -215,7 +215,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function onFormSubmit(event) {
|
function onFormSubmit(event) {
|
||||||
|
// warn if amount is more than balance/credit will be created
|
||||||
|
var invoiceId = $('input[name=invoice]').val();
|
||||||
|
var invoice = invoiceMap[invoiceId];
|
||||||
|
var amount = $('#amount').val();
|
||||||
|
|
||||||
|
if (amount <= invoice.balance || confirm("{{ trans('texts.amount_greater_than_balance') }}")) {
|
||||||
$('#saveButton').attr('disabled', true);
|
$('#saveButton').attr('disabled', true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitAction(action) {
|
function submitAction(action) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user