From 3f37858c70638053d1e94f2c94ca96b16cc5ab36 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Sun, 23 Apr 2023 23:15:05 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B02889=20-=20Fix=20error=20on=20attachment?= =?UTF-8?q?=20download=20due=20to=20$oObj=20not=20being=20a=20\cmdbAbstrac?= =?UTF-8?q?tObject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/ormdocument.class.inc.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/ormdocument.class.inc.php b/core/ormdocument.class.inc.php index 24b0c2d15..f4218c72e 100644 --- a/core/ormdocument.class.inc.php +++ b/core/ormdocument.class.inc.php @@ -284,7 +284,10 @@ class ormDocument if($sContentDisposition === static::ENUM_CONTENT_DISPOSITION_ATTACHMENT) { $oDocument->IncreaseDownloadsCount(); $oObj->Set($sAttCode, $oDocument); - $oObj->AllowWrite(); + // $oObj can be a \DBObject or \cmdbAbstractObject so we ahve to protect it + if (method_exists($oObj, 'AllowWrite')) { + $oObj->AllowWrite(); + } $oObj->DBUpdate(); } }