Example #1
0
 public function updateCustomRecord($parameters)
 {
     $hotel = ['field_group_id_170' => $this->request->has('customFieldGroup') ? $this->request->input('customFieldGroup') : null, 'name_170' => $this->request->input('name'), 'slug_170' => $this->request->input('slug'), 'web_170' => $this->request->input('web'), 'web_url_170' => $this->request->input('webUrl'), 'contact_170' => $this->request->input('contact'), 'email_170' => $this->request->input('email'), 'booking_email_170' => $this->request->input('bookingEmail'), 'phone_170' => $this->request->input('phone'), 'mobile_170' => $this->request->input('mobile'), 'fax_170' => $this->request->input('fax'), 'environment_170' => $this->request->has('environment') ? $this->request->input('environment') : null, 'decoration_170' => $this->request->has('decoration') ? $this->request->input('decoration') : null, 'relationship_170' => $this->request->has('relationship') ? $this->request->input('relationship') : null, 'n_rooms_170' => $this->request->input('nRooms'), 'n_places_170' => $this->request->input('nPlaces'), 'n_events_rooms_170' => $this->request->input('nEventsRooms'), 'n_events_rooms_places_170' => $this->request->input('nEventsRoomsPlaces'), 'user_170' => $this->request->input('user'), 'active_170' => $this->request->has('active'), 'country_id_170' => $this->request->input('country'), 'territorial_area_1_id_170' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_170' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_170' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_170' => $this->request->has('cp') ? $this->request->input('cp') : null, 'locality_170' => $this->request->input('locality'), 'address_170' => $this->request->input('address'), 'latitude_170' => str_replace(',', '', $this->request->input('latitude')), 'longitude_170' => str_replace(',', '', $this->request->input('longitude')), 'booking_url_170' => $this->request->input('bookingUrl'), 'country_chef_restaurant_170' => $this->request->has('countryChefRestaurant'), 'country_chef_url_170' => $this->request->input('countryChefUrl'), 'restaurant_name_170' => $this->request->input('restaurantName'), 'restaurant_type_id_170' => $this->request->has('restaurantType') ? $this->request->input('restaurantType') : null, 'restaurant_terrace_170' => $this->request->has('restaurantTerrace'), 'billing_name_170' => $this->request->input('billingName'), 'billing_surname_170' => $this->request->input('billingSurname'), 'billing_company_name_170' => $this->request->input('billingCompanyName'), 'billing_tin_170' => $this->request->input('billingTin'), 'billing_country_id_170' => $this->request->has('billingCountry') ? $this->request->input('billingCountry') : null, 'billing_territorial_area_1_id_170' => $this->request->has('billingTerritorialArea1') ? $this->request->input('billingTerritorialArea1') : null, 'billing_territorial_area_2_id_170' => $this->request->has('billingTerritorialArea2') ? $this->request->input('billingTerritorialArea2') : null, 'billing_territorial_area_3_id_170' => $this->request->has('billingTerritorialArea3') ? $this->request->input('billingTerritorialArea3') : null, 'billing_cp_170' => $this->request->has('billingCp') ? $this->request->input('billingCp') : null, 'billing_locality_170' => $this->request->input('billingLocality'), 'billing_address_170' => $this->request->input('billingAddress'), 'billing_phone_170' => $this->request->input('billingPhone'), 'billing_email_170' => $this->request->input('billingEmail'), 'billing_iban_country_170' => $this->request->input('billingIbanCountry'), 'billing_iban_check_digits_170' => $this->request->input('billingIbanCheckDigits'), 'billing_iban_basic_bank_account_number_170' => $this->request->input('billingIbanBasicBankAccountNumber'), 'billing_bic_170' => $this->request->input('billingBic')];
     if ($parameters['specialRules']['emailRule']) {
         $hotel['email_170'] = $this->request->input('email');
     }
     if ($parameters['specialRules']['userRule']) {
         $hotel['user_170'] = $this->request->input('user');
     }
     if (!$parameters['specialRules']['passRule']) {
         $hotel['password_170'] = Hash::make($this->request->input('password'));
     }
     Hotel::where('id_170', $parameters['id'])->update($hotel);
     $hotel = Hotel::find($parameters['id']);
     // publications
     if (is_array($this->request->input('published'))) {
         $hotel->getPublications()->sync($this->request->input('published'));
     } else {
         $hotel->getPublications()->detach();
     }
     // services
     if (is_array($this->request->input('services'))) {
         $hotel->getServices()->sync($this->request->input('services'));
     } else {
         $hotel->getServices()->detach();
     }
     HotelLang::where('id_171', $parameters['id'])->where('lang_id_171', $this->request->input('lang'))->update(['cuisine_171' => $this->request->has('cuisine') ? $this->request->input('cuisine') : null, 'special_dish_171' => $this->request->has('specialDish') ? $this->request->input('specialDish') : null, 'indications_171' => $this->request->has('indications') ? $this->request->input('indications') : null, 'interest_points_171' => $this->request->has('interestPoints') ? $this->request->input('interestPoints') : null, 'environment_description_171' => $this->request->has('environmentDescription') ? $this->request->input('environmentDescription') : null, 'construction_171' => $this->request->has('construction') ? $this->request->input('construction') : null, 'activities_171' => $this->request->has('activities') ? $this->request->input('activities') : null, 'description_title_171' => $this->request->has('descriptionTitle') ? $this->request->input('descriptionTitle') : null, 'description_171' => $this->request->has('description') ? $this->request->input('description') : null]);
     // set hotel products
     HotelProduct::where('hotel_id_177', $parameters['id'])->where('lang_id_177', $this->request->input('lang'))->delete();
     $hotelProducts = [];
     $products = json_decode($this->request->input('products'));
     foreach ($products as $product) {
         $hotelProducts[] = ['hotel_id_177' => $parameters['id'], 'product_id_177' => $product, 'lang_id_177' => $this->request->input('lang'), 'description_177' => $this->request->input('d' . $product)];
     }
     if (count($hotelProducts) > 0) {
         HotelProduct::insert($hotelProducts);
     }
     // set custom fields
     if (!empty($this->request->input('customFieldGroup'))) {
         CustomFieldResultLibrary::deleteCustomFieldResults('hotels-hotel', $parameters['id'], $this->request->input('lang'));
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $this->request->input('customFieldGroup'), 'hotels-hotel', $parameters['id'], $this->request->input('lang'));
     } else {
         CustomFieldResultLibrary::deleteCustomFieldResults('hotels-hotel', $parameters['id'], $this->request->input('lang'));
     }
 }
Example #2
0
 public function deleteCustomRecordsSelect($ids)
 {
     foreach ($ids as $id) {
         AttachmentLibrary::deleteAttachment($this->package, $this->request->route()->getAction()['resource'], $id);
         CustomFieldResultLibrary::deleteCustomFieldResults('market-product', $id);
     }
 }
 public function apiGetCustomFields()
 {
     $html = CustomFieldResultLibrary::getCustomFields(['lang' => $this->request->input('lang'), 'customFieldGroup' => $this->request->input('customFieldGroup'), 'resource' => $this->request->input('resource'), 'action' => $this->request->input('action'), 'object' => $this->request->input('object')]);
     return response()->json(['status' => 'success', 'html' => $html]);
 }
Example #4
0
 public function updateCustomRecord($parameters)
 {
     $spa = ['field_group_id_180' => $this->request->has('customFieldGroup') ? $this->request->input('customFieldGroup') : null, 'hotel_id_180' => $this->request->has('hotel') ? $this->request->input('hotel') : null, 'name_180' => $this->request->input('name'), 'slug_180' => $this->request->input('slug'), 'web_180' => $this->request->input('web'), 'web_url_180' => $this->request->input('webUrl'), 'contact_180' => $this->request->input('contact'), 'email_180' => $this->request->input('email'), 'phone_180' => $this->request->input('phone'), 'mobile_180' => $this->request->input('mobile'), 'fax_180' => $this->request->input('fax'), 'active_180' => $this->request->has('active'), 'country_id_180' => $this->request->input('country'), 'territorial_area_1_id_180' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_180' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_180' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_180' => $this->request->input('cp'), 'locality_180' => $this->request->input('locality'), 'address_180' => $this->request->input('address'), 'latitude_180' => str_replace(',', '', $this->request->input('latitude')), 'longitude_180' => str_replace(',', '', $this->request->input('longitude'))];
     if ($parameters['specialRules']['emailRule']) {
         $hotel['email_180'] = $this->request->input('email');
     }
     Spa::where('id_180', $parameters['id'])->update($spa);
     // por si hiciera falta a futuro, sinconizar el spa con otros elementos,
     // harĂ­a falta el objedo actualizado
     //$spa = Spa::find($parameters['id']);
     SpaLang::where('id_181', $parameters['id'])->where('lang_id_181', $this->request->input('lang'))->update(['description_title_181' => $this->request->has('descriptionTitle') ? $this->request->input('descriptionTitle') : null, 'description_181' => $this->request->has('description') ? $this->request->input('description') : null, 'treatments_181' => $this->request->has('treatments') ? $this->request->input('treatments') : null]);
     // set custom fields
     if (!empty($this->request->input('customFieldGroup'))) {
         CustomFieldResultLibrary::deleteCustomFieldResults('spas-spa', $parameters['id'], $this->request->input('lang'));
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $this->request->input('customFieldGroup'), 'spas-spa', $parameters['id'], $this->request->input('lang'));
     }
 }
Example #5
0
 public function deleteCustomRecordsSelect($ids)
 {
     $articles = Article::getRecordsById($ids);
     foreach ($articles as $article) {
         $article->getCategories()->detach();
         AttachmentLibrary::deleteAttachment($this->package, 'cms-article', $article->id_355);
         CustomFieldResultLibrary::deleteCustomFieldResults('cms-article-family', $article->id_355);
     }
 }