use the latestet version if no version is given

This commit is contained in:
Uwe Steinmann 2019-03-14 07:47:23 +01:00
parent 3f77722aa8
commit d71d78138b

View File

@ -30,7 +30,15 @@ class SeedDMS_Controller_Download extends SeedDMS_Controller_Common {
case "version":
$version = $this->params['version'];
$document = $this->params['document'];
$content = $document->getContentByVersion($version);
if($version < 1) {
$content = $this->callHook('documentLatestContent', $document);
if($content === null)
$content = $document->getLatestContent();
} else {
$content = $this->callHook('documentContent', $document, $version);
if($content === null)
$content = $document->getContentByVersion($version);
}
if (!is_object($content)) {
$this->errormsg = 'invalid_version';
return false;