Skip to content

Commit

Permalink
Merge pull request #62 from UB-Heidelberg/stable-3_1_2
Browse files Browse the repository at this point in the history
Fix errors in hooks used in "Schedule for Publication" and Submission Step 3
  • Loading branch information
asmecher authored Mar 13, 2019
2 parents 7165f9a + c843fd3 commit 346c63a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions OrcidProfilePlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function handleTemplateDisplay($hookName, $args) {
if(!empty($author->getOrcid()) && !empty($author->getData('orcidAccessToken'))) {
$script .= '$("a[href=\"'.$author->getOrcid().'\"]").prepend(orcidIconSvg);';
}
}
}
$templateMgr->addJavaScript('orcidIconDisplay', $script, ['inline' => true]);
break;
}
Expand Down Expand Up @@ -397,9 +397,9 @@ function collectUserOrcidId($hookName, $params) {
* @return bool
*/
function handleSubmissionSubmitStep3FormExecute($hookName, $params) {
$submission =& $params[1];
$form = $params[0];
// Have to use global Request access because request is not passed to hook
$authors = $submission->getAuthors();
$authors = $form->submission->getAuthors();
$user = Request::getUser();
//error_log("OrcidProfilePlugin: authors[0] = " . var_export($authors[0], true));
//error_log("OrcidProfilePlugin: user = " . var_export($user, true));
Expand All @@ -410,7 +410,7 @@ function handleSubmissionSubmitStep3FormExecute($hookName, $params) {
$authors[0]->setData('orcidAccessToken', $user->getData('orcidAccessToken'));
$authors[0]->setData('orcidAccessScope', $user->getData('orcidAccessScope'));
$authors[0]->setData('orcidRefreshToken', $user->getData('orcidRefreshToken'));
$authors[0]->setData('orcidAccessExpiresOn', $user->getData('orcidAccessExpiresOn'));
$authors[0]->setData('orcidAccessExpiresOn', $user->getData('orcidAccessExpiresOn'));
$authors[0]->setData('orcidSandbox', $user->getData('orcidSandbox'));
$authorDao = DAORegistry::getDAO('AuthorDAO');
$authorDao->updateObject($authors[0]);
Expand Down Expand Up @@ -674,9 +674,8 @@ public function handlePublishIssue($hookName, $args) {
* @see IssueEntryPublicationMetadataForm::execute() The function calling the hook.
*/
public function handleScheduleForPublication($hookName, $args) {
$form =& $args[0];
$request =& $args[1];
$submissionId = $request->getUserVar('submissionId');
$form = $args[0];
$submissionId = $form->getSubmission()->getId();
$this->submissionIdToBePublished = $submissionId;
HookRegistry::register('ArticleSearchIndex::articleChangesFinished',
[$this, 'handleScheduleForPublicationFinished']);
Expand Down

0 comments on commit 346c63a

Please sign in to comment.