1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Warning if changing gateway fee location

This commit is contained in:
Hillel Coren 2017-03-19 16:35:03 +02:00
parent 3ac6c42efb
commit eff34f9133
2 changed files with 18 additions and 2 deletions

View File

@ -2416,9 +2416,9 @@ $LANG = array(
'online_payment_surcharge' => 'Online Payment Surcharge',
'gateway_fees' => 'Gateway Fees',
'fees_disabled' => 'Fees are disabled',
//'gateway_fees_help' => 'Automatically add an online payment surcharge [partial payments are not supported].',
'gateway_fees_help' => 'Automatically add an online payment surcharge or line item.<br/>Use \'Line item\' to support partial payments.',
'gateway' => 'Gateway',
'gateway_fee_change_warning' => 'If there are unpaid invoices with fees applied they need to be removed to prevent duplicate fees.',
);

View File

@ -30,6 +30,7 @@
->addOption(trans('texts.location_first_surcharge') . ($account->custom_invoice_label1 ? ' | ' . $account->custom_invoice_label1 : ''), FEE_LOCATION_CHARGE1)
->addOption(trans('texts.location_second_surcharge') . ($account->custom_invoice_label2 ? ' | ' . $account->custom_invoice_label2 : '' ), FEE_LOCATION_CHARGE2)
->addOption(trans('texts.location_line_item'), FEE_LOCATION_ITEM)
->onchange('onGatewayFeeChange()')
->help('gateway_fees_help')
->label('gateway_fees')!!}
<br/>
@ -57,7 +58,7 @@
->setOptions('sPaginationType', 'bootstrap')
->setOptions('bFilter', false)
->setOptions('bAutoWidth', false)
->setOptions('aoColumns', [[ "sWidth"=> "24%" ], ["sWidth"=> "27%"], ["sWidth"=> "27%"], ["sWidth"=> "20%"]])
->setOptions('aoColumns', [[ "sWidth"=> "20%" ], ["sWidth"=> "20%"], ["sWidth"=> "30%"], ["sWidth"=> "20%"]])
->setOptions('aoColumnDefs', [['bSortable'=>false, 'aTargets'=>[1, 2, 3]]])
->render('datatable') !!}
@ -372,6 +373,21 @@
onTaxRateChange(instance);
}
function onGatewayFeeChange()
{
if (window.hasShownGatewayFeeWarning) {
return;
}
window.hasShownGatewayFeeWarning = true;
var settingLocation = $('#gateway_fee_location').val();
var accountLocation = '{{ $account->gateway_fee_location }}';
if (accountLocation && settingLocation && accountLocation != settingLocation) {
swal("{!! trans('texts.warning') !!}", "{!! trans('texts.gateway_fee_change_warning') !!}");
}
}
</script>
@stop