Qual: Uniformise code. user class use id in first param of fetch

This commit is contained in:
Laurent Destailleur 2010-04-28 07:31:34 +00:00
parent da5cf895d0
commit a4f144f24d
48 changed files with 158 additions and 170 deletions

View File

@ -49,7 +49,7 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0);
// 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; }
$user->getrights();

View File

@ -49,7 +49,7 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0);
// 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; }
$user->getrights();

View File

@ -51,7 +51,7 @@ $langs->load("main"); // To load language file for default language
@set_time_limit(0); // No timeout for this script
// 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; }
$user->getrights();

View File

@ -504,8 +504,7 @@ class Adherent extends CommonObject
// This member is linked with a user, so we also update users informations
// if this is an update.
$luser=new User($this->db);
$luser->id=$this->user_id;
$result=$luser->fetch();
$result=$luser->fetch($this->user_id);
if ($result >= 0)
{
@ -2051,22 +2050,22 @@ class Adherent extends CommonObject
$this->id = $obj->rowid;
if ($obj->fk_user_author)
{
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid)
{
$vuser = new User($this->db, $obj->fk_user_valid);
$vuser->fetch();
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_mod)
{
$muser = new User($this->db, $obj->fk_user_mod);
$muser->fetch();
$muser = new User($this->db);
$muser->fetch($obj->fk_user_mod);
$this->user_modification = $muser;
}

View File

@ -224,8 +224,7 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"]))
if ($bookmark->fk_user)
{
$fuser=new User($db);
$fuser->id=$bookmark->fk_user;
$fuser->fetch();
$fuser->fetch($bookmark->fk_user);
//$fuser->nom=$fuser->login; $fuser->prenom='';
print $fuser->getNomUrl(1);
}

View File

@ -81,9 +81,9 @@ switch ( $_GET['action'] )
case 'valide_facture':
$now=dol_now('tzserver');
// Recuperation de la date et de l'heure
$date = dol_print_date($now,'day');
$heure = dol_print_date($now,'hour');
@ -131,8 +131,7 @@ switch ( $_GET['action'] )
$db->begin();
$user->id=$_SESSION['uid'];
$user->fetch();
$user->fetch($_SESSION['uid']);
$user->getrights();
$invoice=new Facture($db,$conf_fksoc);
@ -216,11 +215,11 @@ switch ( $_GET['action'] )
{
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
}
else
else
{
$error++;
}
$id = $invoice->id;
}
else
@ -231,7 +230,7 @@ switch ( $_GET['action'] )
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
$id = $invoice->id;
// Add the payment
$payment=new Paiement($db);
$payment->datepaye=$now;
@ -240,7 +239,7 @@ switch ( $_GET['action'] )
$payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->num_facture();
$payment->paiementid=$invoice->mode_reglement_id;
$payment->num_paiement='';
$paiement_id = $payment->create($user);
if ($paiement_id > 0)
{
@ -260,13 +259,13 @@ switch ( $_GET['action'] )
{
$bankaccountid=$conf_fkaccount_cb;
}
if ($bankaccountid > 0)
{
// Insertion dans llx_bank
$label = "(CustomerInvoicePayment)";
$acc = new Account($db, $bankaccountid);
$bank_line_id = $acc->addline($payment->datepaye,
$payment->paiementid, // Payment mode id or code ("CHQ or VIR for example")
$label,
@ -276,7 +275,7 @@ switch ( $_GET['action'] )
$user,
'',
'');
// Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a genere l'ecriture bancaire
if ($bank_line_id > 0)
@ -308,7 +307,7 @@ switch ( $_GET['action'] )
}
}
}
else
else
{
$error++;
}

View File

@ -454,14 +454,14 @@ class ActionComm
$this->id = $obj->id;
if ($obj->fk_user_author)
{
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_mod)
{
$muser = new User($this->db, $obj->fk_user_mod);
$muser->fetch();
$muser = new User($this->db);
$muser->fetch($obj->fk_user_mod);
$this->user_modification = $muser;
}

View File

@ -615,10 +615,10 @@ if ($_GET["id"])
}
$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->usermod->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->usermod->id; $res=$tmpuser->fetch(); $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->userdone->id > 0) { $tmpuser=new User($db); $tmpuser->id=$act->userdone->id; $res=$tmpuser->fetch(); $act->userdone=$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); $res=$tmpuser->fetch($act->usermod->id); $act->usermod=$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); $res=$tmpuser->fetch($act->userdone->id); $act->userdone=$tmpuser; }
$contact = new Contact($db);
if ($act->contact->id)

View File

@ -450,14 +450,14 @@ class AdresseLivraison
$this->id = $obj->rowid;
if ($obj->fk_user_creat) {
$cuser = new User($this->db, $obj->fk_user_creat);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creat);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif) {
$muser = new User($this->db, $obj->fk_user_modif);
$muser->fetch();
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->ref = $obj->nom;

View File

@ -1744,21 +1744,21 @@ class Propal extends CommonObject
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_cloture = $this->db->jdate($obj->dateo);
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
if ($obj->fk_user_valid)
{
$vuser = new User($this->db, $obj->fk_user_valid);
$vuser->fetch();
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture)
{
$cluser = new User($this->db, $obj->fk_user_cloture);
$cluser->fetch();
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}

View File

@ -2190,22 +2190,22 @@ class Commande extends CommonObject
$this->id = $obj->rowid;
if ($obj->fk_user_author)
{
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid)
{
$vuser = new User($this->db, $obj->fk_user_valid);
$vuser->fetch();
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture)
{
$cluser = new User($this->db, $obj->fk_user_cloture);
$cluser->fetch();
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}

View File

@ -1107,14 +1107,14 @@ class AccountLine
if ($obj->fk_user_author)
{
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_rappro)
{
$ruser = new User($this->db, $obj->fk_user_rappro);
$ruser->fetch();
$ruser = new User($this->db);
$ruser->fetch($obj->fk_user_rappro);
$this->user_rappro = $ruser;
}

View File

@ -2290,14 +2290,14 @@ class Facture extends CommonObject
$this->id = $obj->rowid;
if ($obj->fk_user_author)
{
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid)
{
$vuser = new User($this->db, $obj->fk_user_valid);
$vuser->fetch();
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
$this->date_creation = $this->db->jdate($obj->datec);

View File

@ -356,14 +356,14 @@ class Paiement
$this->id = $obj->rowid;
if ($obj->fk_user_creat)
{
$cuser = new User($this->db, $obj->fk_user_creat);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creat);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif)
{
$muser = new User($this->db, $obj->fk_user_modif);
$muser->fetch();
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec);

View File

@ -197,8 +197,8 @@ class RejetPrelevement
if ($userid > 0)
{
$emuser = new User($this->db, $userid);
$emuser->fetch();
$emuser = new User($this->db);
$emuser->fetch($userid);
$soc = new Societe($this->db);
$soc->fetch($fac->socid);

View File

@ -158,8 +158,8 @@ if ($user->rights->prelevement->bons->configurer)
print '<td>';
if (defined("PRELEVEMENT_USER") && PRELEVEMENT_USER > 0)
{
$cuser = new User($db, PRELEVEMENT_USER);
$cuser->fetch();
$cuser = new User($db);
$cuser->fetch(PRELEVEMENT_USER);
print $cuser->fullname;
}
else

View File

@ -173,8 +173,8 @@ if ($_GET["id"])
if($bon->date_trans <> 0)
{
$muser = new User($db, $bon->user_trans);
$muser->fetch();
$muser = new User($db);
$muser->fetch($bon->user_trans);
print '<tr><td width="20%">Date Transmission / Par</td><td>';
print dol_print_date($bon->date_trans,'dayhour');

View File

@ -672,14 +672,14 @@ class Contact extends CommonObject
$this->id = $obj->rowid;
if ($obj->fk_user_creat) {
$cuser = new User($this->db, $obj->fk_user_creat);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creat);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif) {
$muser = new User($this->db, $obj->fk_user_modif);
$muser->fetch();
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}

View File

@ -467,8 +467,7 @@ if ($user->rights->societe->contact->creer)
if ($contact->user_id)
{
$dolibarr_user=new User($db);
$dolibarr_user->id=$contact->user_id;
$result=$dolibarr_user->fetch();
$result=$dolibarr_user->fetch($contact->user_id);
print $dolibarr_user->getLoginUrl(1);
}
else print $langs->trans("NoDolibarrAccess");
@ -617,8 +616,7 @@ if ($_GET["id"] && $_GET["action"] != 'edit')
if ($contact->user_id)
{
$dolibarr_user=new User($db);
$dolibarr_user->id=$contact->user_id;
$result=$dolibarr_user->fetch();
$result=$dolibarr_user->fetch($contact->user_id);
print $dolibarr_user->getLoginUrl(1);
}
else print $langs->trans("NoDolibarrAccess");

View File

@ -1149,14 +1149,14 @@ class Contrat extends CommonObject
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_cloture) {
$cuser = new User($this->db, $obj->fk_user_cloture);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cuser;
}
$this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref;

View File

@ -386,8 +386,8 @@ class CommonObject
*/
function fetch_user($userid)
{
$user = new User($this->db, $userid);
$result=$user->fetch();
$user = new User($this->db);
$result=$user->fetch($userid);
$this->user = $user;
return $result;
}

View File

@ -491,14 +491,14 @@ class Fichinter extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $this->db->jdate($obj->datev);
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
if ($obj->fk_user_valid)
{
$vuser = new User($this->db, $obj->fk_user_valid);
$vuser->fetch();
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
}

View File

@ -356,14 +356,14 @@ class PaiementFourn
$this->id = $obj->rowid;
if ($obj->fk_user_creat)
{
$cuser = new User($this->db, $obj->fk_user_creat);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creat);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif)
{
$muser = new User($this->db, $obj->fk_user_modif);
$muser->fetch();
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->date_creation = $this->db->jdate($obj->datec);

View File

@ -878,14 +878,14 @@ class FactureFournisseur extends Facture
$this->id = $obj->rowid;
if ($obj->fk_user_author)
{
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid)
{
$vuser = new User($this->db, $obj->fk_user_valid);
$vuser->fetch();
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
$this->date_creation = $obj->datec;

View File

@ -1958,8 +1958,7 @@ class Form
//$this->load_cache_contacts();
//print $this->cache_contacts[$selected];
$theuser=new User($this->db);
$theuser->id=$selected;
$theuser->fetch();
$theuser->fetch($selected);
print $theuser->getNomUrl(1);
} else {
print "&nbsp;";

View File

@ -235,8 +235,7 @@ class FormMail
{
$langs->load("users");
$fuser=new User($this->db);
$fuser->id=$this->fromid;
$fuser->fetch();
$fuser->fetch($this->fromid);
print $fuser->getNomUrl(1);
}
else

View File

@ -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_admin_login,$dolibarr_main_auth_ldap_admin_pass;
global $dolibarr_main_auth_ldap_debug;
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");
@ -50,11 +50,11 @@ function check_user_password_ldap($usertotest,$passwordtotest)
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorLDAPFunctionsAreDisabledOnThisPHP").' '.$langs->trans("TryAnotherConnectionMode");
return;
}
$login='';
$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
$ldaphost=$dolibarr_main_auth_ldap_host;
@ -67,7 +67,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
$ldapadminlogin=$dolibarr_main_auth_ldap_admin_login;
$ldapadminpass=$dolibarr_main_auth_ldap_admin_pass;
$ldapdebug=(empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug=="false" ? false : true);
if ($ldapdebug) print "DEBUG: Logging LDAP steps<br>\n";
require_once(DOL_DOCUMENT_ROOT."/lib/ldap.class.php");
@ -78,16 +78,16 @@ function check_user_password_ldap($usertotest,$passwordtotest)
$ldap->serverType=$ldapservertype;
$ldap->searchUser=$ldapadminlogin;
$ldap->searchPassword=$ldapadminpass;
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 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: uid/samacountname=".$ldapuserattr.", dn=".$ladpdn.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword."\n";
}
$resultCheckUserDN=false;
// If admin login provided
@ -116,7 +116,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
}
$ldap->close();
}
// Forge LDAP user and password to test from config setup
$ldap->searchUser=$ldapuserattr."=".$usertotest.",".$ldapdn;
$ldap->searchPassword=$passwordtotest;
@ -124,7 +124,7 @@ function check_user_password_ldap($usertotest,$passwordtotest)
if ($resultCheckUserDN) $ldap->searchUser = $ldap->ldapUserDN;
// Test with this->seachUser and this->searchPassword
$result=$ldap->connect_bind();
$result=$ldap->connect_bind();
if ($result > 0)
{
if ($result == 2)
@ -138,17 +138,17 @@ function check_user_password_ldap($usertotest,$passwordtotest)
// On charge les attributs du user ldap
if ($ldapdebug) print "DEBUG: login ldap = ".$login."<br>\n";
$ldap->fetch($login);
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: badPasswordTime = ".dol_print_date($ldap->badpwdtime,'day')."<br>\n";
// On recherche le user dolibarr en fonction de son SID ldap
$sid = $ldap->getObjectSid($login);
if ($ldapdebug) print "DEBUG: sid = ".$sid."<br>\n";
$user=new User($db);
$resultFetchUser=$user->fetch($login,$sid);
$resultFetchUser=$user->fetch('',$login,$sid);
if ($resultFetchUser > 0)
{
// 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');
$_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword");
}
$ldap->close();
}
return $login;
}

View File

@ -399,7 +399,7 @@ if (! defined('NOLOGIN'))
exit;
}
$resultFetchUser=$user->fetch($login);
$resultFetchUser=$user->fetch('',$login);
if ($resultFetchUser <= 0)
{
dol_syslog('User not found, connexion refused');
@ -436,7 +436,7 @@ if (! defined('NOLOGIN'))
{
// It is already in a session
$login=$_SESSION["dol_login"];
$resultFetchUser=$user->fetch($login);
$resultFetchUser=$user->fetch('',$login);
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login);
if ($resultFetchUser <= 0)

View File

@ -292,14 +292,14 @@ class Entrepot extends CommonObject
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db, $obj->fk_user_author);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
$vuser = new User($this->db, $obj->fk_user_valid);
$vuser->fetch();
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}

View File

@ -1881,14 +1881,14 @@ class Societe extends CommonObject
$this->id = $obj->rowid;
if ($obj->fk_user_creat) {
$cuser = new User($this->db, $obj->fk_user_creat);
$cuser->fetch();
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_creat);
$this->user_creation = $cuser;
}
if ($obj->fk_user_modif) {
$muser = new User($this->db, $obj->fk_user_modif);
$muser->fetch();
$muser = new User($this->db);
$muser->fetch($obj->fk_user_modif);
$this->user_modification = $muser;
}
$this->ref = $obj->nom;

View File

@ -67,8 +67,8 @@ llxHeader("","ClickToDial");
if ($_GET["id"])
{
$fuser = new User($db, $_GET["id"]);
$fuser->fetch();
$fuser = new User($db);
$fuser->fetch($_GET["id"]);
$fuser->fetch_clicktodial();

View File

@ -98,8 +98,7 @@ if ($_REQUEST["action"] == 'confirm_disable' && $_REQUEST["confirm"] == "yes")
if ($_GET["id"] <> $user->id)
{
$edituser = new User($db);
$edituser->id=$_GET["id"];
$edituser->fetch();
$edituser->fetch($_GET["id"]);
$edituser->setstatus(0);
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
exit;
@ -109,9 +108,8 @@ if ($_REQUEST["action"] == 'confirm_enable' && $_REQUEST["confirm"] == "yes")
{
if ($_GET["id"] <> $user->id)
{
$edituser = new User($db, $_GET["id"]);
$edituser->id=$_GET["id"];
$edituser->fetch();
$edituser = new User($db);
$edituser->fetch($_GET["id"]);
$edituser->setstatus(1);
Header("Location: ".DOL_URL_ROOT.'/user/fiche.php?id='.$_GET["id"]);
exit;
@ -122,7 +120,7 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == "yes")
{
if ($_GET["id"] <> $user->id)
{
$edituser = new User($db, $_GET["id"]);
$edituser = new User($db);
$edituser->id=$_GET["id"];
$result = $edituser->delete();
if ($result < 0)
@ -242,8 +240,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
if (! $message)
{
$db->begin();
$edituser = new User($db, $_GET["id"]);
$edituser->fetch();
$edituser = new User($db);
$edituser->fetch($_GET["id"]);
$edituser->oldcopy=dol_clone($edituser);
@ -328,8 +326,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
}
else if ($caneditpassword) // Case we can edit only password
{
$edituser = new User($db, $_GET["id"]);
$edituser->fetch();
$edituser = new User($db);
$edituser->fetch($_GET["id"]);
$ret=$edituser->setPassword($user,$_POST["password"]);
if ($ret < 0)
@ -343,8 +341,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
if ((($_REQUEST["action"] == 'confirm_password' && $_REQUEST["confirm"] == 'yes')
|| ($_REQUEST["action"] == 'confirm_passwordsend' && $_REQUEST["confirm"] == 'yes')) && $caneditpassword)
{
$edituser = new User($db, $_GET["id"]);
$edituser->fetch();
$edituser = new User($db);
$edituser->fetch($_GET["id"]);
$newpassword=$edituser->setPassword($user,'');
if ($newpassword < 0)
@ -746,8 +744,8 @@ else
if ($_GET["id"])
{
$fuser = new User($db, $_GET["id"]);
$fuser->fetch();
$fuser = new User($db);
$fuser->fetch($_GET["id"]);
// Connexion ldap
// pour recuperer passDoNotExpire et userChangePassNextLogon

View File

@ -600,8 +600,7 @@ class UserGroup extends CommonObject
foreach($this->members as $key=>$val)
{
$muser=new User($this->db);
$muser->id=$val;
$muser->fetch();
$muser->fetch($val);
$ldapuserid=$muser->login;
// TODO ldapuserid should depends on value $conf->global->LDAP_KEY_USERS;

View File

@ -33,8 +33,7 @@ $langs->load("users");
// Security check
$id = isset($_GET["id"])?$_GET["id"]:'';
$fuser = new User($db);
$fuser->id = $id;
$fuser->fetch();
$fuser->fetch($id);
// Security check
$socid=0;

View File

@ -47,8 +47,8 @@ if ($user->id == $_GET["id"]) // A user can always read its own card
}
$result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
$fuser = new User($db, $_GET["id"]);
$fuser->fetch();
$fuser = new User($db);
$fuser->fetch($_GET["id"]);
$fuser->getrights();

View File

@ -37,8 +37,7 @@ $langs->load("bills");
$langs->load("users");
$fuser = new User($db);
$fuser->id = $id;
$fuser->fetch();
$fuser->fetch($id);
// 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))

View File

@ -63,8 +63,8 @@ $dirleft = "../includes/menus/barre_left";
$dirtheme = "../theme";
// Charge utilisateur edite
$fuser = new User($db, $id);
$fuser->fetch();
$fuser = new User($db);
$fuser->fetch($id);
$fuser->getrights();
// Liste des zone de recherche permanentes supportees

View File

@ -54,7 +54,7 @@ $conf->entity = isset($_POST["entity"])?$_POST["entity"]:1;
if ($_GET["action"] == 'validatenewpassword' && $_GET["username"] && $_GET["passwordmd5"])
{
$edituser = new User($db);
$result=$edituser->fetch($_GET["username"]);
$result=$edituser->fetch('',$_GET["username"]);
if ($result < 0)
{
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$_GET["username"]).'</div>';
@ -93,7 +93,7 @@ if ($_POST["action"] == 'buildnewpassword' && $_POST["username"])
else
{
$edituser = new User($db);
$result=$edituser->fetch($_POST["username"],'',1);
$result=$edituser->fetch('',$_POST["username"],'',1);
if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
{
$message = '<div class="error">'.$langs->trans("ErrorLoginDoesNotExists",$_POST["username"]).'</div>';

View File

@ -96,8 +96,8 @@ llxHeader('',$langs->trans("Permissions"));
$form=new Form($db);
$fuser = new User($db, $_GET["id"]);
$fuser->fetch();
$fuser = new User($db);
$fuser->fetch($_GET["id"]);
$fuser->getrights();
/*

View File

@ -133,12 +133,13 @@ class User extends CommonObject
/**
* \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 $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
* \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;

View File

@ -79,8 +79,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
$fuser = new User($db);
$fuser->id = $obj->rowid;
$fuser->fetch();
$fuser->fetch($obj->rowid);
print $langs->trans("UpdateUser")." rowid=".$fuser->id." ".$fuser->fullname;

View File

@ -43,8 +43,8 @@ require_once(DOL_DOCUMENT_ROOT."/societe/societe.class.php");
$error = 0;
$puser = new user($db, PRELEVEMENT_USER);
$puser->fetch();
$puser = new user($db);
$puser->fetch(PRELEVEMENT_USER);
dol_syslog("Prelevements effectues par ".$puser->fullname." [".PRELEVEMENT_USER."]");
dol_syslog("Raison sociale : ".PRELEVEMENT_RAISON_SOCIALE);

View File

@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/adherents/class/adherent.class.php';
if (empty($user->id))
{
print "Load permissions for admin user with login 'admin'\n";
$user->fetch('admin');
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}

View File

@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/commande/class/commande.class.php';
if (empty($user->id))
{
print "Load permissions for admin user with login 'admin'\n";
$user->fetch('admin');
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}

View File

@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/contrat/contrat.class.php';
if (empty($user->id))
{
print "Load permissions for admin user with login 'admin'\n";
$user->fetch('admin');
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}

View File

@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/compta/facture/class/facture.class.ph
if (empty($user->id))
{
print "Load permissions for admin user with login 'admin'\n";
$user->fetch('admin');
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}

View File

@ -33,8 +33,8 @@ require_once dirname(__FILE__).'/../htdocs/master.inc.php';
if (empty($user->id))
{
print "Load permissions for admin user with login 'admin'\n";
$user->fetch('admin');
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}

View File

@ -32,8 +32,8 @@ require_once dirname(__FILE__).'/../htdocs/comm/propal/propal.class.php';
if (empty($user->id))
{
print "Load permissions for admin user with login 'admin'\n";
$user->fetch('admin');
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}