Index: branches/5.2.x/units/payment_type/payment_type_event_handler.php =================================================================== diff -u -N -r14986 -r15061 --- branches/5.2.x/units/payment_type/payment_type_event_handler.php (.../payment_type_event_handler.php) (revision 14986) +++ branches/5.2.x/units/payment_type/payment_type_event_handler.php (.../payment_type_event_handler.php) (revision 15061) @@ -1,6 +1,6 @@ Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 0 '); $this->Conn->Query('UPDATE '.$object->TableName.' SET IsPrimary = 1, Status = 1 WHERE PaymentTypeId = '.$id.' '); } - $event->setRedirectParams(Array('opener' => 's'), true); + $event->SetRedirectParam('opener', 's'); } function OnMassDecline(&$event) { - $object =& $event->getObject( Array('skip_autoload' => true) ); + $object =& $event->getObject(Array ('skip_autoload' => true)); + /* @var $object kDBItem */ + $this->StoreSelectedIDs($event); - $ids=$this->getSelectedIDs($event); + $ids = $this->getSelectedIDs($event); - if($ids) - { - $status_field = array_shift( $this->Application->getUnitOption($event->Prefix,'StatusField') ); + if ( $ids ) { + $status_field = array_shift($this->Application->getUnitOption($event->Prefix, 'StatusField')); - foreach($ids as $id) - { + foreach ($ids as $id) { $object->Load($id); - if (!$object->GetDBField("IsPrimary")){ + if ( !$object->GetDBField("IsPrimary") ) { $object->SetDBField($status_field, 0); } - if( $object->Update() ) - { + if ( $object->Update() ) { $event->status = kEvent::erSUCCESS; - $event->setRedirectParams(Array('opener' => 's'), true); + $event->SetRedirectParam('opener', 's'); } - else - { + else { $event->status = kEvent::erFAIL; $event->redirect = false; break; @@ -115,7 +113,7 @@ * @return void * @access protected */ - protected function OnBeforeItemUpdate(&$event) + protected function OnBeforeItemUpdate(kEvent &$event) { parent::OnBeforeItemUpdate($event); @@ -138,7 +136,7 @@ * @return void * @access protected */ - protected function OnBeforeItemCreate(&$event) + protected function OnBeforeItemCreate(kEvent &$event) { parent::OnBeforeItemCreate($event); @@ -153,24 +151,27 @@ * @return void * @access protected */ - protected function customProcessing(&$event, $type) + protected function customProcessing(kEvent &$event, $type) { - if ($event->Name == 'OnMassDelete' && $type == 'before'){ - $object = &$event->getObject(); + if ( $event->Name == 'OnMassDelete' && $type == 'before' ) { + $object =& $event->getObject(); + /* @var $object kDBItem */ + $ids_ok = Array (); $ids = $event->getEventParam('ids'); - $ids_ok=array(); - foreach ($ids as $key => $id){ + + foreach ($ids as $id) { $object->Load($id); - if ($object->GetDBField('IsPrimary')){ + + if ( $object->GetDBField('IsPrimary') ) { $this->Application->StoreVar('pt_delete_error', '1'); - }else{ - $ids_ok[]=$id; } + else { + $ids_ok[] = $id; + } } $event->setEventParam('ids', $ids_ok); - } } @@ -182,7 +183,7 @@ * @return void * @access protected */ - protected function OnSave(&$event) + protected function OnSave(kEvent &$event) { $this->Application->StoreVar('check_unused_currencies', 1);