N°2889 - Fix error on attachment download due to $oObj not being a \cmdbAbstractObject

This commit is contained in:
Molkobain
2023-04-23 23:15:05 +02:00
parent c34bd42945
commit 3f37858c70

View File

@@ -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();
}
}