bookingactivities / booking-activities

Wordpress plugin booking system
GNU General Public License v3.0
29 stars 10 forks source link

The desired event haven't the same activity as the booked event. #145

Closed rayedgar closed 2 years ago

rayedgar commented 2 years ago

somehow i am not able to reschedule anymore. and get this error message after selecting and confiming the changed activity The desired event haven't the same activity as the booked event.

it always worked and have tested it many times. The calendar is now live on the site and we need to be able to change a booking.

I hope you can help me with this please

Screenshot 2022-04-14 at 15 12 40

.

yoancutillas commented 2 years ago

Hello Ray, does the booked event has the same activity ID as the desired event? Are you using a custom code to allow to reschedule bookings to a different activity?

rayedgar commented 2 years ago

Hi,

Its a different activity (made in calender editor from the same activity but with a different name)

i used your code to allow various activities to assign:

// Allow to reschedule to any activities function my_theme_allow_to_reschedule_to_any_activity( $return_array, $booking, $event_id, $event_start, $event_end, $context ) { $admin_only = true; // SET IT TO TRUE TO ALLOW ADMINISTRATORS ONLY (NOT CUSTOMERS) $bypass_template_managers_check = apply_filters( 'bookacti_bypass_template_managers_check', false ); if( ! empty( $return_array[ 'error' ] ) && $return_array[ 'error' ] === 'reschedule_to_different_activity' && ( ! $admin_only || ( ! empty( $_POST[ 'is_admin' ] ) && $bypass_template_managers_check ) ) ) { $return_array[ 'status' ] = 'success'; unset( $return_array[ 'error' ] ); unset( $return_array[ 'message' ] ); } return $return_array; }

!! but also by removing this code the error remains.

yoancutillas commented 2 years ago

Bookings cannot be rescheduled to a different activity. The only way to achieve it is to make a custom code.

I cannot provide support for custom codes, any custom code given for free here is in the hope to help only, then, you need to be able to adapt it to your needs and maintain it by your own means.

I confirm that the code given on this page is working properly on my side: https://github.com/bookingactivities/booking-activities/issues/83

rayedgar commented 2 years ago

Without the custom code i am not able to see any other activity except the one that i want to reschedule

rayedgar commented 2 years ago

I see , damn i am screwed! since there are already bookings on them. It took me so long to convince my boss to use this plugin because the rescheduling would be easier. oh dear! but it worked to reschdule before?

As you can see on the screenshot. i made various activities they, i was able with the custom code to reasign other actvities. I see it is not the way i should have setup the calender.

Screenshot 2022-04-14 at 15 56 49

But your custom code would be able to overide this? it did before, many times ? i am really confused. I would really appreciate if you can advise in how to fix this please.

this the code that you gave me

// Allow to reschedule to any activities function my_theme_allow_to_reschedule_to_any_activity( $return_array, $booking, $event_id, $event_start, $event_end, $context ) { $admin_only = true; // SET IT TO TRUE TO ALLOW ADMINISTRATORS ONLY (NOT CUSTOMERS) $bypass_template_managers_check = apply_filters( 'bookacti_bypass_template_managers_check', false ); if( ! empty( $return_array[ 'error' ] ) && $return_array[ 'error' ] === 'reschedule_to_different_activity' && ( ! $admin_only || ( ! empty( $_POST[ 'is_admin' ] ) && $bypass_template_managers_check ) ) ) { $return_array[ 'status' ] = 'success'; unset( $return_array[ 'error' ] ); unset( $return_array[ 'message' ] ); } return $return_array; } //add_filter( 'bookacti_booking_can_be_rescheduled_to', 'my_theme_allow_to_reschedule_to_any_activity', 100, 6 );

// Allow to see any activities in reschedule calendars function my_theme_display_all_events_on_reschedule_calendar( $atts, $booking, $init_atts, $mixed_data ) { $admin_only = true; // SET IT TO TRUE TO ALLOW ADMINISTRATORS ONLY (NOT CUSTOMERS) $bypass_template_managers_check = apply_filters( 'bookacti_bypass_template_managers_check', false ); if( ! $admin_only || $bypass_template_managers_check ) { // $atts[ 'calendars' ] = array(); // REMOVE THIS LINE IF YOU DON'T WANT TO DISPLAY EVENTS FROM OTHER CALENDARS $atts[ 'activities' ] = array(); } return $atts; } add_filter( 'bookacti_reschedule_booking_system_attributes', 'my_theme_display_all_events_on_reschedule_calendar', 100, 4 );

yoancutillas commented 2 years ago

Ah ah ^^ The problem here is that your code is commented (//add_filter... instead of add_filter...). If you have a doubt, just copy / paste the code on that page https://github.com/bookingactivities/booking-activities/issues/83 and replace yours. However, you should not use a custom code that you cannot maintain, it will break for sure sooner or later.

rayedgar commented 2 years ago

OH YES! how dumb. i deactivated it. You are a star Yoancutillas!! Thank you for your great and swift support, life saver.

It seems to work now again. I agree custom code is not the way to go. and will clone the next time the activities.