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

Collapse All | Expand All

(-)classes/submission/editor/EditorSubmissionDAO.inc.php (-172 / +43 lines)
 Lines 154-202    Link Here 
154
	}
154
	}
155
155
156
	/**
156
	/**
157
	 * Get all submissions for a journal.
158
	 * @param $journalId int
159
	 * @param $status boolean true if queued, false if archived.
160
	 * @return array EditorSubmission
161
	 */
162
	function &getEditorSubmissions($journalId, $status = true, $sectionId = 0, $rangeInfo = null) {
163
		$primaryLocale = Locale::getPrimaryLocale();
164
		$locale = Locale::getLocale();
165
		$params = array(
166
			'title',
167
			$primaryLocale,
168
			'title',
169
			$locale,
170
			'abbrev',
171
			$primaryLocale,
172
			'abbrev',
173
			$locale,
174
			$journalId,
175
			$status
176
		);
177
		if ($sectionId) $params[] = $sectionId;
178
179
		$sql = 'SELECT	a.*,
180
				COALESCE(stl.setting_value, stpl.setting_value) AS section_title,
181
				COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev
182
183
			FROM	articles a
184
				LEFT JOIN sections s ON (s.section_id = a.section_id)
185
				LEFT JOIN section_settings stpl ON (s.section_id = stpl.section_id AND stpl.setting_name = ? AND stpl.locale = ?)
186
				LEFT JOIN section_settings stl ON (s.section_id = stl.section_id AND stl.setting_name = ? AND stl.locale = ?)
187
				LEFT JOIN section_settings sapl ON (s.section_id = sapl.section_id AND sapl.setting_name = ? AND sapl.locale = ?)
188
				LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
189
			WHERE	a.journal_id = ?
190
				AND a.status = ?' .
191
				($sectionId?' AND a.section_id = ?':'') .
192
			' ORDER BY article_id ASC';
193
194
		$result =& $this->retrieveRange($sql, $params, $rangeInfo);
195
		$returner = new DAOResultFactory($result, $this, '_returnEditorSubmissionFromRow');
196
		return $returner;
197
	}
198
199
	/**
200
	 * Get all unfiltered submissions for a journal.
157
	 * Get all unfiltered submissions for a journal.
201
	 * @param $journalId int
158
	 * @param $journalId int
202
	 * @param $sectionId int
159
	 * @param $sectionId int
 Lines 207-217    Link Here 
207
	 * @param $dateField int Symbolic SUBMISSION_FIELD_DATE_... identifier
164
	 * @param $dateField int Symbolic SUBMISSION_FIELD_DATE_... identifier
208
	 * @param $dateFrom String date to search from
165
	 * @param $dateFrom String date to search from
209
	 * @param $dateTo String date to search to
166
	 * @param $dateTo String date to search to
210
	 * @param $status boolean whether to return active or not
167
	 * @param $additionalWhereSql String additional SQL "where" clause info
211
	 * @param $rangeInfo object
168
	 * @param $rangeInfo object
212
	 * @return array result
169
	 * @return array result
213
	 */
170
	 */
214
	function &getUnfilteredEditorSubmissions($journalId, $sectionId = 0, $editorId = 0, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $status = true, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
171
	function &_getUnfilteredEditorSubmissions($journalId, $sectionId = 0, $editorId = 0, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $additionalWhereSql, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
215
		$primaryLocale = Locale::getPrimaryLocale();
172
		$primaryLocale = Locale::getPrimaryLocale();
216
		$locale = Locale::getLocale();
173
		$locale = Locale::getLocale();
217
		$params = array(
174
		$params = array(
 Lines 334-347    Link Here 
334
				LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
291
				LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
335
				LEFT JOIN article_settings atpl ON (a.article_id = atpl.article_id AND atpl.setting_name = ? AND atpl.locale = ?)
292
				LEFT JOIN article_settings atpl ON (a.article_id = atpl.article_id AND atpl.setting_name = ? AND atpl.locale = ?)
336
				LEFT JOIN article_settings atl ON (a.article_id = atl.article_id AND atl.setting_name = ? AND atl.locale = ?)
293
				LEFT JOIN article_settings atl ON (a.article_id = atl.article_id AND atl.setting_name = ? AND atl.locale = ?)
337
			WHERE
294
				LEFT JOIN edit_assignments ea ON (a.article_id = ea.article_id)
338
				a.journal_id = ? AND a.submission_progress = 0';
295
				LEFT JOIN edit_assignments ea2 ON (a.article_id = ea2.article_id AND ea.edit_id < ea2.edit_id)
339
296
				LEFT JOIN edit_decisions edec ON (a.article_id = edec.article_id)
340
		// "Active" submissions have a status of STATUS_QUEUED and
297
				LEFT JOIN edit_decisions edec2 ON (a.article_id = edec2.article_id AND edec.date_decided < edec2.date_decided)
341
		// the layout editor has not yet been acknowledged.
298
			WHERE	edec2.date_decided IS NULL
342
		// A status value of null doesn't discriminate.
299
				AND ea2.edit_id IS NULL
343
		if ($status === true) $sql .= ' AND a.status = ' . STATUS_QUEUED;
300
				AND a.journal_id = ?
344
		elseif ($status === false) $sql .= ' AND a.status <> ' . STATUS_QUEUED;
301
				AND a.submission_progress = 0' .
302
				(!empty($additionalWhereSql)?" AND ($additionalWhereSql)":'');
345
303
346
		if ($sectionId) {
304
		if ($sectionId) {
347
			$searchSql .= ' AND a.section_id = ?';
305
			$searchSql .= ' AND a.section_id = ?';
 Lines 397-424    Link Here 
397
	 * @return array EditorSubmission
355
	 * @return array EditorSubmission
398
	 */
356
	 */
399
	function &getEditorSubmissionsUnassigned($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
357
	function &getEditorSubmissionsUnassigned($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
400
		$editorSubmissions = array();
358
		$result =& $this->_getUnfilteredEditorSubmissions(
401
359
			$journalId, $sectionId, $editorId,
402
		// FIXME Does not pass $rangeInfo else we only get partial results
360
			$searchField, $searchMatch, $search,
403
		$result = $this->getUnfilteredEditorSubmissions($journalId, $sectionId, $editorId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, true, null, $sortBy, $sortDirection);
361
			$dateField, $dateFrom, $dateTo,
404
362
			'a.status = ' . STATUS_QUEUED . ' AND ea.edit_id IS NULL',
405
		while (!$result->EOF) {
363
			$rangeInfo, $sortBy, $sortDirection
406
			$editorSubmission =& $this->_returnEditorSubmissionFromRow($result->GetRowAssoc(false));
364
		);
407
365
		$returner = new DAOResultFactory($result, $this, '_returnEditorSubmissionFromRow');
408
			// used to check if editor exists for this submission
409
			$editAssignments =& $editorSubmission->getEditAssignments();
410
411
			if (empty($editAssignments)) {
412
				$editorSubmissions[] =& $editorSubmission;
413
			}
414
			unset($editorSubmission);
415
			$result->MoveNext();
416
		}
417
		$result->Close();
418
		unset($result);
419
420
		import('core.ArrayItemIterator');
421
		$returner =& ArrayItemIterator::fromRangeInfo($editorSubmissions, $rangeInfo);
422
		return $returner;
366
		return $returner;
423
	}
367
	}
424
368
 Lines 437-483    Link Here 
437
	 * @return array EditorSubmission
381
	 * @return array EditorSubmission
438
	 */
382
	 */
439
	function &getEditorSubmissionsInReview($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
383
	function &getEditorSubmissionsInReview($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
440
		$editorSubmissions = array();
384
		$result =& $this->_getUnfilteredEditorSubmissions(
441
385
			$journalId, $sectionId, $editorId,
442
		// FIXME Does not pass $rangeInfo else we only get partial results
386
			$searchField, $searchMatch, $search,
443
		$result = $this->getUnfilteredEditorSubmissions($journalId, $sectionId, $editorId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, true, null, $sortBy, $sortDirection);
387
			$dateField, $dateFrom, $dateTo,
444
388
			'a.status = ' . STATUS_QUEUED . ' AND ea.edit_id IS NOT NULL AND edec.decision <> ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
445
		$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
389
			$rangeInfo, $sortBy, $sortDirection
446
		while (!$result->EOF) {
390
		);
447
			$editorSubmission =& $this->_returnEditorSubmissionFromRow($result->GetRowAssoc(false));
391
		$returner = new DAOResultFactory($result, $this, '_returnEditorSubmissionFromRow');
448
			$articleId = $editorSubmission->getArticleId();
449
			for ($i = 1; $i <= $editorSubmission->getCurrentRound(); $i++) {
450
				$reviewAssignment =& $reviewAssignmentDao->getReviewAssignmentsByArticleId($articleId, $i);
451
				if (!empty($reviewAssignment)) {
452
					$editorSubmission->setReviewAssignments($reviewAssignment, $i);
453
				}
454
			}
455
456
			// check if submission is still in review
457
			$inReview = true;
458
			$decisions = $editorSubmission->getDecisions();
459
			$decision = array_pop($decisions);
460
			if (!empty($decision)) {
461
				$latestDecision = array_pop($decision);
462
				if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
463
					$inReview = false;			
464
				}
465
			}
466
467
			// used to check if editor exists for this submission
468
			$editAssignments =& $editorSubmission->getEditAssignments();
469
470
			if (!empty($editAssignments) && $inReview) {
471
				$editorSubmissions[] =& $editorSubmission;
472
			}
473
			unset($editorSubmission);
474
			$result->MoveNext();
475
		}
476
		$result->Close();
477
		unset($result);
478
479
		import('core.ArrayItemIterator');
480
		$returner =& ArrayItemIterator::fromRangeInfo($editorSubmissions, $rangeInfo);
481
		return $returner;
392
		return $returner;
482
	}
393
	}
483
394
 Lines 496-536    Link Here 
496
	 * @return array EditorSubmission
407
	 * @return array EditorSubmission
497
	 */
408
	 */
498
	function &getEditorSubmissionsInEditing($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
409
	function &getEditorSubmissionsInEditing($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
499
		$editorSubmissions = array();
410
		$result =& $this->_getUnfilteredEditorSubmissions(
500
		$signoffDao =& DAORegistry::getDAO('SignoffDAO');
411
			$journalId, $sectionId, $editorId,
501
412
			$searchField, $searchMatch, $search,
502
		// FIXME Does not pass $rangeInfo else we only get partial results
413
			$dateField, $dateFrom, $dateTo,
503
		$result = $this->getUnfilteredEditorSubmissions($journalId, $sectionId, $editorId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, true, null, $sortBy, $sortDirection);
414
			'a.status = ' . STATUS_QUEUED . ' AND ea.edit_id IS NOT NULL AND edec.decision = ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
504
415
			$rangeInfo, $sortBy, $sortDirection
505
		while (!$result->EOF) {
416
		);
506
			$editorSubmission =& $this->_returnEditorSubmissionFromRow($result->GetRowAssoc(false));
417
		$returner = new DAOResultFactory($result, $this, '_returnEditorSubmissionFromRow');
507
			$articleId = $editorSubmission->getArticleId();
508
509
			// check if submission is still in review
510
			$inEditing = false;
511
			$decisions = $editorSubmission->getDecisions();
512
			$decision = array_pop($decisions);
513
			if (!empty($decision)) {
514
				$latestDecision = array_pop($decision);
515
				if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
516
					$inEditing = true;	
517
				}
518
			}
519
520
			// used to check if editor exists for this submission
521
			$editAssignments = $editorSubmission->getEditAssignments();
522
523
			if ($inEditing && !empty($editAssignments)) {
524
				$editorSubmissions[] =& $editorSubmission;
525
			}
526
			unset($editorSubmission);
527
			$result->MoveNext();
528
		}
529
		$result->Close();
530
		unset($result);
531
532
		import('core.ArrayItemIterator');
533
		$returner =& ArrayItemIterator::fromRangeInfo($editorSubmissions, $rangeInfo);
534
		return $returner;
418
		return $returner;
535
	}
419
	}
536
420
 Lines 549-575    Link Here 
549
	 * @return array EditorSubmission
433
	 * @return array EditorSubmission
550
	 */
434
	 */
551
	function &getEditorSubmissionsArchives($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
435
	function &getEditorSubmissionsArchives($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
552
		$editorSubmissions = array();
436
		$result =& $this->_getUnfilteredEditorSubmissions(
553
437
			$journalId, $sectionId, $editorId,
554
		$result = $this->getUnfilteredEditorSubmissions($journalId, $sectionId, $editorId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, false, $rangeInfo, $sortBy, $sortDirection);
438
			$searchField, $searchMatch, $search,
555
		while (!$result->EOF) {
439
			$dateField, $dateFrom, $dateTo,
556
			$editorSubmission =& $this->_returnEditorSubmissionFromRow($result->GetRowAssoc(false));
440
			'a.status = ' . STATUS_QUEUED,
557
			$editorSubmissions[] =& $editorSubmission;
441
			$rangeInfo, $sortBy, $sortDirection
558
			unset($editorSubmission);
442
		);
559
			$result->MoveNext();
443
		$returner = new DAOResultFactory($result, $this, '_returnEditorSubmissionFromRow');
560
		}
561
562
		if (isset($rangeInfo) && $rangeInfo->isValid()) {
563
			import('core.VirtualArrayIterator');
564
			$returner = new VirtualArrayIterator($editorSubmissions, $result->MaxRecordCount(), $rangeInfo->getPage(), $rangeInfo->getCount());
565
		} else {
566
			import('core.ArrayItemIterator');
567
			$returner = new ArrayItemIterator($editorSubmissions);
568
		}
569
570
		$result->Close();
571
		unset($result);
572
573
		return $returner;
444
		return $returner;
574
	}
445
	}
575
446
(-)classes/submission/sectionEditor/SectionEditorSubmissionDAO.inc.php (-92 / +30 lines)
 Lines 326-332    Link Here 
326
	/**
326
	/**
327
	 * Retrieve unfiltered section editor submissions
327
	 * Retrieve unfiltered section editor submissions
328
	 */
328
	 */
329
	function &getUnfilteredSectionEditorSubmissions($sectionEditorId, $journalId, $sectionId = 0, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $status = true, $additionalWhereSql = '', $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
329
	function &_getUnfilteredSectionEditorSubmissions($sectionEditorId, $journalId, $sectionId = 0, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $additionalWhereSql = '', $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
330
		$primaryLocale = Locale::getPrimaryLocale();
330
		$primaryLocale = Locale::getPrimaryLocale();
331
		$locale = Locale::getLocale();
331
		$locale = Locale::getLocale();
332
332
 Lines 433-439    Link Here 
433
					$searchSql .= ' AND p.date_proofreader_completed >= ' . $this->datetimeToDB($dateFrom);
433
					$searchSql .= ' AND p.date_proofreader_completed >= ' . $this->datetimeToDB($dateFrom);
434
				}
434
				}
435
				if (!empty($dateTo)) {
435
				if (!empty($dateTo)) {
436
					$searchSql .= 'AND p.date_proofreader_completed <= ' . $this->datetimeToDB($dateTo);
436
					$searchSql .= ' AND p.date_proofreader_completed <= ' . $this->datetimeToDB($dateTo);
437
				}
437
				}
438
				break;
438
				break;
439
		}
439
		}
 Lines 469-482    Link Here 
469
				LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
469
				LEFT JOIN section_settings sal ON (s.section_id = sal.section_id AND sal.setting_name = ? AND sal.locale = ?)
470
				LEFT JOIN article_settings atpl ON (atpl.article_id = a.article_id AND atpl.setting_name = ? AND atpl.locale = ?)
470
				LEFT JOIN article_settings atpl ON (atpl.article_id = a.article_id AND atpl.setting_name = ? AND atpl.locale = ?)
471
				LEFT JOIN article_settings atl ON (a.article_id = atl.article_id AND atl.setting_name = ? AND atl.locale = ?)
471
				LEFT JOIN article_settings atl ON (a.article_id = atl.article_id AND atl.setting_name = ? AND atl.locale = ?)
472
				LEFT JOIN edit_decisions edec ON (a.article_id = edec.article_id)
473
				LEFT JOIN edit_decisions edec2 ON (a.article_id = edec2.article_id AND edec.date_decided < edec2.date_decided)
472
			WHERE	a.journal_id = ?
474
			WHERE	a.journal_id = ?
473
				AND e.editor_id = ?
475
				AND e.editor_id = ?
474
				AND a.submission_progress = 0' . (!empty($additionalWhereSql)?" AND ($additionalWhereSql)":"");
476
				AND a.submission_progress = 0' . (!empty($additionalWhereSql)?" AND ($additionalWhereSql)":'') . '
475
477
				AND edec2.date_decided IS NULL';
476
		// "Active" submissions have a status of STATUS_QUEUED and
477
		// the layout editor has not yet been acknowledged.
478
		if ($status) $sql .= ' AND a.status = ' . STATUS_QUEUED;
479
		else $sql .= ' AND a.status <> ' . STATUS_QUEUED;
480
478
481
		if ($sectionId) {
479
		if ($sectionId) {
482
			$params[] = $sectionId;
480
			$params[] = $sectionId;
 Lines 505-543    Link Here 
505
	 * @return array EditorSubmission
503
	 * @return array EditorSubmission
506
	 */
504
	 */
507
	function &getSectionEditorSubmissionsInReview($sectionEditorId, $journalId, $sectionId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
505
	function &getSectionEditorSubmissionsInReview($sectionEditorId, $journalId, $sectionId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
508
		$submissions = array();
506
		$result =& $this->_getUnfilteredSectionEditorSubmissions(
509
507
			$sectionEditorId, $journalId, $sectionId,
510
		// FIXME Does not pass $rangeInfo else we only get partial results
508
			$searchField, $searchMatch, $search,
511
		$result = $this->getUnfilteredSectionEditorSubmissions($sectionEditorId, $journalId, $sectionId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, true, 'e.can_review = 1', null, $sortBy, $sortDirection);
509
			$dateField, $dateFrom, $dateTo,
512
510
			'a.status = ' . STATUS_QUEUED . ' AND e.can_review = 1 AND edec.decision <> ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
513
		while (!$result->EOF) {
511
			$rangeInfo, $sortBy, $sortDirection
514
			$row = $result->GetRowAssoc(false);
512
		);
515
			$submission =& $this->_returnSectionEditorSubmissionFromRow($row);
513
		$returner = new DAOResultFactory($result, $this, '_returnSectionEditorSubmissionFromRow');
516
			$articleId = $submission->getArticleId();
517
518
			// check if submission is still in review
519
			$inReview = true;
520
			$decisions = $submission->getDecisions();
521
			$decision = array_pop($decisions);
522
			if (!empty($decision)) {
523
				$latestDecision = array_pop($decision);
524
				if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
525
					$inReview = false;
526
				}
527
			}
528
			if ($inReview) $submissions[] =& $submission;
529
530
			unset($submission);
531
			$result->MoveNext();
532
		}
533
534
		$result->Close();
535
		unset($result);
536
537
		import('core.ArrayItemIterator');
538
		$returner =& ArrayItemIterator::fromRangeInfo($submissions, $rangeInfo);
539
		return $returner;
514
		return $returner;
540
541
	}
515
	}
542
516
543
	/**
517
	/**
 Lines 554-589    Link Here 
554
	 * @return array EditorSubmission
528
	 * @return array EditorSubmission
555
	 */
529
	 */
556
	function &getSectionEditorSubmissionsInEditing($sectionEditorId, $journalId, $sectionId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
530
	function &getSectionEditorSubmissionsInEditing($sectionEditorId, $journalId, $sectionId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
557
		$submissions = array();
531
		$result =& $this->_getUnfilteredSectionEditorSubmissions(
558
532
			$sectionEditorId, $journalId, $sectionId,
559
		// FIXME Does not pass $rangeInfo else we only get partial results
533
			$searchField, $searchMatch, $search,
560
		$result = $this->getUnfilteredSectionEditorSubmissions($sectionEditorId, $journalId, $sectionId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, true, 'e.can_edit = 1', null, $sortBy, $sortDirection);
534
			$dateField, $dateFrom, $dateTo,
561
535
			'a.status = ' . STATUS_QUEUED . ' AND e.can_edit = 1 AND edec.decision = ' . SUBMISSION_EDITOR_DECISION_ACCEPT,
562
		while (!$result->EOF) {
536
			$rangeInfo, $sortBy, $sortDirection
563
			$row = $result->GetRowAssoc(false);
537
		);
564
			$submission =& $this->_returnSectionEditorSubmissionFromRow($row);
538
		$returner = new DAOResultFactory($result, $this, '_returnSectionEditorSubmissionFromRow');
565
566
			// check if submission is still in review
567
			$inReview = true;
568
			$decisions = $submission->getDecisions();
569
			$decision = array_pop($decisions);
570
			if (!empty($decision)) {
571
				$latestDecision = array_pop($decision);
572
				if ($latestDecision['decision'] == SUBMISSION_EDITOR_DECISION_ACCEPT) {
573
					$inReview = false;
574
				}
575
			}
576
			if (!$inReview) $submissions[] =& $submission;
577
578
			unset($submission);
579
			$result->MoveNext();
580
		}
581
582
		$result->Close();
583
		unset($result);
584
585
		import('core.ArrayItemIterator');
586
		$returner =& ArrayItemIterator::fromRangeInfo($submissions, $rangeInfo);
587
		return $returner;
539
		return $returner;
588
	}
540
	}
589
541
 Lines 601-628    Link Here 
601
	 * @return array EditorSubmission
553
	 * @return array EditorSubmission
602
	 */
554
	 */
603
	function &getSectionEditorSubmissionsArchives($sectionEditorId, $journalId, $sectionId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
555
	function &getSectionEditorSubmissionsArchives($sectionEditorId, $journalId, $sectionId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
604
		$submissions = array();
556
		$result = $this->_getUnfilteredSectionEditorSubmissions(
605
557
			$sectionEditorId, $journalId, $sectionId,
606
		$result = $this->getUnfilteredSectionEditorSubmissions($sectionEditorId, $journalId, $sectionId, $searchField, $searchMatch, $search, $dateField, $dateFrom, $dateTo, false, '', $rangeInfo, $sortBy, $sortDirection);
558
			$searchField, $searchMatch, $search,
607
559
			$dateField, $dateFrom, $dateTo,
608
		while (!$result->EOF) {
560
			'a.status <> ' . STATUS_QUEUED,
609
			$submission =& $this->_returnSectionEditorSubmissionFromRow($result->GetRowAssoc(false));
561
			$rangeInfo, $sortBy, $sortDirection
610
			$submissions[] =& $submission;
562
		);
611
			unset($submission);
563
		$returner = new DAOResultFactory($result, $this, '_returnSectionEditorSubmissionFromRow');
612
			$result->MoveNext();
613
		}
614
615
		if (isset($rangeInfo) && $rangeInfo->isValid()) {
616
			import('core.VirtualArrayIterator');
617
			$returner = new VirtualArrayIterator($submissions, $result->MaxRecordCount(), $rangeInfo->getPage(), $rangeInfo->getCount());
618
		} else {
619
			import('core.ArrayItemIterator');
620
			$returner = new ArrayItemIterator($submissions);
621
		}
622
623
		$result->Close();
624
		unset($result);
625
626
		return $returner;
564
		return $returner;
627
	}
565
	}
628
566

Return to bug 4737