/** * Save changes to submission. * @param $args array * @param $request PKPRequest * @return int the submission ID */ function execute($args, $request) { parent::execute($args, $request); // Send author notification email import('classes.mail.MonographMailTemplate'); $mail = new MonographMailTemplate($this->submission, 'SUBMISSION_ACK', null, null, false); $authorMail = new MonographMailTemplate($this->submission, 'SUBMISSION_ACK_NOT_USER', null, null, false); $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 = $this->submission->getPrimaryAuthor(); if (!isset($primaryAuthor)) { $authors = $this->submission->getAuthors(); $primaryAuthor = $authors[0]; } $mail->addRecipient($user->getEmail(), $user->getFullName()); 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 = $this->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->bccAssignedSeriesEditors($this->submissionId, WORKFLOW_STAGE_ID_SUBMISSION); $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName(), 'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $this->submissionId))); $authorMail->assignParams(array('submitterName' => $user->getFullName(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName())); $mail->send($request); $recipients = $authorMail->getRecipients(); if (!empty($recipients)) { $authorMail->send($request); } } // Log submission. import('lib.pkp.classes.log.SubmissionLog'); import('classes.log.SubmissionEventLogEntry'); // constants SubmissionLog::logEvent($request, $this->submission, SUBMISSION_LOG_SUBMISSION_SUBMIT, 'submission.event.submissionSubmitted'); return $this->submissionId; }
/** * Records whether or not the reviewer accepts the review assignment. * @param $reviewerSubmission object * @param $decline boolean * @param $send boolean */ function confirmReview($request, $reviewerSubmission, $decline, $send) { $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $userDao =& DAORegistry::getDAO('UserDAO'); $reviewId = $reviewerSubmission->getReviewId(); $reviewAssignment =& $reviewAssignmentDao->getById($reviewId); $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId()); if (!isset($reviewer)) { return true; } // Only confirm the review for the reviewer if // he has not previously done so. if ($reviewAssignment->getDateConfirmed() == null) { import('classes.mail.MonographMailTemplate'); $email = new MonographMailTemplate($reviewerSubmission, $decline ? 'REVIEW_DECLINE' : 'REVIEW_CONFIRM'); // Must explicitly set sender because we may be here on an access // key, in which case the user is not technically logged in $email->setFrom($reviewer->getEmail(), $reviewer->getFullName()); if (!$email->isEnabled() || $send && !$email->hasErrors()) { HookRegistry::call('ReviewerAction::confirmReview', array(&$request, &$reviewerSubmission, &$email, $decline)); if ($email->isEnabled()) { $email->setEventType($decline ? MONOGRAPH_EMAIL_REVIEW_DECLINE : MONOGRAPH_EMAIL_REVIEW_CONFIRM); $email->send($request); } $reviewAssignment->setDeclined($decline); $reviewAssignment->setDateConfirmed(Core::getCurrentDate()); $reviewAssignment->stampModified(); $reviewAssignmentDao->updateObject($reviewAssignment); // Add log import('classes.log.MonographLog'); import('classes.log.MonographEventLogEntry'); $entry = new MonographEventLogEntry(); $entry->setMonographId($reviewAssignment->getSubmissionId()); $entry->setUserId($reviewer->getId()); $entry->setDateLogged(Core::getCurrentDate()); $entry->setEventType($decline ? MONOGRAPH_LOG_REVIEW_DECLINE : MONOGRAPH_LOG_REVIEW_ACCEPT); MonographLog::logEvent($request, $reviewerSubmission, $decline ? MONOGRAPH_LOG_REVIEW_DECLINE : MONOGRAPH_LOG_REVIEW_ACCEPT, $decline ? 'log.review.reviewDeclined' : 'log.review.reviewAccepted', array('reviewerName' => $reviewer->getFullName(), 'monographId' => $reviewAssignment->getSubmissionId(), 'round' => $reviewAssignment->getRound())); return true; } else { if (!$request->getUserVar('continued')) { $assignedEditors = $email->ccAssignedEditors($reviewerSubmission->getId()); $reviewingSeriesEditors = $email->toAssignedReviewingSeriesEditors($reviewerSubmission->getId()); if (empty($assignedEditors) && empty($reviewingSeriesEditors)) { $press =& $request->getPress(); $email->addRecipient($press->getSetting('contactEmail'), $press->getSetting('contactName')); $editorialContactName = $press->getSetting('contactName'); } else { if (!empty($reviewingSeriesEditors)) { $editorialContact = array_shift($reviewingSeriesEditors); } else { $editorialContact = array_shift($assignedEditors); } $editorialContactName = $editorialContact->getEditorFullName(); } // Format the review due date $reviewDueDate = strtotime($reviewAssignment->getDateDue()); $dateFormatShort = Config::getVar('general', 'date_format_short'); if ($reviewDueDate == -1) { $reviewDueDate = $dateFormatShort; } else { $reviewDueDate = strftime($dateFormatShort, $reviewDueDate); } $email->assignParams(array('editorialContactName' => $editorialContactName, 'reviewerName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate)); } $paramArray = array('reviewId' => $reviewId); if ($decline) { $paramArray['declineReview'] = 1; } $email->displayEditForm($request->url(null, 'reviewer', 'confirmReview'), $paramArray); return false; } } return true; }