Skip to content

Commit

Permalink
Fixed #286 -- Erro na paginação do serviço Documentos Favoritos
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonmoura committed Jan 17, 2023
1 parent fb00be9 commit 85f86d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
4 changes: 1 addition & 3 deletions client/business/mydocuments.php
Expand Up @@ -67,9 +67,7 @@
}
}

if($shallBreak){
break;
}
if ( $shallBreak ) break;
}

unset($shallBreak);
Expand Down
3 changes: 2 additions & 1 deletion client/classes/Tools.php
Expand Up @@ -262,7 +262,8 @@ public static function unique_list_docs($array, $key) {
// docURL
$docURL = array();
$site = end(explode('/', $v['srcID']));
$_site = end(explode('/', $_data[$v[$key]]['srcID']));
$site = ( strpos($v['srcID'], 'e-blueinfo') !== false ) ? 'e-blueinfo' : end(explode('/', $v['srcID'])) ;
$_site = ( strpos($_data[$v[$key]]['srcID'], 'e-blueinfo') !== false ) ? 'e-blueinfo' : end(explode('/', $_data[$v[$key]]['srcID'])) ;

if ( is_array($_data[$v[$key]]['docURL']) ) {
$docURL = $_data[$v[$key]]['docURL'];
Expand Down
18 changes: 13 additions & 5 deletions server/classes/ShelfDAO.php
Expand Up @@ -308,20 +308,22 @@ public static function listDocs($shelf, $params){
$count = ( $params["count"] ) ? $params["count"] : DOCUMENTS_PER_PAGE;
$from = $count * $params["page"];
$objUserDirectory = $shelf->getDir();

if($objUserDirectory){
$dirID = $objUserDirectory[0]->getDirID();
}

if (isset($dirID)){
if ($dirID == 0){
$filterTb = '';
$filter = " and userShelf.userDirID=0";
}else{
$filterTb = ", directories";
$filter = " and userShelf.userDirID=directories.dirID
and userShelf.userDirID=".$dirID;
}
}else{
$filterTb = '';
$filter = ( !$params["widget"] ) ? " and userShelf.userDirID=0" : "";
}

Expand All @@ -341,7 +343,8 @@ public static function listDocs($shelf, $params){
WHERE userShelf.sysUID = '".$sysUID."' and
userShelf.docID = documents.docID and
userShelf.visible = 1 ".$filter."
order by userShelf.".$sort;
GROUP BY userShelf.docID
ORDER BY userShelf.".$sort;
/*
$strsql = "SELECT * FROM userShelf, documents".$filterTb."
WHERE userShelf.sysUID = '".$sysUID."' and
Expand Down Expand Up @@ -618,11 +621,16 @@ public static function getTotalItens($userID, $dirID){

if ( $sysUID ) {
if(isset($dirID)){
$filter = " and userDirID=".$dirID;
$filter = " and userShelf.userDirID=".$dirID;
}

$strsql = "SELECT count(*) as total FROM userShelf
WHERE sysUID ='".$sysUID."' AND visible = 1 ".$filter ;
$strsql = "SELECT count(total) as total FROM (
SELECT count(*) as total FROM userShelf, documents
WHERE userShelf.sysUID ='".$sysUID."' and
userShelf.docID = documents.docID and
userShelf.visible = 1".$filter."
GROUP BY userShelf.docID
) as total";

try{
$_db = new DBClass();
Expand Down

0 comments on commit 85f86d6

Please sign in to comment.