1
0
mirror of synced 2024-11-25 14:56:09 +03:00

history session fix

This commit is contained in:
Grisha Pomadchin 2013-12-26 01:49:50 +04:00
parent 4bc57cc63a
commit 098d966039

View File

@ -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;
}