Fix: delete deprecated code

Fix: change select_contact for view exclude contcat in grey mode
This commit is contained in:
Regis Houssin 2011-04-26 13:49:41 +00:00
parent fdffc4758c
commit 827eed5d39
12 changed files with 33 additions and 33 deletions

View File

@ -571,7 +571,7 @@ if ($action == 'create')
if (GETPOST("contactid") > 0 || GETPOST("socid") > 0) if (GETPOST("contactid") > 0 || GETPOST("socid") > 0)
{ {
print '<tr><td nowrap>'.$langs->trans("ActionOnContact").'</td><td>'; print '<tr><td nowrap>'.$langs->trans("ActionOnContact").'</td><td>';
$html->select_contacts(GETPOST("socid"),GETPOST('contactid'),'contactid',1,1); $html->select_contacts(GETPOST("socid"),GETPOST('contactid'),'contactid',1);
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -284,8 +284,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
//$contactAlreadySelected = $propal->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -281,8 +281,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le selectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -1164,6 +1164,9 @@ if ($action == 'create' && $user->rights->commande->creer)
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0)); $remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);
} }
} }
else else
@ -1207,7 +1210,7 @@ if ($action == 'create' && $user->rights->commande->creer)
* Contact de la commande * Contact de la commande
*/ */
print "<tr><td>".$langs->trans("DefaultContact").'</td><td>'; print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
$html->select_contacts($soc->id,$setcontact,'contactidp',1); $html->select_contacts($soc->id,$setcontact,'contactidp',1,$srccontactslist);
print '</td></tr>'; print '</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers

View File

@ -276,8 +276,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td>'; print '<td>';
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionne car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -279,8 +279,7 @@ if ($id > 0)
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
//$contactAlreadySelected = $contrat->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -261,12 +261,13 @@ class CommonObject
} }
/** /**
* \brief Get array of all contacts for an object * Get array of all contacts for an object
* \param statut Status of lines to get (-1=all) * @param statut Status of lines to get (-1=all)
* \param source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* \return array Array of id of contacts * @param list 0:all, 1:just id
* @return array Array of contacts
*/ */
function liste_contact($statut=-1,$source='external') function liste_contact($statut=-1,$source='external',$list=0)
{ {
global $langs; global $langs;
@ -300,12 +301,21 @@ class CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code; if (! $list)
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); {
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom, 'firstname'=>$obj->firstname, $transkey="TypeContact_".$obj->element."_".$obj->source."_".$obj->code;
'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut); $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,'nom'=>$obj->nom, 'firstname'=>$obj->firstname,
'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut);
}
else
{
$tab[$i]=$obj->id;
}
$i++; $i++;
} }
return $tab; return $tab;
} }
else else

View File

@ -680,18 +680,11 @@ class Form
{ {
global $conf,$langs; global $conf,$langs;
// Permettre l'exclusion de contacts
if (is_array($exclude))
{
$excludeContacts = implode("','",$exclude);
}
// On recherche les societes // On recherche les societes
$sql = "SELECT s.rowid, s.name, s.firstname, s.poste FROM"; $sql = "SELECT s.rowid, s.name, s.firstname, s.poste FROM";
$sql.= " ".MAIN_DB_PREFIX ."socpeople as s"; $sql.= " ".MAIN_DB_PREFIX ."socpeople as s";
$sql.= " WHERE entity = ".$conf->entity; $sql.= " WHERE entity = ".$conf->entity;
if ($socid) $sql.= " AND fk_soc=".$socid; if ($socid) $sql.= " AND fk_soc=".$socid;
if (is_array($exclude) && $excludeContacts) $sql.= " AND s.rowid NOT IN ('".$excludeContacts."')";
$sql.= " ORDER BY s.name ASC"; $sql.= " ORDER BY s.name ASC";
dol_syslog("Form::select_contacts sql=".$sql); dol_syslog("Form::select_contacts sql=".$sql);
@ -721,6 +714,7 @@ class Form
if ($htmlname != 'none') if ($htmlname != 'none')
{ {
$disabled=0; $disabled=0;
if (is_array($exclude) && sizeof($exclude) && in_array($obj->rowid,$exclude)) $disabled=1;
if (is_array($limitto) && sizeof($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1; if (is_array($limitto) && sizeof($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1;
if ($selected && $selected == $obj->rowid) if ($selected && $selected == $obj->rowid)
{ {

View File

@ -266,8 +266,7 @@ if ($id > 0)
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
//$contactAlreadySelected = $fichinter->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -273,8 +273,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
// $contactAlreadySelected = $commande->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -266,8 +266,7 @@ if ($id > 0)
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
//$contactAlreadySelected = $facture->getListContactId('external'); // On ne doit pas desactiver un contact deja selectionner car on doit pouvoir le seclectionner une deuxieme fois pour un autre type $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';

View File

@ -296,7 +296,7 @@ if ($id > 0 || ! empty($ref))
print '</td>'; print '</td>';
print '<td colspan="1">'; print '<td colspan="1">';
$nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0); $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid');
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print '</td>'; print '</td>';
print '<td>'; print '<td>';