next up previous contents
Next: 字串變數 Up: 未完成投稿 Previous: 使用者首頁   Contents

MySQL 資料庫查詢函式

  1. 刪除 submission_progress = 0 的查詢,也就是限制只查詢已完成投稿的稿件。
    [root@csie5 ojs-isend]# diff -urNwbBE ../ojs-2.4.2/classes/submission/editor/EditorSubmissionDAO.inc.php classes/submission/editor/EditorSubmissionDAO.inc.php
    --- ../ojs-2.4.2/classes/submission/editor/EditorSubmissionDAO.inc.php	2013-03-05 07:53:15.000000000 +0800
    +++ classes/submission/editor/EditorSubmissionDAO.inc.php	2014-04-17 17:22:07.613665423 +0800
    @@ -312,8 +312,8 @@
     				LEFT JOIN edit_decisions edec2 ON (a.article_id = edec2.article_id AND edec.edit_decision_id < edec2.edit_decision_id)
     			WHERE	edec2.edit_decision_id IS NULL
     				AND ea2.edit_id IS NULL
    -				AND a.journal_id = ?
    -				AND a.submission_progress = 0' .
    +				AND a.journal_id = ?' .
     				(!empty($additionalWhereSql)?" AND ($additionalWhereSql)":'');
     
     		if ($sectionId) {
    
  2. 查詢未指派稿件中增加 submission_progress = 0 的限制,也就是只查已完成投稿的稿件。
    @@ -374,7 +374,33 @@
     			$journalId, $sectionId, $editorId,
     			$searchField, $searchMatch, $search,
     			$dateField, $dateFrom, $dateTo,
    -			'a.status = ' . STATUS_QUEUED . ' AND ea.edit_id IS NULL',
    +			'a.status = ' . STATUS_QUEUED . ' AND ea.edit_id IS NULL AND a.submission_progress = 0',
    +			$rangeInfo, $sortBy, $sortDirection
    +		);
    +		$returner = new DAOResultFactory($result, $this, '_returnEditorSubmissionFromRow');
    +		return $returner;
    +	}
    +
    
  3. 增加未完成投稿稿件查詢函式 getEditorSubmissionsUncompleted,查詢條件為 submission_progress != 0,也就投稿步驟還在第一至第四步驟之間。
    +	/**
    +	 * Get all submissions unassigned for a journal.
    +	 * @param $journalId int
    +	 * @param $sectionId int
    +	 * @param $editorId int
    +	 * @param $searchField int Symbolic SUBMISSION_FIELD_... identifier
    +	 * @param $searchMatch string "is" or "contains" or "startsWith"
    +	 * @param $search String to look in $searchField for
    +	 * @param $dateField int Symbolic SUBMISSION_FIELD_DATE_... identifier
    +	 * @param $dateFrom String date to search from
    +	 * @param $dateTo String date to search to
    +	 * @param $rangeInfo object
    +	 * @return array EditorSubmission
    +	 */
    +	function &getEditorSubmissionsUncompleted($journalId, $sectionId, $editorId, $searchField = null, $searchMatch = null, $search = null, $dateField = null, $dateFrom = null, $dateTo = null, $rangeInfo = null, $sortBy = null, $sortDirection = SORT_DIRECTION_ASC) {
    +		$result =& $this->_getUnfilteredEditorSubmissions(
    +			$journalId, $sectionId, $editorId,
    +			$searchField, $searchMatch, $search,
    +			$dateField, $dateFrom, $dateTo,
    +			'a.submission_progress != 0',
     		);
     		$returner = new DAOResultFactory($result, $this, '_returnEditorSubmissionFromRow');
    
  4. 增加陣列 submissionsCount 第 4 個元素,做為未完成投稿稿件的數量統計。
    @@ -490,7 +516,7 @@
     	 */
     	function &getEditorSubmissionsCount($journalId) {
     		$submissionsCount = array();
    -		for($i = 0; $i < 3; $i++) {
    +		for($i = 0; $i < 4; $i++) {
     			$submissionsCount[$i] = 0;
     		}
    
  5. 統計未完成投稿稿件的數量,放到陣列 submissionsCount 第 4 個元素。
    @@ -560,6 +586,17 @@
     		$submissionsCount[2] = $result->Fields('editing_count');
     		$result->Close();
     
    +		// Fetch a count of submissions in uncompleted.
    +		$result =& $this->retrieve(
    +			'SELECT	COUNT(*) AS uncompleted_count
    +			FROM	articles a
    +			WHERE	a.journal_id = ?
    +				AND a.submission_progress != 0',
    +			array((int) $journalId)
    +		);
    +		$submissionsCount[3] = $result->Fields('uncompleted_count');
    +		$result->Close();
    +
     		return $submissionsCount;
     	}
    



2016-10-25