diff --git a/api/index.php b/api/index.php index f1d71ec..eff6498 100644 --- a/api/index.php +++ b/api/index.php @@ -530,6 +530,14 @@ switch($PARAM_1) if($user_registered) { + $companies = getCompaniesForUser($ar_user['ID']); + $company_data = [ + "inn" => $companies[0]['inn'], + "kpp" => $companies[0]['kpp'], + "ogrn" => $companies[0]['ogrn'], + "title" => $companies[0]['title'], + ]; + $user_data = [ "email" => $ar_user['LOGIN'], "name" => $ar_user['NAME'], @@ -537,14 +545,7 @@ switch($PARAM_1) "lastname" => $ar_user['LAST_NAME'], "phone" => $ar_user['UF_PHONE_NUMBER'], "phone_verified" => $ar_user['UF_PHONE_VERIFIED'], - ]; - - $companies = getCompaniesForUser($ar_user['ID']); - $company_data = [ - "inn" => $companies[0]['inn'], - "kpp" => $companies[0]['kpp'], - "ogrn" => $companies[0]['ogrn'], - "title" => $companies[0]['title'], + "is_admin" => $companies[0]['is_admin'], ]; print json_encode([ @@ -1654,6 +1655,14 @@ switch($PARAM_1) $rs_user = \CUser::GetByLogin($REQ['email']); $ar_user = $rs_user->Fetch(); + $companies = getCompaniesForUser($ar_user['ID']); + $company_data = [ + "inn" => $companies[0]['inn'], + "kpp" => $companies[0]['kpp'], + "ogrn" => $companies[0]['ogrn'], + "title" => $companies[0]['title'], + ]; + $user_data = [ "email" => $ar_user['LOGIN'], "name" => $ar_user['NAME'], @@ -1661,14 +1670,7 @@ switch($PARAM_1) "lastname" => $ar_user['LAST_NAME'], "phone" => $ar_user['UF_PHONE_NUMBER'], "phone_verified" => $ar_user['UF_PHONE_VERIFIED'], - ]; - - $companies = getCompaniesForUser($ar_user['ID']); - $company_data = [ - "inn" => $companies[0]['inn'], - "kpp" => $companies[0]['kpp'], - "ogrn" => $companies[0]['ogrn'], - "title" => $companies[0]['title'], + "is_admin" => $companies[0]['is_admin'], ]; print json_encode([ @@ -1721,6 +1723,7 @@ switch($PARAM_1) "lastname" => $ar_user['LAST_NAME'], "phone_number" => $ar_user['UF_PHONE_NUMBER'], "phone_verified" => $ar_user['UF_PHONE_VERIFIED'], + "is_admin" => $companies[0]['is_admin'], ], "company" => [ "inn" => $companies[0]['inn'],