* Copyright (C) 2024 Frédéric France * Copyright (C) 2025 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * @var Conf $conf * @var Form $form * @var Translate $langs * @var User $user * * @var string $action */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit(1); } print ''; // Sale representative print ''; print ''; if ($action != 'editsalesrepresentatives' && $user->hasRight('societe', 'creer')) { print ''; } print '
'; print $langs->trans('SalesRepresentatives'); print ''; print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; print '
'; print ''; if ($action == 'editsalesrepresentatives') { print '
'; print ''; print ''; print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 'default', 0, 0, '', 0, '', '', 0, 1); $arrayselected = GETPOST('commercial', 'array'); if (empty($arrayselected)) { $arrayselected = $object->getSalesRepresentatives($user, 1); } print $form->multiselectarray('commercial', $userlist, $arrayselected, 0, 0, '', 0, "90%"); print ''; print '
'; } else { $listsalesrepresentatives = $object->getSalesRepresentatives($user); $nbofsalesrepresentative = is_array($listsalesrepresentatives) ? count($listsalesrepresentatives) : 0; if ($nbofsalesrepresentative > 0) { $userstatic = new User($db); foreach ($listsalesrepresentatives as $val) { $userstatic->id = $val['id']; $userstatic->login = $val['login']; $userstatic->lastname = $val['lastname']; $userstatic->firstname = $val['firstname']; $userstatic->status = $val['statut']; $userstatic->photo = $val['photo']; $userstatic->email = $val['email']; $userstatic->office_phone = $val['office_phone']; $userstatic->user_mobile = $val['user_mobile']; $userstatic->job = $val['job']; $userstatic->entity = $val['entity']; $userstatic->gender = $val['gender']; print $userstatic->getNomUrl(-1, '', 0, 0, ($nbofsalesrepresentative > 1 ? 16 : (empty($conf->dol_optimize_smallscreen) ? 24 : 20))); print ' '; } } else { print ''.$langs->trans("NoSalesRepresentativeAffected").''; } print ''; }