diff --git a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml index 07cb4c904..09d3b68ab 100755 --- a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml +++ b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml @@ -203,40 +203,6 @@ } }]]> - - /** - * @param array $aEventData - * - * @return void - * @throws \CoreException - */ - - false - protected - Overload-ExNihilo - FireEvent(EVENT_SERVICE_ATTACHMENT_AFTER_UPDATE); - } -]]> - - - /** - * @return void - * @throws \CoreException - */ - - false - protected - Overload-ExNihilo - FireEvent(EVENT_SERVICE_ATTACHMENT_AFTER_DELETE); - } -]]> -
@@ -288,8 +254,8 @@ - - An attachment has been updated in database. + + An attachment has been added to an object Attachment::AfterUpdate Attachment @@ -299,9 +265,9 @@ The attachment updated DBObject - - Array of all the attributes changed - array + + The object to which the attachment is linked + DBObject Debug string @@ -309,15 +275,19 @@ - - An attachment has been deleted from database. - Attachment::AfterDelete + + An attachment has been removed from an object + Attachment::AfterUpdate Attachment - The attachment deleted + The attachment updated + DBObject + + + The object to which the attachment is linked DBObject diff --git a/datamodels/2.x/itop-attachments/main.itop-attachments.php b/datamodels/2.x/itop-attachments/main.itop-attachments.php index 24ad38a6e..3cbcc9fd3 100644 --- a/datamodels/2.x/itop-attachments/main.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/main.itop-attachments.php @@ -304,6 +304,8 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt // Remove attachments that are no longer attached to the current object if (in_array($oAttachment->GetKey(), $aRemovedAttachmentIds)) { + $aData = ['target_object' => $oObject]; + $oAttachment->FireEvent(EVENT_SERVICE_REMOVE_ATTACHMENT_FROM_OBJECT, $aData); $oAttachment->DBDelete(); $aActions[] = self::GetActionChangeOp($oAttachment, false /* false => deletion */); } @@ -332,6 +334,8 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt $oAttachment->DBUpdate(); // temporary attachment confirmed, list it in the history $aActions[] = self::GetActionChangeOp($oAttachment, true /* true => creation */); + $aData = ['target_object' => $oObject]; + $oAttachment->FireEvent(EVENT_SERVICE_ADD_ATTACHMENT_TO_OBJECT, $aData); } } }