Index: branches/5.1.x/units/manufacturers/manufacturers_event_handler.php =================================================================== diff -u -N -r13100 -r13465 --- branches/5.1.x/units/manufacturers/manufacturers_event_handler.php (.../manufacturers_event_handler.php) (revision 13100) +++ branches/5.1.x/units/manufacturers/manufacturers_event_handler.php (.../manufacturers_event_handler.php) (revision 13465) @@ -1,6 +1,6 @@ Application->recallObject('CountryStatesHelper'); - $cs_helper->PopulateStates($event, 'State', 'Country'); + parent::OnAfterItemLoad($event); - $object =& $event->getObject(); - - if( $object->isRequired('Country') && $cs_helper->CountryHasStates( $object->GetDBField('Country') ) ) $object->setRequired('State', true); - } - - function OnUpdate(&$event) - { $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - $cs_helper->CheckStateField($event, 'State', 'Country'); + /* @var $cs_helper kCountryStatesHelper */ - parent::OnUpdate($event); + $cs_helper->PopulateStates($event, 'State', 'Country'); } - function OnCreate(&$event) + /** + * Processes states + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) { + parent::OnBeforeItemUpdate($event); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - $cs_helper->CheckStateField($event, 'State', 'Country'); + /* @var $cs_helper kCountryStatesHelper */ - parent::OnCreate($event); + $cs_helper->CheckStateField($event, 'State', 'Country'); + $cs_helper->PopulateStates($event, 'State', 'Country'); } - function OnPreSave(&$event) + /** + * Processes states + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) { + parent::OnBeforeItemCreate($event); + $cs_helper =& $this->Application->recallObject('CountryStatesHelper'); - $cs_helper->CheckStateField($event, 'State', 'Country'); + /* @var $cs_helper kCountryStatesHelper */ - parent::OnPreSave($event); + $cs_helper->CheckStateField($event, 'State', 'Country'); + $cs_helper->PopulateStates($event, 'State', 'Country'); } - } \ No newline at end of file