Save default DownloadBehaviour on a DMSDocument when initially uploading a new one

- array key check for behavior before using
This commit is contained in:
Dave Collins 2018-07-06 08:59:10 -04:00
parent 52772ae879
commit cf278fd8e2
1 changed files with 5 additions and 3 deletions

View File

@ -1011,9 +1011,11 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
$possibleBehaviors = $this->dbObject('DownloadBehavior')
->enumValues();
$behavior = $possibleBehaviors[$defaultDownloadBehaviour];
if ($behavior) {
$this->DownloadBehavior = $behavior;
if (array_key_exists($defaultDownloadBehaviour, $possibleBehaviors)) {
$behavior = $possibleBehaviors[$defaultDownloadBehaviour];
if ($behavior) {
$this->DownloadBehavior = $behavior;
}
}
}
}