public function validate()
 {
     $result = parent::validate();
     $minLength = $this->config()->minimum_code_length;
     $code = $this->getField('Code');
     if ($minLength && $code && $this->isChanged('Code') && strlen($code) < $minLength) {
         $result->error(_t('OrderCoupon.INVALIDMINLENGTH', 'Coupon code must be at least {length} characters in length', array('length' => $this->config()->minimum_code_length)), 'INVALIDMINLENGTH');
     }
     return $result;
 }
 function validate()
 {
     $result = parent::validate();
     //prevent vital things from changing
     foreach (self::$defaults as $field => $value) {
         if ($this->isChanged($field)) {
             $result->error("{$field} should not be changed for partial use discounts.");
         }
     }
     return $result;
 }