소스 검색

Fixe Nb assign Documents

stany.ferer 1 년 전
부모
커밋
d488063e40
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      core/class/document.class.php

+ 5 - 3
core/class/document.class.php

@@ -401,17 +401,18 @@ class document
 
     static public function getAssign(float $_id = NULL){
 
-        $idUser = is_null($_id ) ? session::getId() : $_id;
+        $idUser = is_null($_id) ? session::getId() : $_id;
         $tags = user::getIdTags($idUser);
 
         $where = NULL;
         foreach ($tags AS $key => $value) {
             if($key == 0){
-                $where = "WHERE " . DB_T_DOCUMENTS . ".id_user_done IS NULL AND " . DB_T_DOCUMENT_TAGS . ".id_tags = " . $value . "";
+                $where = "WHERE " . DB_T_DOCUMENTS . ".id_user_done IS NULL AND (" . DB_T_DOCUMENT_TAGS . ".id_tags = " . $value . "";
             } else {
                 $where .= " OR " . DB_T_DOCUMENT_TAGS . ".id_tags = " . $value . "";
             }
         }
+        $where .= ")";
 
         db::query("SELECT 
         " . DB_T_DOCUMENTS . ".id, 
@@ -475,11 +476,12 @@ class document
             $where = NULL;
             foreach ($_tags AS $key => $value) {
                 if($key == 0){
-                    $where = "WHERE " . DB_T_DOCUMENTS . ".id_user_done IS NULL AND " . DB_T_DOCUMENT_TAGS . ".id_tags = " . $value . "";
+                    $where = "WHERE " . DB_T_DOCUMENTS . ".id_user_done IS NULL AND (" . DB_T_DOCUMENT_TAGS . ".id_tags = " . $value . "";
                 } else {
                     $where .= " OR " . DB_T_DOCUMENT_TAGS . ".id_tags = " . $value . "";
                 }
             }
+            $where .= ")";
         }
 
         db::query("SELECT "