Ejemplo n.º 1
0
 /**
  * Records an editor's submission decision. (Modified: Update if there is already an existing decision.)
  * @param $sectionEditorSubmission object
  * @param $decision int
  * @param $lastDecisionId int (Added)
  */
 function recordDecision($sectionEditorSubmission, $decision, $reviewType, $round, $comments = null, $dateDecided = null, $lastDecisionId = null)
 {
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $user =& Request::getUser();
     $journal =& Request::getJournal();
     $currentDate = date(Core::getCurrentDate());
     $approvalDate = $dateDecided == null ? $currentDate : date($dateDecided);
     // Create the section decision
     import('classes.article.SectionDecision');
     $sectionDecision = new SectionDecision();
     if ($lastDecisionId) {
         $sectionDecision->setId($lastDecisionId);
     }
     $sectionDecision->setArticleId($sectionEditorSubmission->getArticleId());
     $sectionDecision->setDecision($decision);
     $sectionDecision->setReviewType($reviewType);
     $sectionDecision->setRound($round);
     $sectionDecision->setSectionId($user->getSecretaryCommitteeId());
     $sectionDecision->setComments($comments);
     $sectionDecision->setDateDecided($approvalDate);
     if (!HookRegistry::call('SectionEditorAction::recordDecision', array($sectionEditorSubmission, $decision, $reviewType, $round, $dateDecided, $lastDecisionId))) {
         if ($reviewType == REVIEW_TYPE_FR && ($decision == SUBMISSION_SECTION_DECISION_APPROVED || $decision == SUBMISSION_SECTION_DECISION_EXEMPTED && $sectionDecision->getComments())) {
             if (!SectionEditorAction::_publishResearch($sectionEditorSubmission)) {
                 Request::redirect(null, null, 'submissionReview', $sectionEditorSubmission->getArticleId());
             }
         }
         if ($reviewType == REVIEW_TYPE_FR && ($decision == SUBMISSION_SECTION_DECISION_APPROVED || $decision == SUBMISSION_SECTION_DECISION_EXEMPTED && $sectionDecision->getComments())) {
             $sectionEditorSubmission->setStatus(STATUS_COMPLETED);
         } elseif ($decision == SUBMISSION_SECTION_DECISION_EXEMPTED && $sectionDecision->getComments() || $decision == SUBMISSION_SECTION_DECISION_APPROVED || $decision == SUBMISSION_SECTION_DECISION_DONE || $decision == SUBMISSION_SECTION_DECISION_INCOMPLETE || $decision == SUBMISSION_SECTION_DECISION_RESUBMIT) {
             $sectionEditorSubmission->setStatus(STATUS_REVIEWED);
         } elseif ($decision == SUBMISSION_SECTION_DECISION_DECLINED) {
             $sectionEditorSubmission->setStatus(STATUS_ARCHIVED);
         }
         $sectionEditorSubmission->stampStatusModified();
         $sectionEditorSubmission->addDecision($sectionDecision);
         $sectionEditorSubmissionDao->updateSectionEditorSubmission($sectionEditorSubmission);
         // Send a notification to the user
         import('lib.pkp.classes.notification.NotificationManager');
         $notificationManager = new NotificationManager();
         $url = Request::url($journal->getPath(), 'author', 'submissionReview', array($sectionEditorSubmission->getArticleId()));
         switch ($decision) {
             case SUBMISSION_SECTION_DECISION_COMPLETE:
                 $message = 'notification.type.submissionComplete';
                 break;
             case SUBMISSION_SECTION_DECISION_INCOMPLETE:
                 $message = 'notification.type.submissionIncomplete';
                 break;
             case SUBMISSION_SECTION_DECISION_EXPEDITED:
                 $message = 'notification.type.submissionExpedited';
                 break;
             case SUBMISSION_SECTION_DECISION_FULL_REVIEW:
                 $message = 'notification.type.submissionAssigned';
                 break;
             case SUBMISSION_SECTION_DECISION_EXEMPTED:
                 $message = 'notification.type.submissionExempted';
                 break;
             case SUBMISSION_SECTION_DECISION_DECLINED:
                 $message = 'notification.type.submissionDecline';
                 break;
             case SUBMISSION_SECTION_DECISION_APPROVED:
                 $message = 'notification.type.submissionAccept';
                 break;
             case SUBMISSION_SECTION_DECISION_DONE:
                 $message = 'notification.type.submissionDone';
                 break;
             case SUBMISSION_SECTION_DECISION_RESUBMIT:
                 $message = 'notification.type.reviseAndResubmit';
                 break;
         }
         switch ($reviewType) {
             case REVIEW_TYPE_PR:
                 $message = $message . '.continuingReview';
                 break;
             case REVIEW_TYPE_AMENDMENT:
                 $message = $message . '.amendment';
                 break;
             case REVIEW_TYPE_SAE:
                 $message = $message . '.sae';
                 break;
             case REVIEW_TYPE_FR:
                 $message = $message . '.eos';
                 break;
         }
         $notificationManager->createNotification($sectionEditorSubmission->getUserId(), $message, $sectionEditorSubmission->getProposalId(), $url, 1, NOTIFICATION_TYPE_SECTION_DECISION_COMMENT);
         $decisions = SectionEditorSubmission::getAllPossibleEditorDecisionOptions();
         // Add log
         import('classes.article.log.ArticleLog');
         import('classes.article.log.ArticleEventLogEntry');
         Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_OJS_EDITOR, LOCALE_COMPONENT_PKP_SUBMISSION));
         ArticleLog::logEvent($sectionEditorSubmission->getArticleId(), ARTICLE_LOG_SECTION_DECISION, ARTICLE_LOG_TYPE_EDITOR, $user->getId(), 'log.editor.decision', array('editorName' => $user->getFullName(), 'proposalId' => $sectionEditorSubmission->getProposalId(), 'decision' => Locale::translate($sectionDecision->getReviewTypeKey()) . ' - ' . $sectionDecision->getRound() . ': ' . Locale::translate($decisions[$decision])));
     }
 }