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 }