Validates order total
@return boolean|null
13862
protected function validateTotalOrder()
    {
        $field = 'total';
        $value = $this->getSubmitted($field);

        if (!isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Total');

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        if (strlen($value) > 10) {
            $this->setErrorLengthRange($field, $label, 0, 10);
            return false;
        }

        return true;
    }
1130812
protected function validateEmail()
    {
        $field = 'email';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('E-mail');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        return true;
    }
982319
public function validate()
    {
        if (is_numeric($this->categoryId) && $this->categoryId >= 1
                && is_numeric($this->forumId) && $this->forumId >= 1
                && is_numeric($this->threadId) && $this->threadId >= 1
                && !empty($this->threadSlug)) {
            return true;
        }
        return false;
    }
91737
public function isValid()
    {
        if(empty($this->token) || empty($this->payerId) || is_null($this->_paymentDetails)) {
            return false;
        }

        $valid = true;
        foreach($this->_paymentDetails as $detail) {
            if(empty($detail)) {
                $valid = false;
                break;
            }

            $amt = $detail->getAmt();

            if(empty($amt)) {
                $valid = false;
                break;
            }
        }

        return $valid;
    }
354917
protected function validateEditPriceRule()
    {
        $this->setSubmitted('price_rule', null, false);
        $this->setSubmittedBool('status');
        $this->setSubmitted('update', $this->data_rule);

        $this->validateComponent('price_rule');

        return !$this->hasErrors();
    }
1321114
protected function validateComponentPricesOrder()
    {
        $field = 'data.components';
        $components = $this->getSubmitted($field);

        if (empty($components)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Price');

        if (!is_array($components)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        foreach ($components as $id => $component) {

            if (!is_numeric($component['price'])) {
                $this->setErrorNumeric("$field.$id", $label);
                continue;
            }

            if (strlen($component['price']) > 10) {
                $this->setErrorLengthRange("$field.$id", $label, 0, 10);
            }
        }

        return !$this->isError('components');
    }
1223373
private function checkValidity()
    {

        if (!is_writable($this->rssFile)) {
            $this->valid = false;
            return;
        }

        $stmt = $this->db->prepare('SELECT CREATED FROM ' . $this->table . ' ORDER BY CREATED DESC LIMIT 1');
        $stmt->execute();
        $res = $stmt->fetchAll();

        if (count($res) == 0) {
            $this->valid = false;
            return;
        }

        $latestInput = strtotime($res[0]->CREATED);

        $rssCreated = filemtime($this->rssFile);

        if ($latestInput > $rssCreated) {
            $this->valid = false;
        } else {
            $this->valid = true;
        }
    }
1081178
protected function validateSyntaxEditor()
    {
        $code = $this->getSubmitted('content');

        if (empty($code) || $this->data_extension !== 'php') {
            return null;
        }

        $result = $this->editor->validatePhpCode($code);

        if (!isset($result) || $result === true) {
            return null;
        }

        $error = empty($result) ? $this->text('There is a syntax error in your file') : $result;
        $this->setError('content', $error);
    }
157563
function pre_confirmation_check($order_total) {
    global $order;
    $od_amount = $this->calculate_deductions($order_total);
//    print_r($od_amount);
    $order->info['total'] = $order->info['total'] - $od_amount['total'];
    if (DISPLAY_PRICE_WITH_TAX != 'true') {
      $order->info['total'] -= $tax;
    }
    return $od_amount['total'] + (DISPLAY_PRICE_WITH_TAX == 'true' ? 0 : $od_amount['tax']);
  }
621149
protected function validateValueRating()
    {
        $field = 'rating';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);
        $label = $this->translation->text('Rating');

        if (!isset($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        if ($value > 5) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        return true;
    }
648761
protected function submitOrderCheckout()
    {
        if (!$this->isPosted('save')) {
            return null;
        }

        $errors = array();

        foreach (array('payment', 'shipping') as $type) {

            $address_errors = $this->validateAddressCheckout($type);

            if (!empty($address_errors)) {
                $errors = gplcart_array_merge($errors, $address_errors);
            }

            if (empty($address_errors)) {
                $this->addAddressCheckout($type);
            }
        }

        $order_errors = $this->validateOrderCheckout();
        $errors = gplcart_array_merge($errors, $order_errors);

        if (empty($errors)) {
            $this->addOrderCheckout();
        } else {
            $this->setError(null, $errors);
        }
    }
1151078
public function validate()
    {
        $globalValid = false;
        $localValid  = $this->validateOwner();
        foreach ($this->chainedRules as $item) {
            foreach ($item as $multiplier) {
                if (!($localValid = $localValid && $multiplier->validate())) {
                    break;
                }
            }
            if ($globalValid = $globalValid || $localValid) {
                break;
            }
            $localValid = true;
        }
        $globalValid or $this->setOwnerError();
        return $globalValid;
    }
854470
private function __validate()
    {
        $blnReturn = true;

        foreach ($this->__elements as $element) {
            if (! $element->isValid()) {
                $blnReturn = false;
                break;
            }
        }

        return $blnReturn;
    }
481358
protected function validateOrderCheckout()
    {
        if ($this->same_payment_address) {
            $this->unsetSubmitted('address.payment');
        }

        $this->setSubmitted('update', array());
        $this->setSubmitted('store_id', $this->store_id);
        $this->setSubmitted('user_id', $this->order_user_id);
        $this->setSubmitted('creator', $this->admin_user_id);

        if ($this->admin) {
            $this->setSubmitted('status', $this->order->getStatusInitial());
        }

        return $this->validateComponent('order');
    }
1163358
protected function validateCodePriceRule()
    {
        $field = 'code';
        $value = $this->getSubmitted($field);

        if (empty($value)) {
            return null;
        }

        $updating = $this->getUpdating();

        if (isset($updating['code']) && $updating['code'] === $value) {
            return true;
        }

        $label = $this->translation->text('Code');

        if (mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $label, 0, 255);
            return false;
        }

        $rules = $this->price_rule->getList(array('code' => $value));

        if (empty($rules)) {
            return true;
        }

        foreach ((array) $rules as $rule) {
            if ($rule['code'] === $value) {
                $this->setErrorExists($field, $label);
                return false;
            }
        }

        return true;
    }
297012
protected function getOrderPaymentStatusPaymentValid()
    {
        $status = null;
        $orderPayment = $this->getOrderPayment();
        if (isset($orderPayment) && !$orderPayment->getIsValid()) {
            $status = 'failed';
        }

        return $status;
    }
511265
public function validateNumeric()
    {
        $val = $this->getValue() + 0;

        return $val >= $this->getArg(0) && $val <= $this->getArg(1);
    }