@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | $event_one_link = $event_two_link = $event_three_link = ''; |
19 | 19 | |
20 | 20 | $I->wantTo( |
21 | - 'Test that when registrations for multiple events are completed, and those events share the same custom' |
|
22 | - . 'template, that that custom template will be used.' |
|
21 | + 'Test that when registrations for multiple events are completed, and those events share the same custom' |
|
22 | + . 'template, that that custom template will be used.' |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | //need the MER plugin active for this test (we'll deactivate it after). |
26 | 26 | $I->ensurePluginActive( |
27 | - 'event-espresso-mer-multi-event-registration', |
|
28 | - 'activated' |
|
27 | + 'event-espresso-mer-multi-event-registration', |
|
28 | + 'activated' |
|
29 | 29 | ); |
30 | 30 | |
31 | 31 | $I->loginAsAdmin(); |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | |
81 | 81 | |
82 | 82 | $test_registration_details = array( |
83 | - 'fname' => 'CTGuy', |
|
84 | - 'lname' => 'Dude', |
|
85 | - 'email' => '[email protected]' |
|
83 | + 'fname' => 'CTGuy', |
|
84 | + 'lname' => 'Dude', |
|
85 | + 'email' => '[email protected]' |
|
86 | 86 | ); |
87 | 87 | |
88 | 88 | $I->amGoingTo('Register for Event One and Event Two and verify Custom Template A was used.'); |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | $I->loginAsAdmin(); |
109 | 109 | $I->amOnMessagesActivityListTablePage(); |
110 | 110 | $I->viewMessageInMessagesListTableFor( |
111 | - 'Registration Approved', |
|
112 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
113 | - 'Email', |
|
114 | - 'Registrant' |
|
111 | + 'Registration Approved', |
|
112 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
113 | + 'Email', |
|
114 | + 'Registrant' |
|
115 | 115 | ); |
116 | 116 | $I->seeTextInViewMessageModal($custom_template_a_label); |
117 | 117 | $I->dismissMessageModal(); |
118 | 118 | $I->deleteMessageInMessagesListTableFor( |
119 | - 'Registration Approved', |
|
120 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
121 | - 'Email', |
|
122 | - 'Registrant' |
|
119 | + 'Registration Approved', |
|
120 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
121 | + 'Email', |
|
122 | + 'Registrant' |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | //verify admin context |
126 | 126 | $I->viewMessageInMessagesListTableFor( |
127 | - 'Registration Approved' |
|
127 | + 'Registration Approved' |
|
128 | 128 | ); |
129 | 129 | $I->seeTextInViewMessageModal($custom_template_a_label); |
130 | 130 | $I->dismissMessageModal(); |
@@ -153,25 +153,25 @@ discard block |
||
153 | 153 | $I->loginAsAdmin(); |
154 | 154 | $I->amOnMessagesActivityListTablePage(); |
155 | 155 | $I->viewMessageInMessagesListTableFor( |
156 | - 'Registration Approved', |
|
157 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
158 | - 'Email', |
|
159 | - 'Registrant' |
|
156 | + 'Registration Approved', |
|
157 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
158 | + 'Email', |
|
159 | + 'Registrant' |
|
160 | 160 | ); |
161 | 161 | $I->waitForElementVisible(MessagesAdmin::MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR); |
162 | 162 | $I->dontSeeTextInViewMessageModal($custom_template_a_label); |
163 | 163 | $I->dontSeeTextInViewMessageModal($custom_template_b_label); |
164 | 164 | $I->dismissMessageModal(); |
165 | 165 | $I->deleteMessageInMessagesListTableFor( |
166 | - 'Registration Approved', |
|
167 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
168 | - 'Email', |
|
169 | - 'Registrant' |
|
166 | + 'Registration Approved', |
|
167 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
168 | + 'Email', |
|
169 | + 'Registrant' |
|
170 | 170 | ); |
171 | 171 | |
172 | 172 | //verify admin context |
173 | 173 | $I->viewMessageInMessagesListTableFor( |
174 | - 'Registration Approved' |
|
174 | + 'Registration Approved' |
|
175 | 175 | ); |
176 | 176 | $I->waitForElementVisible(MessagesAdmin::MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR); |
177 | 177 | $I->dontSee($custom_template_a_label); |
@@ -183,6 +183,6 @@ discard block |
||
183 | 183 | |
184 | 184 | //deactivate MER plugin so its not active for future tests |
185 | 185 | $I->ensurePluginDeactivated( |
186 | - 'event-espresso-mer-multi-event-registration', |
|
187 | - 'plugins deactivated' |
|
186 | + 'event-espresso-mer-multi-event-registration', |
|
187 | + 'plugins deactivated' |
|
188 | 188 | ); |
189 | 189 | \ No newline at end of file |
@@ -6,59 +6,59 @@ |
||
6 | 6 | |
7 | 7 | trait CountrySettingsAdmin |
8 | 8 | { |
9 | - /** |
|
10 | - * Instructs the actor to browse to the country settings page. |
|
11 | - * Assumes the actor is already logged in. |
|
12 | - * @param string $additional_params |
|
13 | - */ |
|
14 | - public function amOnCountrySettingsAdminPage($additional_params = '') |
|
15 | - { |
|
16 | - $this->actor()->amOnAdminPage(CountrySettings::url($additional_params)); |
|
17 | - } |
|
9 | + /** |
|
10 | + * Instructs the actor to browse to the country settings page. |
|
11 | + * Assumes the actor is already logged in. |
|
12 | + * @param string $additional_params |
|
13 | + */ |
|
14 | + public function amOnCountrySettingsAdminPage($additional_params = '') |
|
15 | + { |
|
16 | + $this->actor()->amOnAdminPage(CountrySettings::url($additional_params)); |
|
17 | + } |
|
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * Instructs the actor to select the given decimal places radio option. |
|
22 | - * Assumes the actor is already on the country settings page. |
|
23 | - * @param string $decimal_places |
|
24 | - * @param string $country_code |
|
25 | - */ |
|
26 | - public function setCurrencyDecimalPlacesTo($decimal_places = '2', $country_code = 'US') |
|
27 | - { |
|
28 | - $this->actor()->click(CountrySettings::currencyDecimalPlacesRadioField($decimal_places, $country_code)); |
|
29 | - } |
|
20 | + /** |
|
21 | + * Instructs the actor to select the given decimal places radio option. |
|
22 | + * Assumes the actor is already on the country settings page. |
|
23 | + * @param string $decimal_places |
|
24 | + * @param string $country_code |
|
25 | + */ |
|
26 | + public function setCurrencyDecimalPlacesTo($decimal_places = '2', $country_code = 'US') |
|
27 | + { |
|
28 | + $this->actor()->click(CountrySettings::currencyDecimalPlacesRadioField($decimal_places, $country_code)); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * Instructs the actor to select the given decimal mark radio option. |
|
34 | - * Assumes the actor is already on the country settings page. |
|
35 | - * @param string $decimal_mark |
|
36 | - */ |
|
37 | - public function setCurrencyDecimalMarkTo($decimal_mark = '.') |
|
38 | - { |
|
39 | - $this->actor()->click(CountrySettings::currencyDecimalMarkRadioField($decimal_mark)); |
|
40 | - } |
|
32 | + /** |
|
33 | + * Instructs the actor to select the given decimal mark radio option. |
|
34 | + * Assumes the actor is already on the country settings page. |
|
35 | + * @param string $decimal_mark |
|
36 | + */ |
|
37 | + public function setCurrencyDecimalMarkTo($decimal_mark = '.') |
|
38 | + { |
|
39 | + $this->actor()->click(CountrySettings::currencyDecimalMarkRadioField($decimal_mark)); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * Instructs the actor to select the given thousands separator radio option. |
|
45 | - * Assumes the actor is already on the country settings page. |
|
46 | - * @param string $thousands_seperator |
|
47 | - */ |
|
48 | - public function setCurrencyThousandsSeparatorTo($thousands_seperator = ',') |
|
49 | - { |
|
50 | - $this->actor()->click(CountrySettings::currencyThousandsSeparatorField($thousands_seperator)); |
|
51 | - } |
|
43 | + /** |
|
44 | + * Instructs the actor to select the given thousands separator radio option. |
|
45 | + * Assumes the actor is already on the country settings page. |
|
46 | + * @param string $thousands_seperator |
|
47 | + */ |
|
48 | + public function setCurrencyThousandsSeparatorTo($thousands_seperator = ',') |
|
49 | + { |
|
50 | + $this->actor()->click(CountrySettings::currencyThousandsSeparatorField($thousands_seperator)); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * Clicks the country settings submit button. |
|
56 | - * Assumes the actor is on the country settings admin page. |
|
57 | - */ |
|
58 | - public function saveCountrySettings() |
|
59 | - { |
|
60 | - $this->actor()->click(CountrySettings::COUNTRY_SETTINGS_SAVE_BUTTON); |
|
61 | - //no indicator on the page when stuff has been updated so just give a bit of time for it to finish. |
|
62 | - $this->actor()->wait(10); |
|
63 | - } |
|
54 | + /** |
|
55 | + * Clicks the country settings submit button. |
|
56 | + * Assumes the actor is on the country settings admin page. |
|
57 | + */ |
|
58 | + public function saveCountrySettings() |
|
59 | + { |
|
60 | + $this->actor()->click(CountrySettings::COUNTRY_SETTINGS_SAVE_BUTTON); |
|
61 | + //no indicator on the page when stuff has been updated so just give a bit of time for it to finish. |
|
62 | + $this->actor()->wait(10); |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -15,139 +15,139 @@ |
||
15 | 15 | trait RegistrationsAdmin |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * This will select all checkboxes on a registration list table for the given array of |
|
20 | - * registration ids. |
|
21 | - * Assumes the actor is on a list table page for registrations. |
|
22 | - * @param $registration_ids |
|
23 | - */ |
|
24 | - public function selectBulkActionCheckboxesForRegistrationIds(array $registration_ids) |
|
25 | - { |
|
26 | - foreach ($registration_ids as $registration_id) { |
|
27 | - $this->actor()->checkOption( |
|
28 | - RegistrationsAdminPage::listTableCheckBoxSelectorForRegistrationId($registration_id) |
|
29 | - ); |
|
30 | - } |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * Navigates the actor to the default registration list table page. |
|
36 | - * @param string $additional_params |
|
37 | - */ |
|
38 | - public function amOnDefaultRegistrationsListTableAdminPage($additional_params = '') |
|
39 | - { |
|
40 | - $this->actor()->amOnAdminPage( |
|
41 | - RegistrationsAdminPage::registrationsDefaultAdminListTableUrl($additional_params) |
|
42 | - ); |
|
43 | - //wait for page to fully load |
|
44 | - $this->actor()->wait(5); |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * Will enter the provided value in the registration list table search field and execute a search for that value. |
|
50 | - * @param string $search_text |
|
51 | - */ |
|
52 | - public function searchForRegistrationOnRegistrationListTableWithText($search_text) |
|
53 | - { |
|
54 | - $this->amOnDefaultRegistrationsListTableAdminPage(); |
|
55 | - $this->actor()->fillField(RegistrationsAdminPage::SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION, $search_text); |
|
56 | - $this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR); |
|
57 | - $this->actor()->waitForText('Displaying search results for'); |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * This will filter the registration list table to view registrations for the given event id. |
|
64 | - * Assumption is made that you are logged into the admin but you do not need to be on the registration list table |
|
65 | - * page. |
|
66 | - * |
|
67 | - * @param int $event_id The id of the event viewing registrations for. |
|
68 | - */ |
|
69 | - public function amViewingRegistrationsForEvent($event_id) |
|
70 | - { |
|
71 | - $this->actor()->amOnDefaultEventsListTablePage(); |
|
72 | - $this->actor()->click(EventsAdmin::listTableActionLinkRegistrationsForEvent($event_id)); |
|
73 | - $this->actor()->waitForText('Viewing registrations for the event'); |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * This helper will initiate registering for the given event via the backend. |
|
79 | - * @param int $event_id The event to initiate registration for. |
|
80 | - */ |
|
81 | - public function amOnAdminRegistrationPageForEvent($event_id) |
|
82 | - { |
|
83 | - $this->actor()->amViewingRegistrationsForEvent($event_id); |
|
84 | - $this->actor()->click(RegistrationsAdminPage::BUTTON_ADD_NEW_REGISTRATION); |
|
85 | - $this->actor()->waitForText('Adding Registration For'); |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * This clicks the View Details Link for Registration with the given Id |
|
92 | - * @param $registration_id |
|
93 | - */ |
|
94 | - public function clickViewDetailsLinkForRegistrationWithId($registration_id) |
|
95 | - { |
|
96 | - $this->actor()->click(RegistrationsAdminPage::viewDetailsLinkSelectorForRegistrationId($registration_id)); |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * /** |
|
102 | - * This assumes you are on the admin details page for a registration in EE. It selects the given status in the |
|
103 | - * dropdown for changing registration status. |
|
104 | - * |
|
105 | - * @param string $status_label_or_value Either the label for the dropdown option or the value for the option. |
|
106 | - * @param $status_label_or_value |
|
107 | - */ |
|
108 | - public function selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value) |
|
109 | - { |
|
110 | - $this->actor()->selectOption( |
|
111 | - RegistrationsAdminPage::DROPDOWN_REGISTRATION_STATUS, |
|
112 | - $status_label_or_value |
|
113 | - ); |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * This selects (or deselects) the "Send Related Messages" checkbox on the Registration Details page. |
|
119 | - * @param bool $send_related_messages |
|
120 | - */ |
|
121 | - public function selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages = true) |
|
122 | - { |
|
123 | - $send_related_messages |
|
124 | - ? $this->actor()->selectOption( |
|
125 | - RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES, |
|
126 | - 'Yes' |
|
127 | - ) |
|
128 | - : $this->actor()->selecOption( |
|
129 | - RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES, |
|
130 | - 'No' |
|
131 | - ); |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * This assumes you are on the admin details page for a registration in EE. It selects the given status in the |
|
138 | - * dropdown for changing registration status and submits the change. |
|
139 | - * |
|
140 | - * @param string $status_label_or_value Either the label for the dropdown option or the value for the option. |
|
141 | - * @param bool $send_related_messages Whether or not to send related messages after changing the bulk action. |
|
142 | - */ |
|
143 | - public function changeRegistrationStatusOnRegistrationDetailsPageTo( |
|
144 | - $status_label_or_value, |
|
145 | - $send_related_messages = true |
|
146 | - ) { |
|
147 | - $this->actor()->selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value); |
|
148 | - $this->actor()->selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages); |
|
149 | - $this->actor()->click(RegistrationsAdminPage::BUTTON_UPDATE_REGISTRATION_STATUS); |
|
150 | - $this->actor()->waitForText('Registration status has been set to'); |
|
151 | - } |
|
18 | + /** |
|
19 | + * This will select all checkboxes on a registration list table for the given array of |
|
20 | + * registration ids. |
|
21 | + * Assumes the actor is on a list table page for registrations. |
|
22 | + * @param $registration_ids |
|
23 | + */ |
|
24 | + public function selectBulkActionCheckboxesForRegistrationIds(array $registration_ids) |
|
25 | + { |
|
26 | + foreach ($registration_ids as $registration_id) { |
|
27 | + $this->actor()->checkOption( |
|
28 | + RegistrationsAdminPage::listTableCheckBoxSelectorForRegistrationId($registration_id) |
|
29 | + ); |
|
30 | + } |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * Navigates the actor to the default registration list table page. |
|
36 | + * @param string $additional_params |
|
37 | + */ |
|
38 | + public function amOnDefaultRegistrationsListTableAdminPage($additional_params = '') |
|
39 | + { |
|
40 | + $this->actor()->amOnAdminPage( |
|
41 | + RegistrationsAdminPage::registrationsDefaultAdminListTableUrl($additional_params) |
|
42 | + ); |
|
43 | + //wait for page to fully load |
|
44 | + $this->actor()->wait(5); |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * Will enter the provided value in the registration list table search field and execute a search for that value. |
|
50 | + * @param string $search_text |
|
51 | + */ |
|
52 | + public function searchForRegistrationOnRegistrationListTableWithText($search_text) |
|
53 | + { |
|
54 | + $this->amOnDefaultRegistrationsListTableAdminPage(); |
|
55 | + $this->actor()->fillField(RegistrationsAdminPage::SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION, $search_text); |
|
56 | + $this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR); |
|
57 | + $this->actor()->waitForText('Displaying search results for'); |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * This will filter the registration list table to view registrations for the given event id. |
|
64 | + * Assumption is made that you are logged into the admin but you do not need to be on the registration list table |
|
65 | + * page. |
|
66 | + * |
|
67 | + * @param int $event_id The id of the event viewing registrations for. |
|
68 | + */ |
|
69 | + public function amViewingRegistrationsForEvent($event_id) |
|
70 | + { |
|
71 | + $this->actor()->amOnDefaultEventsListTablePage(); |
|
72 | + $this->actor()->click(EventsAdmin::listTableActionLinkRegistrationsForEvent($event_id)); |
|
73 | + $this->actor()->waitForText('Viewing registrations for the event'); |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * This helper will initiate registering for the given event via the backend. |
|
79 | + * @param int $event_id The event to initiate registration for. |
|
80 | + */ |
|
81 | + public function amOnAdminRegistrationPageForEvent($event_id) |
|
82 | + { |
|
83 | + $this->actor()->amViewingRegistrationsForEvent($event_id); |
|
84 | + $this->actor()->click(RegistrationsAdminPage::BUTTON_ADD_NEW_REGISTRATION); |
|
85 | + $this->actor()->waitForText('Adding Registration For'); |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * This clicks the View Details Link for Registration with the given Id |
|
92 | + * @param $registration_id |
|
93 | + */ |
|
94 | + public function clickViewDetailsLinkForRegistrationWithId($registration_id) |
|
95 | + { |
|
96 | + $this->actor()->click(RegistrationsAdminPage::viewDetailsLinkSelectorForRegistrationId($registration_id)); |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * /** |
|
102 | + * This assumes you are on the admin details page for a registration in EE. It selects the given status in the |
|
103 | + * dropdown for changing registration status. |
|
104 | + * |
|
105 | + * @param string $status_label_or_value Either the label for the dropdown option or the value for the option. |
|
106 | + * @param $status_label_or_value |
|
107 | + */ |
|
108 | + public function selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value) |
|
109 | + { |
|
110 | + $this->actor()->selectOption( |
|
111 | + RegistrationsAdminPage::DROPDOWN_REGISTRATION_STATUS, |
|
112 | + $status_label_or_value |
|
113 | + ); |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * This selects (or deselects) the "Send Related Messages" checkbox on the Registration Details page. |
|
119 | + * @param bool $send_related_messages |
|
120 | + */ |
|
121 | + public function selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages = true) |
|
122 | + { |
|
123 | + $send_related_messages |
|
124 | + ? $this->actor()->selectOption( |
|
125 | + RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES, |
|
126 | + 'Yes' |
|
127 | + ) |
|
128 | + : $this->actor()->selecOption( |
|
129 | + RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES, |
|
130 | + 'No' |
|
131 | + ); |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * This assumes you are on the admin details page for a registration in EE. It selects the given status in the |
|
138 | + * dropdown for changing registration status and submits the change. |
|
139 | + * |
|
140 | + * @param string $status_label_or_value Either the label for the dropdown option or the value for the option. |
|
141 | + * @param bool $send_related_messages Whether or not to send related messages after changing the bulk action. |
|
142 | + */ |
|
143 | + public function changeRegistrationStatusOnRegistrationDetailsPageTo( |
|
144 | + $status_label_or_value, |
|
145 | + $send_related_messages = true |
|
146 | + ) { |
|
147 | + $this->actor()->selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value); |
|
148 | + $this->actor()->selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages); |
|
149 | + $this->actor()->click(RegistrationsAdminPage::BUTTON_UPDATE_REGISTRATION_STATUS); |
|
150 | + $this->actor()->waitForText('Registration status has been set to'); |
|
151 | + } |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | \ No newline at end of file |
@@ -13,75 +13,75 @@ |
||
13 | 13 | */ |
14 | 14 | trait Checkout |
15 | 15 | { |
16 | - /** |
|
17 | - * @param $value |
|
18 | - * @param int $attendee_number |
|
19 | - * @param bool $admin Used to indicate whether we're filling out the field from the context of the admin or not. |
|
20 | - */ |
|
21 | - public function fillOutFirstNameFieldForAttendee($value, $attendee_number = 1, $admin = false) |
|
22 | - { |
|
23 | - $this->actor()->fillField(CheckoutPage::firstNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value); |
|
24 | - } |
|
16 | + /** |
|
17 | + * @param $value |
|
18 | + * @param int $attendee_number |
|
19 | + * @param bool $admin Used to indicate whether we're filling out the field from the context of the admin or not. |
|
20 | + */ |
|
21 | + public function fillOutFirstNameFieldForAttendee($value, $attendee_number = 1, $admin = false) |
|
22 | + { |
|
23 | + $this->actor()->fillField(CheckoutPage::firstNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * @param $value |
|
28 | - * @param int $attendee_number |
|
29 | - * @param bool $admin Used to indicate whether we're filling out the field from the context of the admin or not. |
|
30 | - */ |
|
31 | - public function fillOutLastNameFieldForAttendee($value, $attendee_number = 1, $admin = false) |
|
32 | - { |
|
33 | - $this->actor()->fillField(CheckoutPage::lastNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value); |
|
34 | - } |
|
26 | + /** |
|
27 | + * @param $value |
|
28 | + * @param int $attendee_number |
|
29 | + * @param bool $admin Used to indicate whether we're filling out the field from the context of the admin or not. |
|
30 | + */ |
|
31 | + public function fillOutLastNameFieldForAttendee($value, $attendee_number = 1, $admin = false) |
|
32 | + { |
|
33 | + $this->actor()->fillField(CheckoutPage::lastNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param $value |
|
38 | - * @param int $attendee_number |
|
39 | - * @param bool $admin Used to indicate whether we're filling out the field from the context of the admin or not. |
|
40 | - */ |
|
41 | - public function fillOutEmailFieldForAttendee($value, $attendee_number = 1, $admin = false) |
|
42 | - { |
|
43 | - $this->actor()->fillField(CheckoutPage::emailFieldSelectorForAttendeeNumber($attendee_number, $admin), $value); |
|
44 | - } |
|
36 | + /** |
|
37 | + * @param $value |
|
38 | + * @param int $attendee_number |
|
39 | + * @param bool $admin Used to indicate whether we're filling out the field from the context of the admin or not. |
|
40 | + */ |
|
41 | + public function fillOutEmailFieldForAttendee($value, $attendee_number = 1, $admin = false) |
|
42 | + { |
|
43 | + $this->actor()->fillField(CheckoutPage::emailFieldSelectorForAttendeeNumber($attendee_number, $admin), $value); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * Clicks the next registration step button. |
|
49 | - */ |
|
50 | - public function goToNextRegistrationStep() |
|
51 | - { |
|
52 | - $this->actor()->click(CheckoutPage::NEXT_STEP_BUTTON_SELECTOR); |
|
53 | - } |
|
47 | + /** |
|
48 | + * Clicks the next registration step button. |
|
49 | + */ |
|
50 | + public function goToNextRegistrationStep() |
|
51 | + { |
|
52 | + $this->actor()->click(CheckoutPage::NEXT_STEP_BUTTON_SELECTOR); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Selects the payment option for the given payment method slug. |
|
58 | - * |
|
59 | - * @param string $payment_method_slug |
|
60 | - * @param bool $verify_selected If true, this will wait for the "Important Information" info box after the |
|
61 | - * payment option select box is complete. Otherwise its up to calling code to |
|
62 | - * wait for whatever is needed after selecting the payment method. |
|
63 | - */ |
|
64 | - public function selectPaymentOptionFor($payment_method_slug = 'invoice', $verify_selected = true) |
|
65 | - { |
|
66 | - $this->waitForElementVisible(CheckoutPage::SELECTOR_PAYMENT_OPTIONS_CONTAINER); |
|
67 | - $this->wait(5); |
|
68 | - $this->actor()->selectOption( |
|
69 | - CheckoutPage::PAYMENT_METHOD_STEP_FORM, |
|
70 | - $payment_method_slug |
|
71 | - ); |
|
72 | - if ($verify_selected) { |
|
73 | - $this->actor()->waitForText('Important information regarding your payment'); |
|
74 | - } |
|
75 | - } |
|
56 | + /** |
|
57 | + * Selects the payment option for the given payment method slug. |
|
58 | + * |
|
59 | + * @param string $payment_method_slug |
|
60 | + * @param bool $verify_selected If true, this will wait for the "Important Information" info box after the |
|
61 | + * payment option select box is complete. Otherwise its up to calling code to |
|
62 | + * wait for whatever is needed after selecting the payment method. |
|
63 | + */ |
|
64 | + public function selectPaymentOptionFor($payment_method_slug = 'invoice', $verify_selected = true) |
|
65 | + { |
|
66 | + $this->waitForElementVisible(CheckoutPage::SELECTOR_PAYMENT_OPTIONS_CONTAINER); |
|
67 | + $this->wait(5); |
|
68 | + $this->actor()->selectOption( |
|
69 | + CheckoutPage::PAYMENT_METHOD_STEP_FORM, |
|
70 | + $payment_method_slug |
|
71 | + ); |
|
72 | + if ($verify_selected) { |
|
73 | + $this->actor()->waitForText('Important information regarding your payment'); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Submits the payment options step form. |
|
80 | - * Assumes the actor is in the context of the payment options SPCO step. |
|
81 | - */ |
|
82 | - public function submitPaymentOptionsRegistrationStepForm() |
|
83 | - { |
|
84 | - $this->actor()->submitForm(CheckoutPage::PAYMENT_METHOD_STEP_FORM, array()); |
|
85 | - } |
|
78 | + /** |
|
79 | + * Submits the payment options step form. |
|
80 | + * Assumes the actor is in the context of the payment options SPCO step. |
|
81 | + */ |
|
82 | + public function submitPaymentOptionsRegistrationStepForm() |
|
83 | + { |
|
84 | + $this->actor()->submitForm(CheckoutPage::PAYMENT_METHOD_STEP_FORM, array()); |
|
85 | + } |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | \ No newline at end of file |
@@ -14,280 +14,280 @@ |
||
14 | 14 | class EventsAdmin extends CoreAdmin |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Selector for the Add new Event button in the admin. |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - const ADD_NEW_EVENT_BUTTON_SELECTOR = '#add-new-event'; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * Selector for the Event Title field in the event editor |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - const EVENT_EDITOR_TITLE_FIELD_SELECTOR = ['xpath' => "//input[@id='title']"]; |
|
29 | - |
|
30 | - /** |
|
31 | - * Selector for the publish submit button in the event editor. |
|
32 | - * @var string |
|
33 | - */ |
|
34 | - const EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR = ['xpath'=>"//div[@id='major-publishing-actions']//input[@id='publish']"]; |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * Selector for the save button in the event editor |
|
39 | - */ |
|
40 | - const EVENT_EDITOR_SAVE_BUTTON_SELECTOR = ['xpath' => "//div[@id='minor-publishing-actions']//input[@id='save-post']"]; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
46 | - const EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR = '#EVT_default_registration_status'; |
|
47 | - |
|
48 | - /** |
|
49 | - * Selector for the view link after publishing an event. |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - const EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR = "//span[@id='sample-permalink']/a"; |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * Selector for the ID of the event in the event editor |
|
57 | - * @var string |
|
58 | - */ |
|
59 | - const EVENT_EDITOR_EVT_ID_SELECTOR = "//input[@id='post_ID']"; |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * Selector for the search input on the event list table page. |
|
64 | - * @var string |
|
65 | - */ |
|
66 | - const EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR = '#toplevel_page_espresso_events-search-input'; |
|
67 | - |
|
68 | - |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * @param string $additional_params |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public static function defaultEventsListTableUrl($additional_params = '') |
|
76 | - { |
|
77 | - return self::adminUrl('espresso_events', 'default', $additional_params); |
|
78 | - } |
|
79 | - |
|
80 | - |
|
81 | - /** |
|
82 | - * The selector for the DTTname field for the given row in the event editor. |
|
83 | - * @param int $row_number |
|
84 | - * @return string |
|
85 | - */ |
|
86 | - public static function eventEditorDatetimeNameFieldSelector($row_number = 1) |
|
87 | - { |
|
88 | - return self::eventEditorDatetimeFieldSelectorForField('DTT_name', $row_number); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * The selector for the DTT_EVT_start field for the given row in the event editor.d |
|
94 | - * @param int $row_number |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public static function eventEditorDatetimeStartDateFieldSelector($row_number = 1) |
|
98 | - { |
|
99 | - return self::eventEditorDatetimeFieldSelectorForField('DTT_EVT_start', $row_number); |
|
100 | - } |
|
101 | - |
|
102 | - |
|
103 | - /** |
|
104 | - * Wrapper for getting the selector for a given field and given row of a datetime in the event editor. |
|
105 | - * |
|
106 | - * @param string $field_name |
|
107 | - * @param int $row_number |
|
108 | - * @return string |
|
109 | - */ |
|
110 | - public static function eventEditorDatetimeFieldSelectorForField($field_name, $row_number = 1) |
|
111 | - { |
|
112 | - return "//input[@id='event-datetime-$field_name-$row_number']"; |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * The selector for the TKT_name field for the given display row in the event editor. |
|
118 | - * @param int $row_number |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public static function eventEditorTicketNameFieldSelector($row_number = 1) |
|
122 | - { |
|
123 | - return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_name', $row_number); |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - /** |
|
128 | - * Selector for the TKT_base_price field for the given display row in the event editor. |
|
129 | - * @param int $row_number |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - public static function eventEditorTicketPriceFieldSelector($row_number = 1) |
|
133 | - { |
|
134 | - return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_base_price', $row_number); |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * Selector for the TKT_qty field for the given display row in the event editor. |
|
140 | - * @param int $row_number |
|
141 | - * @return string |
|
142 | - */ |
|
143 | - public static function eventEditorTicketQuantityFieldSelector($row_number = 1) |
|
144 | - { |
|
145 | - return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_qty', $row_number); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - /** |
|
150 | - * Selector for the advanced details toggle for the ticket for the given display row in the event editor. |
|
151 | - * @param int $row_number |
|
152 | - * @return string |
|
153 | - */ |
|
154 | - public static function eventEditorTicketAdvancedDetailsSelector($row_number = 1) |
|
155 | - { |
|
156 | - return "//tr[@id='display-ticketrow-$row_number']//span[contains(@class, 'gear-icon')]"; |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * Selector for the subtotal amount for the given display row of the ticket in the event editor. |
|
162 | - * @param int $row_number |
|
163 | - * @return string |
|
164 | - */ |
|
165 | - public static function eventEditorTicketAdvancedDetailsSubtotalSelector($row_number = 1) |
|
166 | - { |
|
167 | - return "//span[@id='price-total-amount-$row_number']"; |
|
168 | - } |
|
169 | - |
|
170 | - |
|
171 | - /** |
|
172 | - * Selector for the Total element for the given display row of the ticket in the event editor. |
|
173 | - * @param int $row_number |
|
174 | - * @return string |
|
175 | - */ |
|
176 | - public static function eventEditorTicketAdvancedDetailsTotalSelector($row_number = 1) |
|
177 | - { |
|
178 | - return "//span[@id='price-total-amount-$row_number']"; |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - /** |
|
183 | - * Selector for the taxable selector for the ticket for the given display row in the event editor. |
|
184 | - * @param int $row_number |
|
185 | - * @return string |
|
186 | - */ |
|
187 | - public static function eventEditorTicketTaxableCheckboxSelector($row_number = 1) |
|
188 | - { |
|
189 | - return "//input[@id='edit-ticket-TKT_taxable-$row_number']"; |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * This returns the xpath locater for the Tax amount display container within the advanced settings view for the |
|
195 | - * given ticket (row) and the given tax id (PRC_ID). |
|
196 | - * |
|
197 | - * @param int $tax_id The PRC_ID for the tax you want the locater for. Note, this defaults to the default tax |
|
198 | - * setup on a fresh install. |
|
199 | - * @param int $row_number What row representing the ticket you want the locator for. |
|
200 | - * @return string |
|
201 | - */ |
|
202 | - public static function eventEditorTicketTaxAmountDisplayForTaxIdAndTicketRowSelector($tax_id = 2, $row_number = 1) |
|
203 | - { |
|
204 | - return "//span[@id='TKT-tax-amount-display-$tax_id-$row_number']"; |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - /** |
|
209 | - * Wrapper for getting the selector for a given field and given display row of a ticket in the event editor. |
|
210 | - * @param $field_name |
|
211 | - * @param int $row_number |
|
212 | - * @return string |
|
213 | - */ |
|
214 | - public static function eventEditorTicketFieldSelectorForFieldInDisplayRow($field_name, $row_number = 1) |
|
215 | - { |
|
216 | - return "//tr[@id='display-ticketrow-$row_number']//input[contains(@class, 'edit-ticket-$field_name')]"; |
|
217 | - } |
|
218 | - |
|
219 | - |
|
220 | - /** |
|
221 | - * Returns the selector for the event title edit link in the events list table for the given Event Title. |
|
222 | - * @param string $event_title |
|
223 | - * @return string |
|
224 | - */ |
|
225 | - public static function eventListTableEventTitleEditLinkSelectorForTitle($event_title) |
|
226 | - { |
|
227 | - return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']"; |
|
228 | - } |
|
229 | - |
|
230 | - |
|
231 | - /** |
|
232 | - * Locator for for the ID column in the event list table for a given event title. |
|
233 | - * @param string $event_title |
|
234 | - * @return string |
|
235 | - */ |
|
236 | - public static function eventListTableEventIdSelectorForTitle($event_title) |
|
237 | - { |
|
238 | - return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
239 | - . "//ancestor::tr/th[contains(@class, 'check-column')]/input"; |
|
240 | - } |
|
241 | - |
|
242 | - |
|
243 | - /** |
|
244 | - * Locator for the view link in the row of an event list table for the given event title. |
|
245 | - * @param string $event_title |
|
246 | - * @return string |
|
247 | - */ |
|
248 | - public static function eventListTableEventTitleViewLinkSelectorForTitle($event_title) |
|
249 | - { |
|
250 | - return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
251 | - . "//ancestor::td//span[@class='view']/a"; |
|
252 | - } |
|
253 | - |
|
254 | - |
|
255 | - /** |
|
256 | - * Locator for the messenger tab in the Notifications metabox in the event editor. |
|
257 | - * @param string $messenger_slug The slug for the messenger (it's reference slug). |
|
258 | - * @return string |
|
259 | - */ |
|
260 | - public static function eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug) |
|
261 | - { |
|
262 | - return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
263 | - . "//a[@rel='ee-tab-$messenger_slug']"; |
|
264 | - } |
|
265 | - |
|
266 | - |
|
267 | - /** |
|
268 | - * Locator for the select input within the notifications metabox. |
|
269 | - * Note, this assumes the tab content for the related messenger is already visible. |
|
270 | - * @param string $message_type_label The message type label (visible string in the table) you want the selector for. |
|
271 | - * @return string |
|
272 | - */ |
|
273 | - public static function eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label) |
|
274 | - { |
|
275 | - return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
276 | - . "//table[@class='messages-custom-template-switcher']" |
|
277 | - . "//tr/td[contains(.,'Registration Approved')]" |
|
278 | - . "//ancestor::tr//select[contains(@class,'message-template-selector')]"; |
|
279 | - } |
|
280 | - |
|
281 | - |
|
282 | - /** |
|
283 | - * Returns the selector for the action link to the registrations list table view filtered by the given event_id. |
|
284 | - * Assumes one is in the context of the Events List Table |
|
285 | - * @param int $event_id |
|
286 | - * @return string |
|
287 | - */ |
|
288 | - public static function listTableActionLinkRegistrationsForEvent($event_id) |
|
289 | - { |
|
290 | - return "//tbody[@id='the-list']/tr/td[contains(@class, 'column-id') and contains(.,$event_id)]" |
|
291 | - . "//ancestor::tr/td//a[div[contains(@class, 'dashicons-groups')]]"; |
|
292 | - } |
|
17 | + /** |
|
18 | + * Selector for the Add new Event button in the admin. |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + const ADD_NEW_EVENT_BUTTON_SELECTOR = '#add-new-event'; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * Selector for the Event Title field in the event editor |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + const EVENT_EDITOR_TITLE_FIELD_SELECTOR = ['xpath' => "//input[@id='title']"]; |
|
29 | + |
|
30 | + /** |
|
31 | + * Selector for the publish submit button in the event editor. |
|
32 | + * @var string |
|
33 | + */ |
|
34 | + const EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR = ['xpath'=>"//div[@id='major-publishing-actions']//input[@id='publish']"]; |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * Selector for the save button in the event editor |
|
39 | + */ |
|
40 | + const EVENT_EDITOR_SAVE_BUTTON_SELECTOR = ['xpath' => "//div[@id='minor-publishing-actions']//input[@id='save-post']"]; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | + const EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR = '#EVT_default_registration_status'; |
|
47 | + |
|
48 | + /** |
|
49 | + * Selector for the view link after publishing an event. |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + const EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR = "//span[@id='sample-permalink']/a"; |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * Selector for the ID of the event in the event editor |
|
57 | + * @var string |
|
58 | + */ |
|
59 | + const EVENT_EDITOR_EVT_ID_SELECTOR = "//input[@id='post_ID']"; |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * Selector for the search input on the event list table page. |
|
64 | + * @var string |
|
65 | + */ |
|
66 | + const EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR = '#toplevel_page_espresso_events-search-input'; |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * @param string $additional_params |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public static function defaultEventsListTableUrl($additional_params = '') |
|
76 | + { |
|
77 | + return self::adminUrl('espresso_events', 'default', $additional_params); |
|
78 | + } |
|
79 | + |
|
80 | + |
|
81 | + /** |
|
82 | + * The selector for the DTTname field for the given row in the event editor. |
|
83 | + * @param int $row_number |
|
84 | + * @return string |
|
85 | + */ |
|
86 | + public static function eventEditorDatetimeNameFieldSelector($row_number = 1) |
|
87 | + { |
|
88 | + return self::eventEditorDatetimeFieldSelectorForField('DTT_name', $row_number); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * The selector for the DTT_EVT_start field for the given row in the event editor.d |
|
94 | + * @param int $row_number |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public static function eventEditorDatetimeStartDateFieldSelector($row_number = 1) |
|
98 | + { |
|
99 | + return self::eventEditorDatetimeFieldSelectorForField('DTT_EVT_start', $row_number); |
|
100 | + } |
|
101 | + |
|
102 | + |
|
103 | + /** |
|
104 | + * Wrapper for getting the selector for a given field and given row of a datetime in the event editor. |
|
105 | + * |
|
106 | + * @param string $field_name |
|
107 | + * @param int $row_number |
|
108 | + * @return string |
|
109 | + */ |
|
110 | + public static function eventEditorDatetimeFieldSelectorForField($field_name, $row_number = 1) |
|
111 | + { |
|
112 | + return "//input[@id='event-datetime-$field_name-$row_number']"; |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * The selector for the TKT_name field for the given display row in the event editor. |
|
118 | + * @param int $row_number |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public static function eventEditorTicketNameFieldSelector($row_number = 1) |
|
122 | + { |
|
123 | + return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_name', $row_number); |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + /** |
|
128 | + * Selector for the TKT_base_price field for the given display row in the event editor. |
|
129 | + * @param int $row_number |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + public static function eventEditorTicketPriceFieldSelector($row_number = 1) |
|
133 | + { |
|
134 | + return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_base_price', $row_number); |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * Selector for the TKT_qty field for the given display row in the event editor. |
|
140 | + * @param int $row_number |
|
141 | + * @return string |
|
142 | + */ |
|
143 | + public static function eventEditorTicketQuantityFieldSelector($row_number = 1) |
|
144 | + { |
|
145 | + return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_qty', $row_number); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + /** |
|
150 | + * Selector for the advanced details toggle for the ticket for the given display row in the event editor. |
|
151 | + * @param int $row_number |
|
152 | + * @return string |
|
153 | + */ |
|
154 | + public static function eventEditorTicketAdvancedDetailsSelector($row_number = 1) |
|
155 | + { |
|
156 | + return "//tr[@id='display-ticketrow-$row_number']//span[contains(@class, 'gear-icon')]"; |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * Selector for the subtotal amount for the given display row of the ticket in the event editor. |
|
162 | + * @param int $row_number |
|
163 | + * @return string |
|
164 | + */ |
|
165 | + public static function eventEditorTicketAdvancedDetailsSubtotalSelector($row_number = 1) |
|
166 | + { |
|
167 | + return "//span[@id='price-total-amount-$row_number']"; |
|
168 | + } |
|
169 | + |
|
170 | + |
|
171 | + /** |
|
172 | + * Selector for the Total element for the given display row of the ticket in the event editor. |
|
173 | + * @param int $row_number |
|
174 | + * @return string |
|
175 | + */ |
|
176 | + public static function eventEditorTicketAdvancedDetailsTotalSelector($row_number = 1) |
|
177 | + { |
|
178 | + return "//span[@id='price-total-amount-$row_number']"; |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + /** |
|
183 | + * Selector for the taxable selector for the ticket for the given display row in the event editor. |
|
184 | + * @param int $row_number |
|
185 | + * @return string |
|
186 | + */ |
|
187 | + public static function eventEditorTicketTaxableCheckboxSelector($row_number = 1) |
|
188 | + { |
|
189 | + return "//input[@id='edit-ticket-TKT_taxable-$row_number']"; |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * This returns the xpath locater for the Tax amount display container within the advanced settings view for the |
|
195 | + * given ticket (row) and the given tax id (PRC_ID). |
|
196 | + * |
|
197 | + * @param int $tax_id The PRC_ID for the tax you want the locater for. Note, this defaults to the default tax |
|
198 | + * setup on a fresh install. |
|
199 | + * @param int $row_number What row representing the ticket you want the locator for. |
|
200 | + * @return string |
|
201 | + */ |
|
202 | + public static function eventEditorTicketTaxAmountDisplayForTaxIdAndTicketRowSelector($tax_id = 2, $row_number = 1) |
|
203 | + { |
|
204 | + return "//span[@id='TKT-tax-amount-display-$tax_id-$row_number']"; |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + /** |
|
209 | + * Wrapper for getting the selector for a given field and given display row of a ticket in the event editor. |
|
210 | + * @param $field_name |
|
211 | + * @param int $row_number |
|
212 | + * @return string |
|
213 | + */ |
|
214 | + public static function eventEditorTicketFieldSelectorForFieldInDisplayRow($field_name, $row_number = 1) |
|
215 | + { |
|
216 | + return "//tr[@id='display-ticketrow-$row_number']//input[contains(@class, 'edit-ticket-$field_name')]"; |
|
217 | + } |
|
218 | + |
|
219 | + |
|
220 | + /** |
|
221 | + * Returns the selector for the event title edit link in the events list table for the given Event Title. |
|
222 | + * @param string $event_title |
|
223 | + * @return string |
|
224 | + */ |
|
225 | + public static function eventListTableEventTitleEditLinkSelectorForTitle($event_title) |
|
226 | + { |
|
227 | + return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']"; |
|
228 | + } |
|
229 | + |
|
230 | + |
|
231 | + /** |
|
232 | + * Locator for for the ID column in the event list table for a given event title. |
|
233 | + * @param string $event_title |
|
234 | + * @return string |
|
235 | + */ |
|
236 | + public static function eventListTableEventIdSelectorForTitle($event_title) |
|
237 | + { |
|
238 | + return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
239 | + . "//ancestor::tr/th[contains(@class, 'check-column')]/input"; |
|
240 | + } |
|
241 | + |
|
242 | + |
|
243 | + /** |
|
244 | + * Locator for the view link in the row of an event list table for the given event title. |
|
245 | + * @param string $event_title |
|
246 | + * @return string |
|
247 | + */ |
|
248 | + public static function eventListTableEventTitleViewLinkSelectorForTitle($event_title) |
|
249 | + { |
|
250 | + return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
|
251 | + . "//ancestor::td//span[@class='view']/a"; |
|
252 | + } |
|
253 | + |
|
254 | + |
|
255 | + /** |
|
256 | + * Locator for the messenger tab in the Notifications metabox in the event editor. |
|
257 | + * @param string $messenger_slug The slug for the messenger (it's reference slug). |
|
258 | + * @return string |
|
259 | + */ |
|
260 | + public static function eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug) |
|
261 | + { |
|
262 | + return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
263 | + . "//a[@rel='ee-tab-$messenger_slug']"; |
|
264 | + } |
|
265 | + |
|
266 | + |
|
267 | + /** |
|
268 | + * Locator for the select input within the notifications metabox. |
|
269 | + * Note, this assumes the tab content for the related messenger is already visible. |
|
270 | + * @param string $message_type_label The message type label (visible string in the table) you want the selector for. |
|
271 | + * @return string |
|
272 | + */ |
|
273 | + public static function eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label) |
|
274 | + { |
|
275 | + return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
|
276 | + . "//table[@class='messages-custom-template-switcher']" |
|
277 | + . "//tr/td[contains(.,'Registration Approved')]" |
|
278 | + . "//ancestor::tr//select[contains(@class,'message-template-selector')]"; |
|
279 | + } |
|
280 | + |
|
281 | + |
|
282 | + /** |
|
283 | + * Returns the selector for the action link to the registrations list table view filtered by the given event_id. |
|
284 | + * Assumes one is in the context of the Events List Table |
|
285 | + * @param int $event_id |
|
286 | + * @return string |
|
287 | + */ |
|
288 | + public static function listTableActionLinkRegistrationsForEvent($event_id) |
|
289 | + { |
|
290 | + return "//tbody[@id='the-list']/tr/td[contains(@class, 'column-id') and contains(.,$event_id)]" |
|
291 | + . "//ancestor::tr/td//a[div[contains(@class, 'dashicons-groups')]]"; |
|
292 | + } |
|
293 | 293 | } |
@@ -12,27 +12,27 @@ |
||
12 | 12 | class TicketSelector |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * Return the selector for the ticket option select input for the given event id. |
|
17 | - * @param int|string $event_id |
|
18 | - * @return string |
|
19 | - */ |
|
20 | - public static function ticketOptionByEventIdSelector($event_id) |
|
21 | - { |
|
22 | - return "//select[@id='ticket-selector-tbl-qty-slct-$event_id-1']"; |
|
23 | - } |
|
15 | + /** |
|
16 | + * Return the selector for the ticket option select input for the given event id. |
|
17 | + * @param int|string $event_id |
|
18 | + * @return string |
|
19 | + */ |
|
20 | + public static function ticketOptionByEventIdSelector($event_id) |
|
21 | + { |
|
22 | + return "//select[@id='ticket-selector-tbl-qty-slct-$event_id-1']"; |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * Return the selector for the submit button for the ticket selector for the given event id. |
|
28 | - * @param int|string $event_id |
|
29 | - * @param bool $admin Used to return the selector from the context of the admin (true) or frontend (false) |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public static function ticketSelectionSubmitSelectorByEventId($event_id, $admin = false) |
|
33 | - { |
|
34 | - return $admin |
|
35 | - ? "#ee-new-registration-step-button" |
|
36 | - : "#ticket-selector-submit-$event_id-btn"; |
|
37 | - } |
|
26 | + /** |
|
27 | + * Return the selector for the submit button for the ticket selector for the given event id. |
|
28 | + * @param int|string $event_id |
|
29 | + * @param bool $admin Used to return the selector from the context of the admin (true) or frontend (false) |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public static function ticketSelectionSubmitSelectorByEventId($event_id, $admin = false) |
|
33 | + { |
|
34 | + return $admin |
|
35 | + ? "#ee-new-registration-step-button" |
|
36 | + : "#ticket-selector-submit-$event_id-btn"; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -12,47 +12,47 @@ |
||
12 | 12 | class RegistrationsAdmin extends CoreAdmin |
13 | 13 | { |
14 | 14 | |
15 | - const REGISTRATION_STATUS_NOT_APPROVED = 'RNA'; |
|
16 | - const REGISTRATION_STATUS_APPROVED = 'RAP'; |
|
17 | - const REGISTRATION_STATUS_PENDING_PAYMENT = 'RPP'; |
|
18 | - const SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION = '#event-espresso_page_espresso_registrations-search-input'; |
|
19 | - const BUTTON_ADD_NEW_REGISTRATION = '#add-new-registration'; |
|
20 | - const DROPDOWN_REGISTRATION_STATUS = '#reg-status-change-form-reg-status'; |
|
21 | - const BUTTON_UPDATE_REGISTRATION_STATUS = '#reg-status-change-form-submit-submit'; |
|
22 | - const DROPDOWN_SEND_RELATED_MESSAGES = '#reg-status-change-form-send-notifications'; |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * @param string $additional_params |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public static function registrationsDefaultAdminListTableUrl($additional_params = '') |
|
30 | - { |
|
31 | - return self::adminUrl('espresso_registrations', 'default', $additional_params); |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * Given a registration id, this will return the selector for all the checkbox for that id. |
|
37 | - * Assumes the view is the default registrations list table. |
|
38 | - * @param int $registration_id |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public static function listTableCheckBoxSelectorForRegistrationId($registration_id) |
|
42 | - { |
|
43 | - return "//input[@name='_REG_ID[]' and @value='{$registration_id}']"; |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * Given a registration id, this will return the selector for the link to the registration details. |
|
49 | - * Assumes the view is the default registrations list table. |
|
50 | - * @param int $registration_id |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public static function viewDetailsLinkSelectorForRegistrationId($registration_id) |
|
54 | - { |
|
55 | - return "//tbody[@id='the-list']/tr/td[contains(@class, 'column-_REG_ID') and contains(., $registration_id)]" |
|
56 | - . "//ancestor::tr/td[contains(@class, 'column-ATT_fname')]/a[1]"; |
|
57 | - } |
|
15 | + const REGISTRATION_STATUS_NOT_APPROVED = 'RNA'; |
|
16 | + const REGISTRATION_STATUS_APPROVED = 'RAP'; |
|
17 | + const REGISTRATION_STATUS_PENDING_PAYMENT = 'RPP'; |
|
18 | + const SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION = '#event-espresso_page_espresso_registrations-search-input'; |
|
19 | + const BUTTON_ADD_NEW_REGISTRATION = '#add-new-registration'; |
|
20 | + const DROPDOWN_REGISTRATION_STATUS = '#reg-status-change-form-reg-status'; |
|
21 | + const BUTTON_UPDATE_REGISTRATION_STATUS = '#reg-status-change-form-submit-submit'; |
|
22 | + const DROPDOWN_SEND_RELATED_MESSAGES = '#reg-status-change-form-send-notifications'; |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * @param string $additional_params |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public static function registrationsDefaultAdminListTableUrl($additional_params = '') |
|
30 | + { |
|
31 | + return self::adminUrl('espresso_registrations', 'default', $additional_params); |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * Given a registration id, this will return the selector for all the checkbox for that id. |
|
37 | + * Assumes the view is the default registrations list table. |
|
38 | + * @param int $registration_id |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public static function listTableCheckBoxSelectorForRegistrationId($registration_id) |
|
42 | + { |
|
43 | + return "//input[@name='_REG_ID[]' and @value='{$registration_id}']"; |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * Given a registration id, this will return the selector for the link to the registration details. |
|
49 | + * Assumes the view is the default registrations list table. |
|
50 | + * @param int $registration_id |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public static function viewDetailsLinkSelectorForRegistrationId($registration_id) |
|
54 | + { |
|
55 | + return "//tbody[@id='the-list']/tr/td[contains(@class, 'column-_REG_ID') and contains(., $registration_id)]" |
|
56 | + . "//ancestor::tr/td[contains(@class, 'column-ATT_fname')]/a[1]"; |
|
57 | + } |
|
58 | 58 | } |
59 | 59 | \ No newline at end of file |
@@ -13,71 +13,71 @@ |
||
13 | 13 | class Checkout |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * The class selector for the next step button in the checkout. |
|
18 | - * @var string |
|
19 | - */ |
|
20 | - const NEXT_STEP_BUTTON_SELECTOR = '.spco-next-step-btn'; |
|
21 | - |
|
22 | - |
|
23 | - const PAYMENT_METHOD_STEP_FORM = '#ee-spco-payment_options-reg-step-form'; |
|
24 | - |
|
25 | - |
|
26 | - const SELECTOR_PAYMENT_OPTIONS_CONTAINER = '#spco-available-methods-of-payment-dv'; |
|
27 | - |
|
28 | - |
|
29 | - /** |
|
30 | - * @param int $attendee_number |
|
31 | - * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
32 | - * @return string |
|
33 | - */ |
|
34 | - public static function firstNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false) |
|
35 | - { |
|
36 | - return self::fieldSelectorForAttendeeNumber('fname', $attendee_number, $admin); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * @param int $attendee_number |
|
42 | - * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
43 | - * @return string |
|
44 | - */ |
|
45 | - public static function lastNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false) |
|
46 | - { |
|
47 | - return self::fieldSelectorForAttendeeNumber('lname', $attendee_number, $admin); |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * @param int $attendee_number |
|
53 | - * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - public static function emailFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false) |
|
57 | - { |
|
58 | - return self::fieldSelectorForAttendeeNumber('email', $attendee_number, $admin); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * @param string $field_name |
|
63 | - * @param int $attendee_number |
|
64 | - * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
65 | - * @return string |
|
66 | - */ |
|
67 | - public static function fieldSelectorForAttendeeNumber($field_name, $attendee_number = 1, $admin = false) |
|
68 | - { |
|
69 | - return $admin |
|
70 | - ? "//fieldset[starts-with(@id, 'ee-registration-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]" |
|
71 | - : "//div[starts-with(@id, 'spco-attendee-panel-dv-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]"; |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * @param string $payment_method_slug Slug for the payment method. |
|
77 | - * @return string |
|
78 | - */ |
|
79 | - public static function fieldSelectorForPaymentOption($payment_method_slug) |
|
80 | - { |
|
81 | - return "#ee-available-payment-method-inputs-{$payment_method_slug}"; |
|
82 | - } |
|
16 | + /** |
|
17 | + * The class selector for the next step button in the checkout. |
|
18 | + * @var string |
|
19 | + */ |
|
20 | + const NEXT_STEP_BUTTON_SELECTOR = '.spco-next-step-btn'; |
|
21 | + |
|
22 | + |
|
23 | + const PAYMENT_METHOD_STEP_FORM = '#ee-spco-payment_options-reg-step-form'; |
|
24 | + |
|
25 | + |
|
26 | + const SELECTOR_PAYMENT_OPTIONS_CONTAINER = '#spco-available-methods-of-payment-dv'; |
|
27 | + |
|
28 | + |
|
29 | + /** |
|
30 | + * @param int $attendee_number |
|
31 | + * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
32 | + * @return string |
|
33 | + */ |
|
34 | + public static function firstNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false) |
|
35 | + { |
|
36 | + return self::fieldSelectorForAttendeeNumber('fname', $attendee_number, $admin); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * @param int $attendee_number |
|
42 | + * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
43 | + * @return string |
|
44 | + */ |
|
45 | + public static function lastNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false) |
|
46 | + { |
|
47 | + return self::fieldSelectorForAttendeeNumber('lname', $attendee_number, $admin); |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * @param int $attendee_number |
|
53 | + * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + public static function emailFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false) |
|
57 | + { |
|
58 | + return self::fieldSelectorForAttendeeNumber('email', $attendee_number, $admin); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * @param string $field_name |
|
63 | + * @param int $attendee_number |
|
64 | + * @param bool $admin Used to indicate whether we're retrieving the selector from the context of the admin or not. |
|
65 | + * @return string |
|
66 | + */ |
|
67 | + public static function fieldSelectorForAttendeeNumber($field_name, $attendee_number = 1, $admin = false) |
|
68 | + { |
|
69 | + return $admin |
|
70 | + ? "//fieldset[starts-with(@id, 'ee-registration-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]" |
|
71 | + : "//div[starts-with(@id, 'spco-attendee-panel-dv-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]"; |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * @param string $payment_method_slug Slug for the payment method. |
|
77 | + * @return string |
|
78 | + */ |
|
79 | + public static function fieldSelectorForPaymentOption($payment_method_slug) |
|
80 | + { |
|
81 | + return "#ee-available-payment-method-inputs-{$payment_method_slug}"; |
|
82 | + } |
|
83 | 83 | } |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | public function ticketDatetimeAvailability(EE_Ticket $ticket, $get_original_ticket_spaces = false) |
67 | 67 | { |
68 | 68 | // if the $_available_spaces array has not been set up yet... |
69 | - if (! isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
69 | + if ( ! isset($this->available_spaces['tickets'][$ticket->ID()])) { |
|
70 | 70 | $this->setInitialTicketDatetimeAvailability($ticket); |
71 | 71 | } |
72 | 72 | $available_spaces = $ticket->qty() - $ticket->sold(); |
73 | - if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
73 | + if (isset($this->available_spaces['tickets'][$ticket->ID()])) { |
|
74 | 74 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
75 | - foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) { |
|
75 | + foreach ($this->available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
76 | 76 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
77 | 77 | if ($get_original_ticket_spaces) { |
78 | 78 | // then grab the available spaces from the "tickets" array |
79 | 79 | // and compare with the above to get the lowest number |
80 | 80 | $available_spaces = min( |
81 | 81 | $available_spaces, |
82 | - $this->available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] |
|
82 | + $this->available_spaces['tickets'][$ticket->ID()][$DTD_ID] |
|
83 | 83 | ); |
84 | 84 | } else { |
85 | 85 | // we want the updated ticket availability as stored in the "datetimes" array |
86 | - $available_spaces = min($available_spaces, $this->available_spaces['datetimes'][ $DTD_ID ]); |
|
86 | + $available_spaces = min($available_spaces, $this->available_spaces['datetimes'][$DTD_ID]); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | 'order_by' => array('DTT_EVT_start' => 'ASC'), |
115 | 115 | ) |
116 | 116 | ); |
117 | - if (! empty($datetimes)) { |
|
117 | + if ( ! empty($datetimes)) { |
|
118 | 118 | // now loop thru all of the datetimes |
119 | 119 | foreach ($datetimes as $datetime) { |
120 | 120 | if ($datetime instanceof EE_Datetime) { |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | $spaces_remaining = $datetime->spaces_remaining(); |
123 | 123 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold |
124 | 124 | // or the datetime spaces remaining) to this ticket using the datetime ID as the key |
125 | - $this->available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min( |
|
125 | + $this->available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min( |
|
126 | 126 | $ticket->qty() - $ticket->sold(), |
127 | 127 | $spaces_remaining |
128 | 128 | ); |
129 | 129 | // if the remaining spaces for this datetime is already set, |
130 | 130 | // then compare that against the datetime spaces remaining, and take the lowest number, |
131 | 131 | // else just take the datetime spaces remaining, and assign to the datetimes array |
132 | - $this->available_spaces['datetimes'][ $datetime->ID() ] = isset( |
|
133 | - $this->available_spaces['datetimes'][ $datetime->ID() ] |
|
132 | + $this->available_spaces['datetimes'][$datetime->ID()] = isset( |
|
133 | + $this->available_spaces['datetimes'][$datetime->ID()] |
|
134 | 134 | ) |
135 | - ? min($this->available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining) |
|
135 | + ? min($this->available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) |
|
136 | 136 | : $spaces_remaining; |
137 | 137 | } |
138 | 138 | } |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public function recalculateTicketDatetimeAvailability(EE_Ticket $ticket, $qty = 0) |
150 | 150 | { |
151 | - if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
151 | + if (isset($this->available_spaces['tickets'][$ticket->ID()])) { |
|
152 | 152 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
153 | - foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) { |
|
153 | + foreach ($this->available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
154 | 154 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
155 | - $this->available_spaces['datetimes'][ $DTD_ID ] -= $qty; |
|
155 | + $this->available_spaces['datetimes'][$DTD_ID] -= $qty; |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
@@ -21,217 +21,217 @@ |
||
21 | 21 | */ |
22 | 22 | class TicketDatetimeAvailabilityTracker |
23 | 23 | { |
24 | - /** |
|
25 | - * array of datetimes and the spaces available for them |
|
26 | - * |
|
27 | - * @var array[][] |
|
28 | - */ |
|
29 | - private $available_spaces = array(); |
|
30 | - |
|
31 | - /** |
|
32 | - * @var EEM_Datetime $datetime_model |
|
33 | - */ |
|
34 | - private $datetime_model; |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * TicketDatetimeAvailabilityTracker constructor. |
|
39 | - * |
|
40 | - * @param EEM_Datetime $datetime_model |
|
41 | - */ |
|
42 | - public function __construct(EEM_Datetime $datetime_model) |
|
43 | - { |
|
44 | - $this->datetime_model = $datetime_model; |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * ticketDatetimeAvailability |
|
50 | - * creates an array of tickets plus all of the datetimes available to each ticket |
|
51 | - * and tracks the spaces remaining for each of those datetimes |
|
52 | - * |
|
53 | - * @param EE_Ticket $ticket - selected ticket |
|
54 | - * @param bool $get_original_ticket_spaces |
|
55 | - * @return int |
|
56 | - * @throws EE_Error |
|
57 | - * @throws InvalidArgumentException |
|
58 | - * @throws InvalidDataTypeException |
|
59 | - * @throws InvalidInterfaceException |
|
60 | - */ |
|
61 | - public function ticketDatetimeAvailability(EE_Ticket $ticket, $get_original_ticket_spaces = false) |
|
62 | - { |
|
63 | - // if the $_available_spaces array has not been set up yet... |
|
64 | - if (! isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
65 | - $this->setInitialTicketDatetimeAvailability($ticket); |
|
66 | - } |
|
67 | - $available_spaces = $ticket->qty() - $ticket->sold(); |
|
68 | - if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
69 | - // loop thru tickets, which will ALSO include individual ticket records AND a total |
|
70 | - foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) { |
|
71 | - // if we want the original datetime availability BEFORE we started subtracting tickets ? |
|
72 | - if ($get_original_ticket_spaces) { |
|
73 | - // then grab the available spaces from the "tickets" array |
|
74 | - // and compare with the above to get the lowest number |
|
75 | - $available_spaces = min( |
|
76 | - $available_spaces, |
|
77 | - $this->available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] |
|
78 | - ); |
|
79 | - } else { |
|
80 | - // we want the updated ticket availability as stored in the "datetimes" array |
|
81 | - $available_spaces = min($available_spaces, $this->available_spaces['datetimes'][ $DTD_ID ]); |
|
82 | - } |
|
83 | - } |
|
84 | - } |
|
85 | - return $available_spaces; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - /** |
|
90 | - * @param EE_Ticket $ticket |
|
91 | - * @return void |
|
92 | - * @throws InvalidArgumentException |
|
93 | - * @throws InvalidInterfaceException |
|
94 | - * @throws InvalidDataTypeException |
|
95 | - * @throws EE_Error |
|
96 | - */ |
|
97 | - private function setInitialTicketDatetimeAvailability(EE_Ticket $ticket) |
|
98 | - { |
|
99 | - // first, get all of the datetimes that are available to this ticket |
|
100 | - $datetimes = $ticket->get_many_related( |
|
101 | - 'Datetime', |
|
102 | - array( |
|
103 | - array( |
|
104 | - 'DTT_EVT_end' => array( |
|
105 | - '>=', |
|
106 | - $this->datetime_model->current_time_for_query('DTT_EVT_end'), |
|
107 | - ), |
|
108 | - ), |
|
109 | - 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
110 | - ) |
|
111 | - ); |
|
112 | - if (! empty($datetimes)) { |
|
113 | - // now loop thru all of the datetimes |
|
114 | - foreach ($datetimes as $datetime) { |
|
115 | - if ($datetime instanceof EE_Datetime) { |
|
116 | - // the number of spaces available for the datetime without considering individual ticket quantities |
|
117 | - $spaces_remaining = $datetime->spaces_remaining(); |
|
118 | - // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold |
|
119 | - // or the datetime spaces remaining) to this ticket using the datetime ID as the key |
|
120 | - $this->available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min( |
|
121 | - $ticket->qty() - $ticket->sold(), |
|
122 | - $spaces_remaining |
|
123 | - ); |
|
124 | - // if the remaining spaces for this datetime is already set, |
|
125 | - // then compare that against the datetime spaces remaining, and take the lowest number, |
|
126 | - // else just take the datetime spaces remaining, and assign to the datetimes array |
|
127 | - $this->available_spaces['datetimes'][ $datetime->ID() ] = isset( |
|
128 | - $this->available_spaces['datetimes'][ $datetime->ID() ] |
|
129 | - ) |
|
130 | - ? min($this->available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining) |
|
131 | - : $spaces_remaining; |
|
132 | - } |
|
133 | - } |
|
134 | - } |
|
135 | - } |
|
136 | - |
|
137 | - |
|
138 | - /** |
|
139 | - * @param EE_Ticket $ticket |
|
140 | - * @param int $qty |
|
141 | - * @return void |
|
142 | - * @throws EE_Error |
|
143 | - */ |
|
144 | - public function recalculateTicketDatetimeAvailability(EE_Ticket $ticket, $qty = 0) |
|
145 | - { |
|
146 | - if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
147 | - // loop thru tickets, which will ALSO include individual ticket records AND a total |
|
148 | - foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) { |
|
149 | - // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
|
150 | - $this->available_spaces['datetimes'][ $DTD_ID ] -= $qty; |
|
151 | - } |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * @param EE_Ticket $ticket |
|
158 | - * @param $qty |
|
159 | - * @param int $total_ticket_count |
|
160 | - * @throws EE_Error |
|
161 | - * @throws InvalidArgumentException |
|
162 | - * @throws InvalidDataTypeException |
|
163 | - * @throws InvalidInterfaceException |
|
164 | - */ |
|
165 | - public function processAvailabilityError(EE_Ticket $ticket, $qty, $total_ticket_count = 1) |
|
166 | - { |
|
167 | - // tickets can not be purchased but let's find the exact number left |
|
168 | - // for the last ticket selected PRIOR to subtracting tickets |
|
169 | - $available_spaces = $this->ticketDatetimeAvailability($ticket, true); |
|
170 | - // greedy greedy greedy eh? |
|
171 | - if ($available_spaces > 0) { |
|
172 | - if ( |
|
173 | - apply_filters( |
|
174 | - 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error', |
|
175 | - true, |
|
176 | - $ticket, |
|
177 | - $qty, |
|
178 | - $available_spaces |
|
179 | - ) |
|
180 | - ) { |
|
181 | - $this->availabilityError( |
|
182 | - $available_spaces, |
|
183 | - $total_ticket_count |
|
184 | - ); |
|
185 | - } |
|
186 | - } else { |
|
187 | - EE_Error::add_error( |
|
188 | - esc_html__( |
|
189 | - 'We\'re sorry, but there are no available spaces left for this event at this particular date and time.', |
|
190 | - 'event_espresso' |
|
191 | - ), |
|
192 | - __FILE__, |
|
193 | - __FUNCTION__, |
|
194 | - __LINE__ |
|
195 | - ); |
|
196 | - } |
|
197 | - } |
|
198 | - |
|
199 | - |
|
200 | - /** |
|
201 | - * @param int $available_spaces |
|
202 | - * @param int $total_ticket_count |
|
203 | - */ |
|
204 | - private function availabilityError($available_spaces = 1, $total_ticket_count = 1) |
|
205 | - { |
|
206 | - // add error messaging - we're using the _n function that will generate |
|
207 | - // the appropriate singular or plural message based on the number of $available_spaces |
|
208 | - if ($total_ticket_count) { |
|
209 | - $msg = sprintf( |
|
210 | - esc_html( |
|
211 | - _n( |
|
212 | - 'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.', |
|
213 | - 'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.', |
|
214 | - $available_spaces, |
|
215 | - 'event_espresso' |
|
216 | - ) |
|
217 | - ), |
|
218 | - $available_spaces, |
|
219 | - '<br />' |
|
220 | - ); |
|
221 | - } else { |
|
222 | - $msg = sprintf( |
|
223 | - esc_html( |
|
224 | - _n( |
|
225 | - 'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets.', |
|
226 | - 'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets.', |
|
227 | - $available_spaces, |
|
228 | - 'event_espresso' |
|
229 | - ) |
|
230 | - ), |
|
231 | - $available_spaces, |
|
232 | - '<br />' |
|
233 | - ); |
|
234 | - } |
|
235 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
236 | - } |
|
24 | + /** |
|
25 | + * array of datetimes and the spaces available for them |
|
26 | + * |
|
27 | + * @var array[][] |
|
28 | + */ |
|
29 | + private $available_spaces = array(); |
|
30 | + |
|
31 | + /** |
|
32 | + * @var EEM_Datetime $datetime_model |
|
33 | + */ |
|
34 | + private $datetime_model; |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * TicketDatetimeAvailabilityTracker constructor. |
|
39 | + * |
|
40 | + * @param EEM_Datetime $datetime_model |
|
41 | + */ |
|
42 | + public function __construct(EEM_Datetime $datetime_model) |
|
43 | + { |
|
44 | + $this->datetime_model = $datetime_model; |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * ticketDatetimeAvailability |
|
50 | + * creates an array of tickets plus all of the datetimes available to each ticket |
|
51 | + * and tracks the spaces remaining for each of those datetimes |
|
52 | + * |
|
53 | + * @param EE_Ticket $ticket - selected ticket |
|
54 | + * @param bool $get_original_ticket_spaces |
|
55 | + * @return int |
|
56 | + * @throws EE_Error |
|
57 | + * @throws InvalidArgumentException |
|
58 | + * @throws InvalidDataTypeException |
|
59 | + * @throws InvalidInterfaceException |
|
60 | + */ |
|
61 | + public function ticketDatetimeAvailability(EE_Ticket $ticket, $get_original_ticket_spaces = false) |
|
62 | + { |
|
63 | + // if the $_available_spaces array has not been set up yet... |
|
64 | + if (! isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
65 | + $this->setInitialTicketDatetimeAvailability($ticket); |
|
66 | + } |
|
67 | + $available_spaces = $ticket->qty() - $ticket->sold(); |
|
68 | + if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
69 | + // loop thru tickets, which will ALSO include individual ticket records AND a total |
|
70 | + foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) { |
|
71 | + // if we want the original datetime availability BEFORE we started subtracting tickets ? |
|
72 | + if ($get_original_ticket_spaces) { |
|
73 | + // then grab the available spaces from the "tickets" array |
|
74 | + // and compare with the above to get the lowest number |
|
75 | + $available_spaces = min( |
|
76 | + $available_spaces, |
|
77 | + $this->available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] |
|
78 | + ); |
|
79 | + } else { |
|
80 | + // we want the updated ticket availability as stored in the "datetimes" array |
|
81 | + $available_spaces = min($available_spaces, $this->available_spaces['datetimes'][ $DTD_ID ]); |
|
82 | + } |
|
83 | + } |
|
84 | + } |
|
85 | + return $available_spaces; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + /** |
|
90 | + * @param EE_Ticket $ticket |
|
91 | + * @return void |
|
92 | + * @throws InvalidArgumentException |
|
93 | + * @throws InvalidInterfaceException |
|
94 | + * @throws InvalidDataTypeException |
|
95 | + * @throws EE_Error |
|
96 | + */ |
|
97 | + private function setInitialTicketDatetimeAvailability(EE_Ticket $ticket) |
|
98 | + { |
|
99 | + // first, get all of the datetimes that are available to this ticket |
|
100 | + $datetimes = $ticket->get_many_related( |
|
101 | + 'Datetime', |
|
102 | + array( |
|
103 | + array( |
|
104 | + 'DTT_EVT_end' => array( |
|
105 | + '>=', |
|
106 | + $this->datetime_model->current_time_for_query('DTT_EVT_end'), |
|
107 | + ), |
|
108 | + ), |
|
109 | + 'order_by' => array('DTT_EVT_start' => 'ASC'), |
|
110 | + ) |
|
111 | + ); |
|
112 | + if (! empty($datetimes)) { |
|
113 | + // now loop thru all of the datetimes |
|
114 | + foreach ($datetimes as $datetime) { |
|
115 | + if ($datetime instanceof EE_Datetime) { |
|
116 | + // the number of spaces available for the datetime without considering individual ticket quantities |
|
117 | + $spaces_remaining = $datetime->spaces_remaining(); |
|
118 | + // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold |
|
119 | + // or the datetime spaces remaining) to this ticket using the datetime ID as the key |
|
120 | + $this->available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min( |
|
121 | + $ticket->qty() - $ticket->sold(), |
|
122 | + $spaces_remaining |
|
123 | + ); |
|
124 | + // if the remaining spaces for this datetime is already set, |
|
125 | + // then compare that against the datetime spaces remaining, and take the lowest number, |
|
126 | + // else just take the datetime spaces remaining, and assign to the datetimes array |
|
127 | + $this->available_spaces['datetimes'][ $datetime->ID() ] = isset( |
|
128 | + $this->available_spaces['datetimes'][ $datetime->ID() ] |
|
129 | + ) |
|
130 | + ? min($this->available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining) |
|
131 | + : $spaces_remaining; |
|
132 | + } |
|
133 | + } |
|
134 | + } |
|
135 | + } |
|
136 | + |
|
137 | + |
|
138 | + /** |
|
139 | + * @param EE_Ticket $ticket |
|
140 | + * @param int $qty |
|
141 | + * @return void |
|
142 | + * @throws EE_Error |
|
143 | + */ |
|
144 | + public function recalculateTicketDatetimeAvailability(EE_Ticket $ticket, $qty = 0) |
|
145 | + { |
|
146 | + if (isset($this->available_spaces['tickets'][ $ticket->ID() ])) { |
|
147 | + // loop thru tickets, which will ALSO include individual ticket records AND a total |
|
148 | + foreach ($this->available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces) { |
|
149 | + // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
|
150 | + $this->available_spaces['datetimes'][ $DTD_ID ] -= $qty; |
|
151 | + } |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * @param EE_Ticket $ticket |
|
158 | + * @param $qty |
|
159 | + * @param int $total_ticket_count |
|
160 | + * @throws EE_Error |
|
161 | + * @throws InvalidArgumentException |
|
162 | + * @throws InvalidDataTypeException |
|
163 | + * @throws InvalidInterfaceException |
|
164 | + */ |
|
165 | + public function processAvailabilityError(EE_Ticket $ticket, $qty, $total_ticket_count = 1) |
|
166 | + { |
|
167 | + // tickets can not be purchased but let's find the exact number left |
|
168 | + // for the last ticket selected PRIOR to subtracting tickets |
|
169 | + $available_spaces = $this->ticketDatetimeAvailability($ticket, true); |
|
170 | + // greedy greedy greedy eh? |
|
171 | + if ($available_spaces > 0) { |
|
172 | + if ( |
|
173 | + apply_filters( |
|
174 | + 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error', |
|
175 | + true, |
|
176 | + $ticket, |
|
177 | + $qty, |
|
178 | + $available_spaces |
|
179 | + ) |
|
180 | + ) { |
|
181 | + $this->availabilityError( |
|
182 | + $available_spaces, |
|
183 | + $total_ticket_count |
|
184 | + ); |
|
185 | + } |
|
186 | + } else { |
|
187 | + EE_Error::add_error( |
|
188 | + esc_html__( |
|
189 | + 'We\'re sorry, but there are no available spaces left for this event at this particular date and time.', |
|
190 | + 'event_espresso' |
|
191 | + ), |
|
192 | + __FILE__, |
|
193 | + __FUNCTION__, |
|
194 | + __LINE__ |
|
195 | + ); |
|
196 | + } |
|
197 | + } |
|
198 | + |
|
199 | + |
|
200 | + /** |
|
201 | + * @param int $available_spaces |
|
202 | + * @param int $total_ticket_count |
|
203 | + */ |
|
204 | + private function availabilityError($available_spaces = 1, $total_ticket_count = 1) |
|
205 | + { |
|
206 | + // add error messaging - we're using the _n function that will generate |
|
207 | + // the appropriate singular or plural message based on the number of $available_spaces |
|
208 | + if ($total_ticket_count) { |
|
209 | + $msg = sprintf( |
|
210 | + esc_html( |
|
211 | + _n( |
|
212 | + 'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.', |
|
213 | + 'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.', |
|
214 | + $available_spaces, |
|
215 | + 'event_espresso' |
|
216 | + ) |
|
217 | + ), |
|
218 | + $available_spaces, |
|
219 | + '<br />' |
|
220 | + ); |
|
221 | + } else { |
|
222 | + $msg = sprintf( |
|
223 | + esc_html( |
|
224 | + _n( |
|
225 | + 'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets.', |
|
226 | + 'We\'re sorry, but there are only %1$s available spaces left for this event at this particular date and time. Please select a different number (or different combination) of tickets.', |
|
227 | + $available_spaces, |
|
228 | + 'event_espresso' |
|
229 | + ) |
|
230 | + ), |
|
231 | + $available_spaces, |
|
232 | + '<br />' |
|
233 | + ); |
|
234 | + } |
|
235 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
236 | + } |
|
237 | 237 | } |