diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php
index 8fd58c52d95..6cdb27466d7 100644
--- a/htdocs/comm/propal/contact.php
+++ b/htdocs/comm/propal/contact.php
@@ -335,9 +335,8 @@ if ($id > 0 || ! empty($ref))
print '
';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php
index 472fbd74523..a959db0b159 100644
--- a/htdocs/commande/contact.php
+++ b/htdocs/commande/contact.php
@@ -332,9 +332,8 @@ if ($id > 0 || ! empty($ref))
print ' | ';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 7210e60e773..3fc107c5642 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -327,9 +327,8 @@ if ($id > 0 || ! empty($ref))
print ' | ';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php
index f376e900db4..21406d8c727 100644
--- a/htdocs/contrat/contact.php
+++ b/htdocs/contrat/contact.php
@@ -279,7 +279,7 @@ if ($id > 0)
print ' | ';
//$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, $selected = '', 'contactid', 0, $contactAlreadySelected);
+ $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print ' | ';
print '';
@@ -331,9 +331,8 @@ if ($id > 0)
print ' | ';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php
index 9fd0add0288..d1ac731ab95 100644
--- a/htdocs/fichinter/contact.php
+++ b/htdocs/fichinter/contact.php
@@ -266,7 +266,7 @@ if ($id > 0)
print ' | ';
//$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, $selected = '', 'contactid', 0, $contactAlreadySelected);
+ $nbofcontacts=$html->select_contacts($selectedCompany, '', 'contactid', 0, $contactAlreadySelected);
if ($nbofcontacts == 0) print $langs->trans("NoContactDefined");
print ' | ';
print '';
@@ -317,9 +317,8 @@ if ($id > 0)
print ' | ';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php
index 4890d4b7b3a..16f1f540fab 100644
--- a/htdocs/fourn/commande/contact.php
+++ b/htdocs/fourn/commande/contact.php
@@ -200,6 +200,8 @@ if ($id > 0 || ! empty($ref))
print '';
+ // TODO All contact.php pages use this huge part of code. Use a function instead.
+
/*
* Lignes de contacts
*/
@@ -207,12 +209,10 @@ if ($id > 0 || ! empty($ref))
/*
* Ajouter une ligne de contact
- * Non affich� en mode modification de ligne
+ * Non affiche en mode modification de ligne
*/
if ($_GET["action"] != 'editline' && $user->rights->fournisseur->facture->creer)
{
- // TODO All contacts page should use same code
-
print ' | ';
print '| '.$langs->trans("Source").' | ';
print ''.$langs->trans("Company").' | ';
@@ -324,9 +324,8 @@ if ($id > 0 || ! empty($ref))
print '';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php
index 050f2058d8a..0ecf8d05741 100644
--- a/htdocs/fourn/facture/contact.php
+++ b/htdocs/fourn/facture/contact.php
@@ -316,9 +316,8 @@ if ($id > 0)
print ' | ';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index 07787090655..236edf036ed 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -341,9 +341,8 @@ if ($id > 0 || ! empty($ref))
print ' | ';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index eda1ee9fd80..354be931de5 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -344,9 +344,8 @@ if ($id > 0 || ! empty($ref))
print ' | ';
if ($tab[$i]['socid'] > 0)
{
- print '';
- print img_object($langs->trans("ShowCompany"),"company").' '.$companystatic->get_nom($tab[$i]['socid']);
- print '';
+ $companystatic->fetch($tab[$i]['socid']);
+ print $companystatic->getNomUrl(1);
}
if ($tab[$i]['socid'] < 0)
{
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 94fcb35f002..f156894ef80 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -1331,33 +1331,6 @@ class Societe extends CommonObject
}
- /**
- * \brief Renvoie le nom d'une societe a partir d'un id
- * \param id id company we search for name
- * \return string Third party name
- */
- function get_nom($id)
- {
-
- $sql = "SELECT nom FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$id."';";
-
- $result = $this->db->query($sql);
-
- if ($result)
- {
- if ($this->db->num_rows())
- {
- $obj = $this->db->fetch_object($result);
- return $obj->nom;
- }
- $this->db->free();
- }
- else {
- dol_print_error($this->db);
- }
-
- }
-
/**
* \brief Return full address of a third party (TODO in format of its country)
* \return string Full address string
|