Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ReferralProgramOverride extends ReferralProgram {
- private function _postValidation()
- {
- echo "test";exit;
- $this->_errors = array();
- // on supprime la vérification inutile dans notre cas
- //
- // if (!(int)(Tools::getValue('order_quantity')) OR Tools::getValue('order_quantity') < 0)
- // $this->_errors[] = $this->displayError($this->l('Order quantity is required/invalid.'));
- if (!is_array(Tools::getValue('discount_value')))
- $this->_errors[] = $this->displayError($this->l('Discount value is invalid.'));
- foreach (Tools::getValue('discount_value') AS $id_currency => $discount_value)
- if ($discount_value == '')
- $this->_errors[] = $this->displayError(sprintf($this->l('Discount value for the currency #%d is empty.'), $id_currency));
- elseif (!Validate::isUnsignedFloat($discount_value))
- $this->_errors[] = $this->displayError(sprintf($this->l('Discount value for the currency #%d is invalid.'), $id_currency));
- if (!(int)(Tools::getValue('discount_type')) OR Tools::getValue('discount_type') < 1 OR Tools::getValue('discount_type') > 2)
- $this->_errors[] = $this->displayError($this->l('Discount type is required/invalid.'));
- if (!(int)(Tools::getValue('nb_friends')) OR Tools::getValue('nb_friends') < 0)
- $this->_errors[] = $this->displayError($this->l('Number of friends is required/invalid.'));
- if ((int)(Tools::getValue('discount_type')) === 1)
- if (!(int)(Tools::getValue('discount_value_percentage')) OR (int)(Tools::getValue('discount_value_percentage')) < 0 OR (int)(Tools::getValue('discount_value_percentage')) > 100)
- $this->_errors[] = $this->displayError($this->l('Discount percentage is required/invalid.'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement