From 098d966039ec36005ef1cd14dc6198dc9edc079d Mon Sep 17 00:00:00 2001 From: Grisha Pomadchin Date: Thu, 26 Dec 2013 01:49:50 +0400 Subject: [PATCH] history session fix --- .../classes/general/ICrmOrderActions.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/intaro.intarocrm/classes/general/ICrmOrderActions.php b/intaro.intarocrm/classes/general/ICrmOrderActions.php index 49aa8e0b..89c5633d 100755 --- a/intaro.intarocrm/classes/general/ICrmOrderActions.php +++ b/intaro.intarocrm/classes/general/ICrmOrderActions.php @@ -281,12 +281,15 @@ class ICrmOrderActions public static function orderHistory() { global $USER; - if(!isset($USER) || !$USER) { // for agent; to add order User + if($USER) { + $realUser = $USER->GetID(); + $USER->Logout(); + } else { // for agent; to add order User $rsUser = CUser::GetByLogin('intarocrm'); if($arUser = $rsUser->Fetch()) { $USER = new CUser; - $USER->Update($arUser['ID'], array()); + $USER->Authorize($arUser['ID']); } else { $login = 'intarocrm'; $serverName = 0 < strlen(SITE_SERVER_NAME)? SITE_SERVER_NAME : 'server.com'; @@ -314,7 +317,7 @@ class ICrmOrderActions } $USER = new CUser; - $USER->Update($id, array()); + $USER->Authorize($id); } } @@ -750,6 +753,9 @@ class ICrmOrderActions if(count($orderHistory)) COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_HISTORY_DATE, $dateStart->format('Y-m-d H:i:s')); + $USER->Logout(); + if($realUser) $USER->Authorize($realUser); + return true; }