Index: openacs-4/packages/acs-subsite/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/package-procs.tcl,v diff -u -r1.40 -r1.40.2.1 --- openacs-4/packages/acs-subsite/tcl/package-procs.tcl 25 Jul 2018 01:28:26 -0000 1.40 +++ openacs-4/packages/acs-subsite/tcl/package-procs.tcl 1 Mar 2019 15:29:31 -0000 1.40.2.1 @@ -206,7 +206,7 @@ # return to null unless this attribute is required # (min_n_values > 0) - return [ad_decode $min_n_values 0 "NULL" ""] + return [expr {$min_n_values > 0 ? "" : "NULL"}] } @@ -502,9 +502,13 @@ for { set i 0 } { $i < [llength $primary_keys] - 1 } { incr i } { lappend pk_formatted "[lindex $primary_keys $i] = [lindex $primary_keys $i+1]" } + if {[llength $pk_formatted] > 0} { + set where_clause [join [string tolower $pk_formatted] "\n AND "] + set where_clause " WHERE $where_clause" + } return "SELECT [string tolower [join $columns ",\n "]] FROM [string tolower [join $tables ", "]] -[ad_decode [llength $pk_formatted] "0" "" " WHERE [join [string tolower $pk_formatted] "\n AND "]"]" +$where_clause" }