N°7294 - EVENT_ADD_ATTACHMENT_TO_OBJECT not triggered

This commit is contained in:
Eric Espie
2024-03-27 10:34:48 +01:00
parent 4eed5bdeb9
commit a7f3bf9a56
2 changed files with 21 additions and 0 deletions

View File

@@ -265,6 +265,23 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt
}
}
/**
*
* @see ObjectFormManager::FinalizeAttachments() for the portal version
*
* @param $oObject
* @param $oChange
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \DeleteException
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
protected static function UpdateAttachments($oObject, $oChange = null)
{
self::$m_bIsModified = false;

View File

@@ -1454,6 +1454,8 @@ class ObjectFormManager extends FormManager
// Remove attachments that are no longer attached to the current object
if (in_array($oAttachment->GetKey(), $aRemovedAttachmentsIds))
{
$aData = ['attachment' => $oAttachment];
$this->oObject->FireEvent(EVENT_REMOVE_ATTACHMENT_FROM_OBJECT, $aData);
$oAttachment->DBDelete();
$aActions[] = self::GetAttachmentActionChangeOp($oAttachment, false);
}
@@ -1478,6 +1480,8 @@ class ObjectFormManager extends FormManager
$oAttachment->Set('temp_id', '');
$oAttachment->DBUpdate();
$aActions[] = self::GetAttachmentActionChangeOp($oAttachment, true);
$aData = ['attachment' => $oAttachment];
$this->oObject->FireEvent(EVENT_ADD_ATTACHMENT_TO_OBJECT, $aData);
}
}