pass inbox tags to __getCategoryData()

This commit is contained in:
Uwe Steinmann 2022-12-12 19:00:52 +01:00
parent af76aa6ee8
commit 58e864f0b6

View File

@ -101,10 +101,10 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
$g = hexdec(substr($hexcolor, 3, 2)); $g = hexdec(substr($hexcolor, 3, 2));
$b = hexdec(substr($hexcolor, 5, 2)); $b = hexdec(substr($hexcolor, 5, 2));
$yiq = (($r * 299) + ($g * 587) + ($b * 114)) / 1000; $yiq = (($r * 299) + ($g * 587) + ($b * 114)) / 1000;
return ($yiq >= 128) ? '000000' : 'ffffff'; return ($yiq >= 148) ? '000000' : 'ffffff';
} }
protected function __getCategoryData($category) { /* {{{ */ protected function __getCategoryData($category, $inboxtags) { /* {{{ */
$color = substr(md5($category->getName()), 0, 6); $color = substr(md5($category->getName()), 0, 6);
$data = [ $data = [
'id'=>(int)$category->getId(), 'id'=>(int)$category->getId(),
@ -115,7 +115,7 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
'match'=>'', 'match'=>'',
'matching_algorithm'=>6, 'matching_algorithm'=>6,
'is_insensitive'=>true, 'is_insensitive'=>true,
'is_inbox_tag'=>$category->getName() == 'Computer', 'is_inbox_tag'=>in_array($category->getId(), $inboxtags),
'document_count'=>0 'document_count'=>0
]; ];
return $data; return $data;