Commit 0bdf9531 authored by Kulya's avatar Kulya 😊

Fix clearing inner_phone for inactive users

parent 07be8b61
...@@ -124,11 +124,17 @@ class AloVoiceActions ...@@ -124,11 +124,17 @@ class AloVoiceActions
)); ));
$bxUserPhones = array(); $bxUserPhones = array();
$GLOBALS["inactive_phones"] = array();
if(!empty($bxOnlineUsers["result"])){ if(!empty($bxOnlineUsers["result"])){
foreach($bxOnlineUsers["result"] as $bxonUser){ foreach($bxOnlineUsers["result"] as $bxonUser){
if(!empty($bxonUser["UF_PHONE_INNER"])){ if(!empty($bxonUser["UF_PHONE_INNER"])){
if(!empty($bxonUser["ACTIVE"])){
$bxUserPhones[] = $bxonUser["UF_PHONE_INNER"]; $bxUserPhones[] = $bxonUser["UF_PHONE_INNER"];
} }
else {
$GLOBALS["inactive_phones"] = $bxonUser["ID"];
}
}
} }
} }
......
...@@ -1415,6 +1415,12 @@ class BitrixEvents ...@@ -1415,6 +1415,12 @@ class BitrixEvents
$resUsUpdate = BxRest::call( 'user.update',array("ID"=>$this->bxData["ID"], "UF_PHONE_INNER"=>$newPhoneInner)); $resUsUpdate = BxRest::call( 'user.update',array("ID"=>$this->bxData["ID"], "UF_PHONE_INNER"=>$newPhoneInner));
ALVC::eLog($resUsUpdate,"------ Events.php :: ONUSERADD resUsUpdate: ----------"); ALVC::eLog($resUsUpdate,"------ Events.php :: ONUSERADD resUsUpdate: ----------");
if(!empty($GLOBALS["inactive_phones"])){
foreach($GLOBALS["inactive_phones"] as $incUserId){
$resUsUpdate = BxRest::call( 'user.update',array("ID"=>$incUserId, "UF_PHONE_INNER"=>""));
}
}
} }
/* /*
{"ID":"420","ACTIVE":"1","LAST_LOGIN":"","DATE_REGISTER":"2021-05-07T03:00:00+03:00","IS_ONLINE":"N","NAME":"\u041a\u0443\u043b\u044f\u0442\u0435\u0441\u0442","LAST_NAME":"\u041a\u0443\u043b\u044f\u0442\u0435\u0441\u0442\u0444\u0430\u043c","PERSONAL_GENDER":"","PERSONAL_BIRTHDAY":"","PERSONAL_MOBILE":"+998994412860","UF_DEPARTMENT":["488"]} {"ID":"420","ACTIVE":"1","LAST_LOGIN":"","DATE_REGISTER":"2021-05-07T03:00:00+03:00","IS_ONLINE":"N","NAME":"\u041a\u0443\u043b\u044f\u0442\u0435\u0441\u0442","LAST_NAME":"\u041a\u0443\u043b\u044f\u0442\u0435\u0441\u0442\u0444\u0430\u043c","PERSONAL_GENDER":"","PERSONAL_BIRTHDAY":"","PERSONAL_MOBILE":"+998994412860","UF_DEPARTMENT":["488"]}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment