69 $myCompanyId = Requisite\EntityLink::getDefaultMyCompanyId();
76 $req =
new EntityRequisite;
77 $res = $req->getList(array(
79 '=ENTITY_TYPE_ID' => \CCrmOwnerType::Company,
80 '=ENTITY_ID' => $myCompanyId
83 $data = $res->fetch();
91 foreach ($data as $key => $value)
93 if (mb_substr($key, 0, 3) ==
'RQ_')
95 $result[$key] = $value;
100 $result[EntityRequisite::PERSON_FULL_NAME] = \CUser::formatName(
101 Format\PersonNameFormatter::getFormat(),
103 'NAME' => $result[EntityRequisite::PERSON_FIRST_NAME],
104 'LAST_NAME' => $result[EntityRequisite::PERSON_LAST_NAME],
105 'SECOND_NAME' => $result[EntityRequisite::PERSON_SECOND_NAME],
110 $addresses = EntityRequisite::getAddresses($data[
'ID']);
111 $addressTypes = array(
112 EntityAddressType::Registered
116 foreach ($addressTypes as $addressType)
118 if (isset($addresses[$addressType]))
120 $address = $addresses[$addressType];
124 if (!$address && count($addresses) > 0)
126 $address = current($addresses);
129 if ($address && is_array($address))
131 $address = Format\AddressFormatter::getSingleInstance()->formatTextComma($address);
136 $address = \CCrmCompany::getByID($myCompanyId,
false);
137 if (!is_array($address))
141 if ($address[
'REG_ADDRESS'])
143 $addressTypeId = EntityAddressType::Registered;
147 $addressTypeId = EntityAddressType::Primary;
150 $address = Format\AddressFormatter::getSingleInstance()->formatTextComma(
151 CompanyAddress::mapEntityFields($address, [
'TYPE_ID' => $addressTypeId])
155 $result[
'COMPANY_ADDRESS'] = $address;