mirror of
https://codeberg.org/SeedDMS/paperless
synced 2024-11-26 07:22:08 +00:00
fix searching for documents in inbox
This commit is contained in:
parent
3fe6f6df3c
commit
fa97180c55
|
@ -940,17 +940,25 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
|||
$facets = $searchresult['facets'];
|
||||
// $logger->log(var_export($facets, true), PEAR_LOG_DEBUG);
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'documents_total'=>$searchresult['count'],
|
||||
'document_inbox'=>0,
|
||||
);
|
||||
$data['documents_total'] = $searchresult['count'];
|
||||
|
||||
$inboxtags = [];
|
||||
if(!empty($settings->_extensions['paperless']['inboxtags']) && $inboxtags = explode(',', $settings->_extensions['paperless']['inboxtags'])) {
|
||||
foreach($inboxtags as $inboxtagid)
|
||||
if($inboxtag = $dms->getDocumentCategory((int) $inboxtagid))
|
||||
$data['document_inbox'] += (int) $facets['category'][$inboxtag->getName()];
|
||||
foreach($inboxtags as $inboxtagid) {
|
||||
$cats = [];
|
||||
if($inboxtag = $dms->getDocumentCategory((int) $inboxtagid)) {
|
||||
$cats[] = $inboxtag->getName();
|
||||
}
|
||||
if($cats) {
|
||||
$searchresult = $lucenesearch->search('', array('record_type'=>['document'], 'status'=>[2], 'user'=>[$userobj->getLogin()], 'category'=>$cats, 'startFolder'=>$startfolder, 'rootFolder'=>$startfolder), array('limit'=>1), array(), array('no_facets'=>true));
|
||||
if($searchresult === false) {
|
||||
return $response->withStatus(500);
|
||||
}
|
||||
$data['documents_inbox'] = $searchresult['count'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response->withJson($data, 200);
|
||||
|
|
Loading…
Reference in New Issue
Block a user