upgrade 1.1.2 pour XML, MySql et SQLite
[mw_sourceml] / app / data / modules / sql / sml_data_sources.php
index c7eb45c..4c85c2b 100644 (file)
@@ -44,6 +44,7 @@
       $id_composition = isset($params["id_composition"]) ? $params["id_composition"] : null;
       $id_source_derivation = isset($params["id_source_derivation"]) ? $params["id_source_derivation"] : null;
       $id_licence = isset($params["id_licence"]) ? $params["id_licence"] : null;
+      $is_reference = isset($params["is_reference"]) ? $params["is_reference"] : null;
       $order_by = isset($params["order_by"]) ? $params["order_by"] : "ordre";
       $order = isset($params["order"]) ? $params["order"] : "ASC";
       $sgbd = $this->sgbd();
       if(isset($id_licence)) $WHERE .=
        ($WHERE ? " AND " : " WHERE ")
       ." #--sml_sources.licence=".$this->eq($id_licence);
+      if(isset($is_reference)){
+        $WHERE .= ($WHERE ? " AND " : " WHERE ");
+        if($is_reference){
+          $WHERE .=
+           " #--sml_sources.reference IS NOT NULL"
+          ." AND LENGTH(#--sml_sources.reference) > 0";
+        }
+        else{
+          $WHERE .=
+           " (#--sml_sources.reference IS NULL"
+          ." OR (LENGTH(#--sml_sources.reference) = 0))";
+        }
+      }
       $ORDER_BY = " ORDER BY ".$order_by." ".$order;
       $LIMIT = (isset($start) && $env->config("max_list") ? " LIMIT ".$env->config("max_list")." OFFSET ".$start : "");
       try{