Example #1
0
	/**
	 * Set the workflow state of the issue.
	 *
	 * @param string $p_value
	 *		Can be NULL, 'Y', 'N', TRUE, or FALSE.
	 *		If set to NULL, the current value will be reversed.
	 *
	 * @return void
	 */
	public function setWorkflowStatus($p_value = null)
	{
		$doPublish = null;
		if (is_null($p_value)) {
			if ($this->m_data['Published'] == 'Y') {
				$doPublish = false;
			} else {
				$doPublish = true;
			}
		} else {
			if (is_string($p_value)) {
				$p_value = strtoupper($p_value);
			}
			if (($this->m_data['Published'] == 'N') && (($p_value == 'Y') || ($p_value === true))) {
				$doPublish = true;
			} elseif (($this->m_data['Published'] == 'Y') && (($p_value == 'N') || ($p_value === false))) {
				$doPublish = false;
			}
		}
		if (!is_null($doPublish)) {
			Article::OnIssuePublish($this->getPublicationId(), $this->getLanguageId(),
			$this->getIssueNumber(), $doPublish);
			if ($doPublish) {
				$this->setProperty('Published', 'Y', true);
				$this->setProperty('PublicationDate', 'NOW()', true, true);
			} else {
				$this->setProperty('Published', 'N', true);
			}

			// Log message
            if (function_exists("camp_load_translation_strings")) {
                camp_load_translation_strings("api");
            }
			if ($this->getWorkflowStatus() == 'Y') {
				$status = getGS('Published');
			} else {
				$status = getGS('Not published');
			}
			$logtext = getGS('Issue $1 changed status to $2',
					 $this->m_data['Number'].'. '.$this->m_data['Name'].' ('.$this->getLanguageName().')',
					 $status);
			Log::Message($logtext, null, 14);
		}
	} // fn setWorkflowStatus
Example #2
0
 /**
  * Set the workflow state of the issue.
  *
  * @param string $p_value
  *		Can be NULL, 'Y', 'N', TRUE, or FALSE.
  *		If set to NULL, the current value will be reversed.
  *
  * @return void
  */
 public function setWorkflowStatus($p_value = null)
 {
     $doPublish = null;
     if (is_null($p_value)) {
         if ($this->m_data['Published'] == 'Y') {
             $doPublish = false;
         } else {
             $doPublish = true;
         }
     } else {
         if (is_string($p_value)) {
             $p_value = strtoupper($p_value);
         }
         if ($this->m_data['Published'] == 'N' && ($p_value == 'Y' || $p_value === true)) {
             $doPublish = true;
         } elseif ($this->m_data['Published'] == 'Y' && ($p_value == 'N' || $p_value === false)) {
             $doPublish = false;
         }
     }
     if (!is_null($doPublish)) {
         Article::OnIssuePublish($this->getPublicationId(), $this->getLanguageId(), $this->getIssueNumber(), $doPublish);
         if ($doPublish) {
             $this->setProperty('Published', 'Y', true);
             $this->setProperty('PublicationDate', 'NOW()', true, true);
         } else {
             $this->setProperty('Published', 'N', true);
         }
     }
 }