Fix when we assign sale representatives to a thirdparty, list must be
the default list with same condition than into getSalesRepresentatives()
This commit is contained in:
parent
19d4726e4c
commit
60578402f4
2 changed files with 5 additions and 4 deletions
|
|
@ -2000,7 +2000,7 @@ class Form
|
|||
* @param int $disabled If select list must be disabled
|
||||
* @param int[]|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
|
||||
* @param array|string $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
|
||||
* @param string $force_entity '0' or list of Ids of environment to force, separated by a coma
|
||||
* @param string $force_entity '0' or list of Ids of environment to force, separated by a coma, or 'default' = do no extend to all entities allowed to superadmin.
|
||||
* @param int $maxlength Maximum length of string into list (0=no limit)
|
||||
* @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
|
||||
* @param string $morefilter Add more filters into sql request (Example: 'employee = 1'). This value must not come from user input.
|
||||
|
|
@ -2055,7 +2055,7 @@ class Form
|
|||
|
||||
// Do we want to show the label of entity into the combo list ?
|
||||
$showlabelofentity = isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && !empty($user->admin) && empty($user->entity);
|
||||
$userissuperadminonentityone = isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && empty($user->entity);
|
||||
$userissuperadminentityone = isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && empty($user->entity);
|
||||
|
||||
// Forge request to select users
|
||||
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut as status, u.login, u.admin, u.entity, u.photo";
|
||||
|
|
@ -2067,7 +2067,7 @@ class Form
|
|||
$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
|
||||
}
|
||||
// Condition here should be the same than into societe->getSalesRepresentatives().
|
||||
if ($userissuperadminonentityone) {
|
||||
if ($userissuperadminentityone && $force_entity != 'default') {
|
||||
if (!empty($force_entity)) {
|
||||
$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ if ($action == 'editsalesrepresentatives') {
|
|||
print '<input type="hidden" name="action" value="set_salesrepresentatives" />';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="socid" value="'.$object->id.'" />';
|
||||
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1);
|
||||
$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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue