FIX 17965 - Keep enter key only to submit expense lines form

This commit is contained in:
lvessiller 2021-06-18 10:51:39 +02:00
parent c329c895fa
commit af634b7f2b

View File

@ -159,7 +159,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if (GETPOSTISSET('sendit')) { // If we just submit a file if (!empty(GETPOST('sendit', 'alpha'))) { // If we just submit a file
if ($action == 'updateline') { if ($action == 'updateline') {
$action = 'editline'; // To avoid to make the updateline now $action = 'editline'; // To avoid to make the updateline now
} else { } else {
@ -2191,33 +2191,23 @@ if ($action == 'create') {
$( ".auploadnewfilenow" ).click(function() { $( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle(); jQuery(".truploadnewfilenow").toggle();
jQuery(".trattachnewfilenow").hide(); jQuery(".trattachnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
}); });
$( ".aattachtodoc" ).click(function() { $( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle(); jQuery(".trattachnewfilenow").toggle();
jQuery(".truploadnewfilenow").hide(); jQuery(".truploadnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
});'; });';
if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array'))) { if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array'))) {
print 'jQuery(".trattachnewfilenow").toggle();'."\n"; print 'jQuery(".trattachnewfilenow").toggle();'."\n";
} }
print ' print '
if (jQuery(".truploadnewfilenow").is(":hidden")) { jQuery("form[name=\"expensereport\"]").submit(function() {
jQuery("input[name=\"sendit\"]").prop("disabled", true); if (jQuery(".truploadnewfilenow").is(":hidden")) {
} else { jQuery("input[name=\"sendit\"]").val("");
jQuery("input[name=\"sendit\"]").prop("disabled", false); }
} });
'; ';
print ' print '
}); });
'; ';
@ -2354,33 +2344,23 @@ if ($action == 'create') {
$( ".auploadnewfilenow" ).click(function() { $( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle(); jQuery(".truploadnewfilenow").toggle();
jQuery(".trattachnewfilenow").hide(); jQuery(".trattachnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
}); });
$( ".aattachtodoc" ).click(function() { $( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle(); jQuery(".trattachnewfilenow").toggle();
jQuery(".truploadnewfilenow").hide(); jQuery(".truploadnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
});'."\n"; });'."\n";
if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')) && $action != 'updateline') { if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')) && $action != 'updateline') {
print 'jQuery(".trattachnewfilenow").show();'."\n"; print 'jQuery(".trattachnewfilenow").show();'."\n";
} }
print ' print '
if (jQuery(".truploadnewfilenow").is(":hidden")) { jQuery("form[name=\"expensereport\"]").submit(function() {
jQuery("input[name=\"sendit\"]").prop("disabled", true); if (jQuery(".truploadnewfilenow").is(":hidden")) {
} else { jQuery("input[name=\"sendit\"]").val("");
jQuery("input[name=\"sendit\"]").prop("disabled", false); }
} });
'; ';
print ' print '
}); });
'; ';