mirror of
https://codeberg.org/SeedDMS/paperless
synced 2025-02-11 09:25:23 +00:00
add initila support for correspondents
This commit is contained in:
parent
7fe0f08ba5
commit
959b8bea7d
|
@ -291,10 +291,29 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function correspondents($request, $response) { /* {{{ */
|
function correspondents($request, $response) { /* {{{ */
|
||||||
|
$dms = $this->container->dms;
|
||||||
|
$userobj = $this->container->userobj;
|
||||||
|
$settings = $this->container->config;
|
||||||
|
$logger = $this->container->logger;
|
||||||
|
|
||||||
//file_put_contents("php://stdout", var_dump($request, true));
|
//file_put_contents("php://stdout", var_dump($request, true));
|
||||||
|
|
||||||
$correspondents = array(
|
$correspondents = array();
|
||||||
);
|
if(!empty($settings->_extensions['paperless']['correspondentsattr']) && $attrdef = $dms->getAttributeDefinition($settings->_extensions['paperless']['correspondentsattr'])) {
|
||||||
|
$valueset = $attrdef->getValueSetAsArray();
|
||||||
|
foreach($valueset as $id=>$val) {
|
||||||
|
$correspondents[] = array(
|
||||||
|
'id'=>$id+1,
|
||||||
|
'slug'=>strtolower($val),
|
||||||
|
'name'=>$val,
|
||||||
|
'match'=>'',
|
||||||
|
'matching_algorithm'=>1,
|
||||||
|
'is_insensitive'=>true,
|
||||||
|
'document_count'=>0,
|
||||||
|
'last_correspondence'=>null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $response->withJson(array('count'=>count($correspondents), 'next'=>null, 'previous'=>null, 'results'=>$correspondents), 200);
|
return $response->withJson(array('count'=>count($correspondents), 'next'=>null, 'previous'=>null, 'results'=>$correspondents), 200);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
|
8
conf.php
8
conf.php
|
@ -50,6 +50,14 @@ $EXT_CONF['paperless'] = array(
|
||||||
'options'=>['title'=>'Title', 'content'=>'Content'],
|
'options'=>['title'=>'Title', 'content'=>'Content'],
|
||||||
'allow_empty'=>true,
|
'allow_empty'=>true,
|
||||||
),
|
),
|
||||||
|
'correspondentsattr' => array(
|
||||||
|
'title'=>'Attribute for storing the correspondence',
|
||||||
|
'help'=>'This attribute stores the correspondence of a document and must have a list of correspondents.',
|
||||||
|
'type'=>'select',
|
||||||
|
'internal'=>'attributedefinitions',
|
||||||
|
'objtype'=>'2',
|
||||||
|
'allow_empty'=>true,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'constraints' => array(
|
'constraints' => array(
|
||||||
'depends' => array('php' => '7.4.0-', 'seeddms' => array('5.1.29-5.1.99', '6.0.22-6.0.99')),
|
'depends' => array('php' => '7.4.0-', 'seeddms' => array('5.1.29-5.1.99', '6.0.22-6.0.99')),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user