New: can force login value when creating a user from a member.
This commit is contained in:
parent
e0a2b51866
commit
6e15ff8cf3
@ -11,6 +11,7 @@ For users:
|
|||||||
- New: Add graph report on number of entities in product statistics page.
|
- New: Add graph report on number of entities in product statistics page.
|
||||||
- New: Can delete a supplier order whatever is its status.
|
- New: Can delete a supplier order whatever is its status.
|
||||||
- New: No limit on free text on PDF generated documents.
|
- New: No limit on free text on PDF generated documents.
|
||||||
|
- New: can force login value when creating a user from a member.
|
||||||
- Fix: Failed to go on the future view of bank transaction if there is no
|
- Fix: Failed to go on the future view of bank transaction if there is no
|
||||||
future bank transaction already wrote.
|
future bank transaction already wrote.
|
||||||
- Fix: Bad ref in supplier list.
|
- Fix: Bad ref in supplier list.
|
||||||
|
|||||||
@ -67,31 +67,29 @@ $typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"];
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Creation utilisateur depuis adherent
|
// Create user from a memeber
|
||||||
if ($user->rights->user->user->creer)
|
if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $user->rights->user->user->creer)
|
||||||
{
|
{
|
||||||
if ($_GET["action"] == 'create_user')
|
// Recuperation contact actuel
|
||||||
|
$adh = new Adherent($db);
|
||||||
|
$result = $adh->fetch($_GET["rowid"]);
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Recuperation contact actuel
|
// Creation user
|
||||||
$adh = new Adherent($db);
|
$nuser = new User($db);
|
||||||
$result = $adh->fetch($_GET["rowid"]);
|
$result=$nuser->create_from_member($adh,$_POST["login"]);
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
// Creation user
|
$langs->load("errors");
|
||||||
$nuser = new User($db);
|
$msg=$langs->trans($nuser->error);
|
||||||
$result=$nuser->create_from_member($adh);
|
|
||||||
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$msg=$nuser->error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$msg=$adh->error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$msg=$adh->error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
|
if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
|
||||||
@ -689,7 +687,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
print_titre($langs->trans("NewMember"));
|
print_titre($langs->trans("NewMember"));
|
||||||
|
|
||||||
print '<form name="add" action="fiche.php" method="post" enctype="multipart/form-data">';
|
print '<form name="add" action="fiche.php" method="post" enctype="multipart/form-data">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@ -818,15 +816,28 @@ if ($rowid && $action != 'edit')
|
|||||||
|
|
||||||
if ($msg) print '<div class="error">'.$msg.'</div>';
|
if ($msg) print '<div class="error">'.$msg.'</div>';
|
||||||
|
|
||||||
|
// Confirm create user
|
||||||
|
if ($_GET["action"] == 'create_user')
|
||||||
|
{
|
||||||
|
$login=$adh->login;
|
||||||
|
if (empty($login)) $login=strtolower(substr($adh->prenom, 0, 4)) . strtolower(substr($adh->nom, 0, 4));
|
||||||
|
|
||||||
// Confirmation de la suppression de l'adherent
|
// Create a form array
|
||||||
|
$formquestion=array(
|
||||||
|
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login));
|
||||||
|
|
||||||
|
$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion);
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm remove member
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete");
|
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation de la validation
|
// Confirm validate memeber
|
||||||
if ($action == 'valid')
|
if ($action == 'valid')
|
||||||
{
|
{
|
||||||
// Cree un tableau formulaire
|
// Cree un tableau formulaire
|
||||||
@ -837,14 +848,14 @@ if ($rowid && $action != 'edit')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation de l'envoi fiche par mail
|
// Confirm send card by mail
|
||||||
if ($action == 'sendinfo')
|
if ($action == 'sendinfo')
|
||||||
{
|
{
|
||||||
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo");
|
$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo");
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation de la Resiliation
|
// Confirm resiliate
|
||||||
if ($action == 'resign')
|
if ($action == 'resign')
|
||||||
{
|
{
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
@ -861,7 +872,7 @@ if ($rowid && $action != 'edit')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de l'ajout dans spip
|
* Confirm add in spip
|
||||||
*/
|
*/
|
||||||
if ($action == 'add_spip')
|
if ($action == 'add_spip')
|
||||||
{
|
{
|
||||||
@ -870,7 +881,7 @@ if ($rowid && $action != 'edit')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression dans spip
|
* Confirm removed from spip
|
||||||
*/
|
*/
|
||||||
if ($action == 'del_spip')
|
if ($action == 'del_spip')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -483,7 +483,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
|
|||||||
{
|
{
|
||||||
$login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4));
|
$login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4));
|
||||||
|
|
||||||
// Cr<EFBFBD>e un tableau formulaire
|
// Create a form array
|
||||||
$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));
|
||||||
|
|
||||||
|
|||||||
@ -797,7 +797,6 @@ class User extends CommonObject
|
|||||||
if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4));
|
if (empty($login)) $login=strtolower(substr($contact->prenom, 0, 4)) . strtolower(substr($contact->nom, 0, 4));
|
||||||
$this->login = $login;
|
$this->login = $login;
|
||||||
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Cree et positionne $this->id
|
// Cree et positionne $this->id
|
||||||
@ -839,21 +838,22 @@ class User extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Cree en base un utilisateur depuis l'objet adherent
|
* \brief Cree en base un utilisateur depuis l'objet adherent
|
||||||
* \param member Objet adherent source
|
* \param member Objet adherent source
|
||||||
|
* \param login Login to force
|
||||||
* \return int Si erreur <0, si ok renvoie id compte cree
|
* \return int Si erreur <0, si ok renvoie id compte cree
|
||||||
*/
|
*/
|
||||||
function create_from_member($member)
|
function create_from_member($member,$login='')
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
// Positionne parametres
|
// Positionne parametres
|
||||||
|
$this->admin = 0;
|
||||||
$this->nom = $member->nom;
|
$this->nom = $member->nom;
|
||||||
$this->prenom = $member->prenom;
|
$this->prenom = $member->prenom;
|
||||||
|
|
||||||
$this->login = $member->login;
|
|
||||||
$this->pass = $member->pass;
|
|
||||||
$this->admin = 0;
|
|
||||||
|
|
||||||
$this->email = $member->email;
|
$this->email = $member->email;
|
||||||
|
$this->pass = $member->pass;
|
||||||
|
|
||||||
|
if (empty($login)) $login=strtolower(substr($member->prenom, 0, 4)) . strtolower(substr($member->nom, 0, 4));
|
||||||
|
$this->login = $login;
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user