From 32aed7f3eb548425f08cc4fd7b2ba1fb4f2c4562 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sat, 18 Feb 2023 15:38:52 +0100 Subject: [PATCH] get correspondents from ->getStatistics() --- class.paperless.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/class.paperless.php b/class.paperless.php index bccc4e7..b5de392 100644 --- a/class.paperless.php +++ b/class.paperless.php @@ -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 ); }