From 4ffb4636f3fb4873c145e214d0a82166672b9214 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Thu, 4 Jul 2024 16:04:48 -0300 Subject: [PATCH] pkp/pkp-lib#10132 add checkbox for validation in Onix export plugin --- lib/pkp | 2 +- .../onix30/Onix30ExportPlugin.inc.php | 15 ++++++++++----- plugins/importexport/onix30/templates/index.tpl | 3 +++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/pkp b/lib/pkp index e8c8d9c2271..9178e9a2592 160000 --- a/lib/pkp +++ b/lib/pkp @@ -1 +1 @@ -Subproject commit e8c8d9c22711e70e095c3038a5fcccc625adb408 +Subproject commit 9178e9a25928be30558b40d487ee5eb395df1a55 diff --git a/plugins/importexport/onix30/Onix30ExportPlugin.inc.php b/plugins/importexport/onix30/Onix30ExportPlugin.inc.php index 63640b28dd5..df5c689b50a 100644 --- a/plugins/importexport/onix30/Onix30ExportPlugin.inc.php +++ b/plugins/importexport/onix30/Onix30ExportPlugin.inc.php @@ -109,19 +109,22 @@ function display($args, $request) { $json = new JSONMessage(true); $json->setEvent('addTab', array( 'title' => __('plugins.importexport.native.results'), - 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'export'), array('selectedSubmissions' => $request->getUserVar('selectedSubmissions'), 'csrfToken' => $request->getSession()->getCSRFToken())), + 'url' => $request->url(null, null, null, array('plugin', $this->getName(), 'export'), array('selectedSubmissions' => $request->getUserVar('selectedSubmissions'), 'validation' => $request->getUserVar('validation'), 'csrfToken' => $request->getSession()->getCSRFToken())), )); header('Content-Type: application/json'); return $json->getString(); case 'export': $onixDeployment = new Onix30ExportDeployment($context, $user); + $noValidation = !$request->getUserVar('validation'); + $exportXml = $this->exportSubmissions( (array) $request->getUserVar('selectedSubmissions'), $context, $user, - $onixDeployment - ); + $onixDeployment, + $noValidation + ); $problems = $onixDeployment->getWarningsAndErrors(); $foundErrors = $onixDeployment->isProcessFailed(); @@ -180,7 +183,7 @@ function display($args, $request) { * @param $onixDeployment Onix30ExportDeployment * @return string XML contents representing the supplied submission IDs. */ - function exportSubmissions($submissionIds, $context, $user, $onixDeployment) { + function exportSubmissions($submissionIds, $context, $user, $onixDeployment, $noValidation) { import('lib.pkp.classes.metadata.MetadataTypeDescription'); $submissionDao = DAORegistry::getDAO('SubmissionDAO'); /* @var $submissionDao SubmissionDAO */ @@ -190,6 +193,8 @@ function exportSubmissions($submissionIds, $context, $user, $onixDeployment) { assert(count($nativeExportFilters) == 1); // Assert only a single serialization filter $exportFilter = array_shift($nativeExportFilters); + if ($noValidation) $exportFilter->setNoValidation($noValidation); + $exportFilter->setDeployment($onixDeployment); $submissions = array(); foreach ($submissionIds as $submissionId) { @@ -216,7 +221,7 @@ function exportSubmissions($submissionIds, $context, $user, $onixDeployment) { } /** - * Create file given it's name and content + * Create file given its name and content * * @param string $filename * @param ?DateTime $fileContent diff --git a/plugins/importexport/onix30/templates/index.tpl b/plugins/importexport/onix30/templates/index.tpl index 0f29d15a4b4..f54d3f6bdd2 100644 --- a/plugins/importexport/onix30/templates/index.tpl +++ b/plugins/importexport/onix30/templates/index.tpl @@ -67,6 +67,9 @@ + {fbvFormSection list="true"} + {fbvElement type="checkbox" id="validation" label="plugins.importexport.common.validation" checked=$validation|default:true} + {/fbvFormSection} {fbvFormSection}