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 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 #3
0
 public function updateCustomRecord($parameters)
 {
     // update product
     Product::where('id_111', $parameters['id'])->update(['field_group_id_111' => $this->request->has('customFieldGroup') ? $this->request->input('customFieldGroup') : null, 'type_id_111' => $this->request->input('productType'), 'parent_product_id_111' => $this->request->has('parentProduct') ? $this->request->input('parentProduct') : null, 'weight_111' => $this->request->has('weight') ? $this->request->input('weight') : 0, 'active_111' => $this->request->has('active'), 'sorting_111' => $this->request->has('sorting') ? $this->request->input('sorting') : null, 'price_type_id_111' => $this->request->input('priceType'), 'subtotal_111' => $this->getSubtotalOverTotal(), 'product_class_tax_id_111' => $this->request->has('productClassTax') ? $this->request->input('productClassTax') : null]);
     ProductLang::where('id_112', $parameters['id'])->where('lang_id_112', $this->request->input('lang'))->update(['name_112' => $this->request->input('name'), 'slug_112' => $this->request->input('slug'), 'description_112' => $this->request->input('description')]);
     $product = Product::where('id_111', $parameters['id'])->first();
     // categories
     if (is_array($this->request->input('categories'))) {
         $product->getCategories()->sync($this->request->input('categories'));
     } else {
         $product->getCategories()->detach();
     }
     // set custom fields
     if (!empty($this->request->input('customFieldGroup'))) {
         CustomFieldResultLibrary::deleteCustomFieldResults('market-product', $parameters['id'], $this->request->input('lang'));
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $this->request->input('customFieldGroup'), 'market-product', $parameters['id'], $this->request->input('lang'));
     }
 }
Example #4
0
 public function updateCustomRecord($parameters)
 {
     Article::where('id_355', $parameters['id'])->where('lang_id_355', $this->request->input('lang'))->update(['section_id_355' => $this->request->input('section'), 'family_id_355' => $this->request->has('family') ? $this->request->input('family') : null, 'status_id_355' => $this->request->input('status'), 'publish_355' => $this->request->has('publish') ? \DateTime::createFromFormat(config('pulsar.datePattern') . ' H:i', $this->request->input('publish'))->getTimestamp() : (int) date('U'), 'publish_text_355' => $this->request->has('publish') ? $this->request->input('publish') : date(config('pulsar.datePattern') . ' H:i'), 'date_355' => \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('date'))->getTimestamp(), 'title_355' => $this->request->input('title'), 'slug_355' => $this->request->has('slug') ? $this->request->input('slug') : null, 'link_355' => $this->request->has('link') ? $this->request->input('link') : null, 'blank_355' => $this->request->has('blank'), 'sorting_355' => $this->request->has('sorting') ? $this->request->input('sorting') : null, 'article_355' => $this->request->input('article'), 'data_355' => null]);
     $article = Article::builder()->where('id_355', $parameters['id'])->where('lang_id_355', $parameters['lang'])->first();
     // tags
     $tags = json_decode($this->request->input('jsonTags'));
     if (is_array($tags) && count($tags) > 0) {
         $idTags = [];
         foreach ($tags as $tag) {
             if ($tag->value === 'null') {
                 $tagObj = Tag::create(['lang_id_358' => $this->request->input('lang'), 'name_358' => $tag->label]);
                 $idTags[] = $tagObj->id_358;
             } else {
                 $idTags[] = $tag->value;
             }
         }
         $article->tags()->sync($idTags);
     }
     // categories
     if (is_array($this->request->input('categories'))) {
         $article->getCategories()->sync($this->request->input('categories'));
     } else {
         $article->getCategories()->detach();
     }
     // set custom fields
     if ($article->field_group_id_351 !== null) {
         CustomFieldResultLibrary::deleteCustomFieldResults('cms-article-family', $article->id_355, $this->request->input('lang'));
         CustomFieldResultLibrary::storeCustomFieldResults($this->request, $article->field_group_id_351, 'cms-article-family', $article->id_355, $this->request->input('lang'));
     }
 }