We are moving to Git Issues for bug tracking in future releases. During transition, content will be in both tools. If you'd like to file a new bug, please create an issue.

View | Details | Raw Unified | Return to bug 4737 | Differences between
and this patch

Collapse All | Expand All

(-)classes/submission/editor/EditorSubmissionDAO.inc.php (-39 / +66 lines)
 Lines 17-23    Link Here 
17
17
18
18
19
import('submission.editor.EditorSubmission');
19
import('submission.editor.EditorSubmission');
20
import('submission.author.AuthorSubmission'); // Bring in editor decision constants
20
21
// Bring in editor decision constants
22
import('submission.common.Action');
23
import('submission.author.AuthorSubmission');
21
24
22
class EditorSubmissionDAO extends DAO {
25
class EditorSubmissionDAO extends DAO {
23
	var $articleDao;
26
	var $articleDao;
 Lines 574-625    Link Here 
574
	 * Function used for counting purposes for right nav bar
577
	 * Function used for counting purposes for right nav bar
575
	 */
578
	 */
576
	function &getEditorSubmissionsCount($journalId) {
579
	function &getEditorSubmissionsCount($journalId) {
577
578
		$submissionsCount = array();
580
		$submissionsCount = array();
579
		for($i = 0; $i < 3; $i++) {
581
		for($i = 0; $i < 3; $i++) {
580
			$submissionsCount[$i] = 0;
582
			$submissionsCount[$i] = 0;
581
		}
583
		}
582
584
583
		$result =& $this->getUnfilteredEditorSubmissions($journalId);
585
		// Fetch a count of unassigned submissions.
584
586
		// "e2" and "e" are used to fetch only a single assignment
585
		while (!$result->EOF) {
587
		// if several exist.
586
			$editorSubmission =& $this->_returnEditorSubmissionFromRow($result->GetRowAssoc(false));
588
		$result =& $this->retrieve(
587
589
			'SELECT	COUNT(*) AS unassigned_count
588
			// check if submission is still in review
590
			FROM	articles a
589
			$inReview = true;
591
				LEFT JOIN edit_assignments e ON (a.article_id = e.article_id)
590
			$notDeclined = true;
592
				LEFT JOIN edit_assignments e2 ON (a.article_id = e2.article_id AND e.edit_id < e2.edit_id)
591
			$decisions = $editorSubmission->getDecisions();
593
			WHERE	a.journal_id = ?
592
			$decision = array_pop($decisions);
594
				AND a.submission_progress = 0
593
			if (!empty($decision)) {
595
				AND a.status = ' . STATUS_QUEUED . '
594
				$latestDecision = array_pop($decision);
596
				AND e2.edit_id IS NULL
595
				import('submission.common.Action');
597
				AND e.edit_id IS NULL',
596
				if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
598
			array((int) $journalId)
597
					$inReview = false;
599
		);
598
				}
600
		$submissionsCount[0] = $result->Fields('unassigned_count');
599
			}
601
		$result->Close();
600
602
601
			// used to check if editor exists for this submission
603
		// Fetch a count of submissions in review.
602
			$editAssignments = $editorSubmission->getEditAssignments();
604
		// "e2" and "e" are used to fetch only a single assignment
605
		// if several exist.
606
		// "d2" and "d" are used to fetch the single most recent
607
		// editor decision.
608
		$result =& $this->retrieve(
609
			'SELECT	COUNT(*) AS review_count
610
			FROM	articles a
611
				LEFT JOIN edit_assignments e ON (a.article_id = e.article_id)
612
				LEFT JOIN edit_assignments e2 ON (a.article_id = e2.article_id AND e.edit_id < e2.edit_id)
613
				LEFT JOIN edit_decisions d ON (a.article_id = d.article_id)
614
				LEFT JOIN edit_decisions d2 ON (a.article_id = d2.article_id AND d.date_decided < d2.date_decided)
615
			WHERE	a.journal_id = ?
616
				AND a.submission_progress = 0
617
				AND a.status = ' . STATUS_QUEUED . '
618
				AND e2.edit_id IS NULL
619
				AND e.edit_id IS NOT NULL
620
				AND d2.date_decided IS NULL
621
				AND d.decision <> ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
622
			array((int) $journalId)
623
		);
624
		$submissionsCount[1] = $result->Fields('review_count');
625
		$result->Close();
603
626
604
			if (empty($editAssignments)) {
627
		// Fetch a count of submissions in editing.
605
				// unassigned submissions
628
		// "e2" and "e" are used to fetch only a single assignment
606
				$submissionsCount[0] += 1;
629
		// if several exist.
607
			} else {
630
		// "d2" and "d" are used to fetch the single most recent
608
				if ($inReview) {
631
		// editor decision.
609
					if ($notDeclined) {
632
		$result =& $this->retrieve(
610
						// in review submissions
633
			'SELECT	COUNT(*) AS editing_count
611
						$submissionsCount[1] += 1;
634
			FROM	articles a
612
					}
635
				LEFT JOIN edit_assignments e ON (a.article_id = e.article_id)
613
				} else {
636
				LEFT JOIN edit_assignments e2 ON (a.article_id = e2.article_id AND e.edit_id < e2.edit_id)
614
					// in editing submissions
637
				LEFT JOIN edit_decisions d ON (a.article_id = d.article_id)
615
					$submissionsCount[2] += 1;					
638
				LEFT JOIN edit_decisions d2 ON (a.article_id = d2.article_id AND d.date_decided < d2.date_decided)
616
				}
639
			WHERE	a.journal_id = ?
617
			}
640
				AND a.submission_progress = 0
618
			unset($editorSubmission);
641
				AND a.status = ' . STATUS_QUEUED . '
619
			$result->MoveNext();
642
				AND e2.edit_id IS NULL
620
		}
643
				AND e.edit_id IS NOT NULL
644
				AND d2.date_decided IS NULL
645
				AND d.decision = ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
646
			array((int) $journalId)
647
		);
648
		$submissionsCount[2] = $result->Fields('editing_count');
621
		$result->Close();
649
		$result->Close();
622
		unset($result);
623
650
624
		return $submissionsCount;
651
		return $submissionsCount;
625
	}
652
	}
(-)classes/submission/sectionEditor/SectionEditorSubmissionDAO.inc.php (-36 / +38 lines)
 Lines 630-677    Link Here 
630
	 * Function used for counting purposes for right nav bar
630
	 * Function used for counting purposes for right nav bar
631
	 */
631
	 */
632
	function &getSectionEditorSubmissionsCount($sectionEditorId, $journalId) {
632
	function &getSectionEditorSubmissionsCount($sectionEditorId, $journalId) {
633
634
		$submissionsCount = array();
633
		$submissionsCount = array();
635
		for($i = 0; $i < 2; $i++) {
634
		for($i = 0; $i < 2; $i++) {
636
			$submissionsCount[$i] = 0;
635
			$submissionsCount[$i] = 0;
637
		}
636
		}
638
637
639
		$result = $this->getUnfilteredSectionEditorSubmissions($sectionEditorId, $journalId);
638
		// Fetch a count of submissions in review.
640
639
		// "d2" and "d" are used to fetch the single most recent
641
		while (!$result->EOF) {
640
		// editor decision.
642
			$row = $result->GetRowAssoc(false);
641
		$result =& $this->retrieve(
643
			$sectionEditorSubmission =& $this->_returnSectionEditorSubmissionFromRow($row);
642
			'SELECT	COUNT(*) AS review_count
644
643
			FROM	articles a
645
			// check if submission is still in review
644
				LEFT JOIN edit_assignments e ON (a.article_id = e.article_id)
646
			$inReview = true;
645
				LEFT JOIN edit_decisions d ON (a.article_id = d.article_id)
647
			$decisions = $sectionEditorSubmission->getDecisions();
646
				LEFT JOIN edit_decisions d2 ON (a.article_id = d2.article_id AND d.date_decided < d2.date_decided)
648
			$decision = array_pop($decisions);
647
			WHERE	a.journal_id = ?
649
648
				AND e.editor_id = ?
650
			if (!empty($decision)) {
649
				AND a.submission_progress = 0
651
				$latestDecision = array_pop($decision);
650
				AND a.status = ' . STATUS_QUEUED . '
652
				if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
651
				AND d2.date_decided IS NULL
653
					$inReview = false;
652
				AND d.decision <> ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
654
				}
653
			array((int) $journalId, (int) $sectionEditorId)
655
			}
654
		);
656
655
		$submissionsCount[0] = $result->Fields('review_count');
657
			if ($inReview) {
656
		$result->Close();
658
				if ($row['can_review']) {
657
659
					// in review submissions
658
		// Fetch a count of submissions in editing.
660
					$submissionsCount[0] += 1;
659
		// "d2" and "d" are used to fetch the single most recent
661
				}
660
		// editor decision.
662
			} else {
661
		$result =& $this->retrieve(
663
				// in editing submissions
662
			'SELECT	COUNT(*) AS editing_count
664
				if ($row['can_edit']) {
663
			FROM	articles a
665
					$submissionsCount[1] += 1;
664
				LEFT JOIN edit_assignments e ON (a.article_id = e.article_id)
666
				}
665
				LEFT JOIN edit_decisions d ON (a.article_id = d.article_id)
667
			}
666
				LEFT JOIN edit_decisions d2 ON (a.article_id = d2.article_id AND d.date_decided < d2.date_decided)
668
			unset($sectionEditorSubmission);
667
			WHERE	a.journal_id = ?
669
			$result->MoveNext();
668
				AND e.editor_id = ?
670
		}
669
				AND a.submission_progress = 0
671
670
				AND a.status = ' . STATUS_QUEUED . '
671
				AND d2.date_decided IS NULL
672
				AND d.decision = ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
673
			array((int) $journalId, (int) $sectionEditorId)
674
		);
675
		$submissionsCount[1] = $result->Fields('editing_count');
672
		$result->Close();
676
		$result->Close();
673
		unset($result);
674
675
		return $submissionsCount;
677
		return $submissionsCount;
676
	}
678
	}
677
679

Return to bug 4737