diff --git a/ext/bulk_actions/main.php b/ext/bulk_actions/main.php index ba613be3..35455f48 100644 --- a/ext/bulk_actions/main.php +++ b/ext/bulk_actions/main.php @@ -1,5 +1,8 @@ yield_items($data); + } + } elseif (isset($_POST['bulk_query']) && $_POST['bulk_query'] != "") { + $query = $_POST['bulk_query']; + if ($query != null && $query != "") { + $items = $this->yield_search_results($query); + } + } else { + throw new BulkActionException("No ids selected and no query present, cannot perform bulk operation on entire collection"); } - if (is_array($data)&&!empty($data)) { - $items = $this->yield_items($data); - } - } elseif (isset($_POST['bulk_query']) && $_POST['bulk_query'] != "") { - $query = $_POST['bulk_query']; - if ($query != null && $query != "") { - $items = $this->yield_search_results($query); - } - } else { - throw new SCoreException("No ids selected and no query present, cannot perform bulk operation on entire collection"); - } - $bae = new BulkActionEvent($action, $items); + $bae = new BulkActionEvent($action, $items); - if (is_iterable($items)) { - send_event($bae); + if (is_iterable($items)) { + send_event($bae); + } + } catch (BulkActionException $e) { + log_error(BulkActionsInfo::KEY, $e->getMessage(), $e->getMessage()); } if ($bae->redirect) {