0) { $objAddInfo = mysql_fetch_assoc($rezAddInfo); //дополнительные поля $object['apartments'] = $objAddInfo['apartments']; $object['video_url'] = $objAddInfo['video_url']; $object['balcony'] = $objAddInfo['balcony']; $object['loggias'] = $objAddInfo['loggias']; $object['separate_wcs'] = $objAddInfo['separate_wcs']; $object['combined_wcs'] = $objAddInfo['combined_wcs']; $object['passenger_lifts'] = $objAddInfo['passenger_lifts']; $object['cargo_lifts'] = $objAddInfo['cargo_lifts']; $object['window_view'] = $objAddInfo['window_view']; $object['renovation'] = $objAddInfo['renovation']; $object['ceiling_height'] = $objAddInfo['ceiling_height']; $object['vat_type_id'] = $objAddInfo['vat_type_id']; $object['house_category'] = $objAddInfo['house_category']; $object['house_category'] = $objAddInfo['house_category']; $object['commercial_object_id'] = $objAddInfo['commercial_object_id']; $object['isPartsEnabled'] = $objAddInfo['isPartsEnabled']; $object['parts_area'] = $objAddInfo['parts_area']; $object['legal_address'] = $objAddInfo['legal_address']; $object['isOccupied'] = $objAddInfo['isOccupied']; $object['is_occupied_month'] = $objAddInfo['is_occupied_month']; $object['is_occupied_year'] = $objAddInfo['is_occupied_year']; $object['layout_id'] = $objAddInfo['layout_id']; $object['number_wet_spots'] = $objAddInfo['number_wet_spots']; $object['electricity_power'] = $objAddInfo['electricity_power']; $object['commer_condition'] = $objAddInfo['commer_condition']; $object['isFurniture'] = $objAddInfo['isFurniture']; $object['commer_access'] = $objAddInfo['commer_access']; $object['parking_price'] = $objAddInfo['parking_price']; $object['parkingIsFree'] = $objAddInfo['parkingIsFree']; $object['building_nazv'] = $objAddInfo['building_nazv']; $object['commerc_year'] = $objAddInfo['commerc_year']; $object['commerc_building_type_id'] = $objAddInfo['commerc_building_type_id']; $object['commerc_building_class_id'] = $objAddInfo['commerc_building_class_id']; $object['building_area'] = $objAddInfo['building_area']; $object['commerc_site'] = $objAddInfo['commerc_site']; $object['commerc_owned'] = $objAddInfo['commerc_owned']; $object['commerc_building_category_id'] = $objAddInfo['commerc_building_category_id']; $object['building_developer'] = $objAddInfo['building_developer']; $object['building_management_company'] = $objAddInfo['building_management_company']; $object['commerc_building_ventilation'] = $objAddInfo['commerc_building_ventilation']; $object['commerc_building_conditioning'] = $objAddInfo['commerc_building_conditioning']; $object['commerc_building_heating'] = $objAddInfo['commerc_building_heating']; $object['commerc_building_fire'] = $objAddInfo['commerc_building_fire']; $object['commerc_houseLineType_id'] = $objAddInfo['commerc_houseLineType_id']; $object['commerc_opened_id'] = $objAddInfo['commerc_opened_id']; $object['commerc_infrastructure'] = $objAddInfo['commerc_infrastructure']; $object['column_grid'] = $objAddInfo['column_grid']; $object['tax_number'] = $objAddInfo['tax_number']; $object['floor_material_id'] = $objAddInfo['floor_material_id']; $object['commerc_portal_id'] = $objAddInfo['commerc_portal_id']; $object['gsk_nazv'] = $objAddInfo['gsk_nazv']; $object['commerc_specifications'] = $objAddInfo['commerc_specifications']; $object['commerc_land_category_id'] = $objAddInfo['commerc_land_category_id']; $object['can_land_category_change'] = $objAddInfo['can_land_category_change']; $object['commerc_permitted_use_id'] = $objAddInfo['commerc_permitted_use_id']; $object['can_permitted_use_change'] = $objAddInfo['can_permitted_use_change']; $object['commerc_investproject'] = $objAddInfo['commerc_investproject']; $object['is_encumbrances'] = $objAddInfo['is_encumbrances']; $object['commerc_electricity_id'] = $objAddInfo['commerc_electricity_id']; $object['can_electricity'] = $objAddInfo['can_electricity']; $object['commerc_gas_id'] = $objAddInfo['commerc_gas_id']; $object['can_gas'] = $objAddInfo['can_gas']; $object['commerc_water_id'] = $objAddInfo['commerc_water_id']; $object['can_water'] = $objAddInfo['can_water']; $object['commerc_sewage_id'] = $objAddInfo['commerc_sewage_id']; $object['can_sewage'] = $objAddInfo['can_sewage']; $object['commerc_driveways_id'] = $objAddInfo['commerc_driveways_id']; $object['garage_type_id'] = $objAddInfo['garage_type_id']; $object['commerc_lift1']=$objAddInfo['commerc_lift1']; $object['lift1_carrying']=$objAddInfo['lift1_carrying']; $object['commerc_lift2']=$objAddInfo['commerc_lift2']; $object['lift2_carrying']=$objAddInfo['lift2_carrying']; $object['commerc_lift3']=$objAddInfo['commerc_lift3']; $object['lift3_carrying']=$objAddInfo['lift3_carrying']; $object['commerc_crane1']=$objAddInfo['commerc_crane1']; $object['crane1_carrying']=$objAddInfo['crane1_carrying']; $object['commerc_crane2']=$objAddInfo['commerc_crane2']; $object['crane2_carrying']=$objAddInfo['crane2_carrying']; $object['commerc_crane3']=$objAddInfo['commerc_crane3']; $object['crane3_carrying']=$objAddInfo['crane3_carrying']; $object['commerc_crane4']=$objAddInfo['commerc_crane4']; $object['crane4_carrying']=$objAddInfo['crane4_carrying']; $object['parking_id'] = $objAddInfo['parking_id']; $object['commerc_services'] = $objAddInfo['commerc_services']; $object['garage_vid_id'] = $objAddInfo['garage_vid_id']; $object['boks_vid_id'] = $objAddInfo['boks_vid_id']; $object['commerc_status_id'] = $objAddInfo['commerc_status_id']; $object['commerc_purpose'] = $objAddInfo['commerc_purpose']; $object['other_ku'] = $objAddInfo['other_ku']; $object['other_ku_stoim'] = $objAddInfo['other_ku_stoim']; } else { $object['apartments'] = 0; $object['video_url'] = null; $object['balcony'] = null; $object['loggias'] = null; $object['separate_wcs'] = null; $object['combined_wcs'] = null; $object['passenger_lifts'] = null; $object['cargo_lifts'] = null; $object['window_view'] = null; $object['renovation'] = null; $object['ceiling_height'] = 0; $object['vat_type_id'] = 0; $object['house_category'] = 0; $object['commercial_object_id'] = 0; $object['isPartsEnabled'] = 0; $object['parts_area'] = null; $object['legal_address'] = null; $object['isOccupied'] = 0; $object['is_occupied_month'] = 0; $object['is_occupied_year'] = null; $object['layout_id'] = 0; $object['number_wet_spots'] = null; $object['electricity_power'] = null; $object['commer_condition'] =null; $object['isFurniture'] = 0; $object['commer_access'] = null; $object['parking_price'] = null; $object['parkingIsFree'] = null; $object['building_nazv'] = null; $object['commerc_year'] = null; $object['commerc_building_type_id'] = 0; $object['commerc_building_class_id'] = 0; $object['building_area'] = null; $object['commerc_site'] = null; $object['commerc_owned'] = null; $object['commerc_building_category_id'] = 0; $object['building_developer'] = null; $object['building_management_company'] = null; $object['commerc_building_ventilation'] = null; $object['commerc_building_conditioning'] = null; $object['commerc_building_heating'] = null; $object['commerc_building_fire'] = null; $object['commerc_houseLineType_id'] = 0; $object['commerc_opened_id'] = 0; $object['commerc_infrastructure'] = null; $object['column_grid'] = ''; $object['tax_number'] = null; $object['floor_material_id'] = 0; $object['commerc_portal_id'] = 0; $object['gsk_nazv'] = ''; $object['commerc_specifications'] = null; $object['commerc_land_category_id'] = 0; $object['can_land_category_change'] = 0; $object['commerc_permitted_use_id'] = 0; $object['can_permitted_use_change'] = 0; $object['commerc_investproject'] = 0; $object['is_encumbrances'] = 0; $object['commerc_electricity_id'] = 0; $object['can_electricity'] = 0; $object['commerc_gas_id'] = 0; $object['can_gas'] = 0; $object['commerc_water_id'] = 0; $object['can_water'] = 0; $object['commerc_sewage_id'] = 0; $object['can_sewage'] = 0; $object['commerc_driveways_id'] = 0; $object['garage_type_id'] = 0; $object['commerc_lift1']=''; $object['lift1_carrying']=''; $object['commerc_lift2']=''; $object['lift2_carrying']=''; $object['commerc_lift3']=''; $object['lift3_carrying']=''; $object['commerc_crane1']=''; $object['crane1_carrying']=''; $object['commerc_crane2']=''; $object['crane2_carrying']=''; $object['commerc_crane3']=''; $object['crane3_carrying']=''; $object['commerc_crane4']=''; $object['crane4_carrying']=''; $object['parking_id'] = 0; $object['commerc_services'] = null; $object['garage_vid_id'] = 0; $object['boks_vid_id'] = 0; $object['commerc_status_id'] = 0; $object['commerc_purpose'] = null; $object['other_ku'] = 0; $object['other_ku_stoim'] = 0; } $sqlPhotoInfo = "SELECT oop.sort_order, p.photo FROM objects_object_photo oop, object_photo p WHERE p.id = oop.object_photo_id AND oop.object_id = $object[id] ORDER BY oop.sort_order"; $rezPhotoInfo = mysql_query($sqlPhotoInfo); if (mysql_num_rows($rezPhotoInfo) > 0) { while ($photoInfo = mysql_fetch_assoc($rezPhotoInfo)) { $object['photo' . $photoInfo['sort_order']] = $photoInfo['photo']; } } $sqlNbInfo = "SELECT newbuilding_id, zipal_new_flat_type_id, investor_type_id, last_name_id, first_name_id, second_name_id, inn_id, nb_end_date, documentation_url FROM object_nb_info WHERE object_id=$object[id]"; $rezNbInfo = mysql_query($sqlNbInfo); if (mysql_num_rows($rezNbInfo) > 0) { $objNbInfo = mysql_fetch_assoc($rezNbInfo); $object['newbuilding_id'] = $objNbInfo['newbuilding_id']; $object['zipal_new_flat_type_id'] = $objNbInfo['zipal_new_flat_type_id']; $object['investor_type_id'] = $objNbInfo['investor_type_id']; $object['last_name_id'] = $objNbInfo['last_name_id']; $object['first_name_id'] = $objNbInfo['first_name_id']; $object['second_name_id'] = $objNbInfo['second_name_id']; $object['inn_id'] = $objNbInfo['inn_id']; $object['nb_end_date'] = $objNbInfo['nb_end_date']; $object['documentation_url'] = $objNbInfo['documentation_url']; } $sqlRayonInfo = "SELECT rayon FROM rayon WHERE id=$object[rayon]"; $rezRayonInfo = mysql_query($sqlRayonInfo); if (mysql_num_rows($rezRayonInfo) > 0) { $objRayonInfo = mysql_fetch_assoc($rezRayonInfo); $object['rayon_name'] = $objRayonInfo['rayon']; } else { $object['rayon_name'] = null; } $sqlSaleInfo = "SELECT * FROM sale_objects WHERE object_id=$object[id]"; $rezSaleInfo = mysql_query($sqlSaleInfo); if (mysql_num_rows($rezSaleInfo) > 0) { $objSaleInfo = mysql_fetch_assoc($rezSaleInfo); $object['house_type'] = $objSaleInfo['house_type']; $object['house_material'] = $objSaleInfo['house_material']; $object['deal_type'] = $objSaleInfo['deal_type']; $object['build_year'] = $objSaleInfo['build_year']; $sqlHmInfo = "SELECT name FROM house_material WHERE id=$object[house_material]"; $rezHmInfo = mysql_query($sqlHmInfo); if (mysql_num_rows($rezHmInfo) > 0) { $objHmInfo = mysql_fetch_assoc($rezHmInfo); $object['house_material_name'] = $objHmInfo['name']; } else { $object['house_material_name'] = null; } $sqlHtInfo = "SELECT name FROM house_type WHERE id=$object[house_type]"; $rezHtInfo = mysql_query($sqlHtInfo); if (mysql_num_rows($rezHtInfo) > 0) { $objHtInfo = mysql_fetch_assoc($rezHtInfo); $object['house_type_name'] = $objHtInfo['name']; } else { $object['house_type_name'] = null; } $sqlDtInfo = "SELECT name FROM deal_type WHERE id=$object[deal_type]"; $rezDtInfo = mysql_query($sqlDtInfo); if (mysql_num_rows($rezDtInfo) > 0) { $objDtInfo = mysql_fetch_assoc($rezDtInfo); $object['deal_type_name'] = $objDtInfo['name']; } else { $object['deal_type_name'] = null; } } else { $object['house_material'] = null; $object['house_type'] = null; $object['deal_type'] = null; $object['build_year'] = null; $object['deal_type_name'] = null; $object['house_type_name'] = null; $object['house_material_name'] = null; } /** GET PLAN */ $plan = ''; $sqlP = "SELECT * FROM objects_plan WHERE object_id = $object[id]"; $rez_plan = mysql_query($sqlP); if(mysql_num_rows($rez_plan) > 0){ $obj_plan = mysql_fetch_assoc($rez_plan); if($obj_plan['img_plan'] != ''){ if (stripos($obj_plan['img_plan'], "http://") === false && stripos($obj_plan['img_plan'], "https://") === false) { $obj_plan['img_plan'] = "https://joywork.ru/photos/" . $obj_plan['img_plan']; } $plan = $obj_plan['img_plan']; } } if(!$object['etazh']) { $object['etazh'] = 1; } else { if ($object['etazh'] <= 0) { $object['etazh'] = 1; } } if(!$object['etazh_iz']) { $object['etazh_iz'] = 1; } else { if ($object['etazh_iz'] <= 0) { $object['etazh_iz'] = 1; } } $request = []; if ($object) { $request['common'] = []; $request['common']['address'] = []; $sqlLocationInfo = "SELECT * FROM object_location WHERE object_id=".$object['id']; $rezLocationInfo = mysql_query($sqlLocationInfo); $objLocationInfo = null; //$needStringAddress = true; if (mysql_num_rows($rezLocationInfo) > 0) { $objLocationInfo = mysql_fetch_assoc($rezLocationInfo); $object['part'] = $objLocationInfo['part']; if ($objLocationInfo['latitude'] && $objLocationInfo['longitude']) { $request['common']['address']['coordinates'] = []; $request['common']['address']['coordinates']['lat'] = $objLocationInfo['latitude']; $request['common']['address']['coordinates']['lon'] = $objLocationInfo['longitude']; //$needStringAddress = false; } } else { $object['part'] = null; } //if ($needStringAddress) { $request['common']['address']['street'] = []; $request['common']['address']['street']['type'] = 'SimpleStreetType'; if ($objLocationInfo != null) { $address = $objLocationInfo['city'] . ', ' . $objLocationInfo['street']; } else { $address = $object['adres']; } $dom = $object['dom']; if (strpos($address, 'Санкт-Петербург') === false && strpos($address, 'Москва') === false && strpos($address, 'Севастополь') === false) { $sql = "SELECT * FROM rf_regions where id = $object[id_rf_region]"; $rez = mysql_query($sql); if ($rez) { $region = mysql_fetch_assoc($rez); if (strpos($address, $region['name']) === false) { $address = $region['name'] . ', ' . $address; } } else { $sql = "SELECT * FROM rayon WHERE id in (select rayon from objects where id = $object[id])"; $result = mysql_query($sql); if ($result) { $rayon = mysql_fetch_assoc($result); } if ((isset($rayon) && $rayon['is_lo'] == 1) || (isset($object['lo_city_id']) && $object['lo_city_id'] > 0)) { if (strpos($address, 'Ленинградская область') === false) { $address = 'Ленинградская область, ' . $address; } } else { if (strpos($address, 'Санкт-Петербург') === false) { $address = 'Санкт-Петербург, ' . $address; } } } } $request['common']['address']['street']['name'] = $address; $request['common']['address']['street']['allowWeak'] = true; if ($object['rayon_name']) { $request['common']['districtName'] = $object['rayon_name']; } if ($dom) { $dom = str_replace(",", "", $dom); } if ($object['korpus']) { $dom = $dom . "к" . $object['korpus']; } if ($object['litera']) { $dom = $dom . " " . $object['litera']; } $request['common']['address']['dom'] = $dom; //} $sql = "SELECT metro.metro FROM metro, sp_metro WHERE sp_metro.id_metro = metro.id AND sp_metro.id_obj = $object[id]"; $result = mysql_query($sql); $m = mysql_fetch_row($result); $mtr = $m[0]; $request['common']['metros']['metro'] = []; $request['common']['metros']['metro'][]['name'] = $mtr; $request['common']['contactInfo'] = []; $userOwner = new User; $userOwner->get($object['id_add_user']); if (!isset($userOwner->agencyId)) { $userOwner->agencyId = $object['id_add_user']; } $agencyId = $userOwner->agencyId; $request['common']['contactInfo']['name'] = htmlspecialchars_decode(trim($userOwner->last_name . ' ' . $userOwner->first_name . ' ' . $userOwner->middle_name)); $agencyPhone = null; $sqlPhoneLink = "SELECT phone FROM feed_adv_phone WHERE id in (select feed_adv_phone_id from feed_adv_phone_user where user_id = $agencyId) and deleted = 0 and feed_adv_phone_type_id in (1, 7) and agency_id = $agencyId LIMIT 1"; $rezPhoneLink = mysql_query($sqlPhoneLink); if (mysql_num_rows($rezPhoneLink) > 0) { $link = mysql_fetch_assoc($rezPhoneLink); $agencyPhone = $link['phone']; } $userPhone = null; $sqlPhoneUserLink = "SELECT phone FROM feed_adv_phone WHERE id in (select feed_adv_phone_id from feed_adv_phone_user where user_id = $object[id_add_user]) and deleted = 0 and feed_adv_phone_type_id in (1, 7) and agency_id = $agencyId LIMIT 1"; $rezPhoneUserLink = mysql_query($sqlPhoneUserLink); if (mysql_num_rows($rezPhoneUserLink) > 0) { $link = mysql_fetch_assoc($rezPhoneUserLink); $userPhone = $link['phone']; } if ($agencyPhone != null) { $object['phone'] = $agencyPhone; } if ($userPhone != null) { $object['phone'] = $userPhone; } $request['common']['contactInfo']['phone'] = $object['phone']; $request['common']['contactInfo']['email'] = $userOwner->email; $request['common']['contactInfo']['company'] = isset($userOwner->agencyName) ? $userOwner->agencyName : ""; $request['common']['ownership'] = 'AGENT'; if ($object['operation_type'] == 0) { if ($object['commission']) { $request['common']['commission'] = round($object['commission']); } else { $request['common']['commission'] = 0; } $request['common']['commissionType'] = 'PERCENT'; } $request['common']['name'] = $object['nazv']; if(mb_strlen($object['opis']) > 2000) { $object['opis'] = mb_substr($object['opis'], 0, 1995); } if (!empty($object['opis'])) { $request['common']['description'] = htmlspecialchars(br2nl($object['opis']), ENT_QUOTES); } else { $request['common']['description'] = ""; } $request['common']['price'] = $object['stoim']; $request['common']['currency'] = 'RUR'; $request['common']['square'] = $object['ploshad']; if ($object['peshkom']) { $request['common']['distanceToMetro'] = $object['peshkom']; $request['common']['distanceType'] = 'WALK'; } if ($object['transport']) { $request['common']['distanceToMetro'] = $object['transport']; $request['common']['distanceType'] = 'TRANSPORT'; } if ($object['cadastral_number']) { $request['common']['cadastralNumber'] = $object['cadastral_number']; } /*if (!empty($object['video_url'])) { $request['common']['videoUrl'] = $object['video_url']; }*/ $hasPhoto = false; for ($j = 1; $j <= 30; $j++) { if (isset($object['photo' . $j]) && $object['photo' . $j]) { $hasPhoto = true; } } if ($hasPhoto || $plan) { $photos = []; $num = 1; for ($k = 1; $k <= 30; $k++) { $photo = []; if (isset($object['photo' . $k]) && $object['photo' . $k]) { $srcFile = $object['photo' . $k]; if (stripos($object['photo' . $k], "http://") === false && stripos($object['photo'.$k],"https://") === false) { $srcFile = "https://" . $_SERVER['SERVER_NAME'] . "/photos/" . $object['photo' . $k]; } if ($srcFile != null) { $photo['url'] = $srcFile; $photos[] = $photo; $num++; } } } /*if ($plan && $plan != 'https://joywork.ru/photos/') { $photo = []; $photo['url'] = $plan; $photos[] = $photo; }*/ $request['common']['photos'] = $photos; } $request['specific'] = []; if(!empty($object['build_year'])){ $request['specific']['year'] = $object['build_year']; } if ($object['operation_type'] == 1) { //продажа if ($object['type'] == 4) { //коммерция $request['specific']['sublease'] = 'true'; $request['specific']['vatType'] = 'VAT_NOT_INCLUDED'; if(isset($object['vat_type_id']) && $object['vat_type_id'] != 0){ if($object['vat_type_id'] == 1){ $request['specific']['vatType'] = 'VAT_NOT_INCLUDED'; } else if($object['vat_type_id'] == 2){ $request['specific']['vatType'] = 'VAT_INCLUDED'; } else if($object['vat_type_id'] == 3){ $request['specific']['vatType'] = 'USN'; } } if ($object['type_category']) { // Можно частями if($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['isPartsEnabled'] > 0){ $request['specific']['byPart'] = 'true'; $partsObj = json_decode($object['parts_area'],true); if(!empty($partsObj)){ foreach ($partsObj as $partt) { $request['specific']['parts'][] = array('square'=>$partt, 'price'=>'1'); } } } } //класс здания if($object['type_category'] == 1){ if($object['commerc_building_class_id']){ $building_class_arr = array('2'=>'APLUS', '1'=>'A', '4'=>'BPLUS', '3'=>'B', '5'=>'B', '6'=>'C'); if(isset($building_class_arr[$object['commerc_building_class_id']])){ $request['specific']['buildingClass'] = $building_class_arr[$object['commerc_building_class_id']]; } } } //Планировка if($object['type_category'] == 1){ if($object['layout_id']){ $layout_arr = array(1=>'CORRIDOR',2=>'FREE',4=>'MIXED'); if(isset($layout_arr[$object['layout_id']])){ $request['specific']['layout'] = $layout_arr[$object['layout_id']]; } } } //Тип здания if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['commerc_building_type_id']){ $building_type_arr = array(1=>'ADMINISTRATIVE',50=>'BANKING',2=>'BUSINESS_CENTER', 6=>'BUSINESS_PARK',35=>'LIVING_HOUSE',20=>'MIXED_COMPLEX',16=>'MANSION', 25=>'OFFICE_BUILDING',22=>'OFFICE_RESIDENTIAL',24=>'OFFICE_WAREHOUSE', 47=>'OFFICE_RETAIL',38=>'MALL'); if(isset($building_type_arr[$object['commerc_building_type_id']])){ $request['specific']['buildingType'] = $building_type_arr[$object['commerc_building_type_id']]; } else { $request['specific']['buildingType'] = "OFFICE_WAREHOUSE"; } } else { $request['specific']['buildingType'] = "OFFICE_WAREHOUSE"; } } //Тип парковки if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['parking_type_id'] && $object['parking_type_id'] > 0){ if($object['parking_type_id'] == 1){ $request['specific']['parkingType'] = 'ON_GROUND'; } if($object['parking_type_id'] == 2){ $request['specific']['parkingType'] = 'UNDER_GROUND'; } } } //objectCondition if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ $request['specific']['objectCondition'] = 'READY'; } //Название здания if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['building_nazv'] && ! empty($object['building_nazv'])){ $request['specific']['centerName'] = $object['building_nazv']; } } if ($object['type_category'] == 1) { //офисы $request['requestType'] = "OfficeSellRequestType"; } //Высота потолков if ($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6) { if($object['ceiling_height'] && $object['ceiling_height'] > 0){ $request['specific']['ceilingHeight'] = $object['ceiling_height'] * 100; } } //Год постройки if ($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6) { if(!empty($object['commerc_year'])){ $request['specific']['year'] = $object['commerc_year']; } } //Вход if($object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['commerc_opened_id']){ $commerc_opened_arr = array(1=>'SEPARATE_FROM_YARD',2=>'SEPARATE_FROM_STREET',3=>'JOINT_FROM_YARD', 4=>'JOINT_FROM_STREET'); if(isset($commerc_opened_arr[$object['commerc_opened_id']])){ $request['specific']['entryType'] = $commerc_opened_arr[$object['commerc_opened_id']]; } } } //Мебель /*if($object['type_category'] == 1){ if($object['isFurniture']){ $request['specific']['feature'][] = 'FURNITURE'; } }*/ //опции if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ $feature_arr = [ // Допустимые значения "REPAIR_BY_OWNER", "ANY_INET_PROVIDER", "FIRST_LINE", "RESTAURANT", "FITNESS", "BANK", "ATM", "SUPERMARKET", "INTERNET", "CLOCK_ACCESS", "VIDEO_SURVEILLANCE", "GUARDS", "ACCESS_CONTROL", "ELEVATOR", "CLIENTS_ACCESS", "CONDITIONER", "HEATING", "SEPARATE_ENTRY" ]; if($object['commerc_infrastructure']){ $commerc_infrastructure = json_decode($object['commerc_infrastructure']); if(!empty($commerc_infrastructure)){ $sql = "SELECT * FROM commerc_infrastructure WHERE id in (".implode(',',$commerc_infrastructure).")"; $q = mysql_query($sql); while($r = mysql_fetch_assoc($q)){ if(in_array($r['zipal_name'],$feature_arr)){ $request['specific']['feature'][] = $r['zipal_name']; } } } } } if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5){ $request['specific']['floorNumber'] = $object['etazh']; } if($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6){ $request['specific']['floorsNumber'] = $object['etazh_iz']; } if($object['type_category'] == 6){ $request['specific']['structureType'] = 'DETACHED'; } //электричество if($object['type_category'] == 9){ $request['common']['square'] = $object['commerc_site'] * 100; //Назначение земли if($object['commerc_land_category_id']){ $commerc_land_category_arr = array(1=>'SETTLEMENTS',2=>'AGRICULTURAL',3=>'INDUSTRIAL'); if(isset($commerc_land_category_arr[$object['commerc_land_category_id']])){ $request['specific']['purpose'] = $commerc_land_category_arr[$object['commerc_land_category_id']]; } } //Обременение if($object['is_encumbrances']){ $request['specific']['burden'] = 'true'; } else { $request['specific']['burden'] = 'false'; } if(isset($object['commerc_electricity_id'])){ $commerc_electricity_arr = array(0=>'NO',1=>'YES',3=>'POSSIBLE'); if(isset($commerc_electricity_arr[$object['commerc_electricity_id']])){ $request['specific']['electricity'] = $commerc_electricity_arr[$object['commerc_electricity_id']]; } } //Газификация if(isset($object['commerc_gas_id'])){ $commerc_gas_arr = array(0=>'NO',1=>'YES',3=>'BORDER'); if(isset($commerc_gas_arr[$object['commerc_gas_id']])){ $request['specific']['gas'] = $commerc_gas_arr[$object['commerc_gas_id']]; } } if(isset($object['commerc_water_id'])){ $commerc_water_arr = array(0=>'NO',1=>'CENTRAL',3=>'BORDER'); if(isset($commerc_water_arr[$object['commerc_water_id']])){ $request['specific']['plumbing'] = $commerc_water_arr[$object['commerc_water_id']]; } } if(isset($object['commerc_sewage_id'])){ $commerc_sewage_arr = array(0=>'NO',1=>'CENTRAL',3=>'CENTRAL'); if(isset($commerc_sewage_arr[$object['commerc_sewage_id']])){ $request['specific']['sewerage'] = $commerc_sewage_arr[$object['commerc_sewage_id']]; } } if ($object['can_electricity']) { $request['specific']['electricity'] = "POSSIBLE"; } if ($object['can_gas']) { $request['specific']['gas'] = "POSSIBLE"; } if ($object['can_water']) { $request['specific']['plumbing'] = "NO"; } if ($object['can_sewage']) { $request['specific']['sewerage'] = "NO"; } } if ($object['type_category'] == 1) { //офисы $request['requestType'] = "OfficeSellRequestType"; } else if ($object['type_category'] == 2 || $object['type_category'] == 4) { //склады $request['requestType'] = "WarehouseSellRequestType"; $request['specific']['warehouseType'] = 'WAREHOUSE'; $request['specific']['floor'] = "TILE"; } else if ($object['type_category'] == 3){ //Торговая площадь $request['requestType'] = "BusinessSellRequestType"; $request['specific']['businessUsageType'] = 'RETAIL'; } else if($object['type_category'] == 4){ //Производство $request['requestType'] = "WarehouseSellRequestType"; $request['specific']['warehouseType'] = 'CONSTRUCTION'; $request['specific']['businessUsageType'] = 'ANY'; } else if ($object['type_category'] == 5 || $object['type_category'] == 6) { $request['requestType'] = 'BusinessSellRequestType'; $request['specific']['businessUsageType'] = 'ANY'; } else if($object['type_category'] == 7){ //гараж $request['requestType'] = 'GarageSellRequestType'; //машиноместо if($object['garage_type_id'] && $object['garage_type_id'] == 1){ $request['requestType'] = 'ParkingLotSellRequestType'; $request['specific']['parkingLotType'] = 'OPEN'; } if($object['garage_type_id'] && $object['garage_type_id'] == 2) { $request['specific']['garageType'] = 'STANDALONE'; } if($object['garage_type_id'] && $object['garage_type_id'] == 3) { $request['specific']['garageType'] = 'BOX'; } $request['specific']['businessUsageType'] = 'ANY'; $request['specific']['buildingType'] = 'MIXED_COMPLEX'; } else if ($object['type_category'] == 9){ //Земля $request['requestType'] = 'CommLandSellRequestType'; if ($object['shape_type_id']) { $sqlShapeType = "SELECT code FROM shape_type WHERE id = $object[shape_type_id]"; $resultShapeType = mysql_query($sqlShapeType); $shapeType = mysql_fetch_row($resultShapeType); $request['specific']['shape'] = $shapeType[0]; } else { $request['specific']['shape'] = "REGULAR"; } if ($object['land_distance']) { $request['specific']['distance'] = intval($object['land_distance']); } if ($object['relief_type_id']) { $sqlReliefType = "SELECT code FROM relief_type WHERE id = $object[relief_type_id]"; $resultReliefType = mysql_query($sqlReliefType); $reliefType = mysql_fetch_row($resultReliefType); $request['specific']['relief'] = $reliefType[0]; } else { $request['specific']['relief'] = "FLAT"; } } else { $request['requestType'] = "BusinessSellRequestType"; $request['specific']['buildingType'] = 'MIXED_COMPLEX'; $request['specific']['floorNumber'] = $object['etazh']; $request['specific']['floorsNumber'] = $object['etazh_iz']; $request['specific']['businessUsageType'] = 'ANY'; } if ($object['type_category'] == 6) { $request['common']['square'] = $object['building_area']; } } } else { $request['specific']['roomsCount'] = $object['komnat']; if ($object['type'] == 1 || $object['type'] == 2) { //квартира или команата $request['requestType'] = "FlatSellRequestType"; $request['specific']['apartments'] = $object['apartments'] && $object['apartments'] == 1 ? true : false; if ($object['balcony'] && $object['balcony'] > 0) { if ($object['balcony'] == 1) { $request['specific']['balcony'] = "ONE"; } if ($object['balcony'] == 2) { $request['specific']['balcony'] = "TWO"; } if ($object['balcony'] == 3) { $request['specific']['balcony'] = "THREE"; } if ($object['balcony'] > 3) { $request['specific']['balcony'] = "FOUR"; } } else { $request['specific']['balcony'] = "NONE"; } if ($object['loggias'] && $object['loggias'] > 0) { if ($object['loggias'] == 1) { $request['specific']['loggia'] = "ONE"; } if ($object['loggias'] == 2) { $request['specific']['loggia'] = "TWO"; } if ($object['loggias'] == 3) { $request['specific']['loggia'] = "THREE"; } if ($object['loggias'] > 3) { $request['specific']['loggia'] = "FOUR"; } } else { $request['specific']['loggia'] = "NONE"; } if ($object['passenger_lifts'] && $object['passenger_lifts'] > 0) { if ($object['passenger_lifts'] == 1) { $request['specific']['elevator'] = "ONE"; } if ($object['passenger_lifts'] == 2) { $request['specific']['elevator'] = "TWO"; } if ($object['passenger_lifts'] == 3) { $request['specific']['elevator'] = "THREE"; } if ($object['passenger_lifts'] > 3) { $request['specific']['elevator'] = "FOUR"; } } else { $request['specific']['elevator'] = "NONE"; } if ($object['cargo_lifts'] && $object['cargo_lifts'] > 0) { if ($object['cargo_lifts'] == 1) { $request['specific']['serviceElevator'] = "ONE"; } if ($object['cargo_lifts'] == 2) { $request['specific']['serviceElevator'] = "TWO"; } if ($object['cargo_lifts'] == 3) { $request['specific']['serviceElevator'] = "THREE"; } if ($object['cargo_lifts'] > 3) { $request['specific']['serviceElevator'] = "FOUR"; } } else { $request['specific']['serviceElevator'] = "NONE"; } if ($object['separate_wcs'] && $object['separate_wcs'] > 0) { $request['specific']['toilet'] = "SEPARATED"; } if ($object['combined_wcs'] && $object['combined_wcs'] > 0) { $request['specific']['toilet'] = "JOINED"; } if ($object['combined_wcs'] && $object['combined_wcs'] > 0 && $object['separate_wcs'] && $object['separate_wcs'] > 0) { $count = $object['combined_wcs'] + $object['separate_wcs']; if ($count === 2) { $request['specific']['toilet'] = "TWO"; } if ($count === 3) { $request['specific']['toilet'] = "THREE"; } if ($count > 3) { $request['specific']['toilet'] = "FOUR"; } } if (isset($object['deal_type']) && ($object['deal_type'] == 5 || $object['deal_type'] == 6)) { if ($object['deal_type'] == 5) { $request['specific']['reassignment'] = true; } if (isset($object['documentation_url'])) { $request['specific']['documentationUrl'] = $object['documentation_url']; } if (isset($object['newbuilding_id'])) { $sqlNb = "SELECT * FROM newbuildings WHERE id = $object[newbuilding_id]"; $rezNb = mysql_query($sqlNb); $nb = mysql_fetch_assoc($rezNb); if ($nb) { $developer['value'] = ''; if($nb['developer_id']) { $sqlDeveloper = "SELECT value FROM developer WHERE id = $nb[developer_id]"; $rezDeveloper = mysql_query($sqlDeveloper); $developer = mysql_fetch_assoc($rezDeveloper); } $request['specific']['buildingName'] = $nb['name']; $request['specific']['developer'] = $developer['value']; } } if ($object['zipal_new_flat_type_id']) { $sqlNb = "SELECT * FROM zipal_new_flat_type WHERE id='" . $object['zipal_new_flat_type_id'] . "'"; $rezNb = mysql_query($sqlNb); $nb = mysql_fetch_assoc($rezNb); if ($nb) { if ($nb['code'] == 'ALL_DONE') { $request['specific']['newFlat'] = 'READY'; } else { $request['specific']['newFlat'] = $nb['code']; } } } if ($object['nb_end_date'] && $object['nb_end_date'] != '0000-00-00') { $curMonth = date("m", strtotime($object['nb_end_date'])); $curQuarter = ceil($curMonth/3); $request['specific']['readyDate'] = []; $request['specific']['readyDate']['quarter'] = $curQuarter == 1 ? "I" : ($curQuarter == 2 ? "II" : ($curQuarter == 3 ? "III" : "IV")); $request['specific']['readyDate']['year'] = date("Y", strtotime($object['nb_end_date'])); } if (isset($object['investor_type_id']) && $object['investor_type_id']) { $sqlInvestorType = "SELECT * FROM investor_type WHERE id='" . $object['investor_type_id'] . "'"; $rezInvestorType = mysql_query($sqlInvestorType); $investorType = mysql_fetch_assoc($rezInvestorType); if ($investorType) { if ($investorType['code'] == 'INDIVIDUAL') { $request['specific']['investorType'] = 'INDIVIDUAL'; if ($object['first_name_id']) { $sqlFirstNameCheck = "SELECT value FROM first_names WHERE id = $object[first_name_id]"; $rezFirstNameCheck = mysql_query($sqlFirstNameCheck); if (mysql_num_rows($rezFirstNameCheck) > 0) { $request['specific']['investorFirstName'] = mysql_fetch_assoc($rezFirstNameCheck)['value']; } } if ($object['last_name_id']) { $sqlLastNameCheck = "SELECT value FROM last_names WHERE id = $object[last_name_id]"; $rezLastNameCheck = mysql_query($sqlLastNameCheck); if (mysql_num_rows($rezLastNameCheck) > 0) { $request['specific']['investorLastName'] = mysql_fetch_assoc($rezLastNameCheck)['value']; } } if ($object['second_name_id']) { $sqlSecondNameCheck = "SELECT value FROM second_names WHERE id = $object[second_name_id]"; $rezSecondNameCheck = mysql_query($sqlSecondNameCheck); if (mysql_num_rows($rezSecondNameCheck) > 0) { $request['specific']['investorPatronymic'] = mysql_fetch_assoc($rezSecondNameCheck)['value']; } } } if ($investorType['code'] == 'LEGAL') { $request['specific']['investorType'] = 'LEGAL'; if ($object['inn_id']) { $sqlInnCheck = "SELECT value FROM inn WHERE id = $object[inn_id]"; $rezInnCheck = mysql_query($sqlInnCheck); if (mysql_num_rows($rezInnCheck) > 0) { $request['specific']['investorInn'] = mysql_fetch_assoc($rezInnCheck)['value']; } } } } } } $request['specific']['floorNumber'] = $object['etazh']; $request['specific']['floorsNumber'] = $object['etazh_iz']; $request['specific']['roomsCountTotal'] = $object['komnat']; $request['specific']['separatedRoomsCount'] = 0; if (isset($object['deal_type'])) { if ($object['deal_type'] == 1) { $request['specific']['flatStatus'] = 'FREE'; } if ($object['deal_type'] == 2) { $request['specific']['flatStatus'] = 'ALTERNATIVE'; } } $request['specific']['type'] = 'FLAT'; if ($object['studio_flag'] == 1) { $request['specific']['type'] = 'STUDIO'; } else { if ($object['rent_house_type_id']) { if ($object['rent_house_type_id'] == 1) { $request['specific']['type'] = 'STALINKA'; } if ($object['rent_house_type_id'] == 1) { $request['specific']['type'] = 'HRUSHEVKA'; } } } $request['specific']['material'] = 'PANEL'; $request['specific']['mortgage'] = (strpos($object['stoim_prim'], "ипотека") === false) ? false : true; $request['specific']['credit'] = false; if ($object['type'] == 1) { if (!empty($object['part'])) { $request['specific']['offerType'] = 'FLATSHARE'; if (strpos($object['part'], "/") === false) { $request['specific']['sharePercent'] = intval($object['part']); } else { $resPart = explode("/", $object['part']); $request['specific']['sharePercent'] = intval(($resPart[0]/$resPart[1]) * 100); } }else{ $request['specific']['offerType'] = 'FLAT'; } } if ($object['type'] == 2) { $request['specific']['offerType'] = 'ROOM'; } if ($object['house_material']) { if ($object['house_material'] == 1) { $request['specific']['material'] = 'BRICK'; } if ($object['house_material'] == 2) { $request['specific']['material'] = 'PANEL'; } if ($object['house_material'] == 3) { $request['specific']['material'] = 'MONOLITH'; } if ($object['house_material'] == 4) { $request['specific']['material'] = 'BLOCK'; } if ($object['house_material'] == 5) { $request['specific']['material'] = 'MONOBRICK'; } if ($object['house_material'] == 6) { $request['specific']['material'] = 'WOOD'; } } if (!empty($object['ploshad_k']) && $object['ploshad_k'] > 0) { $request['specific']['kitchenSquare'] = $object['ploshad_k']; } if (!empty($object['ploshad_komn']) && $object['ploshad_komn'] > 0) { $sq = $object['ploshad_komn']; if (strpos($object['ploshad_komn'], "+")) { $request['specific']['chambers'] = str_replace(',', '.', $object['ploshad_komn']); $sqTemp = 0; $res = explode("+", $object['ploshad_komn']); foreach ($res as $str) { $sqTemp = $sqTemp + intval(trim($str)); } $sq = $sqTemp; } $request['specific']['usefulSquare'] = str_replace(',', '.', $sq); } if ($object['type'] == 2) { $request['specific']['roomsCount'] = 1; } //Дополнительные поля (делала Ирина) //Вид из окон if($object['window_view'] && $object['window_view'] > 0){ if($object['window_view'] == 1){ $request['specific']['windowView'] = 'YARD'; } if($object['window_view'] == 2){ $request['specific']['windowView'] = 'STREET'; } if($object['window_view'] == 3){ $request['specific']['windowView'] = 'BOTH'; } } //Ремонт if($object['renovation'] && $object['renovation'] > 0){ if($object['renovation'] == 1){ $request['specific']['renovation'] = 'EURO'; } if($object['renovation'] == 2){ $request['specific']['renovation'] = 'COSMETIC'; } if($object['renovation'] == 5){ $request['specific']['renovation'] = 'AUTHOR'; } if($object['renovation'] == 6){ $request['specific']['renovation'] = 'NONE'; } } //Тип ванны if($object['bath_type_id'] && $object['bath_type_id'] > 0){ if($object['bath_type_id'] == 1){ $request['specific']['bathType'] = 'SHOWER'; } if($object['bath_type_id'] == 2){ $request['specific']['bathType'] = 'JOINED'; } if($object['bath_type_id'] == 3){ $request['specific']['bathType'] = 'SEPARATED'; } if($object['bath_type_id'] == 4){ $request['specific']['bathType'] = 'CROSS'; } if($object['bath_type_id'] == 5){ $request['specific']['bathType'] = 'LONGITUDINAL'; } if($object['bath_type_id'] == 6){ $request['specific']['bathType'] = 'SEDENTARY'; } if($object['bath_type_id'] == 7){ $request['specific']['bathType'] = 'KITCHEN'; } if($object['bath_type_id'] == 8){ $request['specific']['bathType'] = 'CORRIDOR'; } if($object['bath_type_id'] == 9){ $request['specific']['bathType'] = 'NO'; } } //Обеспечение горячей водой if($object['hot_water_id'] && $object['hot_water_id'] > 0){ if($object['hot_water_id'] == 1){ $request['specific']['hotWater'] = 'CENTRAL'; } if($object['hot_water_id'] == 2){ $request['specific']['hotWater'] = 'BOILER'; } if($object['hot_water_id'] == 3){ $request['specific']['hotWater'] = 'GAS_COLUMN'; } if($object['hot_water_id'] == 4){ $request['specific']['hotWater'] = 'ELECTRICITY'; } if($object['hot_water_id'] == 5){ $request['specific']['hotWater'] = 'WOOD_STOVE'; } if($object['hot_water_id'] == 6){ $request['specific']['hotWater'] = 'NONE'; } } //Тип парковки if($object['parking_type_id'] && $object['parking_type_id'] > 0){ if($object['parking_type_id'] == 1){ $request['specific']['parkingType'] = 'ON_GROUND'; } if($object['parking_type_id'] == 2){ $request['specific']['parkingType'] = 'UNDER_GROUND'; } } //Высота потолков if($object['ceiling_height'] && $object['ceiling_height'] > 0){ $request['specific']['ceilingHeight'] = $object['ceiling_height'] * 100; } if($object['rubbish_chute']){ $request['specific']['feature'] = []; $request['specific']['feature'][] = "RUBBISH_CHUTE"; } } else { if ($object['land_purpose_id']) { $sqlPurpose = "SELECT code FROM land_purpose WHERE id = $object[land_purpose_id]"; $resultPurpose = mysql_query($sqlPurpose); $landPurpose = mysql_fetch_row($resultPurpose); $request['specific']['purpose'] = $landPurpose[0]; } else { $request['specific']['purpose'] = "SETTLEMENTS"; } if ($object['shape_type_id']) { $sqlShapeType = "SELECT code FROM shape_type WHERE id = $object[shape_type_id]"; $resultShapeType = mysql_query($sqlShapeType); $shapeType = mysql_fetch_row($resultShapeType); $request['specific']['shape'] = $shapeType[0]; } else { $request['specific']['shape'] = "REGULAR"; } if ($object['plumbing_type_id']) { $sqlPlumbingType = "SELECT code FROM plumbing_type WHERE id = $object[plumbing_type_id]"; $resultPlumbingType = mysql_query($sqlPlumbingType); $plumbingType = mysql_fetch_row($resultPlumbingType); $request['specific']['plumbing'] = $plumbingType[0]; } else { $request['specific']['plumbing'] = "CENTRAL"; } if ($object['gas_type_id']) { $sqlGusType = "SELECT code FROM gas_type WHERE id = $object[gas_type_id]"; $resultGusType = mysql_query($sqlGusType); $gasType = mysql_fetch_row($resultGusType); $request['specific']['gas'] = $gasType[0]; } else { $request['specific']['gas'] = "YES"; } if ($object['electricity_type_id']) { $sqlElectricityType = "SELECT code FROM electricity_type WHERE id = $object[electricity_type_id]"; $resultElectricityType = mysql_query($sqlElectricityType); $electricityType = mysql_fetch_row($resultElectricityType); $request['specific']['electricity'] = $electricityType[0]; } else { $request['specific']['electricity'] = "YES"; } if ($object['sewerage_type_id']) { $sqlSewerageType = "SELECT code FROM sewerage_type WHERE id = $object[sewerage_type_id]"; $resultSewerageType = mysql_query($sqlSewerageType); $sewerageType = mysql_fetch_row($resultSewerageType); $request['specific']['sewerage'] = $sewerageType[0]; } else { $request['specific']['sewerage'] = "CENTRAL"; } if ($object['relief_type_id']) { $sqlReliefType = "SELECT code FROM relief_type WHERE id = $object[relief_type_id]"; $resultReliefType = mysql_query($sqlReliefType); $reliefType = mysql_fetch_row($resultReliefType); $request['specific']['relief'] = $reliefType[0]; } else { $request['specific']['relief'] = "FLAT"; } if ($object['land_usage_type_id']) { $sqlUsageType = "SELECT code FROM land_usage_type WHERE id = $object[land_usage_type_id]"; $resultUsageType = mysql_query($sqlUsageType); $usageType = mysql_fetch_row($resultUsageType); $request['specific']['landUsageType'] = $usageType[0]; } else { $request['specific']['landUsageType'] = "IGS"; } $request['specific']['distance'] = intval($object['land_distance']); if ($object['land_burden']) { $request['specific']['burden'] = true; } else { $request['specific']['burden'] = false; } if ($object['type'] == 7) { $request['requestType'] = "LandSellRequestType"; $request['common']['square'] = $object['land_area']; if (isset($object['deal_type'])) { if ($object['deal_type'] == 1) { $request['specific']['flatStatus'] = 'FREE'; } if ($object['deal_type'] == 2) { $request['specific']['flatStatus'] = 'ALTERNATIVE'; } } } else { //дома $request['requestType'] = "HouseSellRequestType"; $request['specific']['landSquare'] = $object['land_area']; $request['specific']['houseType'] = 'HOUSE'; $request['specific']['furniture'] = "NONE"; $request['specific']['renovation'] = "COSMETIC"; $request['specific']['material'] = "BRICK"; $request['specific']['heating'] = "LOCAL"; if (isset($object['deal_type'])) { if ($object['deal_type'] == 1) { $request['specific']['flatStatus'] = 'FREE'; } if ($object['deal_type'] == 2) { $request['specific']['flatStatus'] = 'ALTERNATIVE'; } } $request['specific']['floorsNumber'] = $object['etazh_iz']; $request['specific']['mortgage'] = (strpos($object['stoim_prim'], "ипотека") === false) ? false : true; $request['specific']['credit'] = false; if ($object['country_wall_type_id']) { if ($object['country_wall_type_id'] == 1) { $request['specific']['material'] = "BRICK"; } if ($object['country_wall_type_id'] == 2) { $request['specific']['material'] = "TIMBER"; } if ($object['country_wall_type_id'] == 3) { $request['specific']['material'] = "WOOD"; } if ($object['country_wall_type_id'] == 4) { $request['specific']['material'] = "BLOCK"; } if ($object['country_wall_type_id'] == 5) { $request['specific']['material'] = "METAL"; } if ($object['country_wall_type_id'] == 7) { $request['specific']['material'] = "PANEL"; } if ($object['country_wall_type_id'] == 8) { $request['specific']['material'] = "CONCRETE"; } } if ($object['type'] == 5) { $request['specific']['houseType'] = 'HOUSESHARE'; } if($object['type'] == 3){ if($object['house_category']){ if($object['house_category'] == 1){ $request['specific']['houseType'] = 'DACHA'; } if($object['house_category'] == 2){ $request['specific']['houseType'] = 'COTTAGE'; } if($object['house_category'] == 3){ $request['specific']['houseType'] = 'TOWNHOUSE'; } if($object['house_category'] == 4){ $request['specific']['houseType'] = 'HOUSE'; } } } } } } } else { //аренда $periodType = 'MONTH'; $period = 'LONG'; if ($object['srok'] == 1) { $periodType = 'DAY'; $period = 'SHORT'; } if ($object['srok'] == 2) { $periodType = 'MONTH'; $period = 'LONG'; } if ($object['srok'] == 3) { $periodType = 'MONTH'; $period = 'MORE_THAN_MONTH'; } $request['common']['priceType'] = $periodType; $request['common']['period'] = $period; if ($object['lease']) { $request['common']['deposit'] = $object['lease']; } else { $request['common']['deposit'] = 0; } $request['common']['prepayment'] = 0; if ($object['type'] == 4) { if(isset($object['vat_type_id']) && $object['vat_type_id'] != 0){ if($object['vat_type_id'] == 1){ $request['specific']['vatType'] = 'VAT_NOT_INCLUDED'; } else if($object['vat_type_id'] == 2){ $request['specific']['vatType'] = 'VAT_INCLUDED'; } else if($object['vat_type_id'] == 3){ $request['specific']['vatType'] = 'USN'; } } // Можно частями if($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['isPartsEnabled'] > 0){ $request['specific']['byPart'] = 'true'; $partsObj = json_decode($object['parts_area'],true); if(!empty($partsObj)){ foreach ($partsObj as $partt) { $request['specific']['parts'][] = array('square'=>$partt, 'price'=>'1'); } } } } //класс здания if($object['type_category'] == 1){ if($object['commerc_building_class_id']){ $building_class_arr = array('2'=>'APLUS', '1'=>'A', '4'=>'BPLUS', '3'=>'B', '5'=>'B', '6'=>'C'); if(isset($building_class_arr[$object['commerc_building_class_id']])){ $request['specific']['buildingClass'] = $building_class_arr[$object['commerc_building_class_id']]; } } } //Планировка if($object['type_category'] == 1){ if($object['layout_id']){ $layout_arr = array(1=>'CORRIDOR',2=>'FREE',4=>'MIXED'); if(isset($layout_arr[$object['layout_id']])){ $request['specific']['layout'] = $layout_arr[$object['layout_id']]; } } } //Тип здания if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['commerc_building_type_id']){ $building_type_arr = array(1=>'ADMINISTRATIVE',50=>'BANKING',2=>'BUSINESS_CENTER', 6=>'BUSINESS_PARK',35=>'LIVING_HOUSE',20=>'MIXED_COMPLEX',16=>'MANSION', 25=>'OFFICE_BUILDING',22=>'OFFICE_RESIDENTIAL',24=>'OFFICE_WAREHOUSE', 47=>'OFFICE_RETAIL',38=>'MALL'); if(isset($building_type_arr[$object['commerc_building_type_id']])){ $request['specific']['buildingType'] = $building_type_arr[$object['commerc_building_type_id']]; }else { $request['specific']['buildingType'] = "OFFICE_WAREHOUSE"; } }else { $request['specific']['buildingType'] = "OFFICE_WAREHOUSE"; } } //Тип парковки if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['parking_type_id'] && $object['parking_type_id'] > 0){ if($object['parking_type_id'] == 1){ $request['specific']['parkingType'] = 'ON_GROUND'; } if($object['parking_type_id'] == 2){ $request['specific']['parkingType'] = 'UNDER_GROUND'; } } } //objectCondition if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ $request['specific']['objectCondition'] = 'READY'; } //Название здания if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['building_nazv'] && ! empty($object['building_nazv'])){ $request['specific']['centerName'] = $object['building_nazv']; } } if ($object['type_category'] == 1) { //офисы $request['requestType'] = "OfficeSellRequestType"; } if($object['type_category'] == 6){ $request['specific']['structureType'] = 'DETACHED'; } //Высота потолков if ($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6) { if($object['ceiling_height'] && $object['ceiling_height'] > 0){ $request['specific']['ceilingHeight'] = $object['ceiling_height'] * 100; } } //Год постройки if ($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6) { if(!empty($object['commerc_year'])){ $request['specific']['year'] = $object['commerc_year']; } } //Вход if($object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6){ if($object['commerc_opened_id']){ $commerc_opened_arr = array(1=>'SEPARATE_FROM_YARD',2=>'SEPARATE_FROM_STREET',3=>'JOINT_FROM_YARD', 4=>'JOINT_FROM_STREET'); if(isset($commerc_opened_arr[$object['commerc_opened_id']])){ $request['specific']['entryType'] = $commerc_opened_arr[$object['commerc_opened_id']]; } } } //Мебель /*if($object['type_category'] == 1){ if($object['isFurniture']){ $request['specific']['feature'][] = 'FURNITURE'; } }*/ //опции if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ $feature_arr = [ // Допустимые значения "REPAIR_BY_OWNER", "ANY_INET_PROVIDER", "FIRST_LINE", "RESTAURANT", "FITNESS", "BANK", "ATM", "SUPERMARKET", "INTERNET", "CLOCK_ACCESS", "VIDEO_SURVEILLANCE", "GUARDS", "ACCESS_CONTROL", "ELEVATOR", "CLIENTS_ACCESS", "CONDITIONER", "HEATING", "SEPARATE_ENTRY" ]; if($object['commerc_infrastructure']){ $commerc_infrastructure = json_decode($object['commerc_infrastructure']); if(!empty($commerc_infrastructure)){ $sql = "SELECT * FROM commerc_infrastructure WHERE id in (".implode(',',$commerc_infrastructure).")"; $q = mysql_query($sql); while($r = mysql_fetch_assoc($q)){ if(in_array($r['zipal_name'],$feature_arr)){ $request['specific']['feature'][] = $r['zipal_name']; } } } } } if($object['type_category'] == 1 || $object['type_category'] == 3 || $object['type_category'] == 5 || $object['type_category'] == 6){ $request['specific']['floorNumber'] = $object['etazh']; } if($object['type_category'] == 1 || $object['type_category'] == 2 || $object['type_category'] == 3 || $object['type_category'] == 4 || $object['type_category'] == 5 || $object['type_category'] == 6){ $request['specific']['floorsNumber'] = $object['etazh_iz']; } if ($object['type_category'] == 1) { //офисы $request['requestType'] = "OfficeRentRequestType"; } else if ($object['type_category'] == 2 || $object['type_category'] == 4) { //склады $request['requestType'] = "WarehouseRentRequestType"; $request['specific']['warehouseType'] = 'WAREHOUSE'; $request['specific']['floor'] = "TILE"; } else if ($object['type_category'] == 3){ //Торговая площадь $request['requestType'] = "BusinessRentRequestType"; $request['specific']['businessUsageType'] = 'RETAIL'; } else if($object['type_category'] == 4){ //Производство $request['requestType'] = "WarehouseRentRequestType"; $request['specific']['warehouseType'] = 'CONSTRUCTION'; $request['specific']['businessUsageType'] = 'ANY'; } else if ($object['type_category'] == 5 || $object['type_category'] == 6) { $request['requestType'] = 'BusinessRentRequestType'; $request['specific']['businessUsageType'] = 'ANY'; } else if($object['type_category'] == 7){ //гараж $request['requestType'] = 'GarageRentRequestType'; //машиноместо if($object['garage_type_id'] && $object['garage_type_id'] == 1) { $request['requestType'] = 'ParkingLotRentRequestType'; $request['specific']['parkingLotType'] = 'OPEN'; } if($object['garage_type_id'] && $object['garage_type_id'] == 2) { $request['specific']['garageType'] = 'STANDALONE'; } if($object['garage_type_id'] && $object['garage_type_id'] == 3) { $request['specific']['garageType'] = 'BOX'; } $request['specific']['businessUsageType'] = 'ANY'; $request['specific']['buildingType'] = 'MIXED_COMPLEX'; } else { $request['requestType'] = "BusinessRentRequestType"; $request['specific']['buildingType'] = 'MIXED_COMPLEX'; $request['specific']['floorNumber'] = $object['etazh']; $request['specific']['floorsNumber'] = $object['etazh_iz']; $request['specific']['businessUsageType'] = 'ANY'; } if ($object['type_category'] == 6) { $request['common']['square'] = $object['building_area']; } } else { $request['specific']['roomsCount'] = $object['komnat']; $request['specific']['feature'] = []; if ($object['tv'] || $object['stirka'] || $object['holod'] || $object['mebel'] || $object['rubbish_chute']) { if ($object['tv']) { $request['specific']['feature'][] = "TV"; } if ($object['holod']) { $request['specific']['feature'][] = "FRIDGE"; } if ($object['stirka']) { $request['specific']['feature'][] = "WASHING_MACHINE"; } if ($object['type'] == 1 || $object['type'] == 2) { if ($object['mebel']) { $request['specific']['feature'][] = "FURNITURE"; } } if($object['rubbish_chute']){ $request['specific']['feature'][] = "RUBBISH_CHUTE"; } } if ($object['type'] == 1 || $object['type'] == 2) { if(!$object['no_child']){ $request['specific']['feature'][] = "WITH_CHILDREN"; } if(!$object['no_pets']){ $request['specific']['feature'][] = "WITH_PETS"; } if (strpos($object['stoim_prim'], "КУ") !== false) { $request['specific']['utilityMeters'] = true; if ($object['other_ku']) { $request['specific']['otherUtilities'] = true; $request['specific']['otherUtilitiesPayment'] = $object['other_ku_stoim']; } else { $request['specific']['otherUtilities'] = false; } } else { $request['specific']['utilityMeters'] = false; if ($object['other_ku']) { $request['specific']['otherUtilities'] = true; $request['specific']['otherUtilitiesPayment'] = $object['other_ku_stoim']; } else { $request['specific']['otherUtilities'] = false; } } //квартира или команата $request['requestType'] = "FlatRentRequestType"; if ($object['stoim_ky']) { $request['specific']['utilities'] = $object['stoim_ky']; } $request['specific']['type'] = 'FLAT'; $request['specific']['roomsCountTotal'] = $object['komnat']; $request['specific']['separatedRoomsCount'] = 0; $request['specific']['floorNumber'] = $object['etazh']; $request['specific']['floorsNumber'] = $object['etazh_iz']; $request['specific']['material'] = 'PANEL'; if ($object['rent_house_type_id']) { if ($object['rent_house_type_id'] == 15) { $request['specific']['material'] = 'MONOBRICK'; } if ($object['rent_house_type_id'] == 18) { $request['specific']['material'] = 'WOOD'; } if ($object['rent_house_type_id'] == 5) { $request['specific']['material'] = 'BLOCK'; } if ($object['rent_house_type_id'] == 6) { $request['specific']['material'] = 'BRICK'; } if ($object['rent_house_type_id'] == 17) { $request['specific']['material'] = 'MONOLITH'; } if ($object['rent_house_type_id'] == 3 || $object['rent_house_type_id'] == 12 || $object['rent_house_type_id'] == 13) { $request['specific']['material'] = 'OLD_FUND'; } } $request['specific']['apartments'] = $object['apartments'] && $object['apartments'] == 1 ? true : false; if ($object['balcony'] && $object['balcony'] > 0) { if ($object['balcony'] == 1) { $request['specific']['balcony'] = "ONE"; } if ($object['balcony'] == 2) { $request['specific']['balcony'] = "TWO"; } if ($object['balcony'] == 3) { $request['specific']['balcony'] = "THREE"; } if ($object['balcony'] > 3) { $request['specific']['balcony'] = "FOUR"; } } else { $request['specific']['balcony'] = "NONE"; } if ($object['loggias'] && $object['loggias'] > 0) { if ($object['loggias'] == 1) { $request['specific']['loggia'] = "ONE"; } if ($object['loggias'] == 2) { $request['specific']['loggia'] = "TWO"; } if ($object['loggias'] == 3) { $request['specific']['loggia'] = "THREE"; } if ($object['loggias'] > 3) { $request['specific']['loggia'] = "FOUR"; } } else { $request['specific']['loggia'] = "NONE"; } if ($object['passenger_lifts'] && $object['passenger_lifts'] > 0) { if ($object['passenger_lifts'] == 1) { $request['specific']['elevator'] = "ONE"; } if ($object['passenger_lifts'] == 2) { $request['specific']['elevator'] = "TWO"; } if ($object['passenger_lifts'] == 3) { $request['specific']['elevator'] = "THREE"; } if ($object['passenger_lifts'] > 3) { $request['specific']['elevator'] = "FOUR"; } } else { $request['specific']['elevator'] = "NONE"; } if ($object['cargo_lifts'] && $object['cargo_lifts'] > 0) { if ($object['cargo_lifts'] == 1) { $request['specific']['serviceElevator'] = "ONE"; } if ($object['cargo_lifts'] == 2) { $request['specific']['serviceElevator'] = "TWO"; } if ($object['cargo_lifts'] == 3) { $request['specific']['serviceElevator'] = "THREE"; } if ($object['cargo_lifts'] > 3) { $request['specific']['serviceElevator'] = "FOUR"; } } else { $request['specific']['serviceElevator'] = "NONE"; } if ($object['separate_wcs'] && $object['separate_wcs'] > 0) { $request['specific']['toilet'] = "SEPARATED"; } if ($object['combined_wcs'] && $object['combined_wcs'] > 0) { $request['specific']['toilet'] = "JOINED"; } if ($object['combined_wcs'] && $object['combined_wcs'] > 0 && $object['separate_wcs'] && $object['separate_wcs'] > 0) { $count = $object['combined_wcs'] + $object['separate_wcs']; if ($count === 2) { $request['specific']['toilet'] = "TWO"; } if ($count === 3) { $request['specific']['toilet'] = "THREE"; } if ($count > 3) { $request['specific']['toilet'] = "FOUR"; } } if (!empty($object['ploshad_k']) && $object['ploshad_k'] > 0) { $request['specific']['kitchenSquare'] = $object['ploshad_k']; } if (!empty($object['ploshad_komn']) && $object['ploshad_komn'] > 0) { $sq = $object['ploshad_komn']; if (strpos($object['ploshad_komn'], "+")) { $request['specific']['chambers'] = str_replace(',', '.', $object['ploshad_komn']); $sqTemp = 0; $res = explode("+", $object['ploshad_komn']); foreach ($res as $str) { $sqTemp = $sqTemp + intval(trim($str)); } $sq = $sqTemp; } $request['specific']['usefulSquare'] = str_replace(',', '.', $sq); } if ($object['type'] == 2) { $request['specific']['roomsCount'] = 1; $request['common']['square'] = str_replace(',', '.', $object['ploshad_komn']); $request['specific']['kitchenSquare'] = ''; $request['specific']['usefulSquare'] = ''; } if ($object['type'] == 1) { if (!empty($object['part'])) { $request['specific']['offerType'] = 'FLATSHARE'; if (strpos($object['part'], "/") === false) { $request['specific']['sharePercent'] = intval($object['part']); } else { $resPart = explode("/", $object['part']); $request['specific']['sharePercent'] = intval(($resPart[0]/$resPart[1]) * 100); } }else{ $request['specific']['offerType'] = 'FLAT'; } } if ($object['type'] == 2) { $request['specific']['offerType'] = 'ROOM'; } if ($object['studio_flag'] == 1) { $request['specific']['type'] = 'STUDIO'; } else { if ($object['rent_house_type_id']) { if ($object['rent_house_type_id'] == 1) { $request['specific']['type'] = 'STALINKA'; } if ($object['rent_house_type_id'] == 1) { $request['specific']['type'] = 'HRUSHEVKA'; } } } //Дополнительные поля (делала Ирина) //Вид из окон if($object['window_view'] && $object['window_view'] > 0){ if($object['window_view'] == 1){ $request['specific']['windowView'] = 'YARD'; } if($object['window_view'] == 2){ $request['specific']['windowView'] = 'STREET'; } if($object['window_view'] == 3){ $request['specific']['windowView'] = 'BOTH'; } } //Ремонт if($object['renovation'] && $object['renovation'] > 0){ if($object['renovation'] == 1){ $request['specific']['renovation'] = 'EURO'; } if($object['renovation'] == 2){ $request['specific']['renovation'] = 'COSMETIC'; } if($object['renovation'] == 5){ $request['specific']['renovation'] = 'AUTHOR'; } if($object['renovation'] == 6){ $request['specific']['renovation'] = 'NONE'; } } //Тип ванны if($object['bath_type_id'] && $object['bath_type_id'] > 0){ if($object['bath_type_id'] == 1){ $request['specific']['bathType'] = 'SHOWER'; } if($object['bath_type_id'] == 2){ $request['specific']['bathType'] = 'JOINED'; } if($object['bath_type_id'] == 3){ $request['specific']['bathType'] = 'SEPARATED'; } if($object['bath_type_id'] == 4){ $request['specific']['bathType'] = 'CROSS'; } if($object['bath_type_id'] == 5){ $request['specific']['bathType'] = 'LONGITUDINAL'; } if($object['bath_type_id'] == 6){ $request['specific']['bathType'] = 'SEDENTARY'; } if($object['bath_type_id'] == 7){ $request['specific']['bathType'] = 'KITCHEN'; } if($object['bath_type_id'] == 8){ $request['specific']['bathType'] = 'CORRIDOR'; } if($object['bath_type_id'] == 9){ $request['specific']['bathType'] = 'NO'; } } //Обеспечение горячей водой if($object['hot_water_id'] && $object['hot_water_id'] > 0){ if($object['hot_water_id'] == 1){ $request['specific']['hotWater'] = 'CENTRAL'; } if($object['hot_water_id'] == 2){ $request['specific']['hotWater'] = 'BOILER'; } if($object['hot_water_id'] == 3){ $request['specific']['hotWater'] = 'GAS_COLUMN'; } if($object['hot_water_id'] == 4){ $request['specific']['hotWater'] = 'ELECTRICITY'; } if($object['hot_water_id'] == 5){ $request['specific']['hotWater'] = 'WOOD_STOVE'; } if($object['hot_water_id'] == 6){ $request['specific']['hotWater'] = 'NONE'; } } //Тип парковки if($object['parking_type_id'] && $object['parking_type_id'] > 0){ if($object['parking_type_id'] == 1){ $request['specific']['parkingType'] = 'ON_GROUND'; } if($object['parking_type_id'] == 2){ $request['specific']['parkingType'] = 'UNDER_GROUND'; } } //Высота потолков if($object['ceiling_height'] && $object['ceiling_height'] > 0){ $request['specific']['ceilingHeight'] = $object['ceiling_height'] * 100; } } else { if ($object['land_purpose_id']) { $sqlPurpose = "SELECT code FROM land_purpose WHERE id = $object[land_purpose_id]"; $resultPurpose = mysql_query($sqlPurpose); $landPurpose = mysql_fetch_row($resultPurpose); $request['specific']['purpose'] = $landPurpose[0]; } else { $request['specific']['purpose'] = "SETTLEMENTS"; } if ($object['land_burden']) { $request['specific']['burden'] = true; } else { $request['specific']['burden'] = false; } if ($object['shape_type_id']) { $sqlShapeType = "SELECT code FROM shape_type WHERE id = $object[shape_type_id]"; $resultShapeType = mysql_query($sqlShapeType); $shapeType = mysql_fetch_row($resultShapeType); $request['specific']['shape'] = $shapeType[0]; } else { $request['specific']['shape'] = "REGULAR"; } if ($object['plumbing_type_id']) { $sqlPlumbingType = "SELECT code FROM plumbing_type WHERE id = $object[plumbing_type_id]"; $resultPlumbingType = mysql_query($sqlPlumbingType); $plumbingType = mysql_fetch_row($resultPlumbingType); $request['specific']['plumbing'] = $plumbingType[0]; } else { $request['specific']['plumbing'] = "CENTRAL"; } if ($object['gas_type_id']) { $sqlGusType = "SELECT code FROM gas_type WHERE id = $object[gas_type_id]"; $resultGusType = mysql_query($sqlGusType); $gasType = mysql_fetch_row($resultGusType); $request['specific']['gas'] = $gasType[0]; } else { $request['specific']['gas'] = "YES"; } if ($object['electricity_type_id']) { $sqlElectricityType = "SELECT code FROM electricity_type WHERE id = $object[electricity_type_id]"; $resultElectricityType = mysql_query($sqlElectricityType); $electricityType = mysql_fetch_row($resultElectricityType); $request['specific']['electricity'] = $electricityType[0]; } else { $request['specific']['electricity'] = "YES"; } if ($object['sewerage_type_id']) { $sqlSewerageType = "SELECT code FROM sewerage_type WHERE id = $object[sewerage_type_id]"; $resultSewerageType = mysql_query($sqlSewerageType); $sewerageType = mysql_fetch_row($resultSewerageType); $request['specific']['sewerage'] = $sewerageType[0]; } else { $request['specific']['sewerage'] = "CENTRAL"; } if ($object['relief_type_id']) { $sqlReliefType = "SELECT code FROM relief_type WHERE id = $object[relief_type_id]"; $resultReliefType = mysql_query($sqlReliefType); $reliefType = mysql_fetch_row($resultReliefType); $request['specific']['relief'] = $reliefType[0]; } else { $request['specific']['relief'] = "FLAT"; } if ($object['land_usage_type_id']) { $sqlUsageType = "SELECT code FROM land_usage_type WHERE id = $object[land_usage_type_id]"; $resultUsageType = mysql_query($sqlUsageType); $usageType = mysql_fetch_row($resultUsageType); $request['specific']['landUsageType'] = $usageType[0]; } else { $request['specific']['landUsageType'] = "IGS"; } //дома $request['requestType'] = "HouseRentRequestType"; $request['specific']['landSquare'] = $object['land_area']; $request['specific']['houseType'] = 'HOUSE'; $request['specific']['distance'] = intval($object['land_distance']); $request['specific']['furniture'] = "NONE"; $request['specific']['renovation'] = "COSMETIC"; $request['specific']['material'] = "BRICK"; $request['specific']['heating'] = "LOCAL"; $request['specific']['floorsNumber'] = $object['etazh_iz']; if ($object['country_wall_type_id']) { if ($object['country_wall_type_id'] == 1) { $request['specific']['material'] = "BRICK"; } if ($object['country_wall_type_id'] == 2) { $request['specific']['material'] = "TIMBER"; } if ($object['country_wall_type_id'] == 3) { $request['specific']['material'] = "WOOD"; } if ($object['country_wall_type_id'] == 4) { $request['specific']['material'] = "BLOCK"; } if ($object['country_wall_type_id'] == 5) { $request['specific']['material'] = "METAL"; } if ($object['country_wall_type_id'] == 7) { $request['specific']['material'] = "PANEL"; } if ($object['country_wall_type_id'] == 8) { $request['specific']['material'] = "CONCRETE"; } } if ($object['type'] == 5) { $request['specific']['houseType'] = 'HOUSESHARE'; if ($object['stoim_ky']) { $request['specific']['utilities'] = $object['stoim_ky']; } } if($object['type'] == 3){ if ($object['stoim_ky']) { $request['specific']['utilities'] = $object['stoim_ky']; } if($object['house_category']){ if($object['house_category'] == 1){ $request['specific']['houseType'] = 'DACHA'; } if($object['house_category'] == 2){ $request['specific']['houseType'] = 'COTTAGE'; } if($object['house_category'] == 3){ $request['specific']['houseType'] = 'TOWNHOUSE'; } if($object['house_category'] == 4){ $request['specific']['houseType'] = 'HOUSE'; } } } } } } return $request; } return null; } }