From 72304505cb8f55355d79b2037765dfd7a6d88982 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 12 Jan 2012 04:11:20 +0800 Subject: [PATCH 1/2] Fix: add htmlname parameter --- htdocs/core/lib/security.lib.php | 2 +- htdocs/user/passwordforgotten.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index d6a8281ce72..34a6ab9b200 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -269,7 +269,7 @@ function dol_loginfunction($langs,$conf,$mysoc) if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX)) { $rowspan++; - $select_entity = $mc->select_entities($lastentity, 'tabindex="3"', 1); + $select_entity = $mc->select_entities($lastentity, 'entity', ' tabindex="3"', 1); } // Security graphical code diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 8a355b4b5b5..783a2d24923 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -228,7 +228,7 @@ if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_ } } - $select_entity = $mc->select_entities($lastentity,'tabindex="2"'); + $select_entity = $mc->select_entities($lastentity, 'entity', ' tabindex="2"'); } // Security graphical code From 303521d14c57b066445e4e43dbcfa1e500de3488 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 12 Jan 2012 04:12:15 +0800 Subject: [PATCH 2/2] New: add possibility to disable or show/hide another elements --- htdocs/core/lib/ajax.lib.php | 44 ++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index e01ae8ef04e..c38b957a813 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -221,60 +221,70 @@ function ajax_combobox($htmlname) * @param string $code Name of constant * @param array $input Input element * @param int $entity Entity to set - * TODO add different method for other input (show/hide, disable, ..) + * @return void */ function ajax_constantonoff($code,$input=array(),$entity=false) { global $conf, $langs; - + $entity = ((! empty($entity) && is_numeric($entity) && $entity > 0) || $entity == 0 ? $entity : $conf->entity); $out= '