Mise a jour user met aussi a jour adherent si lien entre les deux
This commit is contained in:
parent
b0cfb2cb61
commit
d587a2e20e
@ -451,7 +451,7 @@ class Adherent
|
|||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
dolibarr_syslog("Adherent::update user=".$user->id." notrigger=".$notrigger);
|
dolibarr_syslog("Adherent::update user->id=".$user->id.", notrigger=".$notrigger);
|
||||||
|
|
||||||
// Verification parametres
|
// Verification parametres
|
||||||
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email))
|
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! ValidEMail($this->email))
|
||||||
@ -488,7 +488,7 @@ class Adherent
|
|||||||
|
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dolibarr_syslog("Adherent::update sql=$sql");
|
dolibarr_syslog("Adherent::update sql=".$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,8 +29,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
|
||||||
require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
|
||||||
|
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,8 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent.class.php");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class User
|
\class User
|
||||||
@ -56,7 +58,7 @@ class User
|
|||||||
var $prenom;
|
var $prenom;
|
||||||
var $note;
|
var $note;
|
||||||
var $email;
|
var $email;
|
||||||
var $office_tel;
|
var $office_phone;
|
||||||
var $office_fax;
|
var $office_fax;
|
||||||
var $user_mobile;
|
var $user_mobile;
|
||||||
var $admin;
|
var $admin;
|
||||||
@ -72,6 +74,7 @@ class User
|
|||||||
var $datec;
|
var $datec;
|
||||||
var $datem;
|
var $datem;
|
||||||
var $societe_id;
|
var $societe_id;
|
||||||
|
var $fk_member;
|
||||||
var $webcal_login;
|
var $webcal_login;
|
||||||
|
|
||||||
var $datelastlogin;
|
var $datelastlogin;
|
||||||
@ -913,6 +916,8 @@ class User
|
|||||||
dolibarr_syslog("User::update notrigger=".$notrigger." nom=".$this->nom.", prenom=".$this->prenom);
|
dolibarr_syslog("User::update notrigger=".$notrigger." nom=".$this->nom.", prenom=".$this->prenom);
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Mise a jour mot de passe
|
// Mise a jour mot de passe
|
||||||
if ($this->pass)
|
if ($this->pass)
|
||||||
{
|
{
|
||||||
@ -938,12 +943,35 @@ class User
|
|||||||
$sql .= ", note = '".addslashes($this->note)."'";
|
$sql .= ", note = '".addslashes($this->note)."'";
|
||||||
$sql .= " WHERE rowid = ".$this->id;
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dolibarr_syslog("User::update sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->affected_rows($resql))
|
$nbrowsaffected=$this->db->affected_rows($resql);
|
||||||
|
|
||||||
|
if ($nbrowsaffected)
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
if ($this->fk_member && ! $notrigger)
|
||||||
|
{
|
||||||
|
// This user is linked with a member, so we also update members informations
|
||||||
|
// if this is an update (notrigger = 0).
|
||||||
|
$adh=new Adherent($this->db);
|
||||||
|
$result=$adh->fetch($this->fk_member);
|
||||||
|
|
||||||
|
// \TODO Mettre parametres
|
||||||
|
$adh->phone=$this->office_phone;
|
||||||
|
$adh->phone_perso=$this->office_fax;
|
||||||
|
$adh->phone_mobile=$this->user_mobile;
|
||||||
|
|
||||||
|
$result=$adh->update($user,0);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->error=$adh->error;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
|
||||||
@ -952,14 +980,24 @@ class User
|
|||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nbrowsaffected;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->db->rollback();
|
||||||
|
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1494,7 +1532,7 @@ class User
|
|||||||
$this->fullname=trim($this->prenom.' '.$this->nom);
|
$this->fullname=trim($this->prenom.' '.$this->nom);
|
||||||
$this->note='This is a note';
|
$this->note='This is a note';
|
||||||
$this->email='email@specimen.com';
|
$this->email='email@specimen.com';
|
||||||
$this->office_tel='0999999999';
|
$this->office_phone='0999999999';
|
||||||
$this->office_fax='0999999998';
|
$this->office_fax='0999999998';
|
||||||
$this->user_mobile='0999999997';
|
$this->user_mobile='0999999997';
|
||||||
$this->admin=0;
|
$this->admin=0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user