*** empty log message ***

This commit is contained in:
Rodolphe Quiedeville 2002-12-18 18:02:06 +00:00
parent 7d161086bd
commit b38a7701c5
2 changed files with 133 additions and 47 deletions

View File

@ -34,17 +34,18 @@ class User {
var $comm; var $comm;
var $compta; var $compta;
var $webcal_login; var $webcal_login;
var $errorstr;
var $limite_liste; var $limite_liste;
Function User($DB, $id=0) { Function User($DB, $id=0)
{
$this->db = $DB; $this->db = $DB;
$this->id = $id; $this->id = $id;
$this->limite_liste = 20; $this->limite_liste = 20;
return 1; return 1;
} }
/* /*
* *
@ -52,7 +53,8 @@ class User {
* *
*/ */
Function fetch($login='') { Function fetch($login='')
{
$sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.code, u.admin, u.module_comm, u.module_compta, u.login, u.webcal_login"; $sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.code, u.admin, u.module_comm, u.module_compta, u.login, u.webcal_login";
$sql .= " FROM llx_user as u"; $sql .= " FROM llx_user as u";
@ -65,35 +67,134 @@ class User {
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result)
if ($this->db->num_rows()) { {
$obj = $this->db->fetch_object($result , 0); if ($this->db->num_rows())
{
$obj = $this->db->fetch_object($result , 0);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->nom = $obj->name; $this->nom = $obj->name;
$this->prenom = $obj->firstname; $this->prenom = $obj->firstname;
$this->fullname = $this->prenom . ' ' . $this->nom; $this->fullname = $this->prenom . ' ' . $this->nom;
$this->admin = $obj->admin; $this->admin = $obj->admin;
$this->webcal_login = $obj->webcal_login; $this->webcal_login = $obj->webcal_login;
$this->code = $obj->code; $this->code = $obj->code;
$this->email = $obj->email; $this->email = $obj->email;
$this->comm = $obj->module_comm; $this->comm = $obj->module_comm;
$this->compta = $obj->module_compta; $this->compta = $obj->module_compta;
$this->login = $obj->login;
$this->pass = $obj->pass;
$this->webcal_login = $obj->webcal_login;
}
$this->db->free();
$this->login = $obj->login;
$this->webcal_login = $obj->webcal_login;
} }
$this->db->free(); else
{
} else { print $this->db->error();
print $this->db->error(); }
}
} }
/*
*
*
*
*/
Function update()
{
$sql = "SELECT login FROM llx_user WHERE login ='$this->login'";
if ($this->db->query($sql))
{
$num = $this->db->num_rows();
$this->db->free();
if ($num)
{
$this->errorstr = "Ce login existe déjà";
return 0;
}
else
{
$sql = "UPDATE llx_user SET ";
$sql .= " name = '$this->nom'";
$sql .= ", firstname = '$this->prenom'";
$sql .= ", login = '$this->login'";
$sql .= ", email = '$this->email'";
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->affected_rows())
{
return 1;
}
}
else
{
print $this->db->error();
}
}
}
}
/*
*
*
*/
Function error()
{
return $this->errorstr;
}
/*
* Change le mot de passe et l'envoie par mail
*
*
*/
Function password()
{
$password = substr(crypt(uniqid("")),0,8);
$sql = "UPDATE llx_user SET pass = '".crypt($password, "CRYPT_STD_DES")."'";
$sql .= " WHERE rowid = $this->id";
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->affected_rows())
{
$mesg = "Login : $this->login\nMot de passe : $password";
if (mail($this->email, "Mot de passe Dolibarr", $mesg))
{
return 1;
}
}
}
else
{
print $this->db->error();
}
}
/*
*
*
*
*/
} }
/* /*
* $Id$ * $Id$

View File

@ -1,8 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,6 +15,8 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$
* $Source$
*/ */
require("../main.inc.php3"); require("../main.inc.php3");
@ -37,20 +36,6 @@ function llxHeader($head = "", $urlp = "") {
$menu->add("/info.php3", "Configuration"); $menu->add("/info.php3", "Configuration");
$menu->add("/product/index.php3", "Produits");
$menu->add("/service/index.php3", "Services");
$menu->add("/comm/index.php3", "Clients");
$menu->add("/fourn/index.php3", "Fournisseurs");
$menu->add_submenu("/soc.php3?&action=create","Nouvelle sociétée");
$menu->add_submenu("contact.php3","Contacts");
left_menu($menu->liste); left_menu($menu->liste);
} }