Index: openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.tcl 19 Jan 2018 14:09:48 -0000 1.6 +++ openacs-4/packages/acs-subsite/www/admin/attributes/enum-add-2.tcl 3 Sep 2024 15:37:34 -0000 1.7 @@ -1,5 +1,3 @@ -# /packages/mbryzek-subsite/www/admin/attribute-add.tcl - ad_page_contract { Adds attributes @@ -19,28 +17,28 @@ db_transaction { foreach ideal_sort_order [array names attribute_enum_values] { - set sort_order [expr {$ideal_sort_order + $max_sort_order}] - set pretty_name $attribute_enum_values($ideal_sort_order) - # delete if the value is empty. Update otherwise - if { $pretty_name eq "" } { - db_dml delete_enum_value { - delete from acs_enum_values - where attribute_id = :attribute_id - and sort_order = :sort_order - } - } else { - db_dml update_enum_value { - update acs_enum_values v - set v.pretty_name = :pretty_name - where v.attribute_id = :attribute_id - and v.sort_order = :sort_order - } - if { [db_resultrows] == 0 } { - # No update - insert the row. Set the enum_value to - # the pretty_name - db_dml insert_enum_value {} - } - } + set sort_order [expr {$ideal_sort_order + $max_sort_order}] + set pretty_name $attribute_enum_values($ideal_sort_order) + # delete if the value is empty. Update otherwise + if { $pretty_name eq "" } { + db_dml delete_enum_value { + delete from acs_enum_values + where attribute_id = :attribute_id + and sort_order = :sort_order + } + } else { + db_dml update_enum_value { + update acs_enum_values v + set v.pretty_name = :pretty_name + where v.attribute_id = :attribute_id + and v.sort_order = :sort_order + } + if { [db_resultrows] == 0 } { + # No update - insert the row. Set the enum_value to + # the pretty_name + db_dml insert_enum_value {} + } + } } }