patch #7445 : display the subsidiaries of a company
This commit is contained in:
parent
79529f3e84
commit
82fc052de0
@ -44,6 +44,9 @@ Company/Fundation=Company/Foundation
|
||||
Individual=Private individual
|
||||
ToCreateContactWithSameName=Will create automatically a physical contact with same informations
|
||||
ParentCompany=Parent company
|
||||
Subsidiary=Subsidiary
|
||||
Subsidiaries=Subsidiaries
|
||||
NoSubsidiary=No subsidiary
|
||||
ReportByCustomers=Report by customers
|
||||
ReportByQuarter=Report by rate
|
||||
CivilityCode=Civility code
|
||||
|
||||
@ -48,6 +48,9 @@ ToCreateContactWithSameName=Créera automatiquement un contact physique avec inf
|
||||
ReportByCustomers=Rapport par client
|
||||
ReportByQuarter=Rapport par taux
|
||||
ParentCompany=Maison mère
|
||||
Subsidiary=Filiale
|
||||
Subsidiaries=Filiales
|
||||
NoSubsidiary=Aucune filiale
|
||||
CivilityCode=Code civilité
|
||||
RegisteredOffice=Siège sociale
|
||||
Name=Nom
|
||||
|
||||
@ -860,4 +860,78 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='')
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show html area for list of subsidiaries
|
||||
* @param conf Object conf
|
||||
* @param lang Object lang
|
||||
* @param db Database handler
|
||||
* @param objsoc Third party object
|
||||
*/
|
||||
function show_subsidiaries($conf,$langs,$db,$object)
|
||||
{
|
||||
global $user;
|
||||
global $bc;
|
||||
|
||||
$i=-1;
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.address, s.cp as zip, s.ville as town, s.code_client, s.canvas";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.parent = ".$object->id;
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY s.nom";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$socstatic = new Societe($db);
|
||||
|
||||
print_titre($langs->trans("Subsidiaries"));
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Company").'</td>';
|
||||
print '<td>'.$langs->trans("Address").'</td><td>'.$langs->trans("Zip").'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td><td>'.$langs->trans("CustomerCode").'</td>';
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
$i=0;
|
||||
$var=true;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = !$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
print '<td>';
|
||||
$socstatic->id = $obj->rowid;
|
||||
$socstatic->name = $obj->name;
|
||||
$socstatic->canvas = $obj->canvas;
|
||||
print $socstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$obj->address.'</td>';
|
||||
print '<td>'.$obj->zip.'</td>';
|
||||
print '<td>'.$obj->town.'</td>';
|
||||
print '<td>'.$obj->code_client.'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$obj->rowid.'&action=edit">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "\n</table>\n";
|
||||
}
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -477,6 +477,9 @@ if (! empty($canvas))
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Subsidiaries list
|
||||
$result=show_subsidiaries($conf,$langs,$db,$soccanvas->control->object);
|
||||
|
||||
// Contacts list
|
||||
$result=show_contacts($conf,$langs,$db,$soccanvas->control->object);
|
||||
@ -1754,6 +1757,9 @@ else
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Subsidiaries list
|
||||
$result=show_subsidiaries($conf,$langs,$db,$soc);
|
||||
|
||||
// Contacts list
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user