Qual: Uniformise code. user class use id in first param of fetch
This commit is contained in:
parent
da5cf895d0
commit
a4f144f24d
@ -49,7 +49,7 @@ $langs->load("main"); // To load language file for default language
|
|||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
|
|
||||||
// Load user and its permissions
|
// Load user and its permissions
|
||||||
$result=$user->fetch('admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||||
if (! $result > 0) { dol_print_error('',$user->error); exit; }
|
if (! $result > 0) { dol_print_error('',$user->error); exit; }
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@ $langs->load("main"); // To load language file for default language
|
|||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
|
|
||||||
// Load user and its permissions
|
// Load user and its permissions
|
||||||
$result=$user->fetch('admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||||
if (! $result > 0) { dol_print_error('',$user->error); exit; }
|
if (! $result > 0) { dol_print_error('',$user->error); exit; }
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@ $langs->load("main"); // To load language file for default language
|
|||||||
@set_time_limit(0); // No timeout for this script
|
@set_time_limit(0); // No timeout for this script
|
||||||
|
|
||||||
// Load user and its permissions
|
// Load user and its permissions
|
||||||
$result=$user->fetch('admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
$result=$user->fetch('','admin'); // Load user for login 'admin'. Comment line to run as anonymous user.
|
||||||
if (! $result > 0) { dol_print_error('',$user->error); exit; }
|
if (! $result > 0) { dol_print_error('',$user->error); exit; }
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
|
|
||||||
|
|||||||
@ -504,8 +504,7 @@ class Adherent extends CommonObject
|
|||||||
// This member is linked with a user, so we also update users informations
|
// This member is linked with a user, so we also update users informations
|
||||||
// if this is an update.
|
// if this is an update.
|
||||||
$luser=new User($this->db);
|
$luser=new User($this->db);
|
||||||
$luser->id=$this->user_id;
|
$result=$luser->fetch($this->user_id);
|
||||||
$result=$luser->fetch();
|
|
||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -2051,22 +2050,22 @@ class Adherent extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
if ($obj->fk_user_author)
|
if ($obj->fk_user_author)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_valid)
|
if ($obj->fk_user_valid)
|
||||||
{
|
{
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
$vuser = new User($this->db);
|
||||||
$vuser->fetch();
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_mod)
|
if ($obj->fk_user_mod)
|
||||||
{
|
{
|
||||||
$muser = new User($this->db, $obj->fk_user_mod);
|
$muser = new User($this->db);
|
||||||
$muser->fetch();
|
$muser->fetch($obj->fk_user_mod);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -224,8 +224,7 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"]))
|
|||||||
if ($bookmark->fk_user)
|
if ($bookmark->fk_user)
|
||||||
{
|
{
|
||||||
$fuser=new User($db);
|
$fuser=new User($db);
|
||||||
$fuser->id=$bookmark->fk_user;
|
$fuser->fetch($bookmark->fk_user);
|
||||||
$fuser->fetch();
|
|
||||||
//$fuser->nom=$fuser->login; $fuser->prenom='';
|
//$fuser->nom=$fuser->login; $fuser->prenom='';
|
||||||
print $fuser->getNomUrl(1);
|
print $fuser->getNomUrl(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,9 +81,9 @@ switch ( $_GET['action'] )
|
|||||||
|
|
||||||
|
|
||||||
case 'valide_facture':
|
case 'valide_facture':
|
||||||
|
|
||||||
$now=dol_now('tzserver');
|
$now=dol_now('tzserver');
|
||||||
|
|
||||||
// Recuperation de la date et de l'heure
|
// Recuperation de la date et de l'heure
|
||||||
$date = dol_print_date($now,'day');
|
$date = dol_print_date($now,'day');
|
||||||
$heure = dol_print_date($now,'hour');
|
$heure = dol_print_date($now,'hour');
|
||||||
@ -131,8 +131,7 @@ switch ( $_GET['action'] )
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$user->id=$_SESSION['uid'];
|
$user->fetch($_SESSION['uid']);
|
||||||
$user->fetch();
|
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
|
|
||||||
$invoice=new Facture($db,$conf_fksoc);
|
$invoice=new Facture($db,$conf_fksoc);
|
||||||
@ -216,11 +215,11 @@ switch ( $_GET['action'] )
|
|||||||
{
|
{
|
||||||
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
|
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = $invoice->id;
|
$id = $invoice->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -231,7 +230,7 @@ switch ( $_GET['action'] )
|
|||||||
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
|
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
|
||||||
|
|
||||||
$id = $invoice->id;
|
$id = $invoice->id;
|
||||||
|
|
||||||
// Add the payment
|
// Add the payment
|
||||||
$payment=new Paiement($db);
|
$payment=new Paiement($db);
|
||||||
$payment->datepaye=$now;
|
$payment->datepaye=$now;
|
||||||
@ -240,7 +239,7 @@ switch ( $_GET['action'] )
|
|||||||
$payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->num_facture();
|
$payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->num_facture();
|
||||||
$payment->paiementid=$invoice->mode_reglement_id;
|
$payment->paiementid=$invoice->mode_reglement_id;
|
||||||
$payment->num_paiement='';
|
$payment->num_paiement='';
|
||||||
|
|
||||||
$paiement_id = $payment->create($user);
|
$paiement_id = $payment->create($user);
|
||||||
if ($paiement_id > 0)
|
if ($paiement_id > 0)
|
||||||
{
|
{
|
||||||
@ -260,13 +259,13 @@ switch ( $_GET['action'] )
|
|||||||
{
|
{
|
||||||
$bankaccountid=$conf_fkaccount_cb;
|
$bankaccountid=$conf_fkaccount_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bankaccountid > 0)
|
if ($bankaccountid > 0)
|
||||||
{
|
{
|
||||||
// Insertion dans llx_bank
|
// Insertion dans llx_bank
|
||||||
$label = "(CustomerInvoicePayment)";
|
$label = "(CustomerInvoicePayment)";
|
||||||
$acc = new Account($db, $bankaccountid);
|
$acc = new Account($db, $bankaccountid);
|
||||||
|
|
||||||
$bank_line_id = $acc->addline($payment->datepaye,
|
$bank_line_id = $acc->addline($payment->datepaye,
|
||||||
$payment->paiementid, // Payment mode id or code ("CHQ or VIR for example")
|
$payment->paiementid, // Payment mode id or code ("CHQ or VIR for example")
|
||||||
$label,
|
$label,
|
||||||
@ -276,7 +275,7 @@ switch ( $_GET['action'] )
|
|||||||
$user,
|
$user,
|
||||||
'',
|
'',
|
||||||
'');
|
'');
|
||||||
|
|
||||||
// Mise a jour fk_bank dans llx_paiement.
|
// Mise a jour fk_bank dans llx_paiement.
|
||||||
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
// On connait ainsi le paiement qui a genere l'ecriture bancaire
|
||||||
if ($bank_line_id > 0)
|
if ($bank_line_id > 0)
|
||||||
@ -308,7 +307,7 @@ switch ( $_GET['action'] )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -454,14 +454,14 @@ class ActionComm
|
|||||||
$this->id = $obj->id;
|
$this->id = $obj->id;
|
||||||
if ($obj->fk_user_author)
|
if ($obj->fk_user_author)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
if ($obj->fk_user_mod)
|
if ($obj->fk_user_mod)
|
||||||
{
|
{
|
||||||
$muser = new User($this->db, $obj->fk_user_mod);
|
$muser = new User($this->db);
|
||||||
$muser->fetch();
|
$muser->fetch($obj->fk_user_mod);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -615,10 +615,10 @@ if ($_GET["id"])
|
|||||||
}
|
}
|
||||||
$act->societe = $societe;
|
$act->societe = $societe;
|
||||||
|
|
||||||
if ($act->author->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->author->id; $res=$tmpuser->fetch(); $act->author=$tmpuser; }
|
if ($act->author->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->author->id); $act->author=$tmpuser; }
|
||||||
if ($act->usermod->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->usermod->id; $res=$tmpuser->fetch(); $act->usermod=$tmpuser; }
|
if ($act->usermod->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->usermod->id); $act->usermod=$tmpuser; }
|
||||||
if ($act->usertodo->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->usertodo->id; $res=$tmpuser->fetch(); $act->usertodo=$tmpuser; }
|
if ($act->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->usertodo->id); $act->usertodo=$tmpuser; }
|
||||||
if ($act->userdone->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->userdone->id; $res=$tmpuser->fetch(); $act->userdone=$tmpuser; }
|
if ($act->userdone->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($act->userdone->id); $act->userdone=$tmpuser; }
|
||||||
|
|
||||||
$contact = new Contact($db);
|
$contact = new Contact($db);
|
||||||
if ($act->contact->id)
|
if ($act->contact->id)
|
||||||
|
|||||||
@ -450,14 +450,14 @@ class AdresseLivraison
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
if ($obj->fk_user_creat) {
|
if ($obj->fk_user_creat) {
|
||||||
$cuser = new User($this->db, $obj->fk_user_creat);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_creat);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_modif) {
|
if ($obj->fk_user_modif) {
|
||||||
$muser = new User($this->db, $obj->fk_user_modif);
|
$muser = new User($this->db);
|
||||||
$muser->fetch();
|
$muser->fetch($obj->fk_user_modif);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
$this->ref = $obj->nom;
|
$this->ref = $obj->nom;
|
||||||
|
|||||||
@ -1744,21 +1744,21 @@ class Propal extends CommonObject
|
|||||||
$this->date_validation = $this->db->jdate($obj->datev);
|
$this->date_validation = $this->db->jdate($obj->datev);
|
||||||
$this->date_cloture = $this->db->jdate($obj->dateo);
|
$this->date_cloture = $this->db->jdate($obj->dateo);
|
||||||
|
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
|
|
||||||
if ($obj->fk_user_valid)
|
if ($obj->fk_user_valid)
|
||||||
{
|
{
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
$vuser = new User($this->db);
|
||||||
$vuser->fetch();
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_cloture)
|
if ($obj->fk_user_cloture)
|
||||||
{
|
{
|
||||||
$cluser = new User($this->db, $obj->fk_user_cloture);
|
$cluser = new User($this->db);
|
||||||
$cluser->fetch();
|
$cluser->fetch($obj->fk_user_cloture);
|
||||||
$this->user_cloture = $cluser;
|
$this->user_cloture = $cluser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2190,22 +2190,22 @@ class Commande extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
if ($obj->fk_user_author)
|
if ($obj->fk_user_author)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_valid)
|
if ($obj->fk_user_valid)
|
||||||
{
|
{
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
$vuser = new User($this->db);
|
||||||
$vuser->fetch();
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_cloture)
|
if ($obj->fk_user_cloture)
|
||||||
{
|
{
|
||||||
$cluser = new User($this->db, $obj->fk_user_cloture);
|
$cluser = new User($this->db);
|
||||||
$cluser->fetch();
|
$cluser->fetch($obj->fk_user_cloture);
|
||||||
$this->user_cloture = $cluser;
|
$this->user_cloture = $cluser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1107,14 +1107,14 @@ class AccountLine
|
|||||||
|
|
||||||
if ($obj->fk_user_author)
|
if ($obj->fk_user_author)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
if ($obj->fk_user_rappro)
|
if ($obj->fk_user_rappro)
|
||||||
{
|
{
|
||||||
$ruser = new User($this->db, $obj->fk_user_rappro);
|
$ruser = new User($this->db);
|
||||||
$ruser->fetch();
|
$ruser->fetch($obj->fk_user_rappro);
|
||||||
$this->user_rappro = $ruser;
|
$this->user_rappro = $ruser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2290,14 +2290,14 @@ class Facture extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
if ($obj->fk_user_author)
|
if ($obj->fk_user_author)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
if ($obj->fk_user_valid)
|
if ($obj->fk_user_valid)
|
||||||
{
|
{
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
$vuser = new User($this->db);
|
||||||
$vuser->fetch();
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
|
|||||||
@ -356,14 +356,14 @@ class Paiement
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
if ($obj->fk_user_creat)
|
if ($obj->fk_user_creat)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_creat);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_creat);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
if ($obj->fk_user_modif)
|
if ($obj->fk_user_modif)
|
||||||
{
|
{
|
||||||
$muser = new User($this->db, $obj->fk_user_modif);
|
$muser = new User($this->db);
|
||||||
$muser->fetch();
|
$muser->fetch($obj->fk_user_modif);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
|
|||||||
@ -197,8 +197,8 @@ class RejetPrelevement
|
|||||||
|
|
||||||
if ($userid > 0)
|
if ($userid > 0)
|
||||||
{
|
{
|
||||||
$emuser = new User($this->db, $userid);
|
$emuser = new User($this->db);
|
||||||
$emuser->fetch();
|
$emuser->fetch($userid);
|
||||||
|
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
$soc->fetch($fac->socid);
|
$soc->fetch($fac->socid);
|
||||||
|
|||||||
@ -158,8 +158,8 @@ if ($user->rights->prelevement->bons->configurer)
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
if (defined("PRELEVEMENT_USER") && PRELEVEMENT_USER > 0)
|
if (defined("PRELEVEMENT_USER") && PRELEVEMENT_USER > 0)
|
||||||
{
|
{
|
||||||
$cuser = new User($db, PRELEVEMENT_USER);
|
$cuser = new User($db);
|
||||||
$cuser->fetch();
|
$cuser->fetch(PRELEVEMENT_USER);
|
||||||
print $cuser->fullname;
|
print $cuser->fullname;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -173,8 +173,8 @@ if ($_GET["id"])
|
|||||||
|
|
||||||
if($bon->date_trans <> 0)
|
if($bon->date_trans <> 0)
|
||||||
{
|
{
|
||||||
$muser = new User($db, $bon->user_trans);
|
$muser = new User($db);
|
||||||
$muser->fetch();
|
$muser->fetch($bon->user_trans);
|
||||||
|
|
||||||
print '<tr><td width="20%">Date Transmission / Par</td><td>';
|
print '<tr><td width="20%">Date Transmission / Par</td><td>';
|
||||||
print dol_print_date($bon->date_trans,'dayhour');
|
print dol_print_date($bon->date_trans,'dayhour');
|
||||||
|
|||||||
@ -672,14 +672,14 @@ class Contact extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
if ($obj->fk_user_creat) {
|
if ($obj->fk_user_creat) {
|
||||||
$cuser = new User($this->db, $obj->fk_user_creat);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_creat);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_modif) {
|
if ($obj->fk_user_modif) {
|
||||||
$muser = new User($this->db, $obj->fk_user_modif);
|
$muser = new User($this->db);
|
||||||
$muser->fetch();
|
$muser->fetch($obj->fk_user_modif);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -467,8 +467,7 @@ if ($user->rights->societe->contact->creer)
|
|||||||
if ($contact->user_id)
|
if ($contact->user_id)
|
||||||
{
|
{
|
||||||
$dolibarr_user=new User($db);
|
$dolibarr_user=new User($db);
|
||||||
$dolibarr_user->id=$contact->user_id;
|
$result=$dolibarr_user->fetch($contact->user_id);
|
||||||
$result=$dolibarr_user->fetch();
|
|
||||||
print $dolibarr_user->getLoginUrl(1);
|
print $dolibarr_user->getLoginUrl(1);
|
||||||
}
|
}
|
||||||
else print $langs->trans("NoDolibarrAccess");
|
else print $langs->trans("NoDolibarrAccess");
|
||||||
@ -617,8 +616,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
|
|||||||
if ($contact->user_id)
|
if ($contact->user_id)
|
||||||
{
|
{
|
||||||
$dolibarr_user=new User($db);
|
$dolibarr_user=new User($db);
|
||||||
$dolibarr_user->id=$contact->user_id;
|
$result=$dolibarr_user->fetch($contact->user_id);
|
||||||
$result=$dolibarr_user->fetch();
|
|
||||||
print $dolibarr_user->getLoginUrl(1);
|
print $dolibarr_user->getLoginUrl(1);
|
||||||
}
|
}
|
||||||
else print $langs->trans("NoDolibarrAccess");
|
else print $langs->trans("NoDolibarrAccess");
|
||||||
|
|||||||
@ -1149,14 +1149,14 @@ class Contrat extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
if ($obj->fk_user_author) {
|
if ($obj->fk_user_author) {
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_cloture) {
|
if ($obj->fk_user_cloture) {
|
||||||
$cuser = new User($this->db, $obj->fk_user_cloture);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_cloture);
|
||||||
$this->user_cloture = $cuser;
|
$this->user_cloture = $cuser;
|
||||||
}
|
}
|
||||||
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;
|
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;
|
||||||
|
|||||||
@ -386,8 +386,8 @@ class CommonObject
|
|||||||
*/
|
*/
|
||||||
function fetch_user($userid)
|
function fetch_user($userid)
|
||||||
{
|
{
|
||||||
$user = new User($this->db, $userid);
|
$user = new User($this->db);
|
||||||
$result=$user->fetch();
|
$result=$user->fetch($userid);
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -491,14 +491,14 @@ class Fichinter extends CommonObject
|
|||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
$this->date_validation = $this->db->jdate($obj->datev);
|
$this->date_validation = $this->db->jdate($obj->datev);
|
||||||
|
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
|
|
||||||
if ($obj->fk_user_valid)
|
if ($obj->fk_user_valid)
|
||||||
{
|
{
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
$vuser = new User($this->db);
|
||||||
$vuser->fetch();
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -356,14 +356,14 @@ class PaiementFourn
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
if ($obj->fk_user_creat)
|
if ($obj->fk_user_creat)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_creat);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_creat);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
if ($obj->fk_user_modif)
|
if ($obj->fk_user_modif)
|
||||||
{
|
{
|
||||||
$muser = new User($this->db, $obj->fk_user_modif);
|
$muser = new User($this->db);
|
||||||
$muser->fetch();
|
$muser->fetch($obj->fk_user_modif);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
|
|||||||
@ -878,14 +878,14 @@ class FactureFournisseur extends Facture
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
if ($obj->fk_user_author)
|
if ($obj->fk_user_author)
|
||||||
{
|
{
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
if ($obj->fk_user_valid)
|
if ($obj->fk_user_valid)
|
||||||
{
|
{
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
$vuser = new User($this->db);
|
||||||
$vuser->fetch();
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
$this->date_creation = $obj->datec;
|
$this->date_creation = $obj->datec;
|
||||||
|
|||||||
@ -1958,8 +1958,7 @@ class Form
|
|||||||
//$this->load_cache_contacts();
|
//$this->load_cache_contacts();
|
||||||
//print $this->cache_contacts[$selected];
|
//print $this->cache_contacts[$selected];
|
||||||
$theuser=new User($this->db);
|
$theuser=new User($this->db);
|
||||||
$theuser->id=$selected;
|
$theuser->fetch($selected);
|
||||||
$theuser->fetch();
|
|
||||||
print $theuser->getNomUrl(1);
|
print $theuser->getNomUrl(1);
|
||||||
} else {
|
} else {
|
||||||
print " ";
|
print " ";
|
||||||
|
|||||||
@ -235,8 +235,7 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$fuser=new User($this->db);
|
$fuser=new User($this->db);
|
||||||
$fuser->id=$this->fromid;
|
$fuser->fetch($this->fromid);
|
||||||
$fuser->fetch();
|
|
||||||
print $fuser->getNomUrl(1);
|
print $fuser->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -40,7 +40,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
global $dolibarr_main_auth_ldap_login_attribute,$dolibarr_main_auth_ldap_dn;
|
global $dolibarr_main_auth_ldap_login_attribute,$dolibarr_main_auth_ldap_dn;
|
||||||
global $dolibarr_main_auth_ldap_admin_login,$dolibarr_main_auth_ldap_admin_pass;
|
global $dolibarr_main_auth_ldap_admin_login,$dolibarr_main_auth_ldap_admin_pass;
|
||||||
global $dolibarr_main_auth_ldap_debug;
|
global $dolibarr_main_auth_ldap_debug;
|
||||||
|
|
||||||
if (! function_exists("ldap_connect"))
|
if (! function_exists("ldap_connect"))
|
||||||
{
|
{
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP. LDAP functions are disabled on this PHP");
|
dol_syslog("functions_ldap::check_user_password_ldap Authentification ko failed to connect to LDAP. LDAP functions are disabled on this PHP");
|
||||||
@ -50,11 +50,11 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->trans("TryAnotherConnectionMode");
|
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->trans("TryAnotherConnectionMode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$login='';
|
$login='';
|
||||||
$resultFetchUser='';
|
$resultFetchUser='';
|
||||||
|
|
||||||
if (! empty($_POST["username"]))
|
if (! empty($_POST["username"]))
|
||||||
{
|
{
|
||||||
// If test username/password asked, we define $test=false and $login var if ok, set $_SESSION["dol_loginmesg"] if ko
|
// If test username/password asked, we define $test=false and $login var if ok, set $_SESSION["dol_loginmesg"] if ko
|
||||||
$ldaphost=$dolibarr_main_auth_ldap_host;
|
$ldaphost=$dolibarr_main_auth_ldap_host;
|
||||||
@ -67,7 +67,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
$ldapadminlogin=$dolibarr_main_auth_ldap_admin_login;
|
$ldapadminlogin=$dolibarr_main_auth_ldap_admin_login;
|
||||||
$ldapadminpass=$dolibarr_main_auth_ldap_admin_pass;
|
$ldapadminpass=$dolibarr_main_auth_ldap_admin_pass;
|
||||||
$ldapdebug=(empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug=="false" ? false : true);
|
$ldapdebug=(empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug=="false" ? false : true);
|
||||||
|
|
||||||
if ($ldapdebug) print "DEBUG: Logging LDAP steps<br>\n";
|
if ($ldapdebug) print "DEBUG: Logging LDAP steps<br>\n";
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
|
||||||
@ -78,16 +78,16 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
$ldap->serverType=$ldapservertype;
|
$ldap->serverType=$ldapservertype;
|
||||||
$ldap->searchUser=$ldapadminlogin;
|
$ldap->searchUser=$ldapadminlogin;
|
||||||
$ldap->searchPassword=$ldapadminpass;
|
$ldap->searchPassword=$ldapadminpass;
|
||||||
|
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap usertotest=".$usertotest);
|
dol_syslog("functions_ldap::check_user_password_ldap usertotest=".$usertotest);
|
||||||
if ($ldapdebug)
|
if ($ldapdebug)
|
||||||
{
|
{
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType);
|
dol_syslog("functions_ldap::check_user_password_ldap Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType);
|
||||||
dol_syslog("functions_ldap::check_user_password_ldap uid/samacountname=".$ldapuserattr.", dn=".$ladpdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword);
|
dol_syslog("functions_ldap::check_user_password_ldap uid/samacountname=".$ldapuserattr.", dn=".$ladpdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword);
|
||||||
print "DEBUG: Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."\n";
|
print "DEBUG: Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType."\n";
|
||||||
print "DEBUG: uid/samacountname=".$ldapuserattr.", dn=".$ladpdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."\n";
|
print "DEBUG: uid/samacountname=".$ldapuserattr.", dn=".$ladpdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$resultCheckUserDN=false;
|
$resultCheckUserDN=false;
|
||||||
|
|
||||||
// If admin login provided
|
// If admin login provided
|
||||||
@ -116,7 +116,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
}
|
}
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forge LDAP user and password to test from config setup
|
// Forge LDAP user and password to test from config setup
|
||||||
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn;
|
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn;
|
||||||
$ldap->searchPassword=$passwordtotest;
|
$ldap->searchPassword=$passwordtotest;
|
||||||
@ -124,7 +124,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
if ($resultCheckUserDN) $ldap->searchUser = $ldap->ldapUserDN;
|
if ($resultCheckUserDN) $ldap->searchUser = $ldap->ldapUserDN;
|
||||||
|
|
||||||
// Test with this->seachUser and this->searchPassword
|
// Test with this->seachUser and this->searchPassword
|
||||||
$result=$ldap->connect_bind();
|
$result=$ldap->connect_bind();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if ($result == 2)
|
if ($result == 2)
|
||||||
@ -138,17 +138,17 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
// On charge les attributs du user ldap
|
// On charge les attributs du user ldap
|
||||||
if ($ldapdebug) print "DEBUG: login ldap = ".$login."<br>\n";
|
if ($ldapdebug) print "DEBUG: login ldap = ".$login."<br>\n";
|
||||||
$ldap->fetch($login);
|
$ldap->fetch($login);
|
||||||
|
|
||||||
if ($ldapdebug) print "DEBUG: UACF = ".join(',',$ldap->uacf)."<br>\n";
|
if ($ldapdebug) print "DEBUG: UACF = ".join(',',$ldap->uacf)."<br>\n";
|
||||||
if ($ldapdebug) print "DEBUG: pwdLastSet = ".dol_print_date($ldap->pwdlastset,'day')."<br>\n";
|
if ($ldapdebug) print "DEBUG: pwdLastSet = ".dol_print_date($ldap->pwdlastset,'day')."<br>\n";
|
||||||
if ($ldapdebug) print "DEBUG: badPasswordTime = ".dol_print_date($ldap->badpwdtime,'day')."<br>\n";
|
if ($ldapdebug) print "DEBUG: badPasswordTime = ".dol_print_date($ldap->badpwdtime,'day')."<br>\n";
|
||||||
|
|
||||||
// On recherche le user dolibarr en fonction de son SID ldap
|
// On recherche le user dolibarr en fonction de son SID ldap
|
||||||
$sid = $ldap->getObjectSid($login);
|
$sid = $ldap->getObjectSid($login);
|
||||||
if ($ldapdebug) print "DEBUG: sid = ".$sid."<br>\n";
|
if ($ldapdebug) print "DEBUG: sid = ".$sid."<br>\n";
|
||||||
|
|
||||||
$user=new User($db);
|
$user=new User($db);
|
||||||
$resultFetchUser=$user->fetch($login,$sid);
|
$resultFetchUser=$user->fetch('',$login,$sid);
|
||||||
if ($resultFetchUser > 0)
|
if ($resultFetchUser > 0)
|
||||||
{
|
{
|
||||||
// On verifie si le login a change et on met a jour les attributs dolibarr
|
// On verifie si le login a change et on met a jour les attributs dolibarr
|
||||||
@ -179,10 +179,10 @@ function check_user_password_ldap($usertotest,$passwordtotest)
|
|||||||
$langs->load('other');
|
$langs->load('other');
|
||||||
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
|
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
|
||||||
}
|
}
|
||||||
|
|
||||||
$ldap->close();
|
$ldap->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $login;
|
return $login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -399,7 +399,7 @@ if (! defined('NOLOGIN'))
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$resultFetchUser=$user->fetch($login);
|
$resultFetchUser=$user->fetch('',$login);
|
||||||
if ($resultFetchUser <= 0)
|
if ($resultFetchUser <= 0)
|
||||||
{
|
{
|
||||||
dol_syslog('User not found, connexion refused');
|
dol_syslog('User not found, connexion refused');
|
||||||
@ -436,7 +436,7 @@ if (! defined('NOLOGIN'))
|
|||||||
{
|
{
|
||||||
// It is already in a session
|
// It is already in a session
|
||||||
$login=$_SESSION["dol_login"];
|
$login=$_SESSION["dol_login"];
|
||||||
$resultFetchUser=$user->fetch($login);
|
$resultFetchUser=$user->fetch('',$login);
|
||||||
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
|
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
|
||||||
|
|
||||||
if ($resultFetchUser <= 0)
|
if ($resultFetchUser <= 0)
|
||||||
|
|||||||
@ -292,14 +292,14 @@ class Entrepot extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
if ($obj->fk_user_author) {
|
if ($obj->fk_user_author) {
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_author);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_valid) {
|
if ($obj->fk_user_valid) {
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
$vuser = new User($this->db);
|
||||||
$vuser->fetch();
|
$vuser->fetch($obj->fk_user_valid);
|
||||||
$this->user_validation = $vuser;
|
$this->user_validation = $vuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1881,14 +1881,14 @@ class Societe extends CommonObject
|
|||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
if ($obj->fk_user_creat) {
|
if ($obj->fk_user_creat) {
|
||||||
$cuser = new User($this->db, $obj->fk_user_creat);
|
$cuser = new User($this->db);
|
||||||
$cuser->fetch();
|
$cuser->fetch($obj->fk_user_creat);
|
||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_modif) {
|
if ($obj->fk_user_modif) {
|
||||||
$muser = new User($this->db, $obj->fk_user_modif);
|
$muser = new User($this->db);
|
||||||
$muser->fetch();
|
$muser->fetch($obj->fk_user_modif);
|
||||||
$this->user_modification = $muser;
|
$this->user_modification = $muser;
|
||||||
}
|
}
|
||||||
$this->ref = $obj->nom;
|
$this->ref = $obj->nom;
|
||||||
|
|||||||
@ -67,8 +67,8 @@ llxHeader("","ClickToDial");
|
|||||||
|
|
||||||
if ($_GET["id"])
|
if ($_GET["id"])
|
||||||
{
|
{
|
||||||
$fuser = new User($db, $_GET["id"]);
|
$fuser = new User($db);
|
||||||
$fuser->fetch();
|
$fuser->fetch($_GET["id"]);
|
||||||
$fuser->fetch_clicktodial();
|
$fuser->fetch_clicktodial();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -98,8 +98,7 @@ if ($_REQUEST["action"] == 'confirm_disable' && $_REQUEST["confirm"] == "yes")
|
|||||||
if ($_GET["id"] <> $user->id)
|
if ($_GET["id"] <> $user->id)
|
||||||
{
|
{
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$edituser->id=$_GET["id"];
|
$edituser->fetch($_GET["id"]);
|
||||||
$edituser->fetch();
|
|
||||||
$edituser->setstatus(0);
|
$edituser->setstatus(0);
|
||||||
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
||||||
exit;
|
exit;
|
||||||
@ -109,9 +108,8 @@ if ($_REQUEST["action"] == 'confirm_enable' && $_REQUEST["confirm"] == "yes")
|
|||||||
{
|
{
|
||||||
if ($_GET["id"] <> $user->id)
|
if ($_GET["id"] <> $user->id)
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
$edituser->id=$_GET["id"];
|
$edituser->fetch($_GET["id"]);
|
||||||
$edituser->fetch();
|
|
||||||
$edituser->setstatus(1);
|
$edituser->setstatus(1);
|
||||||
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
|
||||||
exit;
|
exit;
|
||||||
@ -122,7 +120,7 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == "yes")
|
|||||||
{
|
{
|
||||||
if ($_GET["id"] <> $user->id)
|
if ($_GET["id"] <> $user->id)
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
$edituser->id=$_GET["id"];
|
$edituser->id=$_GET["id"];
|
||||||
$result = $edituser->delete();
|
$result = $edituser->delete();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -242,8 +240,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||||||
if (! $message)
|
if (! $message)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
$edituser->fetch();
|
$edituser->fetch($_GET["id"]);
|
||||||
|
|
||||||
$edituser->oldcopy=dol_clone($edituser);
|
$edituser->oldcopy=dol_clone($edituser);
|
||||||
|
|
||||||
@ -328,8 +326,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||||||
}
|
}
|
||||||
else if ($caneditpassword) // Case we can edit only password
|
else if ($caneditpassword) // Case we can edit only password
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
$edituser->fetch();
|
$edituser->fetch($_GET["id"]);
|
||||||
|
|
||||||
$ret=$edituser->setPassword($user,$_POST["password"]);
|
$ret=$edituser->setPassword($user,$_POST["password"]);
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
@ -343,8 +341,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
|||||||
if ((($_REQUEST["action"] == 'confirm_password' && $_REQUEST["confirm"] == 'yes')
|
if ((($_REQUEST["action"] == 'confirm_password' && $_REQUEST["confirm"] == 'yes')
|
||||||
|| ($_REQUEST["action"] == 'confirm_passwordsend' && $_REQUEST["confirm"] == 'yes')) && $caneditpassword)
|
|| ($_REQUEST["action"] == 'confirm_passwordsend' && $_REQUEST["confirm"] == 'yes')) && $caneditpassword)
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
$edituser->fetch();
|
$edituser->fetch($_GET["id"]);
|
||||||
|
|
||||||
$newpassword=$edituser->setPassword($user,'');
|
$newpassword=$edituser->setPassword($user,'');
|
||||||
if ($newpassword < 0)
|
if ($newpassword < 0)
|
||||||
@ -746,8 +744,8 @@ else
|
|||||||
|
|
||||||
if ($_GET["id"])
|
if ($_GET["id"])
|
||||||
{
|
{
|
||||||
$fuser = new User($db, $_GET["id"]);
|
$fuser = new User($db);
|
||||||
$fuser->fetch();
|
$fuser->fetch($_GET["id"]);
|
||||||
|
|
||||||
// Connexion ldap
|
// Connexion ldap
|
||||||
// pour recuperer passDoNotExpire et userChangePassNextLogon
|
// pour recuperer passDoNotExpire et userChangePassNextLogon
|
||||||
|
|||||||
@ -600,8 +600,7 @@ class UserGroup extends CommonObject
|
|||||||
foreach($this->members as $key=>$val)
|
foreach($this->members as $key=>$val)
|
||||||
{
|
{
|
||||||
$muser=new User($this->db);
|
$muser=new User($this->db);
|
||||||
$muser->id=$val;
|
$muser->fetch($val);
|
||||||
$muser->fetch();
|
|
||||||
|
|
||||||
$ldapuserid=$muser->login;
|
$ldapuserid=$muser->login;
|
||||||
// TODO ldapuserid should depends on value $conf->global->LDAP_KEY_USERS;
|
// TODO ldapuserid should depends on value $conf->global->LDAP_KEY_USERS;
|
||||||
|
|||||||
@ -33,8 +33,7 @@ $langs->load("users");
|
|||||||
// Security check
|
// Security check
|
||||||
$id = isset($_GET["id"])?$_GET["id"]:'';
|
$id = isset($_GET["id"])?$_GET["id"]:'';
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
$fuser->id = $id;
|
$fuser->fetch($id);
|
||||||
$fuser->fetch();
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
$socid=0;
|
||||||
|
|||||||
@ -47,8 +47,8 @@ if ($user->id == $_GET["id"]) // A user can always read its own card
|
|||||||
}
|
}
|
||||||
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
|
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
|
||||||
|
|
||||||
$fuser = new User($db, $_GET["id"]);
|
$fuser = new User($db);
|
||||||
$fuser->fetch();
|
$fuser->fetch($_GET["id"]);
|
||||||
$fuser->getrights();
|
$fuser->getrights();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -37,8 +37,7 @@ $langs->load("bills");
|
|||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
$fuser->id = $id;
|
$fuser->fetch($id);
|
||||||
$fuser->fetch();
|
|
||||||
|
|
||||||
// If user is not user read and no permission to read other users, we stop
|
// If user is not user read and no permission to read other users, we stop
|
||||||
if (($fuser->id != $user->id) && (! $user->rights->user->user->lire))
|
if (($fuser->id != $user->id) && (! $user->rights->user->user->lire))
|
||||||
|
|||||||
@ -63,8 +63,8 @@ $dirleft = "../includes/menus/barre_left";
|
|||||||
$dirtheme = "../theme";
|
$dirtheme = "../theme";
|
||||||
|
|
||||||
// Charge utilisateur edite
|
// Charge utilisateur edite
|
||||||
$fuser = new User($db, $id);
|
$fuser = new User($db);
|
||||||
$fuser->fetch();
|
$fuser->fetch($id);
|
||||||
$fuser->getrights();
|
$fuser->getrights();
|
||||||
|
|
||||||
// Liste des zone de recherche permanentes supportees
|
// Liste des zone de recherche permanentes supportees
|
||||||
|
|||||||
@ -54,7 +54,7 @@ $conf->entity = isset($_POST["entity"])?$_POST["entity"]:1;
|
|||||||
if ($_GET["action"] == 'validatenewpassword' && $_GET["username"] && $_GET["passwordmd5"])
|
if ($_GET["action"] == 'validatenewpassword' && $_GET["username"] && $_GET["passwordmd5"])
|
||||||
{
|
{
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$result=$edituser->fetch($_GET["username"]);
|
$result=$edituser->fetch('',$_GET["username"]);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$_GET["username"]).'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$_GET["username"]).'</div>';
|
||||||
@ -93,7 +93,7 @@ if ($_POST["action"] == 'buildnewpassword' && $_POST["username"])
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$result=$edituser->fetch($_POST["username"],'',1);
|
$result=$edituser->fetch('',$_POST["username"],'',1);
|
||||||
if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
|
if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
|
||||||
{
|
{
|
||||||
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$_POST["username"]).'</div>';
|
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$_POST["username"]).'</div>';
|
||||||
|
|||||||
@ -96,8 +96,8 @@ llxHeader('',$langs->trans("Permissions"));
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
$fuser = new User($db, $_GET["id"]);
|
$fuser = new User($db);
|
||||||
$fuser->fetch();
|
$fuser->fetch($_GET["id"]);
|
||||||
$fuser->getrights();
|
$fuser->getrights();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -133,12 +133,13 @@ class User extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge un objet user avec toutes ces caracteristiques depuis un id ou login
|
* \brief Charge un objet user avec toutes ces caracteristiques depuis un id ou login
|
||||||
* \param login Si defini, login a utiliser pour recherche
|
* \param id Si defini, id a utiliser pour recherche
|
||||||
|
* \param login Si defini, login a utiliser pour recherche
|
||||||
* \param sid Si defini, sid a utiliser pour recherche
|
* \param sid Si defini, sid a utiliser pour recherche
|
||||||
* \param $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
|
* \param $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
|
||||||
* \return int <0 if KO, 0 not found, >0 if OK
|
* \return int <0 if KO, 0 not found, >0 if OK
|
||||||
*/
|
*/
|
||||||
function fetch($login='',$sid='',$loadpersonalconf=1)
|
function fetch($id='', $login='',$sid='',$loadpersonalconf=1)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
|||||||
@ -79,8 +79,7 @@ if ($resql)
|
|||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
$fuser = new User($db);
|
$fuser = new User($db);
|
||||||
$fuser->id = $obj->rowid;
|
$fuser->fetch($obj->rowid);
|
||||||
$fuser->fetch();
|
|
||||||
|
|
||||||
print $langs->trans("UpdateUser")." rowid=".$fuser->id." ".$fuser->fullname;
|
print $langs->trans("UpdateUser")." rowid=".$fuser->id." ".$fuser->fullname;
|
||||||
|
|
||||||
|
|||||||
@ -43,8 +43,8 @@ require_once(DOL_DOCUMENT_ROOT."/societe/societe.class.php");
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$puser = new user($db, PRELEVEMENT_USER);
|
$puser = new user($db);
|
||||||
$puser->fetch();
|
$puser->fetch(PRELEVEMENT_USER);
|
||||||
dol_syslog("Prelevements effectues par ".$puser->fullname." [".PRELEVEMENT_USER."]");
|
dol_syslog("Prelevements effectues par ".$puser->fullname." [".PRELEVEMENT_USER."]");
|
||||||
|
|
||||||
dol_syslog("Raison sociale : ".PRELEVEMENT_RAISON_SOCIALE);
|
dol_syslog("Raison sociale : ".PRELEVEMENT_RAISON_SOCIALE);
|
||||||
|
|||||||
@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/adherents/class/adherent.class.php';
|
|||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
print "Load permissions for admin user with login 'admin'\n";
|
print "Load permissions for admin user nb 1\n";
|
||||||
$user->fetch('admin');
|
$user->fetch(1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/commande/class/commande.class.php';
|
|||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
print "Load permissions for admin user with login 'admin'\n";
|
print "Load permissions for admin user nb 1\n";
|
||||||
$user->fetch('admin');
|
$user->fetch(1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/contrat/contrat.class.php';
|
|||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
print "Load permissions for admin user with login 'admin'\n";
|
print "Load permissions for admin user nb 1\n";
|
||||||
$user->fetch('admin');
|
$user->fetch(1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/compta/facture/class/facture.class.ph
|
|||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
print "Load permissions for admin user with login 'admin'\n";
|
print "Load permissions for admin user nb 1\n";
|
||||||
$user->fetch('admin');
|
$user->fetch(1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,8 +33,8 @@ require_once dirname(__FILE__).'/../htdocs/master.inc.php';
|
|||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
print "Load permissions for admin user with login 'admin'\n";
|
print "Load permissions for admin user nb 1\n";
|
||||||
$user->fetch('admin');
|
$user->fetch(1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/comm/propal/propal.class.php';
|
|||||||
|
|
||||||
if (empty($user->id))
|
if (empty($user->id))
|
||||||
{
|
{
|
||||||
print "Load permissions for admin user with login 'admin'\n";
|
print "Load permissions for admin user nb 1\n";
|
||||||
$user->fetch('admin');
|
$user->fetch(1);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user