Code

Make package filters for sections work (#6576)
[gosa.git] / trunk / gosa-core / include / class_gosaSupportDaemon.inc
index af297df05da0b8655b465b1e022912d05f46f949..e887252354804d877b9db9c3db12564feb2f2715 100644 (file)
@@ -280,7 +280,7 @@ class gosaSupportDaemon
   }
 
 
-  public function FAI_get_packages($release,$attrs,$package,$from=-1,$to=-1)
+  public function FAI_get_packages($release,$attrs,$package,$from=-1,$to=-1, $exclude_sections=array())
   {
     $ret = array();
 
@@ -305,6 +305,18 @@ class gosaSupportDaemon
     /* If no package is given, search for all */
     if(!count($package)) $package = array("%");
 
+    /* If no section is given, search for all */
+    $section_filter = "";
+    if(count($exclude_sections)) {
+      $section_filter = '<clause><connector>AND</connector>';
+          foreach ($exclude_sections as $section => $value) {
+            $section_filter .= "<phrase><operator>ne</operator><section>"
+              .$section
+              ."</section></phrase>";
+          }
+        $section_filter .= "</clause>";
+    }
+
     /* Create limit tag */
     if($from == -1){
       $limit =""; 
@@ -325,6 +337,7 @@ class gosaSupportDaemon
       <clause><connector>OR</connector>
       ".$pkgs."
       </clause>
+      ".$section_filter."
       </where>".
       $limit.
       "</xml>";