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.7 -r1.8 --- openacs-4/packages/invoices/www/offer-send.tcl 14 Oct 2005 06:25:03 -0000 1.7 +++ openacs-4/packages/invoices/www/offer-send.tcl 17 Oct 2005 15:08:38 -0000 1.8 @@ -59,4 +59,24 @@ ad_return_error "No Recipient" "The recipient does not have a valid e-mail address. Please go back and make sure that you provide an e-mail address first." } +# 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_id" \ + -mime_type "text/plain" \ + -party_id $contact_id \ + -due_date ${due_date} \ + -object_id $offer_id \ + -mime_type "text/html" \ + -priority "1"] +} + ad_return_template