Advertisement
Guest User

ReferralProgramOverride

a guest
May 6th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. class ReferralProgramOverride extends ReferralProgram {
  2.  
  3. private function _postValidation()
  4. {
  5. echo "test";exit;
  6. $this->_errors = array();
  7. // on supprime la vérification inutile dans notre cas
  8. //
  9. // if (!(int)(Tools::getValue('order_quantity')) OR Tools::getValue('order_quantity') < 0)
  10. // $this->_errors[] = $this->displayError($this->l('Order quantity is required/invalid.'));
  11. if (!is_array(Tools::getValue('discount_value')))
  12. $this->_errors[] = $this->displayError($this->l('Discount value is invalid.'));
  13. foreach (Tools::getValue('discount_value') AS $id_currency => $discount_value)
  14. if ($discount_value == '')
  15. $this->_errors[] = $this->displayError(sprintf($this->l('Discount value for the currency #%d is empty.'), $id_currency));
  16. elseif (!Validate::isUnsignedFloat($discount_value))
  17. $this->_errors[] = $this->displayError(sprintf($this->l('Discount value for the currency #%d is invalid.'), $id_currency));
  18. if (!(int)(Tools::getValue('discount_type')) OR Tools::getValue('discount_type') < 1 OR Tools::getValue('discount_type') > 2)
  19. $this->_errors[] = $this->displayError($this->l('Discount type is required/invalid.'));
  20. if (!(int)(Tools::getValue('nb_friends')) OR Tools::getValue('nb_friends') < 0)
  21. $this->_errors[] = $this->displayError($this->l('Number of friends is required/invalid.'));
  22. if ((int)(Tools::getValue('discount_type')) === 1)
  23. if (!(int)(Tools::getValue('discount_value_percentage')) OR (int)(Tools::getValue('discount_value_percentage')) < 0 OR (int)(Tools::getValue('discount_value_percentage')) > 100)
  24. $this->_errors[] = $this->displayError($this->l('Discount percentage is required/invalid.'));
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement