dolibarr 21.0.0-beta
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 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
26// Protection to avoid direct call of template
27if (empty($conf) || !is_object($conf)) {
28 print "Error, template page can't be called as URL";
29 exit(1);
30}
31
32print '<!-- linesalesrepresentative.tpl.php -->';
33
34// Sale representative
35print '<tr><td>';
36print '<table class="nobordernopadding centpercent"><tr><td>';
37print $langs->trans('SalesRepresentatives');
38print '</td>';
39if ($action != 'editsalesrepresentatives' && $user->hasRight('societe', 'creer')) {
40 print '<td class="right">';
41 print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editsalesrepresentatives&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
42 print '</td>';
43}
44print '</tr></table>';
45print '</td><td>';
46
47if ($action == 'editsalesrepresentatives') {
48 print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
49 print '<input type="hidden" name="action" value="set_salesrepresentatives" />';
50 print '<input type="hidden" name="token" value="'.newToken().'" />';
51 print '<input type="hidden" name="socid" value="'.$object->id.'" />';
52 $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 'default', 0, 0, '', 0, '', '', 0, 1);
53
54 $arrayselected = GETPOST('commercial', 'array');
55 if (empty($arrayselected)) {
56 $arrayselected = $object->getSalesRepresentatives($user, 1);
57 }
58 print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%");
59 print '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'" />';
60 print '</form>';
61} else {
62 $listsalesrepresentatives = $object->getSalesRepresentatives($user);
63
64 $nbofsalesrepresentative = count($listsalesrepresentatives);
65 if ($nbofsalesrepresentative > 0 && is_array($listsalesrepresentatives)) {
66 $userstatic = new User($db);
67 foreach ($listsalesrepresentatives as $val) {
68 $userstatic->id = $val['id'];
69 $userstatic->login = $val['login'];
70 $userstatic->lastname = $val['lastname'];
71 $userstatic->firstname = $val['firstname'];
72 $userstatic->status = $val['statut'];
73 $userstatic->photo = $val['photo'];
74 $userstatic->email = $val['email'];
75 $userstatic->office_phone = $val['office_phone'];
76 $userstatic->user_mobile = $val['user_mobile'];
77 $userstatic->job = $val['job'];
78 $userstatic->entity = $val['entity'];
79 $userstatic->gender = $val['gender'];
80 print $userstatic->getNomUrl(-1, '', 0, 0, ($nbofsalesrepresentative > 1 ? 16 : (empty($conf->dol_optimize_smallscreen) ? 24 : 20)));
81 print ' ';
82 }
83 } else {
84 print '<span class="opacitymedium">'.$langs->trans("NoSalesRepresentativeAffected").'</span>';
85 }
86 print '</td></tr>';
87}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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