From 997c7f3b01e03d8a3eb3462472c36cf826fef7f8 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 4 Sep 2024 15:32:50 -0400 Subject: [PATCH] Call form execute hook after object update --- .../grid/catalogEntry/form/IdentificationCodeForm.inc.php | 4 +++- .../grid/catalogEntry/form/PublicationFormatForm.inc.php | 5 +++-- controllers/grid/users/chapter/form/ChapterForm.inc.php | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/controllers/grid/catalogEntry/form/IdentificationCodeForm.inc.php b/controllers/grid/catalogEntry/form/IdentificationCodeForm.inc.php index 1c988d8baff..4210987d6d6 100644 --- a/controllers/grid/catalogEntry/form/IdentificationCodeForm.inc.php +++ b/controllers/grid/catalogEntry/form/IdentificationCodeForm.inc.php @@ -177,7 +177,6 @@ public function readInputData() { * @copydoc Form::execute() */ public function execute(...$functionArgs) { - parent::execute(...$functionArgs); $identificationCodeDao = DAORegistry::getDAO('IdentificationCodeDAO'); /* @var $identificationCodeDao IdentificationCodeDAO */ $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO'); /* @var $publicationFormatDao PublicationFormatDAO */ @@ -209,6 +208,9 @@ public function execute(...$functionArgs) { $identificationCodeId = $identificationCodeDao->insertObject($identificationCode); } + // in order to be able to use the hook + parent::execute(...$functionArgs); + return $identificationCodeId; } } diff --git a/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php b/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php index 17030b384f0..c065e47d6a7 100644 --- a/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php +++ b/controllers/grid/catalogEntry/form/PublicationFormatForm.inc.php @@ -155,8 +155,6 @@ function readInputData() { * @see Form::execute() */ function execute(...$functionParams) { - parent::execute(...$functionParams); - $publicationFormatDao = DAORegistry::getDAO('PublicationFormatDAO'); /* @var $publicationFormatDao PublicationFormatDAO */ $publicationFormat = $this->getPublicationFormat(); if (!$publicationFormat) { @@ -188,6 +186,9 @@ function execute(...$functionParams) { SubmissionLog::logEvent(Application::get()->getRequest(), $this->getMonograph(), SUBMISSION_LOG_PUBLICATION_FORMAT_CREATE, 'submission.event.publicationFormatCreated', array('formatName' => $publicationFormat->getLocalizedName())); } + // in order to be able to use the hook + parent::execute(...$functionParams); + return $representationId; } } diff --git a/controllers/grid/users/chapter/form/ChapterForm.inc.php b/controllers/grid/users/chapter/form/ChapterForm.inc.php index d262f87e711..f3981c45b12 100644 --- a/controllers/grid/users/chapter/form/ChapterForm.inc.php +++ b/controllers/grid/users/chapter/form/ChapterForm.inc.php @@ -198,8 +198,6 @@ function readInputData() { * @see Form::execute() */ function execute(...$functionParams) { - parent::execute(...$functionParams); - $chapterDao = DAORegistry::getDAO('ChapterDAO'); /* @var $chapterDao ChapterDAO */ $chapter = $this->getChapter(); $isEdit = !!$chapter; @@ -238,6 +236,9 @@ function execute(...$functionParams) { DAORegistry::getDAO('SubmissionFileDAO')->updateChapterFiles($selectedFiles, $this->getChapter()->getId()); } + // in order to be able to use the hook + parent::execute(...$functionParams); + return true; } }