mirror of
https://codeberg.org/SeedDMS/paperless
synced 2024-11-26 07:22:08 +00:00
allow to set correspondent
This commit is contained in:
parent
8fd2a12ed8
commit
e2b20688fe
|
@ -1475,6 +1475,7 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
if($document) {
|
if($document) {
|
||||||
$body = $request->getBody();
|
$body = $request->getBody();
|
||||||
if($data = json_decode($body, true)) {
|
if($data = json_decode($body, true)) {
|
||||||
|
$updatefulltext = false;
|
||||||
$logger->log(var_export($data, true), PEAR_LOG_DEBUG);
|
$logger->log(var_export($data, true), PEAR_LOG_DEBUG);
|
||||||
if(isset($data['tags'])) {
|
if(isset($data['tags'])) {
|
||||||
$cats = [];
|
$cats = [];
|
||||||
|
@ -1485,6 +1486,21 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */
|
||||||
}
|
}
|
||||||
if(!$document->setCategories($cats))
|
if(!$document->setCategories($cats))
|
||||||
return $response->withStatus(500);
|
return $response->withStatus(500);
|
||||||
|
$updatefulltext = true;
|
||||||
|
}
|
||||||
|
if(isset($data['correspondent'])) {
|
||||||
|
if(!empty($settings->_extensions['paperless']['correspondentsattr']) && $attrdef = $dms->getAttributeDefinition($settings->_extensions['paperless']['correspondentsattr'])) {
|
||||||
|
$valueset = $attrdef->getValueSetAsArray();
|
||||||
|
if(isset($valueset[$data['correspondent']-1])) {
|
||||||
|
$attrvalue = $valueset[$data['correspondent']-1];
|
||||||
|
$logger->log('set attribute '.$attrdef->getName().' to '.$attrvalue, PEAR_LOG_DEBUG);
|
||||||
|
if(!$document->setAttributeValue($attrdef, $attrvalue)) {
|
||||||
|
}
|
||||||
|
$updatefulltext = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($updatefulltext) {
|
||||||
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
|
if($fulltextservice && ($index = $fulltextservice->Indexer())) {
|
||||||
$idoc = $fulltextservice->IndexedDocument($document);
|
$idoc = $fulltextservice->IndexedDocument($document);
|
||||||
// if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
|
// if(false !== $this->callHook('preIndexDocument', $document, $idoc)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user