Index: branches/5.2.x/units/taxes/taxes_event_handler.php =================================================================== diff -u -N -r14258 -r14625 --- branches/5.2.x/units/taxes/taxes_event_handler.php (.../taxes_event_handler.php) (revision 14258) +++ branches/5.2.x/units/taxes/taxes_event_handler.php (.../taxes_event_handler.php) (revision 14625) @@ -1,6 +1,6 @@ eventMethods = array_merge($this->eventMethods, $zones_events); } - function customProcessing(&$event, $type) + /** + * Apply custom processing to item + * + * @param kEvent $event + * @param string $type + * @return void + * @access protected + */ + protected function customProcessing(&$event, $type) { - $zone_object =& $event->GetObject(); - switch($type) - { - case 'before': + $zone_object =& $event->getObject(); + /* @var $zone_object kDBItem */ - break; - case 'after': - $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); - $dst_object =& $this->Application->RecallObject('taxdst'); - if ($event->Name == 'OnUpdate') - { - $sql = 'DELETE FROM '.$dst_object->TableName.' WHERE TaxZoneId='.$zone_object->GetID(); - $this->Conn->Query($sql); + if ( $type == 'after' ) { + $dst_object =& $this->Application->recallObject('taxdst'); + /* @var $dst_object kDBItem */ + + if ( $event->Name == 'OnUpdate' ) { + $sql = 'DELETE FROM ' . $dst_object->TableName . ' + WHERE TaxZoneId = ' . $zone_object->GetID(); + $this->Conn->Query($sql); + } + else { + $temp = $this->Application->GetVar('taxdst', Array ()); + + foreach ($temp as $key => $value) { + $temp[$key]['TaxZoneId'] = $zone_object->GetID(); } - else - { - $temp = $this->Application->GetVar('taxdst'); - foreach ($temp as $key => $value) - { - $temp[$key]['TaxZoneId'] = $zone_object->GetID(); - } - $this->Application->SetVar('taxdst', $temp); - } - $dst_event = new kEvent(); - $dst_event->Init('taxdst'); - $dst_event->Name = 'OnCreate'; - $this->Application->HandleEvent($dst_event); - break; + $this->Application->SetVar('taxdst', $temp); + } - default: + $dst_event = new kEvent('taxdst:OnCreate'); + $this->Application->HandleEvent($dst_event); } } @@ -222,22 +223,6 @@ $event->CallSubEvent("OnPreSave"); } - function OnMassDelete(&$event) - { - $this->StoreSelectedIDs($event); - - $event->setEventParam('ids', $this->getSelectedIDs($event) ); - $this->customProcessing($event, 'before'); - $ids = $event->getEventParam('ids'); - $ids = implode(',', $ids); - - $dst =& $this->Application->recallObject('taxdst'); - $sql = 'DELETE FROM '.$dst->TableName.' WHERE TaxZoneId IN ('.$ids.')'; - $this->Conn->Query($sql); - - parent::OnMassDelete($event); - } - function OnCountryChange(&$event) { $destinations = &$this->Application->recallObject('taxdst');