From f1626b67e08dce03434267ec178266b57c664141 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 4 Sep 2024 15:54:32 -0400 Subject: [PATCH] Call publication edit hook when chapter and representation is updated --- .../PublicationFormatGridHandler.inc.php | 12 ++++++++++++ .../grid/users/chapter/ChapterGridHandler.inc.php | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php b/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php index 4c95898eec0..f0910c7e6cf 100644 --- a/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php +++ b/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php @@ -320,6 +320,10 @@ function deleteFormat($args, $request) { Services::get('publicationFormat')->deleteFormat($representation, $submission, $context); + // call publication::edit hook when format data is updated + $publication = $this->getPublication(); + $publication = Services::get('publication')->edit($publication, [], $request); + $currentUser = $request->getUser(); $notificationMgr = new NotificationManager(); $notificationMgr->createTrivialNotification($currentUser->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedPublicationFormat'))); @@ -383,6 +387,10 @@ function setApproved($args, $request) { $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($representation, $request->getContext()); } + // call publication::edit hook when format data is updated + $publication = $this->getPublication(); + $publication = Services::get('publication')->edit($publication, [], $request); + return DAO::getDataChangedEvent($representation->getId()); } @@ -425,6 +433,10 @@ function setAvailable($args, $request) { $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($publicationFormat, $context); } + // call publication::edit hook when format data is updated + $publication = $this->getPublication(); + $publication = Services::get('publication')->edit($publication, [], $request); + return DAO::getDataChangedEvent($publicationFormat->getId()); } diff --git a/controllers/grid/users/chapter/ChapterGridHandler.inc.php b/controllers/grid/users/chapter/ChapterGridHandler.inc.php index 8097ac269c6..b7bb0c49091 100644 --- a/controllers/grid/users/chapter/ChapterGridHandler.inc.php +++ b/controllers/grid/users/chapter/ChapterGridHandler.inc.php @@ -482,6 +482,11 @@ function deleteChapter($args, $request) { $chapterDao = DAORegistry::getDAO('ChapterDAO'); /* @var $chapterDao ChapterDAO */ $chapterDao->deleteById($chapterId); + + // call publication::edit hook when chapter data is updated + $publication = $this->getPublication(); + $publication = Services::get('publication')->edit($publication, [], $request); + return DAO::getDataChangedEvent(); }