From cf278fd8e2e00e14628dd52ed61af0948aabfeb3 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 6 Jul 2018 08:59:10 -0400 Subject: [PATCH] Save default DownloadBehaviour on a DMSDocument when initially uploading a new one - array key check for behavior before using --- code/model/DMSDocument.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/model/DMSDocument.php b/code/model/DMSDocument.php index 6954160..7176eab 100644 --- a/code/model/DMSDocument.php +++ b/code/model/DMSDocument.php @@ -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; + } } } }