/** * Start review stage * @param $args array * @param $request PKPRequest * @see Form::execute() */ function execute($args, &$request) { // 1. Increment the monograph's workflow stage $monograph =& $this->getMonograph(); $monograph->setCurrentStageId(WORKFLOW_STAGE_ID_INTERNAL_REVIEW); $monographDao =& DAORegistry::getDAO('MonographDAO'); $monographDao->updateMonograph($monograph); // 2. Create a new internal review round // FIXME #6102: What to do with reviewType? $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO'); $reviewRoundDao->build($monograph->getId(), REVIEW_TYPE_INTERNAL, 1, 1, REVIEW_ROUND_STATUS_PENDING_REVIEWERS); // 3. Assign the default users import('classes.submission.common.Action'); Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_INTERNAL_REVIEW); // 4. Add the selected files to the new round $selectedFiles = $this->getData('selectedFiles'); if (is_array($selectedFiles)) { $filesForReview = array(); foreach ($selectedFiles as $selectedFile) { $filesForReview[] = explode("-", $selectedFile); } $reviewRoundDAO =& DAORegistry::getDAO('ReviewRoundDAO'); $reviewRoundDAO->setFilesForReview($monograph->getId(), REVIEW_TYPE_INTERNAL, 1, $filesForReview); } }
/** * Save editor decision * @param $args array * @param $request PKPRequest * @see Form::execute() */ function execute($args, &$request) { import('classes.submission.seriesEditor.SeriesEditorAction'); $monographDao =& DAORegistry::getDAO('MonographDAO'); $reviewRoundDao =& DAORegistry::getDAO('ReviewRoundDAO'); $monograph =& $this->getMonograph(); $decision = $this->getDecision(); switch ($decision) { case SUBMISSION_EDITOR_DECISION_ACCEPT: // 1. Record the decision SeriesEditorAction::recordDecision($monograph, SUBMISSION_EDITOR_DECISION_ACCEPT); // 2. select email key $emailKey = 'EDITOR_DECISION_ACCEPT'; // 3. Set status of round $status = REVIEW_ROUND_STATUS_ACCEPTED; // 4. Assign the default users to the next workflow stage Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_EDITING); $monograph->setCurrentStageId(WORKFLOW_STAGE_ID_EDITING); $monographDao->updateMonograph($monograph); break; case SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW: // 1. Record the decision SeriesEditorAction::recordDecision($monograph, SUBMISSION_EDITOR_DECISION_EXTERNAL_REVIEW); // 2. Create a new external review round $reviewRoundDao->build($monograph->getId(), REVIEW_TYPE_EXTERNAL, 1, 1); // 3. Get selected files and put in review_round_files table $selectedFiles = $this->getData('selectedFiles'); $filesForReview = array(); foreach ($selectedFiles as $selectedFile) { $filesForReview[] = explode("-", $selectedFile); } $reviewRoundDao->setFilesForReview($monograph->getId(), REVIEW_TYPE_EXTERNAL, 1, $filesForReview); // 4. select email key // FIXME #6123: will we have an email key for this decision? $emailKey = 'EDITOR_DECISION_ACCEPT'; // 5. Set status of round $status = REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL; // 6. Assign the default users to the next workflow stage Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_EXTERNAL_REVIEW); $monograph->setCurrentStageId(WORKFLOW_STAGE_ID_EXTERNAL_REVIEW); $monograph->setCurrentRound(1); $monographDao->updateMonograph($monograph); break; default: // only support the three decisions above assert(false); } $currentReviewRound =& $reviewRoundDao->build($monograph->getId(), $monograph->getCurrentReviewType(), $monograph->getCurrentRound()); $currentReviewRound->setStatus($status); $reviewRoundDao->updateObject($currentReviewRound); // n. Send Personal message to author $submitter =& $monograph->getUser(); import('classes.mail.MonographMailTemplate'); $email =& new MonographMailTemplate($monograph, $emailKey, null, true); $email->setBody($this->getData('personalMessage')); $email->addRecipient($submitter->getEmail(), $submitter->getFullName()); $email->setAssoc(MONOGRAPH_EMAIL_EDITOR_NOTIFY_AUTHOR, MONOGRAPH_EMAIL_TYPE_EDITOR, $currentReviewRound->getRound()); // Attach the selected reviewer attachments $submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */ $selectedAttachments = $this->getData('selectedAttachments') ? $this->getData('selectedAttachments') : array(); $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO'); $reviewIndexes =& $reviewAssignmentDao->getReviewIndexesForRound($monograph->getId(), $monograph->getCurrentRound()); assert(is_array($reviewIndexes)); if (is_array($selectedAttachments)) { foreach ($selectedAttachments as $attachmentId) { $monographFile =& $submissionFileDao->getLatestRevision($attachmentId); $fileName = $monographFile->getOriginalFileName(); $reviewAssignmentId = $monographFile->getAssocId(); assert($monographFile->getAssocType == ASSOC_TYPE_REVIEW_ASSIGNMENT); assert(is_numeric($reviewAssignmentId)); $email->addAttachment($monographFile->getFilePath(), String::enumerateAlphabetically($reviewIndexes[$reviewAssignmentId]) . '-' . $monographFile->getOriginalFileName()); // Update monograph to set viewable as true, so author can view the file on their submission summary page $monographFile->setViewable(true); $submissionFileDao->updateObject($monographFile); } } $email->send(); }
/** * Save changes to monograph. * @return int the monograph ID */ function execute() { $monographDao =& DAORegistry::getDAO('MonographDAO'); $authorDao =& DAORegistry::getDAO('AuthorDAO'); // Update monograph $monograph =& $this->monograph; $monograph->setTitle($this->getData('title'), null); // Localized $monograph->setAbstract($this->getData('abstract'), null); // Localized if (is_array($this->getData('agenciesKeywords'))) { $monograph->setSupportingAgencies(implode(", ", $this->getData('agenciesKeywords')), null); } // Localized if (is_array($this->getData('disciplinesKeywords'))) { $monograph->setDiscipline(implode(", ", $this->getData('disciplinesKeywords')), null); } // Localized if (is_array($this->getData('keywordKeywords'))) { $monograph->setSubject(implode(", ", $this->getData('keywordKeywords')), null); } // Localized if ($monograph->getSubmissionProgress() <= $this->step) { $monograph->setDateSubmitted(Core::getCurrentDate()); $monograph->stampStatusModified(); $monograph->setSubmissionProgress(0); } // Assign the default users to the submission workflow stage import('classes.submission.common.Action'); Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_SUBMISSION); // Save the monograph $monographDao->updateMonograph($monograph); return $this->monographId; }