Index: branches/5.0.x/in-commerce/units/orders/orders_event_handler.php =================================================================== diff -u -r12674 -r12722 --- branches/5.0.x/in-commerce/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 12674) +++ branches/5.0.x/in-commerce/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 12722) @@ -1,6 +1,6 @@ Application->IsAdmin()) { + if (!$this->Application->isAdminUser) { if ($event->Name == 'OnCreate') { // user can't initiate custom order creation directly return false; @@ -160,7 +160,9 @@ */ function OnSelectAddress(&$event) { - if ($this->Application->IsAdmin()) return true; + if ($this->Application->isAdminUser) { + return ; + } $object =& $event->getObject(); @@ -397,8 +399,7 @@ $this->SplitOrder($event, $order); } - if( !$this->Application->IsAdmin() ) - { + if (!$this->Application->isAdminUser) { // for tracking code $this->Application->StoreVar('last_order_amount', $order->GetDBField('TotalAmount')); $this->Application->StoreVar('last_order_number', $order->GetDBField('OrderNumber')); @@ -603,7 +604,7 @@ parent::OnUpdate($event); - if ($this->Application->IsAdmin()) { + if ($this->Application->isAdminUser) { return true; } else { @@ -784,15 +785,15 @@ $event->setEventParam('ItemData', serialize($item_data)); // 1 for PacakgeNum when in admin - temporary solution to overcome splitting into separate sub-orders // of orders with items added through admin when approving them - $this->AddItemToOrder($event, $item_id, $qty, $this->Application->IsAdmin() ? 1 : null); + $this->AddItemToOrder($event, $item_id, $qty, $this->Application->isAdminUser ? 1 : null); } if ($event->status == erSUCCESS && !$event->redirect) { $event->redirect_params['pass'] = 'm'; $event->redirect_params['pass_category'] = 0; //otherwise mod-rewrite shop-cart URL will include category $event->redirect = true; } else { - if ($this->Application->IsAdmin()) { + if ($this->Application->isAdminUser) { $event->redirect_params['opener'] = 'u'; } } @@ -878,7 +879,7 @@ if ($result) { $event->status = erSUCCESS; - $event->redirect = $this->Application->IsAdmin() ? true : $this->Application->GetVar('shop_cart_template'); + $event->redirect = $this->Application->isAdminUser ? true : $this->Application->GetVar('shop_cart_template'); } else { $event->status = erFAIL; @@ -918,7 +919,7 @@ $ord_item->SetDBField('OptionsSalt', $this->OptionsSalt($options)); $ord_item->Update(); $event->CallSubEvent('OnRecalculateItems'); - if ($event->status == erSUCCESS && $this->Application->IsAdmin()) { + if ($event->status == erSUCCESS && $this->Application->isAdminUser) { $event->redirect_params['opener'] = 'u'; } } @@ -1049,7 +1050,8 @@ { $event->setEventParam('raise_warnings', 0); $passed = parent::getPassedID($event); - if ( $this->Application->IsAdmin() ) { + + if ($this->Application->isAdminUser) { // work as usual in admin return $passed; } @@ -1215,14 +1217,14 @@ $check_cc = $this->Application->GetVar('check_credit_card'); $ord_event = $this->Application->GetVar($event->getPrefixSpecial().'_event'); - if (($ord_event !== 'OnProceedToPreview') && !$this->Application->IsAdmin()) { + if (($ord_event !== 'OnProceedToPreview') && !$this->Application->isAdmin) { // don't check credit card when going from "billing info" to "order preview" step $check_cc = 0; } if ($check_cc && ($field_values['PaymentType'] == $order->GetDBField('PaymentType'))) { // cc check required AND payment type was not changed during SUBMIT - if ($this->Application->IsAdmin()) { + if ($this->Application->isAdminUser) { $req_fields = array('PaymentCardType', 'PaymentAccount', 'PaymentNameOnCard', 'PaymentCCExpDate'); } else { @@ -1242,7 +1244,10 @@ */ function CheckUser(&$event) { - if ( $this->Application->IsAdmin() ) return; + if ($this->Application->isAdminUser) { + return; + } + $order =& $event->GetObject(); $ses_user = $this->Application->RecallVar('user_id'); @@ -2084,18 +2089,18 @@ function CheckQuantites(&$event) { if ($this->OnRecalculateItems($event)) { // if something has changed in the order - if ( $this->Application->IsAdmin() ) - { + if ($this->Application->isAdminUser) { if ($this->UseTempTables($event)) { $event->redirect = 'in-commerce/orders/orders_edit_items'; } } - else - { + else { $event->redirect = $this->Application->GetVar('viewcart_template'); } + return false; } + return true; } @@ -2635,7 +2640,7 @@ $order =& $this->Application->recallObject('ord'); /* @var $order kDBItem */ - if (!$order->isLoaded() && !$this->Application->IsAdmin()) { + if (!$order->isLoaded() && !$this->Application->isAdmin) { // no order was created before -> create one now if ($this->_createNewCart($event)) { $this->LoadItem($event); @@ -2753,7 +2758,7 @@ } $this->Application->HandleEvent($ord_event, 'ord:OnRecalculateItems'); - /*if ($ord_event->getEventParam('RecalculateChangedCart') && !$this->Application->IsAdmin() ) { + /*if ($ord_event->getEventParam('RecalculateChangedCart') && !$this->Application->isAdmin) { $event->SetRedirectParam('checkout_error', $ord_event->redirect_params['checkout_error']); }*/ } @@ -3814,7 +3819,7 @@ $fields['Number']['format'] = str_replace('%06d', '%0'.$order_number.'d', $fields['Number']['format']); $fields['SubNumber']['format'] = str_replace('%03d', '%0'.$order_sub_number.'d', $fields['SubNumber']['format']); - if (!$this->Application->IsAdmin()) { + if (!$this->Application->isAdminUser) { $user_groups = explode(',', $this->Application->RecallVar('UserGroups')); $default_group = $this->Application->ConfigValue('User_LoggedInGroup'); if (!in_array($default_group, $user_groups)){ @@ -3915,7 +3920,7 @@ */ function checkItemStatus(&$event) { - if ($this->Application->IsAdmin()) { + if ($this->Application->isAdminUser) { return true; } @@ -3985,7 +3990,7 @@ $UserName = explode(" ", $object->GetDBField('ShippingTo')); $item_table = TABLE_PREFIX.'OrderItems'; - if ( $this->Application->IsAdmin() ) { + if ($this->Application->isAdminUser) { // this strange contraption actually uses temp table from object (when in temp mode) $order_table = $object->TableName; $item_table = str_replace('Orders', 'OrderItems', $order_table);