dolibarr 22.0.5
linesalesrepresentative.tpl.php
1<?php
2/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
27// Protection to avoid direct call of template
28if (empty($conf) || !is_object($conf)) {
29 print "Error, template page can't be called as URL";
30 exit(1);
31}
32
33print '<!-- linesalesrepresentative.tpl.php -->';
34
35// Sale representative
36print '<tr><td>';
37print '<table class="nobordernopadding centpercent"><tr><td>';
38print $langs->trans('SalesRepresentatives');
39print '</td>';
40if ($action != 'editsalesrepresentatives' && $user->hasRight('societe', 'creer')) {
41 print '<td class="right">';
42 print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editsalesrepresentatives&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
43 print '</td>';
44}
45print '</tr></table>';
46print '</td><td>';
47
48if ($action == 'editsalesrepresentatives') {
49 print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
50 print '<input type="hidden" name="action" value="set_salesrepresentatives" />';
51 print '<input type="hidden" name="token" value="'.newToken().'" />';
52 print '<input type="hidden" name="socid" value="'.$object->id.'" />';
53 $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 'default', 0, 0, '', 0, '', '', 0, 1);
54
55 $arrayselected = GETPOST('commercial', 'array');
56 if (empty($arrayselected)) {
57 $arrayselected = $object->getSalesRepresentatives($user, 1);
58 }
59 print $form->multiselectarray('commercial', $userlist, $arrayselected, 0, 0, '', 0, "90%");
60 print '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'" />';
61 print '</form>';
62} else {
63 $listsalesrepresentatives = $object->getSalesRepresentatives($user);
64
65 $nbofsalesrepresentative = is_array($listsalesrepresentatives) ? count($listsalesrepresentatives) : 0;
66 if ($nbofsalesrepresentative > 0) {
67 $userstatic = new User($db);
68 foreach ($listsalesrepresentatives as $val) {
69 $userstatic->id = $val['id'];
70 $userstatic->login = $val['login'];
71 $userstatic->lastname = $val['lastname'];
72 $userstatic->firstname = $val['firstname'];
73 $userstatic->status = $val['statut'];
74 $userstatic->photo = $val['photo'];
75 $userstatic->email = $val['email'];
76 $userstatic->office_phone = $val['office_phone'];
77 $userstatic->user_mobile = $val['user_mobile'];
78 $userstatic->job = $val['job'];
79 $userstatic->entity = $val['entity'];
80 $userstatic->gender = $val['gender'];
81 print $userstatic->getNomUrl(-1, '', 0, 0, ($nbofsalesrepresentative > 1 ? 16 : (empty($conf->dol_optimize_smallscreen) ? 24 : 20)));
82 print ' ';
83 }
84 } else {
85 print '<span class="opacitymedium">'.$langs->trans("NoSalesRepresentativeAffected").'</span>';
86 }
87 print '</td></tr>';
88}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
Class to manage Dolibarr users.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79