<commit_before>Spree::User.class_eval do
  attr_accessible :postal_code, :is_not_canadian
  validate :postal_code_valid
  include Spree::BaseHelper
  def postal_code_valid
    if(self.is_not_canadian)
      self.postal_code = ""
    else
      self.postal_code = parse_postal_code self.postal_code
      
      if(!postal_code_formatted? self.postal_code)
        errors.add(:postal_code, I18n.t("spree.postal_code_restriction.not_valid"))
      end<commit_msg>PE-70 fixed validation problem with postal code in some forms where the field is missing<commit_after>Spree::User.class_eval do
  attr_accessible :postal_code, :is_not_canadian
  validate :postal_code_valid
  include Spree::BaseHelper
  def postal_code_valid
    if(self.is_not_canadian or self.postal_code.nil?)
      self.postal_code = ""
    else
      self.postal_code = parse_postal_code self.postal_code
      
      if(!postal_code_formatted? self.postal_code)
        errors.add(:postal_code, I18n.t("spree.postal_code_restriction.not_valid"))
      end
{'fraction_non_alphanumeric': 0.08023483365949119, 'fraction_numerical': 0.005870841487279843, 'mean_word_length': 4.166666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3084331', 'n_tokens_mistral': 368, 'n_tokens_neox': 353, 'n_words': 59}