From: Chuck Scott Date: Wed, 22 Nov 2017 17:47:39 +0000 (-0500) Subject: Now not automatically adding dates to registrations. Have button for this. X-Git-Tag: v1.0.0^2~247 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=c0af5ecad632a116159582015072bfe54eb05905;p=WP-Plugins%2Fglm-member-db-registrations.git Now not automatically adding dates to registrations. Have button for this. Reworked top of registration dashboard page to get buttons in proper location and to be better responsive. Removed defaults for reg_hold_minutes, cart_hold_days, and reg_hours_before from dataRegEvent.php Added default for reg_hours_before to events.php Added $deleteTimes option to checkEventTimes. Must be set for it to remove times. - dataRegEvent.php Added dialog box and button to allow user to request any new times in event are added to registrations in eventDashboard.html. No longer automatically adding times to registrations when adding registrations for an event in event.php. Added messages to events.php to display when there are not times, when times are added, and when a request to add times or delete registrations for an event fail. Replaced old "reason" code with "messages" code in eventEditLevels.html and eventEdit.html --- diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 458ff47..82d86ac 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -222,7 +222,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'field' => 'reg_hold_minutes', 'type' => 'integer', 'required' => true, - 'default' => 60, + // 'default' => 60, See models/admin/registrations/events.php - Search for "Add event to registrations" 'use' => 'a' ), @@ -231,7 +231,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'field' => 'cart_hold_days', 'type' => 'integer', 'required' => true, - 'default' => 10, + // 'default' => 10, See models/admin/registrations/events.php - Search for "Add event to registrations" 'use' => 'a' ), @@ -240,7 +240,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'field' => 'reg_hours_before', 'type' => 'integer', 'required' => true, - 'default' => 24, + // 'default' => 24, See models/admin/registrations/events.php - Search for "Add event to registrations" 'use' => 'a' ), @@ -249,7 +249,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'field' => 'registration_account_options', 'type' => 'bitmap', 'bitmap' => $this->config['registration_account_option'], - 'default' => 0, // none selected + 'default' => 14, // Guest, Saved, Members 'use' => 'a' ), @@ -258,7 +258,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'field' => 'payment_methods', 'type' => 'bitmap', 'bitmap' => $this->config['payment_method'], - 'default' => 0, // none selected + 'default' => 68, // No Charge 'use' => 'a' ), @@ -267,7 +267,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'field' => 'restricted_payment_methods', 'type' => 'bitmap', 'bitmap' => $this->config['payment_method'], - 'default' => 0, // none selected + 'default' => 26, // none selected 'use' => 'a' ), @@ -967,10 +967,12 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract * The getEventConfig() method must have been called first or a reg_event ID must be passed so that we have all of the needed event data. * * @param integer $regEventId Optional ID of a reg event record. If provided, load all registration data using getEventConfig() above + * This is not required if the event data has already been loaded using getEVentConfig() by the calling code + * @param boolean $deleteRemovedTimes Optional flag to ask that times removed from the event are removed from registration * * @return array updated reg_times data or false if not regEventData has been provided or no recurrence data */ - public function checkEventTimes($regEventId = false) + public function checkEventTimes($regEventId = false, $deleteTimes = false) { $needTimesReloaded = false; @@ -1100,8 +1102,8 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract } - // If there's anything in the delete list, purge them now and say we need a reload - if ($deleteList != '') { + // If requested and there's anything in the delete list, purge them now and say we need a reload + if ($deleteTimes && $deleteList != '') { $this->wpdb->query(" DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time WHERE id IN ($deleteList) diff --git a/models/admin/registrations/events.php b/models/admin/registrations/events.php index e06301c..16057c5 100644 --- a/models/admin/registrations/events.php +++ b/models/admin/registrations/events.php @@ -231,6 +231,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent attendee_max_per_reg, reg_hold_minutes, cart_hold_days, + reg_hours_before, registration_account_options, payment_methods, restricted_payment_methods, @@ -249,6 +250,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent 0, 60, 10, + 24, 0, 0, 0, @@ -337,7 +339,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent } } else { - + $messages[] = 'You did not properly confirm your request by entering "DELETE". No dates and times were added.'; } } @@ -360,7 +362,26 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent case 'eventDashboard': $regEvent = $this->getEventConfig($regEventID, true, false, true); - $regEvent = $this->checkEventTimes(); + + // Check if there's a request to add event times from the event + if (isset($_REQUEST) && isset($_REQUEST['getTimesFromEvent']) && $_REQUEST['getTimesFromEvent'] == 'yes') { + + // Check that the user entered the correct confirmation string + if (isset($_REQUEST['addConfirmation']) && $_REQUEST['addConfirmation'] == 'ADD') { + + // Check for new event times + $regEvent = $this->checkEventTimes(); + + // Get the event data again along with any new times + $regEvent = $this->getEventConfig($regEventID, true, false, true); + + $messages[] = 'Per your request, any dates and times specified in the event schedules that were not already added here, have now been added.'; + + }else{ + $messages[] = 'You did not properly confirm your request by entering "ADD". No dates and times were added.'; + } + + } if ($regEvent !== false) { @@ -369,12 +390,19 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent $regEventLastTime = $regEvent['lastTime']; // if there's a user notice, add it to messages - if ($regEvent['message']) { + if (isset($regEvent['message']) && $regEvent['message']) { $messages[] = $regEvent['message']; } } + // Check if we have any times for this reg_event + if (is_array($regEvent['reg_time']) || count($regEVent['reg_time']) > 0) { + $haveRegEventTimes = true; + } else { + $messages[] = 'There are no dates for registrations for this event.'; + } + $view = 'eventDashboard'; break; diff --git a/views/admin/registrations/eventDashboard.html b/views/admin/registrations/eventDashboard.html index 2dc700d..7c2f14f 100644 --- a/views/admin/registrations/eventDashboard.html +++ b/views/admin/registrations/eventDashboard.html @@ -2,25 +2,22 @@

{$regEvent.event_name}

- {if $haveMessages} -
- Please Note: - -
- {/if} - - -
- -
- {if $haveRegEvent} - -
-
+{if $haveMessages} +
+ Please Note: +
    + {foreach $messages as $m} +
  • {$m}
  • + {/foreach} +
+
+{/if} + +
+{if $haveRegEvent} +
+
+

Event Code:

@@ -46,8 +43,10 @@
-
- {if $regEvent.total > 0} +
+
+
+ {if $haveRegEvent}

Maximum Attendees:

@@ -56,7 +55,7 @@ {$regEvent.total}
- {/if} + {/if}

Registered:

@@ -65,7 +64,7 @@ {$regEvent.registered}
- {if $regEvent.total > 0} + {if $haveRegEvent}

Cart Hold:

@@ -90,19 +89,60 @@ {$regEvent.totalAvail}
- {/if} + {/if}
- - {if apply_filters('glm_members_menu_members', true)} -
+
+ {if apply_filters('glm_members_menu_members', true)} + +
+
Edit Registration Event {$r_link = apply_filters('glm_members_add_link_to_registrations_event_list_entry', $regEvent.event)} - {if is_array($r_link)} - Edit {$r_link.title} - {/if} - +
+
+
+
+
Add Registration Dates/Times from Event
+
+

+ This action looks for dates and time specified for the associated event in the event schedules. If there are any dates and times that are + not already included for registrations, this action will add them using the defaults set for this event. You may set those + defaults by clicking the "Edit Registration Event" button on this page. This action will not modify or remove date and times already + added to registrations for this event. +

+

+ The primary purpose of this action is to assist with initial setup of registrations for an event when there are a number of + dates and times specified in the schedules for the event and you wish to make most or all of those dates and times available for registration. +

+

+ NOTE: If the event covers a large number of dates, this action may add a large number of dates + and times to registrations for this event. To deactivate or remove those dates you will be required to click on each date/time + and either deactivate it or demove it. +

+
+ + + + + +
+

Event: {$regEvent.event_name}

+

To add dates and times from the event schedules
enter exactly "ADD" in the field below.

+ +

Then click this button

+ +
+
+
+ + + +
+
+
+
Delete Registration Event
@@ -148,18 +188,29 @@
- + + + +
+
+
+
+ {if is_array($r_link)} + {$r_link.title} + {/if}
+
- {/if}
- {else} -

Did not find selected event.

- {/if} + {/if}
+{else} +

Did not find selected event.

+{/if}
+
{if $haveRegEvent}

Dates and Availability

@@ -241,6 +292,7 @@ {if $regEvent} events: [ {$sep = ''} + {if $haveRegEventTimes} {foreach $regEvent.reg_time as $t} {$sep}{ {if $t.attendee_max == 0} @@ -261,6 +313,7 @@ } {$sep = ','} {/foreach} + {/if} ], eventMouseover : function(event, jsEvent, view) { $('.fc-event').css( 'cursor', 'pointer' ); @@ -347,6 +400,18 @@ } + // Add registration dates from event dialog box + $("#regEventAddTimesDialog").dialog({ + autoOpen: false, + width: 600, + resizable: true + }); + + // Add registration dates from event button + $('#regEventAddTimesButton').on('click', function() { + $('#regEventAddTimesDialog').dialog('open'); + }); + // Delete Dialog Box $("#regEventDeleteDialog").dialog({ autoOpen: false, diff --git a/views/admin/registrations/eventEdit.html b/views/admin/registrations/eventEdit.html index 9c6c62c..1f7cdc2 100644 --- a/views/admin/registrations/eventEdit.html +++ b/views/admin/registrations/eventEdit.html @@ -10,9 +10,16 @@
-{if $reason} -

{$reason}

-{else} +{if $haveMessages} +
+ Please Note: +
    + {foreach $messages as $m} +
  • {$m}
  • + {/foreach} +
+
+{/if}
-{/if} - - - - - - -{/if} - +
{include file='admin/footer.html'}