dolibarr/htdocs/societe/tpl/linesalesrepresentative.tpl.php
2017-12-21 13:32:16 +01:00

51 lines
1.9 KiB
PHP

<?php
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
}
// Sale representative
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('SalesRepresentatives');
print '</td><td align="right">';
if ($user->rights->societe->creer && $user->rights->societe->client->voir)
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$object->id.'">'.img_edit('',1).'</a>';
else
print '&nbsp;';
print '</td></tr></table>';
print '</td>';
print '<td colspan="3">';
$listsalesrepresentatives=$object->getSalesRepresentatives($user);
$nbofsalesrepresentative=count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) // We print only number
{
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$object->id.'">';
print $nbofsalesrepresentative;
print '</a>';
}
else if ($nbofsalesrepresentative > 0)
{
$userstatic=new User($db);
$i=0;
foreach($listsalesrepresentatives as $val)
{
$userstatic->id=$val['id'];
$userstatic->login=$val['login'];
$userstatic->lastname=$val['lastname'];
$userstatic->firstname=$val['firstname'];
$userstatic->statut=$val['statut'];
$userstatic->photo=$val['photo'];
$userstatic->email=$val['email'];
$userstatic->entity=$val['entity'];
print $userstatic->getNomUrl(-1);
$i++;
if ($i < $nbofsalesrepresentative) print ', ';
}
}
else print '<span class="opacitymedium">'.$langs->trans("NoSalesRepresentativeAffected").'</span>';
print '</td></tr>';