@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
222 | - * retrieve ALL registrations for a particular Attendee from db |
|
223 | - * @access public |
|
224 | - * @param int $ATT_ID |
|
225 | - * @return EE_Registration[] |
|
226 | - */ |
|
222 | + * retrieve ALL registrations for a particular Attendee from db |
|
223 | + * @access public |
|
224 | + * @param int $ATT_ID |
|
225 | + * @return EE_Registration[] |
|
226 | + */ |
|
227 | 227 | public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
228 | 228 | if ( ! $ATT_ID ) { |
229 | 229 | return FALSE; |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | |
251 | 251 | |
252 | 252 | /** |
253 | - * retrieve registration for a specific transaction attendee from db |
|
254 | - * |
|
255 | - * @access public |
|
256 | - * @param int $TXN_ID |
|
257 | - * @param int $ATT_ID |
|
258 | - * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | - * @return mixed array on success, FALSE on fail |
|
260 | - */ |
|
253 | + * retrieve registration for a specific transaction attendee from db |
|
254 | + * |
|
255 | + * @access public |
|
256 | + * @param int $TXN_ID |
|
257 | + * @param int $ATT_ID |
|
258 | + * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
|
259 | + * @return mixed array on success, FALSE on fail |
|
260 | + */ |
|
261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
262 | 262 | return $this->get_one(array( |
263 | 263 | array( |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | |
271 | 271 | |
272 | 272 | /** |
273 | - * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
273 | + * get the number of registrations per day for the Registration Admin page Reports Tab. |
|
274 | 274 | * (doesn't utilize models because it's a fairly specialized query) |
275 | - * @access public |
|
275 | + * @access public |
|
276 | 276 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
277 | 277 | * @return stdClass[] with properties regDate and total |
278 | - */ |
|
278 | + */ |
|
279 | 279 | public function get_registrations_per_day_report( $period = '-1 month' ) { |
280 | 280 | |
281 | 281 | $sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | |
305 | 305 | |
306 | 306 | /** |
307 | - * get the number of registrations per event for the Registration Admin page Reports Tab |
|
308 | - * @access public |
|
307 | + * get the number of registrations per event for the Registration Admin page Reports Tab |
|
308 | + * @access public |
|
309 | 309 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
310 | 310 | * @return stdClass[] each with properties event_name, reg_limit, and total |
311 | - */ |
|
311 | + */ |
|
312 | 312 | public function get_registrations_per_event_report( $period = '-1 month' ) { |
313 | 313 | |
314 | 314 | $date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
3 | -require_once ( EE_CLASSES . 'EE_Registration.class.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
3 | +require_once (EE_CLASSES.'EE_Registration.class.php'); |
|
4 | 4 | /** |
5 | 5 | * |
6 | 6 | * Registration Model |
@@ -92,31 +92,31 @@ discard block |
||
92 | 92 | * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
93 | 93 | * @return \EEM_Registration |
94 | 94 | */ |
95 | - protected function __construct( $timezone ) { |
|
96 | - $this->singular_item = __('Registration','event_espresso'); |
|
97 | - $this->plural_item = __('Registrations','event_espresso'); |
|
95 | + protected function __construct($timezone) { |
|
96 | + $this->singular_item = __('Registration', 'event_espresso'); |
|
97 | + $this->plural_item = __('Registrations', 'event_espresso'); |
|
98 | 98 | |
99 | 99 | $this->_tables = array( |
100 | - 'Registration'=>new EE_Primary_Table('esp_registration','REG_ID') |
|
100 | + 'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID') |
|
101 | 101 | ); |
102 | 102 | $this->_fields = array( |
103 | 103 | 'Registration'=>array( |
104 | - 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')), |
|
105 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
106 | - 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'), |
|
107 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
108 | - 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'), |
|
109 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | - 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, time(), $timezone ), |
|
111 | - 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0), |
|
112 | - 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0), |
|
113 | - 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''), |
|
114 | - 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''), |
|
115 | - 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''), |
|
116 | - 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1), |
|
117 | - 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1), |
|
118 | - 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false), |
|
119 | - 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false ) |
|
104 | + 'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')), |
|
105 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
106 | + 'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'), |
|
107 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
108 | + 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'), |
|
109 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), |
|
110 | + 'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, time(), $timezone), |
|
111 | + 'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0), |
|
112 | + 'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0), |
|
113 | + 'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''), |
|
114 | + 'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''), |
|
115 | + 'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''), |
|
116 | + 'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1), |
|
117 | + 'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1), |
|
118 | + 'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false), |
|
119 | + 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false) |
|
120 | 120 | ) |
121 | 121 | ); |
122 | 122 | $this->_model_relations = array( |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | 'Answer'=>new EE_Has_Many_Relation(), |
129 | 129 | 'Checkin'=>new EE_Has_Many_Relation(), |
130 | 130 | 'Registration_Payment' => new EE_Has_Many_Relation(), |
131 | - 'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ), |
|
131 | + 'Payment'=>new EE_HABTM_Relation('Registration_Payment'), |
|
132 | 132 | ); |
133 | 133 | $this->_model_chain_to_wp_user = 'Event'; |
134 | 134 | |
135 | - parent::__construct( $timezone ); |
|
135 | + parent::__construct($timezone); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param bool $translated If true will return the values as singular localized strings |
166 | 166 | * @return array |
167 | 167 | */ |
168 | - public static function reg_status_array( $exclude = array(), $translated = FALSE ) { |
|
169 | - EEM_Registration::instance()->_get_registration_status_array( $exclude ); |
|
170 | - return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
168 | + public static function reg_status_array($exclude = array(), $translated = FALSE) { |
|
169 | + EEM_Registration::instance()->_get_registration_status_array($exclude); |
|
170 | + return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | * @param array $exclude |
179 | 179 | * @return array |
180 | 180 | */ |
181 | - private function _get_registration_status_array( $exclude = array() ) { |
|
181 | + private function _get_registration_status_array($exclude = array()) { |
|
182 | 182 | //in the very rare circumstance that we are deleting a model's table's data |
183 | 183 | //and the table hasn't actually been created, this could have an error |
184 | 184 | /** @type WPDB $wpdb */ |
185 | 185 | global $wpdb; |
186 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
187 | - if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){ |
|
188 | - $SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"'; |
|
189 | - $results = $wpdb->get_results( $SQL ); |
|
186 | + EE_Registry::instance()->load_helper('Activation'); |
|
187 | + if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) { |
|
188 | + $SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"'; |
|
189 | + $results = $wpdb->get_results($SQL); |
|
190 | 190 | self::$_reg_status = array(); |
191 | - foreach ( $results as $status ) { |
|
192 | - if ( ! in_array( $status->STS_ID, $exclude )) { |
|
193 | - self::$_reg_status[ $status->STS_ID ] = $status->STS_code; |
|
191 | + foreach ($results as $status) { |
|
192 | + if ( ! in_array($status->STS_ID, $exclude)) { |
|
193 | + self::$_reg_status[$status->STS_ID] = $status->STS_code; |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | } |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | * @param array $where_params Array of query_params as described in the comments for EEM_Base::get_all() |
206 | 206 | * @return wpdb results array |
207 | 207 | */ |
208 | - public function get_reg_months_and_years( $where_params ) { |
|
208 | + public function get_reg_months_and_years($where_params) { |
|
209 | 209 | $query_params[0] = $where_params; |
210 | 210 | $query_params['group_by'] = array('reg_year', 'reg_month'); |
211 | - $query_params['order_by'] = array( 'REG_date' => 'DESC' ); |
|
211 | + $query_params['order_by'] = array('REG_date' => 'DESC'); |
|
212 | 212 | $columns_to_select = array( |
213 | 213 | 'reg_year' => array('YEAR(REG_date)', '%s'), |
214 | 214 | 'reg_month' => array('MONTHNAME(REG_date)', '%s') |
215 | 215 | ); |
216 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
216 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | * @param int $ATT_ID |
226 | 226 | * @return EE_Registration[] |
227 | 227 | */ |
228 | - public function get_all_registrations_for_attendee( $ATT_ID = 0 ) { |
|
229 | - if ( ! $ATT_ID ) { |
|
228 | + public function get_all_registrations_for_attendee($ATT_ID = 0) { |
|
229 | + if ( ! $ATT_ID) { |
|
230 | 230 | return FALSE; |
231 | 231 | } |
232 | - return $this->get_all( array( array( 'ATT_ID' => $ATT_ID ))); |
|
232 | + return $this->get_all(array(array('ATT_ID' => $ATT_ID))); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | * @param string $REG_url_link |
241 | 241 | * @return EE_Registration |
242 | 242 | */ |
243 | - public function get_registration_for_reg_url_link($REG_url_link){ |
|
244 | - if(!$REG_url_link){ |
|
243 | + public function get_registration_for_reg_url_link($REG_url_link) { |
|
244 | + if ( ! $REG_url_link) { |
|
245 | 245 | return false; |
246 | 246 | } |
247 | 247 | return $this->get_one(array(array('REG_url_link'=>$REG_url_link))); |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
260 | 260 | * @return mixed array on success, FALSE on fail |
261 | 261 | */ |
262 | - public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
|
262 | + public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) { |
|
263 | 263 | return $this->get_one(array( |
264 | 264 | array( |
265 | 265 | 'TXN_ID'=>$TXN_ID, |
266 | 266 | 'ATT_ID'=>$ATT_ID |
267 | 267 | ), |
268 | - 'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 ) |
|
268 | + 'limit'=>array(min(($att_nmbr - 1), 0), 1) |
|
269 | 269 | )); |
270 | 270 | } |
271 | 271 | |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
278 | 278 | * @return stdClass[] with properties regDate and total |
279 | 279 | */ |
280 | - public function get_registrations_per_day_report( $period = '-1 month' ) { |
|
280 | + public function get_registrations_per_day_report($period = '-1 month') { |
|
281 | 281 | |
282 | - $sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' ); |
|
283 | - $where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
282 | + $sql_date = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
283 | + $where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
284 | 284 | |
285 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) { |
|
285 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) { |
|
286 | 286 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
287 | 287 | } |
288 | 288 | |
289 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
290 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' ); |
|
289 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
290 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date'); |
|
291 | 291 | |
292 | 292 | $results = $this->_get_all_wpdb_results( |
293 | 293 | array( |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | ), |
298 | 298 | OBJECT, |
299 | 299 | array( |
300 | - 'regDate'=>array( 'DATE(' . $query_interval . ')','%s'), |
|
301 | - 'total'=>array('count(REG_ID)','%d') |
|
300 | + 'regDate'=>array('DATE('.$query_interval.')', '%s'), |
|
301 | + 'total'=>array('count(REG_ID)', '%d') |
|
302 | 302 | )); |
303 | 303 | return $results; |
304 | 304 | } |
@@ -313,23 +313,23 @@ discard block |
||
313 | 313 | * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID |
314 | 314 | * (i.e. RAP) |
315 | 315 | */ |
316 | - public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) { |
|
316 | + public function get_registrations_per_day_and_per_status_report($period = '-1 month') { |
|
317 | 317 | global $wpdb; |
318 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
318 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
319 | 319 | $event_table = $wpdb->posts; |
320 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
320 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
321 | 321 | |
322 | 322 | //prepare the query interval for displaying offset |
323 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
324 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' ); |
|
323 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
324 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date'); |
|
325 | 325 | |
326 | 326 | //inner date query |
327 | 327 | $inner_date_query = "SELECT DISTINCT REG_date from $registration_table "; |
328 | 328 | $inner_where = " WHERE"; |
329 | 329 | //exclude events not authored by user if permissions in effect |
330 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
330 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
331 | 331 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
332 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
332 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
333 | 333 | } |
334 | 334 | $inner_where .= " REG_date >= '$sql_date'"; |
335 | 335 | $inner_date_query .= $inner_where; |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | $select_parts = array(); |
342 | 342 | |
343 | 343 | //loop through registration stati to do parts for each status. |
344 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
345 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
344 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
345 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
346 | 346 | continue; |
347 | 347 | } |
348 | 348 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | //setup the selects |
353 | - $select .= implode(', ', $select_parts ); |
|
353 | + $select .= implode(', ', $select_parts); |
|
354 | 354 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN "; |
355 | 355 | |
356 | 356 | //setup the joins |
357 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
357 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
358 | 358 | |
359 | 359 | //now let's put it all together |
360 | - $query = $select . $join . ' GROUP BY Registration_REG_date'; |
|
360 | + $query = $select.$join.' GROUP BY Registration_REG_date'; |
|
361 | 361 | |
362 | 362 | //and execute it |
363 | 363 | $results = $wpdb->get_results( |
@@ -378,23 +378,23 @@ discard block |
||
378 | 378 | * @param $period string which can be passed to php's strtotime function (eg "-1 month") |
379 | 379 | * @return stdClass[] each with properties event_name, reg_limit, and total |
380 | 380 | */ |
381 | - public function get_registrations_per_event_report( $period = '-1 month' ) { |
|
381 | + public function get_registrations_per_event_report($period = '-1 month') { |
|
382 | 382 | |
383 | - $date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' ); |
|
384 | - $where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ); |
|
383 | + $date_sql = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC'); |
|
384 | + $where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)); |
|
385 | 385 | |
386 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
386 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
387 | 387 | $where['Event.EVT_wp_user'] = get_current_user_id(); |
388 | 388 | } |
389 | 389 | $results = $this->_get_all_wpdb_results(array( |
390 | 390 | $where, |
391 | 391 | 'group_by'=>'Event.EVT_name', |
392 | 392 | 'order_by'=>'Event.EVT_name', |
393 | - 'limit'=>array(0,24)), |
|
393 | + 'limit'=>array(0, 24)), |
|
394 | 394 | OBJECT, |
395 | 395 | array( |
396 | - 'event_name'=>array('Event_CPT.post_title','%s'), |
|
397 | - 'total'=>array('COUNT(REG_ID)','%s') |
|
396 | + 'event_name'=>array('Event_CPT.post_title', '%s'), |
|
397 | + 'total'=>array('COUNT(REG_ID)', '%s') |
|
398 | 398 | ) |
399 | 399 | ); |
400 | 400 | |
@@ -412,19 +412,19 @@ discard block |
||
412 | 412 | * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID |
413 | 413 | * (i.e. RAP) |
414 | 414 | */ |
415 | - public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) { |
|
415 | + public function get_registrations_per_event_and_per_status_report($period = '-1 month') { |
|
416 | 416 | global $wpdb; |
417 | - $registration_table = $wpdb->prefix . 'esp_registration'; |
|
417 | + $registration_table = $wpdb->prefix.'esp_registration'; |
|
418 | 418 | $event_table = $wpdb->posts; |
419 | - $sql_date = date("Y-m-d H:i:s", strtotime($period) ); |
|
419 | + $sql_date = date("Y-m-d H:i:s", strtotime($period)); |
|
420 | 420 | |
421 | 421 | //inner date query |
422 | 422 | $inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table "; |
423 | 423 | $inner_where = " WHERE"; |
424 | 424 | //exclude events not authored by user if permissions in effect |
425 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) { |
|
425 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) { |
|
426 | 426 | $inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID"; |
427 | - $inner_where .= " post_author = " . get_current_user_id() . " AND"; |
|
427 | + $inner_where .= " post_author = ".get_current_user_id()." AND"; |
|
428 | 428 | } |
429 | 429 | $inner_where .= " REG_date >= '$sql_date'"; |
430 | 430 | $inner_date_query .= $inner_where; |
@@ -436,8 +436,8 @@ discard block |
||
436 | 436 | $select_parts = array(); |
437 | 437 | |
438 | 438 | //loop through registration stati to do parts for each status. |
439 | - foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) { |
|
440 | - if ( $STS_ID === EEM_Registration::status_id_incomplete ) { |
|
439 | + foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) { |
|
440 | + if ($STS_ID === EEM_Registration::status_id_incomplete) { |
|
441 | 441 | continue; |
442 | 442 | } |
443 | 443 | $select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID"; |
@@ -445,14 +445,14 @@ discard block |
||
445 | 445 | } |
446 | 446 | |
447 | 447 | //setup the selects |
448 | - $select .= implode( ', ', $select_parts ); |
|
448 | + $select .= implode(', ', $select_parts); |
|
449 | 449 | $select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN "; |
450 | 450 | |
451 | 451 | //setup remaining joins |
452 | - $join .= implode( " LEFT JOIN ", $join_parts ); |
|
452 | + $join .= implode(" LEFT JOIN ", $join_parts); |
|
453 | 453 | |
454 | 454 | //now put it all together |
455 | - $query = $select . $join . ' GROUP BY Registration_Event'; |
|
455 | + $query = $select.$join.' GROUP BY Registration_Event'; |
|
456 | 456 | |
457 | 457 | //and execute |
458 | 458 | $results = $wpdb->get_results( |
@@ -468,11 +468,11 @@ discard block |
||
468 | 468 | * @param int $TXN_ID |
469 | 469 | * @return EE_Registration |
470 | 470 | */ |
471 | - public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){ |
|
472 | - if( ! $TXN_ID ){ |
|
471 | + public function get_primary_registration_for_transaction_ID($TXN_ID = 0) { |
|
472 | + if ( ! $TXN_ID) { |
|
473 | 473 | return false; |
474 | 474 | } |
475 | - return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
475 | + return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=> EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | * @param boolean $for_incomplete_payments |
485 | 485 | * @return int |
486 | 486 | */ |
487 | - public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) { |
|
487 | + public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) { |
|
488 | 488 | // we only count approved registrations towards registration limits |
489 | - $query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) ); |
|
490 | - if( $for_incomplete_payments ){ |
|
491 | - $query_params[0]['Transaction.STS_ID']=array('!=', EEM_Transaction::complete_status_code); |
|
489 | + $query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved)); |
|
490 | + if ($for_incomplete_payments) { |
|
491 | + $query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | return $this->count($query_params); |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | /** @type WPDB $wpdb */ |
505 | 505 | global $wpdb; |
506 | 506 | return $wpdb->query( |
507 | - 'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
507 | + 'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' ); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | /** |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
515 | 515 | * @return int |
516 | 516 | */ |
517 | - public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) { |
|
517 | + public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) { |
|
518 | 518 | return $this->count( |
519 | 519 | array( |
520 | 520 | array( |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @param boolean $checked_in whether to count registrations checked IN or OUT |
533 | 533 | * @return int |
534 | 534 | */ |
535 | - public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) { |
|
535 | + public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) { |
|
536 | 536 | return $this->count( |
537 | 537 | array( |
538 | 538 | array( |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | 2 | /** |
3 | - * EE_Email_Input |
|
4 | - * |
|
5 | - * @package Event Espresso |
|
6 | - * @subpackage |
|
7 | - * @author Mike Nelson |
|
8 | - */ |
|
3 | + * EE_Email_Input |
|
4 | + * |
|
5 | + * @package Event Espresso |
|
6 | + * @subpackage |
|
7 | + * @author Mike Nelson |
|
8 | + */ |
|
9 | 9 | class EE_Email_Input extends EE_Form_Input_Base{ |
10 | 10 | |
11 | 11 | /** |
@@ -6,22 +6,22 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Email_Input extends EE_Form_Input_Base{ |
|
9 | +class EE_Email_Input extends EE_Form_Input_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $input_settings |
13 | 13 | */ |
14 | - function __construct( $input_settings = array() ){ |
|
15 | - $this->_set_display_strategy( new EE_Text_Input_Display_Strategy('email') ); |
|
16 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
14 | + function __construct($input_settings = array()) { |
|
15 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
16 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
17 | 17 | $this->_add_validation_strategy( |
18 | 18 | new EE_Email_Validation_Strategy( |
19 | - isset( $input_settings[ 'validation_error_message' ] ) |
|
20 | - ? $input_settings[ 'validation_error_message' ] |
|
19 | + isset($input_settings['validation_error_message']) |
|
20 | + ? $input_settings['validation_error_message'] |
|
21 | 21 | : NULL |
22 | 22 | ) |
23 | 23 | ); |
24 | - parent::__construct( $input_settings ); |
|
25 | - $this->set_html_class( $this->html_class() . ' email' ); |
|
24 | + parent::__construct($input_settings); |
|
25 | + $this->set_html_class($this->html_class().' email'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This template will display The Loop that displays your venues |
|
4 | - * |
|
5 | - * @ package Event Espresso |
|
6 | - * @ author Seth Shoultes |
|
7 | - * @ copyright (c) 2008-2013 Event Espresso All Rights Reserved. |
|
8 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | - * @ link http://www.eventespresso.com |
|
10 | - * @ version 4+ |
|
11 | - */ |
|
3 | + * This template will display The Loop that displays your venues |
|
4 | + * |
|
5 | + * @ package Event Espresso |
|
6 | + * @ author Seth Shoultes |
|
7 | + * @ copyright (c) 2008-2013 Event Espresso All Rights Reserved. |
|
8 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | + * @ link http://www.eventespresso.com |
|
10 | + * @ version 4+ |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | if ( have_posts() ) : ?> |
14 | 14 |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * EEH_URL helper |
|
4 | - * Helper class for URL-related PHP functions |
|
5 | - * |
|
6 | - * @package Event Espresso |
|
7 | - * @subpackage /helper/EEH_URL.helper.php |
|
8 | - * @author Brent Christensen, Michael Nelson |
|
9 | - * |
|
10 | - * ------------------------------------------------------------------------ |
|
11 | - */ |
|
3 | + * EEH_URL helper |
|
4 | + * Helper class for URL-related PHP functions |
|
5 | + * |
|
6 | + * @package Event Espresso |
|
7 | + * @subpackage /helper/EEH_URL.helper.php |
|
8 | + * @author Brent Christensen, Michael Nelson |
|
9 | + * |
|
10 | + * ------------------------------------------------------------------------ |
|
11 | + */ |
|
12 | 12 | class EEH_URL{ |
13 | 13 | |
14 | 14 | /** |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * |
10 | 10 | * ------------------------------------------------------------------------ |
11 | 11 | */ |
12 | -class EEH_URL{ |
|
12 | +class EEH_URL { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * _add_query_arg |
@@ -21,30 +21,30 @@ discard block |
||
21 | 21 | * @param bool $exclude_nonce If true then the nonce will be excluded from the generated url. |
22 | 22 | * @return string |
23 | 23 | */ |
24 | - public static function add_query_args_and_nonce( $args = array(), $url = '', $exclude_nonce = false ) { |
|
25 | - if ( empty( $url ) ) { |
|
26 | - $user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso' ); |
|
27 | - $dev_msg = $user_msg . "\n" . sprintf( |
|
28 | - __('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso' ), |
|
24 | + public static function add_query_args_and_nonce($args = array(), $url = '', $exclude_nonce = false) { |
|
25 | + if (empty($url)) { |
|
26 | + $user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso'); |
|
27 | + $dev_msg = $user_msg."\n".sprintf( |
|
28 | + __('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso'), |
|
29 | 29 | __CLASS__ |
30 | 30 | ); |
31 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
31 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
32 | 32 | } |
33 | 33 | // check that an action exists and add nonce |
34 | - if ( ! $exclude_nonce ) { |
|
35 | - if ( isset( $args['action'] ) && ! empty( $args['action'] ) ) { |
|
36 | - $args = array_merge( $args, array( $args['action'] . '_nonce' => wp_create_nonce( $args['action'] . '_nonce' ) ) ); |
|
34 | + if ( ! $exclude_nonce) { |
|
35 | + if (isset($args['action']) && ! empty($args['action'])) { |
|
36 | + $args = array_merge($args, array($args['action'].'_nonce' => wp_create_nonce($args['action'].'_nonce'))); |
|
37 | 37 | } else { |
38 | - $args = array_merge( $args, array( 'action' => 'default', 'default_nonce' => wp_create_nonce( 'default_nonce' ) ) ); |
|
38 | + $args = array_merge($args, array('action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce'))); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | 42 | //finally, let's always add a return address (if present) :) |
43 | - $args = ! empty( $_REQUEST['action'] ) && ! isset( $_REQUEST[ 'return' ] ) |
|
44 | - ? array_merge( $args, array( 'return' => $_REQUEST['action'] ) ) |
|
43 | + $args = ! empty($_REQUEST['action']) && ! isset($_REQUEST['return']) |
|
44 | + ? array_merge($args, array('return' => $_REQUEST['action'])) |
|
45 | 45 | : $args; |
46 | 46 | |
47 | - return add_query_arg( $args, $url ); |
|
47 | + return add_query_arg($args, $url); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -57,17 +57,17 @@ discard block |
||
57 | 57 | * @param boolean $sslverify whether we care if the SSL certificate for the requested site is setup properly |
58 | 58 | * @return boolean |
59 | 59 | */ |
60 | - public static function remote_file_exists( $url, $args = array() ){ |
|
61 | - $results = wp_remote_request($url,array_merge( array( |
|
60 | + public static function remote_file_exists($url, $args = array()) { |
|
61 | + $results = wp_remote_request($url, array_merge(array( |
|
62 | 62 | 'method'=>'GET', |
63 | 63 | 'redirection'=>1 |
64 | - ), $args ) ); |
|
65 | - if( ! $results instanceof WP_Error && |
|
64 | + ), $args)); |
|
65 | + if ( ! $results instanceof WP_Error && |
|
66 | 66 | isset($results['response']) && |
67 | 67 | isset($results['response']['code']) && |
68 | - $results['response']['code'] == '200'){ |
|
68 | + $results['response']['code'] == '200') { |
|
69 | 69 | return true; |
70 | - }else{ |
|
70 | + } else { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | } |
@@ -83,29 +83,29 @@ discard block |
||
83 | 83 | * @param bool $base_url_only - TRUE will only return the scheme and host with no other parameters |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public static function refactor_url( $url = '', $remove_query = TRUE, $base_url_only = FALSE ) { |
|
86 | + public static function refactor_url($url = '', $remove_query = TRUE, $base_url_only = FALSE) { |
|
87 | 87 | // break apart incoming URL |
88 | - $url_bits = parse_url( $url ); |
|
88 | + $url_bits = parse_url($url); |
|
89 | 89 | // HTTP or HTTPS ? |
90 | - $scheme = isset( $url_bits[ 'scheme' ] ) ? $url_bits[ 'scheme' ] . '://' : 'http://'; |
|
90 | + $scheme = isset($url_bits['scheme']) ? $url_bits['scheme'].'://' : 'http://'; |
|
91 | 91 | // domain |
92 | - $host = isset( $url_bits[ 'host' ] ) ? $url_bits[ 'host' ] : ''; |
|
92 | + $host = isset($url_bits['host']) ? $url_bits['host'] : ''; |
|
93 | 93 | // if only the base URL is requested, then return that now |
94 | - if ( $base_url_only ) { |
|
95 | - return $scheme . $host; |
|
94 | + if ($base_url_only) { |
|
95 | + return $scheme.$host; |
|
96 | 96 | } |
97 | - $port = isset( $url_bits[ 'port' ] ) ? ':' . $url_bits[ 'port' ] : ''; |
|
98 | - $user = isset( $url_bits[ 'user' ] ) ? $url_bits[ 'user' ] : ''; |
|
99 | - $pass = isset( $url_bits[ 'pass' ] ) ? ':' . $url_bits[ 'pass' ] : ''; |
|
100 | - $pass = ( $user || $pass ) ? $pass . '@' : ''; |
|
101 | - $path = isset( $url_bits[ 'path' ] ) ? $url_bits[ 'path' ] : ''; |
|
97 | + $port = isset($url_bits['port']) ? ':'.$url_bits['port'] : ''; |
|
98 | + $user = isset($url_bits['user']) ? $url_bits['user'] : ''; |
|
99 | + $pass = isset($url_bits['pass']) ? ':'.$url_bits['pass'] : ''; |
|
100 | + $pass = ($user || $pass) ? $pass.'@' : ''; |
|
101 | + $path = isset($url_bits['path']) ? $url_bits['path'] : ''; |
|
102 | 102 | // if the query string is not required, then return what we have so far |
103 | - if ( $remove_query ) { |
|
104 | - return $scheme . $user . $pass . $host . $port . $path; |
|
103 | + if ($remove_query) { |
|
104 | + return $scheme.$user.$pass.$host.$port.$path; |
|
105 | 105 | } |
106 | - $query = isset( $url_bits[ 'query' ] ) ? '?' . $url_bits[ 'query' ] : ''; |
|
107 | - $fragment = isset( $url_bits[ 'fragment' ] ) ? '#' . $url_bits[ 'fragment' ] : ''; |
|
108 | - return $scheme . $user . $pass . $host . $port . $path . $query . $fragment; |
|
106 | + $query = isset($url_bits['query']) ? '?'.$url_bits['query'] : ''; |
|
107 | + $fragment = isset($url_bits['fragment']) ? '#'.$url_bits['fragment'] : ''; |
|
108 | + return $scheme.$user.$pass.$host.$port.$path.$query.$fragment; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -118,29 +118,29 @@ discard block |
||
118 | 118 | * @param bool $as_array TRUE (default) will return query params as an array of key value pairs, FALSE will simply return the query string |
119 | 119 | * @return string|array |
120 | 120 | */ |
121 | - public static function get_query_string( $url = '', $as_array = TRUE ) { |
|
121 | + public static function get_query_string($url = '', $as_array = TRUE) { |
|
122 | 122 | // break apart incoming URL |
123 | - $url_bits = parse_url( $url ); |
|
123 | + $url_bits = parse_url($url); |
|
124 | 124 | // grab query string from URL |
125 | - $query = isset( $url_bits[ 'query' ] ) ? $url_bits[ 'query' ] : ''; |
|
125 | + $query = isset($url_bits['query']) ? $url_bits['query'] : ''; |
|
126 | 126 | // if we don't want the query string formatted into an array of key => value pairs, then just return it as is |
127 | - if ( ! $as_array ) { |
|
127 | + if ( ! $as_array) { |
|
128 | 128 | return $query; |
129 | 129 | } |
130 | 130 | // if no query string exists then just return an empty array now |
131 | - if ( empty( $query )) { |
|
131 | + if (empty($query)) { |
|
132 | 132 | return array(); |
133 | 133 | } |
134 | 134 | // empty array to hold results |
135 | 135 | $query_params = array(); |
136 | 136 | // now break apart the query string into separate params |
137 | - $query = explode( '&', $query ); |
|
137 | + $query = explode('&', $query); |
|
138 | 138 | // loop thru our query params |
139 | - foreach ( $query as $query_args ) { |
|
139 | + foreach ($query as $query_args) { |
|
140 | 140 | // break apart the key value pairs |
141 | - $query_args = explode( '=', $query_args ); |
|
141 | + $query_args = explode('=', $query_args); |
|
142 | 142 | // and add to our results array |
143 | - $query_params[ $query_args[0] ] = $query_args[1]; |
|
143 | + $query_params[$query_args[0]] = $query_args[1]; |
|
144 | 144 | } |
145 | 145 | return $query_params; |
146 | 146 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * prevent_prefetching |
152 | 152 | * @return void |
153 | 153 | */ |
154 | - public static function prevent_prefetching(){ |
|
154 | + public static function prevent_prefetching() { |
|
155 | 155 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
156 | 156 | remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
157 | 157 | } |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | * @param string $prefix Use this to prefix the string with something. |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - public static function generate_unique_token( $prefix = '' ) { |
|
170 | - $token = md5( uniqid() . mt_rand() ); |
|
171 | - return $prefix ? $prefix . '_' . $token : $token; |
|
169 | + public static function generate_unique_token($prefix = '') { |
|
170 | + $token = md5(uniqid().mt_rand()); |
|
171 | + return $prefix ? $prefix.'_'.$token : $token; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * add_nocache_headers |
178 | 178 | * @return void |
179 | 179 | */ |
180 | - public static function add_nocache_headers(){ |
|
180 | + public static function add_nocache_headers() { |
|
181 | 181 | // add no cache headers |
182 | 182 | // add_action( 'wp_head' , array( 'EED_Single_Page_Checkout', 'nocache_headers' ), 10 ); |
183 | 183 | // plus a little extra for nginx |
@@ -194,19 +194,19 @@ discard block |
||
194 | 194 | * @param string $server_variable |
195 | 195 | * @return string |
196 | 196 | */ |
197 | - public static function filter_input_server_url( $server_variable = 'REQUEST_URI' ){ |
|
197 | + public static function filter_input_server_url($server_variable = 'REQUEST_URI') { |
|
198 | 198 | $URL = ''; |
199 | 199 | $server_variables = array( |
200 | 200 | 'REQUEST_URI' => 1, |
201 | 201 | 'HTTP_HOST' => 1, |
202 | 202 | 'PHP_SELF' => 1, |
203 | 203 | ); |
204 | - $server_variable = strtoupper( $server_variable ); |
|
204 | + $server_variable = strtoupper($server_variable); |
|
205 | 205 | // whitelist INPUT_SERVER var |
206 | - if ( isset( $server_variables[ $server_variable ] ) ) { |
|
207 | - $URL = filter_input( INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE ); |
|
208 | - if ( empty( $URL ) ) { |
|
209 | - $URL = esc_url( $_SERVER[ $server_variable ] ); |
|
206 | + if (isset($server_variables[$server_variable])) { |
|
207 | + $URL = filter_input(INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE); |
|
208 | + if (empty($URL)) { |
|
209 | + $URL = esc_url($_SERVER[$server_variable]); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | return $URL; |
@@ -1,26 +1,26 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | - * @ link http://www.eventespresso.com |
|
12 | - * @ version 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - * |
|
16 | - * Datetime Model |
|
17 | - * |
|
18 | - * @package Event Espresso |
|
19 | - * @subpackage includes/models/ |
|
20 | - * @author Brent Christensen |
|
21 | - * |
|
22 | - * ------------------------------------------------------------------------ |
|
23 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license http://eventespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
11 | + * @ link http://www.eventespresso.com |
|
12 | + * @ version 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + * |
|
16 | + * Datetime Model |
|
17 | + * |
|
18 | + * @package Event Espresso |
|
19 | + * @subpackage includes/models/ |
|
20 | + * @author Brent Christensen |
|
21 | + * |
|
22 | + * ------------------------------------------------------------------------ |
|
23 | + */ |
|
24 | 24 | require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
25 | 25 | require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
26 | 26 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | /** |
78 | - * create new blank datetime |
|
79 | - * |
|
80 | - * @access public |
|
81 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | - */ |
|
78 | + * create new blank datetime |
|
79 | + * |
|
80 | + * @access public |
|
81 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
82 | + */ |
|
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | |
101 | 101 | |
102 | 102 | /** |
103 | - * get event start date from db |
|
104 | - * |
|
105 | - * @access public |
|
106 | - * @param int $EVT_ID |
|
107 | - * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | - */ |
|
103 | + * get event start date from db |
|
104 | + * |
|
105 | + * @access public |
|
106 | + * @param int $EVT_ID |
|
107 | + * @return EE_Datetime[] array on success, FALSE on fail |
|
108 | + */ |
|
109 | 109 | public function get_all_event_dates( $EVT_ID = 0 ) { |
110 | 110 | if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
111 | 111 | return $this->create_new_blank_datetime(); |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
253 | - * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | - * only by start date |
|
255 | - * @param int $TKT_ID |
|
256 | - * @param boolean $include_expired |
|
257 | - * @param boolean $include_deleted |
|
258 | - * @param int $limit |
|
259 | - * @return EE_Datetime[] |
|
260 | - */ |
|
253 | + * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered |
|
254 | + * only by start date |
|
255 | + * @param int $TKT_ID |
|
256 | + * @param boolean $include_expired |
|
257 | + * @param boolean $include_deleted |
|
258 | + * @param int $limit |
|
259 | + * @return EE_Datetime[] |
|
260 | + */ |
|
261 | 261 | public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
262 | 262 | //sanitize TKT_ID |
263 | 263 | $TKT_ID = intval( $TKT_ID ); |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Datetime.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Datetime extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,28 +35,28 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Datetime','event_espresso'); |
|
40 | - $this->plural_item = __('Datetimes','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Datetime', 'event_espresso'); |
|
40 | + $this->plural_item = __('Datetimes', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Datetime'=>array( |
47 | - 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')), |
|
48 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
47 | + 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), |
|
48 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
49 | 49 | 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), |
50 | 50 | 'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), |
51 | - 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ), |
|
52 | - 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ), |
|
53 | - 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF), |
|
54 | - 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ), |
|
55 | - 'DTT_reserved' => new EE_Integer_Field('DTT_reserved',__('Quantity of tickets that are reserved, but not yet fully purchased','event_espresso'),false,0), |
|
56 | - 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false), |
|
51 | + 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF), |
|
54 | + 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), |
|
55 | + 'DTT_reserved' => new EE_Integer_Field('DTT_reserved', __('Quantity of tickets that are reserved, but not yet fully purchased', 'event_espresso'), false, 0), |
|
56 | + 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), |
|
57 | 57 | 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), |
58 | - 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ), |
|
59 | - 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ), |
|
58 | + 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), |
|
59 | + 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false), |
|
60 | 60 | )); |
61 | 61 | $this->_model_relations = array( |
62 | 62 | 'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | ); |
66 | 66 | $this->_model_chain_to_wp_user = 'Event'; |
67 | 67 | //this model is generally available for reading |
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
69 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
70 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
71 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
72 | - parent::__construct( $timezone ); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
69 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
70 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
71 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
72 | + parent::__construct($timezone); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | public function create_new_blank_datetime() { |
85 | 85 | $blank_datetime = EE_Datetime::new_instance( |
86 | 86 | array( |
87 | - 'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30), |
|
88 | - 'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30), |
|
87 | + 'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30), |
|
88 | + 'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30), |
|
89 | 89 | 'DTT_order' => 1, |
90 | 90 | 'DTT_reg_limit' => EE_INF |
91 | 91 | ), |
92 | 92 | $this->_timezone |
93 | 93 | ); |
94 | - $blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) ); |
|
95 | - $blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) ); |
|
96 | - return array( $blank_datetime ); |
|
94 | + $blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone)); |
|
95 | + $blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone)); |
|
96 | + return array($blank_datetime); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | * @param int $EVT_ID |
108 | 108 | * @return EE_Datetime[] array on success, FALSE on fail |
109 | 109 | */ |
110 | - public function get_all_event_dates( $EVT_ID = 0 ) { |
|
111 | - if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
|
110 | + public function get_all_event_dates($EVT_ID = 0) { |
|
111 | + if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
112 | 112 | return $this->create_new_blank_datetime(); |
113 | 113 | } |
114 | - $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
114 | + $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
115 | 115 | |
116 | - if ( empty( $results ) ) { |
|
116 | + if (empty($results)) { |
|
117 | 117 | return $this->create_new_blank_datetime(); |
118 | 118 | } |
119 | 119 | |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | * the given number |
135 | 135 | * @return EE_Datetime[] |
136 | 136 | */ |
137 | - public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL ) { |
|
137 | + public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) { |
|
138 | 138 | |
139 | 139 | //sanitize EVT_ID |
140 | - $EVT_ID = intval( $EVT_ID ); |
|
140 | + $EVT_ID = intval($EVT_ID); |
|
141 | 141 | |
142 | 142 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
143 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
144 | - $where_params = array( 'Event.EVT_ID' => $EVT_ID ); |
|
143 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
144 | + $where_params = array('Event.EVT_ID' => $EVT_ID); |
|
145 | 145 | |
146 | - $query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ); |
|
146 | + $query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none'); |
|
147 | 147 | |
148 | - if( ! $include_expired){ |
|
149 | - $query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) ); |
|
148 | + if ( ! $include_expired) { |
|
149 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
150 | 150 | } |
151 | - if( $include_deleted){ |
|
152 | - $query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE )); |
|
151 | + if ($include_deleted) { |
|
152 | + $query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE)); |
|
153 | 153 | } |
154 | 154 | |
155 | - $result = $this->get_all( $query_params ); |
|
156 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
155 | + $result = $this->get_all($query_params); |
|
156 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
157 | 157 | return $result; |
158 | 158 | } |
159 | 159 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @param int $limit |
169 | 169 | * @return EE_Datetime[] |
170 | 170 | */ |
171 | - public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){ |
|
172 | - return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID), |
|
171 | + public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) { |
|
172 | + return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID), |
|
173 | 173 | 'limit'=>$limit, |
174 | 174 | 'order_by'=>array('DTT_EVT_start'=>'ASC'), |
175 | 175 | 'default_where_conditions' => 'none')); |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @param boolean $include_deleted |
185 | 185 | * @return EE_Datetime |
186 | 186 | */ |
187 | - public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){ |
|
188 | - $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
189 | - if($results){ |
|
187 | + public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) { |
|
188 | + $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
189 | + if ($results) { |
|
190 | 190 | return array_shift($results); |
191 | - }else{ |
|
191 | + } else { |
|
192 | 192 | return NULL; |
193 | 193 | } |
194 | 194 | } |
@@ -202,16 +202,16 @@ discard block |
||
202 | 202 | * @param bool $try_to_exclude_deleted |
203 | 203 | * @return \EE_Datetime |
204 | 204 | */ |
205 | - public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){ |
|
206 | - if($try_to_exclude_expired){ |
|
207 | - $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false); |
|
208 | - if($non_expired){ |
|
205 | + public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) { |
|
206 | + if ($try_to_exclude_expired) { |
|
207 | + $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
208 | + if ($non_expired) { |
|
209 | 209 | return $non_expired; |
210 | 210 | } |
211 | 211 | } |
212 | - if($try_to_exclude_deleted){ |
|
212 | + if ($try_to_exclude_deleted) { |
|
213 | 213 | $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
214 | - if($expired_even){ |
|
214 | + if ($expired_even) { |
|
215 | 215 | return $expired_even; |
216 | 216 | } |
217 | 217 | } |
@@ -230,23 +230,23 @@ discard block |
||
230 | 230 | * @param int $limit |
231 | 231 | * @return EE_Datetime[] |
232 | 232 | */ |
233 | - public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){ |
|
233 | + public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
234 | 234 | //sanitize EVT_ID |
235 | - $EVT_ID = intval( $EVT_ID ); |
|
235 | + $EVT_ID = intval($EVT_ID); |
|
236 | 236 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
237 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
238 | - $query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
239 | - if( ! $include_expired){ |
|
240 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
237 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
238 | + $query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
239 | + if ( ! $include_expired) { |
|
240 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
241 | 241 | } |
242 | - if( $include_deleted){ |
|
243 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
242 | + if ($include_deleted) { |
|
243 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
244 | 244 | } |
245 | - if($limit){ |
|
245 | + if ($limit) { |
|
246 | 246 | $query_params['limit'] = $limit; |
247 | 247 | } |
248 | - $result = $this->get_all( $query_params ); |
|
249 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
248 | + $result = $this->get_all($query_params); |
|
249 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
250 | 250 | return $result; |
251 | 251 | } |
252 | 252 | |
@@ -259,23 +259,23 @@ discard block |
||
259 | 259 | * @param int $limit |
260 | 260 | * @return EE_Datetime[] |
261 | 261 | */ |
262 | - public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
|
262 | + public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
263 | 263 | //sanitize TKT_ID |
264 | - $TKT_ID = intval( $TKT_ID ); |
|
264 | + $TKT_ID = intval($TKT_ID); |
|
265 | 265 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
266 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
267 | - $query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
268 | - if( ! $include_expired){ |
|
269 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
266 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
267 | + $query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
268 | + if ( ! $include_expired) { |
|
269 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
270 | 270 | } |
271 | - if( $include_deleted){ |
|
272 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
271 | + if ($include_deleted) { |
|
272 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
273 | 273 | } |
274 | - if($limit){ |
|
274 | + if ($limit) { |
|
275 | 275 | $query_params['limit'] = $limit; |
276 | 276 | } |
277 | - $result = $this->get_all( $query_params ); |
|
278 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
277 | + $result = $this->get_all($query_params); |
|
278 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
279 | 279 | return $result; |
280 | 280 | } |
281 | 281 | |
@@ -291,24 +291,24 @@ discard block |
||
291 | 291 | * that number |
292 | 292 | * @return EE_Datetime[] |
293 | 293 | */ |
294 | - public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) { |
|
294 | + public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
295 | 295 | //sanitize id. |
296 | - $TKT_ID = intval( $TKT_ID ); |
|
296 | + $TKT_ID = intval($TKT_ID); |
|
297 | 297 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
298 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
299 | - $where_params = array( 'Ticket.TKT_ID' => $TKT_ID ); |
|
300 | - $query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) ); |
|
301 | - if( ! $include_expired){ |
|
302 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
298 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
299 | + $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
300 | + $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
301 | + if ( ! $include_expired) { |
|
302 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
303 | 303 | } |
304 | - if( $include_deleted){ |
|
305 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
304 | + if ($include_deleted) { |
|
305 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
306 | 306 | } |
307 | - if($limit){ |
|
307 | + if ($limit) { |
|
308 | 308 | $query_params['limit'] = $limit; |
309 | 309 | } |
310 | - $result = $this->get_all( $query_params ); |
|
311 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
310 | + $result = $this->get_all($query_params); |
|
311 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
312 | 312 | return $result; |
313 | 313 | } |
314 | 314 | |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | * @param int $EVT_ID |
320 | 320 | * @return EE_Datetime |
321 | 321 | */ |
322 | - public function get_most_important_datetime_for_event($EVT_ID){ |
|
322 | + public function get_most_important_datetime_for_event($EVT_ID) { |
|
323 | 323 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
324 | - if($results){ |
|
324 | + if ($results) { |
|
325 | 325 | return array_shift($results); |
326 | - }else{ |
|
326 | + } else { |
|
327 | 327 | return null; |
328 | 328 | } |
329 | 329 | } |
@@ -342,78 +342,78 @@ discard block |
||
342 | 342 | * - inactive = Events that are either not published. |
343 | 343 | * @return wpdb results array |
344 | 344 | */ |
345 | - public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) { |
|
346 | - $current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' ); |
|
347 | - $current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' ); |
|
345 | + public function get_dtt_months_and_years($where_params, $evt_active_status = '') { |
|
346 | + $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
347 | + $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
348 | 348 | |
349 | - switch ( $evt_active_status ) { |
|
349 | + switch ($evt_active_status) { |
|
350 | 350 | case 'upcoming' : |
351 | 351 | $where_params['Event.status'] = 'publish'; |
352 | 352 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
353 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
353 | + if (isset($where_params['DTT_EVT_start'])) { |
|
354 | 354 | $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
355 | 355 | } |
356 | - $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start ); |
|
356 | + $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start); |
|
357 | 357 | break; |
358 | 358 | |
359 | 359 | case 'expired' : |
360 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
360 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
361 | 361 | //get events to exclude |
362 | - $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
|
362 | + $exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))); |
|
363 | 363 | //first get all events that have datetimes where its not expired. |
364 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' ); |
|
365 | - $event_ids = array_keys( $event_ids ); |
|
364 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID'); |
|
365 | + $event_ids = array_keys($event_ids); |
|
366 | 366 | |
367 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
367 | + if (isset($where_params['DTT_EVT_end'])) { |
|
368 | 368 | $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
369 | 369 | } |
370 | - $where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end ); |
|
371 | - $where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids ); |
|
370 | + $where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end); |
|
371 | + $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids); |
|
372 | 372 | break; |
373 | 373 | |
374 | 374 | case 'active' : |
375 | 375 | $where_params['Event.status'] = 'publish'; |
376 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
376 | + if (isset($where_params['DTT_EVT_start'])) { |
|
377 | 377 | $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
378 | 378 | } |
379 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
379 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
380 | 380 | $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
381 | 381 | } |
382 | - $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start ); |
|
383 | - $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end ); |
|
382 | + $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start); |
|
383 | + $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end); |
|
384 | 384 | break; |
385 | 385 | |
386 | 386 | case 'inactive' : |
387 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
388 | - if ( isset( $where_params['OR'] ) ) { |
|
387 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
388 | + if (isset($where_params['OR'])) { |
|
389 | 389 | $where_params['AND']['OR'] = $where_params['OR']; |
390 | 390 | } |
391 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
391 | + if (isset($where_params['DTT_EVT_end'])) { |
|
392 | 392 | $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
393 | - unset( $where_params['DTT_EVT_end'] ); |
|
393 | + unset($where_params['DTT_EVT_end']); |
|
394 | 394 | } |
395 | 395 | |
396 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
396 | + if (isset($where_params['DTT_EVT_start'])) { |
|
397 | 397 | $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
398 | - unset( $where_params['DTT_EVT_start'] ); |
|
398 | + unset($where_params['DTT_EVT_start']); |
|
399 | 399 | } |
400 | - $where_params['AND']['Event.status'] = array( '!=', 'publish' ); |
|
400 | + $where_params['AND']['Event.status'] = array('!=', 'publish'); |
|
401 | 401 | break; |
402 | 402 | } |
403 | 403 | |
404 | 404 | $query_params[0] = $where_params; |
405 | 405 | $query_params['group_by'] = array('dtt_year', 'dtt_month'); |
406 | - $query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' ); |
|
406 | + $query_params['order_by'] = array('DTT_EVT_start' => 'DESC'); |
|
407 | 407 | |
408 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
409 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' ); |
|
408 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
409 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start'); |
|
410 | 410 | |
411 | 411 | $columns_to_select = array( |
412 | - 'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'), |
|
413 | - 'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'), |
|
414 | - 'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s') |
|
412 | + 'dtt_year' => array('YEAR('.$query_interval.')', '%s'), |
|
413 | + 'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'), |
|
414 | + 'dtt_month_num' => array('MONTH('.$query_interval.')', '%s') |
|
415 | 415 | ); |
416 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
416 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | /** |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | * for the tickets for each datetime) |
422 | 422 | * @param EE_Datetime[] $datetimes |
423 | 423 | */ |
424 | - public function update_sold($datetimes){ |
|
425 | - foreach($datetimes as $datetime){ |
|
424 | + public function update_sold($datetimes) { |
|
425 | + foreach ($datetimes as $datetime) { |
|
426 | 426 | $datetime->update_sold(); |
427 | 427 | } |
428 | 428 | } |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | * @param array $query_params |
438 | 438 | * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO tickets attached to datetime then FALSE is returned. |
439 | 439 | */ |
440 | - public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) { |
|
441 | - $datetime = $this->get_one_by_ID( $DTT_ID ); |
|
442 | - if ( $datetime instanceof EE_Datetime ) { |
|
443 | - return $datetime->tickets_remaining( $query_params ); |
|
440 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
441 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
442 | + if ($datetime instanceof EE_Datetime) { |
|
443 | + return $datetime->tickets_remaining($query_params); |
|
444 | 444 | } |
445 | 445 | return 0; |
446 | 446 | } |
@@ -462,36 +462,36 @@ discard block |
||
462 | 462 | * EE_Datetime::upcoming |
463 | 463 | * EE_Datetime::expired |
464 | 464 | */ |
465 | - public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) { |
|
465 | + public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) { |
|
466 | 466 | //only accept where conditions for this query. |
467 | - $_where = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
467 | + $_where = isset($query_params[0]) ? $query_params[0] : array(); |
|
468 | 468 | $status_query_args = array( |
469 | 469 | EE_Datetime::active => array_merge( |
470 | 470 | $_where, |
471 | - array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) ) |
|
471 | + array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time())) |
|
472 | 472 | ), |
473 | 473 | EE_Datetime::upcoming => array_merge( |
474 | 474 | $_where, |
475 | - array( 'DTT_EVT_start' => array( '>', time() ) ) |
|
475 | + array('DTT_EVT_start' => array('>', time())) |
|
476 | 476 | ), |
477 | 477 | EE_Datetime::expired => array_merge( |
478 | 478 | $_where, |
479 | - array( 'DTT_EVT_end' => array('<', time() ) ) |
|
479 | + array('DTT_EVT_end' => array('<', time())) |
|
480 | 480 | ) |
481 | 481 | ); |
482 | 482 | |
483 | - if ( ! empty( $stati_to_include ) ) { |
|
484 | - foreach( array_keys( $status_query_args ) as $status ) { |
|
485 | - if ( ! in_array( $status, $stati_to_include ) ) { |
|
486 | - unset( $status_query_args[$status] ); |
|
483 | + if ( ! empty($stati_to_include)) { |
|
484 | + foreach (array_keys($status_query_args) as $status) { |
|
485 | + if ( ! in_array($status, $stati_to_include)) { |
|
486 | + unset($status_query_args[$status]); |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
491 | 491 | //loop through and query counts for each stati. |
492 | 492 | $status_query_results = array(); |
493 | - foreach( $status_query_args as $status => $status_where_conditions ) { |
|
494 | - $status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true ); |
|
493 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
494 | + $status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | return $status_query_results; |
@@ -505,9 +505,9 @@ discard block |
||
505 | 505 | * @param array $query_params |
506 | 506 | * @return int |
507 | 507 | */ |
508 | - public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) { |
|
509 | - $count = $this->get_datetime_counts_by_status( array( $status ), $query_params ); |
|
510 | - return ! empty( $count[$status] ) ? $count[$status] : 0; |
|
508 | + public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) { |
|
509 | + $count = $this->get_datetime_counts_by_status(array($status), $query_params); |
|
510 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Espresso Template functions |
|
4 | - * |
|
5 | - * @ package Event Espresso |
|
6 | - * @ author Seth Shoultes |
|
7 | - * @ copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
8 | - * @ license http://venueespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | - * @ link http://www.eventespresso.com |
|
10 | - * @ version 4+ |
|
11 | - */ |
|
3 | + * Espresso Template functions |
|
4 | + * |
|
5 | + * @ package Event Espresso |
|
6 | + * @ author Seth Shoultes |
|
7 | + * @ copyright (c) 2008-2014 Event Espresso All Rights Reserved. |
|
8 | + * @ license http://venueespresso.com/support/terms-conditions/ * see Plugin Licensing * |
|
9 | + * @ link http://www.eventespresso.com |
|
10 | + * @ version 4+ |
|
11 | + */ |
|
12 | 12 | define( 'EE_THEME_FUNCTIONS_LOADED', TRUE ); |
13 | 13 | |
14 | 14 | /** |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * @ link http://www.eventespresso.com |
10 | 10 | * @ version 4+ |
11 | 11 | */ |
12 | -define( 'EE_THEME_FUNCTIONS_LOADED', TRUE ); |
|
12 | +define('EE_THEME_FUNCTIONS_LOADED', TRUE); |
|
13 | 13 | |
14 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
14 | +if ( ! function_exists('espresso_pagination')) { |
|
15 | 15 | /** |
16 | 16 | * espresso_pagination |
17 | 17 | * |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | $big = 999999999; // need an unlikely integer |
24 | 24 | $pagination = paginate_links( |
25 | 25 | array( |
26 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
26 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
27 | 27 | 'format' => '?paged=%#%', |
28 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
28 | + 'current' => max(1, get_query_var('paged')), |
|
29 | 29 | 'total' => $wp_query->max_num_pages, |
30 | 30 | 'show_all' => true, |
31 | 31 | 'end_size' => 10, |
32 | 32 | 'mid_size' => 6, |
33 | 33 | 'prev_next' => true, |
34 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
35 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
34 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
35 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
36 | 36 | 'type' => 'plain', |
37 | 37 | 'add_args' => false, |
38 | 38 | 'add_fragment' => '' |
39 | 39 | ) |
40 | 40 | ); |
41 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
41 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | |
137 | 137 | /** |
138 | 138 | * grab url requests and route them |
139 | - * @access private |
|
140 | - * @return void |
|
141 | - */ |
|
139 | + * @access private |
|
140 | + * @return void |
|
141 | + */ |
|
142 | 142 | public function _set_page_routes() { |
143 | 143 | |
144 | 144 | $this->_get_registration_status_array(); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'title' => __('Registrations Other', 'event_espresso'), |
405 | 405 | 'filename' => 'registrations_overview_other' |
406 | 406 | ) |
407 | - ), |
|
407 | + ), |
|
408 | 408 | 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
409 | 409 | 'qtips' => array('Registration_List_Table_Tips'), |
410 | 410 | 'list_table' => 'EE_Registrations_List_Table', |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
419 | 419 | 'persistent' => FALSE |
420 | 420 | ), |
421 | - 'help_tabs' => array( |
|
421 | + 'help_tabs' => array( |
|
422 | 422 | 'registrations_details_help_tab' => array( |
423 | 423 | 'title' => __('Registration Details', 'event_espresso'), |
424 | 424 | 'filename' => 'registrations_details' |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | 'order' => 20 |
483 | 483 | ), |
484 | 484 | 'list_table' => 'EE_Attendee_Contact_List_Table', |
485 | - 'help_tabs' => array( |
|
485 | + 'help_tabs' => array( |
|
486 | 486 | 'registrations_contact_list_help_tab' => array( |
487 | 487 | 'title' => __('Registrations Contact List', 'event_espresso'), |
488 | 488 | 'filename' => 'registrations_contact_list' |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | 'title' => __('Contact List Other', 'event_espresso'), |
500 | 500 | 'filename' => 'registrations_contact_list_other' |
501 | 501 | ) |
502 | - ), |
|
502 | + ), |
|
503 | 503 | 'help_tour' => array( 'Contact_List_Help_Tour' ), |
504 | 504 | 'metaboxes' => array(), |
505 | 505 | 'require_nonce' => FALSE |
@@ -533,9 +533,9 @@ discard block |
||
533 | 533 | |
534 | 534 | /** |
535 | 535 | * get list of registration statuses |
536 | - * @access private |
|
537 | - * @return void |
|
538 | - */ |
|
536 | + * @access private |
|
537 | + * @return void |
|
538 | + */ |
|
539 | 539 | private function _get_registration_status_array() { |
540 | 540 | self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
541 | 541 | } |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | return TRUE; |
843 | 843 | } |
844 | 844 | |
845 | - $REG = EEM_Registration::instance(); |
|
845 | + $REG = EEM_Registration::instance(); |
|
846 | 846 | |
847 | 847 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
848 | 848 | |
@@ -1065,9 +1065,9 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | /** |
1067 | 1067 | * generates HTML for the View Registration Details Admin page |
1068 | - * @access protected |
|
1069 | - * @return void |
|
1070 | - */ |
|
1068 | + * @access protected |
|
1069 | + * @return void |
|
1070 | + */ |
|
1071 | 1071 | protected function _registration_details() { |
1072 | 1072 | |
1073 | 1073 | $this->_template_args = array(); |
@@ -1145,9 +1145,9 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | /** |
1147 | 1147 | * _set_approve_or_decline_reg_status_buttons |
1148 | - * @access protected |
|
1149 | - * @return string |
|
1150 | - */ |
|
1148 | + * @access protected |
|
1149 | + * @return string |
|
1150 | + */ |
|
1151 | 1151 | public function set_reg_status_buttons_metabox() { |
1152 | 1152 | |
1153 | 1153 | //is registration for free event OR for a completed transaction? This will determine whether the set to pending option is shown. |
@@ -1337,10 +1337,10 @@ discard block |
||
1337 | 1337 | |
1338 | 1338 | /** |
1339 | 1339 | * approve_registration |
1340 | - * @access protected |
|
1341 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1342 | - * @return void |
|
1343 | - */ |
|
1340 | + * @access protected |
|
1341 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1342 | + * @return void |
|
1343 | + */ |
|
1344 | 1344 | protected function approve_registration( $notify = false ) { |
1345 | 1345 | $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
1346 | 1346 | } |
@@ -1350,10 +1350,10 @@ discard block |
||
1350 | 1350 | |
1351 | 1351 | /** |
1352 | 1352 | * decline_registration |
1353 | - * @access protected |
|
1354 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1355 | - * @return void |
|
1356 | - */ |
|
1353 | + * @access protected |
|
1354 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1355 | + * @return void |
|
1356 | + */ |
|
1357 | 1357 | protected function decline_registration( $notify = false ) { |
1358 | 1358 | $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
1359 | 1359 | } |
@@ -1363,10 +1363,10 @@ discard block |
||
1363 | 1363 | |
1364 | 1364 | /** |
1365 | 1365 | * cancel_registration |
1366 | - * @access protected |
|
1367 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1368 | - * @return void |
|
1369 | - */ |
|
1366 | + * @access protected |
|
1367 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1368 | + * @return void |
|
1369 | + */ |
|
1370 | 1370 | protected function cancel_registration( $notify = false ) { |
1371 | 1371 | $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
1372 | 1372 | } |
@@ -1377,10 +1377,10 @@ discard block |
||
1377 | 1377 | |
1378 | 1378 | /** |
1379 | 1379 | * not_approve_registration |
1380 | - * @access protected |
|
1381 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1382 | - * @return void |
|
1383 | - */ |
|
1380 | + * @access protected |
|
1381 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1382 | + * @return void |
|
1383 | + */ |
|
1384 | 1384 | protected function not_approve_registration( $notify = false ) { |
1385 | 1385 | $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
1386 | 1386 | } |
@@ -1389,10 +1389,10 @@ discard block |
||
1389 | 1389 | |
1390 | 1390 | /** |
1391 | 1391 | * decline_registration |
1392 | - * @access protected |
|
1393 | - * @param bool $notify whether or not to notify the registrant about their approval. |
|
1394 | - * @return void |
|
1395 | - */ |
|
1392 | + * @access protected |
|
1393 | + * @param bool $notify whether or not to notify the registrant about their approval. |
|
1394 | + * @return void |
|
1395 | + */ |
|
1396 | 1396 | protected function pending_registration( $notify = false ) { |
1397 | 1397 | $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
1398 | 1398 | } |
@@ -1402,9 +1402,9 @@ discard block |
||
1402 | 1402 | |
1403 | 1403 | /** |
1404 | 1404 | * generates HTML for the Registration main meta box |
1405 | - * @access public |
|
1406 | - * @return void |
|
1407 | - */ |
|
1405 | + * @access public |
|
1406 | + * @return void |
|
1407 | + */ |
|
1408 | 1408 | public function _reg_details_meta_box() { |
1409 | 1409 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1410 | 1410 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
@@ -1487,7 +1487,7 @@ discard block |
||
1487 | 1487 | * |
1488 | 1488 | * @access public |
1489 | 1489 | * @return void |
1490 | - */ |
|
1490 | + */ |
|
1491 | 1491 | public function _reg_questions_meta_box() { |
1492 | 1492 | //allow someone to override this method entirely |
1493 | 1493 | if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
@@ -1689,12 +1689,12 @@ discard block |
||
1689 | 1689 | |
1690 | 1690 | /** |
1691 | 1691 | * generates HTML for the Registration main meta box |
1692 | - * @access public |
|
1693 | - * @return void |
|
1694 | - */ |
|
1692 | + * @access public |
|
1693 | + * @return void |
|
1694 | + */ |
|
1695 | 1695 | public function _reg_attendees_meta_box() { |
1696 | 1696 | |
1697 | - $REG = EEM_Registration::instance(); |
|
1697 | + $REG = EEM_Registration::instance(); |
|
1698 | 1698 | //get all other registrations on this transaction, and cache |
1699 | 1699 | //the attendees for them so we don't have to run another query using force_join |
1700 | 1700 | $registrations = $REG->get_all(array( |
@@ -1747,9 +1747,9 @@ discard block |
||
1747 | 1747 | |
1748 | 1748 | /** |
1749 | 1749 | * generates HTML for the Edit Registration side meta box |
1750 | - * @access public |
|
1751 | - * @return void |
|
1752 | - */ |
|
1750 | + * @access public |
|
1751 | + * @return void |
|
1752 | + */ |
|
1753 | 1753 | public function _reg_registrant_side_meta_box() { |
1754 | 1754 | |
1755 | 1755 | /*@var $attendee EE_Attendee */ |
@@ -2095,9 +2095,9 @@ discard block |
||
2095 | 2095 | |
2096 | 2096 | /** |
2097 | 2097 | * set_reg_event |
2098 | - * @access private |
|
2099 | - * @return boolean |
|
2100 | - */ |
|
2098 | + * @access private |
|
2099 | + * @return boolean |
|
2100 | + */ |
|
2101 | 2101 | private function _set_reg_event() { |
2102 | 2102 | if ( is_object( $this->_reg_event )) { |
2103 | 2103 | return TRUE; |
@@ -2204,9 +2204,9 @@ discard block |
||
2204 | 2204 | |
2205 | 2205 | /** |
2206 | 2206 | * generates HTML for the Attendee Contact List |
2207 | - * @access protected |
|
2208 | - * @return void |
|
2209 | - */ |
|
2207 | + * @access protected |
|
2208 | + * @return void |
|
2209 | + */ |
|
2210 | 2210 | protected function _attendee_contact_list_table() { |
2211 | 2211 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
2212 | 2212 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
@@ -2220,9 +2220,9 @@ discard block |
||
2220 | 2220 | /** |
2221 | 2221 | * get_attendees |
2222 | 2222 | * @param bool $count whether to return count or data. |
2223 | - * @access public |
|
2224 | - * @return array |
|
2225 | - */ |
|
2223 | + * @access public |
|
2224 | + * @return array |
|
2225 | + */ |
|
2226 | 2226 | public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
2227 | 2227 | |
2228 | 2228 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2558,9 +2558,9 @@ discard block |
||
2558 | 2558 | |
2559 | 2559 | /** |
2560 | 2560 | * _attendee_details |
2561 | - * @access protected |
|
2562 | - * @return void |
|
2563 | - */ |
|
2561 | + * @access protected |
|
2562 | + * @return void |
|
2563 | + */ |
|
2564 | 2564 | public function attendee_registrations_meta_box( $post ) { |
2565 | 2565 | |
2566 | 2566 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
@@ -2593,10 +2593,10 @@ discard block |
||
2593 | 2593 | |
2594 | 2594 | /** |
2595 | 2595 | * _trash_or_restore_attendee |
2596 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2597 | - * @access protected |
|
2598 | - * @return void |
|
2599 | - */ |
|
2596 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
2597 | + * @access protected |
|
2598 | + * @return void |
|
2599 | + */ |
|
2600 | 2600 | protected function _trash_or_restore_attendees( $trash = TRUE ) { |
2601 | 2601 | |
2602 | 2602 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Registrations_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
61 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' )); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | + add_action('wp_loaded', array($this, 'wp_loaded')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | 66 | public function wp_loaded() { |
67 | 67 | // when adding a new registration... |
68 | - if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) { |
|
68 | + if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') { |
|
69 | 69 | EE_System::do_not_cache(); |
70 | 70 | if ( |
71 | - ! isset( $this->_req_data[ 'processing_registration' ] ) |
|
72 | - || absint( $this->_req_data[ 'processing_registration' ] ) !== 1 |
|
71 | + ! isset($this->_req_data['processing_registration']) |
|
72 | + || absint($this->_req_data['processing_registration']) !== 1 |
|
73 | 73 | ) { |
74 | 74 | // and it's NOT the attendee information reg step |
75 | 75 | // force cookie expiration by setting time to last week |
76 | - setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' ); |
|
76 | + setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/'); |
|
77 | 77 | // and update the global |
78 | - $_COOKIE[ 'ee_registration_added' ] = 0; |
|
78 | + $_COOKIE['ee_registration_added'] = 0; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | 'trash' => 'post.php' |
110 | 110 | ); |
111 | 111 | |
112 | - add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 ); |
|
112 | + add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10); |
|
113 | 113 | //add filters so that the comment urls don't take users to a confusing 404 page |
114 | - add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 ); |
|
114 | + add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
118 | - public function clear_comment_link( $link, $comment, $args ) { |
|
118 | + public function clear_comment_link($link, $comment, $args) { |
|
119 | 119 | //gotta make sure this only happens on this route |
120 | - $post_type = get_post_type( $comment->comment_post_ID); |
|
121 | - if ( $post_type == 'espresso_attendees' ) |
|
120 | + $post_type = get_post_type($comment->comment_post_ID); |
|
121 | + if ($post_type == 'espresso_attendees') |
|
122 | 122 | return '#commentsdiv'; |
123 | 123 | return $link; |
124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | protected function _ajax_hooks() { |
128 | 128 | //todo: all hooks for registrations ajax goes in here |
129 | - add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' )); |
|
129 | + add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | 'add-attendee' => __('Add Contact', 'event_espresso'), |
142 | 142 | 'edit' => __('Edit Contact', 'event_espresso'), |
143 | 143 | 'report'=> __("Event Registrations CSV Report", "event_espresso"), |
144 | - 'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ), |
|
145 | - 'contact_list_report' => __( 'Contact List Report', 'event_espresso' ), |
|
144 | + 'report_all' => __('All Registrations CSV Report', 'event_espresso'), |
|
145 | + 'contact_list_report' => __('Contact List Report', 'event_espresso'), |
|
146 | 146 | 'contact_list_export'=> __("Export Data", "event_espresso"), |
147 | 147 | ), |
148 | 148 | 'publishbox' => array( |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $this->_get_registration_status_array(); |
172 | 172 | |
173 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
173 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
174 | + $att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0; |
|
175 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
176 | 176 | |
177 | 177 | $this->_page_routes = array( |
178 | 178 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | 'restore_registrations' => array( |
207 | 207 | 'func' => '_trash_or_restore_registrations', |
208 | - 'args' => array( 'trash' => FALSE ), |
|
208 | + 'args' => array('trash' => FALSE), |
|
209 | 209 | 'noheader' => TRUE, |
210 | 210 | 'capability' => 'ee_delete_registrations' |
211 | 211 | ), |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'filename' => 'registrations_overview_other' |
438 | 438 | ) |
439 | 439 | ), |
440 | - 'help_tour' => array( 'Registration_Overview_Help_Tour' ), |
|
440 | + 'help_tour' => array('Registration_Overview_Help_Tour'), |
|
441 | 441 | 'qtips' => array('Registration_List_Table_Tips'), |
442 | 442 | 'list_table' => 'EE_Registrations_List_Table', |
443 | 443 | 'require_nonce' => FALSE |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | 'nav' => array( |
448 | 448 | 'label' => __('REG Details', 'event_espresso'), |
449 | 449 | 'order' => 15, |
450 | - 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
450 | + 'url' => isset($this->_req_data['_REG_ID']) ? add_query_arg(array('_REG_ID' => $this->_req_data['_REG_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
451 | 451 | 'persistent' => FALSE |
452 | 452 | ), |
453 | 453 | 'help_tabs' => array( |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | 'filename' => 'registrations_details_registrant_details' |
469 | 469 | ) |
470 | 470 | ), |
471 | - 'help_tour' => array( 'Registration_Details_Help_Tour' ), |
|
472 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ), |
|
471 | + 'help_tour' => array('Registration_Details_Help_Tour'), |
|
472 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')), |
|
473 | 473 | 'require_nonce' => FALSE |
474 | 474 | ), |
475 | 475 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | 'order' => 15, |
494 | 494 | 'persistent' => FALSE |
495 | 495 | ), |
496 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ), |
|
496 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')), |
|
497 | 497 | 'require_nonce' => FALSE |
498 | 498 | ), |
499 | 499 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | 'label' => __('Edit Contact', 'event_espresso'), |
503 | 503 | 'order' => 15, |
504 | 504 | 'persistent' => FALSE, |
505 | - 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
505 | + 'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
506 | 506 | ), |
507 | 507 | 'metaboxes' => array('attendee_editor_metaboxes'), |
508 | 508 | 'require_nonce' => FALSE |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | 'filename' => 'registrations_contact_list_other' |
533 | 533 | ) |
534 | 534 | ), |
535 | - 'help_tour' => array( 'Contact_List_Help_Tour' ), |
|
535 | + 'help_tour' => array('Contact_List_Help_Tour'), |
|
536 | 536 | 'metaboxes' => array(), |
537 | 537 | 'require_nonce' => FALSE |
538 | 538 | ), |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | protected function _add_screen_options() {} |
552 | 552 | protected function _add_feature_pointers() {} |
553 | 553 | public function admin_init() { |
554 | - EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' ); |
|
554 | + EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso'); |
|
555 | 555 | } |
556 | 556 | public function admin_notices() {} |
557 | 557 | public function admin_footer_scripts() {} |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * @return void |
570 | 570 | */ |
571 | 571 | private function _get_registration_status_array() { |
572 | - self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE); |
|
572 | + self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | |
@@ -592,11 +592,11 @@ discard block |
||
592 | 592 | public function load_scripts_styles() { |
593 | 593 | //style |
594 | 594 | //wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
595 | - wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
595 | + wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
596 | 596 | wp_enqueue_style('espresso_reg'); |
597 | 597 | |
598 | 598 | //script |
599 | - wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
599 | + wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE); |
|
600 | 600 | wp_enqueue_script('espresso_reg'); |
601 | 601 | } |
602 | 602 | |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | public function load_scripts_styles_edit_attendee() { |
606 | 606 | //stuff to only show up on our attendee edit details page. |
607 | 607 | $attendee_details_translations = array( |
608 | - 'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') ) |
|
608 | + 'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created')) |
|
609 | 609 | ); |
610 | - wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations ); |
|
610 | + wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations); |
|
611 | 611 | wp_enqueue_script('jquery-validate'); |
612 | 612 | } |
613 | 613 | |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | //styles |
617 | 617 | wp_enqueue_style('espresso-ui-theme'); |
618 | 618 | //scripts |
619 | - $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
620 | - $this->_reg_custom_questions_form->wp_enqueue_scripts( true ); |
|
619 | + $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
620 | + $this->_reg_custom_questions_form->wp_enqueue_scripts(true); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | |
628 | 628 | public function load_scripts_styles_contact_list() { |
629 | 629 | wp_deregister_style('espresso_reg'); |
630 | - wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION ); |
|
630 | + wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION); |
|
631 | 631 | wp_enqueue_style('espresso_att'); |
632 | 632 | } |
633 | 633 | |
@@ -636,9 +636,9 @@ discard block |
||
636 | 636 | |
637 | 637 | |
638 | 638 | public function load_scripts_styles_new_registration() { |
639 | - wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
639 | + wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
640 | 640 | wp_enqueue_script('ee-spco-for-admin'); |
641 | - add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' ); |
|
641 | + add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); |
|
642 | 642 | EE_Form_Section_Proper::wp_enqueue_scripts(); |
643 | 643 | EED_Ticket_Selector::load_tckt_slctr_assets(); |
644 | 644 | EE_Datepicker_Input::enqueue_styles_and_scripts(); |
@@ -677,23 +677,23 @@ discard block |
||
677 | 677 | |
678 | 678 | /** setup reg status bulk actions **/ |
679 | 679 | $def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso'); |
680 | - if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
680 | + if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
681 | 681 | $def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso'); |
682 | 682 | } |
683 | 683 | $def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso'); |
684 | - if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
684 | + if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
685 | 685 | $def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso'); |
686 | 686 | } |
687 | 687 | $def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso'); |
688 | - if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
688 | + if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
689 | 689 | $def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso'); |
690 | 690 | } |
691 | 691 | $def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso'); |
692 | - if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
692 | + if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
693 | 693 | $def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso'); |
694 | 694 | } |
695 | 695 | $def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso'); |
696 | - if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) { |
|
696 | + if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) { |
|
697 | 697 | $def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso'); |
698 | 698 | } |
699 | 699 | |
@@ -702,29 +702,29 @@ discard block |
||
702 | 702 | 'slug' => 'all', |
703 | 703 | 'label' => __('View All Registrations', 'event_espresso'), |
704 | 704 | 'count' => 0, |
705 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
705 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
706 | 706 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
707 | - ) ) |
|
707 | + )) |
|
708 | 708 | ), |
709 | 709 | 'month' => array( |
710 | 710 | 'slug' => 'month', |
711 | 711 | 'label' => __('This Month', 'event_espresso'), |
712 | 712 | 'count' => 0, |
713 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
713 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
714 | 714 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
715 | 715 | )) |
716 | 716 | ), |
717 | 717 | 'today' => array( |
718 | 718 | 'slug' => 'today', |
719 | - 'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ), |
|
719 | + 'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))), |
|
720 | 720 | 'count' => 0, |
721 | - 'bulk_action' => array_merge( $def_reg_status_actions, array( |
|
721 | + 'bulk_action' => array_merge($def_reg_status_actions, array( |
|
722 | 722 | 'trash_registrations' => __('Trash Registrations', 'event_espresso') |
723 | 723 | )) |
724 | 724 | ) |
725 | 725 | ); |
726 | 726 | |
727 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) { |
|
727 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) { |
|
728 | 728 | $this->_views['incomplete'] = array( |
729 | 729 | 'slug' => 'incomplete', |
730 | 730 | 'label' => __('Incomplete', 'event_espresso'), |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | ) |
761 | 761 | ); |
762 | 762 | |
763 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) { |
|
763 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) { |
|
764 | 764 | $this->_views['trash'] = array( |
765 | 765 | 'slug' => 'trash', |
766 | 766 | 'label' => __('Trash', 'event_espresso'), |
@@ -799,42 +799,42 @@ discard block |
||
799 | 799 | 'desc' => __('View Transaction Invoice', 'event_espresso') |
800 | 800 | ), |
801 | 801 | ); |
802 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
802 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
803 | 803 | $fc_items['resend_registration'] = array( |
804 | 804 | 'class' => 'dashicons dashicons-email-alt', |
805 | 805 | 'desc' => __('Resend Registration Details', 'event_espresso') |
806 | 806 | ); |
807 | 807 | } else { |
808 | - $fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' ); |
|
808 | + $fc_items['blank'] = array('class' => 'blank', 'desc' => ''); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | $sc_items = array( |
812 | 812 | 'approved_status' => array( |
813 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
814 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
813 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
814 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
815 | 815 | ), |
816 | 816 | 'pending_status' => array( |
817 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
818 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
817 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
818 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
819 | 819 | ), |
820 | 820 | 'incomplete_status' => array( |
821 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete, |
|
822 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' ) |
|
821 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete, |
|
822 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence') |
|
823 | 823 | ), |
824 | 824 | 'not_approved' => array( |
825 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
826 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
825 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
826 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
827 | 827 | ), |
828 | 828 | 'declined_status' => array( |
829 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
830 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
829 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
830 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
831 | 831 | ), |
832 | 832 | 'cancelled_status' => array( |
833 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
834 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
833 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
834 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
835 | 835 | ) |
836 | 836 | ); |
837 | - return array_merge( $fc_items, $sc_items ); |
|
837 | + return array_merge($fc_items, $sc_items); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -847,15 +847,15 @@ discard block |
||
847 | 847 | |
848 | 848 | |
849 | 849 | protected function _registrations_overview_list_table() { |
850 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
851 | - if ( $EVT_ID ) { |
|
852 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID ) ) { |
|
853 | - $this->_admin_page_title .= $this->get_action_link_or_button( 'new_registration', 'add-registrant', array( 'event_id' => $EVT_ID ), 'add-new-h2' ); |
|
850 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
851 | + if ($EVT_ID) { |
|
852 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_registrations', 'espresso_registrations_new_registration', $EVT_ID)) { |
|
853 | + $this->_admin_page_title .= $this->get_action_link_or_button('new_registration', 'add-registrant', array('event_id' => $EVT_ID), 'add-new-h2'); |
|
854 | 854 | } |
855 | - $event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
856 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce( array('action' => 'edit', 'post' => $event->ID() ), EVENTS_ADMIN_URL ) . '">' . $event->get('EVT_name') . '</a>', '</h2>' ) : ''; |
|
855 | + $event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
856 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%s Viewing registrations for the event: %s%s', 'event_espresso'), '<h2>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'">'.$event->get('EVT_name').'</a>', '</h2>') : ''; |
|
857 | 857 | } |
858 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() ); |
|
858 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items()); |
|
859 | 859 | $this->display_admin_list_table_page_with_no_sidebar(); |
860 | 860 | } |
861 | 861 | |
@@ -870,19 +870,19 @@ discard block |
||
870 | 870 | */ |
871 | 871 | private function _set_registration_object() { |
872 | 872 | //get out if we've already set the object |
873 | - if ( is_object( $this->_registration )) { |
|
873 | + if (is_object($this->_registration)) { |
|
874 | 874 | return TRUE; |
875 | 875 | } |
876 | 876 | |
877 | 877 | $REG = EEM_Registration::instance(); |
878 | 878 | |
879 | - $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
879 | + $REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
880 | 880 | |
881 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
881 | + if ($this->_registration = $REG->get_one_by_ID($REG_ID)) |
|
882 | 882 | return TRUE; |
883 | 883 | else { |
884 | - $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
|
885 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
884 | + $error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID); |
|
885 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
886 | 886 | $this->_registration = NULL; |
887 | 887 | return FALSE; |
888 | 888 | } |
@@ -901,25 +901,25 @@ discard block |
||
901 | 901 | * @internal param bool $all whether to ignore all query params and just return ALL registrations (or count if count is set) |
902 | 902 | * @return mixed (int|array) int = count || array of registration objects |
903 | 903 | */ |
904 | - public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) { |
|
905 | - |
|
906 | - $EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
907 | - $CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE; |
|
908 | - $reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE; |
|
909 | - $month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april |
|
910 | - $today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
911 | - $this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
904 | + public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) { |
|
905 | + |
|
906 | + $EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE; |
|
907 | + $CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE; |
|
908 | + $reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE; |
|
909 | + $month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april |
|
910 | + $today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'today' ? TRUE : FALSE; |
|
911 | + $this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'month' ? TRUE : FALSE; |
|
912 | 912 | $start_date = FALSE; |
913 | 913 | $end_date = FALSE; |
914 | 914 | $_where = array(); |
915 | - $trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
916 | - $incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
915 | + $trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'trash' ? TRUE : FALSE; |
|
916 | + $incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'incomplete' ? TRUE : FALSE; |
|
917 | 917 | |
918 | 918 | //set orderby |
919 | 919 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
920 | 920 | |
921 | 921 | |
922 | - switch ( $this->_req_data['orderby'] ) { |
|
922 | + switch ($this->_req_data['orderby']) { |
|
923 | 923 | case '_REG_ID': |
924 | 924 | $orderby = 'REG_ID'; |
925 | 925 | break; |
@@ -939,26 +939,26 @@ discard block |
||
939 | 939 | $orderby = 'REG_date'; |
940 | 940 | } |
941 | 941 | |
942 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
943 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
944 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
942 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
943 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
944 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
945 | 945 | |
946 | 946 | |
947 | - $offset = ($current_page-1)*$per_page; |
|
948 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
947 | + $offset = ($current_page - 1) * $per_page; |
|
948 | + $limit = $count ? NULL : array($offset, $per_page); |
|
949 | 949 | |
950 | - if($EVT_ID){ |
|
951 | - $_where['EVT_ID']=$EVT_ID; |
|
950 | + if ($EVT_ID) { |
|
951 | + $_where['EVT_ID'] = $EVT_ID; |
|
952 | 952 | } |
953 | - if($CAT_ID){ |
|
953 | + if ($CAT_ID) { |
|
954 | 954 | $_where['Event.Term_Taxonomy.term_id'] = $CAT_ID; |
955 | 955 | } |
956 | - if ( $incomplete ) { |
|
956 | + if ($incomplete) { |
|
957 | 957 | $_where['STS_ID'] = EEM_Registration::status_id_incomplete; |
958 | 958 | } else if ( ! $trash) { |
959 | - $_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete ); |
|
959 | + $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete); |
|
960 | 960 | } |
961 | - if($reg_status){ |
|
961 | + if ($reg_status) { |
|
962 | 962 | $_where['STS_ID'] = $reg_status; |
963 | 963 | } |
964 | 964 | |
@@ -970,105 +970,105 @@ discard block |
||
970 | 970 | $time_start = ' 00:00:00'; |
971 | 971 | $time_end = ' 23:59:59'; |
972 | 972 | |
973 | - if($today_a || $today ){ |
|
973 | + if ($today_a || $today) { |
|
974 | 974 | $curdate = date('Y-m-d', current_time('timestamp')); |
975 | - $_where['REG_date']= array('BETWEEN', |
|
975 | + $_where['REG_date'] = array('BETWEEN', |
|
976 | 976 | array( |
977 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
|
978 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
|
977 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'), |
|
978 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'), |
|
979 | 979 | )); |
980 | - }elseif($this_month_a || $this_month){ |
|
980 | + }elseif ($this_month_a || $this_month) { |
|
981 | 981 | $this_month_r = date('m', current_time('timestamp')); |
982 | - $days_this_month = date( 't', current_time('timestamp') ); |
|
983 | - $_where['REG_date']= array('BETWEEN', |
|
982 | + $days_this_month = date('t', current_time('timestamp')); |
|
983 | + $_where['REG_date'] = array('BETWEEN', |
|
984 | 984 | array( |
985 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
|
986 | - EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
|
985 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'), |
|
986 | + EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s') |
|
987 | 987 | )); |
988 | - }elseif($month_range){ |
|
988 | + }elseif ($month_range) { |
|
989 | 989 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
990 | - $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
991 | - $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
|
992 | - $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
|
993 | - $_where['REG_date']= array('BETWEEN', |
|
994 | - array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
|
995 | - }elseif($start_date && $end_date){ |
|
990 | + $month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
|
991 | + $year_r = ! empty($pieces[1]) ? $pieces[1] : ''; |
|
992 | + $days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01')); |
|
993 | + $_where['REG_date'] = array('BETWEEN', |
|
994 | + array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s'))); |
|
995 | + }elseif ($start_date && $end_date) { |
|
996 | 996 | throw new EE_Error("not yet supported"); |
997 | - }elseif($start_date){ |
|
997 | + }elseif ($start_date) { |
|
998 | 998 | throw new EE_Error("not yet supported"); |
999 | - }elseif($end_date){ |
|
999 | + }elseif ($end_date) { |
|
1000 | 1000 | throw new EE_Error("not yet supported"); |
1001 | 1001 | } |
1002 | 1002 | |
1003 | - if ( ! empty( $this->_req_data['s'] ) ) { |
|
1004 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1003 | + if ( ! empty($this->_req_data['s'])) { |
|
1004 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1005 | 1005 | $_where['OR'] = array( |
1006 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1007 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1008 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1009 | - 'Attendee.ATT_full_name' => array( 'LIKE', $sstr ), |
|
1010 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1011 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1012 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1013 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1014 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1015 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1016 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1017 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1018 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1019 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1020 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1021 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1022 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ), |
|
1023 | - 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr ) |
|
1006 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1007 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1008 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1009 | + 'Attendee.ATT_full_name' => array('LIKE', $sstr), |
|
1010 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1011 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1012 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1013 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1014 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1015 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1016 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1017 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1018 | + 'REG_code' => array('LIKE', $sstr), |
|
1019 | + 'REG_count' => array('LIKE', $sstr), |
|
1020 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1021 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1022 | + 'Ticket.TKT_description' => array('LIKE', $sstr), |
|
1023 | + 'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr) |
|
1024 | 1024 | ); |
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | //capability checks |
1028 | - if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) { |
|
1028 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) { |
|
1029 | 1029 | $_where['AND'] = array( |
1030 | 1030 | 'Event.EVT_wp_user' => get_current_user_id() |
1031 | 1031 | ); |
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | |
1035 | - if( $count ){ |
|
1036 | - if ( $trash ) { |
|
1037 | - return EEM_Registration::instance()->count_deleted( array( $_where )); |
|
1038 | - } else if ( $incomplete ) { |
|
1039 | - return EEM_Registration::instance()->count( array( $_where )); |
|
1035 | + if ($count) { |
|
1036 | + if ($trash) { |
|
1037 | + return EEM_Registration::instance()->count_deleted(array($_where)); |
|
1038 | + } else if ($incomplete) { |
|
1039 | + return EEM_Registration::instance()->count(array($_where)); |
|
1040 | 1040 | } else { |
1041 | - return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' )); |
|
1041 | + return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only')); |
|
1042 | 1042 | } |
1043 | 1043 | } else { |
1044 | 1044 | //make sure we remove default where conditions cause all registrations matching query are returned |
1045 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' ); |
|
1046 | - if ( $per_page !== -1 ) { |
|
1045 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only'); |
|
1046 | + if ($per_page !== -1) { |
|
1047 | 1047 | $query_params['limit'] = $limit; |
1048 | 1048 | } |
1049 | - $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1049 | + $registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params); |
|
1050 | 1050 | |
1051 | 1051 | |
1052 | - if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1052 | + if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) { |
|
1053 | 1053 | $first_registration = $registrations[0]; |
1054 | 1054 | //EEH_Debug_Tools::printr( $registrations[0], '$registrations <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1055 | 1055 | $event_name = $first_registration->event_obj()->name(); |
1056 | - $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1056 | + $event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1057 | 1057 | // edit event link |
1058 | - if ( $event_name != '' ) { |
|
1059 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1060 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1061 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1058 | + if ($event_name != '') { |
|
1059 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1060 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1061 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1065 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1064 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1065 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1066 | 1066 | |
1067 | 1067 | $this->_template_args['before_admin_page_content'] = ' |
1068 | 1068 | <div id="admin-page-header"> |
1069 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1070 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1071 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1069 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1070 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1071 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1072 | 1072 | </div> |
1073 | 1073 | '; |
1074 | 1074 | |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | |
1107 | 1107 | $this->_set_registration_object(); |
1108 | 1108 | |
1109 | - if ( is_object( $this->_registration )) { |
|
1109 | + if (is_object($this->_registration)) { |
|
1110 | 1110 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1111 | 1111 | $this->_session = $transaction->session_data(); |
1112 | 1112 | |
@@ -1114,10 +1114,10 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | |
1116 | 1116 | $this->_template_args['reg_nmbr']['value'] = $this->_registration->ID(); |
1117 | - $this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' ); |
|
1117 | + $this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso'); |
|
1118 | 1118 | |
1119 | - $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y','g:i:s a') ; |
|
1120 | - $this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
1119 | + $this->_template_args['reg_datetime']['value'] = $this->_registration->pretty_date('l F j, Y', 'g:i:s a'); |
|
1120 | + $this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso'); |
|
1121 | 1121 | |
1122 | 1122 | $this->_template_args['grand_total'] = $transaction->total(); |
1123 | 1123 | |
@@ -1125,19 +1125,19 @@ discard block |
||
1125 | 1125 | // link back to overview |
1126 | 1126 | $this->_template_args['reg_overview_url'] = REG_ADMIN_URL; |
1127 | 1127 | $this->_template_args['registration'] = $this->_registration; |
1128 | - $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL ); |
|
1129 | - $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) ); |
|
1130 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) ); |
|
1128 | + $this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL); |
|
1129 | + $this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php')); |
|
1130 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php')); |
|
1131 | 1131 | |
1132 | 1132 | //next and previous links |
1133 | - $next_reg = $this->_registration->next(null, array(), 'REG_ID' ); |
|
1134 | - $this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : ''; |
|
1135 | - $previous_reg = $this->_registration->previous( null, array(), 'REG_ID' ); |
|
1136 | - $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : ''; |
|
1133 | + $next_reg = $this->_registration->next(null, array(), 'REG_ID'); |
|
1134 | + $this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : ''; |
|
1135 | + $previous_reg = $this->_registration->previous(null, array(), 'REG_ID'); |
|
1136 | + $this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : ''; |
|
1137 | 1137 | |
1138 | 1138 | // grab header |
1139 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php'; |
|
1140 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1139 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php'; |
|
1140 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1141 | 1141 | |
1142 | 1142 | } else { |
1143 | 1143 | |
@@ -1156,17 +1156,17 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | |
1158 | 1158 | protected function _registration_details_metaboxes() { |
1159 | - do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this ); |
|
1159 | + do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this); |
|
1160 | 1160 | $this->_set_registration_object(); |
1161 | 1161 | $attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null; |
1162 | - add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1163 | - add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1164 | - if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) { |
|
1165 | - add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1162 | + add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high'); |
|
1163 | + add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1164 | + if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) { |
|
1165 | + add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1166 | 1166 | } |
1167 | - add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' ); |
|
1168 | - if ( $this->_registration->group_size() > 1 ) { |
|
1169 | - add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1167 | + add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high'); |
|
1168 | + if ($this->_registration->group_size() > 1) { |
|
1169 | + add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1170 | 1170 | } |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1187,23 +1187,23 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | //let's get an array of all possible buttons that we can just reference |
1189 | 1189 | $status_buttons = $this->_get_reg_status_buttons(); |
1190 | - $template_args[ 'reg_status_value' ] = $this->_registration->pretty_status(); |
|
1191 | - $template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID(); |
|
1190 | + $template_args['reg_status_value'] = $this->_registration->pretty_status(); |
|
1191 | + $template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID(); |
|
1192 | 1192 | $template_args['attendee'] = $this->_registration->attendee(); |
1193 | - $template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php'; |
|
1194 | - if ( $this->_set_registration_object() ) { |
|
1193 | + $template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php'; |
|
1194 | + if ($this->_set_registration_object()) { |
|
1195 | 1195 | $current_status = $this->_registration->status_ID(); |
1196 | - unset( $status_buttons[$current_status] ); |
|
1197 | - if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) { |
|
1198 | - unset( $status_buttons[EEM_Registration::status_id_pending_payment] ); |
|
1196 | + unset($status_buttons[$current_status]); |
|
1197 | + if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) { |
|
1198 | + unset($status_buttons[EEM_Registration::status_id_pending_payment]); |
|
1199 | 1199 | } |
1200 | - $template_args['status_buttons'] = implode( "\n", $status_buttons ); |
|
1200 | + $template_args['status_buttons'] = implode("\n", $status_buttons); |
|
1201 | 1201 | } |
1202 | 1202 | $template_args['form_url'] = REG_ADMIN_URL; |
1203 | 1203 | $template_args['REG_ID'] = $this->_registration->ID(); |
1204 | - $template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE ); |
|
1204 | + $template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE); |
|
1205 | 1205 | |
1206 | - EEH_Template::display_template( $template, $template_args ); |
|
1206 | + EEH_Template::display_template($template, $template_args); |
|
1207 | 1207 | |
1208 | 1208 | } |
1209 | 1209 | |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | private function _get_reg_status_buttons() { |
1218 | 1218 | |
1219 | 1219 | $buttons = array( |
1220 | - EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">', |
|
1221 | - EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">', |
|
1222 | - EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">', |
|
1223 | - EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">', |
|
1224 | - EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">', |
|
1220 | + EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">', |
|
1221 | + EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">', |
|
1222 | + EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">', |
|
1223 | + EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">', |
|
1224 | + EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">', |
|
1225 | 1225 | ); |
1226 | 1226 | return $buttons; |
1227 | 1227 | } |
@@ -1235,13 +1235,13 @@ discard block |
||
1235 | 1235 | * |
1236 | 1236 | * @return array (array with reg_id(s) updated and whether update was successful. |
1237 | 1237 | */ |
1238 | - protected function _set_registration_status_from_request( $status = false, $notify = false ) { |
|
1239 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1238 | + protected function _set_registration_status_from_request($status = false, $notify = false) { |
|
1239 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array(); |
|
1240 | 1240 | |
1241 | - $success = $this->_set_registration_status( $REG_ID, $status ); |
|
1241 | + $success = $this->_set_registration_status($REG_ID, $status); |
|
1242 | 1242 | |
1243 | 1243 | //notify? |
1244 | - if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) { |
|
1244 | + if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) { |
|
1245 | 1245 | $this->_process_resend_registration(); |
1246 | 1246 | } |
1247 | 1247 | |
@@ -1259,19 +1259,19 @@ discard block |
||
1259 | 1259 | * @param bool $status |
1260 | 1260 | * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations). |
1261 | 1261 | */ |
1262 | - protected function _set_registration_status( $REG_ID, $status = false ) { |
|
1262 | + protected function _set_registration_status($REG_ID, $status = false) { |
|
1263 | 1263 | $success = true; |
1264 | 1264 | // set default status if none is passed |
1265 | 1265 | $status = $status ? $status : EEM_Registration::status_id_pending_payment; |
1266 | 1266 | |
1267 | 1267 | //typecast and sanitize reg_id |
1268 | - $reg_ids = array_filter( (array) $REG_ID, 'absint' ); |
|
1268 | + $reg_ids = array_filter((array) $REG_ID, 'absint'); |
|
1269 | 1269 | |
1270 | 1270 | //loop through REG_ID's and change status |
1271 | - foreach ( $reg_ids as $r_id ) { |
|
1272 | - $registration = EEM_Registration::instance()->get_one_by_ID( $r_id ); |
|
1273 | - if ( $registration instanceof EE_Registration ) { |
|
1274 | - $registration->set_status( $status ); |
|
1271 | + foreach ($reg_ids as $r_id) { |
|
1272 | + $registration = EEM_Registration::instance()->get_one_by_ID($r_id); |
|
1273 | + if ($registration instanceof EE_Registration) { |
|
1274 | + $registration->set_status($status); |
|
1275 | 1275 | $result = $registration->save(); |
1276 | 1276 | |
1277 | 1277 | //verifying explicit fails because update *may* just return 0 for 0 rows affected |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | $this->_req_data['_REG_ID'] = $reg_ids; |
1284 | 1284 | |
1285 | 1285 | //return $success and processed registrations |
1286 | - return array( 'REG_ID' => $reg_ids, 'success' => $success ); |
|
1286 | + return array('REG_ID' => $reg_ids, 'success' => $success); |
|
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | |
@@ -1295,37 +1295,37 @@ discard block |
||
1295 | 1295 | * @param bool $notify indicates whether the _set_registration_status_from_request does notifications or not. |
1296 | 1296 | * @return void |
1297 | 1297 | */ |
1298 | - protected function _reg_status_change_return( $STS_ID, $notify = false ) { |
|
1298 | + protected function _reg_status_change_return($STS_ID, $notify = false) { |
|
1299 | 1299 | |
1300 | - $result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false ); |
|
1300 | + $result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false); |
|
1301 | 1301 | |
1302 | 1302 | |
1303 | - $success = isset( $result['success'] ) && $result['success']; |
|
1303 | + $success = isset($result['success']) && $result['success']; |
|
1304 | 1304 | |
1305 | 1305 | //setup success message |
1306 | - if ( $success ) { |
|
1307 | - $msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1 ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) : sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ; |
|
1308 | - EE_Error::add_success( $msg ); |
|
1306 | + if ($success) { |
|
1307 | + $msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')); |
|
1308 | + EE_Error::add_success($msg); |
|
1309 | 1309 | } else { |
1310 | - EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ ); |
|
1310 | + EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
1311 | 1311 | } |
1312 | 1312 | |
1313 | - $route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' ); |
|
1313 | + $route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default'); |
|
1314 | 1314 | //unset nonces |
1315 | - foreach ( $this->_req_data as $ref => $value ) { |
|
1316 | - if ( strpos( $ref, 'nonce' ) !== false ) { |
|
1317 | - unset( $this->_req_data[$ref] ); |
|
1315 | + foreach ($this->_req_data as $ref => $value) { |
|
1316 | + if (strpos($ref, 'nonce') !== false) { |
|
1317 | + unset($this->_req_data[$ref]); |
|
1318 | 1318 | continue; |
1319 | 1319 | } |
1320 | 1320 | |
1321 | - $value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value ); |
|
1321 | + $value = is_array($value) ? array_map('urlencode', $value) : urlencode($value); |
|
1322 | 1322 | $this->_req_data[$ref] = $value; |
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | //merge request vars so that the reloaded list table contains any existing filter query params |
1326 | - $route = array_merge( $this->_req_data, $route ); |
|
1326 | + $route = array_merge($this->_req_data, $route); |
|
1327 | 1327 | |
1328 | - $this->_redirect_after_action( false, '', '', $route, true ); |
|
1328 | + $this->_redirect_after_action(false, '', '', $route, true); |
|
1329 | 1329 | } |
1330 | 1330 | |
1331 | 1331 | |
@@ -1337,29 +1337,29 @@ discard block |
||
1337 | 1337 | protected function _change_reg_status() { |
1338 | 1338 | $this->_req_data['return'] = 'view_registration'; |
1339 | 1339 | //set notify based on whether the send notifications toggle is set or not |
1340 | - $notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] ); |
|
1341 | - $this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : ''; |
|
1340 | + $notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']); |
|
1341 | + $this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : ''; |
|
1342 | 1342 | |
1343 | - switch ( $this->_req_data['_reg_status_id'] ) { |
|
1344 | - case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) : |
|
1345 | - $this->approve_registration( $notify ); |
|
1343 | + switch ($this->_req_data['_reg_status_id']) { |
|
1344 | + case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') : |
|
1345 | + $this->approve_registration($notify); |
|
1346 | 1346 | break; |
1347 | - case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) : |
|
1348 | - $this->pending_registration( $notify ); |
|
1347 | + case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') : |
|
1348 | + $this->pending_registration($notify); |
|
1349 | 1349 | break; |
1350 | - case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) : |
|
1351 | - $this->not_approve_registration( $notify ); |
|
1350 | + case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') : |
|
1351 | + $this->not_approve_registration($notify); |
|
1352 | 1352 | break; |
1353 | - case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) : |
|
1354 | - $this->decline_registration( $notify ); |
|
1353 | + case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') : |
|
1354 | + $this->decline_registration($notify); |
|
1355 | 1355 | break; |
1356 | - case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) : |
|
1357 | - $this->cancel_registration( $notify ); |
|
1356 | + case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') : |
|
1357 | + $this->cancel_registration($notify); |
|
1358 | 1358 | break; |
1359 | 1359 | default : |
1360 | 1360 | $result['success'] = false; |
1361 | - unset( $this->_req_data['return'] ); |
|
1362 | - $this->_reg_status_change_return( '', false ); |
|
1361 | + unset($this->_req_data['return']); |
|
1362 | + $this->_reg_status_change_return('', false); |
|
1363 | 1363 | break; |
1364 | 1364 | } |
1365 | 1365 | } |
@@ -1372,8 +1372,8 @@ discard block |
||
1372 | 1372 | * @param bool $notify whether or not to notify the registrant about their approval. |
1373 | 1373 | * @return void |
1374 | 1374 | */ |
1375 | - protected function approve_registration( $notify = false ) { |
|
1376 | - $this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify ); |
|
1375 | + protected function approve_registration($notify = false) { |
|
1376 | + $this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify); |
|
1377 | 1377 | } |
1378 | 1378 | |
1379 | 1379 | |
@@ -1385,8 +1385,8 @@ discard block |
||
1385 | 1385 | * @param bool $notify whether or not to notify the registrant about their approval. |
1386 | 1386 | * @return void |
1387 | 1387 | */ |
1388 | - protected function decline_registration( $notify = false ) { |
|
1389 | - $this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify ); |
|
1388 | + protected function decline_registration($notify = false) { |
|
1389 | + $this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | |
@@ -1398,8 +1398,8 @@ discard block |
||
1398 | 1398 | * @param bool $notify whether or not to notify the registrant about their approval. |
1399 | 1399 | * @return void |
1400 | 1400 | */ |
1401 | - protected function cancel_registration( $notify = false ) { |
|
1402 | - $this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify ); |
|
1401 | + protected function cancel_registration($notify = false) { |
|
1402 | + $this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify); |
|
1403 | 1403 | } |
1404 | 1404 | |
1405 | 1405 | |
@@ -1412,8 +1412,8 @@ discard block |
||
1412 | 1412 | * @param bool $notify whether or not to notify the registrant about their approval. |
1413 | 1413 | * @return void |
1414 | 1414 | */ |
1415 | - protected function not_approve_registration( $notify = false ) { |
|
1416 | - $this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify ); |
|
1415 | + protected function not_approve_registration($notify = false) { |
|
1416 | + $this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify); |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | |
@@ -1424,8 +1424,8 @@ discard block |
||
1424 | 1424 | * @param bool $notify whether or not to notify the registrant about their approval. |
1425 | 1425 | * @return void |
1426 | 1426 | */ |
1427 | - protected function pending_registration( $notify = false ) { |
|
1428 | - $this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify ); |
|
1427 | + protected function pending_registration($notify = false) { |
|
1428 | + $this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify); |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | |
@@ -1439,75 +1439,75 @@ discard block |
||
1439 | 1439 | public function _reg_details_meta_box() { |
1440 | 1440 | EEH_Autoloader::register_line_item_display_autoloaders(); |
1441 | 1441 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
1442 | - EE_Registry::instance()->load_Helper( 'Line_Item' ); |
|
1442 | + EE_Registry::instance()->load_Helper('Line_Item'); |
|
1443 | 1443 | $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); |
1444 | 1444 | $this->_session = $transaction->session_data(); |
1445 | 1445 | |
1446 | 1446 | $filters = new EE_Line_Item_Filter_Collection(); |
1447 | - $filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) ); |
|
1448 | - $filters->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
1449 | - $line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() ); |
|
1447 | + $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); |
|
1448 | + $filters->add(new EE_Non_Zero_Line_Item_Filter()); |
|
1449 | + $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); |
|
1450 | 1450 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
1451 | 1451 | |
1452 | 1452 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1453 | - $line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' ); |
|
1454 | - $this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) ); |
|
1453 | + $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); |
|
1454 | + $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); |
|
1455 | 1455 | |
1456 | 1456 | |
1457 | 1457 | $attendee = $this->_registration->attendee(); |
1458 | 1458 | |
1459 | 1459 | |
1460 | - $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID() ), TXN_ADMIN_URL ), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart' ) : ''; |
|
1461 | - $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ?EEH_Template::get_button_or_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration' ), REG_ADMIN_URL ), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt' ) : ''; |
|
1460 | + $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=> 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; |
|
1461 | + $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action'=>'resend_registration', '_REG_ID'=>$this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; |
|
1462 | 1462 | |
1463 | 1463 | |
1464 | 1464 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
1465 | - $payment = $transaction->get_first_related( 'Payment' ); |
|
1465 | + $payment = $transaction->get_first_related('Payment'); |
|
1466 | 1466 | $payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; |
1467 | - $payment_method = $payment->get_first_related( 'Payment_Method' ); |
|
1467 | + $payment_method = $payment->get_first_related('Payment_Method'); |
|
1468 | 1468 | $payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; |
1469 | - $reg_status_class = 'status-' . $this->_registration->status_ID(); |
|
1469 | + $reg_status_class = 'status-'.$this->_registration->status_ID(); |
|
1470 | 1470 | $reg_details = array( |
1471 | 1471 | 'payment_method' => $payment_method->name(), |
1472 | 1472 | 'response_msg' => $payment->gateway_response(), |
1473 | - 'registration_id' => $this->_registration->get( 'REG_code' ), |
|
1473 | + 'registration_id' => $this->_registration->get('REG_code'), |
|
1474 | 1474 | 'registration_session' => $this->_registration->session_ID(), |
1475 | - 'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '', |
|
1476 | - 'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '', |
|
1475 | + 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', |
|
1476 | + 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '', |
|
1477 | 1477 | ); |
1478 | 1478 | |
1479 | 1479 | |
1480 | - if ( isset( $reg_details['registration_id'] )) { |
|
1480 | + if (isset($reg_details['registration_id'])) { |
|
1481 | 1481 | $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; |
1482 | - $this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' ); |
|
1482 | + $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); |
|
1483 | 1483 | $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; |
1484 | 1484 | } |
1485 | 1485 | |
1486 | - if ( isset( $reg_details['payment_method'] ) ) { |
|
1486 | + if (isset($reg_details['payment_method'])) { |
|
1487 | 1487 | $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; |
1488 | - $this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' ); |
|
1488 | + $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); |
|
1489 | 1489 | $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; |
1490 | 1490 | $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; |
1491 | - $this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' ); |
|
1491 | + $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); |
|
1492 | 1492 | $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; |
1493 | 1493 | } |
1494 | 1494 | |
1495 | 1495 | $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; |
1496 | - $this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
1496 | + $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
1497 | 1497 | $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; |
1498 | 1498 | |
1499 | 1499 | $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; |
1500 | - $this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' ); |
|
1500 | + $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); |
|
1501 | 1501 | $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; |
1502 | 1502 | |
1503 | 1503 | $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; |
1504 | - $this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
1504 | + $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
1505 | 1505 | $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; |
1506 | 1506 | |
1507 | - $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL ); |
|
1507 | + $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); |
|
1508 | 1508 | |
1509 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1510 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1509 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php'; |
|
1510 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1511 | 1511 | |
1512 | 1512 | } |
1513 | 1513 | |
@@ -1521,14 +1521,14 @@ discard block |
||
1521 | 1521 | */ |
1522 | 1522 | public function _reg_questions_meta_box() { |
1523 | 1523 | //allow someone to override this method entirely |
1524 | - if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) { |
|
1525 | - $form = $this->_get_reg_custom_questions_form( $this->_registration->ID() ); |
|
1526 | - $this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : ''; |
|
1524 | + if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) { |
|
1525 | + $form = $this->_get_reg_custom_questions_form($this->_registration->ID()); |
|
1526 | + $this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : ''; |
|
1527 | 1527 | $this->_template_args['reg_questions_form_action'] = 'edit_registration'; |
1528 | 1528 | $this->_template_args['REG_ID'] = $this->_registration->ID(); |
1529 | 1529 | |
1530 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1531 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1530 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
1531 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | |
@@ -1542,12 +1542,12 @@ discard block |
||
1542 | 1542 | * @param string $output |
1543 | 1543 | * @return string |
1544 | 1544 | */ |
1545 | - public function form_before_question_group( $output ) { |
|
1545 | + public function form_before_question_group($output) { |
|
1546 | 1546 | EE_Error::doing_it_wrong( |
1547 | - __CLASS__ . '::' . __FUNCTION__, |
|
1548 | - __( 'This method would have been protected but was used on a filter callback' |
|
1547 | + __CLASS__.'::'.__FUNCTION__, |
|
1548 | + __('This method would have been protected but was used on a filter callback' |
|
1549 | 1549 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1550 | - 'event_espresso' ), |
|
1550 | + 'event_espresso'), |
|
1551 | 1551 | '4.8.32.rc.000' |
1552 | 1552 | ); |
1553 | 1553 | return ' |
@@ -1566,20 +1566,20 @@ discard block |
||
1566 | 1566 | * @param string $output |
1567 | 1567 | * @return string |
1568 | 1568 | */ |
1569 | - public function form_after_question_group( $output ) { |
|
1569 | + public function form_after_question_group($output) { |
|
1570 | 1570 | EE_Error::doing_it_wrong( |
1571 | - __CLASS__ . '::' . __FUNCTION__, |
|
1572 | - __( 'This method would have been protected but was used on a filter callback' |
|
1571 | + __CLASS__.'::'.__FUNCTION__, |
|
1572 | + __('This method would have been protected but was used on a filter callback' |
|
1573 | 1573 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1574 | - 'event_espresso' ), |
|
1574 | + 'event_espresso'), |
|
1575 | 1575 | '4.8.32.rc.000' |
1576 | 1576 | ); |
1577 | 1577 | return ' |
1578 | 1578 | <tr class="hide-if-no-js"> |
1579 | 1579 | <th> </th> |
1580 | 1580 | <td class="reg-admin-edit-attendee-question-td"> |
1581 | - <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '"> |
|
1582 | - <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span> |
|
1581 | + <a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'"> |
|
1582 | + <span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span> |
|
1583 | 1583 | <div class="dashicons dashicons-edit"></div> |
1584 | 1584 | </a> |
1585 | 1585 | </td> |
@@ -1599,18 +1599,18 @@ discard block |
||
1599 | 1599 | * @param string $label |
1600 | 1600 | * @return string |
1601 | 1601 | */ |
1602 | - public function form_form_field_label_wrap( $label ) { |
|
1602 | + public function form_form_field_label_wrap($label) { |
|
1603 | 1603 | EE_Error::doing_it_wrong( |
1604 | - __CLASS__ . '::' . __FUNCTION__, |
|
1605 | - __( 'This method would have been protected but was used on a filter callback' |
|
1604 | + __CLASS__.'::'.__FUNCTION__, |
|
1605 | + __('This method would have been protected but was used on a filter callback' |
|
1606 | 1606 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1607 | - 'event_espresso' ), |
|
1607 | + 'event_espresso'), |
|
1608 | 1608 | '4.8.32.rc.000' |
1609 | 1609 | ); |
1610 | 1610 | return ' |
1611 | 1611 | <tr> |
1612 | 1612 | <th> |
1613 | - ' . $label . ' |
|
1613 | + ' . $label.' |
|
1614 | 1614 | </th>'; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1624,17 +1624,17 @@ discard block |
||
1624 | 1624 | * @param string $input |
1625 | 1625 | * @return string |
1626 | 1626 | */ |
1627 | - public function form_form_field_input__wrap( $input ) { |
|
1627 | + public function form_form_field_input__wrap($input) { |
|
1628 | 1628 | EE_Error::doing_it_wrong( |
1629 | - __CLASS__ . '::' . __FUNCTION__, |
|
1630 | - __( 'This method would have been protected but was used on a filter callback' |
|
1629 | + __CLASS__.'::'.__FUNCTION__, |
|
1630 | + __('This method would have been protected but was used on a filter callback' |
|
1631 | 1631 | . 'so needed to be public. Please discontinue usage as it will be removed soon.', |
1632 | - 'event_espresso' ), |
|
1632 | + 'event_espresso'), |
|
1633 | 1633 | '4.8.32.rc.000' |
1634 | 1634 | ); |
1635 | 1635 | return ' |
1636 | 1636 | <td class="reg-admin-attendee-questions-input-td disabled-input"> |
1637 | - ' . $input . ' |
|
1637 | + ' . $input.' |
|
1638 | 1638 | </td> |
1639 | 1639 | </tr>'; |
1640 | 1640 | } |
@@ -1648,14 +1648,14 @@ discard block |
||
1648 | 1648 | * @return void |
1649 | 1649 | */ |
1650 | 1650 | protected function _update_attendee_registration_form() { |
1651 | - do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this ); |
|
1652 | - if( $_SERVER['REQUEST_METHOD'] == 'POST'){ |
|
1653 | - $REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
|
1654 | - $success = $this->_save_reg_custom_questions_form( $REG_ID ); |
|
1655 | - if( $success ) { |
|
1651 | + do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this); |
|
1652 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
1653 | + $REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE; |
|
1654 | + $success = $this->_save_reg_custom_questions_form($REG_ID); |
|
1655 | + if ($success) { |
|
1656 | 1656 | $what = __('Registration Form', 'event_espresso'); |
1657 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
1658 | - $this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
1657 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
1658 | + $this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
1659 | 1659 | } |
1660 | 1660 | } |
1661 | 1661 | } |
@@ -1666,11 +1666,11 @@ discard block |
||
1666 | 1666 | * @param int $REG_ID |
1667 | 1667 | * @return EE_Registration_Custom_Questions_Form |
1668 | 1668 | */ |
1669 | - protected function _get_reg_custom_questions_form( $REG_ID ) { |
|
1670 | - if( ! $this->_reg_custom_questions_form ) { |
|
1671 | - require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' ); |
|
1672 | - $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) ); |
|
1673 | - $this->_reg_custom_questions_form->_construct_finalize( null, null ); |
|
1669 | + protected function _get_reg_custom_questions_form($REG_ID) { |
|
1670 | + if ( ! $this->_reg_custom_questions_form) { |
|
1671 | + require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php'); |
|
1672 | + $this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID)); |
|
1673 | + $this->_reg_custom_questions_form->_construct_finalize(null, null); |
|
1674 | 1674 | } |
1675 | 1675 | return $this->_reg_custom_questions_form; |
1676 | 1676 | } |
@@ -1683,17 +1683,17 @@ discard block |
||
1683 | 1683 | * @param bool $REG_ID |
1684 | 1684 | * @return bool |
1685 | 1685 | */ |
1686 | - private function _save_reg_custom_questions_form( $REG_ID = FALSE ) { |
|
1686 | + private function _save_reg_custom_questions_form($REG_ID = FALSE) { |
|
1687 | 1687 | |
1688 | 1688 | if ( ! $REG_ID) { |
1689 | - EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1689 | + EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1690 | 1690 | } |
1691 | - $form = $this->_get_reg_custom_questions_form( $REG_ID ); |
|
1692 | - $form->receive_form_submission( $this->_req_data ); |
|
1691 | + $form = $this->_get_reg_custom_questions_form($REG_ID); |
|
1692 | + $form->receive_form_submission($this->_req_data); |
|
1693 | 1693 | $success = false; |
1694 | - if( $form->is_valid() ) { |
|
1695 | - foreach( $form->subforms() as $question_group_id => $question_group_form ) { |
|
1696 | - foreach( $question_group_form->inputs() as $question_id => $input ) { |
|
1694 | + if ($form->is_valid()) { |
|
1695 | + foreach ($form->subforms() as $question_group_id => $question_group_form) { |
|
1696 | + foreach ($question_group_form->inputs() as $question_id => $input) { |
|
1697 | 1697 | $where_conditions = array( |
1698 | 1698 | 'QST_ID' => $question_id, |
1699 | 1699 | 'REG_ID' => $REG_ID |
@@ -1701,19 +1701,19 @@ discard block |
||
1701 | 1701 | $possibly_new_values = array( |
1702 | 1702 | 'ANS_value' => $input->normalized_value() |
1703 | 1703 | ); |
1704 | - $answer = EEM_Answer::instance()->get_one( array( $where_conditions ) ); |
|
1705 | - if( $answer instanceof EE_Answer ) { |
|
1706 | - $success = $answer->save( $possibly_new_values ); |
|
1704 | + $answer = EEM_Answer::instance()->get_one(array($where_conditions)); |
|
1705 | + if ($answer instanceof EE_Answer) { |
|
1706 | + $success = $answer->save($possibly_new_values); |
|
1707 | 1707 | } else { |
1708 | 1708 | //insert it then |
1709 | - $cols_n_vals = array_merge( $where_conditions, $possibly_new_values ); |
|
1710 | - $answer = EE_Answer::new_instance( $cols_n_vals ); |
|
1709 | + $cols_n_vals = array_merge($where_conditions, $possibly_new_values); |
|
1710 | + $answer = EE_Answer::new_instance($cols_n_vals); |
|
1711 | 1711 | $success = $answer->save(); |
1712 | 1712 | } |
1713 | 1713 | } |
1714 | 1714 | } |
1715 | 1715 | } else { |
1716 | - EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1716 | + EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__); |
|
1717 | 1717 | } |
1718 | 1718 | return $success; |
1719 | 1719 | } |
@@ -1731,30 +1731,30 @@ discard block |
||
1731 | 1731 | $registrations = $REG->get_all(array( |
1732 | 1732 | array( |
1733 | 1733 | 'TXN_ID'=>$this->_registration->transaction_ID(), |
1734 | - 'REG_ID'=>array('!=',$this->_registration->ID()) |
|
1734 | + 'REG_ID'=>array('!=', $this->_registration->ID()) |
|
1735 | 1735 | ), |
1736 | 1736 | 'force_join'=>array('Attendee'))); |
1737 | 1737 | |
1738 | 1738 | $this->_template_args['attendees'] = array(); |
1739 | 1739 | $this->_template_args['attendee_notice'] = ''; |
1740 | 1740 | EE_Registry::instance()->load_helper('Array'); |
1741 | - if ( empty( $registrations) || ( is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations) ) ) { |
|
1742 | - EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1741 | + if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) { |
|
1742 | + EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1743 | 1743 | $this->_template_args['attendee_notice'] = EE_Error::get_notices(); |
1744 | 1744 | } else { |
1745 | 1745 | |
1746 | 1746 | $att_nmbr = 1; |
1747 | - foreach ( $registrations as $registration ) { |
|
1747 | + foreach ($registrations as $registration) { |
|
1748 | 1748 | /* @var $registration EE_Registration */ |
1749 | 1749 | $attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object(); |
1750 | - $this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1751 | - $this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1752 | - $this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1753 | - $this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1750 | + $this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : ''; |
|
1751 | + $this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : ''; |
|
1752 | + $this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : ''; |
|
1753 | + $this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : ''; |
|
1754 | 1754 | |
1755 | - $this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() ); |
|
1755 | + $this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array()); |
|
1756 | 1756 | |
1757 | - $this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1757 | + $this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1758 | 1758 | |
1759 | 1759 | $att_nmbr++; |
1760 | 1760 | } |
@@ -1766,8 +1766,8 @@ discard block |
||
1766 | 1766 | |
1767 | 1767 | // $this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees' ), REG_ADMIN_URL ); |
1768 | 1768 | } |
1769 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1770 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1769 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php'; |
|
1770 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1771 | 1771 | |
1772 | 1772 | } |
1773 | 1773 | |
@@ -1788,11 +1788,11 @@ discard block |
||
1788 | 1788 | $attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object(); |
1789 | 1789 | |
1790 | 1790 | //now let's determine if this is not the primary registration. If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show cereate button or not) |
1791 | - if ( ! $this->_registration->is_primary_registrant() ) { |
|
1791 | + if ( ! $this->_registration->is_primary_registrant()) { |
|
1792 | 1792 | $primary_registration = $this->_registration->get_primary_registration(); |
1793 | 1793 | $primary_attendee = $primary_registration->attendee(); |
1794 | 1794 | |
1795 | - if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) { |
|
1795 | + if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) { |
|
1796 | 1796 | //in here? This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg. |
1797 | 1797 | $primary_registration = NULL; |
1798 | 1798 | } |
@@ -1801,28 +1801,28 @@ discard block |
||
1801 | 1801 | } |
1802 | 1802 | |
1803 | 1803 | $this->_template_args['ATT_ID'] = $attendee->ID(); |
1804 | - $this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname; |
|
1805 | - $this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname; |
|
1806 | - $this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email; |
|
1804 | + $this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname; |
|
1805 | + $this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname; |
|
1806 | + $this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email; |
|
1807 | 1807 | $this->_template_args['phone'] = $attendee->phone(); |
1808 | 1808 | |
1809 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1810 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee ); |
|
1809 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1810 | + $this->_template_args['formatted_address'] = EEH_Address::format($attendee); |
|
1811 | 1811 | |
1812 | 1812 | |
1813 | 1813 | //edit link |
1814 | - $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL ); |
|
1815 | - $this->_template_args['att_edit_label'] = __('View/Edit Contact' ); |
|
1814 | + $this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL); |
|
1815 | + $this->_template_args['att_edit_label'] = __('View/Edit Contact'); |
|
1816 | 1816 | |
1817 | 1817 | //create link |
1818 | - $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): ''; |
|
1818 | + $this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : ''; |
|
1819 | 1819 | $this->_template_args['create_label'] = __('Create Contact', 'event_espresso'); |
1820 | 1820 | |
1821 | 1821 | $this->_template_args['att_check'] = $att_check; |
1822 | 1822 | |
1823 | 1823 | |
1824 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1825 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
1824 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php'; |
|
1825 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
1826 | 1826 | } |
1827 | 1827 | |
1828 | 1828 | |
@@ -1835,7 +1835,7 @@ discard block |
||
1835 | 1835 | * @access protected |
1836 | 1836 | * @return void |
1837 | 1837 | */ |
1838 | - protected function _trash_or_restore_registrations( $trash = TRUE ) { |
|
1838 | + protected function _trash_or_restore_registrations($trash = TRUE) { |
|
1839 | 1839 | $REGM = EEM_Registration::instance(); |
1840 | 1840 | |
1841 | 1841 | $success = 1; |
@@ -1845,26 +1845,26 @@ discard block |
||
1845 | 1845 | $dtts = array(); |
1846 | 1846 | |
1847 | 1847 | //if empty _REG_ID then get out because there's nothing to do |
1848 | - if ( empty( $this->_req_data['_REG_ID'] ) ) { |
|
1848 | + if (empty($this->_req_data['_REG_ID'])) { |
|
1849 | 1849 | $msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso'); |
1850 | - EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ ); |
|
1851 | - $this->_redirect_after_action(FALSE, '', '', array(), TRUE ); |
|
1850 | + EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__); |
|
1851 | + $this->_redirect_after_action(FALSE, '', '', array(), TRUE); |
|
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | //Checkboxes |
1855 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1855 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1856 | 1856 | // if array has more than one element than success message should be plural |
1857 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1857 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1858 | 1858 | // cycle thru checkboxes |
1859 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1859 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1860 | 1860 | |
1861 | 1861 | $REG = $REGM->get_one_by_ID($REG_ID); |
1862 | 1862 | $payment_count = $REG->get_first_related('Transaction')->count_related('Payment'); |
1863 | - if ( $payment_count > 0 ) { |
|
1864 | - $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ); |
|
1863 | + if ($payment_count > 0) { |
|
1864 | + $name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso'); |
|
1865 | 1865 | $error = 1; |
1866 | 1866 | $success = 0; |
1867 | - EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1867 | + EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction. If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__); |
|
1868 | 1868 | continue; //can't trash this registration because it has payments. |
1869 | 1869 | } |
1870 | 1870 | $ticket = $REG->get_first_related('Ticket'); |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | $dtts = array_merge($dtts, $dtt); |
1874 | 1874 | |
1875 | 1875 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1876 | - if ( !$updated ) { |
|
1876 | + if ( ! $updated) { |
|
1877 | 1877 | $success = 0; |
1878 | 1878 | } else { |
1879 | 1879 | $success = 2; |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | $tickets[$ticket->ID()] = $ticket; |
1889 | 1889 | $dtts = $ticket->get_many_related('Datetime'); |
1890 | 1890 | $updated = $trash ? $REG->delete() : $REG->restore(); |
1891 | - if ( ! $updated ) { |
|
1891 | + if ( ! $updated) { |
|
1892 | 1892 | $success = 0; |
1893 | 1893 | } |
1894 | 1894 | |
@@ -1898,10 +1898,10 @@ discard block |
||
1898 | 1898 | EEM_Ticket::instance()->update_tickets_sold($tickets); |
1899 | 1899 | EEM_Datetime::instance()->update_sold($dtts); |
1900 | 1900 | |
1901 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1902 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
1901 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1902 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
1903 | 1903 | $overwrite_msgs = $error ? TRUE : FALSE; |
1904 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs ); |
|
1904 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs); |
|
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | |
@@ -1925,16 +1925,16 @@ discard block |
||
1925 | 1925 | $success = 1; |
1926 | 1926 | |
1927 | 1927 | //Checkboxes |
1928 | - if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1928 | + if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) { |
|
1929 | 1929 | // if array has more than one element than success message should be plural |
1930 | - $success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1; |
|
1930 | + $success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1; |
|
1931 | 1931 | // cycle thru checkboxes |
1932 | - while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
|
1932 | + while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) { |
|
1933 | 1933 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1934 | - if ( ! $REG instanceof EE_Registration ) |
|
1934 | + if ( ! $REG instanceof EE_Registration) |
|
1935 | 1935 | continue; |
1936 | 1936 | $deleted = $this->_delete_registration($REG); |
1937 | - if ( !$deleted ) { |
|
1937 | + if ( ! $deleted) { |
|
1938 | 1938 | $success = 0; |
1939 | 1939 | } |
1940 | 1940 | } |
@@ -1944,15 +1944,15 @@ discard block |
||
1944 | 1944 | $REG_ID = $this->_req_data['_REG_ID']; |
1945 | 1945 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1946 | 1946 | $deleted = $this->_delete_registration($REG); |
1947 | - if ( ! $deleted ) { |
|
1947 | + if ( ! $deleted) { |
|
1948 | 1948 | $success = 0; |
1949 | 1949 | } |
1950 | 1950 | |
1951 | 1951 | } |
1952 | 1952 | |
1953 | - $what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' ); |
|
1954 | - $action_desc = __( 'permanently deleted.', 'event_espresso' ); |
|
1955 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE ); |
|
1953 | + $what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso'); |
|
1954 | + $action_desc = __('permanently deleted.', 'event_espresso'); |
|
1955 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE); |
|
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | |
@@ -1964,31 +1964,31 @@ discard block |
||
1964 | 1964 | * @param EE_Registration $REG registration to be deleted permenantly |
1965 | 1965 | * @return boolean true = successful deletion, false = fail. |
1966 | 1966 | */ |
1967 | - protected function _delete_registration( EE_Registration $REG ) { |
|
1967 | + protected function _delete_registration(EE_Registration $REG) { |
|
1968 | 1968 | //first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed. |
1969 | 1969 | $TXN = $REG->get_first_related('Transaction'); |
1970 | 1970 | $REGS = $TXN->get_many_related('Registration'); |
1971 | 1971 | |
1972 | 1972 | $all_trashed = TRUE; |
1973 | - foreach ( $REGS as $registration ) { |
|
1974 | - if ( ! $registration->get('REG_deleted') ) |
|
1973 | + foreach ($REGS as $registration) { |
|
1974 | + if ( ! $registration->get('REG_deleted')) |
|
1975 | 1975 | $all_trashed = FALSE; |
1976 | 1976 | } |
1977 | 1977 | |
1978 | - if ( ! $all_trashed ) { |
|
1979 | - EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1978 | + if ( ! $all_trashed) { |
|
1979 | + EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well. These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1980 | 1980 | return false; |
1981 | 1981 | } |
1982 | 1982 | |
1983 | 1983 | //k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one). |
1984 | - foreach ( $REGS as $registration ) { |
|
1984 | + foreach ($REGS as $registration) { |
|
1985 | 1985 | |
1986 | 1986 | //delete related answers |
1987 | 1987 | $registration->delete_related_permanently('Answer'); |
1988 | 1988 | |
1989 | 1989 | //remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact) |
1990 | 1990 | $attendee = $registration->get_first_related('Attendee'); |
1991 | - if ( $attendee instanceof EE_Attendee ) { |
|
1991 | + if ($attendee instanceof EE_Attendee) { |
|
1992 | 1992 | $registration->_remove_relation_to($attendee, 'Attendee'); |
1993 | 1993 | } |
1994 | 1994 | |
@@ -1998,7 +1998,7 @@ discard block |
||
1998 | 1998 | //now delete permanently the checkins related to this registration. |
1999 | 1999 | $registration->delete_related_permanently('Checkin'); |
2000 | 2000 | |
2001 | - if ( $registration->ID() === $REG->ID() ) |
|
2001 | + if ($registration->ID() === $REG->ID()) |
|
2002 | 2002 | continue; //we don't want to delete permanently the existing registration just yet. |
2003 | 2003 | |
2004 | 2004 | //remove relation to transaction for these registrations if NOT the existing registrations |
@@ -2031,35 +2031,35 @@ discard block |
||
2031 | 2031 | * @return void |
2032 | 2032 | */ |
2033 | 2033 | public function new_registration() { |
2034 | - if ( ! $this->_set_reg_event() ) { |
|
2035 | - throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') ); |
|
2034 | + if ( ! $this->_set_reg_event()) { |
|
2035 | + throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso')); |
|
2036 | 2036 | } |
2037 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2037 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2038 | 2038 | // gotta start with a clean slate if we're not coming here via ajax |
2039 | 2039 | if ( |
2040 | - ! defined('DOING_AJAX' ) |
|
2041 | - && ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) ) |
|
2040 | + ! defined('DOING_AJAX') |
|
2041 | + && ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error'])) |
|
2042 | 2042 | ) { |
2043 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2043 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2044 | 2044 | } |
2045 | 2045 | |
2046 | - $this->_template_args['event_name'] = '' ; |
|
2046 | + $this->_template_args['event_name'] = ''; |
|
2047 | 2047 | // event name |
2048 | - if ( $this->_reg_event ) { |
|
2048 | + if ($this->_reg_event) { |
|
2049 | 2049 | $this->_template_args['event_name'] = $this->_reg_event->name(); |
2050 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL ); |
|
2051 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
2052 | - $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
2050 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL); |
|
2051 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
2052 | + $this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
2053 | 2053 | } |
2054 | 2054 | |
2055 | 2055 | $this->_template_args['step_content'] = $this->_get_registration_step_content(); |
2056 | 2056 | |
2057 | - if ( defined('DOING_AJAX' ) ) { |
|
2057 | + if (defined('DOING_AJAX')) { |
|
2058 | 2058 | $this->_return_json(); |
2059 | 2059 | } |
2060 | 2060 | // grab header |
2061 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php'; |
|
2062 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2061 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php'; |
|
2062 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2063 | 2063 | |
2064 | 2064 | //$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
2065 | 2065 | // the details template wrapper |
@@ -2076,7 +2076,7 @@ discard block |
||
2076 | 2076 | * @return string html |
2077 | 2077 | */ |
2078 | 2078 | protected function _get_registration_step_content() { |
2079 | - if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) { |
|
2079 | + if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) { |
|
2080 | 2080 | $warning_msg = sprintf( |
2081 | 2081 | __( |
2082 | 2082 | '%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s', |
@@ -2092,7 +2092,7 @@ discard block |
||
2092 | 2092 | '</b>' |
2093 | 2093 | ); |
2094 | 2094 | return ' |
2095 | - <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div> |
|
2095 | + <div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div> |
|
2096 | 2096 | <script > |
2097 | 2097 | // WHOAH !!! it appears that someone is using the back button from the Transaction admin page |
2098 | 2098 | // after just adding a new registration... we gotta try to put a stop to that !!! |
@@ -2127,16 +2127,16 @@ discard block |
||
2127 | 2127 | $cart = EE_Registry::instance()->SSN->cart(); |
2128 | 2128 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2129 | 2129 | |
2130 | - switch ( $step ) { |
|
2130 | + switch ($step) { |
|
2131 | 2131 | case 'ticket' : |
2132 | 2132 | $hidden_fields['processing_registration']['value'] = 1; |
2133 | 2133 | $template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso'); |
2134 | - $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event ); |
|
2134 | + $template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event); |
|
2135 | 2135 | $template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso'); |
2136 | 2136 | $template_args['show_notification_toggle'] = FALSE; |
2137 | 2137 | break; |
2138 | 2138 | case 'questions' : |
2139 | - $hidden_fields[ 'processing_registration' ][ 'value' ] = 2; |
|
2139 | + $hidden_fields['processing_registration']['value'] = 2; |
|
2140 | 2140 | $template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso'); |
2141 | 2141 | //in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run. |
2142 | 2142 | $template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin(); |
@@ -2145,10 +2145,10 @@ discard block |
||
2145 | 2145 | break; |
2146 | 2146 | } |
2147 | 2147 | |
2148 | - $this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route. |
|
2148 | + $this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route. |
|
2149 | 2149 | |
2150 | 2150 | return EEH_Template::display_template( |
2151 | - REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2151 | + REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE |
|
2152 | 2152 | ); |
2153 | 2153 | } |
2154 | 2154 | |
@@ -2163,11 +2163,11 @@ discard block |
||
2163 | 2163 | * @return boolean |
2164 | 2164 | */ |
2165 | 2165 | private function _set_reg_event() { |
2166 | - if ( is_object( $this->_reg_event )) { |
|
2166 | + if (is_object($this->_reg_event)) { |
|
2167 | 2167 | return TRUE; |
2168 | 2168 | } |
2169 | - $EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
2170 | - if ( ! $EVT_ID ) { |
|
2169 | + $EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE; |
|
2170 | + if ( ! $EVT_ID) { |
|
2171 | 2171 | return FALSE; |
2172 | 2172 | } |
2173 | 2173 | |
@@ -2188,82 +2188,82 @@ discard block |
||
2188 | 2188 | public function process_reg_step() { |
2189 | 2189 | EE_System::do_not_cache(); |
2190 | 2190 | $this->_set_reg_event(); |
2191 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
2191 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
2192 | 2192 | |
2193 | 2193 | //what step are we on? |
2194 | 2194 | $cart = EE_Registry::instance()->SSN->cart(); |
2195 | 2195 | $step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions'; |
2196 | 2196 | |
2197 | 2197 | //if doing ajax then we need to verify the nonce |
2198 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2199 | - $nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : ''; |
|
2200 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
2198 | + if (defined('DOING_AJAX')) { |
|
2199 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
2200 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
2201 | 2201 | } |
2202 | 2202 | |
2203 | - switch ( $step ) { |
|
2203 | + switch ($step) { |
|
2204 | 2204 | |
2205 | 2205 | case 'ticket' : |
2206 | 2206 | //process ticket selection |
2207 | 2207 | $success = EED_Ticket_Selector::instance()->process_ticket_selections(); |
2208 | - if ( $success ) { |
|
2209 | - EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2208 | + if ($success) { |
|
2209 | + EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso'); |
|
2210 | 2210 | } else { |
2211 | 2211 | $query_args['step_error'] = $this->_req_data['step_error'] = TRUE; |
2212 | 2212 | } |
2213 | - if ( defined('DOING_AJAX') ) { |
|
2213 | + if (defined('DOING_AJAX')) { |
|
2214 | 2214 | $this->new_registration(); //display next step |
2215 | 2215 | } else { |
2216 | 2216 | $query_args['action'] = 'new_registration'; |
2217 | 2217 | $query_args['processing_registration'] = 1; |
2218 | 2218 | $query_args['event_id'] = $this->_reg_event->ID(); |
2219 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2219 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2220 | 2220 | } |
2221 | 2221 | break; |
2222 | 2222 | |
2223 | 2223 | case 'questions' : |
2224 | - if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) { |
|
2225 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 ); |
|
2224 | + if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) { |
|
2225 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); |
|
2226 | 2226 | } |
2227 | 2227 | //process registration |
2228 | 2228 | $transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin(); |
2229 | - if ( $cart instanceof EE_Cart ) { |
|
2229 | + if ($cart instanceof EE_Cart) { |
|
2230 | 2230 | $grand_total = $cart->get_cart_grand_total(); |
2231 | - if ( $grand_total instanceof EE_Line_Item ) { |
|
2231 | + if ($grand_total instanceof EE_Line_Item) { |
|
2232 | 2232 | $grand_total->save_this_and_descendants_to_txn(); |
2233 | 2233 | } |
2234 | 2234 | } |
2235 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
2235 | + if ( ! $transaction instanceof EE_Transaction) { |
|
2236 | 2236 | $query_args = array( |
2237 | 2237 | 'action' => 'new_registration', |
2238 | 2238 | 'processing_registration' => 2, |
2239 | 2239 | 'event_id' => $this->_reg_event->ID() |
2240 | 2240 | ); |
2241 | 2241 | |
2242 | - if ( defined('DOING_AJAX' )) { |
|
2242 | + if (defined('DOING_AJAX')) { |
|
2243 | 2243 | //display registration form again because there are errors (maybe validation?) |
2244 | 2244 | $this->new_registration(); |
2245 | 2245 | return; |
2246 | 2246 | } else { |
2247 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
2247 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2248 | 2248 | return; |
2249 | 2249 | } |
2250 | 2250 | } |
2251 | 2251 | /** @type EE_Transaction_Payments $transaction_payments */ |
2252 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
2252 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
2253 | 2253 | // maybe update status, and make sure to save transaction if not done already |
2254 | - if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) { |
|
2254 | + if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) { |
|
2255 | 2255 | $transaction->save(); |
2256 | 2256 | } |
2257 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2257 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2258 | 2258 | $this->_req_data = array(); |
2259 | 2259 | $query_args = array( |
2260 | 2260 | 'action' => 'redirect_to_txn', |
2261 | 2261 | 'TXN_ID' => $transaction->ID(), |
2262 | 2262 | 'EVT_ID' => $this->_reg_event->ID(), |
2263 | - 'event_name' => urlencode( $this->_reg_event->name() ), |
|
2263 | + 'event_name' => urlencode($this->_reg_event->name()), |
|
2264 | 2264 | 'redirect_from' => 'new_registration' |
2265 | 2265 | ); |
2266 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2266 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2267 | 2267 | break; |
2268 | 2268 | } |
2269 | 2269 | |
@@ -2280,21 +2280,21 @@ discard block |
||
2280 | 2280 | */ |
2281 | 2281 | public function redirect_to_txn() { |
2282 | 2282 | EE_System::do_not_cache(); |
2283 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
2283 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
2284 | 2284 | $query_args = array( |
2285 | 2285 | 'action' => 'view_transaction', |
2286 | - 'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] ) : 0, |
|
2286 | + 'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0, |
|
2287 | 2287 | 'page' => 'espresso_transactions' |
2288 | 2288 | ); |
2289 | - if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) { |
|
2290 | - $query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ]; |
|
2291 | - $query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] ); |
|
2292 | - $query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ]; |
|
2289 | + if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) { |
|
2290 | + $query_args['EVT_ID'] = $this->_req_data['EVT_ID']; |
|
2291 | + $query_args['event_name'] = urlencode($this->_req_data['event_name']); |
|
2292 | + $query_args['redirect_from'] = $this->_req_data['redirect_from']; |
|
2293 | 2293 | } |
2294 | 2294 | EE_Error::add_success( |
2295 | - __( 'Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso' ) |
|
2295 | + __('Registration Created. Please review the transaction and add any payments as necessary', 'event_espresso') |
|
2296 | 2296 | ); |
2297 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
2297 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
2298 | 2298 | } |
2299 | 2299 | |
2300 | 2300 | |
@@ -2305,7 +2305,7 @@ discard block |
||
2305 | 2305 | * @return void |
2306 | 2306 | */ |
2307 | 2307 | protected function _attendee_contact_list_table() { |
2308 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2308 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2309 | 2309 | $this->_search_btn_label = __('Contacts', 'event_espresso'); |
2310 | 2310 | $this->display_admin_list_table_page_with_no_sidebar(); |
2311 | 2311 | } |
@@ -2320,10 +2320,10 @@ discard block |
||
2320 | 2320 | * @access public |
2321 | 2321 | * @return array |
2322 | 2322 | */ |
2323 | - public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) { |
|
2323 | + public function get_attendees($per_page, $count = FALSE, $trash = FALSE) { |
|
2324 | 2324 | |
2325 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2326 | - require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' ); |
|
2325 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2326 | + require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php'); |
|
2327 | 2327 | $ATT_MDL = EEM_Attendee::instance(); |
2328 | 2328 | |
2329 | 2329 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
@@ -2351,47 +2351,47 @@ discard block |
||
2351 | 2351 | $orderby = 'ATT_lname'; |
2352 | 2352 | } |
2353 | 2353 | |
2354 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
2354 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
2355 | 2355 | |
2356 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
2357 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
2358 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
2356 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
2357 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
2358 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
2359 | 2359 | |
2360 | 2360 | $_where = array(); |
2361 | 2361 | |
2362 | - if ( isset( $this->_req_data['s'] ) ) { |
|
2363 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
2362 | + if (isset($this->_req_data['s'])) { |
|
2363 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
2364 | 2364 | $_where['OR'] = array( |
2365 | - 'Registration.Event.EVT_name' => array( 'LIKE', $sstr), |
|
2366 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
2367 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
2368 | - 'ATT_fname' => array( 'LIKE', $sstr ), |
|
2369 | - 'ATT_lname' => array( 'LIKE', $sstr ), |
|
2370 | - 'ATT_short_bio' => array( 'LIKE', $sstr ), |
|
2371 | - 'ATT_email' => array('LIKE', $sstr ), |
|
2372 | - 'ATT_address' => array( 'LIKE', $sstr ), |
|
2373 | - 'ATT_address2' => array( 'LIKE', $sstr ), |
|
2374 | - 'ATT_city' => array( 'LIKE', $sstr ), |
|
2375 | - 'Country.CNT_name' => array( 'LIKE', $sstr ), |
|
2376 | - 'State.STA_name' => array('LIKE', $sstr ), |
|
2377 | - 'ATT_phone' => array( 'LIKE', $sstr ), |
|
2378 | - 'Registration.REG_final_price' => array( 'LIKE', $sstr ), |
|
2379 | - 'Registration.REG_code' => array( 'LIKE', $sstr ), |
|
2380 | - 'Registration.REG_count' => array( 'LIKE' , $sstr ), |
|
2381 | - 'Registration.REG_group_size' => array( 'LIKE' , $sstr ) |
|
2365 | + 'Registration.Event.EVT_name' => array('LIKE', $sstr), |
|
2366 | + 'Registration.Event.EVT_desc' => array('LIKE', $sstr), |
|
2367 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $sstr), |
|
2368 | + 'ATT_fname' => array('LIKE', $sstr), |
|
2369 | + 'ATT_lname' => array('LIKE', $sstr), |
|
2370 | + 'ATT_short_bio' => array('LIKE', $sstr), |
|
2371 | + 'ATT_email' => array('LIKE', $sstr), |
|
2372 | + 'ATT_address' => array('LIKE', $sstr), |
|
2373 | + 'ATT_address2' => array('LIKE', $sstr), |
|
2374 | + 'ATT_city' => array('LIKE', $sstr), |
|
2375 | + 'Country.CNT_name' => array('LIKE', $sstr), |
|
2376 | + 'State.STA_name' => array('LIKE', $sstr), |
|
2377 | + 'ATT_phone' => array('LIKE', $sstr), |
|
2378 | + 'Registration.REG_final_price' => array('LIKE', $sstr), |
|
2379 | + 'Registration.REG_code' => array('LIKE', $sstr), |
|
2380 | + 'Registration.REG_count' => array('LIKE', $sstr), |
|
2381 | + 'Registration.REG_group_size' => array('LIKE', $sstr) |
|
2382 | 2382 | ); |
2383 | 2383 | } |
2384 | 2384 | |
2385 | 2385 | |
2386 | - $offset = ($current_page-1)*$per_page; |
|
2387 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
2386 | + $offset = ($current_page - 1) * $per_page; |
|
2387 | + $limit = $count ? NULL : array($offset, $per_page); |
|
2388 | 2388 | |
2389 | - if ( $trash ) { |
|
2390 | - $_where['status'] = array( '!=', 'publish' ); |
|
2391 | - $all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2389 | + if ($trash) { |
|
2390 | + $_where['status'] = array('!=', 'publish'); |
|
2391 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2392 | 2392 | } else { |
2393 | - $_where['status'] = array( 'IN', array( 'publish' ) ); |
|
2394 | - $all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) ); |
|
2393 | + $_where['status'] = array('IN', array('publish')); |
|
2394 | + $all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)); |
|
2395 | 2395 | } |
2396 | 2396 | |
2397 | 2397 | return $all_attendees; |
@@ -2408,10 +2408,10 @@ discard block |
||
2408 | 2408 | */ |
2409 | 2409 | protected function _resend_registration() { |
2410 | 2410 | $this->_process_resend_registration(); |
2411 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array( |
|
2411 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array( |
|
2412 | 2412 | 'action' => 'default' |
2413 | 2413 | ); |
2414 | - $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE ); |
|
2414 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
2415 | 2415 | } |
2416 | 2416 | |
2417 | 2417 | |
@@ -2419,27 +2419,27 @@ discard block |
||
2419 | 2419 | |
2420 | 2420 | |
2421 | 2421 | |
2422 | - public function _registrations_report(){ |
|
2423 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2424 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2422 | + public function _registrations_report() { |
|
2423 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2424 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2425 | 2425 | array( |
2426 | 2426 | 'page' => 'espresso_batch', |
2427 | 2427 | 'batch' => 'file', |
2428 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2429 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ), |
|
2430 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2431 | - )) ); |
|
2428 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2429 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'), |
|
2430 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2431 | + ))); |
|
2432 | 2432 | } else { |
2433 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2433 | + EE_Registry::instance()->load_helper('File'); |
|
2434 | 2434 | $new_request_args = array( |
2435 | 2435 | 'export' => 'report', |
2436 | 2436 | 'action' => 'registrations_report_for_event', |
2437 | - 'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL, |
|
2437 | + 'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL, |
|
2438 | 2438 | ); |
2439 | 2439 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
2440 | 2440 | |
2441 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2442 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2441 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2442 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2443 | 2443 | $EE_Export = EE_Export::instance($this->_req_data); |
2444 | 2444 | $EE_Export->export(); |
2445 | 2445 | } |
@@ -2448,28 +2448,28 @@ discard block |
||
2448 | 2448 | |
2449 | 2449 | |
2450 | 2450 | |
2451 | - public function _contact_list_export(){ |
|
2452 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2453 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2454 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2451 | + public function _contact_list_export() { |
|
2452 | + EE_Registry::instance()->load_helper('File'); |
|
2453 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2454 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2455 | 2455 | $EE_Export = EE_Export::instance($this->_req_data); |
2456 | 2456 | $EE_Export->export_attendees(); |
2457 | 2457 | } |
2458 | 2458 | } |
2459 | 2459 | |
2460 | - public function _contact_list_report(){ |
|
2461 | - if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) { |
|
2462 | - wp_redirect( EE_Admin_Page::add_query_args_and_nonce( |
|
2460 | + public function _contact_list_report() { |
|
2461 | + if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) { |
|
2462 | + wp_redirect(EE_Admin_Page::add_query_args_and_nonce( |
|
2463 | 2463 | array( |
2464 | 2464 | 'page' => 'espresso_batch', |
2465 | 2465 | 'batch' => 'file', |
2466 | - 'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ), |
|
2467 | - 'return_url' => urlencode( $this->_req_data[ 'return_url' ] ), |
|
2468 | - )) ); |
|
2466 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'), |
|
2467 | + 'return_url' => urlencode($this->_req_data['return_url']), |
|
2468 | + ))); |
|
2469 | 2469 | } else { |
2470 | - EE_Registry::instance()->load_helper( 'File' ); |
|
2471 | - if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
2472 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
2470 | + EE_Registry::instance()->load_helper('File'); |
|
2471 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
2472 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
2473 | 2473 | $EE_Export = EE_Export::instance($this->_req_data); |
2474 | 2474 | $EE_Export->report_attendees(); |
2475 | 2475 | } |
@@ -2489,73 +2489,73 @@ discard block |
||
2489 | 2489 | * @return void |
2490 | 2490 | */ |
2491 | 2491 | protected function _duplicate_attendee() { |
2492 | - $action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default'; |
|
2492 | + $action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default'; |
|
2493 | 2493 | //verify we have necessary info |
2494 | - if ( empty($this->_req_data['_REG_ID'] ) ) { |
|
2495 | - EE_Error::add_error( __('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__ ); |
|
2496 | - $query_args = array( 'action' => $action ); |
|
2494 | + if (empty($this->_req_data['_REG_ID'])) { |
|
2495 | + EE_Error::add_error(__('Unable to create the contact for the registration because the required paramaters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__); |
|
2496 | + $query_args = array('action' => $action); |
|
2497 | 2497 | $this->_redirect_after_action('', '', '', $query_args, TRUE); |
2498 | 2498 | } |
2499 | 2499 | |
2500 | 2500 | //okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration. |
2501 | - $registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] ); |
|
2501 | + $registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']); |
|
2502 | 2502 | $attendee = $registration->attendee(); |
2503 | 2503 | |
2504 | 2504 | //remove relation of existing attendee on registration |
2505 | - $registration->_remove_relation_to($attendee, 'Attendee' ); |
|
2505 | + $registration->_remove_relation_to($attendee, 'Attendee'); |
|
2506 | 2506 | //new attendee |
2507 | 2507 | $new_attendee = clone $attendee; |
2508 | - $new_attendee->set( 'ATT_ID', 0 ); |
|
2508 | + $new_attendee->set('ATT_ID', 0); |
|
2509 | 2509 | $new_attendee->save(); |
2510 | 2510 | |
2511 | 2511 | //add new attendee to reg |
2512 | - $registration->_add_relation_to( $new_attendee, 'Attendee'); |
|
2512 | + $registration->_add_relation_to($new_attendee, 'Attendee'); |
|
2513 | 2513 | |
2514 | - EE_Error::add_success( __('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso') ); |
|
2514 | + EE_Error::add_success(__('New Contact record created. Now make any edits you wish to make for this contact.', 'event_espresso')); |
|
2515 | 2515 | |
2516 | 2516 | //redirect to edit page for attendee |
2517 | - $query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' ); |
|
2517 | + $query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee'); |
|
2518 | 2518 | |
2519 | - $this->_redirect_after_action( '', '', '', $query_args, TRUE ); |
|
2519 | + $this->_redirect_after_action('', '', '', $query_args, TRUE); |
|
2520 | 2520 | } |
2521 | 2521 | |
2522 | 2522 | |
2523 | 2523 | //related to cpt routes |
2524 | 2524 | protected function _insert_update_cpt_item($post_id, $post) { |
2525 | 2525 | $success = true; |
2526 | - $attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id ); |
|
2526 | + $attendee = EEM_Attendee::instance()->get_one_by_ID($post_id); |
|
2527 | 2527 | //for attendee updates |
2528 | - if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) { |
|
2528 | + if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) { |
|
2529 | 2529 | //note we should only be UPDATING attendees at this point. |
2530 | 2530 | $updated_fields = array( |
2531 | 2531 | 'ATT_fname' => $this->_req_data['ATT_fname'], |
2532 | 2532 | 'ATT_lname' => $this->_req_data['ATT_lname'], |
2533 | - 'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'], |
|
2533 | + 'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'], |
|
2534 | 2534 | 'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '', |
2535 | 2535 | 'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '', |
2536 | - 'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '', |
|
2537 | - 'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '', |
|
2538 | - 'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '', |
|
2539 | - 'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '', |
|
2540 | - 'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '', |
|
2541 | - 'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : '' |
|
2536 | + 'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '', |
|
2537 | + 'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '', |
|
2538 | + 'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '', |
|
2539 | + 'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '', |
|
2540 | + 'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '', |
|
2541 | + 'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : '' |
|
2542 | 2542 | ); |
2543 | - foreach ( $updated_fields as $field => $value ) { |
|
2543 | + foreach ($updated_fields as $field => $value) { |
|
2544 | 2544 | $attendee->set($field, $value); |
2545 | 2545 | } |
2546 | 2546 | |
2547 | 2547 | $success = $attendee->save(); |
2548 | 2548 | |
2549 | - $attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() ); |
|
2550 | - foreach ( $attendee_update_callbacks as $a_callback ) { |
|
2551 | - if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) { |
|
2552 | - throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback ) ); |
|
2549 | + $attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array()); |
|
2550 | + foreach ($attendee_update_callbacks as $a_callback) { |
|
2551 | + if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) { |
|
2552 | + throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback. Please check the spelling.', 'event_espresso'), $a_callback)); |
|
2553 | 2553 | } |
2554 | 2554 | } |
2555 | 2555 | } |
2556 | 2556 | |
2557 | - if ( $success === FALSE ) |
|
2558 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2557 | + if ($success === FALSE) |
|
2558 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2559 | 2559 | |
2560 | 2560 | } |
2561 | 2561 | |
@@ -2575,17 +2575,17 @@ discard block |
||
2575 | 2575 | remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2576 | 2576 | remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2577 | 2577 | |
2578 | - if ( post_type_supports( 'espresso_attendees', 'excerpt') ) { |
|
2579 | - add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' ); |
|
2578 | + if (post_type_supports('espresso_attendees', 'excerpt')) { |
|
2579 | + add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal'); |
|
2580 | 2580 | } |
2581 | 2581 | |
2582 | - if ( post_type_supports( 'espresso_attendees', 'comments') ) { |
|
2582 | + if (post_type_supports('espresso_attendees', 'comments')) { |
|
2583 | 2583 | add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
2584 | 2584 | } |
2585 | 2585 | |
2586 | - add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' ); |
|
2587 | - add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' ); |
|
2588 | - add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2586 | + add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core'); |
|
2587 | + add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core'); |
|
2588 | + add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high'); |
|
2589 | 2589 | } |
2590 | 2590 | |
2591 | 2591 | |
@@ -2594,10 +2594,10 @@ discard block |
||
2594 | 2594 | * @param WP_Post $post wp post object |
2595 | 2595 | * @return string attendee contact info ( and form ) |
2596 | 2596 | */ |
2597 | - public function attendee_contact_info( $post ) { |
|
2597 | + public function attendee_contact_info($post) { |
|
2598 | 2598 | //get attendee object ( should already have it ) |
2599 | 2599 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2600 | - $template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php'; |
|
2600 | + $template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php'; |
|
2601 | 2601 | EEH_Template::display_template($template, $this->_template_args); |
2602 | 2602 | } |
2603 | 2603 | |
@@ -2613,12 +2613,12 @@ discard block |
||
2613 | 2613 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2614 | 2614 | $this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input( |
2615 | 2615 | new EE_Question_Form_Input( |
2616 | - EE_Question::new_instance( array( |
|
2616 | + EE_Question::new_instance(array( |
|
2617 | 2617 | 'QST_ID' => 0, |
2618 | 2618 | 'QST_display_text' => __('State/Province', 'event_espresso'), |
2619 | 2619 | 'QST_system' => 'admin-state' |
2620 | 2620 | )), |
2621 | - EE_Answer::new_instance( array( |
|
2621 | + EE_Answer::new_instance(array( |
|
2622 | 2622 | 'ANS_ID' => 0, |
2623 | 2623 | 'ANS_value' => $this->_cpt_model_obj->state_ID() |
2624 | 2624 | )), |
@@ -2631,12 +2631,12 @@ discard block |
||
2631 | 2631 | )); |
2632 | 2632 | $this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input( |
2633 | 2633 | new EE_Question_Form_Input( |
2634 | - EE_Question::new_instance( array( |
|
2634 | + EE_Question::new_instance(array( |
|
2635 | 2635 | 'QST_ID' => 0, |
2636 | 2636 | 'QST_display_text' => __('Country', 'event_espresso'), |
2637 | 2637 | 'QST_system' => 'admin-country' |
2638 | 2638 | )), |
2639 | - EE_Answer::new_instance( array( |
|
2639 | + EE_Answer::new_instance(array( |
|
2640 | 2640 | 'ANS_ID' => 0, |
2641 | 2641 | 'ANS_value' => $this->_cpt_model_obj->country_ID() |
2642 | 2642 | )), |
@@ -2647,8 +2647,8 @@ discard block |
||
2647 | 2647 | 'append_qstn_id' => FALSE |
2648 | 2648 | ) |
2649 | 2649 | )); |
2650 | - $template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php'; |
|
2651 | - EEH_Template::display_template($template, $this->_template_args ); |
|
2650 | + $template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php'; |
|
2651 | + EEH_Template::display_template($template, $this->_template_args); |
|
2652 | 2652 | |
2653 | 2653 | } |
2654 | 2654 | |
@@ -2658,11 +2658,11 @@ discard block |
||
2658 | 2658 | * @access protected |
2659 | 2659 | * @return void |
2660 | 2660 | */ |
2661 | - public function attendee_registrations_meta_box( $post ) { |
|
2661 | + public function attendee_registrations_meta_box($post) { |
|
2662 | 2662 | |
2663 | 2663 | $this->_template_args['attendee'] = $this->_cpt_model_obj; |
2664 | 2664 | $this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration'); |
2665 | - $template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php'; |
|
2665 | + $template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php'; |
|
2666 | 2666 | EEH_Template::display_template($template, $this->_template_args); |
2667 | 2667 | |
2668 | 2668 | } |
@@ -2676,8 +2676,8 @@ discard block |
||
2676 | 2676 | * @return string html for new form. |
2677 | 2677 | */ |
2678 | 2678 | public function after_title_form_fields($post) { |
2679 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
2680 | - $template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php'; |
|
2679 | + if ($post->post_type == 'espresso_attendees') { |
|
2680 | + $template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php'; |
|
2681 | 2681 | $template_args['attendee'] = $this->_cpt_model_obj; |
2682 | 2682 | EEH_Template::display_template($template, $template_args); |
2683 | 2683 | } |
@@ -2694,21 +2694,21 @@ discard block |
||
2694 | 2694 | * @access protected |
2695 | 2695 | * @return void |
2696 | 2696 | */ |
2697 | - protected function _trash_or_restore_attendees( $trash = TRUE ) { |
|
2697 | + protected function _trash_or_restore_attendees($trash = TRUE) { |
|
2698 | 2698 | |
2699 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2699 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2700 | 2700 | |
2701 | 2701 | $ATT_MDL = EEM_Attendee::instance(); |
2702 | 2702 | |
2703 | 2703 | $success = 1; |
2704 | 2704 | //Checkboxes |
2705 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2705 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2706 | 2706 | // if array has more than one element than success message should be plural |
2707 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2707 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2708 | 2708 | // cycle thru checkboxes |
2709 | - while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
2710 | - $updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID); |
|
2711 | - if ( !$updated ) { |
|
2709 | + while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2710 | + $updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID); |
|
2711 | + if ( ! $updated) { |
|
2712 | 2712 | $success = 0; |
2713 | 2713 | } |
2714 | 2714 | } |
@@ -2717,18 +2717,18 @@ discard block |
||
2717 | 2717 | // grab single id and delete |
2718 | 2718 | $ATT_ID = absint($this->_req_data['ATT_ID']); |
2719 | 2719 | //get attendee |
2720 | - $att = $ATT_MDL->get_one_by_ID( $ATT_ID ); |
|
2720 | + $att = $ATT_MDL->get_one_by_ID($ATT_ID); |
|
2721 | 2721 | $updated = $trash ? $att->set_status('trash') : $att->set_status('publish'); |
2722 | 2722 | $updated = $att->save(); |
2723 | - if ( ! $updated ) { |
|
2723 | + if ( ! $updated) { |
|
2724 | 2724 | $success = 0; |
2725 | 2725 | } |
2726 | 2726 | |
2727 | 2727 | } |
2728 | 2728 | |
2729 | - $what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' ); |
|
2730 | - $action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' ); |
|
2731 | - $this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) ); |
|
2729 | + $what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso'); |
|
2730 | + $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
|
2731 | + $this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list')); |
|
2732 | 2732 | |
2733 | 2733 | } |
2734 | 2734 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | public function clear_comment_link( $link, $comment, $args ) { |
119 | 121 | //gotta make sure this only happens on this route |
120 | 122 | $post_type = get_post_type( $comment->comment_post_ID); |
121 | - if ( $post_type == 'espresso_attendees' ) |
|
122 | - return '#commentsdiv'; |
|
123 | + if ( $post_type == 'espresso_attendees' ) { |
|
124 | + return '#commentsdiv'; |
|
125 | + } |
|
123 | 126 | return $link; |
124 | 127 | } |
125 | 128 | |
@@ -878,9 +881,9 @@ discard block |
||
878 | 881 | |
879 | 882 | $REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE; |
880 | 883 | |
881 | - if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) |
|
882 | - return TRUE; |
|
883 | - else { |
|
884 | + if ( $this->_registration = $REG->get_one_by_ID( $REG_ID )) { |
|
885 | + return TRUE; |
|
886 | + } else { |
|
884 | 887 | $error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID ); |
885 | 888 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
886 | 889 | $this->_registration = NULL; |
@@ -977,7 +980,7 @@ discard block |
||
977 | 980 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ), |
978 | 981 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ), |
979 | 982 | )); |
980 | - }elseif($this_month_a || $this_month){ |
|
983 | + } elseif($this_month_a || $this_month){ |
|
981 | 984 | $this_month_r = date('m', current_time('timestamp')); |
982 | 985 | $days_this_month = date( 't', current_time('timestamp') ); |
983 | 986 | $_where['REG_date']= array('BETWEEN', |
@@ -985,18 +988,18 @@ discard block |
||
985 | 988 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ), |
986 | 989 | EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' ) |
987 | 990 | )); |
988 | - }elseif($month_range){ |
|
991 | + } elseif($month_range){ |
|
989 | 992 | $pieces = explode(' ', $this->_req_data['month_range'], 3); |
990 | 993 | $month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : ''; |
991 | 994 | $year_r = !empty($pieces[1]) ? $pieces[1] : ''; |
992 | 995 | $days_in_month = date('t', strtotime($year_r . '-' . $month_r . '-' . '01') ); |
993 | 996 | $_where['REG_date']= array('BETWEEN', |
994 | 997 | array( EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month . ' 23:59:59', 'Y-m-d H:i:s' ) ) ); |
995 | - }elseif($start_date && $end_date){ |
|
998 | + } elseif($start_date && $end_date){ |
|
996 | 999 | throw new EE_Error("not yet supported"); |
997 | - }elseif($start_date){ |
|
1000 | + } elseif($start_date){ |
|
998 | 1001 | throw new EE_Error("not yet supported"); |
999 | - }elseif($end_date){ |
|
1002 | + } elseif($end_date){ |
|
1000 | 1003 | throw new EE_Error("not yet supported"); |
1001 | 1004 | } |
1002 | 1005 | |
@@ -1931,8 +1934,9 @@ discard block |
||
1931 | 1934 | // cycle thru checkboxes |
1932 | 1935 | while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) { |
1933 | 1936 | $REG = $REG_MDL->get_one_by_ID($REG_ID); |
1934 | - if ( ! $REG instanceof EE_Registration ) |
|
1935 | - continue; |
|
1937 | + if ( ! $REG instanceof EE_Registration ) { |
|
1938 | + continue; |
|
1939 | + } |
|
1936 | 1940 | $deleted = $this->_delete_registration($REG); |
1937 | 1941 | if ( !$deleted ) { |
1938 | 1942 | $success = 0; |
@@ -1971,8 +1975,9 @@ discard block |
||
1971 | 1975 | |
1972 | 1976 | $all_trashed = TRUE; |
1973 | 1977 | foreach ( $REGS as $registration ) { |
1974 | - if ( ! $registration->get('REG_deleted') ) |
|
1975 | - $all_trashed = FALSE; |
|
1978 | + if ( ! $registration->get('REG_deleted') ) { |
|
1979 | + $all_trashed = FALSE; |
|
1980 | + } |
|
1976 | 1981 | } |
1977 | 1982 | |
1978 | 1983 | if ( ! $all_trashed ) { |
@@ -1998,8 +2003,10 @@ discard block |
||
1998 | 2003 | //now delete permanently the checkins related to this registration. |
1999 | 2004 | $registration->delete_related_permanently('Checkin'); |
2000 | 2005 | |
2001 | - if ( $registration->ID() === $REG->ID() ) |
|
2002 | - continue; //we don't want to delete permanently the existing registration just yet. |
|
2006 | + if ( $registration->ID() === $REG->ID() ) { |
|
2007 | + continue; |
|
2008 | + } |
|
2009 | + //we don't want to delete permanently the existing registration just yet. |
|
2003 | 2010 | |
2004 | 2011 | //remove relation to transaction for these registrations if NOT the existing registrations |
2005 | 2012 | $registration->_remove_relations('Transaction'); |
@@ -2554,8 +2561,9 @@ discard block |
||
2554 | 2561 | } |
2555 | 2562 | } |
2556 | 2563 | |
2557 | - if ( $success === FALSE ) |
|
2558 | - EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2564 | + if ( $success === FALSE ) { |
|
2565 | + EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
2566 | + } |
|
2559 | 2567 | |
2560 | 2568 | } |
2561 | 2569 |
@@ -503,7 +503,7 @@ |
||
503 | 503 | /** |
504 | 504 | * @param $message_types |
505 | 505 | * @param array $extra |
506 | - * @return mixed|string |
|
506 | + * @return string |
|
507 | 507 | */ |
508 | 508 | protected function _get_admin_content_events_edit( $message_types, $extra ) { |
509 | 509 | //defaults |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param EE_Admin_Page $admin_page |
45 | 45 | */ |
46 | - public function __construct( $admin_page ) { |
|
46 | + public function __construct($admin_page) { |
|
47 | 47 | parent::__construct($admin_page); |
48 | - require_once( EE_HELPERS . 'EEH_DTT_Helper.helper.php' ); |
|
48 | + require_once(EE_HELPERS.'EEH_DTT_Helper.helper.php'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function _setup_data() { |
56 | 56 | $this->_data = $this->_admin_page->get_events($this->_per_page, $this->_current_page); |
57 | - $this->_all_data_count = $this->_admin_page->get_events(0,0, TRUE); |
|
57 | + $this->_all_data_count = $this->_admin_page->get_events(0, 0, TRUE); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | $this->_sortable_columns = array( |
88 | - 'id' => array( 'EVT_ID' => true ), |
|
89 | - 'name' => array( 'EVT_name' => false ), |
|
90 | - 'author' => array( 'EVT_wp_user' => false ), |
|
91 | - 'venue' => array( 'Venue.VNU_name' => false ), |
|
88 | + 'id' => array('EVT_ID' => true), |
|
89 | + 'name' => array('EVT_name' => false), |
|
90 | + 'author' => array('EVT_wp_user' => false), |
|
91 | + 'venue' => array('Venue.VNU_name' => false), |
|
92 | 92 | 'start_date_time' => array('Datetime.DTT_EVT_start' => false), |
93 | 93 | 'reg_begins' => array('Datetime.Ticket.TKT_start_date' => false), |
94 | 94 | ); |
95 | 95 | |
96 | 96 | $this->_primary_column = 'id'; |
97 | 97 | |
98 | - $this->_hidden_columns = array( 'author' ); |
|
98 | + $this->_hidden_columns = array('author'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | protected function _add_view_counts() { |
114 | 114 | $this->_views['all']['count'] = $this->_admin_page->total_events(); |
115 | 115 | $this->_views['draft']['count'] = $this->_admin_page->total_events_draft(); |
116 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) { |
|
116 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) { |
|
117 | 117 | $this->_views['trash']['count'] = $this->_admin_page->total_trashed_events(); |
118 | 118 | } |
119 | 119 | } |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return string |
126 | 126 | */ |
127 | - protected function _get_row_class( $item ) { |
|
128 | - $class = parent::_get_row_class( $item ); |
|
127 | + protected function _get_row_class($item) { |
|
128 | + $class = parent::_get_row_class($item); |
|
129 | 129 | //add status class |
130 | - $class .= $item instanceof EE_Event ? ' ee-status-strip event-status-' . $item->get_active_status() : ''; |
|
131 | - if ( $this->_has_checkbox_column ) { |
|
130 | + $class .= $item instanceof EE_Event ? ' ee-status-strip event-status-'.$item->get_active_status() : ''; |
|
131 | + if ($this->_has_checkbox_column) { |
|
132 | 132 | $class .= ' has-checkbox-column'; |
133 | 133 | } |
134 | 134 | return $class; |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return string |
142 | 142 | */ |
143 | - public function column_status( EE_Event $item ) { |
|
144 | - return '<span class="ee-status-strip ee-status-strip-td event-status-' . $item->get_active_status() . '"></span>'; |
|
143 | + public function column_status(EE_Event $item) { |
|
144 | + return '<span class="ee-status-strip ee-status-strip-td event-status-'.$item->get_active_status().'"></span>'; |
|
145 | 145 | }/**/ |
146 | 146 | |
147 | 147 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function column_cb( $item ) { |
|
153 | + public function column_cb($item) { |
|
154 | 154 | $this->_dtt = $item->primary_datetime(); //set this for use in other columns |
155 | 155 | |
156 | 156 | //does event have any attached registrations? |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return mixed|string |
168 | 168 | */ |
169 | - public function column_id( EE_Event $item ) { |
|
169 | + public function column_id(EE_Event $item) { |
|
170 | 170 | $content = $item->ID(); |
171 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->name() . '</span>'; |
|
171 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
172 | 172 | return $content; |
173 | 173 | } |
174 | 174 | |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return string |
180 | 180 | */ |
181 | - public function column_name( EE_Event $item ) { |
|
181 | + public function column_name(EE_Event $item) { |
|
182 | 182 | $edit_query_args = array( |
183 | 183 | 'action' => 'edit', |
184 | 184 | 'post' => $item->ID() |
185 | 185 | ); |
186 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
187 | - $actions = $this->_column_name_action_setup( $item ); |
|
186 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
187 | + $actions = $this->_column_name_action_setup($item); |
|
188 | 188 | $status = ''; //$item->status() !== 'publish' ? ' (' . $item->status() . ')' : ''; |
189 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' . $status; |
|
190 | - $content .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->get_active_status(), false, 'sentence' ) . '</span>'; |
|
189 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>'.$status; |
|
190 | + $content .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->get_active_status(), false, 'sentence').'</span>'; |
|
191 | 191 | $content .= $this->row_actions($actions); |
192 | 192 | return $content; |
193 | 193 | |
@@ -204,72 +204,72 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return array array of actions |
206 | 206 | */ |
207 | - protected function _column_name_action_setup( EE_Event $item ) { |
|
207 | + protected function _column_name_action_setup(EE_Event $item) { |
|
208 | 208 | //todo: remove when attendees is active |
209 | - if ( !defined('REG_ADMIN_URL') ) |
|
209 | + if ( ! defined('REG_ADMIN_URL')) |
|
210 | 210 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
211 | 211 | |
212 | 212 | $actions = array(); |
213 | 213 | |
214 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
214 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
215 | 215 | $edit_query_args = array( |
216 | 216 | 'action' => 'edit', |
217 | 217 | 'post' => $item->ID() |
218 | 218 | ); |
219 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
220 | - $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'; |
|
219 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
220 | + $actions['edit'] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
221 | 221 | |
222 | 222 | } |
223 | 223 | |
224 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
224 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
225 | 225 | $attendees_query_args = array( |
226 | 226 | 'action' => 'default', |
227 | 227 | 'event_id' => $item->ID() |
228 | 228 | ); |
229 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
230 | - $actions['attendees'] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrations', 'event_espresso') . '">' . __('Registrations', 'event_espresso') . '</a>'; |
|
229 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
230 | + $actions['attendees'] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrations', 'event_espresso').'">'.__('Registrations', 'event_espresso').'</a>'; |
|
231 | 231 | } |
232 | 232 | |
233 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
233 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
234 | 234 | $trash_event_query_args = array( |
235 | 235 | 'action' => 'trash_event', |
236 | 236 | 'EVT_ID' => $item->ID() |
237 | 237 | ); |
238 | - $trash_event_link = EE_Admin_Page::add_query_args_and_nonce( $trash_event_query_args, EVENTS_ADMIN_URL ); |
|
238 | + $trash_event_link = EE_Admin_Page::add_query_args_and_nonce($trash_event_query_args, EVENTS_ADMIN_URL); |
|
239 | 239 | } |
240 | 240 | |
241 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
241 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
242 | 242 | $restore_event_query_args = array( |
243 | 243 | 'action' => 'restore_event', |
244 | 244 | 'EVT_ID' => $item->ID() |
245 | 245 | ); |
246 | - $restore_event_link = EE_Admin_Page::add_query_args_and_nonce( $restore_event_query_args, EVENTS_ADMIN_URL ); |
|
246 | + $restore_event_link = EE_Admin_Page::add_query_args_and_nonce($restore_event_query_args, EVENTS_ADMIN_URL); |
|
247 | 247 | } |
248 | 248 | |
249 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
249 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
250 | 250 | $delete_event_query_args = array( |
251 | 251 | 'action' => 'delete_event', |
252 | 252 | 'EVT_ID' => $item->ID() |
253 | 253 | ); |
254 | - $delete_event_link = EE_Admin_Page::add_query_args_and_nonce( $delete_event_query_args, EVENTS_ADMIN_URL ); |
|
254 | + $delete_event_link = EE_Admin_Page::add_query_args_and_nonce($delete_event_query_args, EVENTS_ADMIN_URL); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | $view_link = get_permalink($item->ID()); |
258 | 258 | |
259 | - $actions['view'] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; |
|
259 | + $actions['view'] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'">'.__('View', 'event_espresso').'</a>'; |
|
260 | 260 | |
261 | - switch ( $item->get( 'status' ) ) { |
|
261 | + switch ($item->get('status')) { |
|
262 | 262 | case 'trash' : |
263 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_restore_event', $item->ID() ) ) { |
|
264 | - $actions['restore_from_trash'] = '<a href="' . $restore_event_link . '" title="' . esc_attr__('Restore from Trash', 'event_espresso') . '">' . __('Restore from Trash', 'event_espresso') . '</a>'; |
|
263 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_restore_event', $item->ID())) { |
|
264 | + $actions['restore_from_trash'] = '<a href="'.$restore_event_link.'" title="'.esc_attr__('Restore from Trash', 'event_espresso').'">'.__('Restore from Trash', 'event_espresso').'</a>'; |
|
265 | 265 | } |
266 | - if ( $item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_delete_event', $item->ID() ) ) { |
|
267 | - $actions['delete'] = '<a href="' . $delete_event_link . '" title="' . esc_attr__('Delete Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
266 | + if ($item->count_related('Registration') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_delete_event', $item->ID())) { |
|
267 | + $actions['delete'] = '<a href="'.$delete_event_link.'" title="'.esc_attr__('Delete Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
268 | 268 | } |
269 | 269 | break; |
270 | 270 | default : |
271 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_event', 'espresso_events_trash_event', $item->ID() ) ) { |
|
272 | - $actions['move to trash'] = '<a href="' . $trash_event_link . '" title="' . esc_attr__('Trash Event', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
271 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_event', 'espresso_events_trash_event', $item->ID())) { |
|
272 | + $actions['move to trash'] = '<a href="'.$trash_event_link.'" title="'.esc_attr__('Trash Event', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
273 | 273 | } |
274 | 274 | } |
275 | 275 | return $actions; |
@@ -281,17 +281,17 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - public function column_author( EE_Event $item ) { |
|
284 | + public function column_author(EE_Event $item) { |
|
285 | 285 | //user author info |
286 | - $event_author = get_userdata( $item->wp_user() ); |
|
287 | - $gravatar = get_avatar( $item->wp_user(), '15' ); |
|
286 | + $event_author = get_userdata($item->wp_user()); |
|
287 | + $gravatar = get_avatar($item->wp_user(), '15'); |
|
288 | 288 | //filter link |
289 | 289 | $query_args = array( |
290 | 290 | 'action' => 'default', |
291 | 291 | 'EVT_wp_user' => $item->wp_user() |
292 | 292 | ); |
293 | - $filter_url = EE_Admin_Page::add_query_args_and_nonce( $query_args, EVENTS_ADMIN_URL ); |
|
294 | - return $gravatar . ' <a href="' . $filter_url . '" title="' . esc_attr__('Click to filter events by this author.', 'event_espresso') . '">' . $event_author->display_name . '</a>'; |
|
293 | + $filter_url = EE_Admin_Page::add_query_args_and_nonce($query_args, EVENTS_ADMIN_URL); |
|
294 | + return $gravatar.' <a href="'.$filter_url.'" title="'.esc_attr__('Click to filter events by this author.', 'event_espresso').'">'.$event_author->display_name.'</a>'; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return string |
302 | 302 | */ |
303 | - public function column_venue( EE_Event $item ) { |
|
304 | - $venue = $item->get_first_related( 'Venue' ); |
|
305 | - return !empty( $venue ) ? $venue->name() : ''; |
|
303 | + public function column_venue(EE_Event $item) { |
|
304 | + $venue = $item->get_first_related('Venue'); |
|
305 | + return ! empty($venue) ? $venue->name() : ''; |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @throws EE_Error |
313 | 313 | */ |
314 | - public function column_start_date_time( EE_Event $item ) { |
|
315 | - echo !empty( $this->_dtt ) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
314 | + public function column_start_date_time(EE_Event $item) { |
|
315 | + echo ! empty($this->_dtt) ? $this->_dtt->get_i18n_datetime('DTT_EVT_start') : __('No Date was saved for this Event', 'event_espresso'); |
|
316 | 316 | //display in user's timezone? |
317 | - echo !empty( $this->_dtt ) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ' ) : ''; |
|
317 | + echo ! empty($this->_dtt) ? $this->_dtt->display_in_my_timezone('DTT_EVT_start', 'get_i18n_datetime', '', 'My Timezone: ') : ''; |
|
318 | 318 | |
319 | 319 | } |
320 | 320 | |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @throws EE_Error |
326 | 326 | */ |
327 | - public function column_reg_begins( EE_Event $item ) { |
|
327 | + public function column_reg_begins(EE_Event $item) { |
|
328 | 328 | $reg_start = $item->get_ticket_with_earliest_start_time(); |
329 | - echo !empty( $reg_start ) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
329 | + echo ! empty($reg_start) ? $reg_start->get_i18n_datetime('TKT_start_date') : __('No Tickets have been setup for this Event', 'event_espresso'); |
|
330 | 330 | //display in user's timezone? |
331 | - echo !empty( $reg_start ) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ' ) : '';/**/ |
|
331 | + echo ! empty($reg_start) ? $reg_start->display_in_my_timezone('TKT_start_date', 'get_i18n_datetime', '', 'My Timezone: ') : ''; /**/ |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @return int|string |
339 | 339 | */ |
340 | - public function column_attendees( EE_Event $item ) { |
|
340 | + public function column_attendees(EE_Event $item) { |
|
341 | 341 | $attendees_query_args = array( |
342 | 342 | 'action' => 'default', |
343 | 343 | 'event_id' => $item->ID() |
344 | 344 | ); |
345 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
346 | - $registered_attendees = EEM_Registration::instance()->get_event_registration_count( $item->ID() ); |
|
347 | - return EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ? '<a href="' . $attendees_link . '">' . $registered_attendees . '</a>' : $registered_attendees; |
|
345 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
346 | + $registered_attendees = EEM_Registration::instance()->get_event_registration_count($item->ID()); |
|
347 | + return EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="'.$attendees_link.'">'.$registered_attendees.'</a>' : $registered_attendees; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return float |
355 | 355 | */ |
356 | - public function column_tkts_sold( EE_Event $item ) { |
|
357 | - return EEM_Ticket::instance()->sum(array( array('Datetime.EVT_ID' => $item->ID() )), 'TKT_sold' ); |
|
356 | + public function column_tkts_sold(EE_Event $item) { |
|
357 | + return EEM_Ticket::instance()->sum(array(array('Datetime.EVT_ID' => $item->ID())), 'TKT_sold'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -363,38 +363,38 @@ discard block |
||
363 | 363 | * |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - public function column_actions( EE_Event $item ) { |
|
366 | + public function column_actions(EE_Event $item) { |
|
367 | 367 | //todo: remove when attendees is active |
368 | - if ( !defined('REG_ADMIN_URL') ) |
|
368 | + if ( ! defined('REG_ADMIN_URL')) |
|
369 | 369 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
370 | 370 | $actionlinks = array(); |
371 | 371 | |
372 | 372 | $view_link = get_permalink($item->ID()); |
373 | 373 | |
374 | - $actionlinks[] = '<a href="' . $view_link . '" title="' . esc_attr__('View Event', 'event_espresso') . '" target="_blank">'; |
|
374 | + $actionlinks[] = '<a href="'.$view_link.'" title="'.esc_attr__('View Event', 'event_espresso').'" target="_blank">'; |
|
375 | 375 | $actionlinks[] = '<div class="dashicons dashicons-search"></div></a>'; |
376 | 376 | |
377 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $item->ID() ) ) { |
|
377 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $item->ID())) { |
|
378 | 378 | $edit_query_args = array( |
379 | 379 | 'action' => 'edit', |
380 | 380 | 'post' => $item->ID() |
381 | 381 | ); |
382 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EVENTS_ADMIN_URL ); |
|
383 | - $actionlinks[] = '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Event', 'event_espresso') . '"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
382 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EVENTS_ADMIN_URL); |
|
383 | + $actionlinks[] = '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Event', 'event_espresso').'"><div class="ee-icon ee-icon-calendar-edit"></div></a>'; |
|
384 | 384 | } |
385 | 385 | |
386 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $item->ID() ) ) { |
|
386 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID())) { |
|
387 | 387 | $attendees_query_args = array( |
388 | 388 | 'action' => 'default', |
389 | 389 | 'event_id' => $item->ID() |
390 | 390 | ); |
391 | - $attendees_link = EE_Admin_Page::add_query_args_and_nonce( $attendees_query_args, REG_ADMIN_URL ); |
|
392 | - $actionlinks[] = '<a href="' . $attendees_link . '" title="' . esc_attr__('View Registrants', 'event_espresso') . '"><div class="dashicons dashicons-groups"></div></a>'; |
|
391 | + $attendees_link = EE_Admin_Page::add_query_args_and_nonce($attendees_query_args, REG_ADMIN_URL); |
|
392 | + $actionlinks[] = '<a href="'.$attendees_link.'" title="'.esc_attr__('View Registrants', 'event_espresso').'"><div class="dashicons dashicons-groups"></div></a>'; |
|
393 | 393 | } |
394 | 394 | |
395 | - $actionlinks = apply_filters( 'FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item ); |
|
395 | + $actionlinks = apply_filters('FHEE__Events_Admin_List_Table__column_actions__action_links', $actionlinks, $item); |
|
396 | 396 | |
397 | - return $this->_action_string( implode( "\n\t", $actionlinks ), $item, 'div' ); |
|
397 | + return $this->_action_string(implode("\n\t", $actionlinks), $item, 'div'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | * @param EE_Transaction $transaction |
1456 | 1456 | * @param \EE_Payment $payment |
1457 | 1457 | * @param array $REG_IDs |
1458 | - * @return bool |
|
1458 | + * @return boolean|null |
|
1459 | 1459 | */ |
1460 | 1460 | protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
1461 | 1461 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
@@ -1647,6 +1647,7 @@ discard block |
||
1647 | 1647 | * |
1648 | 1648 | * @access protected |
1649 | 1649 | * @param \EE_Payment | null $payment |
1650 | + * @param EE_Payment $payment |
|
1650 | 1651 | */ |
1651 | 1652 | protected function _maybe_send_notifications( $payment = null ) { |
1652 | 1653 | switch ( $payment instanceof EE_Payment ) { |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | /** |
108 | 108 | * grab url requests and route them |
109 | - * @access private |
|
110 | - * @return void |
|
111 | - */ |
|
109 | + * @access private |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | public function _set_page_routes() { |
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
@@ -261,10 +261,10 @@ discard block |
||
261 | 261 | /** |
262 | 262 | * _set_transaction_status_array |
263 | 263 | * sets list of transaction statuses |
264 | - * |
|
264 | + * |
|
265 | 265 | * @access private |
266 | - * @return void |
|
267 | - */ |
|
266 | + * @return void |
|
267 | + */ |
|
268 | 268 | private function _set_transaction_status_array() { |
269 | 269 | self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE); |
270 | 270 | } |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | |
287 | 287 | /** |
288 | 288 | * get list of payment statuses |
289 | - * |
|
289 | + * |
|
290 | 290 | * @access private |
291 | - * @return void |
|
292 | - */ |
|
291 | + * @return void |
|
292 | + */ |
|
293 | 293 | private function _get_payment_status_array() { |
294 | 294 | self::$_pay_status = EEM_Payment::instance()->status_array(TRUE); |
295 | 295 | $this->_template_args['payment_status'] = self::$_pay_status; |
@@ -397,18 +397,18 @@ discard block |
||
397 | 397 | if ( is_object( $this->_transaction) ) |
398 | 398 | return; //get out we've already set the object |
399 | 399 | |
400 | - $TXN = EEM_Transaction::instance(); |
|
400 | + $TXN = EEM_Transaction::instance(); |
|
401 | 401 | |
402 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
402 | + $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
403 | 403 | |
404 | - //get transaction object |
|
405 | - $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
406 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
404 | + //get transaction object |
|
405 | + $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
406 | + $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
407 | 407 | |
408 | 408 | if ( empty( $this->_transaction ) ) { |
409 | - $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
409 | + $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
410 | 410 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
411 | - } |
|
411 | + } |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | |
511 | 511 | |
512 | 512 | /** |
513 | - * _transaction_details |
|
513 | + * _transaction_details |
|
514 | 514 | * generates HTML for the View Transaction Details Admin page |
515 | - * |
|
515 | + * |
|
516 | 516 | * @access protected |
517 | - * @return void |
|
518 | - */ |
|
517 | + * @return void |
|
518 | + */ |
|
519 | 519 | protected function _transaction_details() { |
520 | 520 | do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
521 | 521 | EE_Registry::instance()->load_helper( 'MSG_Template' ); |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | 'button secondary-button right', |
569 | 569 | 'dashicons dashicons-email-alt' |
570 | 570 | ) |
571 | - : ''; |
|
571 | + : ''; |
|
572 | 572 | } else { |
573 | 573 | $this->_template_args['send_payment_reminder_button'] = ''; |
574 | 574 | } |
@@ -722,10 +722,10 @@ discard block |
||
722 | 722 | /** |
723 | 723 | * txn_details_meta_box |
724 | 724 | * generates HTML for the Transaction main meta box |
725 | - * |
|
725 | + * |
|
726 | 726 | * @access public |
727 | - * @return void |
|
728 | - */ |
|
727 | + * @return void |
|
728 | + */ |
|
729 | 729 | public function txn_details_meta_box() { |
730 | 730 | |
731 | 731 | $this->_set_transaction_object(); |
@@ -1066,10 +1066,10 @@ discard block |
||
1066 | 1066 | /** |
1067 | 1067 | * txn_billing_info_side_meta_box |
1068 | 1068 | * generates HTML for the Edit Transaction side meta box |
1069 | - * |
|
1069 | + * |
|
1070 | 1070 | * @access public |
1071 | - * @return void |
|
1072 | - */ |
|
1071 | + * @return void |
|
1072 | + */ |
|
1073 | 1073 | public function txn_billing_info_side_meta_box() { |
1074 | 1074 | |
1075 | 1075 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
@@ -1087,10 +1087,10 @@ discard block |
||
1087 | 1087 | /** |
1088 | 1088 | * apply_payments_or_refunds |
1089 | 1089 | * registers a payment or refund made towards a transaction |
1090 | - * |
|
1090 | + * |
|
1091 | 1091 | * @access public |
1092 | - * @return void |
|
1093 | - */ |
|
1092 | + * @return void |
|
1093 | + */ |
|
1094 | 1094 | public function apply_payments_or_refunds() { |
1095 | 1095 | $json_response_data = array( 'return_data' => FALSE ); |
1096 | 1096 | $valid_data = $this->_validate_payment_request_data(); |
@@ -1244,9 +1244,9 @@ discard block |
||
1244 | 1244 | 'default' => '', |
1245 | 1245 | 'required' => false, |
1246 | 1246 | 'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ), |
1247 | - 'validation_strategies' => array( |
|
1248 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1249 | - ) |
|
1247 | + 'validation_strategies' => array( |
|
1248 | + new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1249 | + ) |
|
1250 | 1250 | ) |
1251 | 1251 | ), |
1252 | 1252 | 'po_number' => new EE_Text_Input( |
@@ -1254,9 +1254,9 @@ discard block |
||
1254 | 1254 | 'default' => '', |
1255 | 1255 | 'required' => false, |
1256 | 1256 | 'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ), |
1257 | - 'validation_strategies' => array( |
|
1258 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1259 | - ) |
|
1257 | + 'validation_strategies' => array( |
|
1258 | + new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1259 | + ) |
|
1260 | 1260 | ) |
1261 | 1261 | ), |
1262 | 1262 | 'accounting' => new EE_Text_Input( |
@@ -1264,9 +1264,9 @@ discard block |
||
1264 | 1264 | 'default' => '', |
1265 | 1265 | 'required' => false, |
1266 | 1266 | 'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ), |
1267 | - 'validation_strategies' => array( |
|
1268 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1269 | - ) |
|
1267 | + 'validation_strategies' => array( |
|
1268 | + new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1269 | + ) |
|
1270 | 1270 | ) |
1271 | 1271 | ), |
1272 | 1272 | ) |
@@ -1561,10 +1561,10 @@ discard block |
||
1561 | 1561 | /** |
1562 | 1562 | * delete_payment |
1563 | 1563 | * delete a payment or refund made towards a transaction |
1564 | - * |
|
1564 | + * |
|
1565 | 1565 | * @access public |
1566 | - * @return void |
|
1567 | - */ |
|
1566 | + * @return void |
|
1567 | + */ |
|
1568 | 1568 | public function delete_payment() { |
1569 | 1569 | $json_response_data = array( 'return_data' => FALSE ); |
1570 | 1570 | $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
@@ -1682,12 +1682,12 @@ discard block |
||
1682 | 1682 | /** |
1683 | 1683 | * _send_payment_reminder |
1684 | 1684 | * generates HTML for the View Transaction Details Admin page |
1685 | - * |
|
1685 | + * |
|
1686 | 1686 | * @access protected |
1687 | - * @return void |
|
1688 | - */ |
|
1687 | + * @return void |
|
1688 | + */ |
|
1689 | 1689 | protected function _send_payment_reminder() { |
1690 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1690 | + $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1691 | 1691 | $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
1692 | 1692 | $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
1693 | 1693 | do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
@@ -1709,29 +1709,29 @@ discard block |
||
1709 | 1709 | |
1710 | 1710 | $TXN = EEM_Transaction::instance(); |
1711 | 1711 | |
1712 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1713 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1712 | + $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1713 | + $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1714 | 1714 | |
1715 | - //make sure our timestamps start and end right at the boundaries for each day |
|
1716 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1717 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1715 | + //make sure our timestamps start and end right at the boundaries for each day |
|
1716 | + $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1717 | + $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1718 | 1718 | |
1719 | 1719 | |
1720 | - //convert to timestamps |
|
1721 | - $start_date = strtotime( $start_date ); |
|
1722 | - $end_date = strtotime( $end_date ); |
|
1720 | + //convert to timestamps |
|
1721 | + $start_date = strtotime( $start_date ); |
|
1722 | + $end_date = strtotime( $end_date ); |
|
1723 | 1723 | |
1724 | - //makes sure start date is the lowest value and vice versa |
|
1725 | - $start_date = min( $start_date, $end_date ); |
|
1726 | - $end_date = max( $start_date, $end_date ); |
|
1724 | + //makes sure start date is the lowest value and vice versa |
|
1725 | + $start_date = min( $start_date, $end_date ); |
|
1726 | + $end_date = max( $start_date, $end_date ); |
|
1727 | 1727 | |
1728 | - //convert to correct format for query |
|
1728 | + //convert to correct format for query |
|
1729 | 1729 | $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
1730 | 1730 | $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
1731 | 1731 | |
1732 | 1732 | |
1733 | 1733 | |
1734 | - //set orderby |
|
1734 | + //set orderby |
|
1735 | 1735 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1736 | 1736 | |
1737 | 1737 | switch ( $this->_req_data['orderby'] ) { |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Transactions_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _ajax_hooks() { |
83 | - add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds')); |
|
84 | - add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds')); |
|
85 | - add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment')); |
|
83 | + add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds')); |
|
84 | + add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds')); |
|
85 | + add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'buttons' => array( |
98 | 98 | 'add' => __('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => __('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => __('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => __('Delete Transaction', 'event_espresso'), |
|
101 | 101 | ) |
102 | 102 | ); |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
115 | 115 | |
116 | - $txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0; |
|
116 | + $txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0; |
|
117 | 117 | |
118 | 118 | $this->_page_routes = array( |
119 | 119 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'filename' => 'transactions_overview_views_filters_search' |
186 | 186 | ), |
187 | 187 | ), |
188 | - 'help_tour' => array( 'Transactions_Overview_Help_Tour' ), |
|
188 | + 'help_tour' => array('Transactions_Overview_Help_Tour'), |
|
189 | 189 | /** |
190 | 190 | * commented out because currently we are not displaying tips for transaction list table status but this |
191 | 191 | * may change in a later iteration so want to keep the code for then. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'nav' => array( |
198 | 198 | 'label' => __('View Transaction', 'event_espresso'), |
199 | 199 | 'order' => 5, |
200 | - 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
200 | + 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
201 | 201 | 'persistent' => FALSE |
202 | 202 | ), |
203 | 203 | 'help_tabs' => array( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | 'filename' => 'transactions_view_transaction_primary_registrant_billing_information' |
219 | 219 | ), |
220 | 220 | ), |
221 | - 'qtips' => array( 'Transaction_Details_Tips' ), |
|
222 | - 'help_tour' => array( 'Transaction_Details_Help_Tour' ), |
|
221 | + 'qtips' => array('Transaction_Details_Tips'), |
|
222 | + 'help_tour' => array('Transaction_Details_Help_Tour'), |
|
223 | 223 | 'metaboxes' => array('_transaction_details_metaboxes'), |
224 | 224 | |
225 | 225 | 'require_nonce' => FALSE |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | // IF a registration was JUST added via the admin... |
238 | 238 | if ( |
239 | 239 | isset( |
240 | - $this->_req_data[ 'redirect_from' ], |
|
241 | - $this->_req_data[ 'EVT_ID' ], |
|
242 | - $this->_req_data[ 'event_name' ] |
|
240 | + $this->_req_data['redirect_from'], |
|
241 | + $this->_req_data['EVT_ID'], |
|
242 | + $this->_req_data['event_name'] |
|
243 | 243 | ) |
244 | 244 | ) { |
245 | 245 | // then set a cookie so that we can block any attempts to use |
246 | 246 | // the back button as a way to enter another registration. |
247 | - setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' ); |
|
247 | + setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/'); |
|
248 | 248 | // and update the global |
249 | - $_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ]; |
|
249 | + $_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID']; |
|
250 | 250 | } |
251 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
252 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
253 | - EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status; |
|
254 | - EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status; |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
252 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
253 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; |
|
254 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; |
|
255 | 255 | } |
256 | 256 | public function admin_notices() {} |
257 | 257 | public function admin_footer_scripts() {} |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function load_scripts_styles() { |
320 | 320 | //enqueue style |
321 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
321 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
322 | 322 | wp_enqueue_style('espresso_txn'); |
323 | 323 | |
324 | 324 | //scripts |
325 | 325 | add_filter('FHEE_load_accounting_js', '__return_true'); |
326 | 326 | |
327 | 327 | //scripts |
328 | - wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
328 | + wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
329 | 329 | wp_enqueue_script('espresso_txn'); |
330 | 330 | |
331 | 331 | } |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @return void |
366 | 366 | */ |
367 | 367 | protected function _set_list_table_views_default() { |
368 | - $this->_views = array ( |
|
369 | - 'all' => array ( |
|
368 | + $this->_views = array( |
|
369 | + 'all' => array( |
|
370 | 370 | 'slug' => 'all', |
371 | 371 | 'label' => __('View All Transactions', 'event_espresso'), |
372 | 372 | 'count' => 0 |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | * @return void |
395 | 395 | */ |
396 | 396 | private function _set_transaction_object() { |
397 | - if ( is_object( $this->_transaction) ) |
|
397 | + if (is_object($this->_transaction)) |
|
398 | 398 | return; //get out we've already set the object |
399 | 399 | |
400 | 400 | $TXN = EEM_Transaction::instance(); |
401 | 401 | |
402 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
402 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
403 | 403 | |
404 | 404 | //get transaction object |
405 | 405 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
406 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
406 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
407 | 407 | |
408 | - if ( empty( $this->_transaction ) ) { |
|
409 | - $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
410 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
408 | + if (empty($this->_transaction)) { |
|
409 | + $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso'); |
|
410 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | ), |
434 | 434 | 'view_receipt' => array( |
435 | 435 | 'class' => 'dashicons dashicons-media-default', |
436 | - 'desc' => __('View Transaction Receipt', 'event_espresso' ) |
|
436 | + 'desc' => __('View Transaction Receipt', 'event_espresso') |
|
437 | 437 | ), |
438 | 438 | 'view_registration' => array( |
439 | 439 | 'class' => 'dashicons dashicons-clipboard', |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | ) |
443 | 443 | ); |
444 | 444 | |
445 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
445 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
446 | 446 | |
447 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
448 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
447 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
448 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
449 | 449 | $items['send_payment_reminder'] = array( |
450 | 450 | 'class' => 'dashicons dashicons-email-alt', |
451 | 451 | 'desc' => __('Send Payment Reminder', 'event_espresso') |
@@ -466,29 +466,29 @@ discard block |
||
466 | 466 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
467 | 467 | array( |
468 | 468 | 'overpaid' => array( |
469 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
470 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
469 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
470 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
471 | 471 | ), |
472 | 472 | 'complete' => array( |
473 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
474 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
473 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
474 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
475 | 475 | ), |
476 | 476 | 'incomplete' => array( |
477 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
478 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
477 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
478 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
479 | 479 | ), |
480 | 480 | 'abandoned' => array( |
481 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
482 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
481 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
482 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
483 | 483 | ), |
484 | 484 | 'failed' => array( |
485 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
486 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
485 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
486 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
487 | 487 | ) |
488 | 488 | ) |
489 | 489 | ); |
490 | 490 | |
491 | - return array_merge( $items, $more_items); |
|
491 | + return array_merge($items, $more_items); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | |
@@ -501,9 +501,9 @@ discard block |
||
501 | 501 | */ |
502 | 502 | protected function _transactions_overview_list_table() { |
503 | 503 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
504 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
505 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : ''; |
|
506 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
504 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
505 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : ''; |
|
506 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
507 | 507 | $this->display_admin_list_table_page_with_no_sidebar(); |
508 | 508 | } |
509 | 509 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * @return void |
518 | 518 | */ |
519 | 519 | protected function _transaction_details() { |
520 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
521 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
520 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
521 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
522 | 522 | |
523 | 523 | $this->_set_transaction_status_array(); |
524 | 524 | |
@@ -531,14 +531,14 @@ discard block |
||
531 | 531 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
532 | 532 | |
533 | 533 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
534 | - $this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' ); |
|
534 | + $this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso'); |
|
535 | 535 | |
536 | - $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a' ); |
|
537 | - $this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
536 | + $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_datetime('TXN_timestamp', 'l F j, Y', 'g:i:s a'); |
|
537 | + $this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso'); |
|
538 | 538 | |
539 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
540 | - $this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' ); |
|
541 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
539 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
540 | + $this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso'); |
|
541 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
542 | 542 | |
543 | 543 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
544 | 544 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | 'espresso_transactions_send_payment_reminder' |
551 | 551 | ) |
552 | 552 | ) { |
553 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
553 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
554 | 554 | $this->_template_args['send_payment_reminder_button'] = |
555 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
555 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
556 | 556 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
557 | 557 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
558 | 558 | ? EEH_Template::get_button_or_link( |
@@ -574,40 +574,40 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
577 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
578 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
579 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
577 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
578 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
579 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
580 | 580 | } else { |
581 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
581 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
582 | 582 | } |
583 | - $this->_template_args['amount_due_class'] = ''; |
|
583 | + $this->_template_args['amount_due_class'] = ''; |
|
584 | 584 | |
585 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
585 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
586 | 586 | // paid in full |
587 | - $this->_template_args['amount_due'] = FALSE; |
|
588 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
587 | + $this->_template_args['amount_due'] = FALSE; |
|
588 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
589 | 589 | // overpaid |
590 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
591 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
590 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
591 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
592 | 592 | // monies owing |
593 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
594 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
593 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
594 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
595 | 595 | // no payments made yet |
596 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
597 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
596 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
597 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
598 | 598 | // free event |
599 | - $this->_template_args['amount_due'] = FALSE; |
|
599 | + $this->_template_args['amount_due'] = FALSE; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | $payment_method = $this->_transaction->payment_method(); |
603 | 603 | |
604 | 604 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
605 | 605 | ? $payment_method->admin_name() |
606 | - : __( 'Unknown', 'event_espresso' ); |
|
606 | + : __('Unknown', 'event_espresso'); |
|
607 | 607 | |
608 | 608 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
609 | 609 | // link back to overview |
610 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
610 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
611 | 611 | ? $_SERVER['HTTP_REFERER'] |
612 | 612 | : TXN_ADMIN_URL; |
613 | 613 | |
@@ -615,13 +615,13 @@ discard block |
||
615 | 615 | // next link |
616 | 616 | $next_txn = $this->_transaction->next( |
617 | 617 | null, |
618 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
618 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
619 | 619 | 'TXN_ID' |
620 | 620 | ); |
621 | 621 | $this->_template_args['next_transaction'] = $next_txn |
622 | 622 | ? $this->_next_link( |
623 | 623 | EE_Admin_Page::add_query_args_and_nonce( |
624 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
624 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
625 | 625 | TXN_ADMIN_URL |
626 | 626 | ), |
627 | 627 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -630,13 +630,13 @@ discard block |
||
630 | 630 | // previous link |
631 | 631 | $previous_txn = $this->_transaction->previous( |
632 | 632 | null, |
633 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
633 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
634 | 634 | 'TXN_ID' |
635 | 635 | ); |
636 | 636 | $this->_template_args['previous_transaction'] = $previous_txn |
637 | 637 | ? $this->_previous_link( |
638 | 638 | EE_Admin_Page::add_query_args_and_nonce( |
639 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
639 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
640 | 640 | TXN_ADMIN_URL |
641 | 641 | ), |
642 | 642 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -646,16 +646,16 @@ discard block |
||
646 | 646 | // were we just redirected here after adding a new registration ??? |
647 | 647 | if ( |
648 | 648 | isset( |
649 | - $this->_req_data[ 'redirect_from' ], |
|
650 | - $this->_req_data[ 'EVT_ID' ], |
|
651 | - $this->_req_data[ 'event_name' ] |
|
649 | + $this->_req_data['redirect_from'], |
|
650 | + $this->_req_data['EVT_ID'], |
|
651 | + $this->_req_data['event_name'] |
|
652 | 652 | ) |
653 | 653 | ) { |
654 | 654 | if ( |
655 | 655 | EE_Registry::instance()->CAP->current_user_can( |
656 | 656 | 'ee_edit_registrations', |
657 | 657 | 'espresso_registrations_new_registration', |
658 | - $this->_req_data[ 'EVT_ID' ] |
|
658 | + $this->_req_data['EVT_ID'] |
|
659 | 659 | ) |
660 | 660 | ) { |
661 | 661 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | 'action' => 'new_registration', |
666 | 666 | 'return' => 'default', |
667 | 667 | 'TXN_ID' => $this->_transaction->ID(), |
668 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
668 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
669 | 669 | ), |
670 | 670 | REG_ADMIN_URL |
671 | 671 | ); |
@@ -673,17 +673,17 @@ discard block |
||
673 | 673 | |
674 | 674 | $this->_admin_page_title .= sprintf( |
675 | 675 | __('Add Another New Registration to Event: "%1$s" ?'), |
676 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
676 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
677 | 677 | ); |
678 | 678 | $this->_admin_page_title .= '</a>'; |
679 | 679 | } |
680 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
680 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
681 | 681 | } |
682 | 682 | // grab messages at the last second |
683 | 683 | $this->_template_args['notices'] = EE_Error::get_notices(); |
684 | 684 | // path to template |
685 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
686 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
685 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
686 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
687 | 687 | |
688 | 688 | // the details template wrapper |
689 | 689 | $this->display_admin_page_with_sidebar(); |
@@ -702,18 +702,18 @@ discard block |
||
702 | 702 | |
703 | 703 | $this->_set_transaction_object(); |
704 | 704 | |
705 | - add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
705 | + add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
706 | 706 | add_meta_box( |
707 | 707 | 'edit-txn-attendees-mbox', |
708 | - __( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
709 | - array( $this, 'txn_attendees_meta_box' ), |
|
708 | + __('Attendees Registered in this Transaction', 'event_espresso'), |
|
709 | + array($this, 'txn_attendees_meta_box'), |
|
710 | 710 | $this->_wp_page_slug, |
711 | 711 | 'normal', |
712 | 712 | 'high', |
713 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
713 | + array('TXN_ID' => $this->_transaction->ID()) |
|
714 | 714 | ); |
715 | - add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
716 | - add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
715 | + add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
716 | + add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
717 | 717 | |
718 | 718 | } |
719 | 719 | |
@@ -734,15 +734,15 @@ discard block |
||
734 | 734 | |
735 | 735 | //get line table |
736 | 736 | EEH_Autoloader::register_line_item_display_autoloaders(); |
737 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
738 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
737 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
738 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
739 | 739 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
740 | 740 | |
741 | 741 | // process taxes |
742 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
743 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
742 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
743 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
744 | 744 | |
745 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
745 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
746 | 746 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
747 | 747 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
748 | 748 | |
@@ -750,63 +750,63 @@ discard block |
||
750 | 750 | |
751 | 751 | // process payment details |
752 | 752 | $payments = $this->_transaction->get_many_related('Payment'); |
753 | - if( ! empty( $payments ) ) { |
|
754 | - $this->_template_args[ 'payments' ] = $payments; |
|
755 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
753 | + if ( ! empty($payments)) { |
|
754 | + $this->_template_args['payments'] = $payments; |
|
755 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
756 | 756 | } else { |
757 | - $this->_template_args[ 'payments' ] = false; |
|
758 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
757 | + $this->_template_args['payments'] = false; |
|
758 | + $this->_template_args['existing_reg_payments'] = array(); |
|
759 | 759 | } |
760 | 760 | |
761 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
762 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
761 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
762 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
763 | 763 | |
764 | - if ( isset( $txn_details['invoice_number'] )) { |
|
764 | + if (isset($txn_details['invoice_number'])) { |
|
765 | 765 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
766 | - $this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' ); |
|
766 | + $this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso'); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
770 | - $this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
770 | + $this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
771 | 771 | |
772 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
773 | - $this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' ); |
|
772 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
773 | + $this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso'); |
|
774 | 774 | |
775 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
776 | - $this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
775 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
776 | + $this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
777 | 777 | |
778 | 778 | $reg_steps = '<ul>'; |
779 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
780 | - if ( $reg_step_status === true ) { |
|
781 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
782 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
783 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
784 | - __( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
785 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
786 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
787 | - ) . '</li>'; |
|
779 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
780 | + if ($reg_step_status === true) { |
|
781 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
782 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
783 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
784 | + __('%1$s : Initiated %2$s', 'event_espresso'), |
|
785 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
786 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
787 | + ).'</li>'; |
|
788 | 788 | } else { |
789 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
789 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | $reg_steps .= '</ul>'; |
793 | 793 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
794 | - $this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' ); |
|
794 | + $this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso'); |
|
795 | 795 | |
796 | 796 | |
797 | 797 | $this->_get_registrations_to_apply_payment_to(); |
798 | - $this->_get_payment_methods( $payments ); |
|
798 | + $this->_get_payment_methods($payments); |
|
799 | 799 | $this->_get_payment_status_array(); |
800 | 800 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
801 | 801 | |
802 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
803 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
804 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
802 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
803 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
804 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
805 | 805 | |
806 | 806 | // 'espresso_delete_payment_nonce' |
807 | 807 | |
808 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
809 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
808 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
809 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
810 | 810 | |
811 | 811 | } |
812 | 812 | |
@@ -821,27 +821,27 @@ discard block |
||
821 | 821 | * @param EE_Payment[] $payments |
822 | 822 | * @return array |
823 | 823 | */ |
824 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
824 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
825 | 825 | $existing_reg_payments = array(); |
826 | 826 | // get all reg payments for these payments |
827 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
827 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
828 | 828 | array( |
829 | 829 | 'PAY_ID' => array( |
830 | 830 | 'IN', |
831 | - array_keys( $payments ) |
|
831 | + array_keys($payments) |
|
832 | 832 | ) |
833 | 833 | ) |
834 | - ) ); |
|
835 | - if ( ! empty( $reg_payments ) ) { |
|
836 | - foreach ( $payments as $payment ) { |
|
837 | - if ( ! $payment instanceof EE_Payment ) { |
|
834 | + )); |
|
835 | + if ( ! empty($reg_payments)) { |
|
836 | + foreach ($payments as $payment) { |
|
837 | + if ( ! $payment instanceof EE_Payment) { |
|
838 | 838 | continue; |
839 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
840 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
839 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
840 | + $existing_reg_payments[$payment->ID()] = array(); |
|
841 | 841 | } |
842 | - foreach ( $reg_payments as $reg_payment ) { |
|
843 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
844 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
842 | + foreach ($reg_payments as $reg_payment) { |
|
843 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
844 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
845 | 845 | } |
846 | 846 | } |
847 | 847 | } |
@@ -878,39 +878,39 @@ discard block |
||
878 | 878 | $registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">'; |
879 | 879 | $registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">'; |
880 | 880 | $registrations_to_apply_payment_to .= '<thead><tr>'; |
881 | - $registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>'; |
|
882 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>'; |
|
883 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>'; |
|
884 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>'; |
|
885 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>'; |
|
886 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>'; |
|
887 | - $registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>'; |
|
881 | + $registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>'; |
|
882 | + $registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>'; |
|
883 | + $registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>'; |
|
884 | + $registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>'; |
|
885 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>'; |
|
886 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>'; |
|
887 | + $registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>'; |
|
888 | 888 | $registrations_to_apply_payment_to .= '</tr></thead><tbody>'; |
889 | 889 | // get registrations for TXN |
890 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
891 | - foreach ( $registrations as $registration ) { |
|
892 | - if ( $registration instanceof EE_Registration ) { |
|
890 | + $registrations = $this->_transaction->registrations($query_params); |
|
891 | + foreach ($registrations as $registration) { |
|
892 | + if ($registration instanceof EE_Registration) { |
|
893 | 893 | $owing = $registration->final_price() - $registration->paid(); |
894 | - $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : ''; |
|
895 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : ''; |
|
896 | - $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">'; |
|
894 | + $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : ''; |
|
895 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : ''; |
|
896 | + $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">'; |
|
897 | 897 | // add html for checkbox input and label |
898 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>'; |
|
899 | - $registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>'; |
|
900 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>'; |
|
901 | - $registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>'; |
|
902 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>'; |
|
903 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>'; |
|
898 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>'; |
|
899 | + $registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>'; |
|
900 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>'; |
|
901 | + $registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>'; |
|
902 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>'; |
|
903 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>'; |
|
904 | 904 | $registrations_to_apply_payment_to .= '<td class="jst-cntr">'; |
905 | 905 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
906 | - $registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>'; |
|
906 | + $registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>'; |
|
907 | 907 | $registrations_to_apply_payment_to .= '</td>'; |
908 | 908 | $registrations_to_apply_payment_to .= '</tr>'; |
909 | 909 | } |
910 | 910 | } |
911 | 911 | $registrations_to_apply_payment_to .= '</tbody></table></div>'; |
912 | - $registrations_to_apply_payment_to .= '<p class="clear description">' . __( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>'; |
|
913 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
912 | + $registrations_to_apply_payment_to .= '<p class="clear description">'.__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>'; |
|
913 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | |
@@ -927,9 +927,9 @@ discard block |
||
927 | 927 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
928 | 928 | //let's add a "don't change" option. |
929 | 929 | $status_array['NAN'] = __('Leave the Same', 'event_espresso'); |
930 | - $status_array = array_merge( $status_array, $statuses ); |
|
931 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' ); |
|
932 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' ); |
|
930 | + $status_array = array_merge($status_array, $statuses); |
|
931 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status'); |
|
932 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status'); |
|
933 | 933 | |
934 | 934 | } |
935 | 935 | |
@@ -944,21 +944,21 @@ discard block |
||
944 | 944 | * @param EE_Payment[] to show on this page |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - private function _get_payment_methods( $payments = array() ) { |
|
947 | + private function _get_payment_methods($payments = array()) { |
|
948 | 948 | $payment_methods_of_payments = array(); |
949 | - foreach( $payments as $payment ){ |
|
950 | - if( $payment instanceof EE_Payment ){ |
|
951 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
949 | + foreach ($payments as $payment) { |
|
950 | + if ($payment instanceof EE_Payment) { |
|
951 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
952 | 952 | } |
953 | 953 | } |
954 | - if( $payment_methods_of_payments ){ |
|
955 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
956 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
957 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
958 | - }else{ |
|
959 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
954 | + if ($payment_methods_of_payments) { |
|
955 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
956 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
957 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
958 | + } else { |
|
959 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
960 | 960 | } |
961 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
961 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | |
@@ -972,46 +972,46 @@ discard block |
||
972 | 972 | * @param array $metabox |
973 | 973 | * @return void |
974 | 974 | */ |
975 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
975 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
976 | 976 | |
977 | - extract( $metabox['args'] ); |
|
977 | + extract($metabox['args']); |
|
978 | 978 | $this->_template_args['post'] = $post; |
979 | 979 | $this->_template_args['event_attendees'] = array(); |
980 | 980 | // process items in cart |
981 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
982 | - if ( ! empty( $line_items )) { |
|
983 | - foreach ( $line_items as $item ) { |
|
984 | - if ( $item instanceof EE_Line_Item ) { |
|
985 | - switch( $item->OBJ_type() ) { |
|
981 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
982 | + if ( ! empty($line_items)) { |
|
983 | + foreach ($line_items as $item) { |
|
984 | + if ($item instanceof EE_Line_Item) { |
|
985 | + switch ($item->OBJ_type()) { |
|
986 | 986 | |
987 | 987 | case 'Event' : |
988 | 988 | break; |
989 | 989 | |
990 | 990 | case 'Ticket' : |
991 | 991 | $ticket = $item->ticket(); |
992 | - if ( empty( $ticket )) { |
|
992 | + if (empty($ticket)) { |
|
993 | 993 | continue; //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
994 | 994 | } |
995 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' )); |
|
995 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
996 | 996 | $event = $ticket->get_first_related('Registration')->get_first_related('Event'); |
997 | - $event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : ''; |
|
997 | + $event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : ''; |
|
998 | 998 | |
999 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1000 | - foreach( $registrations as $registration ) { |
|
1001 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1002 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1003 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
999 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1000 | + foreach ($registrations as $registration) { |
|
1001 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1002 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1003 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1004 | 1004 | // attendee info |
1005 | 1005 | $attendee = $registration->get_first_related('Attendee'); |
1006 | - if ( $attendee instanceof EE_Attendee ) { |
|
1006 | + if ($attendee instanceof EE_Attendee) { |
|
1007 | 1007 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
1008 | 1008 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
1009 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1010 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array() ); |
|
1009 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1010 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array()); |
|
1011 | 1011 | } else { |
1012 | 1012 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1013 | 1013 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
1014 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1014 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1015 | 1015 | $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
1016 | 1016 | } |
1017 | 1017 | } |
@@ -1021,12 +1021,12 @@ discard block |
||
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | |
1024 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1025 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1024 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1025 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1026 | 1026 | |
1027 | 1027 | } else { |
1028 | 1028 | echo sprintf( |
1029 | - __( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1029 | + __('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1030 | 1030 | '<p class="important-notice">', |
1031 | 1031 | '</p>' |
1032 | 1032 | ); |
@@ -1045,20 +1045,20 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | public function txn_registrant_side_meta_box() { |
1047 | 1047 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1048 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1048 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1049 | 1049 | $this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1050 | 1050 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1051 | 1051 | } |
1052 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1052 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1053 | 1053 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1054 | 1054 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1055 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1055 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1056 | 1056 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1057 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID() ), REG_ADMIN_URL ); |
|
1057 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL); |
|
1058 | 1058 | // get formatted address for registrant |
1059 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1060 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1061 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1059 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1060 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1061 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | |
@@ -1074,12 +1074,12 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1076 | 1076 | $this->_template_args['billing_form_url'] = add_query_arg( |
1077 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1077 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1078 | 1078 | TXN_ADMIN_URL |
1079 | 1079 | ); |
1080 | 1080 | |
1081 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1082 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1081 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1082 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | |
@@ -1092,42 +1092,42 @@ discard block |
||
1092 | 1092 | * @return void |
1093 | 1093 | */ |
1094 | 1094 | public function apply_payments_or_refunds() { |
1095 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1095 | + $json_response_data = array('return_data' => FALSE); |
|
1096 | 1096 | $valid_data = $this->_validate_payment_request_data(); |
1097 | - if ( ! empty( $valid_data ) ) { |
|
1098 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1097 | + if ( ! empty($valid_data)) { |
|
1098 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1099 | 1099 | //save the new payment |
1100 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1100 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1101 | 1101 | // get the TXN for this payment |
1102 | 1102 | $transaction = $payment->transaction(); |
1103 | 1103 | // verify transaction |
1104 | - if ( $transaction instanceof EE_Transaction ) { |
|
1104 | + if ($transaction instanceof EE_Transaction) { |
|
1105 | 1105 | // calculate_total_payments_and_update_status |
1106 | - $this->_process_transaction_payments( $transaction ); |
|
1107 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1108 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1106 | + $this->_process_transaction_payments($transaction); |
|
1107 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1108 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1109 | 1109 | // apply payment to registrations (if applicable) |
1110 | - if ( ! empty( $REG_IDs ) ) { |
|
1111 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1110 | + if ( ! empty($REG_IDs)) { |
|
1111 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1112 | 1112 | $this->_maybe_send_notifications(); |
1113 | 1113 | // now process status changes for the same registrations |
1114 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1114 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1115 | 1115 | } |
1116 | - $this->_maybe_send_notifications( $payment ); |
|
1116 | + $this->_maybe_send_notifications($payment); |
|
1117 | 1117 | //prepare to render page |
1118 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1119 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1118 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1119 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1120 | 1120 | } else { |
1121 | 1121 | EE_Error::add_error( |
1122 | - __( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1122 | + __('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1123 | 1123 | __FILE__, __FUNCTION__, __LINE__ |
1124 | 1124 | ); |
1125 | 1125 | } |
1126 | 1126 | } else { |
1127 | - EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1127 | + EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1130 | + $notices = EE_Error::get_notices(false, false, false); |
|
1131 | 1131 | $this->_template_args = array( |
1132 | 1132 | 'data' => $json_response_data, |
1133 | 1133 | 'error' => $notices['errors'], |
@@ -1144,30 +1144,30 @@ discard block |
||
1144 | 1144 | * @return array |
1145 | 1145 | */ |
1146 | 1146 | protected function _validate_payment_request_data() { |
1147 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1147 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1148 | 1148 | return false; |
1149 | 1149 | } |
1150 | 1150 | $payment_form = $this->_generate_payment_form_section(); |
1151 | 1151 | try { |
1152 | - if ( $payment_form->was_submitted() ) { |
|
1152 | + if ($payment_form->was_submitted()) { |
|
1153 | 1153 | $payment_form->receive_form_submission(); |
1154 | - if ( ! $payment_form->is_valid() ) { |
|
1154 | + if ( ! $payment_form->is_valid()) { |
|
1155 | 1155 | $submission_error_messages = array(); |
1156 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1157 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1156 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1157 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1158 | 1158 | $submission_error_messages[] = sprintf( |
1159 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1159 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1160 | 1160 | $validation_error->get_form_section()->html_label_text(), |
1161 | 1161 | $validation_error->getMessage() |
1162 | 1162 | ); |
1163 | 1163 | } |
1164 | 1164 | } |
1165 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1165 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1166 | 1166 | return array(); |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | - } catch ( EE_Error $e ) { |
|
1170 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1169 | + } catch (EE_Error $e) { |
|
1170 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1171 | 1171 | return array(); |
1172 | 1172 | } |
1173 | 1173 | return $payment_form->valid_data(); |
@@ -1189,63 +1189,63 @@ discard block |
||
1189 | 1189 | array( |
1190 | 1190 | 'default' => 0, |
1191 | 1191 | 'required' => false, |
1192 | - 'html_label_text' => __( 'Payment ID', 'event_espresso' ), |
|
1193 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1192 | + 'html_label_text' => __('Payment ID', 'event_espresso'), |
|
1193 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1194 | 1194 | ) |
1195 | 1195 | ), |
1196 | 1196 | 'TXN_ID' => new EE_Text_Input( |
1197 | 1197 | array( |
1198 | 1198 | 'default' => 0, |
1199 | 1199 | 'required' => true, |
1200 | - 'html_label_text' => __( 'Transaction ID', 'event_espresso' ), |
|
1201 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1200 | + 'html_label_text' => __('Transaction ID', 'event_espresso'), |
|
1201 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1202 | 1202 | ) |
1203 | 1203 | ), |
1204 | 1204 | 'type' => new EE_Text_Input( |
1205 | 1205 | array( |
1206 | 1206 | 'default' => 1, |
1207 | 1207 | 'required' => true, |
1208 | - 'html_label_text' => __( 'Payment or Refund', 'event_espresso' ), |
|
1209 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1208 | + 'html_label_text' => __('Payment or Refund', 'event_espresso'), |
|
1209 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1210 | 1210 | ) |
1211 | 1211 | ), |
1212 | 1212 | 'amount' => new EE_Text_Input( |
1213 | 1213 | array( |
1214 | 1214 | 'default' => 0, |
1215 | 1215 | 'required' => true, |
1216 | - 'html_label_text' => __( 'Payment amount', 'event_espresso' ), |
|
1217 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1216 | + 'html_label_text' => __('Payment amount', 'event_espresso'), |
|
1217 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1218 | 1218 | ) |
1219 | 1219 | ), |
1220 | 1220 | 'status' => new EE_Text_Input( |
1221 | 1221 | array( |
1222 | 1222 | 'default' => EEM_Payment::status_id_approved, |
1223 | 1223 | 'required' => true, |
1224 | - 'html_label_text' => __( 'Payment status', 'event_espresso' ), |
|
1224 | + 'html_label_text' => __('Payment status', 'event_espresso'), |
|
1225 | 1225 | ) |
1226 | 1226 | ), |
1227 | 1227 | 'PMD_ID' => new EE_Text_Input( |
1228 | 1228 | array( |
1229 | 1229 | 'default' => 2, |
1230 | 1230 | 'required' => true, |
1231 | - 'html_label_text' => __( 'Payment Method', 'event_espresso' ), |
|
1232 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1231 | + 'html_label_text' => __('Payment Method', 'event_espresso'), |
|
1232 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1233 | 1233 | ) |
1234 | 1234 | ), |
1235 | 1235 | 'date' => new EE_Text_Input( |
1236 | 1236 | array( |
1237 | 1237 | 'default' => time(), |
1238 | 1238 | 'required' => true, |
1239 | - 'html_label_text' => __( 'Payment date', 'event_espresso' ), |
|
1239 | + 'html_label_text' => __('Payment date', 'event_espresso'), |
|
1240 | 1240 | ) |
1241 | 1241 | ), |
1242 | 1242 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1243 | 1243 | array( |
1244 | 1244 | 'default' => '', |
1245 | 1245 | 'required' => false, |
1246 | - 'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1246 | + 'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'), |
|
1247 | 1247 | 'validation_strategies' => array( |
1248 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1248 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1249 | 1249 | ) |
1250 | 1250 | ) |
1251 | 1251 | ), |
@@ -1253,9 +1253,9 @@ discard block |
||
1253 | 1253 | array( |
1254 | 1254 | 'default' => '', |
1255 | 1255 | 'required' => false, |
1256 | - 'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ), |
|
1256 | + 'html_label_text' => __('Purchase Order Number', 'event_espresso'), |
|
1257 | 1257 | 'validation_strategies' => array( |
1258 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1258 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1259 | 1259 | ) |
1260 | 1260 | ) |
1261 | 1261 | ), |
@@ -1263,9 +1263,9 @@ discard block |
||
1263 | 1263 | array( |
1264 | 1264 | 'default' => '', |
1265 | 1265 | 'required' => false, |
1266 | - 'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ), |
|
1266 | + 'html_label_text' => __('Extra Field for Accounting', 'event_espresso'), |
|
1267 | 1267 | 'validation_strategies' => array( |
1268 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1268 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1269 | 1269 | ) |
1270 | 1270 | ) |
1271 | 1271 | ), |
@@ -1282,37 +1282,37 @@ discard block |
||
1282 | 1282 | * @param array $valid_data |
1283 | 1283 | * @return EE_Payment |
1284 | 1284 | */ |
1285 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1286 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1285 | + protected function _create_payment_from_request_data($valid_data) { |
|
1286 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1287 | 1287 | // get payment amount |
1288 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1288 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1289 | 1289 | // payments have a type value of 1 and refunds have a type value of -1 |
1290 | 1290 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1291 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1291 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1292 | 1292 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1293 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1293 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1294 | 1294 | $payment = EE_Payment::new_instance( |
1295 | 1295 | array( |
1296 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1297 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1296 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1297 | + 'STS_ID' => $valid_data['status'], |
|
1298 | 1298 | 'PAY_timestamp' => $date, |
1299 | 1299 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1300 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1300 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1301 | 1301 | 'PAY_amount' => $amount, |
1302 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1303 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1304 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1302 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1303 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1304 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1305 | 1305 | 'PAY_details' => $valid_data, |
1306 | 1306 | 'PAY_ID' => $PAY_ID |
1307 | 1307 | ), |
1308 | 1308 | '', |
1309 | - array( 'Y-m-d', 'g:i a' ) |
|
1309 | + array('Y-m-d', 'g:i a') |
|
1310 | 1310 | ); |
1311 | 1311 | |
1312 | - if ( ! $payment->save() ) { |
|
1312 | + if ( ! $payment->save()) { |
|
1313 | 1313 | EE_Error::add_error( |
1314 | 1314 | sprintf( |
1315 | - __( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1315 | + __('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1316 | 1316 | $payment->ID() |
1317 | 1317 | ), |
1318 | 1318 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1329,15 +1329,15 @@ discard block |
||
1329 | 1329 | * @param \EE_Transaction $transaction |
1330 | 1330 | * @return array |
1331 | 1331 | */ |
1332 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1332 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1333 | 1333 | /** @type EE_Transaction_Payments $transaction_payments */ |
1334 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1334 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1335 | 1335 | //update the transaction with this payment |
1336 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1337 | - EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1337 | + EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1338 | 1338 | } else { |
1339 | 1339 | EE_Error::add_error( |
1340 | - __( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1340 | + __('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1341 | 1341 | , __FILE__, __FUNCTION__, __LINE__ |
1342 | 1342 | ); |
1343 | 1343 | } |
@@ -1353,19 +1353,19 @@ discard block |
||
1353 | 1353 | * @param \EE_Payment $payment |
1354 | 1354 | * @return array |
1355 | 1355 | */ |
1356 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1356 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1357 | 1357 | $REG_IDs = array(); |
1358 | 1358 | // grab array of IDs for specific registrations to apply changes to |
1359 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1360 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1359 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1360 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1361 | 1361 | } |
1362 | 1362 | //nothing specified ? then get all reg IDs |
1363 | - if ( empty( $REG_IDs ) ) { |
|
1363 | + if (empty($REG_IDs)) { |
|
1364 | 1364 | $registrations = $payment->transaction()->registrations(); |
1365 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1365 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1366 | 1366 | } |
1367 | 1367 | // ensure that REG_IDs are integers and NOT strings |
1368 | - return array_map( 'intval', $REG_IDs ); |
|
1368 | + return array_map('intval', $REG_IDs); |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | /** |
1383 | 1383 | * @param array $existing_reg_payment_REG_IDs |
1384 | 1384 | */ |
1385 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1385 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1386 | 1386 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1387 | 1387 | } |
1388 | 1388 | |
@@ -1397,13 +1397,13 @@ discard block |
||
1397 | 1397 | * @param \EE_Payment $payment |
1398 | 1398 | * @return array |
1399 | 1399 | */ |
1400 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1401 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1400 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1401 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1402 | 1402 | // let's get any existing reg payment records for this payment |
1403 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1403 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1404 | 1404 | // but we only want the REG IDs, so grab the array keys |
1405 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1406 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1405 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1406 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1407 | 1407 | } |
1408 | 1408 | return $this->existing_reg_payment_REG_IDs(); |
1409 | 1409 | } |
@@ -1422,23 +1422,23 @@ discard block |
||
1422 | 1422 | * @param int $PAY_ID |
1423 | 1423 | * @return bool; |
1424 | 1424 | */ |
1425 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1425 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1426 | 1426 | // newly created payments will have nothing recorded for $PAY_ID |
1427 | - if ( $PAY_ID == 0 ) { |
|
1427 | + if ($PAY_ID == 0) { |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1431 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1430 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1431 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1432 | 1432 | return false; |
1433 | 1433 | } |
1434 | 1434 | /** @type EE_Transaction_Payments $transaction_payments */ |
1435 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1435 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1436 | 1436 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1437 | 1437 | $payment, |
1438 | 1438 | array( |
1439 | 1439 | array( |
1440 | 1440 | 'PAY_ID' => $payment->ID(), |
1441 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1441 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1442 | 1442 | ) |
1443 | 1443 | ) |
1444 | 1444 | ); |
@@ -1457,25 +1457,25 @@ discard block |
||
1457 | 1457 | * @param array $REG_IDs |
1458 | 1458 | * @return bool |
1459 | 1459 | */ |
1460 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1460 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1461 | 1461 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1462 | 1462 | // so let's do that using our set of REG_IDs from the form |
1463 | 1463 | $registration_query_where_params = array( |
1464 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1464 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1465 | 1465 | ); |
1466 | 1466 | // but add in some conditions regarding payment, |
1467 | 1467 | // so that we don't apply payments to registrations that are free or have already been paid for |
1468 | 1468 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1469 | - if ( ! $payment->is_a_refund() ) { |
|
1470 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1471 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1469 | + if ( ! $payment->is_a_refund()) { |
|
1470 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1471 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1472 | 1472 | } |
1473 | 1473 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1474 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1475 | - if ( ! empty( $registrations ) ) { |
|
1474 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1475 | + if ( ! empty($registrations)) { |
|
1476 | 1476 | /** @type EE_Payment_Processor $payment_processor */ |
1477 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1478 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1477 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1478 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1479 | 1479 | } |
1480 | 1480 | } |
1481 | 1481 | |
@@ -1491,22 +1491,22 @@ discard block |
||
1491 | 1491 | * @param array $REG_IDs |
1492 | 1492 | * @return bool |
1493 | 1493 | */ |
1494 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1494 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1495 | 1495 | // first if there is no change in status then we get out. |
1496 | 1496 | if ( |
1497 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1497 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1498 | 1498 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1499 | 1499 | ) { |
1500 | 1500 | //no error message, no change requested, just nothing to do man. |
1501 | 1501 | return FALSE; |
1502 | 1502 | } |
1503 | 1503 | /** @type EE_Transaction_Processor $transaction_processor */ |
1504 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1504 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1505 | 1505 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1506 | 1506 | return $transaction_processor->manually_update_registration_statuses( |
1507 | 1507 | $transaction, |
1508 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1509 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1508 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1509 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1510 | 1510 | ); |
1511 | 1511 | } |
1512 | 1512 | |
@@ -1521,16 +1521,16 @@ discard block |
||
1521 | 1521 | * @param bool | null $delete_txn_reg_status_change |
1522 | 1522 | * @return array |
1523 | 1523 | */ |
1524 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1524 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1525 | 1525 | // was the payment deleted ? |
1526 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1526 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1527 | 1527 | return array( |
1528 | 1528 | 'PAY_ID' => $payment->ID(), |
1529 | 1529 | 'amount' => $payment->amount(), |
1530 | 1530 | 'total_paid' => $payment->transaction()->paid(), |
1531 | 1531 | 'txn_status' => $payment->transaction()->status_ID(), |
1532 | 1532 | 'pay_status' => $payment->STS_ID(), |
1533 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1533 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1534 | 1534 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1535 | 1535 | ); |
1536 | 1536 | } else { |
@@ -1542,16 +1542,16 @@ discard block |
||
1542 | 1542 | 'pay_status' => $payment->STS_ID(), |
1543 | 1543 | 'PAY_ID' => $payment->ID(), |
1544 | 1544 | 'STS_ID' => $payment->STS_ID(), |
1545 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1546 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1547 | - 'method' => strtoupper( $payment->source() ), |
|
1545 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1546 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1547 | + 'method' => strtoupper($payment->source()), |
|
1548 | 1548 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1549 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ), |
|
1549 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'), |
|
1550 | 1550 | 'gateway_response' => $payment->gateway_response(), |
1551 | 1551 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1552 | 1552 | 'po_number' => $payment->po_number(), |
1553 | 1553 | 'extra_accntng' => $payment->extra_accntng(), |
1554 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1554 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1555 | 1555 | ); |
1556 | 1556 | } |
1557 | 1557 | } |
@@ -1566,39 +1566,39 @@ discard block |
||
1566 | 1566 | * @return void |
1567 | 1567 | */ |
1568 | 1568 | public function delete_payment() { |
1569 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1570 | - $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
|
1571 | - if ( $PAY_ID ) { |
|
1572 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1573 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1574 | - if ( $payment instanceof EE_Payment ) { |
|
1575 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1569 | + $json_response_data = array('return_data' => FALSE); |
|
1570 | + $PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0; |
|
1571 | + if ($PAY_ID) { |
|
1572 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1573 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1574 | + if ($payment instanceof EE_Payment) { |
|
1575 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1576 | 1576 | /** @type EE_Transaction_Payments $transaction_payments */ |
1577 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1578 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1579 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1580 | - if ( $delete_txn_reg_status_change ) { |
|
1577 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1578 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1579 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1580 | + if ($delete_txn_reg_status_change) { |
|
1581 | 1581 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1582 | 1582 | //MAKE sure we also add the delete_txn_req_status_change to the |
1583 | 1583 | //$_REQUEST global because that's how messages will be looking for it. |
1584 | 1584 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1585 | 1585 | $this->_maybe_send_notifications(); |
1586 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1586 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1587 | 1587 | } |
1588 | 1588 | } |
1589 | 1589 | } else { |
1590 | 1590 | EE_Error::add_error( |
1591 | - __( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1591 | + __('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1592 | 1592 | __FILE__, __FUNCTION__, __LINE__ |
1593 | 1593 | ); |
1594 | 1594 | } |
1595 | 1595 | } else { |
1596 | 1596 | EE_Error::add_error( |
1597 | - __( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1597 | + __('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1598 | 1598 | __FILE__, __FUNCTION__, __LINE__ |
1599 | 1599 | ); |
1600 | 1600 | } |
1601 | - $notices = EE_Error::get_notices( false, false, false); |
|
1601 | + $notices = EE_Error::get_notices(false, false, false); |
|
1602 | 1602 | $this->_template_args = array( |
1603 | 1603 | 'data' => $json_response_data, |
1604 | 1604 | 'success' => $notices['success'], |
@@ -1618,17 +1618,17 @@ discard block |
||
1618 | 1618 | * @param array $REG_IDs |
1619 | 1619 | * @return array |
1620 | 1620 | */ |
1621 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1621 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1622 | 1622 | $registration_payment_data = array(); |
1623 | 1623 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1624 | - if ( ! empty( $REG_IDs ) ) { |
|
1625 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
1626 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1627 | - foreach ( $registrations as $registration ) { |
|
1628 | - if ( $registration instanceof EE_Registration ) { |
|
1629 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1624 | + if ( ! empty($REG_IDs)) { |
|
1625 | + EE_Registry::instance()->load_helper('Template'); |
|
1626 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1627 | + foreach ($registrations as $registration) { |
|
1628 | + if ($registration instanceof EE_Registration) { |
|
1629 | + $registration_payment_data[$registration->ID()] = array( |
|
1630 | 1630 | 'paid' => $registration->pretty_paid(), |
1631 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1631 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1632 | 1632 | ); |
1633 | 1633 | } |
1634 | 1634 | } |
@@ -1648,30 +1648,30 @@ discard block |
||
1648 | 1648 | * @access protected |
1649 | 1649 | * @param \EE_Payment | null $payment |
1650 | 1650 | */ |
1651 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1652 | - switch ( $payment instanceof EE_Payment ) { |
|
1651 | + protected function _maybe_send_notifications($payment = null) { |
|
1652 | + switch ($payment instanceof EE_Payment) { |
|
1653 | 1653 | // payment notifications |
1654 | 1654 | case true : |
1655 | 1655 | if ( |
1656 | 1656 | isset( |
1657 | - $this->_req_data[ 'txn_payments' ], |
|
1658 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1657 | + $this->_req_data['txn_payments'], |
|
1658 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1659 | 1659 | ) && |
1660 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1660 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1661 | 1661 | ) { |
1662 | - $this->_process_payment_notification( $payment ); |
|
1662 | + $this->_process_payment_notification($payment); |
|
1663 | 1663 | } |
1664 | 1664 | break; |
1665 | 1665 | // registration notifications |
1666 | 1666 | case false : |
1667 | 1667 | if ( |
1668 | 1668 | isset( |
1669 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1670 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1669 | + $this->_req_data['txn_reg_status_change'], |
|
1670 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1671 | 1671 | ) && |
1672 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1672 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1673 | 1673 | ) { |
1674 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1674 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1675 | 1675 | } |
1676 | 1676 | break; |
1677 | 1677 | } |
@@ -1687,11 +1687,11 @@ discard block |
||
1687 | 1687 | * @return void |
1688 | 1688 | */ |
1689 | 1689 | protected function _send_payment_reminder() { |
1690 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1691 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1692 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1693 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1694 | - $this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE ); |
|
1690 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1691 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1692 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1693 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1694 | + $this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE); |
|
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | |
@@ -1705,36 +1705,36 @@ discard block |
||
1705 | 1705 | * @param string $view |
1706 | 1706 | * @return mixed int = count || array of transaction objects |
1707 | 1707 | */ |
1708 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1708 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1709 | 1709 | |
1710 | 1710 | $TXN = EEM_Transaction::instance(); |
1711 | 1711 | |
1712 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1713 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1712 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
1713 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
1714 | 1714 | |
1715 | 1715 | //make sure our timestamps start and end right at the boundaries for each day |
1716 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1717 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1716 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1717 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1718 | 1718 | |
1719 | 1719 | |
1720 | 1720 | //convert to timestamps |
1721 | - $start_date = strtotime( $start_date ); |
|
1722 | - $end_date = strtotime( $end_date ); |
|
1721 | + $start_date = strtotime($start_date); |
|
1722 | + $end_date = strtotime($end_date); |
|
1723 | 1723 | |
1724 | 1724 | //makes sure start date is the lowest value and vice versa |
1725 | - $start_date = min( $start_date, $end_date ); |
|
1726 | - $end_date = max( $start_date, $end_date ); |
|
1725 | + $start_date = min($start_date, $end_date); |
|
1726 | + $end_date = max($start_date, $end_date); |
|
1727 | 1727 | |
1728 | 1728 | //convert to correct format for query |
1729 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
1730 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
1729 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
1730 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
1731 | 1731 | |
1732 | 1732 | |
1733 | 1733 | |
1734 | 1734 | //set orderby |
1735 | 1735 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1736 | 1736 | |
1737 | - switch ( $this->_req_data['orderby'] ) { |
|
1737 | + switch ($this->_req_data['orderby']) { |
|
1738 | 1738 | case 'TXN_ID': |
1739 | 1739 | $orderby = 'TXN_ID'; |
1740 | 1740 | break; |
@@ -1748,66 +1748,66 @@ discard block |
||
1748 | 1748 | $orderby = 'TXN_timestamp'; |
1749 | 1749 | } |
1750 | 1750 | |
1751 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1752 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1753 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1754 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1751 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1752 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1753 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1754 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1755 | 1755 | |
1756 | - $offset = ($current_page-1)*$per_page; |
|
1757 | - $limit = array( $offset, $per_page ); |
|
1756 | + $offset = ($current_page - 1) * $per_page; |
|
1757 | + $limit = array($offset, $per_page); |
|
1758 | 1758 | |
1759 | 1759 | $_where = array( |
1760 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1760 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1761 | 1761 | 'Registration.REG_count' => 1 |
1762 | 1762 | ); |
1763 | 1763 | |
1764 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1764 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1765 | 1765 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1766 | 1766 | } |
1767 | 1767 | |
1768 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1769 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1768 | + if (isset($this->_req_data['s'])) { |
|
1769 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1770 | 1770 | $_where['OR'] = array( |
1771 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1772 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1773 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1774 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1775 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1776 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1777 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1778 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1779 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1780 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1781 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1782 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1783 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1784 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1785 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1786 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1787 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1788 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1789 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1790 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1791 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1771 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1772 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1773 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1774 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1775 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1776 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1777 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1778 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1779 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1780 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1781 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1782 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1783 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1784 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1785 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1786 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1787 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1788 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1789 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1790 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1791 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1792 | 1792 | ); |
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | //failed transactions |
1796 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1797 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1796 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1797 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1798 | 1798 | |
1799 | - if ( $failed ) { |
|
1800 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1801 | - } else if ( $abandoned ) { |
|
1799 | + if ($failed) { |
|
1800 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1801 | + } else if ($abandoned) { |
|
1802 | 1802 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1803 | 1803 | } else { |
1804 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1805 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1804 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1805 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1806 | 1806 | } |
1807 | 1807 | |
1808 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1808 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1809 | 1809 | |
1810 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1810 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1811 | 1811 | |
1812 | 1812 | |
1813 | 1813 | return $transactions; |