/** * Save changes to submission. * @param $args array * @param $request PKPRequest * @return int the submission ID */ function execute($args, $request) { parent::execute($args, $request); $submission = $this->submission; // Send author notification email import('classes.mail.ArticleMailTemplate'); $mail = new ArticleMailTemplate($submission, 'SUBMISSION_ACK'); $authorMail = new ArticleMailTemplate($submission, 'SUBMISSION_ACK_NOT_USER'); $context = $request->getContext(); $router = $request->getRouter(); if ($mail->isEnabled()) { // submission ack emails should be from the contact. $mail->setFrom($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName')); $authorMail->setFrom($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName')); $user = $request->getUser(); $primaryAuthor = $submission->getPrimaryAuthor(); if (!isset($primaryAuthor)) { $authors = $submission->getAuthors(); $primaryAuthor = $authors[0]; } $mail->addRecipient($user->getEmail(), $user->getFullName()); // Add primary contact and e-mail address as specified in the journal submission settings if ($context->getSetting('copySubmissionAckPrimaryContact')) { $mail->addBcc($context->getSetting('contactEmail'), $context->getSetting('contactName')); } if ($copyAddress = $context->getSetting('copySubmissionAckAddress')) { $mail->addBcc($copyAddress); } if ($user->getEmail() != $primaryAuthor->getEmail()) { $authorMail->addRecipient($primaryAuthor->getEmail(), $primaryAuthor->getFullName()); } $assignedAuthors = $submission->getAuthors(); foreach ($assignedAuthors as $author) { $authorEmail = $author->getEmail(); // only add the author email if they have not already been added as the primary author // or user creating the submission. if ($authorEmail != $primaryAuthor->getEmail() && $authorEmail != $user->getEmail()) { $authorMail->addRecipient($author->getEmail(), $author->getFullName()); } } $mail->bccAssignedSubEditors($submission->getId(), WORKFLOW_STAGE_ID_SUBMISSION); $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $context->getSetting('contactName'), 'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $submission->getId()))); $authorMail->assignParams(array('submitterName' => $user->getFullName(), 'editorialContactSignature' => $context->getSetting('contactName'))); $mail->send($request); $recipients = $authorMail->getRecipients(); if (!empty($recipients)) { $authorMail->send($request); } } // Log submission. import('classes.log.SubmissionEventLogEntry'); // Constants import('lib.pkp.classes.log.SubmissionLog'); SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_SUBMISSION_SUBMIT, 'submission.event.submissionSubmitted'); return $this->submissionId; }
/** * Save changes to article. */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $journal = Request::getJournal(); $user = Request::getUser(); // Update article $article =& $this->article; if ($this->getData('commentsToEditor') != '') { $article->setCommentsToEditor($this->getData('commentsToEditor')); } $article->setDateSubmitted(Core::getCurrentDate()); $article->setSubmissionProgress(0); $article->stampStatusModified(); $articleDao->updateArticle($article); // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId()); AuthorAction::designateReviewVersion($authorSubmission, true); unset($authorSubmission); $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId()); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); $sectionEditors = $this->assignEditors($article); $user =& Request::getUser(); // Update search index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); ArticleSearchIndex::indexArticleFiles($article); // Send author notification email import('classes.mail.ArticleMailTemplate'); $mail = new ArticleMailTemplate($article, 'SUBMISSION_ACK', null, null, null, false); $mail->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); if ($mail->isEnabled()) { $mail->addRecipient($user->getEmail(), $user->getFullName()); // If necessary, BCC the acknowledgement to someone. if ($journal->getSetting('copySubmissionAckPrimaryContact')) { $mail->addBcc($journal->getSetting('contactEmail'), $journal->getSetting('contactName')); } if ($journal->getSetting('copySubmissionAckSpecified')) { $copyAddress = $journal->getSetting('copySubmissionAckAddress'); if (!empty($copyAddress)) { $mail->addBcc($copyAddress); } } // Also BCC automatically assigned section editors foreach ($sectionEditors as $sectionEditorEntry) { $sectionEditor =& $sectionEditorEntry['user']; $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName()); unset($sectionEditor); } $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getLocalizedTitle(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getId()))); $mail->send(); } import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), 'log.author.submitted', array('submissionId' => $article->getId(), 'authorName' => $user->getFullName())); return $this->articleId; }
/** * Blind CC the editor decision email to reviewers. * @param $article object * @param $send boolean * @return boolean true iff ready for redirect */ function bccEditorDecisionCommentToReviewers($article, $send, $request) { import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_DECISION_REVIEWERS'); if ($send && !$email->hasErrors()) { HookRegistry::call('SectionEditorAction::bccEditorDecisionCommentToReviewers', array(&$article, &$reviewAssignments, &$email)); $email->send($request); return true; } else { if (!$request->getUserVar('continued')) { $userDao =& DAORegistry::getDAO('UserDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($article->getId(), $article->getCurrentRound()); $email->clearRecipients(); foreach ($reviewAssignments as $reviewAssignment) { if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (isset($reviewer)) { $email->addBcc($reviewer->getEmail(), $reviewer->getFullName()); } } } $commentsText = ""; if ($article->getMostRecentEditorDecisionComment()) { $comment = $article->getMostRecentEditorDecisionComment(); $commentsText = String::html2text($comment->getComments()) . "\n\n"; } $user =& $request->getUser(); $paramArray = array('comments' => $commentsText, 'editorialContactSignature' => $user->getContactSignature()); $email->assignParams($paramArray); } $email->displayEditForm($request->url(null, null, 'bccEditorDecisionCommentToReviewers', 'send'), array('articleId' => $article->getId())); return false; } }
/** * Blind CC the reviews to reviewers. * @param $article object * @param $send boolean * @param $inhibitExistingEmail boolean * @return boolean true iff ready for redirect */ function blindCcReviewsToReviewers($article, $send = false, $inhibitExistingEmail = false) { $commentDao =& DAORegistry::getDAO('ArticleCommentDAO'); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $journal =& Request::getJournal(); $comments =& $commentDao->getArticleComments($article->getId(), COMMENT_TYPE_EDITOR_DECISION); $reviewAssignments =& $reviewAssignmentDao->getBySubmissionId($article->getId(), $article->getCurrentRound()); $commentsText = ""; foreach ($comments as $comment) { $commentsText .= String::html2text($comment->getComments()) . "\n\n"; } $user =& Request::getUser(); import('classes.mail.ArticleMailTemplate'); $email = new ArticleMailTemplate($article, 'SUBMISSION_DECISION_REVIEWERS', null, null, null, true, true); if ($send && !$email->hasErrors() && !$inhibitExistingEmail) { HookRegistry::call('SectionEditorAction::blindCcReviewsToReviewers', array(&$article, &$reviewAssignments, &$email)); $email->send(); return true; } else { if ($inhibitExistingEmail || !Request::getUserVar('continued')) { $email->clearRecipients(); foreach ($reviewAssignments as $reviewAssignment) { if ($reviewAssignment->getDateCompleted() != null && !$reviewAssignment->getCancelled()) { $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (isset($reviewer)) { $email->addBcc($reviewer->getEmail(), $reviewer->getFullName()); } } } $paramArray = array('comments' => $commentsText, 'editorialContactSignature' => $user->getContactSignature()); $email->assignParams($paramArray); } $email->displayEditForm(Request::url(null, null, 'blindCcReviewsToReviewers'), array('articleId' => $article->getId())); return false; } }
/** * Save changes to article. */ function execute() { $articleDao =& DAORegistry::getDAO('ArticleDAO'); $signoffDao =& DAORegistry::getDAO('SignoffDAO'); $sectionDao =& DAORegistry::getDAO('SectionDAO'); $ercReviewersDao =& DAORegistry::getDAO('ErcReviewersDAO'); $institutionDao =& DAORegistry::getDAO('InstitutionDAO'); $journal = Request::getJournal(); $user = Request::getUser(); // Update article $article =& $this->article; if ($article->getDateSubmitted() == null) { $year = substr(Core::getCurrentDate(), 0, 4); $countyear = $articleDao->getSubmissionsForYearCount($year) + 1; $pSponsor = $article->getArticlePrimarySponsor(); $institution = $institutionDao->getInstitutionById($pSponsor->getInstitutionId()); $article->setProposalId($year . '-' . $countyear . '-' . $institution->getInstitutionAcronym()); } if ($this->getData('commentsToEditor') != '') { $article->setCommentsToEditor($this->getData('commentsToEditor')); } $article->setDateSubmitted(Core::getCurrentDate()); $article->setSubmissionProgress(0); $article->stampStatusModified(); $articleDao->updateArticle($article); // Designate this as the review version by default. $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($article->getId()); AuthorAction::designateReviewVersion($authorSubmission, true); unset($authorSubmission); $copyeditInitialSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditAuthorSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId()); $copyeditInitialSignoff->setUserId(0); $copyeditAuthorSignoff->setUserId($user->getId()); $copyeditFinalSignoff->setUserId(0); $signoffDao->updateObject($copyeditInitialSignoff); $signoffDao->updateObject($copyeditAuthorSignoff); $signoffDao->updateObject($copyeditFinalSignoff); $layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $layoutSignoff->setUserId(0); $signoffDao->updateObject($layoutSignoff); $proofAuthorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_AUTHOR', ASSOC_TYPE_ARTICLE, $article->getId()); $proofProofreaderSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $article->getId()); $proofLayoutEditorSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId()); $proofAuthorSignoff->setUserId($user->getId()); $proofProofreaderSignoff->setUserId(0); $proofLayoutEditorSignoff->setUserId(0); $signoffDao->updateObject($proofAuthorSignoff); $signoffDao->updateObject($proofProofreaderSignoff); $signoffDao->updateObject($proofLayoutEditorSignoff); $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO'); $sectionEditors =& $sectionEditorsDao->getEditorsBySectionId($journal->getId(), $article->getSectionId()); $user =& Request::getUser(); // Update search index import('classes.search.ArticleSearchIndex'); ArticleSearchIndex::indexArticleMetadata($article); ArticleSearchIndex::indexArticleFiles($article); // Send author notification email import('classes.mail.ArticleMailTemplate'); $mail = new ArticleMailTemplate($article, null, 'SUBMISSION_ACK', null, null, null, false); foreach ($sectionEditors as $sectionEditor) { // If one of the secretary is the chair of the committee, send from the chair, if not, take the last secretary in the array $from = $mail->getFrom(); if ($ercReviewersDao->isErcReviewer($journal->getId(), $sectionEditor->getId(), REVIEWER_CHAIR)) { $mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName()); } elseif ($from['email'] == $user->getEmail()) { $mail->setFrom($sectionEditor->getEmail(), $sectionEditor->getFullName()); } $mail->addBcc($sectionEditor->getEmail(), $sectionEditor->getFullName()); unset($sectionEditor); } if ($mail->isEnabled()) { $mail->addRecipient($user->getEmail(), $user->getFullName()); if ($journal->getSetting('copySubmissionAckSpecified')) { $copyAddress = $journal->getSetting('copySubmissionAckAddress'); if (!empty($copyAddress)) { $mail->addBcc($copyAddress); } } $section = $sectionDao->getSection($article->getSectionId()); $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'address' => $sectionDao->getSettingValue($article->getSectionId(), 'address'), 'bankAccount' => $sectionDao->getSettingValue($article->getSectionId(), 'bankAccount'), 'proposalId' => $article->getProposalId(), 'submissionUrl' => Request::url(null, 'author', 'submission', $article->getId()))); $mail->send(); } // Send a regular notification to section editors $lastDecision = $article->getLastSectionDecision(); switch ($lastDecision->getReviewType()) { case REVIEW_TYPE_INITIAL: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.initialReview'; } else { $message = 'notification.type.articleReSubmitted.initialReview'; } break; case REVIEW_TYPE_PR: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.continuingReview'; } else { $message = 'notification.type.articleReSubmitted.continuingReview'; } break; case REVIEW_TYPE_AMENDMENT: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.PAAmendmentReview'; } else { $message = 'notification.type.articleReSubmitted.PAAmendmentReview'; } break; case REVIEW_TYPE_SAE: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.SAE'; } else { $message = 'notification.type.articleReSubmitted.SAE'; } break; case REVIEW_TYPE_FR: if ($lastDecision->getRound() == 1) { $message = 'notification.type.articleSubmitted.EOS'; } else { $message = 'notification.type.articleReSubmitted.EOS'; } break; } import('lib.pkp.classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $url = Request::url($journal->getPath(), 'sectionEditor', 'submission', array($article->getId(), 'submissionReview')); foreach ($sectionEditors as $sectionEditor) { $notificationManager->createNotification($sectionEditor->getId(), $message, $article->getProposalId(), $url, 1, NOTIFICATION_TYPE_ARTICLE_SUBMITTED); } import('classes.article.log.ArticleLog'); import('classes.article.log.ArticleEventLogEntry'); if ($lastDecision->getRound() == 1) { $message = 'log.author.submitted'; } else { $message = 'log.author.resubmitted'; } ArticleLog::logEvent($this->articleId, ARTICLE_LOG_ARTICLE_SUBMIT, ARTICLE_LOG_TYPE_AUTHOR, $user->getId(), $message, array('submissionId' => $article->getProposalId(), 'authorName' => $user->getFullName(), 'reviewType' => Locale::translate($lastDecision->getReviewTypeKey()))); return $this->articleId; }