Merge pull request #24638 from noec764/16_FIX_Expense_report_TTC_autofill

FIX: expense report autofill ttc input if force ttc conf is enabled
This commit is contained in:
Laurent Destailleur 2023-04-28 20:00:29 +02:00 committed by GitHub
commit 48358ef3a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2643,10 +2643,22 @@ if ($action == 'create') {
,async:false
,dataType:"json"
,success:function(response) {
if (response.response_status == "success"){
jQuery("#value_unit_ht").val(response.data);
jQuery("#value_unit_ht").trigger("change");
jQuery("#value_unit").val("");
if (response.response_status == "success"){';
if (!empty($conf->global->EXPENSEREPORT_FORCE_LINE_AMOUNTS_INCLUDING_TAXES_ONLY)) {
print '
jQuery("#value_unit").val(parseFloat(response.data) * (100 + parseFloat(tva)) / 100);
jQuery("#value_unit").trigger("change");
';
} else {
print '
jQuery("#value_unit_ht").val(response.data);
jQuery("#value_unit_ht").trigger("change");
jQuery("#value_unit").val("");
';
}
print '
} else if(response.response_status == "error" && response.errorMessage != undefined && response.errorMessage.length > 0 ){
$.jnotify(response.errorMessage, "error", {timeout: 0, type: "error"},{ remove: function (){} } );
}