get correspondents from ->getStatistics()

This commit is contained in:
Uwe Steinmann 2023-02-18 15:38:52 +01:00
parent 1121532204
commit 32aed7f3eb

View File

@ -300,8 +300,11 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
$correspondents = array();
if(!empty($settings->_extensions['paperless']['correspondentsattr']) && $attrdef = $dms->getAttributeDefinition($settings->_extensions['paperless']['correspondentsattr'])) {
$res = $attrdef->getStatistics(30);
// print_r($res['frequencies']);
$valueset = $attrdef->getValueSetAsArray();
foreach($valueset as $id=>$val) {
$c = isset($res['frequencies']['document'][md5($val)]) ? $res['frequencies']['document'][md5($val)]['c'] : 0;
$correspondents[] = array(
'id'=>$id+1,
'slug'=>strtolower($val),
@ -309,7 +312,7 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
'match'=>'',
'matching_algorithm'=>1,
'is_insensitive'=>true,
'document_count'=>0,
'document_count'=>$c,
'last_correspondence'=>null
);
}