Index: openacs-4/packages/invoices/tcl/cost-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/cost-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/tcl/cost-procs.tcl 16 Aug 2005 20:04:32 -0000 1.1 +++ openacs-4/packages/invoices/tcl/cost-procs.tcl 29 Jun 2006 14:46:45 -0000 1.2 @@ -31,7 +31,7 @@ set folder_id [content::folder::get_folder_from_package -package_id $package_id] db_transaction { - set item_id [db_nextval acs_object_id_seq] + set item_id [db_nextval t_acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_cost_$item_id" } Index: openacs-4/packages/invoices/tcl/invoice-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/invoice-item-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/tcl/invoice-item-procs.tcl 16 Aug 2005 20:04:32 -0000 1.1 +++ openacs-4/packages/invoices/tcl/invoice-item-procs.tcl 29 Jun 2006 14:46:45 -0000 1.2 @@ -33,7 +33,7 @@ set folder_id [content::folder::get_folder_from_package -package_id $package_id] db_transaction { - set item_id [db_nextval acs_object_id_seq] + set item_id [db_nextval t_acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_invoice_item_$item_id" } Index: openacs-4/packages/invoices/tcl/invoice-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/invoice-procs.tcl,v diff -u -r1.23 -r1.24 --- openacs-4/packages/invoices/tcl/invoice-procs.tcl 3 May 2006 05:52:35 -0000 1.23 +++ openacs-4/packages/invoices/tcl/invoice-procs.tcl 29 Jun 2006 14:46:45 -0000 1.24 @@ -36,8 +36,9 @@ } set folder_id [content::folder::get_folder_from_package -package_id $package_id] + set item_id [db_nextval t_acs_object_id_seq] + db_transaction { - set item_id [db_nextval acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_invoice_$item_id" } Index: openacs-4/packages/invoices/tcl/invoice-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/invoice-procs.xql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/invoices/tcl/invoice-procs.xql 3 May 2006 05:52:35 -0000 1.12 +++ openacs-4/packages/invoices/tcl/invoice-procs.xql 29 Jun 2006 14:46:45 -0000 1.13 @@ -127,10 +127,10 @@ select cr.title, cr.description, cr.item_id, ii.offer_item_id, ii.item_units, ii.price_per_unit, ii.item_nr, ii.rebate, ii.vat, m.category_id, ofi.file_count, - ofi.page_count, pr.title as project_title, p.project_code, p.last_modified, p.contact_id, + ofi.page_count, pr.title as project_title, p.project_code, pr.publish_date as last_modified, p.contact_id, pi.item_id as project_id, o.credit_percent from cr_items ci, cr_revisions cr, iv_invoice_items ii, cr_revisions oor, - acs_data_links r, cr_items pi, cr_revisions pr, pm_projectsx p, iv_offers o, + acs_data_links r, cr_items pi, cr_revisions pr, pm_projects p, iv_offers o, iv_offer_items ofi left outer join category_object_map m on (m.object_id = ofi.offer_item_id) where ci.latest_revision = ii.invoice_id Index: openacs-4/packages/invoices/tcl/offer-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-item-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/tcl/offer-item-procs.tcl 16 Aug 2005 20:04:32 -0000 1.1 +++ openacs-4/packages/invoices/tcl/offer-item-procs.tcl 29 Jun 2006 14:46:45 -0000 1.2 @@ -33,15 +33,17 @@ } set folder_id [content::folder::get_folder_from_package -package_id $package_id] + set item_id [db_nextval t_acs_object_id_seq] + set revision_id [db_nextval t_acs_object_id_seq] db_transaction { - set item_id [db_nextval acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_offer_item_$item_id" } set item_id [content::item::new -parent_id $folder_id -content_type {iv_offer_item} -name $name -package_id $package_id -item_id $item_id] set new_id [content::revision::new \ -item_id $item_id \ + -revision_id $revision_id \ -content_type {iv_offer_item} \ -title $title \ -description $description \ @@ -83,25 +85,46 @@ Edit Offer Item } { - db_transaction { + set new_rev_id [db_nextval t_acs_object_id_seq] + if {[catch {content::revision::new \ + -item_id $offer_item_id \ + -content_type {iv_offer_item} \ + -title $title \ + -description $description \ + -attributes [list \ + [list comment $comment] \ + [list item_nr $item_nr] \ + [list offer_id $offer_id] \ + [list item_units $item_units] \ + [list price_per_unit $price_per_unit] \ + [list rebate $rebate] \ + [list file_count $file_count] \ + [list page_count $page_count] \ + [list sort_order $sort_order] \ + [list vat $vat] \ + [list parent_item_id $parent_item_id] ] + } + ] + } { + set new_rev_id [db_nextval t_acs_object_id_seq] set new_rev_id [content::revision::new \ - -item_id $offer_item_id \ - -content_type {iv_offer_item} \ - -title $title \ - -description $description \ - -attributes [list \ - [list comment $comment] \ - [list item_nr $item_nr] \ - [list offer_id $offer_id] \ - [list item_units $item_units] \ - [list price_per_unit $price_per_unit] \ - [list rebate $rebate] \ - [list file_count $file_count] \ - [list page_count $page_count] \ - [list sort_order $sort_order] \ - [list vat $vat] \ - [list parent_item_id $parent_item_id] ] ] + -item_id $offer_item_id \ + -content_type {iv_offer_item} \ + -title $title \ + -description $description \ + -attributes [list \ + [list comment $comment] \ + [list item_nr $item_nr] \ + [list offer_id $offer_id] \ + [list item_units $item_units] \ + [list price_per_unit $price_per_unit] \ + [list rebate $rebate] \ + [list file_count $file_count] \ + [list page_count $page_count] \ + [list sort_order $sort_order] \ + [list vat $vat] \ + [list parent_item_id $parent_item_id] ] + ] } - return $new_rev_id } Index: openacs-4/packages/invoices/tcl/offer-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/offer-procs.tcl,v diff -u -r1.24 -r1.25 --- openacs-4/packages/invoices/tcl/offer-procs.tcl 1 Jun 2006 10:49:31 -0000 1.24 +++ openacs-4/packages/invoices/tcl/offer-procs.tcl 29 Jun 2006 14:46:45 -0000 1.25 @@ -35,16 +35,19 @@ set package_id [ad_conn package_id] } set folder_id [content::folder::get_folder_from_package -package_id $package_id] - + + # Always set the sequence outside the transaction + set item_id [db_nextval t_acs_object_id_seq] + set revision_id [db_nextval t_acs_object_id_seq] db_transaction { - set item_id [db_nextval acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_offer_$item_id" } set item_id [content::item::new -parent_id $folder_id -content_type {iv_offer} -name $name -package_id $package_id -item_id $item_id] set new_id [content::revision::new \ -item_id $item_id \ + -revision_id $revision_id \ -content_type {iv_offer} \ -title $title \ -description $description \ @@ -110,8 +113,10 @@ set status new } set old_rev_id [content::item::get_best_revision -item_id $offer_id] - set new_rev_id [content::revision::new \ + set new_rev_id [db_nextval t_acs_object_id_seq] + if {[catch {content::revision::new \ -item_id $offer_id \ + -revision_id $new_rev_id \ -content_type {iv_offer} \ -title $title \ -description $description \ @@ -130,7 +135,35 @@ [list status $status] \ [list vat_percent $vat_percent] \ [list vat $vat] \ - [list credit_percent $credit_percent] ] ] + [list credit_percent $credit_percent] ]} ] + } { + set new_rev_id [db_nextval t_acs_object_id_seq] + set new_rev_id [content::revision::new \ + -item_id $offer_id \ + -revision_id $new_rev_id \ + -content_type {iv_offer} \ + -title $title \ + -description $description \ + -attributes [list \ + [list comment $comment] \ + [list reservation $reservation] \ + [list offer_nr $offer_nr] \ + [list organization_id $organization_id] \ + [list amount_total $amount_total] \ + [list amount_sum $amount_sum] \ + [list currency $currency] \ + [list finish_date $finish_date] \ + [list date_comment $date_comment] \ + [list payment_days $payment_days] \ + [list show_sum_p $show_sum_p] \ + [list status $status] \ + [list vat_percent $vat_percent] \ + [list vat $vat] \ + [list credit_percent $credit_percent] + ] + ] + } + db_dml set_accepted_date {} return $new_rev_id } Index: openacs-4/packages/invoices/tcl/payment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/payment-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/tcl/payment-procs.tcl 16 Aug 2005 20:04:32 -0000 1.1 +++ openacs-4/packages/invoices/tcl/payment-procs.tcl 29 Jun 2006 14:46:45 -0000 1.2 @@ -28,7 +28,7 @@ set folder_id [content::folder::get_folder_from_package -package_id $package_id] db_transaction { - set item_id [db_nextval acs_object_id_seq] + set item_id [db_nextval t_acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_payment_$item_id" } Index: openacs-4/packages/invoices/tcl/price-list-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/price-list-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/tcl/price-list-procs.tcl 5 Jun 2006 11:34:17 -0000 1.3 +++ openacs-4/packages/invoices/tcl/price-list-procs.tcl 29 Jun 2006 14:46:45 -0000 1.4 @@ -25,7 +25,7 @@ set folder_id [content::folder::get_folder_from_package -package_id $package_id] db_transaction { - set item_id [db_nextval acs_object_id_seq] + set item_id [db_nextval t_acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_price_list_$item_id" } Index: openacs-4/packages/invoices/tcl/price-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/tcl/price-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/invoices/tcl/price-procs.tcl 16 Aug 2005 20:04:32 -0000 1.1 +++ openacs-4/packages/invoices/tcl/price-procs.tcl 29 Jun 2006 14:46:45 -0000 1.2 @@ -26,7 +26,7 @@ set folder_id [content::folder::get_folder_from_package -package_id $package_id] db_transaction { - set item_id [db_nextval acs_object_id_seq] + set item_id [db_nextval t_acs_object_id_seq] if {[empty_string_p $name]} { set name "iv_price_$item_id" }