From 7e2eca661bd289ff76138c2fa6ed081b9133197f Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 18 Dec 2018 09:40:58 +0100 Subject: [PATCH] FIX: contact/adress tab: when changing company ajax combo, the first contact change is not taken into account --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/core/class/html.formcompany.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index bc9aa55f6f681..1dc334560ec4c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1355,7 +1355,7 @@ function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty= $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); } - if ($htmlname != 'none' || $options_only) $out.= ''; if ($showempty == 1) $out.= ''; if ($showempty == 2) $out.= ''; $num = $this->db->num_rows($resql); @@ -1417,7 +1417,7 @@ function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty= { $out.= ''; } - if ($htmlname != 'none' || $options_only) + if ($htmlname != 'none' && ! $options_only) { $out.= ''; } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 63babef655ebb..317f5fe1af61a 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -589,8 +589,8 @@ function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname= runJsCodeForEvent'.$htmlname.'(values); } }); - /* Clean contact */ - $("div#s2id_contactid>a>span").html(\'\'); + + $(this).trigger("blur"); }); // Function used to execute events when search_htmlname change