Need to be in Normal view_mode to accurately get a count of subgalleries.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 8 Sep 2010 23:22:36 +0000 (19:22 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 8 Sep 2010 23:22:36 +0000 (19:22 -0400)
Fixes a bug that would cause subgalleries to become inaccessable in certain
conditions

ansel/lib/Gallery.php

index dc40517..99225fb 100644 (file)
@@ -824,7 +824,14 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical
         $old = $this->getParent();
         $reset_has_subgalleries = false;
         if (!is_null($old)) {
+            $vMode = $old->get('view_mode');
+            if ($vMode != 'Normal') {
+                $old->set('view_mode', 'Normal');
+            }
             $cnt = $old->countGalleryChildren(Horde_Perms::READ, true);
+            if ($vMode != 'Normal') {
+                $old->set('view_mode', $vMode);
+            }
             if ($cnt == 1) {
                 /* Count is 1, and we are about to delete it */
                 $reset_has_subgalleries = true;