mirror of
				https://codeberg.org/SeedDMS/paperless
				synced 2025-10-31 05:11:22 +00:00 
			
		
		
		
	set correspondent and document type in document data
This commit is contained in:
		
							parent
							
								
									af39f6fdf2
								
							
						
					
					
						commit
						2a19650419
					
				|  | @ -61,6 +61,7 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */ | ||||||
| 		$conversionmgr = $this->container->conversionmgr; | 		$conversionmgr = $this->container->conversionmgr; | ||||||
| 
 | 
 | ||||||
| 		$lc = $document->getLatestContent(); | 		$lc = $document->getLatestContent(); | ||||||
|  | 		$dms = $document->getDMS(); | ||||||
| 
 | 
 | ||||||
| 		$content = ''; | 		$content = ''; | ||||||
| 		/* The plain text can either be created by the text previewer | 		/* The plain text can either be created by the text previewer | ||||||
|  | @ -98,10 +99,30 @@ class SeedDMS_ExtPaperless_RestAPI_Controller { /* {{{ */ | ||||||
| 		$tags = array(); | 		$tags = array(); | ||||||
| 		foreach($cats as $cat) | 		foreach($cats as $cat) | ||||||
| 			$tags[] = (int) $cat->getId(); | 			$tags[] = (int) $cat->getId(); | ||||||
|  | 
 | ||||||
|  | 		$correspondent = null; | ||||||
|  | 		if(!empty($settings->_extensions['paperless']['correspondentsattr']) && $attrdef = $dms->getAttributeDefinition($settings->_extensions['paperless']['correspondentsattr'])) { | ||||||
|  | 			if($attr = $document->getAttribute($attrdef)) { | ||||||
|  | 				$valueset = $attrdef->getValueSetAsArray(); | ||||||
|  | 				$i = array_search($attr->getValue(), $valueset); | ||||||
|  | 				if($i !== false) | ||||||
|  | 					$correspondent = $i+1; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		$documenttype = null; | ||||||
|  | 		if(!empty($settings->_extensions['paperless']['documenttypesattr']) && $attrdef = $dms->getAttributeDefinition($settings->_extensions['paperless']['documenttypesattr'])) { | ||||||
|  | 			if($attr = $document->getAttribute($attrdef)) { | ||||||
|  | 				$valueset = $attrdef->getValueSetAsArray(); | ||||||
|  | 				$i = array_search($attr->getValue(), $valueset); | ||||||
|  | 				if($i !== false) | ||||||
|  | 					$documenttype = $i+1; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
| 		$data = array( | 		$data = array( | ||||||
| 			'id'=>(int)$document->getId(), | 			'id'=>(int)$document->getId(), | ||||||
| 			'correspondent'=>null, | 			'correspondent'=>$correspondent, | ||||||
| 			'document_type'=>null, | 			'document_type'=>$documenttype, | ||||||
| 			'storage_path'=>null, | 			'storage_path'=>null, | ||||||
| 			'title'=>$document->getName(), | 			'title'=>$document->getName(), | ||||||
| 			'content'=>$content, | 			'content'=>$content, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann