dolibarr  13.0.2
linesalesrepresentative.tpl.php
1 <?php
2 /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 // Protection to avoid direct call of template
19 if (empty($conf) || !is_object($conf))
20 {
21  print "Error, template page can't be called as URL";
22  exit;
23 }
24 
25 // Sale representative
26 print '<tr><td>';
27 print '<table class="nobordernopadding" width="100%"><tr><td>';
28 print $langs->trans('SalesRepresentatives');
29 print '</td>';
30 if ($action != 'editsalesrepresentatives' && $user->rights->societe->creer) {
31  print '<td class="right">';
32  print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editsalesrepresentatives&amp;socid='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
33  print '</td>';
34 }
35 print '</tr></table>';
36 print '</td><td colspan="3">';
37 
38 if ($action == 'editsalesrepresentatives') {
39  print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
40  print '<input type="hidden" name="action" value="set_salesrepresentatives" />';
41  print '<input type="hidden" name="token" value="'.newToken().'" />';
42  print '<input type="hidden" name="socid" value="'.$object->id.'" />';
43  $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1);
44  $arrayselected = GETPOST('commercial', 'array');
45  if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1);
46  print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%");
47  print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'" />';
48  print '</form>';
49 } else {
50  $listsalesrepresentatives = $object->getSalesRepresentatives($user);
51  $nbofsalesrepresentative = count($listsalesrepresentatives);
52  if ($nbofsalesrepresentative > 0 && is_array($listsalesrepresentatives)) {
53  $userstatic = new User($db);
54  foreach ($listsalesrepresentatives as $val) {
55  $userstatic->id = $val['id'];
56  $userstatic->login = $val['login'];
57  $userstatic->lastname = $val['lastname'];
58  $userstatic->firstname = $val['firstname'];
59  $userstatic->statut = $val['statut'];
60  $userstatic->photo = $val['photo'];
61  $userstatic->email = $val['email'];
62  $userstatic->phone = $val['phone'];
63  $userstatic->job = $val['job'];
64  $userstatic->entity = $val['entity'];
65  print $userstatic->getNomUrl(-1);
66  print ' ';
67  }
68  } else print '<span class="opacitymedium">'.$langs->trans("NoSalesRepresentativeAffected").'</span>';
69  print '</td></tr>';
70 }
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 editer/modifier fiche.
Class to manage Dolibarr users.
Definition: user.class.php:44
print
Draft customers invoices.
Definition: index.php:89