FIX: contact/adress tab: when changing company ajax combo, the first contact change is not taken into account

This commit is contained in:
Marc de Lima Lucio 2018-12-18 09:40:58 +01:00
parent 051853fc00
commit 7e2eca661b
2 changed files with 4 additions and 4 deletions

View File

@ -1355,7 +1355,7 @@ class Form
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
} }
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlid.'" name="'.$htmlname.'" '.(!empty($moreparam) ? $moreparam : '').'>'; if ($htmlname != 'none' && ! $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlid.'" name="'.$htmlname.'" '.(!empty($moreparam) ? $moreparam : '').'>';
if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected':'').'>&nbsp;</option>'; if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected':'').'>&nbsp;</option>';
if ($showempty == 2) $out.= '<option value="0"'.($selected=='0'?' selected':'').'>'.$langs->trans("Internal").'</option>'; if ($showempty == 2) $out.= '<option value="0"'.($selected=='0'?' selected':'').'>'.$langs->trans("Internal").'</option>';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
@ -1417,7 +1417,7 @@ class Form
{ {
$out.= '<option value="-1"'.($showempty==2?'':' selected').' disabled>'.$langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined").'</option>'; $out.= '<option value="-1"'.($showempty==2?'':' selected').' disabled>'.$langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined").'</option>';
} }
if ($htmlname != 'none' || $options_only) if ($htmlname != 'none' && ! $options_only)
{ {
$out.= '</select>'; $out.= '</select>';
} }

View File

@ -589,8 +589,8 @@ class FormCompany
runJsCodeForEvent'.$htmlname.'(values); runJsCodeForEvent'.$htmlname.'(values);
} }
}); });
/* Clean contact */
$("div#s2id_contactid>a>span").html(\'\'); $(this).trigger("blur");
}); });
// Function used to execute events when search_htmlname change // Function used to execute events when search_htmlname change