From 4157b32a7f3d34b266b8522a53f43e1785d9846c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Tue, 12 Jan 2010 09:22:05 +0000
Subject: [PATCH] New: Can filter on project on agenda

---
 htdocs/comm/action/fiche.php | 7 ++++---
 htdocs/comm/action/index.php | 1 +
 htdocs/html.form.class.php   | 5 +++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 393b31a6851..a58b88128d7 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005      Simon TOSSER         <simon@kornog-computing.com>
  * Copyright (C) 2005-2009 Regis Houssin        <regis@dolibarr.fr>
  *
@@ -688,6 +688,7 @@ if ($_GET["id"])
 		print $html->select_societes($act->societe->id,'socid',1,1);
 		print '</td>';
 
+		// Contact
 		print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
 		$html->select_array("contactid",  $act->societe->contact_array(), $act->contact->id, 1);
 		print '</td></tr>';
@@ -714,12 +715,12 @@ if ($_GET["id"])
 		print $act->author->getNomUrl(1);
 		print '</td></tr>';
 
-		// Affecte a
+		// Affected to
 		print '<tr><td nowrap>'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
 		$html->select_users($act->usertodo->id,'affectedto',1);
 		print '</td></tr>';
 
-		// Realise par
+		// Realised by
 		print '<tr><td nowrap>'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
 		$html->select_users($act->userdone->id,'doneby',1);
 		print '</td></tr>';
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 69ede4995a3..10b3dde8bd5 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -238,6 +238,7 @@ $sql.= ', '.MAIN_DB_PREFIX.'user as u';
 $sql.= ' WHERE a.fk_action = ca.id';
 $sql.= ' AND a.fk_user_author = u.rowid';
 $sql.= ' AND u.entity in (0,'.$conf->entity.')';
+if ($_REQUEST["projectid"]) $sql.=" AND a.fk_project=".addslashes($_REQUEST["projectid"]);
 if ($_GET["action"] == 'show_day')
 {
 	$sql.= ' AND (';
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 931d66f85d3..5bfc04b6a5d 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -2263,6 +2263,7 @@ class Form
 	 *		@param	d				1=Affiche aussi les jours, mois, annees
 	 * 		@param	addnowbutton	Add a button "Now"
 	 * 		@param	nooutput		Do not output zone but return it
+	 * 		@return	nothing or string if nooutput is 1
 	 */
 	function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowbutton=0, $nooutput=0)
 	{
@@ -2323,7 +2324,7 @@ class Form
 				if ("$conf->use_popup_calendar" == "eldy")	// Laisser conf->use_popup_calendar entre quote
 				{
 					// Zone de saisie manuelle de la date
-					$retstring ='<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="9" maxlength="11" value="'.$formated_date.'"';
+					$retstring.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="9" maxlength="11" value="'.$formated_date.'"';
 					$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\'); "';
 					$retstring.='>';
 
@@ -2531,7 +2532,7 @@ class Form
 
 		if (! empty($nooutput)) return $retstring;
 
-		print $restring;
+		print $retstring;
 		return;
 	}
 
-- 
GitLab