Index: openacs-4/packages/contacts/lib/contact-complaint-list-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list-portlet.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/contacts/lib/contact-complaint-list-portlet.adp	16 Oct 2005 12:43:54 -0000	1.2
+++ openacs-4/packages/contacts/lib/contact-complaint-list-portlet.adp	8 Sep 2006 13:48:09 -0000	1.3
@@ -24,5 +24,12 @@
   </td>
 </tr>
 </table>
+	<form action="/contacts/add-edit-complaint">
+	#contacts.Add_complaint_to#: @select_menu;noquote@
+	     <input type="hidden" name="customer_id" value="@customer_id@">
+	     <input type="submit" value="#contacts.Add_1#">
+	</form>
 
 
+
+
Index: openacs-4/packages/contacts/lib/contact-complaint-list-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list-portlet.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/contacts/lib/contact-complaint-list-portlet.tcl	16 Oct 2005 12:43:54 -0000	1.2
+++ openacs-4/packages/contacts/lib/contact-complaint-list-portlet.tcl	8 Sep 2006 13:48:09 -0000	1.3
@@ -5,4 +5,33 @@
     }
 }
 
+# We are going to get a list of all members of the group Freelancer
+# that have worked in a project for customer_id (party_id in this case).
+# So first we get all projects were the party_id is customer
+
+set project_list [db_list get_projects { select item_id from pm_projectsx where customer_id = :customer_id }]
+
+if {![empty_string_p $project_list]} {
+    # Now we search for all the members of the Freelancer
+    # group that are assigned to one of this projects.
+    
+    # Get the group members list
+    set group_id [group::get_id -group_name "Freelancer"]
+    set group_members_list [group::get_members -group_id $group_id]
+    # Now we create the select menu to use
+    if {![empty_string_p $group_members_list]} {
+	set select_menu "<select name=\"supplier_id\">"
+	append select_menu "<option value=\"-100\" selected> - - - - - -</option>"
+	
+	db_foreach get_members {  } {
+	    append select_menu "<option value=\"$supplier_id\">[contact::name -party_id $supplier_id]</option>"
+	}
+	append select_menu "</select>"
+    } else {
+	set select_menu ""
+    }
+} else {
+    set select_menu ""
+}
+
 set portlet_layout [parameter::get -parameter "DefaultPortletLayout"]
\ No newline at end of file
Index: openacs-4/packages/contacts/lib/contact-complaint-list-portlet.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list-portlet.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/contacts/lib/contact-complaint-list-portlet.xql	8 Sep 2006 13:48:09 -0000	1.1
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<queryset>
+
+<fullquery name="get_members">
+    <querytext>
+	select
+		distinct
+		pa.party_id as supplier_id
+	from
+		pm_project_assignment pa
+	where
+		pa.project_id in ([template::util::tcl_to_sql_list $project_list])
+		and pa.party_id in ([template::util::tcl_to_sql_list $group_members_list])
+    </querytext>
+</fullquery>
+
+</queryset>
Index: openacs-4/packages/contacts/lib/contact-complaint-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/lib/contact-complaint-list.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/contacts/lib/contact-complaint-list.adp	4 Oct 2005 21:27:07 -0000	1.4
+++ openacs-4/packages/contacts/lib/contact-complaint-list.adp	8 Sep 2006 13:48:09 -0000	1.5
@@ -13,5 +13,3 @@
   </tr>
 </table>
 
-
-