Fix: add empty message in combobox

This commit is contained in:
Regis Houssin 2012-03-18 12:18:23 +01:00
parent 9526465824
commit 3cdff5361f
2 changed files with 6 additions and 3 deletions

View File

@ -815,9 +815,9 @@ class Form
if ($resql)
{
$num=$this->db->num_rows($resql);
if ($num == 0) return 0;
$disable=($num==0 ? ' disabled="disabled"' : '');
if ($htmlname != 'none') print '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($htmlname != 'none') print '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disable.'>';
if ($showempty) print '<option value="0"></option>';
$num = $this->db->num_rows($resql);
$i = 0;
@ -870,6 +870,10 @@ class Form
$i++;
}
}
else
{
print '<option value="-1" selected="selected">'.$langs->trans("NoContactDefined").'</option>';
}
if ($htmlname != 'none')
{
print '</select>';

View File

@ -76,7 +76,6 @@ $userstatic=new User($db);
</td>
<td>
<?php $nbofcontacts=$form->select_contacts($selectedCompany, '', 'contactid'); ?>
<?php if ($nbofcontacts == 0) echo $langs->trans("NoContactDefined"); ?>
</td>
<td>
<?php $formcompany->selectTypeContact($object, '', 'type','external'); ?>