Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v
diff -u -r1.208 -r1.209
--- openacs-4/packages/new-portal/tcl/portal-procs.tcl	30 Jun 2018 22:04:28 -0000	1.208
+++ openacs-4/packages/new-portal/tcl/portal-procs.tcl	9 Jul 2018 11:48:01 -0000	1.209
@@ -2104,11 +2104,7 @@
     @return 1 on success, 0 on failure
     @param a portal_id
 } {
-    if { [db_0or1row select {} ]} {
-        return 1
-    } else {
-        return 0
-    }
+    return [db_0or1row select {}]
 }
 
 ad_proc -public portal::add_element_parameters {
@@ -2501,11 +2497,7 @@
 
 } {
     set ds_id [get_datasource_id $portlet_name]
-    if {[db_string portlet_visible "" -default 0]} {
-        return 1
-    } else {
-        return 0
-    }
+    return [db_string portlet_visible {}]
 }
 
 # Local variables:
Index: openacs-4/packages/new-portal/tcl/portal-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.xql,v
diff -u -r1.51 -r1.52
--- openacs-4/packages/new-portal/tcl/portal-procs.xql	7 Aug 2017 23:48:12 -0000	1.51
+++ openacs-4/packages/new-portal/tcl/portal-procs.xql	9 Jul 2018 11:48:02 -0000	1.52
@@ -818,14 +818,13 @@
 
     <fullquery name="portal::portlet_visible_p.portlet_visible">
         <querytext>
-            select 1
+            select exists (select 1
             from portal_element_map,
                  portal_pages
             where portal_pages.portal_id = :portal_id
             and portal_element_map.datasource_id = :ds_id
             and portal_element_map.page_id = portal_pages.page_id
-            and portal_element_map.state <> 'hidden'
-            order by portal_element_map.pretty_name
+            and portal_element_map.state <> 'hidden') from dual
         </querytext>
     </fullquery>