Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Right now the field, used to store credit card expiration date is using kCCDateFormatter. It appears that there is a bug in the formatter class and following code was added to OrdersItem class to overcome this:

Code Block
languagephp
firstline32
titleorders_item.phpfirstline32
linenumberstrue
public function SetFieldsFromHash($hash, $skip_fields = Array (), $set_fields = Array ())
{
	parent::SetFieldsFromHash($hash, $skip_fields, $set_fields);
 
	$options = $this->GetFieldOptions('PaymentCCExpDate');
 
	if ( $this->GetDirtyField($options['month_field']) || $this->GetDirtyField($options['year_field']) ) {
		$this->SetDirtyField('PaymentCCExpDate', 0);
		$this->SetField('PaymentCCExpDate', 0);
	}
}

...

  1. set the formatter on month/year fields, but do nothing
  2. the kDBItem::UpdateFormattersMasterFields method is called already before validation happens and combines both fields into one

Related Tasks