use $dms->getDocument() in function for checking objects

This commit is contained in:
Uwe Steinmann 2020-12-18 07:51:13 +01:00
parent 02a0ef95f9
commit 9c97564cb4

View File

@ -2934,11 +2934,14 @@ class SeedDMS_Core_DMS {
/** @var SeedDMS_Core_Document[] $versions */
$versions = array();
foreach($resArr as $row) {
/** @var SeedDMS_Core_Document $document */
$document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', '');
$document->setDMS($this);
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum'], $row['fileSize'], $row['checksum']);
$versions[] = $version;
$document = $this->getDocument($row['document']);
/* getting the document can fail if it is outside the root folder
* and checkWithinRootDir is enabled.
*/
if($document) {
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum'], $row['fileSize'], $row['checksum']);
$versions[] = $version;
}
}
return $versions;
@ -2961,11 +2964,14 @@ class SeedDMS_Core_DMS {
/** @var SeedDMS_Core_Document[] $versions */
$versions = array();
foreach($resArr as $row) {
/** @var SeedDMS_Core_Document $document */
$document = new $this->classnames['document']($row['document'], '', '', '', '', '', '', '', '', '', '', '');
$document->setDMS($this);
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']);
$versions[] = $version;
$document = $this->getDocument($row['document']);
/* getting the document can fail if it is outside the root folder
* and checkWithinRootDir is enabled.
*/
if($document) {
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']);
$versions[] = $version;
}
}
return $versions;
@ -2989,12 +2995,17 @@ class SeedDMS_Core_DMS {
$versions = array();
foreach($resArr as $row) {
$document = $this->getDocument($row['document']);
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']);
if(!isset($versions[$row['dupid']])) {
$versions[$row['id']]['content'] = $version;
$versions[$row['id']]['duplicates'] = array();
} else
$versions[$row['dupid']]['duplicates'][] = $version;
/* getting the document can fail if it is outside the root folder
* and checkWithinRootDir is enabled.
*/
if($document) {
$version = new $this->classnames['documentcontent']($row['id'], $document, $row['version'], $row['comment'], $row['date'], $row['createdBy'], $row['dir'], $row['orgFileName'], $row['fileType'], $row['mimeType'], $row['fileSize'], $row['checksum']);
if(!isset($versions[$row['dupid']])) {
$versions[$row['id']]['content'] = $version;
$versions[$row['id']]['duplicates'] = array();
} else
$versions[$row['dupid']]['duplicates'][] = $version;
}
}
return $versions;