Index: branches/5.2.x/core/units/helpers/country_states_helper.php =================================================================== diff -u -N -r14244 -r14628 --- branches/5.2.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 14244) +++ branches/5.2.x/core/units/helpers/country_states_helper.php (.../country_states_helper.php) (revision 14628) @@ -1,6 +1,6 @@ Conn->GetOne($sql); } + /** + * Checks, that entered state matches entered country + * + * @param kEvent $event + * @param string $state_field + * @param string $country_field + * @param bool $auto_required + * @return void + */ function CheckStateField(&$event, $state_field, $country_field, $auto_required = true) { $object =& $event->getObject(); /* @var $object kDBItem */ $country_iso = $object->GetDBField($country_field); - if ($auto_required) { + if ( $auto_required ) { $object->setRequired($state_field, $this->CountryHasStates($country_iso)); } $state = $object->GetDBField($state_field); - if ($country_iso && $state) { + if ( $country_iso && $state ) { $state_iso = $this->getStateIso($state, $country_iso); - if ($state_iso !== false) { + if ( $state_iso !== false ) { // replace state name with it's ISO code $object->SetDBField($state_field, $state_iso); }