Merge pull request #21470 from thomas-Ngr/develop_fix_formconfirm_send_as_post

send formconfirm as a POST
This commit is contained in:
Laurent Destailleur 2022-08-11 02:09:15 +02:00 committed by GitHub
commit febc1b8600
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5156,8 +5156,9 @@ class Form
closeOnEscape: false,
buttons: {
"'.dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
var options = "&token='.urlencode(newToken()).'";
var options = "token='.urlencode(newToken()).'";
var inputok = '.json_encode($inputok).'; /* List of fields into form */
var page = "'.dol_escape_js(!empty($page) ? $page : '').'";
var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
if (inputok.length>0) {
$.each(inputok, function(i, inputname) {
@ -5174,13 +5175,19 @@ class Form
options += "&" + inputname + "=" + encodeURIComponent(inputvalue);
});
}
var urljump = pageyes + (pageyes.indexOf("?") < 0 ? "?" : "") + options;
if (pageyes.length > 0) { location.href = urljump; }
if (pageyes.length > 0) {
var post = $.post(
pageyes,
options,
(data) => {$("body").html(data)}
);
}
$(this).dialog("close");
},
"'.dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
var options = "&token='.urlencode(newToken()).'";
var options = "token='.urlencode(newToken()).'";
var inputko = '.json_encode($inputko).'; /* List of fields into form */
var page = "'.dol_escape_js(!empty($page) ? $page : '').'";
var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'";
if (inputko.length>0) {
$.each(inputko, function(i, inputname) {
@ -5191,9 +5198,13 @@ class Form
options += "&" + inputname + "=" + encodeURIComponent(inputvalue);
});
}
var urljump=pageno + (pageno.indexOf("?") < 0 ? "?" : "") + options;
//alert(urljump);
if (pageno.length > 0) { location.href = urljump; }
if (pageno.length > 0) {
var post = $.post(
pageno,
options,
(data) => {$("body").html(data)}
);
}
$(this).dialog("close");
}
}