Esempio n. 1
0
	/**
	 * Run validation on the server side
	 *
	 * Method will run the validation on the server side (will not run the JS function type) and return
	 * the result
	 *
	 * @access public
	 * @param string &$errmsg The error message if the validation fails
	 * @return bool TRUE if the validation was successful, FALSE if it failed
	 */
	public function runValidation(&$errmsg)
	{
		if (!parent::runValidation($errmsg)) {
			return false;
		}

		if ($this->getValue() == '') {
			return true;
		}

		/**
		 * Just need to check that all our selected values actually existing within our options array
		 */
		if (empty($this->extraInfo['options'])) {
			return true;
		}

		if (!Store_Array::inArrayCI($this->getValue(), $this->extraInfo['options'])) {
			$errmsg = sprintf(GetLang('CustomFieldsValidationInvalidSelectOption'), $this->label);
			return false;
		}

		return true;
	}
Esempio n. 2
0
	/**
	 * Check to see if the currency is supported
	 *
	 * Method will check to see if the currency $currency is supported
	 *
	 * @access protected
	 * @param string $currency The currency string to check
	 * @return bool TRUE if the currency is supported, FALSE if not
	 */
	protected function checkSupportedCurrencies($currency)
	{
		if (trim($currency) == '') {
			return false;
		}

		if (empty($this->supportedCurrencyCodes)) {
			return true;
		}

		return Store_Array::inArrayCI(trim($currency), $this->supportedCurrencyCodes);
	}