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.1 -r1.2 --- openacs-4/packages/invoices/www/offer-pdf.tcl 19 Dec 2005 20:10:04 -0000 1.1 +++ openacs-4/packages/invoices/www/offer-pdf.tcl 27 Dec 2005 16:39:35 -0000 1.2 @@ -1,5 +1,6 @@ ad_page_contract { add offer-pdf to offer / accepted offer folder + and create task to call customer again @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-10-05 @@ -16,6 +17,7 @@ acs_object::get -object_id $project_id -array project set pm_url [lindex [site_node::get_url_from_object_id -object_id $project(package_id)] 0] set return_url [export_vars -base "${pm_url}one" {{project_item_id $project_id}}] + db_1row project_data {} } else { set return_url [export_vars -base offer-list {organization_id}] } @@ -35,6 +37,27 @@ set file_item_id [content::revision::item_id -revision_id $file_id] content::item::move -item_id $file_item_id -target_folder_id $offer_folder_id application_data_link::new -this_object_id $offer_id -target_object_id $file_id + db_dml set_publish_status {} + + # Set the task by default to phone three days later. + set due_date [clock format [clock scan "3 days" -base [clock scan [dt_systime]]] -format "%Y-%m-%d"] + + # 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"] + + 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. $offer_nr" \ + -mime_type "text/plain" \ + -party_id $contact_id \ + -due_date ${due_date} \ + -object_id $offer_id \ + -mime_type "text/html" \ + -priority "1"] + } } ad_returnredirect $return_url