From d2e2dabf26695255fad2104065e34a1458163090 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 13 May 2014 11:40:19 +0200 Subject: [PATCH] Add showempty into combobox --- htdocs/core/ajax/contacts.php | 4 +++- htdocs/core/lib/ajax.lib.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/contacts.php b/htdocs/core/ajax/contacts.php index c4f3d79da52..97f29c4069d 100644 --- a/htdocs/core/ajax/contacts.php +++ b/htdocs/core/ajax/contacts.php @@ -32,6 +32,7 @@ require '../../main.inc.php'; $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $htmlname = GETPOST('htmlname','alpha'); +$showempty = GETPOST('showempty','int'); /* * View @@ -47,8 +48,9 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname)) $form = new Form($db); $return=array(); + if (empty($showempty)) $showempty=0; - $return['value'] = $form->selectcontacts($id,'','contactid',0,'','',0,'',true); + $return['value'] = $form->selectcontacts($id,'','contactid',$showempty,'','',0,'',true); $return['num'] = $form->num; $return['error'] = $form->error; diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index b09699cbc33..55815324487 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -348,11 +348,13 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0) var method = obj.method; var url = obj.url; var htmlname = obj.htmlname; + var showempty = obj.showempty; $.getJSON(url, { action: method, id: id, - htmlname: htmlname + htmlname: htmlname, + showempty: showempty }, function(response) { $.each(obj.params, function(key,action) {