Skip to content
Snippets Groups Projects
Commit d5eb4510 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.6

parents dd9a0812 0632cbda
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net> // 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 // 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 // it under the terms of the GNU General Public License as published by
...@@ -633,7 +633,7 @@ function hideMessage(fieldId,message) { ...@@ -633,7 +633,7 @@ function hideMessage(fieldId,message) {
/* /*
* TODO Used by admin page only ? * TODO Used by admin page only ?
*/ */
function setConstant(url, code, input, entity) { function setConstant(url, code, input, entity, strict) {
$.get( url, { $.get( url, {
action: "set", action: "set",
name: code, name: code,
...@@ -644,7 +644,7 @@ function setConstant(url, code, input, entity) { ...@@ -644,7 +644,7 @@ function setConstant(url, code, input, entity) {
$("#del_" + code).show(); $("#del_" + code).show();
$.each(input, function(type, data) { $.each(input, function(type, data) {
// Enable another element // Enable another element
if (type == "disabled") { if (type == "disabled" && strict != 1) {
$.each(data, function(key, value) { $.each(data, function(key, value) {
var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value; var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
$(newvalue).removeAttr("disabled"); $(newvalue).removeAttr("disabled");
...@@ -656,6 +656,9 @@ function setConstant(url, code, input, entity) { ...@@ -656,6 +656,9 @@ function setConstant(url, code, input, entity) {
} else if (type == "enabled") { } else if (type == "enabled") {
$.each(data, function(key, value) { $.each(data, function(key, value) {
var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value; var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
if (strict == 1)
$(newvalue).removeAttr("disabled");
else
$(newvalue).attr("disabled", true); $(newvalue).attr("disabled", true);
if ($(newvalue).hasClass("butAction") == true) { if ($(newvalue).hasClass("butAction") == true) {
$(newvalue).removeClass("butAction"); $(newvalue).removeClass("butAction");
...@@ -688,7 +691,7 @@ function setConstant(url, code, input, entity) { ...@@ -688,7 +691,7 @@ function setConstant(url, code, input, entity) {
/* /*
* TODO Used by admin page only ? * TODO Used by admin page only ?
*/ */
function delConstant(url, code, input, entity) { function delConstant(url, code, input, entity, strict) {
$.get( url, { $.get( url, {
action: "del", action: "del",
name: code, name: code,
...@@ -708,7 +711,7 @@ function delConstant(url, code, input, entity) { ...@@ -708,7 +711,7 @@ function delConstant(url, code, input, entity) {
$(newvalue).addClass("butActionRefused"); $(newvalue).addClass("butActionRefused");
} }
}); });
} else if (type == "enabled") { } else if (type == "enabled" && strict != 1) {
$.each(data, function(key, value) { $.each(data, function(key, value) {
var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value; var newvalue=((value.search("^#") < 0 && value.search("^\.") < 0) ? "#" : "") + value;
$(newvalue).removeAttr("disabled"); $(newvalue).removeAttr("disabled");
...@@ -742,7 +745,7 @@ function delConstant(url, code, input, entity) { ...@@ -742,7 +745,7 @@ function delConstant(url, code, input, entity) {
/* /*
* TODO Used by admin page only ? * 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; var boxConfirm = box;
$("#confirm_" + code) $("#confirm_" + code)
.attr("title", boxConfirm.title) .attr("title", boxConfirm.title)
...@@ -758,9 +761,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, ...@@ -758,9 +761,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); setConstant(url, code, input, entity, strict);
} else if (action == "del") { } else if (action == "del") {
delConstant(url, code, input, entity); delConstant(url, code, input, entity, strict);
} }
// Close dialog // Close dialog
$(this).dialog("close"); $(this).dialog("close");
......
<?php <?php
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* 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> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -391,9 +391,10 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) ...@@ -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 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 $entity Entity to set
* @param int $revertonoff Revert on/off * @param int $revertonoff Revert on/off
* @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant
* @return void * @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; global $conf, $langs;
...@@ -406,6 +407,7 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) ...@@ -406,6 +407,7 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\'; var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
var code = \''.$code.'\'; var code = \''.$code.'\';
var entity = \''.$entity.'\'; var entity = \''.$entity.'\';
var strict = \''.$strict.'\';
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")).'";
...@@ -414,9 +416,9 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) ...@@ -414,9 +416,9 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
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); confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict);
} else { } else {
setConstant(url, code, input, entity); setConstant(url, code, input, entity, strict);
} }
}); });
...@@ -425,9 +427,9 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0) ...@@ -425,9 +427,9 @@ function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0)
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); confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict);
} else { } else {
delConstant(url, code, input, entity); delConstant(url, code, input, entity, strict);
} }
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment