Skip to content

Commit

Permalink
Call publication edit hook when chapter and representation is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagolepidus committed Sep 4, 2024
1 parent 997c7f3 commit f1626b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions controllers/grid/catalogEntry/PublicationFormatGridHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')));
Expand Down Expand Up @@ -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());
}

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

Expand Down
5 changes: 5 additions & 0 deletions controllers/grid/users/chapter/ChapterGridHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit f1626b6

Please sign in to comment.