From a45c2fa9127d58a3ecfe408ccbed1921695ec574 Mon Sep 17 00:00:00 2001 From: Thiago Date: Mon, 2 Sep 2024 20:12:29 -0400 Subject: [PATCH] Call publication edit hook when chapter and representation is updated --- .../grid/catalogEntry/PublicationFormatGridHandler.inc.php | 6 ++++++ .../grid/catalogEntry/form/PublicationFormatForm.inc.php | 4 ++-- controllers/grid/users/chapter/ChapterGridHandler.inc.php | 4 ++-- controllers/grid/users/chapter/form/ChapterForm.inc.php | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php b/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php index 4c95898eec0..c8c8c2d092a 100644 --- a/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php +++ b/controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php @@ -324,6 +324,8 @@ function deleteFormat($args, $request) { $notificationMgr = new NotificationManager(); $notificationMgr->createTrivialNotification($currentUser->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('notification.removedPublicationFormat'))); + $publication = Services::get('publication')->edit($publication, [], $request); + return DAO::getDataChangedEvent(); } @@ -383,6 +385,8 @@ function setApproved($args, $request) { $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($representation, $request->getContext()); } + $publication = Services::get('publication')->edit($publication, [], $request); + return DAO::getDataChangedEvent($representation->getId()); } @@ -425,6 +429,8 @@ function setAvailable($args, $request) { $publicationFormatTombstoneMgr->insertTombstoneByPublicationFormat($publicationFormat, $context); } + $publication = Services::get('publication')->edit($publication, [], $request); + return DAO::getDataChangedEvent($publicationFormat->getId()); } diff --git a/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php b/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php index 17030b384f0..25924cef24a 100644 --- a/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php +++ b/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php @@ -188,8 +188,8 @@ function execute(...$functionParams) { SubmissionLog::logEvent(Application::get()->getRequest(), $this->getMonograph(), SUBMISSION_LOG_PUBLICATION_FORMAT_CREATE, 'submission.event.publicationFormatCreated', array('formatName' => $publicationFormat->getLocalizedName())); } + $publication = Services::get('publication')->edit($publication, [], Application::get()->getRequest()); + return $representationId; } } - - diff --git a/controllers/grid/users/chapter/ChapterGridHandler.inc.php b/controllers/grid/users/chapter/ChapterGridHandler.inc.php index 8097ac269c6..40af8b22c64 100644 --- a/controllers/grid/users/chapter/ChapterGridHandler.inc.php +++ b/controllers/grid/users/chapter/ChapterGridHandler.inc.php @@ -482,6 +482,8 @@ function deleteChapter($args, $request) { $chapterDao = DAORegistry::getDAO('ChapterDAO'); /* @var $chapterDao ChapterDAO */ $chapterDao->deleteById($chapterId); + $publication = $this->getPublication(); + $publication = Services::get('publication')->edit($publication, [], $request); return DAO::getDataChangedEvent(); } @@ -495,5 +497,3 @@ function _getChapterFromRequest($request) { ); } } - - diff --git a/controllers/grid/users/chapter/form/ChapterForm.inc.php b/controllers/grid/users/chapter/form/ChapterForm.inc.php index d262f87e711..06d5bce9f9c 100644 --- a/controllers/grid/users/chapter/form/ChapterForm.inc.php +++ b/controllers/grid/users/chapter/form/ChapterForm.inc.php @@ -238,8 +238,8 @@ function execute(...$functionParams) { DAORegistry::getDAO('SubmissionFileDAO')->updateChapterFiles($selectedFiles, $this->getChapter()->getId()); } + $publication = Services::get('publication')->edit($publication, [], Application::get()->getRequest()); + return true; } } - -