From c3d1a632f4e4e9206c09bb13fd749eaf342340cb Mon Sep 17 00:00:00 2001 From: Franky Van Liedekerke Date: Sat, 18 Jan 2025 17:28:19 +0100 Subject: [PATCH] hide some settings if booking approval is not required --- eme-events.php | 38 ++++++++++++++++++-------------------- js/eme_admin_events.js | 17 +++++++---------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/eme-events.php b/eme-events.php index 57160215..5be76cb0 100644 --- a/eme-events.php +++ b/eme-events.php @@ -599,9 +599,9 @@ function eme_events_page() { } // validation successful - if ( isset( $_POST['location-select-id'] ) && $_POST['location-select-id'] != '' ) { + if ( !empty( $_POST['location-select-id'] ) ) { $event['location_id'] = intval( $_POST['location-select-id'] ); - } elseif ( isset( $_POST['location_id'] ) && intval( $_POST['location_id'] ) > 0 ) { + } elseif ( !empty( $_POST['location_id'] ) ) { $event['location_id'] = intval( $_POST['location_id'] ); } elseif ( empty( $location['location_name'] ) && empty( $location['location_address1'] ) && empty( $location['location_city'] ) ) { $event['location_id'] = 0; @@ -706,7 +706,7 @@ function eme_events_page() { } elseif ( current_user_can( get_option( 'eme_cap_edit_events' ) ) || ( current_user_can( get_option( 'eme_cap_author_event' ) ) && $orig_event['event_author'] == $current_userid ) ) { - if ( isset( $_POST['repeated_event'] ) && $_POST['repeated_event'] ) { + if ( ! empty( $_POST['repeated_event'] ) ) { // we go from single event to recurrence: create the recurrence and delete the single event $recurrence_id = eme_db_insert_recurrence( $recurrence, $event ); if ( ! $recurrence_id ) { @@ -1309,7 +1309,6 @@ function eme_events_page_content() { return $page_body; } - //if (isset ( $_REQUEST['event_id'] ) && $_REQUEST['event_id'] != '') { if ( eme_is_single_event_page() ) { // single event page $event_id = eme_sanitize_request( get_query_var( 'event_id' ) ); @@ -6386,6 +6385,7 @@ function eme_event_form( $event, $info, $edit_recurrence = 0 ) {

'; echo '' . esc_html__( 'Booking Made or Approved Email', 'events-made-easy' ) . '
'; eme_meta_box_div_event_registration_approved_email( $event, $templates_array, $pdf_templates_array ); @@ -6394,7 +6394,7 @@ function eme_event_form( $event, $info, $edit_recurrence = 0 ) { echo '' . esc_html__( 'Booking Awaiting User Confirmation Email', 'events-made-easy' ) . '
'; eme_meta_box_div_event_registration_userpending_email( $event, $templates_array ); echo '
'; - echo '
'; + echo '
'; echo '' . esc_html__( 'Booking Pending Email', 'events-made-easy' ) . '
'; eme_meta_box_div_event_registration_pending_email( $event, $templates_array, $pdf_templates_array ); echo '
'; @@ -7955,8 +7955,8 @@ function eme_meta_box_div_event_registration_reminder_email( $event, $templates_
>
-

+

@@ -8742,27 +8742,25 @@ function eme_meta_box_div_event_rsvp( $event, $pdf_templates_array ) { ?>

+

+ +
+

>
- warning" . __( 'RSVP notifications are not activated for pending bookings, so these mails will not be sent. Go in the Email settings to activate this if wanted.', 'events-made-easy' ) . ''; - } - ?> -

-

- -
+ warning" . __( 'RSVP notifications are not activated for pending bookings, so these mails will not be sent. Go in the Email settings to activate this if wanted.', 'events-made-easy' ) . ''; + } + ?>

-

+

-

-

+
' . __( 'In case online payments are possible, pending bookings younger than 5 minutes will count as occupied too, to be able to allow people to finish online payments.', 'events-made-easy' ) ); ?> -

-

+

diff --git a/js/eme_admin_events.js b/js/eme_admin_events.js index df1107a7..d13e3119 100644 --- a/js/eme_admin_events.js +++ b/js/eme_admin_events.js @@ -108,15 +108,14 @@ jQuery(document).ready( function($) { function updateShowHideRsvpAutoApprove() { if ($('input#approval_required-checkbox').prop('checked')) { $('span#span_approval_required_mail_warning').fadeIn(); - $('p#p_auto_approve').fadeIn(); - $('p#p_auto_approve').fadeIn(); - $('p#p_ignore_pending').fadeIn(); - $('p#p_rsvp_pending_reminder_days').fadeIn(); + $('#p_approve_settings').fadeIn(); + $('#details_pending').show(); + $('#div_event_registration_pending_reminder_email').show(); } else { $('span#span_approval_required_mail_warning').hide(); - $('p#p_auto_approve').fadeOut(); - $('p#p_ignore_pending').fadeOut(); - $('p#p_rsvp_pending_reminder_days').fadeOut(); + $('#p_approve_settings').fadeOut(); + $('#details_pending').hide(); + $('#div_event_registration_pending_reminder_email').hide(); } } @@ -464,9 +463,7 @@ jQuery(document).ready( function($) { function validateEventForm() { // users cannot submit the event form unless some fields are filled - let recurring = $('input[name=repeated_event]:checked').val(); - - if (recurring && $('input#localized-rec-start-date').val() == $('input#localized-rec-end-date').val()) { + if ($('input#event-recurrence').prop('checked') && $('input#localized-rec-start-date').val() == $('input#localized-rec-end-date').val()) { alert (emeevents.translate_startenddate_identical); $('input#localized-rec-end-date').css('border','2px solid red'); return false;