Index: openacs-4/packages/invoices/www/offer-accept-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/invoices/www/offer-accept-2.tcl 27 Dec 2005 16:39:35 -0000 1.9 +++ openacs-4/packages/invoices/www/offer-accept-2.tcl 27 Dec 2005 18:45:40 -0000 1.10 @@ -25,18 +25,34 @@ 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] +set offer_text "{#invoices.iv_offer_accepted_email#}" set subject [lang::util::localize "#invoices.iv_offer_accepted_email_subject#" $locale] -set template "OfferAcceptedTemplate" -set offer_text [iv::offer::parse_data -offer_id $offer_id -recipient_id $contact_id -template $template -locale $locale] +set file_title [lang::util::localize "#invoices.file_offer_accepted#_${offer_nr}.pdf" $locale] -if {[empty_string_p $file_ids]} { - set pdf_file [text_templates::create_pdf_from_html -html_content "$offer_text"] - if {![empty_string_p $pdf_file]} { - set file_size [file size $pdf_file] - set file_ids [cr_import_content -title "Accepted_Offer_${offer_id}.pdf" -description "PDF version of this offer" $offer_id $pdf_file $file_size application/pdf "[clock seconds]-[expr round([ns_rand]*100000)]"] - } +# substitute variables in offer text +# and return the content of the email plus the file-paths to the document file +set documents [iv::offer::parse_data -offer_id $offer_id -type accepted -email_text $offer_text] + +set offer_text [lindex $documents 0] + +set file_ids {} +set document_file [lindex $documents 1] +if {![empty_string_p $document_file]} { + set file_size [file size $document_file] + set file_ids [contact::oo::import_oo_pdf -oo_file $document_file -printer_name "pdfconv" -title $file_title -parent_id $offer_id] + + # set file_ids [cr_import_content -title $file_title -description "PDF version of this offer" $offer_id $document_file $file_size application/pdf "[clock seconds]-[expr round([ns_rand]*100000)]"] + # content::item::set_live_revision -revision_id $file_ids + + db_dml set_publish_status {} } +if {[llength $file_ids] > 0} { + set return_url [export_vars -base offer-pdf {offer_id {file_id $file_ids}}] +} else { + set return_url "" +} + if {[empty_string_p [cc_email_from_party $contact_id]]} { ad_return_error "No Recipient $contact_id" "The recipient does not have a valid e-mail address. Please go back and make sure that you provide an e-mail address first." } Index: openacs-4/packages/invoices/www/offer-accept-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-accept-2.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/www/offer-accept-2.xql 11 Oct 2005 15:23:29 -0000 1.3 +++ openacs-4/packages/invoices/www/offer-accept-2.xql 27 Dec 2005 18:45:40 -0000 1.4 @@ -23,4 +23,14 @@ + + + + update cr_items + set publish_status = 'expired' + where item_id = (select item_id from cr_revisions where revision_id = :file_ids) + + + + 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.14 -r1.15 --- openacs-4/packages/invoices/www/offer-send.tcl 27 Dec 2005 18:28:16 -0000 1.14 +++ openacs-4/packages/invoices/www/offer-send.tcl 27 Dec 2005 18:45:40 -0000 1.15 @@ -41,9 +41,8 @@ set file_title [lang::util::localize "#invoices.file_offer_accepted#_${offer_nr}.pdf" $locale] } -# substitute variables in invoice text -# and return the content of all necessary document files -# (opening, invoice/credit/cancellation, copy) +# substitute variables in offer text +# and return the content of the email plus the file-paths to the document file set documents [iv::offer::parse_data -offer_id $offer_id -type $document_type -email_text $offer_text -accept_link $accept_link] set offer_text [lindex $documents 0]