34 $params = $documentImport->getFieldValues();
35 foreach($params as $k=>$v)
41 $profile[
'VERSION_1C'] = $v;
62 $profile[
'AGENT_NAME'] = $v;
65 case 'REGISTRATION_ADDRESS':
68 foreach($params[$k] as $name=>$values)
70 if($name ==
'ADDRESS_FIELD')
72 foreach($values as $nameAddres=>$valuesAddres)
74 $profile[$k][$nameAddres] = $valuesAddres[
'VALUE'];
79 $profile[$k][$name] = $values;
84 foreach($params[$k][
'CONTACT'] as $name=>$values)
86 $profile[
'CONTACT'][$name] = $values[
'VALUE'];
89 $profile[
'CONTACT'][
'EMAIL'] = !empty($profile[
'CONTACT'][
'MAIL_NEW'])? $profile[
'CONTACT'][
'MAIL_NEW']:
null;
90 $profile[
'CONTACT'][
'PHONE'] = !empty($profile[
'CONTACT'][
'WORK_PHONE_NEW'])? $profile[
'CONTACT'][
'WORK_PHONE_NEW']:
null;
93 case 'REPRESENTATIVES':
94 foreach($params[$k][
'REPRESENTATIVE'] as $name=>$values)
96 if($name ==
'CONTACT_PERSON')
98 $profile[
'CONTACT'][$name] = $values[
'ITEM_NAME'];
105 if(!empty($profile[
"OKPO_CODE"]))
106 $profile[
"OKPO"] = $profile[
"OKPO_CODE"];
108 if($profile[
"OFICIAL_NAME"] <>
'' && empty($profile[
"FULL_NAME"]))
109 $profile[
"FULL_NAME"] = $profile[
"OFICIAL_NAME"];
111 if($profile[
"OFICIAL_NAME"] <>
'' && $profile[
"INN"] <>
'')
112 $profile[
"TYPE"] =
"UR";
113 elseif($profile[
"INN"] <>
'')
114 $profile[
"TYPE"] =
"IP";
116 $profile[
"TYPE"] =
"FIZ";
121 foreach($profile as $name => $value)
140 $property[$name] = $value;
143 $property[
"EMAIL"] = $value[
"MAIL_NEW"];
144 $property[
"PHONE"] = $value[
"WORK_PHONE_NEW"];
146 case 'REPRESENTATIVE':
147 $property[
"CONTACT_PERSON"] = $value[
"CONTACT_PERSON"];
149 case 'REGISTRATION_ADDRESS':
151 foreach($value as $nameProperty => $valueProperty)
153 if($valueProperty <>
'' && empty($property[$nameProperty]))
154 $property[$nameProperty] = $valueProperty;
156 $property[
"ADDRESS_FULL"] = $value[
"PRESENTATION"];
157 $property[
"INDEX"] = $value[
"POST_CODE"];
160 foreach($value as $nameProperty => $valueProperty)
162 if($valueProperty <>
'' && empty($property[
"F_".$nameProperty]))
163 $property[
"F_".$nameProperty] = $valueProperty;
165 $property[
"F_ADDRESS_FULL"] = $value[
"PRESENTATION"];
166 $property[
"F_INDEX"] = $value[
"POST_CODE"];
172 $result[
'TRAITS'] = isset($profile)? $profile:array();
173 $result[
'ORDER_PROPS'] = isset($property)? $property:array();
190 $traits = $fields[
'TRAITS'];
191 $businessValue = $fields[
'BUSINESS_VALUE'];
195 foreach ($availableFields as $k=>$v)
198 $replacedFields = $businessValue;
202 $value = $this->getXmlId($traits);
205 $value = $businessValue[
'AGENT_NAME'];
208 $value = $businessValue[
'INN'];
211 $value = $businessValue[
'KPP'];
214 $replaceNameFields = array(
215 'PRESENTATION' =>
'F_ADDRESS_FULL',
216 'POST_CODE' =>
'F_INDEX',
217 'COUNTRY' =>
'F_COUNTRY',
218 'REGION' =>
'F_REGION',
219 'STATE' =>
'F_STATE',
220 'SMALL_CITY' =>
'F_TOWN',
222 'STREET' =>
'F_STREET',
223 'HOUSE' =>
'F_HOUSE',
224 'BUILDING' =>
'F_BUILDING',
226 $this->replaceNameFields($replacedFields, $replaceNameFields);
230 $replaceNameFields = array(
231 'WORK_PHONE_NEW' =>
'PHONE',
232 'MAIL_NEW' =>
'EMAIL'
234 $this->replaceNameFields($replacedFields, $replaceNameFields);
237 case 'REPRESENTATIVES':
238 $replaceNameFields = array(
239 'RELATION' =>
'CONTACT_PERSON',
240 'ID' =>
'CONTACT_PERSON',
241 'ITEM_NAME' =>
'CONTACT_PERSON',
243 $this->replaceNameFields($replacedFields, $replaceNameFields);
250 $result[$k] = $value;
253 if($this->
isFiz($businessValue))
255 foreach ($availableFields as $k=>$v)
257 if(in_array($k, array(
'XML_ID',
'ITEM_NAME',
'INN',
'KPP',
'ADDRESS',
'CONTACTS',
'REPRESENTATIVES',
'ROLE')))
261 $replacedFields = $businessValue;
265 $value = $businessValue[
'FULL_NAME'];
268 $value = $businessValue[
'SURNAME'];
271 $value = $businessValue[
'NAME'];
274 $value = $businessValue[
'SECOND_NAME'];
277 $value = $businessValue[
'BIRTHDAY'];
280 $value = $businessValue[
'MALE'];
282 case 'REGISTRATION_ADDRESS':
283 $replaceNameFields = array(
284 'PRESENTATION'=>
'ADDRESS_FULL',
285 'POST_CODE'=>
'INDEX',
287 $this->replaceNameFields($replacedFields, $replaceNameFields);
291 if(!is_array($value))
292 $this->externalizeField($value, $v);
294 $result[$k] = $value;
300 foreach ($availableFields as $k=>$v)
302 if(in_array($k, array(
'XML_ID',
'ITEM_NAME',
'INN',
'KPP',
'ADDRESS',
'CONTACTS',
'REPRESENTATIVES',
'ROLE')))
306 $replacedFields = $businessValue;
310 $replaceNameFields = array(
311 'PRESENTATION'=>
'ADDRESS_FULL',
312 'POST_CODE'=>
'INDEX',
314 $this->replaceNameFields($replacedFields, $replaceNameFields);
318 $value = $businessValue[
'FULL_NAME'];
321 $value = $businessValue[
'EGRPO'];
324 $value = $businessValue[
'OKVED'];
327 $value = $businessValue[
'OKDP'];
330 $value = $businessValue[
'OKOPF'];
333 $value = $businessValue[
'OKFC'];
337 $value = $businessValue[
'OKPO'];
339 case 'MONEY_ACCOUNTS':
340 $replaceNameFields = array(
341 'ITEM_NAME'=>
'B_NAME',
342 'PRESENTATION'=>
'B_ADDRESS_FULL',
343 'POST_CODE'=>
'B_INDEX',
344 'COUNTRY'=>
'B_COUNTRY',
345 'REGION'=>
'B_REGION',
347 'SMALL_CITY'=>
'B_TOWN',
349 'STREET'=>
'B_STREET',
351 'BUILDING'=>
'B_BUILDING',
354 $this->replaceNameFields($replacedFields, $replaceNameFields);
358 if(!is_array($value))
359 $this->externalizeField($value, $v);
361 $result[$k] = $value;
365 foreach ($availableFields as $k=>$v)
367 if($k <>
'REK_VALUES')
375 foreach($v[
'FIELDS'] as $name=>$fieldInfo)
380 case 'DELIVERY_ADDRESS':
381 $valueRV = isset($result[
'ADDRESS'][
'PRESENTATION']) ? $result[
'ADDRESS'][
'PRESENTATION']:
'';
383 $valueRV = $result[($this->
isFiz($businessValue) ?
'REGISTRATION_ADDRESS':
'UR_ADDRESS')][
'PRESENTATION'];
386 $value[] = $this->externalizeRekvValue($name, $valueRV, $fieldInfo);
390 $result[$k] = $value;
393 $result = $this->modifyTrim($result);