diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index 8a4ff98c1c0..675881e95c6 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -59,8 +59,7 @@ if ($action == 'add') print "Erreur"; $action = "create"; } - -} +} if ($action == 'delete') { @@ -130,10 +129,6 @@ if ($action == 'create') { print '
| Date du don : | ";
print_date_select();
diff --git a/htdocs/don.class.php b/htdocs/don.class.php
index 24c04835a3c..10823187d28 100644
--- a/htdocs/don.class.php
+++ b/htdocs/don.class.php
@@ -159,7 +159,7 @@ class Don
}
/*
- *
+ * Création
*
*
*/
@@ -188,6 +188,48 @@ class Don
}
}
+ /*
+ * Mise à jour
+ *
+ *
+ */
+ Function update($userid)
+ {
+
+ $this->date = $this->db->idate($this->date);
+
+ $sql = "UPDATE llx_don SET ";
+ $sql .= "amount = " . $this->amount;
+ $sql .= ",fk_paiement = ".$this->modepaiementid;
+ $sql .= ",prenom = '".$this->prenom ."'";
+ $sql .= ",nom='".$this->nom."'";
+ $sql .= ",societe='".$this->societe."'";
+ $sql .= ",adresse='".$this->adresse."'";
+ $sql .= ",cp='".$this->cp."'";
+ $sql .= ",ville='".$this->ville."'";
+ $sql .= ",pays='".$this->pays."'";
+ $sql .= ",public=".$this->public;
+ $sql .= ",fk_don_projet=".$this->projetid;
+ $sql .= ",note='".$this->commentaire."'";
+ $sql .= ",datedon='".$this->date."'";
+ $sql .= ",email='".$this->email."'";
+
+ $sql .= " WHERE rowid = $this->id";
+
+ $result = $this->db->query($sql);
+
+ if ($result)
+ {
+ return 1;
+ }
+ else
+ {
+ print $this->db->error();
+ print "";
+ return 0;
+ }
+ }
+
/*
* Suppression du don
*
@@ -222,7 +264,7 @@ class Don
*/
Function fetch($rowid)
{
- $sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email";
+ $sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet";
$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";
@@ -245,6 +287,7 @@ class Don
$this->email = stripslashes($obj->email);
$this->pays = stripslashes($obj->pays);
$this->projet = $obj->projet;
+ $this->projetid = $obj->fk_don_projet;
$this->public = $obj->public;
$this->modepaiementid = $obj->fk_paiement;
$this->modepaiement = $obj->libelle;
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index ccc8be0d97b..b564457423c 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -49,7 +49,7 @@ class Form {
$num = $this->db->num_rows();
$i = 0;
- if (strlen($id))
+ if (strlen("$id"))
{
while ($i < $num)
{
|