Index: openacs-4/packages/invoices/www/invoice-ae.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-ae.tcl,v
diff -u -r1.20 -r1.21
--- openacs-4/packages/invoices/www/invoice-ae.tcl	4 Jan 2006 08:06:48 -0000	1.20
+++ openacs-4/packages/invoices/www/invoice-ae.tcl	10 Jan 2006 11:22:18 -0000	1.21
@@ -155,7 +155,7 @@
     {invoice_specialities:text(inform) {label "[_ invoices.iv_invoice_specialities]"} {value $invoice_specialities} {help_text "[_ invoices.iv_invoice_specialities_help]"}}
     {contact_id:integer(select),optional {label "[_ invoices.iv_invoice_contact]"} {options $contact_options} {help_text "[_ invoices.iv_invoice_contact_help]"}}
     {recipient_id:integer(select),optional {label "[_ invoices.iv_invoice_recipient]"} {options $recipient_options} {help_text "[_ invoices.iv_invoice_recipient_help]"}}
-    {title:text {label "[_ invoices.iv_invoice_Title]"} {html {size 80 maxlength 1000}} {help_text "[_ invoices.iv_invoice_Title_help]"}}
+    {title:text(inform) {label "[_ invoices.iv_invoice_Title]"} {html {size 80 maxlength 1000}} {help_text "[_ invoices.iv_invoice_Title_help]"}}
     {description:text(textarea),optional {label "[_ invoices.iv_invoice_Description]"} {html {rows 5 cols 80}} {help_text "[_ invoices.iv_invoice_Description_help]"}}
 }
 	
Index: openacs-4/packages/invoices/www/invoice-ae.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-ae.xql,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/invoices/www/invoice-ae.xql	27 Dec 2005 16:39:35 -0000	1.11
+++ openacs-4/packages/invoices/www/invoice-ae.xql	10 Jan 2006 11:22:18 -0000	1.12
@@ -135,7 +135,7 @@
                of.credit_percent
 	from cr_items oi, iv_invoice_items i, cr_revisions ir, cr_items pi,
 	     cr_revisions pr, iv_offers of, cr_items vi, cr_items ii, acs_data_links r,
-	     iv_offer_items ofi
+	     pm_projects p, iv_offer_items ofi
 	left outer join category_object_map m on (m.object_id = ofi.offer_item_id)
 	where oi.latest_revision = ofi.offer_id
 	and i.offer_item_id = ofi.offer_item_id
@@ -146,6 +146,7 @@
         and r.object_id_one = pi.item_id
         and r.object_id_two = oi.item_id
 	and pr.revision_id = pi.latest_revision
+	and p.project_id = pr.revision_id
         and of.offer_id = ofi.offer_id
 	order by pi.item_id, i.item_nr
 
Index: openacs-4/packages/invoices/www/offer-ae.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.tcl,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/invoices/www/offer-ae.tcl	8 Jan 2006 11:27:13 -0000	1.18
+++ openacs-4/packages/invoices/www/offer-ae.tcl	10 Jan 2006 11:22:18 -0000	1.19
@@ -521,7 +521,7 @@
     }
     set today [db_string today {}]
     set finish_date ""
-    set finish_time "[template::util::date::now]"
+    set finish_time ""
     if {[exists_and_not_null project_title]} {
 	set title "[_ invoices.iv_offer_1] $project_title"
     } else {
@@ -559,7 +559,11 @@
     }
     set amount_total [format "%.2f" $amount_total]
     set credit_sum $total_credit
-    set finish_date [lc_time_fmt $finish_ansi "%x %X"]
+    if {$mode eq "display"} {
+	set finish_date [lc_time_fmt $finish_ansi "%x %X"]
+    } else {
+	set finish_date $finish_ansi
+    }
     set creation_date [lc_time_fmt $creation_ansi "%x %X"]
     set accepted_date [lc_time_fmt $accepted_ansi "%x %X"]
 
Index: openacs-4/packages/invoices/www/offer-ae.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.xql,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/invoices/www/offer-ae.xql	27 Dec 2005 16:39:35 -0000	1.7
+++ openacs-4/packages/invoices/www/offer-ae.xql	10 Jan 2006 11:22:18 -0000	1.8
@@ -82,7 +82,8 @@
 <fullquery name="get_project">
       <querytext>
 
-	select r.title as project_name, r.item_id
+	select r.title as project_name, r.item_id,
+               to_char(p.planned_end_date,'YYYY-MM-DD HH24:MI:SS') as project_date_ansi
 	from cr_revisions r, cr_items i, pm_projects p
 	where i.item_id = :_project_id
 	and i.latest_revision = r.revision_id
@@ -113,7 +114,7 @@
 <fullquery name="get_project_description">
       <querytext>
 
-	    select r.description
+	    select r.description as comment
 	    from cr_revisions r, cr_items i
 	    where r.revision_id = i.latest_revision
 	    and i.item_id = :_project_id
@@ -127,10 +128,9 @@
 	select t.offer_id as offer_rev_id, r.title, r.description,
 	       t.offer_nr, t.amount_total, t.vat, t.vat_percent, t.comment,
 	       to_char(t.finish_date, 'YYYY-MM-DD HH24:MI:SS') as finish_ansi,
-	       to_char(t.finish_date, :timestamp_format) as finish_date,
 	       o.creation_user, p.first_names, p.last_name,
-	       to_char(o.creation_date, :timestamp_format) as creation_date,
-	       to_char(t.accepted_date, :timestamp_format) as accepted_date,
+	       to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_ansi,
+	       to_char(t.accepted_date, 'YYYY-MM-DD HH24:MI:SS') as accepted_ansi,
 	       t.amount_sum as amount_sum_, t.payment_days, t.date_comment
 	from iv_offers t, cr_revisions r, cr_items i, acs_objects o,
 	     persons p
Index: openacs-4/packages/invoices/www/offer-pdf.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-pdf.tcl,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/invoices/www/offer-pdf.tcl	4 Jan 2006 08:06:48 -0000	1.3
+++ openacs-4/packages/invoices/www/offer-pdf.tcl	10 Jan 2006 11:22:18 -0000	1.4
@@ -45,19 +45,33 @@
 
     # Make sure to set the task only once
     set task_generated_p [db_string task_generated "select count(*) from t_tasks where object_id=:offer_id and status_id <> 2"]
+    
+    # Set the assignee to the account manager of the organization
+    # Otherwise use user_id
 
+    set assignee_ids [contacts::util::get_account_manager -organization_id $organization_id]
+    
+    if {$assignee_ids eq ""} {
+	set assignee_ids $user_id
+    }
+			      
+
     if {!$task_generated_p && [apm_package_installed_p "tasks"]} {
 
-	# Create a task for the saved offer
-	set task_id [tasks::task::new \
-			 -title "Nachfassen Angebot" \
-			 -description "Angebot Nr. <a href=\"[export_vars -base "[ad_url][ad_conn package_url]offer-ae" -url {offer_id {mode display}}]\">$offer_nr" \
-			 -mime_type "text/plain" \
-			 -party_id $contact_id \
-			 -due_date ${due_date} \
-			 -object_id $offer_id \
-			 -mime_type "text/html" \
-			 -priority "1"]
+	foreach assignee_id $assignee_ids {
+	    # Create a task for the saved offer
+	    set task_id [tasks::task::new \
+			     -title "Nachfassen Angebot" \
+			     -description "Angebot Nr. <a href=\"[export_vars -base "[ad_url][ad_conn package_url]offer-ae" -url {offer_id {mode display}}]\">$offer_nr" \
+			     -mime_type "text/plain" \
+			     -party_id $contact_id \
+			     -due_date ${due_date} \
+			     -object_id $offer_id \
+			     -mime_type "text/html" \
+			     -priority "1" \
+			     -assignee_id $assignee_id
+			]
+	}
     }
 }
 
Index: openacs-4/packages/invoices/www/offer-send.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-send.tcl,v
diff -u -r1.16 -r1.17
--- openacs-4/packages/invoices/www/offer-send.tcl	27 Dec 2005 20:17:41 -0000	1.16
+++ openacs-4/packages/invoices/www/offer-send.tcl	10 Jan 2006 11:22:18 -0000	1.17
@@ -17,6 +17,10 @@
 db_1row offer_data {}
 set project_id [lindex [application_data_link::get_linked -from_object_id $offer_id -to_object_type content_item] 0]
 db_1row project_data {}
+
+# We don't want to use a seperate offer number but use the project_title
+set offer_nr $project_title
+
 set locale [lang::user::site_wide_locale -user_id $contact_id]
 
 set context [list [list [export_vars -base offer-list {organization_id}] "[_ invoices.iv_offer_2]"] [list [export_vars -base offer-ae {offer_id}] "[_ invoices.iv_offer_View]"] $page_title]