Make sure default DownloadBehavior is stored when initially uploading a document

This commit is contained in:
Dave Collins 2018-07-05 11:58:18 -04:00
parent d94aa25ac7
commit 71c09244f7

View File

@ -1003,6 +1003,18 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
} }
$this->LastEditedByID = $currentUserID; $this->LastEditedByID = $currentUserID;
} }
// make sure default DownloadBehavior is respected when writing since
$defaultDownloadBehaviour = Config::inst()->get('DMSDocument', 'default_download_behaviour');
if ($this->DownloadBehavior == null && !empty($defaultDownloadBehaviour)) {
$possibleBehaviors = $this->dbObject('DownloadBehavior')
->enumValues();
$behavior =$possibleBehaviors[$defaultDownloadBehaviour];
if ($behavior) {
$this->DownloadBehavior = $behavior;
}
}
} }
/** /**