Index: branches/5.2.x/units/orders/orders_event_handler.php =================================================================== diff -u -N -r14796 -r14808 --- branches/5.2.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 14796) +++ branches/5.2.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 14808) @@ -1,6 +1,6 @@ Application->GetVar('check_shipping_address')) { $has_tangibles = $order->HasTangibleItems(); - $req_fields = array('ShippingTo', 'ShippingAddress1', 'ShippingCity', 'ShippingZip', 'ShippingCountry', 'ShippingPhone'); + $req_fields = array('ShippingTo', 'ShippingAddress1', 'ShippingCity', 'ShippingZip', 'ShippingCountry', /*'ShippingPhone',*/ 'BillingEmail'); $order->setRequired($req_fields, $has_tangibles); $order->setRequired('ShippingState', $cs_helper->CountryHasStates( $field_values['ShippingCountry'] )); } // billing address required fields if ($this->Application->GetVar('check_billing_address')) { - $req_fields = array('BillingTo', 'BillingAddress1', 'BillingCity', 'BillingZip', 'BillingCountry', 'BillingPhone'); + $req_fields = array('BillingTo', 'BillingAddress1', 'BillingCity', 'BillingZip', 'BillingCountry', 'BillingPhone', 'BillingEmail'); $order->setRequired($req_fields); $order->setRequired('BillingState', $cs_helper->CountryHasStates( $field_values['BillingCountry'] )); } $check_cc = $this->Application->GetVar('check_credit_card'); - $ord_event = $this->Application->GetVar($event->getPrefixSpecial().'_event'); - if (($ord_event !== 'OnProceedToPreview') && !$this->Application->isAdmin) { - // don't check credit card when going from "billing info" to "order preview" step - $check_cc = 0; - } - if ($check_cc && ($field_values['PaymentType'] == $order->GetDBField('PaymentType'))) { + if ( $check_cc && ($field_values['PaymentType'] == $order->GetDBField('PaymentType')) ) { // cc check required AND payment type was not changed during SUBMIT - if ($this->Application->isAdminUser) { - $req_fields = array('PaymentCardType', 'PaymentAccount', 'PaymentNameOnCard', 'PaymentCCExpDate'); + if ( $this->Application->isAdminUser ) { + $req_fields = Array ('PaymentCardType', 'PaymentAccount', 'PaymentNameOnCard', 'PaymentCCExpDate'); } else { - $req_fields = array('PaymentCardType', 'PaymentAccount', 'PaymentNameOnCard', 'PaymentCCExpDate', 'PaymentCVV2'); + $req_fields = Array ('PaymentCardType', 'PaymentAccount', 'PaymentNameOnCard', 'PaymentCCExpDate', 'PaymentCVV2'); } $order->setRequired($req_fields); @@ -3722,13 +3717,38 @@ } /** + * Occurs before validation attempt + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnBeforeItemValidate(kEvent &$event) + { + parent::OnBeforeItemValidate($event); + + $create_account = $this->Application->GetVar('create_account'); + + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $required_fields = Array ('UserPassword', 'UserPassword_plain', 'VerifyUserPassword', 'VerifyUserPassword_plain'); + $object->setRequired($required_fields, $create_account); + } + + /** * Enter description here... * * @param kEvent $event */ function OnCombinedPlaceOrder(&$event) { + $ajax_form_helper =& $this->Application->recallObject('AjaxFormHelper'); + /* @var $ajax_form_helper AjaxFormHelper */ - $event->CallSubEvent('OnUpdate'); + $ajax_form_helper->transitEvent($event, 'OnUpdate'); + + +// $event->CallSubEvent('OnUpdate'); } } \ No newline at end of file