From 7d7f7223b022a238659f110360ac66c1edd5f499 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Nov 2009 01:12:54 +0000 Subject: [PATCH] Fix: Debug on donation module --- htdocs/compta/dons/fiche.php | 30 +++++++++++++-------------- htdocs/don.class.php | 39 ++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index bbfe116ee81..796010a8906 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -225,7 +225,7 @@ if ($_GET["action"] == 'create') if ($conf->projet->enabled) $nbrows++; print ''.$langs->trans("Comments").' :
'; - print ""; + print ""; print "".$langs->trans("PaymentMode")."\n"; $html->select_types_paiements('', 'modepaiement', 'CRDT', 0); @@ -235,23 +235,23 @@ if ($_GET["action"] == 'create') { // Si module projet actif print "".$langs->trans("Project").""; - select_projects('','','',"projetid"); + select_projects('',$_POST["projetid"],"projetid"); print "\n"; } print "".$langs->trans("PublicDonation").""; - print $html->selectyesno("public",1,1); + print $html->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1); print "\n"; - print "".''.$langs->trans("Company").''; - print "".''.$langs->trans("Firstname").''; - print "".''.$langs->trans("Lastname").''; + print "".''.$langs->trans("Company").''; + print "".''.$langs->trans("Firstname").''; + print "".''.$langs->trans("Lastname").''; print "".''.$langs->trans("Address").''; - print ''; - print "".''.$langs->trans("Zip").' / '.$langs->trans("Town").' '; - print "".''.$langs->trans("Country").''; - print "".''.$langs->trans("EMail").''; - print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->monnaie).''; + print ''; + print "".''.$langs->trans("Zip").' / '.$langs->trans("Town").' '; + print "".''.$langs->trans("Country").''; + print "".''.$langs->trans("EMail").''; + print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->monnaie).''; print "".''; print "\n"; print "\n"; @@ -357,11 +357,11 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit') $h=0; $head[$h][0] = DOL_URL_ROOT."/compta/dons/fiche.php?rowid=".$_GET["rowid"]; - $head[$h][1] = $langs->trans("Donation"); + $head[$h][1] = $langs->trans("Card"); $hselected=$h; $h++; - dol_fiche_head($head, $hselected, $langs->trans("Ref").": ".$_GET["rowid"]); + dol_fiche_head($head, $hselected, $langs->trans("Donation")); print "
"; print ''; @@ -391,7 +391,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit') } print "".$langs->trans("PublicDonation").""; - print $yn[$don->public]; + print yn($don->public); print "\n"; print "".''.$langs->trans("Company").''.$don->societe.''; @@ -455,7 +455,7 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit') print '
'; /* - * Documents g�n�r�s + * Documents generes */ $filename=dol_sanitizeFileName($don->id); $filedir=$conf->don->dir_output . '/' . get_exdir($filename,2); diff --git a/htdocs/don.class.php b/htdocs/don.class.php index 87133018dfe..d4e9f588a16 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -308,8 +308,8 @@ class Don extends CommonObject } /** - * \brief Mise � jour du don - * \param user Objet utilisateur qui met � jour le don + * \brief Mise a jour du don + * \param user Objet utilisateur qui met a jour le don * \return int >0 si ok, <0 si ko */ function update($user) @@ -329,7 +329,7 @@ class Don extends CommonObject $sql .= ",pays='".$this->pays."'"; $sql .= ",public=".$this->public; $sql .= ",fk_don_projet=".($this->projetid>0?$this->projetid:'null'); - $sql .= ",note='".$this->note."'"; + $sql .= ",note='".addslashes($this->note)."'"; $sql .= ",datedon='".$this->date."'"; $sql .= ",email='".$this->email."'"; $sql .= ",fk_statut=".$this->statut; @@ -386,40 +386,41 @@ class Don extends CommonObject $sql = "SELECT d.rowid, ".$this->db->pdate("d.datec")." as datec,"; $sql.= " ".$this->db->pdate("d.datedon")." as datedon,"; $sql.= " d.prenom, d.nom, d.societe, d.amount, 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.= " p.title as projet"; + $sql.= " p.title as projet"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."don as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p"; $sql.= " ON p.rowid = d.fk_don_projet"; $sql.= " WHERE cp.id = d.fk_paiement AND d.rowid = ".$rowid; dol_syslog("Don::fetch sql=".$sql); - if ( $this->db->query( $sql) ) + $resql=$this->db->query($sql); + if ($resql) { - if ($this->db->num_rows()) + if ($this->db->num_rows($resql)) { - - $obj = $this->db->fetch_object(); + $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; $this->ref = $obj->rowid; $this->datec = $obj->datec; $this->date = $obj->datedon; - $this->prenom = stripslashes($obj->prenom); - $this->nom = stripslashes($obj->nom); - $this->societe = stripslashes($obj->societe); + $this->prenom = $obj->prenom; + $this->nom = $obj->nom; + $this->societe = $obj->societe; $this->statut = $obj->fk_statut; - $this->adresse = stripslashes($obj->adresse); - $this->cp = stripslashes($obj->cp); - $this->ville = stripslashes($obj->ville); - $this->email = stripslashes($obj->email); - $this->pays = stripslashes($obj->pays); + $this->adresse = $obj->adresse; + $this->cp = $obj->cp; + $this->ville = $obj->ville; + $this->email = $obj->email; + $this->pays = $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; $this->amount = $obj->amount; - $this->commentaire = stripslashes($obj->note); + $this->note = $obj->note; + $this->commentaire = $obj->note; // deprecated } return 1; } @@ -544,7 +545,7 @@ class Don extends CommonObject return $result; } - + /** * \brief Return clicable name (with picto eventually) * \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul @@ -567,6 +568,6 @@ class Don extends CommonObject if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin; return $result; - } + } } ?>