Prepare for fix

This commit is contained in:
Laurent Destailleur 2020-09-19 01:53:22 +02:00
parent b7a97b2c81
commit 6a45545ec1
2 changed files with 15 additions and 11 deletions

View File

@ -670,8 +670,9 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
* @param int noButton noButton * @param int noButton noButton
* @param int strict Strict * @param int strict Strict
* @param int userid User id * @param int userid User id
* @param string token Token
*/ */
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict, userid) { function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict, userid, token) {
var boxConfirm = box; var boxConfirm = box;
$("#confirm_" + code) $("#confirm_" + code)
.attr("title", boxConfirm.title) .attr("title", boxConfirm.title)
@ -687,9 +688,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
text : yesButton, text : yesButton,
click : function() { click : function() {
if (action == "set") { if (action == "set") {
setConstant(url, code, input, entity, strict, 0, userid); setConstant(url, code, input, entity, strict, 0, userid, token);
} else if (action == "del") { } else if (action == "del") {
delConstant(url, code, input, entity, strict, 0, userid); delConstant(url, code, input, entity, strict, 0, userid, token);
} }
// Close dialog // Close dialog
$(this).dialog("close"); $(this).dialog("close");

View File

@ -516,17 +516,18 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
var entity = \''.$entity.'\'; var entity = \''.$entity.'\';
var strict = \''.$strict.'\'; var strict = \''.$strict.'\';
var userid = \''.$user->id.'\'; var userid = \''.$user->id.'\';
var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'"; var yesButton = \''.dol_escape_js($langs->transnoentities("Yes")).'\';
var noButton = "'.dol_escape_js($langs->transnoentities("No")).'"; var noButton = \''.dol_escape_js($langs->transnoentities("No")).'\';
var token = \''.newToken().'\';
// Set constant // Set constant
$("#set_" + code).click(function() { $("#set_" + code).click(function() {
if (input.alert && input.alert.set) { if (input.alert && input.alert.set) {
if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton; if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
if (input.alert.set.noButton) noButton = input.alert.set.noButton; if (input.alert.set.noButton) noButton = input.alert.set.noButton;
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict, userid); confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict, userid, token);
} else { } else {
setConstant(url, code, input, entity, 0, '.$forcereload.', userid); setConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);
} }
}); });
@ -535,9 +536,9 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
if (input.alert && input.alert.del) { if (input.alert && input.alert.del) {
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
if (input.alert.del.noButton) noButton = input.alert.del.noButton; if (input.alert.del.noButton) noButton = input.alert.del.noButton;
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid); confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token);
} else { } else {
delConstant(url, code, input, entity, 0, '.$forcereload.', userid); delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);
} }
}); });
}); });
@ -579,7 +580,8 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
field: \''.$field.'\', field: \''.$field.'\',
value: \'1\', value: \'1\',
element: \''.$object->element.'\', element: \''.$object->element.'\',
id: \''.$object->id.'\' id: \''.$object->id.'\',
token: \''.newToken().'\'
}, },
function() { function() {
$("#set_'.$code.'_'.$object->id.'").hide(); $("#set_'.$code.'_'.$object->id.'").hide();
@ -609,7 +611,8 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
field: \''.$field.'\', field: \''.$field.'\',
value: \'0\', value: \'0\',
element: \''.$object->element.'\', element: \''.$object->element.'\',
id: \''.$object->id.'\' id: \''.$object->id.'\',
token: \''.newToken().'\'
}, },
function() { function() {
$("#del_'.$code.'_'.$object->id.'").hide(); $("#del_'.$code.'_'.$object->id.'").hide();