From 8df4a29688adc52137e86a33011612f7f2e24ee4 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sat, 21 Dec 2002 17:35:17 +0000 Subject: [PATCH] . --- htdocs/compta/dons/index.php | 9 +-- htdocs/compta/dons/liste.php | 13 ++-- htdocs/don.class.php | 44 +++++++----- htdocs/pre.inc.php3 | 2 +- htdocs/public/dons/code_valid.php | 19 +++--- htdocs/public/dons/don.xhtml | 2 +- htdocs/public/dons/index.php | 108 ++++++++++++++++-------------- htdocs/public/dons/valid.xhtml | 12 ++-- htdocs/public/password.php | 4 +- htdocs/user.class.php3 | 2 + htdocs/user/fiche.php3 | 2 +- httpd.public.conf.dist | 31 +++++++++ 12 files changed, 145 insertions(+), 103 deletions(-) create mode 100644 httpd.public.conf.dist diff --git a/htdocs/compta/dons/index.php b/htdocs/compta/dons/index.php index 95edcdf3ed2..58a82e3da7f 100644 --- a/htdocs/compta/dons/index.php +++ b/htdocs/compta/dons/index.php @@ -63,14 +63,7 @@ for ($i = 0 ; $i < 4 ; $i++) { $var=!$var; print ""; - if ($somme[$i]) - { - print ''.$libelle[$i].''; - } - else - { - print ''.$libelle[$i].''; - } + print ''.$libelle[$i].''; print ''.price($somme[$i]).''; print ""; } diff --git a/htdocs/compta/dons/liste.php b/htdocs/compta/dons/liste.php index b4315621942..8760bccb006 100644 --- a/htdocs/compta/dons/liste.php +++ b/htdocs/compta/dons/liste.php @@ -45,12 +45,8 @@ if ($action == 'add') { } -if ($sortorder == "") { - $sortorder="DESC"; -} -if ($sortfield == "") { - $sortfield="d.datedon"; -} +if ($sortorder == "") { $sortorder="DESC"; } +if ($sortfield == "") { $sortfield="d.datedon"; } if ($page == -1) { $page = 0 ; } @@ -70,7 +66,7 @@ if ($result) $num = $db->num_rows(); $i = 0; - print_barre_liste("Dons", $page, $PHP_SELF); + print_barre_liste("Dons", $page, $PHP_SELF, "&statut=$statut"); print ""; print ''; @@ -87,7 +83,7 @@ if ($result) $objp = $db->fetch_object( $i); $var=!$var; print ""; - print "\n"; + print "\n"; print "\n"; print "\n"; print ''; @@ -99,6 +95,7 @@ if ($result) } else { + print $sql; print $db->error(); } diff --git a/htdocs/don.class.php b/htdocs/don.class.php index 2aec0ea7883..905acccfdd5 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -34,7 +34,8 @@ class Don var $public; var $projetid; var $modepaiement; - var $note; + var $modepaiementid; + var $commentaire; var $statut; var $projet; @@ -51,7 +52,7 @@ class Don Function Don($DB, $soc_idp="") { $this->db = $DB ; - $this->modepaiement = 0; + $this->modepaiementid = 0; } /* * @@ -126,7 +127,7 @@ class Don $this->date = $this->db->idate($this->date); $sql = "INSERT INTO llx_don (datec, amount, fk_paiement, nom, adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon)"; - $sql .= " VALUES (now(), $this->amount, $this->modepaiement,'$this->nom','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->note', $userid, '$this->date')"; + $sql .= " VALUES (now(), $this->amount, $this->modepaiementid,'$this->nom','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->commentaire', $userid, '$this->date')"; $result = $this->db->query($sql); @@ -176,9 +177,9 @@ class Don */ Function fetch($rowid) { - $sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.nom, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.public, d.amount, d.fk_paiement"; - $sql .= " FROM llx_don as d, llx_don_projet as p"; - $sql .= " WHERE p.rowid = d.fk_don_projet AND d.rowid = $rowid"; + $sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.nom, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.public, d.amount, d.fk_paiement, d.note, cp.libelle"; + $sql .= " FROM llx_don as d, llx_don_projet as p, c_paiement as cp"; + $sql .= " WHERE p.rowid = d.fk_don_projet AND cp.id = d.fk_paiement AND d.rowid = $rowid"; if ( $this->db->query( $sql) ) { @@ -187,16 +188,18 @@ class Don $obj = $this->db->fetch_object(0); - $this->date = $obj->datedon; - $this->nom = $obj->nom; - $this->statut = $obj->fk_statut; - $this->adresse = $obj->adresse; - $this->cp = $obj->cp; - $this->ville = $obj->ville; - $this->projet = $obj->projet; - $this->public = $obj->public; - $this->modepaiement = $obj->modepaiement; - $this->amount = $obj->amount; + $this->date = $obj->datedon; + $this->nom = stripslashes($obj->nom); + $this->statut = $obj->fk_statut; + $this->adresse = stripslashes($obj->adresse); + $this->cp = stripslashes($obj->cp); + $this->ville = stripslashes($obj->ville); + $this->projet = $obj->projet; + $this->public = $obj->public; + $this->modepaiementid = $obj->fk_paiement; + $this->modepaiement = $obj->libelle; + $this->amount = $obj->amount; + $this->commentaire = stripslashes($obj->note); } } else @@ -235,10 +238,15 @@ class Don * Classé comme payé, le don a été recu * */ - Function set_paye($rowid) + Function set_paye($rowid, $modepaiement='') { + $sql = "UPDATE llx_don SET fk_statut = 2"; - $sql = "UPDATE llx_don SET fk_statut = 2 WHERE rowid = $rowid AND fk_statut = 1;"; + if ($modepaiement) + { + $sql .= ", fk_paiement=$modepaiement"; + } + $sql .= " WHERE rowid = $rowid AND fk_statut = 1;"; if ( $this->db->query( $sql) ) { diff --git a/htdocs/pre.inc.php3 b/htdocs/pre.inc.php3 index 5609639db6d..2efe5bf7680 100644 --- a/htdocs/pre.inc.php3 +++ b/htdocs/pre.inc.php3 @@ -60,7 +60,7 @@ function llxHeader($head = "") { $menu->add("/fichinter/", "Fiches d'intervention"); } - if ($conf->produit->enabled ) + if ($conf->produit->enabled ) { $menu->add("/product/", "Produits"); } diff --git a/htdocs/public/dons/code_valid.php b/htdocs/public/dons/code_valid.php index e9df8c5c882..1cf009f6136 100644 --- a/htdocs/public/dons/code_valid.php +++ b/htdocs/public/dons/code_valid.php @@ -20,15 +20,16 @@ * */ -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; ?> diff --git a/htdocs/public/dons/don.xhtml b/htdocs/public/dons/don.xhtml index fbe4ea27df4..fc6b7f80739 100644 --- a/htdocs/public/dons/don.xhtml +++ b/htdocs/public/dons/don.xhtml @@ -66,7 +66,7 @@ - + diff --git a/htdocs/public/dons/index.php b/htdocs/public/dons/index.php index a5b011cffd1..c778ac55585 100644 --- a/htdocs/public/dons/index.php +++ b/htdocs/public/dons/index.php @@ -24,69 +24,77 @@ require("../../don.class.php"); require("../../lib/mysql.lib.php3"); require("../../conf/conf.class.php3"); -if ($HTTP_POST_VARS["action"] == 'add') +$conf = new Conf(); + +if ($conf->don->enabled) { - $conf = new Conf(); - $db = new Db(); - $don = new Don($db); - - $don->projetid = $HTTP_POST_VARS["projetid"]; - $don->date = time(); - $don->nom = $HTTP_POST_VARS["nom"]; - $don->adresse = $HTTP_POST_VARS["adresse"]; - $don->cp = $HTTP_POST_VARS["cp"]; - $don->ville = $HTTP_POST_VARS["ville"]; - $don->public = $HTTP_POST_VARS["public"]; - $don->email = $HTTP_POST_VARS["email"]; - $don->amount = $HTTP_POST_VARS["montant"]; - - - if ($don->check()) + if ($HTTP_POST_VARS["action"] == 'add') { - require("valid.php"); - } - else - { - require("erreur.php"); - } - -} -elseif ($HTTP_POST_VARS["action"] == 'valid') -{ - $conf = new Conf(); - $db = new Db(); - $don = new Don($db); - - $don->projetid = $HTTP_POST_VARS["projetid"]; - $don->date = time(); - $don->nom = $HTTP_POST_VARS["nom"]; - $don->adresse = $HTTP_POST_VARS["adresse"]; - $don->cp = $HTTP_POST_VARS["cp"]; - $don->ville = $HTTP_POST_VARS["ville"]; - $don->public = $HTTP_POST_VARS["public"]; - $don->email = $HTTP_POST_VARS["email"]; - $don->amount = $HTTP_POST_VARS["montant"]; - - - if ($don->check()) - { - $return = $don->create(0); - - if ($return) + $db = new Db(); + $don = new Don($db); + + $don->projetid = $HTTP_POST_VARS["projetid"]; + $don->date = time(); + $don->nom = $HTTP_POST_VARS["nom"]; + $don->adresse = $HTTP_POST_VARS["adresse"]; + $don->cp = $HTTP_POST_VARS["cp"]; + $don->ville = $HTTP_POST_VARS["ville"]; + $don->public = $HTTP_POST_VARS["public"]; + $don->email = $HTTP_POST_VARS["email"]; + $don->amount = $HTTP_POST_VARS["montant"]; + $don->commentaire = $HTTP_POST_VARS["commentaire"]; + + + if ($don->check()) { - require("merci.php"); + require("valid.php"); + } + else + { + require("erreur.php"); + } + } + elseif ($HTTP_POST_VARS["action"] == 'valid') + { + + $db = new Db(); + $don = new Don($db); + + $don->projetid = $HTTP_POST_VARS["projetid"]; + $don->date = time(); + $don->nom = $HTTP_POST_VARS["nom"]; + $don->adresse = $HTTP_POST_VARS["adresse"]; + $don->cp = $HTTP_POST_VARS["cp"]; + $don->ville = $HTTP_POST_VARS["ville"]; + $don->public = $HTTP_POST_VARS["public"]; + $don->email = $HTTP_POST_VARS["email"]; + $don->amount = $HTTP_POST_VARS["montant"]; + $don->commentaire = $HTTP_POST_VARS["commentaire"]; + + if ($don->check()) + { + $return = $don->create(0); + + if ($return) + { + require("merci.php"); + } + } + else + { + require("erreur.php"); } } else { - require("erreur.php"); + require("don.php"); } } else { -require("don.php"); + print "Cette fonctionnalité n'est pas activé sur ce site"; } diff --git a/htdocs/public/dons/valid.xhtml b/htdocs/public/dons/valid.xhtml index efc506c3bfc..f5fc6c35f20 100644 --- a/htdocs/public/dons/valid.xhtml +++ b/htdocs/public/dons/valid.xhtml @@ -38,31 +38,31 @@ @@ -74,7 +74,7 @@ diff --git a/htdocs/public/password.php b/htdocs/public/password.php index 836eb3b05ca..f5305b30da1 100644 --- a/htdocs/public/password.php +++ b/htdocs/public/password.php @@ -44,12 +44,14 @@ if ($result) $user = new User($db); $user->login = "admin"; - + $user->admin = 1; $user->create(); $user->id = 1; $user->password("admin"); + + print "Compte admin/admin créé"; } } } diff --git a/htdocs/user.class.php3 b/htdocs/user.class.php3 index dc9baf6b1eb..7fc959a096e 100644 --- a/htdocs/user.class.php3 +++ b/htdocs/user.class.php3 @@ -124,6 +124,8 @@ class User { { if ($this->db->affected_rows()) { + $this->id = $this->db->last_insert_id(); + $this->update(); return 1; } } diff --git a/htdocs/user/fiche.php3 b/htdocs/user/fiche.php3 index 67df40ac04a..fdf40946a3a 100644 --- a/htdocs/user/fiche.php3 +++ b/htdocs/user/fiche.php3 @@ -191,7 +191,7 @@ else print ''; print ''; - print ''; + print ''; print '
rowid&action=edit\">$objp->nomrowid&action=edit\">".stripslashes($objp->nom)."rowid&action=edit\">".strftime("%d %B %Y",$objp->datedon)."$objp->projet'.price($objp->amount).' 
Email
Description'; diff --git a/httpd.public.conf.dist b/httpd.public.conf.dist new file mode 100644 index 00000000000..c6e4f90861f --- /dev/null +++ b/httpd.public.conf.dist @@ -0,0 +1,31 @@ +# +# +# Sample httpd.public.conf for dolibarr +# +# $Id$ +# $Source$ +# + + ServerAdmin webmaster.fr@lolix.org + DocumentRoot /spare/home/www/dolibarr/dolibarr/htdocs + ServerName public-doli.lafrere.lan + ErrorLog /spare/home/www/dolibarr/logs/error.log + CustomLog /spare/home/www/dolibarr/logs/access.log combined + + ErrorDocument 401 /public/error-401.html + + + Options Indexes FollowSymLinks + AllowOverride All + Order deny,allow + Allow from all + + + + Options Indexes FollowSymLinks + AllowOverride All + Order deny,allow + Allow from all + + + \ No newline at end of file