31if (empty($conf) || !is_object($conf)) {
32 print
"Error, template page can't be called as URL";
36print
'<!-- linesalesrepresentative.tpl.php -->';
40print
'<table class="nobordernopadding centpercent"><tr><td>';
41print $langs->trans(
'SalesRepresentatives');
43if ($action !=
'editsalesrepresentatives' && $user->hasRight(
'societe',
'creer')) {
44 print
'<td class="right">';
45 print
'<a class="editfielda reposition" href="' .
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'action' =>
'editsalesrepresentatives',
'socid' =>
$object->id],
true) .
'">'.img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a>';
51if ($action ==
'editsalesrepresentatives') {
52 print
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'">';
53 print
'<input type="hidden" name="action" value="set_salesrepresentatives" />';
54 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
55 print
'<input type="hidden" name="socid" value="'.$object->id.
'" />';
56 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'default', 0, 0,
'', 0,
'',
'', 0, 1);
58 $arrayselected =
GETPOST(
'commercial',
'array');
59 if (empty($arrayselected)) {
60 $arrayselected =
$object->getSalesRepresentatives($user, 1);
62 print $form->multiselectarray(
'commercial', $userlist, $arrayselected, 0, 0,
'', 0,
"90%");
63 print
'<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans(
"Modify").
'" />';
66 $listsalesrepresentatives =
$object->getSalesRepresentatives($user);
68 $nbofsalesrepresentative = is_array($listsalesrepresentatives) ? count($listsalesrepresentatives) : 0;
69 if ($nbofsalesrepresentative > 0) {
70 $userstatic =
new User($db);
71 foreach ($listsalesrepresentatives as $val) {
72 $userstatic->id = $val[
'id'];
73 $userstatic->login = $val[
'login'];
74 $userstatic->lastname = $val[
'lastname'];
75 $userstatic->firstname = $val[
'firstname'];
76 $userstatic->status = $val[
'statut'];
77 $userstatic->photo = $val[
'photo'];
78 $userstatic->email = $val[
'email'];
79 $userstatic->office_phone = $val[
'office_phone'];
80 $userstatic->user_mobile = $val[
'user_mobile'];
81 $userstatic->job = $val[
'job'];
82 $userstatic->entity = $val[
'entity'];
83 $userstatic->gender = $val[
'gender'];
84 print $userstatic->getNomUrl(-1,
'', 0, 0, ($nbofsalesrepresentative > 1 ? 16 : (empty($conf->dol_optimize_smallscreen) ? 24 : 20)));
if(! $sortfield) if(! $sortorder) $object
Class to manage Dolibarr users.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.