2
0
forked from Wavyzz/dolibarr

Fix: broken feature: add param for use only "disabled" with delConstant

and "enabled" with setConstant
This commit is contained in:
Regis Houssin
2014-08-17 15:12:20 +02:00
parent f392eb4c94
commit e713c8dadc
2 changed files with 18 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -391,9 +391,10 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0)
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @param int $entity Entity to set
* @param int $revertonoff Revert on/off
* @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant
* @return void
*/
function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0)
{
global $conf, $langs;
@@ -413,6 +414,7 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
var code = \''.$code.'\';
var entity = \''.$entity.'\';
var strict = \''.$strict.'\';
var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'";
var noButton = "'.dol_escape_js($langs->transnoentities("No")).'";
@@ -421,7 +423,7 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
if (input.alert && input.alert.set) {
if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton;
if (input.alert.set.noButton) noButton = input.alert.set.noButton;
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton);
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict);
} else {
setConstant(url, code, input, entity);
}
@@ -432,7 +434,7 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
if (input.alert && input.alert.del) {
if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton;
if (input.alert.del.noButton) noButton = input.alert.del.noButton;
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton);
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict);
} else {
delConstant(url, code, input, entity);
}