NEW When creating a user from a member linked to a thirdparty, you can
decide if it is an internal or external (default) user.
This commit is contained in:
parent
02fcee5d94
commit
a0b17635fd
@ -181,7 +181,12 @@ if (empty($reshook)) {
|
|||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
// Creation user
|
// Creation user
|
||||||
$nuser = new User($db);
|
$nuser = new User($db);
|
||||||
$result = $nuser->create_from_member($object, GETPOST('login', 'alphanohtml'));
|
$tmpuser = dol_clone($object);
|
||||||
|
if (GETPOST('internalorexternal', 'aZ09') == 'internal') {
|
||||||
|
$tmpuser->fk_soc = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $nuser->create_from_member($tmpuser, GETPOST('login', 'alphanohtml'));
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@ -1279,11 +1284,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)
|
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)
|
||||||
);
|
);
|
||||||
$text = $langs->trans("ConfirmCreateLogin").'<br>';
|
if (!empty($conf->societe->enabled) && $object->socid > 0) {
|
||||||
if (!empty($conf->societe->enabled)) {
|
$object->fetch_thirdparty();
|
||||||
if ($object->socid > 0) $text .= $langs->trans("UserWillBeExternalUser");
|
$formquestion[] = array('label' => $langs->trans("UserWillBe"), 'type' => 'radio', 'name' => 'internalorexternal', 'default'=>'external', 'values' => array('external'=>$langs->trans("External").' - '.$langs->trans("LinkedToDolibarrThirdParty").' '.$object->thirdparty->getNomUrl(1, '', 0, 1), 'internal'=>$langs->trans("Internal")));
|
||||||
else $text .= $langs->trans("UserWillBeInternalUser");
|
|
||||||
}
|
}
|
||||||
|
$text = '';
|
||||||
|
if (!empty($conf->societe->enabled) && $object->socid <= 0) {
|
||||||
|
$text .= $langs->trans("UserWillBeInternalUser").'<br>';
|
||||||
|
}
|
||||||
|
$text .= $langs->trans("ConfirmCreateLogin");
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
|
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4213,10 +4213,11 @@ class Form
|
|||||||
$more .= '<div class="tagtr">';
|
$more .= '<div class="tagtr">';
|
||||||
if ($i == 0) $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
|
if ($i == 0) $more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
|
||||||
else $more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>';
|
else $more .= '<div clas="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>';
|
||||||
$more .= '<div class="tagtd"><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr;
|
$more .= '<div class="tagtd'.($i == 0 ? ' tdtop' : '').'"><input type="radio" class="flat'.$morecss.'" id="'.$input['name'].$selkey.'" name="'.$input['name'].'" value="'.$selkey.'"'.$moreattr;
|
||||||
if ($input['disabled']) $more .= ' disabled';
|
if ($input['disabled']) $more .= ' disabled';
|
||||||
|
if (isset($input['default']) && $input['default'] === $selkey) $more .= ' checked="checked"';
|
||||||
$more .= ' /> ';
|
$more .= ' /> ';
|
||||||
$more .= $selval;
|
$more .= '<label for="'.$input['name'].$selkey.'">'.$selval.'</label>';
|
||||||
$more .= '</div></div>'."\n";
|
$more .= '</div></div>'."\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,6 +75,7 @@ CreateInternalUserDesc=This form allows you to create an internal user in your c
|
|||||||
InternalExternalDesc=An <b>internal</b> user is a user that is part of your company/organization.<br>An <b>external</b> user is a customer, vendor or other (Creating an external user for a third-party can be done from the contact record of the third-party).<br><br>In both cases, permissions defines rights on Dolibarr, also external user can have a different menu manager than internal user (See Home - Setup - Display)
|
InternalExternalDesc=An <b>internal</b> user is a user that is part of your company/organization.<br>An <b>external</b> user is a customer, vendor or other (Creating an external user for a third-party can be done from the contact record of the third-party).<br><br>In both cases, permissions defines rights on Dolibarr, also external user can have a different menu manager than internal user (See Home - Setup - Display)
|
||||||
PermissionInheritedFromAGroup=Permission granted because inherited from one of a user's group.
|
PermissionInheritedFromAGroup=Permission granted because inherited from one of a user's group.
|
||||||
Inherited=Inherited
|
Inherited=Inherited
|
||||||
|
UserWillBe=Created user will be
|
||||||
UserWillBeInternalUser=Created user will be an internal user (because not linked to a particular third party)
|
UserWillBeInternalUser=Created user will be an internal user (because not linked to a particular third party)
|
||||||
UserWillBeExternalUser=Created user will be an external user (because linked to a particular third party)
|
UserWillBeExternalUser=Created user will be an external user (because linked to a particular third party)
|
||||||
IdPhoneCaller=Id phone caller
|
IdPhoneCaller=Id phone caller
|
||||||
|
|||||||
@ -375,7 +375,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl
|
|||||||
// Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions)
|
// Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions)
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST' ||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' ||
|
||||||
((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) ||
|
((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) ||
|
||||||
in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof', 'deletepayment')))
|
in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof', 'deletepayment', 'confirm_create_user', 'confirm_create_thirdparty')))
|
||||||
{
|
{
|
||||||
if (!GETPOSTISSET('token')) {
|
if (!GETPOSTISSET('token')) {
|
||||||
if (GETPOST('uploadform', 'int')) {
|
if (GETPOST('uploadform', 'int')) {
|
||||||
|
|||||||
@ -2358,13 +2358,14 @@ class Societe extends CommonObject
|
|||||||
$code .= $this->code_fournisseur.' - ';
|
$code .= $this->code_fournisseur.' - ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1)
|
if ($code) {
|
||||||
{
|
if ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1) {
|
||||||
$name = $code.' '.$name;
|
$name = $code.' '.$name;
|
||||||
} else {
|
} else {
|
||||||
$name = $code;
|
$name = $code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')';
|
if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')';
|
||||||
|
|
||||||
|
|||||||
@ -1318,7 +1318,8 @@ class User extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Create a user into database from a member object
|
* Create a user into database from a member object.
|
||||||
|
* If $member->fk_soc is set, it will be an external user.
|
||||||
*
|
*
|
||||||
* @param Adherent $member Object member source
|
* @param Adherent $member Object member source
|
||||||
* @param string $login Login to force
|
* @param string $login Login to force
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user