Index: openacs-4/packages/lors/tcl/lors-imscp-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors/tcl/lors-imscp-procs.tcl,v diff -u -r1.7.2.3.2.3 -r1.7.2.3.2.4 --- openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 22 Nov 2006 11:55:52 -0000 1.7.2.3.2.3 +++ openacs-4/packages/lors/tcl/lors-imscp-procs.tcl 29 Dec 2006 11:57:42 -0000 1.7.2.3.2.4 @@ -174,7 +174,26 @@ } +#Funcion convert PG to ORACLE boolean type +ad_proc -private lors::imscp::convert_boolean_type { + {varname} +} { + Convert Postgres boolean type to compatible format with Oracle. + Return t or f + @author Mario Aguado + @creation-date 2006-12-27 +} { + set valid_true [list TRUE t true y yes 1] + if { [lsearch $valid_true $varname] != -1 } { + return t + } else { + return f + } +} + + + # IMS CP database transaction functions ad_proc -public lors::imscp::manifest_add { {-man_id ""} @@ -275,24 +294,10 @@ # db_transaction { #Convert oracle boolean type. This is compatible with postgreSQL - if { $hasmetadata == 0 } { - set hasmetadata "f" - } elseif {$hasmetadata == 1 } { - set hasmetadata "t" - } + set hasmetadata [lors::imscp::convert_boolean_type $hasmetadata] + set isscorm [lors::imscp::convert_boolean_type $isscorm] + set isshared [lors::imscp::convert_boolean_type $isshared] - if { $isscorm == 0 } { - set isscorm "f" - } elseif {$isscorm == 1 } { - set isscorm "t" - } - - if { $isshared == 0 } { - set isshared "f" - } elseif {$isshared == 1 } { - set isshared "t" - } - set manifest_id [db_exec_plsql new_manifest {} ] # } @@ -418,11 +423,8 @@ -creation_ip $creation_ip -item_id $item_id -is_live "t"] # db_transaction { - if { $hasmetadata == 0 } { - set hasmetadata "f" - } elseif {$hasmetadata == 1 } { - set hasmetadata "t" - } + set hasmetadata [lors::imscp::convert_boolean_type $hasmetadata] + set organization_id [db_exec_plsql new_organization {} ] # } @@ -532,11 +534,10 @@ # db_transaction { #Convert oracle boolean type. This is compatible with postgreSQL - if { $hasmetadata == 0 } { - set hasmetadata "f" - } elseif {$hasmetadata == 1 } { - set hasmetadata "t" - } + set isvisible [lors::imscp::convert_boolean_type $isvisible] + set hasmetadata [lors::imscp::convert_boolean_type $hasmetadata] + + set item_id [db_exec_plsql new_item {} ] # }