Index: /trunk/admin/batch_manager_global.php
===================================================================
--- /trunk/admin/batch_manager_global.php	(revision 28700)
+++ /trunk/admin/batch_manager_global.php	(revision 28701)
@@ -87,4 +87,5 @@
 
   $action = $_POST['selectAction'];
+  $redirect = false;
 
   if ('remove_from_caddie' == $action)
@@ -99,8 +100,8 @@
 
     // remove from caddie action available only in caddie so reload content
-    redirect($redirect_url);
-  }
-
-  if ('add_tags' == $action)
+    $redirect = true;
+  }
+
+  else if ('add_tags' == $action)
   {
     if (empty($_POST['add_tags']))
@@ -115,14 +116,14 @@
       if ('no_tag' == $page['prefilter'])
       {
-        redirect($redirect_url);
-      }
-    }
-  }
-
-  if ('del_tags' == $action)
-  {
-     if (isset($_POST['del_tags']) and count($_POST['del_tags']) > 0)
-     {
-    $query = '
+        $redirect = true;
+      }
+    }
+  }
+
+  else if ('del_tags' == $action)
+  {
+    if (isset($_POST['del_tags']) and count($_POST['del_tags']) > 0)
+    {
+      $query = '
 DELETE
   FROM '.IMAGE_TAG_TABLE.'
@@ -130,10 +131,16 @@
     AND tag_id IN ('.implode(',', $_POST['del_tags']).')
 ;';
-    pwg_query($query);
-    }
-     else
-     {
+      pwg_query($query);
+      
+      if (isset($_SESSION['bulk_manager_filter']['tags']) &&
+        count(array_intersect($_SESSION['bulk_manager_filter']['tags'], $_POST['del_tags'])))
+      {
+        $redirect = true;
+      }
+    }
+    else
+    {
       $page['errors'][] = l10n('Select at least one tag');
-     }
+    }
   }
 
@@ -152,18 +159,18 @@
     if ('no_album' == $page['prefilter'])
     {
-      redirect($redirect_url);
-    }
-
-    if ('no_virtual_album' == $page['prefilter'])
+      $redirect = true;
+    }
+
+    else if ('no_virtual_album' == $page['prefilter'])
     {
       $category_info = get_cat_info($_POST['associate']);
       if (empty($category_info['dir']))
       {
-        redirect($redirect_url);
-      }
-    }
-  }
-
-  if ('move' == $action)
+        $redirect = true;
+      }
+    }
+  }
+
+  else if ('move' == $action)
   {
     move_images_to_categories($collection, array($_POST['move']));
@@ -176,24 +183,24 @@
     if ('no_album' == $page['prefilter'])
     {
-      redirect($redirect_url);
-    }
-
-    if ('no_virtual_album' == $page['prefilter'])
+      $redirect = true;
+    }
+
+    else if ('no_virtual_album' == $page['prefilter'])
     {
       $category_info = get_cat_info($_POST['move']);
       if (empty($category_info['dir']))
       {
-        redirect($redirect_url);
-      }
-    }
-
-    if (isset($_SESSION['bulk_manager_filter']['category'])
+        $redirect = true;
+      }
+    }
+
+    else if (isset($_SESSION['bulk_manager_filter']['category'])
         and $_POST['move'] != $_SESSION['bulk_manager_filter']['category'])
     {
-      redirect($redirect_url);
-    }
-  }
-
-  if ('dissociate' == $action)
+      $redirect = true;
+    }
+  }
+
+  else if ('dissociate' == $action)
   {
     // physical links must not be broken, so we must first retrieve image_id
@@ -227,10 +234,10 @@
 
       // let's refresh the page because the current set might be modified
-      redirect($redirect_url);
+      $redirect = true;
     }
   }
 
   // author
-  if ('author' == $action)
+  else if ('author' == $action)
   {
     if (isset($_POST['remove_author']))
@@ -256,5 +263,5 @@
 
   // title
-  if ('title' == $action)
+  else if ('title' == $action)
   {
     if (isset($_POST['remove_title']))
@@ -280,5 +287,5 @@
 
   // date_creation
-  if ('date_creation' == $action)
+  else if ('date_creation' == $action)
   {
     if (isset($_POST['remove_date_creation']) || empty($_POST['date_creation']))
@@ -308,5 +315,5 @@
 
   // privacy_level
-  if ('level' == $action)
+  else if ('level' == $action)
   {
     $datas = array();
@@ -329,5 +336,5 @@
       if ($_POST['level'] < $_SESSION['bulk_manager_filter']['level'])
       {
-        redirect($redirect_url);
+        $redirect = true;
       }
     }
@@ -335,5 +342,5 @@
 
   // add_to_caddie
-  if ('add_to_caddie' == $action)
+  else if ('add_to_caddie' == $action)
   {
     fill_caddie($collection);
@@ -341,5 +348,5 @@
 
   // delete
-  if ('delete' == $action)
+  else if ('delete' == $action)
   {
     if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
@@ -354,5 +361,5 @@
 
         $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
-        redirect($redirect_url);
+        $redirect = true;
       }
       else
@@ -368,5 +375,5 @@
 
   // synchronize metadata
-  if ('metadata' == $action)
+  else if ('metadata' == $action)
   {
     sync_metadata($collection);
@@ -374,5 +381,5 @@
   }
 
-  if ('delete_derivatives' == $action && !empty($_POST['del_derivatives_type']))
+  else if ('delete_derivatives' == $action && !empty($_POST['del_derivatives_type']))
   {
     $query='SELECT path,representative_ext FROM '.IMAGES_TABLE.'
@@ -388,5 +395,5 @@
   }
 
-  if ('generate_derivatives' == $action)
+  else if ('generate_derivatives' == $action)
   {
     if ($_POST['regenerateSuccess'] != '0')
@@ -406,4 +413,9 @@
 
   trigger_notify('element_set_global_action', $action, $collection);
+
+  if ($redirect)
+  {
+    redirect($redirect_url);
+  }
 }
 
