diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 7d9059fc9c1..d65a744398f 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -190,6 +190,13 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } + // Set sales representatives + if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer) + { + $object->fetch($id); + $result = $object->setSalesRep(GETPOST('commercial', 'array')); + } + if ($action == 'update_extras') { $object->fetch($id); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index c22aab4cfd1..354b29eabed 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -839,6 +839,13 @@ if (empty($reshook)) $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } + // Set sales representatives + if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer) + { + $object->fetch($socid); + $result = $object->setSalesRep(GETPOST('commercial', 'array')); + } + $id = $socid; $object->fetch($socid); diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 8ee338fba44..5b9078e6b76 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -23,30 +23,48 @@ if (empty($conf) || !is_object($conf)) } // Sale representative -print '
| '; print $langs->trans('SalesRepresentatives'); print ' | '; -print ''; +if ($action != 'editsalesrepresentatives' && $user->rights->societe->creer) { + print ' | '; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + print ' | '; +} +print '