diff --git a/DNBExportPlugin.inc.php b/DNBExportPlugin.inc.php index d15a194..79f58ae 100644 --- a/DNBExportPlugin.inc.php +++ b/DNBExportPlugin.inc.php @@ -400,7 +400,10 @@ function getGalleyPackage($galley, $filter, $noValidation, $journal, $journalExp $param = __('plugins.importexport.dnb.export.error.articleMetadataInvalidCharacters.param', array('submissionId' => $submissionId, 'node' => $e->getMessage())); return array('plugins.importexport.dnb.export.error.articleMetadataInvalidCharacters', $param); case URN_SET: - return array('plugins.importexport.dnb.export.error.urnSet'); + return array('plugins.importexport.dnb.export.error.urnSet'); + case FIRST_AUTHOR_NOT_REGISTERED: + $param = __('plugins.importexport.dnb.export.error.firestAuthorNotRegistred.param', array('submissionId' => $submissionId, 'msg' => $e->getMessage())); + return array('plugins.importexport.dnb.export.error.firestAuthorNotRegistred', $param); } } diff --git a/DNBInfoSender.inc.php b/DNBInfoSender.inc.php index 9384770..184bb86 100644 --- a/DNBInfoSender.inc.php +++ b/DNBInfoSender.inc.php @@ -87,19 +87,19 @@ function executeActions() { } $journalExportPath = $result; - foreach ($notDepositedArticles as $article) { - if (is_a($article, 'PublishedArticle')) { + foreach ($notDepositedArticles as $submission) { + if (is_a($submission, 'Submission')) { $issue = null; $galleys = array(); // Get issue and galleys, and check if the article can be exported - if (!$plugin->canBeExported($article, $issue, $galleys)) { - $errors[] = array('plugins.importexport.dnb.export.error.articleCannotBeExported', $article->getId()); + if (!$plugin->canBeExported($submission, $issue, $galleys)) { + $errors[] = array('plugins.importexport.dnb.export.error.articleCannotBeExported', $submission->getId()); // continue with other articles continue; } $fullyDeposited = true; - $articleId = $article->getId(); + $submissionId = $submission->getId(); foreach ($galleys as $galley) { // check if it is a full text $galleyFile = $galley->getFile(); @@ -131,8 +131,9 @@ function executeActions() { // Update article status //TODO @RS cleanup //$articleDao->updateSetting($articleId, $plugin->getDepositStatusSettingName(), DNB_STATUS_DEPOSITED, 'string'); - $object->setData($plugin->getDepositStatusSettingName(), DNB_STATUS_DEPOSITED); -+ $this->updateObject($object); + $submissionDao = DAORegistry::getDAO('SubmissionDAO'); + $submission->setData($plugin->getDepositStatusSettingName(), DNB_STATUS_DEPOSITED); + $submissionDao->updateObject($submission); } } } diff --git a/filter/DNBXmlFilter.inc.php b/filter/DNBXmlFilter.inc.php index 0606155..c15cf16 100644 --- a/filter/DNBXmlFilter.inc.php +++ b/filter/DNBXmlFilter.inc.php @@ -16,6 +16,7 @@ import('lib.pkp.plugins.importexport.native.filter.NativeExportFilter'); define('XML_NON_VALID_CHARCTERS', 100); +define('FIRST_AUTHOR_NOT_REGISTERED', 102); define('URN_SET', 101); define('MESSAGE_URN_SET','An URN has been set.'); // @RS refine @@ -115,7 +116,9 @@ function &process(&$pubObject) { // so the array can be used later in the field 700 1 _ $firstAuthor = array_shift($authors); } - assert($firstAuthor); + if (!$firstAuthor) { + throw new ErrorException("DNBXmlFilter Error: ", FIRST_AUTHOR_NOT_REGISTERED); + } // extract submission translators $translators = array_filter($contributors, array($this, '_filterTranslators')); @@ -229,7 +232,8 @@ function &process(&$pubObject) { $abstract = mb_substr($abstract, 0, 996,"UTF-8"); $abstract .= '...'; } - $abstractURL = $request->url($journal->getPath(), 'article', 'view', array($article->getId())); + //$abstractURL = $request->url($journal->getPath(), 'article', 'view', array($article->getId())); //TODO @RS + $abstractURL = $request->url($journal->getPath(), 'article', 'view', array($submissionId)); $datafield520 = $this->createDatafieldNode($doc, $recordNode, '520', '3', ' '); $this->createSubfieldNode($doc, $datafield520, 'a', $abstract); $this->createSubfieldNode($doc, $datafield520, 'u', $abstractURL); @@ -291,7 +295,8 @@ function &process(&$pubObject) { $journalDatafield773 = $this->createDatafieldNode($doc, $recordNode, '773', '1', '8'); $this->createSubfieldNode($doc, $journalDatafield773, 'x', $issn); // file data - $galleyURL = $request->url($journal->getPath(), 'article', 'view', array($article->getId(), $galley->getId())); + //$galleyURL = $request->url($journal->getPath(), 'article', 'view', array($article->getId(), $galley->getId())); //TODO @RS + $galleyURL = $request->url($journal->getPath(), 'article', 'view', array($submissionId, $galley->getId())); $datafield856 = $this->createDatafieldNode($doc, $recordNode, '856', '4', ' '); $this->createSubfieldNode($doc, $datafield856, 'u', $galleyURL); $this->createSubfieldNode($doc, $datafield856, 'q', $this->_getGalleyFileType($galley)); @@ -309,7 +314,7 @@ function &process(&$pubObject) { } /** - * Check if the contributor is an author. + * Check if the contributor is an author resistered with the journal. * @param $contributor Author * @return boolean */ @@ -319,7 +324,7 @@ function _filterAuthors($contributor) { } /** - * Check if the contributor is a translator. + * Check if the contributor is a translator resistered with the journal. * @param $contributor Author * @return boolean */ diff --git a/locale/de_DE/locale.xml b/locale/de_DE/locale.xml index bd2d780..8430a22 100644 --- a/locale/de_DE/locale.xml +++ b/locale/de_DE/locale.xml @@ -66,6 +66,9 @@ Die Fahnendatei {$param} konnte nicht gefunden werden. Die Fahnendatei {$param} kopiert werden. {$sourceGalleyFilePath} konnte nicht nach {$targetGalleyFilePath} + Fehler beim Export der Fahne {$submissionId}. {$msg} + {$param} Der Erstautor der Fahe muss bei dieser Zeitschrift als Autor registriert sein. + DNB automatic deposit task diff --git a/locale/en_US/locale.xml b/locale/en_US/locale.xml index b769b36..6440695 100644 --- a/locale/en_US/locale.xml +++ b/locale/en_US/locale.xml @@ -66,6 +66,8 @@ The galley file {$param} could not be found. The galley file {$param}. {$sourceGalleyFilePath} could not be copied to {$targetGalleyFilePath} + Error exporting submission {$submissionId}. {$msg} + {$param} The primary auther of the submission is required to be a registered author with this journal. DNB automatic deposit task diff --git a/templates/settingsForm.tpl b/templates/settingsForm.tpl index 365898f..9d1e16d 100644 --- a/templates/settingsForm.tpl +++ b/templates/settingsForm.tpl @@ -36,7 +36,7 @@ {fbvElement type="text" id="folderId" value=$folderId label="plugins.importexport.dnb.settings.form.folderId" maxlength="50" size=$fbvStyles.size.MEDIUM} {translate key="plugins.importexport.dnb.settings.form.folderId.description"}
{/fbvFormSection} - {fbvFormSection list="true"} + {fbvFormSection list="true"} {fbvElement type="checkbox" id="automaticDeposit" label="plugins.importexport.dnb.settings.form.automaticDeposit.description" checked=$automaticDeposit|compare:true} {/fbvFormSection}