forked from Wavyzz/dolibarr
New: Sales representative column on Propal List
This commit is contained in:
@@ -159,6 +159,7 @@ $arrayfields=array(
|
||||
'p.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0),
|
||||
'p.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
||||
'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10),
|
||||
'sale_representative'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>1),
|
||||
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
@@ -667,6 +668,10 @@ if ($resql)
|
||||
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
@@ -721,6 +726,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'],$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@@ -943,6 +949,51 @@ if ($resql)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['sale_representative']['checked']))
|
||||
{
|
||||
// Sales representatives
|
||||
print '<td>';
|
||||
if ($obj->socid > 0)
|
||||
{
|
||||
$listsalesrepresentatives=$companystatic->getSalesRepresentatives($user);
|
||||
if ($listsalesrepresentatives < 0) dol_print_error($db);
|
||||
$nbofsalesrepresentative=count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$companystatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
else if ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
$userstatic=new User($db);
|
||||
$j=0;
|
||||
foreach($listsalesrepresentatives as $val)
|
||||
{
|
||||
$userstatic->id=$val['id'];
|
||||
$userstatic->lastname=$val['lastname'];
|
||||
$userstatic->firstname=$val['firstname'];
|
||||
$userstatic->email=$val['email'];
|
||||
$userstatic->statut=$val['statut'];
|
||||
$userstatic->entity=$val['entity'];
|
||||
$userstatic->photo=$val['photo'];
|
||||
|
||||
//print '<div class="float">':
|
||||
print $userstatic->getNomUrl(-2);
|
||||
$j++;
|
||||
if ($j < $nbofsalesrepresentative) print ' ';
|
||||
//print '</div>';
|
||||
}
|
||||
}
|
||||
//else print $langs->trans("NoSalesRepresentativeAffected");
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
||||
Reference in New Issue
Block a user