diff --git a/htdocs/contact.class.php3 b/htdocs/contact.class.php3 new file mode 100644 index 00000000000..426fbe4f997 --- /dev/null +++ b/htdocs/contact.class.php3 @@ -0,0 +1,82 @@ + + * + * $Id$ + * $Source$ + * Classe Company + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +class Contact { + var $bs; + var $db; + + var $id; + var $fullname; + var $nom; + var $prenom; + var $code; + var $email; + + Function Contact($DB, $id=0) { + + $this->db = $DB; + $this->id = $id; + + return 1; + } + /* + * + * + * + */ + + Function fetch($id) { + + $sql = "SELECT c.idp, c.idp, c.name, c.firstname"; + $sql .= " FROM socpeople as c"; + $sql .= " WHERE c.idp = $id"; + + $result = $this->db->query($sql); + + if ($result) { + if ($this->db->num_rows()) { + $obj = $this->db->fetch_object($result , 0); + + $this->id = $obj->idp; + $this->nom = $obj->name; + $this->prenom = $obj->firstname; + + $this->fullname = $this->prenom . ' ' . $this->nom; + + $this->code = $obj->code; + $this->email = $obj->email; + } + $this->db->free(); + + } else { + print $this->db->error(); + } + } + + +} +/* + * $Id$ + * $Source$ + */ +?> diff --git a/htdocs/info.php3 b/htdocs/info.php3 new file mode 100644 index 00000000000..e958bb2caf7 --- /dev/null +++ b/htdocs/info.php3 @@ -0,0 +1,41 @@ + + * + * $Id$ + * $Source$ + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +require("./pre.inc.php3"); + +llxHeader(); +print ''; + +print ''; + +print ''; +print ''; +print ''; +print ''; + +print '
Database
host' . $conf->db->host . '
user' . $conf->db->user . '
pass' . $conf->db->pass . '
Database name' . $conf->db->name . '
'; + + + +$db = new Db(); + +llxFooter(); +?> diff --git a/htdocs/phpinfo.php3 b/htdocs/phpinfo.php3 new file mode 100644 index 00000000000..77d0bf859f2 --- /dev/null +++ b/htdocs/phpinfo.php3 @@ -0,0 +1,23 @@ + + * + * $Id$ + * $Source$ + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ +phpinfo(); +?> diff --git a/htdocs/soc.php3 b/htdocs/soc.php3 new file mode 100644 index 00000000000..99761680c78 --- /dev/null +++ b/htdocs/soc.php3 @@ -0,0 +1,164 @@ + + * + * $Id$ + * $Source$ + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +require("pre.inc.php3"); + +require("./societe.class.php3"); +llxHeader(); +$db = new Db(); +if ($sortorder == "") { + $sortfield="lower(s.nom)"; + $sortorder="ASC"; +} + +if ($page == -1) { $page = 0 ; } +$limit = 26; +$offset = $limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + +if ($action == 'add') { + $soc = new Societe($db); + $soc->nom = $nom; + + $soc->tel = $tel; + $soc->fax = $fax; + $soc->url = $url; + + $soc->client = 1; + + $socid = $soc->create(); +} + +if ($action == 'update') { + $soc = new Societe($db); + + $soc->nom = $nom; + $soc->tel = $tel; + $soc->fax = $fax; + $soc->url = $url; + + $soc->update($socid); +} + +/* + * + * + */ + +if ($action == 'create') { + print 'Nouvelle societe
'; + print '
'; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print '
Nom
Adresse
CP '; + print 'Ville 
Tel
Fax
Web
Siren
Type'; + + print '
Effectif'; + + print '
'; + print '
'; +} elseif ($action == 'edit') { + print 'Edition de la société
'; + + $soc = new Societe($db); + $soc->id = $socid; + $soc->fetch(); + + print '
'; + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + + print ''; + + print ''; + + print ''; + print '
Nom
Adresse
CP '; + print 'Ville 
Tel
Fax
Web
Siren
Type'; + + print '
Effectif'; + + print '
'; + print '
'; +} else { + + $soc = new Societe($db); + $soc->id = $socid; + $soc->fetch(); + print "[Editer]"; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + + print ''; + + print ''; + + print '
Nom'.$soc->nom.'
Adresse
CP '; + print 'Ville 
Tel'.$soc->tel.'
Fax'.$soc->fax.'
Web'.$soc->url.'
Siren
Type'; + + print '
Effectif'; + + print '
'; + + +} + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/societe.class.php3 b/htdocs/societe.class.php3 new file mode 100644 index 00000000000..9289e96b17f --- /dev/null +++ b/htdocs/societe.class.php3 @@ -0,0 +1,153 @@ + + * + * $Id$ + * $Source$ + * Classe Company + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +class Societe { + var $bs; + var $db; + + var $id; + var $nom; + + var $tel; + var $fax; + var $url; + + var $client; + + Function Societe($DB, $id=0) { + global $config; + + $this->db = $DB; + $this->id = $id; + + return 1; + } + + Function create() { + + $sql = "INSERT INTO societe (nom, datec, datea, client) "; + $sql .= " VALUES ('".trim($this->nom)."', now(), now(), $this->client)"; + + if ($this->db->query($sql) ) { + $id = $this->db->last_insert_id(); + + $this->update($id); + + return $id; + } + } + /* + * + * + * + */ + Function update($id) { + + $sql = "UPDATE societe "; + $sql .= " SET nom = '" . trim($this->nom) ."'"; + $sql .= ",cp = '" . trim($this->cp) ."'"; + $sql .= ",ville = '" . trim($this->ville) ."'"; + $sql .= ",tel = '" . trim($this->tel) ."'"; + $sql .= ",fax = '" . trim($this->fax) ."'"; + $sql .= ",url = '" . trim($this->url) ."'"; + $sql .= ",siren = '" . trim($this->siren) ."'"; + $sql .= " WHERE idp = " . $id; + + $this->db->query($sql); + } + /* + * + * + * + */ + Function fetch() { + + $sql = "SELECT s.idp, s.nom,".$this->db->pdate("s.datec")." as dc,".$this->db->pdate("s.datem")." as dm,".$this->db->pdate("s.datea")." as da, s.intern, s.cjn, "; + + $sql .= " s.c_nom, s.c_prenom, s.c_tel, s.c_mail, s.tel, s.fax, s.fplus, s.cjn, s.viewed, st.libelle as stcomm, s.fk_stcomm, s.url,s.cp,s.ville, s.note"; + + $sql .= " FROM societe as s, c_stcomm as st "; + $sql .= " WHERE s.fk_stcomm = st.id"; + + $sql .= " AND s.idp = ".$this->id; + + $result = $this->db->query($sql); + + if ($result) { + if ($this->db->num_rows()) { + $obj = $this->db->fetch_object($result , 0); + + $this->nom = $obj->nom; + + $this->tel = $obj->tel; + $this->fax = $obj->fax; + + $this->url = $obj->url; + $this->cp = $obj->cp; + $this->ville = $obj->ville; + + + $this->cjn = $obj->cjn; + + $this->viewed = $obj->viewed; + + $this->stcomm = $obj->stcomm; + + $this->c_nom = $obj->c_nom; + $this->c_prenom = $obj->c_prenom; + $this->c_tel = $obj->c_tel; + $this->c_fax = $obj->c_fax; + + } + $this->db->free(); + } + } + /* + * + * + * + */ + Function get_nom($id) { + + $sql = "SELECT nom FROM societe WHERE idp=$id;"; + + $result = $this->db->query($sql); + + if ($result) { + if ($this->db->num_rows()) { + $obj = $this->db->fetch_object($result , 0); + + $this->nom = $obj->nom; + + } + $this->db->free(); + } + } + + +} +/* + * $Id$ + * $Source$ + */ +?> diff --git a/htdocs/user.class.php3 b/htdocs/user.class.php3 new file mode 100644 index 00000000000..f5d95d7ae02 --- /dev/null +++ b/htdocs/user.class.php3 @@ -0,0 +1,87 @@ + + * + * $Id$ + * $Source$ + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +class User { + var $bs; + var $db; + + var $id; + var $fullname; + var $nom; + var $prenom; + var $code; + var $email; + + var $comm; + var $compta; + + Function User($DB, $id=0) { + + $this->db = $DB; + $this->id = $id; + + return 1; + } + /* + * + * + * + */ + + Function fetch($login) { + + $sql = "SELECT u.rowid, u.name, u.firstname, u.email, u.code, u.module_comm, u.module_compta"; + $sql .= " FROM llx_user as u"; + $sql .= " WHERE u.login = '$login'"; + + $result = $this->db->query($sql); + + if ($result) { + if ($this->db->num_rows()) { + $obj = $this->db->fetch_object($result , 0); + + $this->id = $obj->rowid; + $this->nom = $obj->name; + $this->prenom = $obj->firstname; + + $this->fullname = $this->prenom . ' ' . $this->nom; + + $this->code = $obj->code; + $this->email = $obj->email; + + $this->comm = $obj->module_comm; + $this->compta = $obj->module_compta; + } + $this->db->free(); + + } else { + print $this->db->error(); + } + } + + +} +/* + * $Id$ + * $Source$ + */ +?>