diff --git a/htdocs/compta/dons/liste.php b/htdocs/compta/dons/liste.php index a0ff260403e..8641faafdea 100644 --- a/htdocs/compta/dons/liste.php +++ b/htdocs/compta/dons/liste.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2004-2010 Laurent Destailleur * * 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 @@ -18,14 +18,15 @@ */ /** - \file htdocs/compta/dons/liste.php - \ingroup don - \brief Page de liste des dons - \version $Id$ + * \file htdocs/compta/dons/liste.php + * \ingroup don + * \brief Page de liste des dons + * \version $Id$ */ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php"); +if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php"); $langs->load("companies"); $langs->load("donations"); @@ -48,6 +49,8 @@ $pagenext = $page + 1; * View */ +if ($conf->projet->enabled) $projectstatic=new Project($db); + llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Subvenciones'); $donationstatic=new Don($db); @@ -55,7 +58,7 @@ $donationstatic=new Don($db); // Genere requete de liste des dons $sql = "SELECT d.rowid, d.datedon, d.prenom, d.nom, d.societe,"; $sql.= " d.amount, d.fk_statut as statut, "; -$sql.= " p.title as projet"; +$sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; $sql.= " ON p.rowid = d.fk_don_projet WHERE 1 = 1"; if ($statut >= 0) @@ -105,12 +108,24 @@ if ($result) $donationstatic->id=$objp->rowid; $donationstatic->ref=$objp->rowid; print "".$donationstatic->getNomUrl(1)."\n"; - print "".stripslashes($objp->prenom)."\n"; - print "".stripslashes($objp->nom)."\n"; - print "".stripslashes($objp->societe)."\n"; + print "".$objp->prenom."\n"; + print "".$objp->nom."\n"; + print "".$objp->societe."\n"; print ''.dol_print_date($db->jdate($objp->datedon)).''; - if ($conf->projet->enabled) { - print "$objp->projet\n"; + if ($conf->projet->enabled) + { + print ""; + if ($objp->pid) + { + $projectstatic->id=$objp->pid; + $projectstatic->ref=$objp->ref; + $projectstatic->id=$objp->pid; + $projectstatic->public=$objp->public; + $projectstatic->title=$objp->title; + print $projectstatic->getNomUrl(1); + } + else print ' '; + print "\n"; } print ''.price($objp->amount).''; print ''.$donationstatic->LibStatut($objp->statut,5).''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index a562c206be6..9efd8016338 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -614,7 +614,7 @@ class Project extends CommonObject $picto='projectpub'; if (! $this->public) $picto='project'; - $label=$langs->trans("ShowProject").': '.$this->ref.($this->label?' - '.$this->label:''); + $label=$langs->trans("ShowProject").': '.$this->ref.($this->title?' - '.$this->title:''); if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin); if ($withpicto && $withpicto != 2) $result.=' ';