Index: openacs-4/packages/invoices/lib/projects-billable.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/projects-billable.tcl,v
diff -u -r1.19 -r1.20
--- openacs-4/packages/invoices/lib/projects-billable.tcl	19 Oct 2006 17:06:49 -0000	1.19
+++ openacs-4/packages/invoices/lib/projects-billable.tcl	20 Oct 2006 10:19:26 -0000	1.20
@@ -221,15 +221,7 @@
 	set recipient [person::name -person_id $recipient_id]
 	set name $recipient
     }
-    set dotlrn_club_id [lindex \
-			    [application_data_link::get_linked \
-				 -from_object_id $org_id \
-				 -to_object_type "dotlrn_club"] 0]
-    
-    set pm_base_url [apm_package_url_from_id \
-			 [dotlrn_community::get_package_id_from_package_key \
-			      -package_key "project-manager" \
-			      -community_id $dotlrn_club_id]]
 
+    set pm_base_url [apm_package_url_from_id [acs_object::package_id -object_id $project_id]]
     set project_link [export_vars -base "${pm_base_url}one" {{project_item_id $project_id}}]
 }
Index: openacs-4/packages/invoices/lib/projects-billable.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/lib/projects-billable.xql,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/invoices/lib/projects-billable.xql	19 Oct 2006 17:06:49 -0000	1.11
+++ openacs-4/packages/invoices/lib/projects-billable.xql	20 Oct 2006 10:19:26 -0000	1.12
@@ -178,10 +178,9 @@
 	 	  	and p.invoice_p = true
     			and ofi.offer_id = oi.latest_revision
     			and p.customer_id = oz.organization_id		
-    			and not exists (select 1
+    			and ofi.offer_item_id not in  (select ii.offer_item_id
                     			from iv_invoice_items ii, iv_invoices i, cr_items ci
-                    			where ii.offer_item_id = ofi.offer_item_id
-                    			and i.invoice_id = ii.invoice_id
+                    			where i.invoice_id = ii.invoice_id
                     			and ci.latest_revision = i.invoice_id
                     			and i.cancelled_p = 'f')
     		group by