forked from Wavyzz/dolibarr
Fix: broken feature: add param for use only "disabled" with delConstant
and "enabled" with setConstant
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
// Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
// Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@@ -633,7 +633,7 @@ function hideMessage(fieldId,message) {
|
||||
/*
|
||||
* TODO Used by admin page only ?
|
||||
*/
|
||||
function setConstant(url, code, input, entity) {
|
||||
function setConstant(url, code, input, entity, strict) {
|
||||
$.get( url, {
|
||||
action: "set",
|
||||
name: code,
|
||||
@@ -644,7 +644,7 @@ function setConstant(url, code, input, entity) {
|
||||
$("#del_" + code).show();
|
||||
$.each(input, function(type, data) {
|
||||
// Enable another element
|
||||
if (type == "disabled") {
|
||||
if (type == "disabled" && strict != 1) {
|
||||
$.each(data, function(key, value) {
|
||||
var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
|
||||
$(newvalue).removeAttr("disabled");
|
||||
@@ -656,7 +656,10 @@ function setConstant(url, code, input, entity) {
|
||||
} else if (type == "enabled") {
|
||||
$.each(data, function(key, value) {
|
||||
var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
|
||||
$(newvalue).attr("disabled", true);
|
||||
if (strict == 1)
|
||||
$(newvalue).removeAttr("disabled");
|
||||
else
|
||||
$(newvalue).attr("disabled", true);
|
||||
if ($(newvalue).hasClass("butAction") == true) {
|
||||
$(newvalue).removeClass("butAction");
|
||||
$(newvalue).addClass("butActionRefused");
|
||||
@@ -688,7 +691,7 @@ function setConstant(url, code, input, entity) {
|
||||
/*
|
||||
* TODO Used by admin page only ?
|
||||
*/
|
||||
function delConstant(url, code, input, entity) {
|
||||
function delConstant(url, code, input, entity, strict) {
|
||||
$.get( url, {
|
||||
action: "del",
|
||||
name: code,
|
||||
@@ -708,7 +711,7 @@ function delConstant(url, code, input, entity) {
|
||||
$(newvalue).addClass("butActionRefused");
|
||||
}
|
||||
});
|
||||
} else if (type == "enabled") {
|
||||
} else if (type == "enabled" && strict != 1) {
|
||||
$.each(data, function(key, value) {
|
||||
var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
|
||||
$(newvalue).removeAttr("disabled");
|
||||
@@ -742,7 +745,7 @@ function delConstant(url, code, input, entity) {
|
||||
/*
|
||||
* TODO Used by admin page only ?
|
||||
*/
|
||||
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton) {
|
||||
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) {
|
||||
var boxConfirm = box;
|
||||
$("#confirm_" + code)
|
||||
.attr("title", boxConfirm.title)
|
||||
@@ -758,9 +761,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
|
||||
text : yesButton,
|
||||
click : function() {
|
||||
if (action == "set") {
|
||||
setConstant(url, code, input, entity);
|
||||
setConstant(url, code, input, entity, strict);
|
||||
} else if (action == "del") {
|
||||
delConstant(url, code, input, entity);
|
||||
delConstant(url, code, input, entity, strict);
|
||||
}
|
||||
// Close dialog
|
||||
$(this).dialog("close");
|
||||
|
||||
Reference in New Issue
Block a user