Changeset View
Changeset View
Standalone View
Standalone View
modules/in-commerce/units/addresses/addresses_event_handler.php
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
protected function OnBeforeItemUpdate(kEvent $event) | protected function OnBeforeItemUpdate(kEvent $event) | ||||
{ | { | ||||
parent::OnBeforeItemUpdate($event); | parent::OnBeforeItemUpdate($event); | ||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBItem */ | /* @var $object kDBItem */ | ||||
if ( !$object->isLoaded() || !$this->checkItemStatus($event) ) { | if ( !$object->isLoaded() || ($this->Application->isWebRequest() && !$this->checkItemStatus($event)) ) { | ||||
// not trivially loaded object OR not current user address | // not trivially loaded object OR not current user address | ||||
$event->status = kEvent::erPERM_FAIL; | $event->status = kEvent::erPERM_FAIL; | ||||
return ; | return ; | ||||
} | } | ||||
$cs_helper = $this->Application->recallObject('CountryStatesHelper'); | $cs_helper = $this->Application->recallObject('CountryStatesHelper'); | ||||
/* @var $cs_helper kCountryStatesHelper */ | /* @var $cs_helper kCountryStatesHelper */ | ||||
▲ Show 20 Lines • Show All 279 Lines • ▼ Show 20 Line(s) | |||||
*/ | */ | ||||
protected function OnBeforeItemDelete(kEvent $event) | protected function OnBeforeItemDelete(kEvent $event) | ||||
{ | { | ||||
parent::OnBeforeItemDelete($event); | parent::OnBeforeItemDelete($event); | ||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
/* @var $object kDBItem */ | /* @var $object kDBItem */ | ||||
if ( !$object->isLoaded() || !$this->checkItemStatus($event) ) { | if ( !$object->isLoaded() || ($this->Application->isWebRequest() && !$this->checkItemStatus($event)) ) { | ||||
// not trivially loaded object OR not current user address | // not trivially loaded object OR not current user address | ||||
$event->status = kEvent::erPERM_FAIL; | $event->status = kEvent::erPERM_FAIL; | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Sets default country for new addresses to Latvia | * Sets default country for new addresses to Latvia | ||||
Show All 40 Lines | |||||
)); | )); | ||||
$config->addEditTabPresetTabs('Default', Array ( | $config->addEditTabPresetTabs('Default', Array ( | ||||
'addresses' => Array ( | 'addresses' => Array ( | ||||
'title' => 'la_tab_Addresses', 't' => 'in-commerce/users/user_edit_addresses', 'priority' => 6 | 'title' => 'la_tab_Addresses', 't' => 'in-commerce/users/user_edit_addresses', 'priority' => 6 | ||||
) | ) | ||||
)); | )); | ||||
} | } | ||||
} | } | ||||
No newline at end of file |