@@ -15,84 +15,84 @@ |
||
15 | 15 | class Pricing_Edit_Price_Type_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Edit Price Type Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'edit-price-type-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Edit Price Type Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'edit-price-type-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - protected function _set_tour_stops() |
|
26 | - { |
|
27 | - $this->_stops = array( |
|
28 | - 10 => array( |
|
29 | - 'content' => $this->_start(), |
|
30 | - ), |
|
31 | - 20 => array( |
|
32 | - 'id' => 'base_type', |
|
33 | - 'content' => $this->_basic_type_stop(), |
|
34 | - 'options' => array( |
|
35 | - 'tipLocation' => 'top', |
|
36 | - 'tipAdjustmentY' => -50, |
|
37 | - 'tipAdjustmentX' => -15, |
|
38 | - ), |
|
39 | - ), |
|
40 | - 30 => array( |
|
41 | - 'id' => 'PRT_name', |
|
42 | - 'content' => $this->_price_type_name_stop(), |
|
43 | - 'options' => array( |
|
44 | - 'tipLocation' => 'top', |
|
45 | - 'tipAdjustmentY' => -40, |
|
46 | - ), |
|
47 | - ), |
|
48 | - 40 => array( |
|
49 | - 'id' => 'PRT_name', |
|
50 | - 'content' => $this->_percentage_dollar_amount_stop(), |
|
51 | - 'options' => array( |
|
52 | - 'tipLocation' => 'top', |
|
53 | - 'tipAdjustmentY' => 45, |
|
54 | - ), |
|
55 | - ), |
|
56 | - 50 => array( |
|
57 | - 'id' => 'PRT_order', |
|
58 | - 'content' => $this->_order_of_application_stop(), |
|
59 | - 'options' => array( |
|
60 | - 'tipLocation' => 'top', |
|
61 | - 'tipAdjustmentY' => -40, |
|
62 | - ), |
|
63 | - ), |
|
64 | - ); |
|
65 | - } |
|
25 | + protected function _set_tour_stops() |
|
26 | + { |
|
27 | + $this->_stops = array( |
|
28 | + 10 => array( |
|
29 | + 'content' => $this->_start(), |
|
30 | + ), |
|
31 | + 20 => array( |
|
32 | + 'id' => 'base_type', |
|
33 | + 'content' => $this->_basic_type_stop(), |
|
34 | + 'options' => array( |
|
35 | + 'tipLocation' => 'top', |
|
36 | + 'tipAdjustmentY' => -50, |
|
37 | + 'tipAdjustmentX' => -15, |
|
38 | + ), |
|
39 | + ), |
|
40 | + 30 => array( |
|
41 | + 'id' => 'PRT_name', |
|
42 | + 'content' => $this->_price_type_name_stop(), |
|
43 | + 'options' => array( |
|
44 | + 'tipLocation' => 'top', |
|
45 | + 'tipAdjustmentY' => -40, |
|
46 | + ), |
|
47 | + ), |
|
48 | + 40 => array( |
|
49 | + 'id' => 'PRT_name', |
|
50 | + 'content' => $this->_percentage_dollar_amount_stop(), |
|
51 | + 'options' => array( |
|
52 | + 'tipLocation' => 'top', |
|
53 | + 'tipAdjustmentY' => 45, |
|
54 | + ), |
|
55 | + ), |
|
56 | + 50 => array( |
|
57 | + 'id' => 'PRT_order', |
|
58 | + 'content' => $this->_order_of_application_stop(), |
|
59 | + 'options' => array( |
|
60 | + 'tipLocation' => 'top', |
|
61 | + 'tipAdjustmentY' => -40, |
|
62 | + ), |
|
63 | + ), |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - protected function _start() |
|
69 | - { |
|
70 | - $content = '<h3>' . __('Edit Price Type', 'event_espresso') . '</h3>'; |
|
71 | - $content .= '<p>' |
|
72 | - . __( |
|
73 | - 'This tour of the Edit Price Type page will go over different areas of the screen to help you understand what they are used for.', |
|
74 | - 'event_espresso' |
|
75 | - ) . '</p>'; |
|
76 | - return $content; |
|
77 | - } |
|
68 | + protected function _start() |
|
69 | + { |
|
70 | + $content = '<h3>' . __('Edit Price Type', 'event_espresso') . '</h3>'; |
|
71 | + $content .= '<p>' |
|
72 | + . __( |
|
73 | + 'This tour of the Edit Price Type page will go over different areas of the screen to help you understand what they are used for.', |
|
74 | + 'event_espresso' |
|
75 | + ) . '</p>'; |
|
76 | + return $content; |
|
77 | + } |
|
78 | 78 | |
79 | - protected function _basic_type_stop() |
|
80 | - { |
|
81 | - return '<p>' . __('Set a price type to be a discount, surcharge, or tax.', 'event_espresso') . '</p>'; |
|
82 | - } |
|
79 | + protected function _basic_type_stop() |
|
80 | + { |
|
81 | + return '<p>' . __('Set a price type to be a discount, surcharge, or tax.', 'event_espresso') . '</p>'; |
|
82 | + } |
|
83 | 83 | |
84 | - protected function _price_type_name_stop() |
|
85 | - { |
|
86 | - return '<p>' . __('The name of the price type.', 'event_espresso') . '</p>'; |
|
87 | - } |
|
84 | + protected function _price_type_name_stop() |
|
85 | + { |
|
86 | + return '<p>' . __('The name of the price type.', 'event_espresso') . '</p>'; |
|
87 | + } |
|
88 | 88 | |
89 | - protected function _percentage_dollar_amount_stop() |
|
90 | - { |
|
91 | - return '<p>' . __('Set a price type to be percentage-based or a fixed amount.', 'event_espresso') . '</p>'; |
|
92 | - } |
|
89 | + protected function _percentage_dollar_amount_stop() |
|
90 | + { |
|
91 | + return '<p>' . __('Set a price type to be percentage-based or a fixed amount.', 'event_espresso') . '</p>'; |
|
92 | + } |
|
93 | 93 | |
94 | - protected function _order_of_application_stop() |
|
95 | - { |
|
96 | - return '<p>' . __('Set the order of application for a price type.', 'event_espresso') . '</p>'; |
|
97 | - } |
|
94 | + protected function _order_of_application_stop() |
|
95 | + { |
|
96 | + return '<p>' . __('Set the order of application for a price type.', 'event_espresso') . '</p>'; |
|
97 | + } |
|
98 | 98 | } |
@@ -67,32 +67,32 @@ |
||
67 | 67 | |
68 | 68 | protected function _start() |
69 | 69 | { |
70 | - $content = '<h3>' . __('Edit Price Type', 'event_espresso') . '</h3>'; |
|
70 | + $content = '<h3>'.__('Edit Price Type', 'event_espresso').'</h3>'; |
|
71 | 71 | $content .= '<p>' |
72 | 72 | . __( |
73 | 73 | 'This tour of the Edit Price Type page will go over different areas of the screen to help you understand what they are used for.', |
74 | 74 | 'event_espresso' |
75 | - ) . '</p>'; |
|
75 | + ).'</p>'; |
|
76 | 76 | return $content; |
77 | 77 | } |
78 | 78 | |
79 | 79 | protected function _basic_type_stop() |
80 | 80 | { |
81 | - return '<p>' . __('Set a price type to be a discount, surcharge, or tax.', 'event_espresso') . '</p>'; |
|
81 | + return '<p>'.__('Set a price type to be a discount, surcharge, or tax.', 'event_espresso').'</p>'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | protected function _price_type_name_stop() |
85 | 85 | { |
86 | - return '<p>' . __('The name of the price type.', 'event_espresso') . '</p>'; |
|
86 | + return '<p>'.__('The name of the price type.', 'event_espresso').'</p>'; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | protected function _percentage_dollar_amount_stop() |
90 | 90 | { |
91 | - return '<p>' . __('Set a price type to be percentage-based or a fixed amount.', 'event_espresso') . '</p>'; |
|
91 | + return '<p>'.__('Set a price type to be percentage-based or a fixed amount.', 'event_espresso').'</p>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | protected function _order_of_application_stop() |
95 | 95 | { |
96 | - return '<p>' . __('Set the order of application for a price type.', 'event_espresso') . '</p>'; |
|
96 | + return '<p>'.__('Set the order of application for a price type.', 'event_espresso').'</p>'; |
|
97 | 97 | } |
98 | 98 | } |
@@ -15,140 +15,140 @@ |
||
15 | 15 | class Pricing_Price_Types_Default_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Price Types Tour', 'event_espresso'); |
|
21 | - $this->_slug = 'default-price-types-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Price Types Tour', 'event_espresso'); |
|
21 | + $this->_slug = 'default-price-types-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - protected function _set_tour_stops() |
|
26 | - { |
|
27 | - $this->_stops = array( |
|
28 | - 10 => array( |
|
29 | - 'content' => $this->_start(), |
|
30 | - ), |
|
31 | - 20 => array( |
|
32 | - 'id' => 'name', |
|
33 | - 'content' => $this->_name_column_stop(), |
|
34 | - 'options' => array( |
|
35 | - 'tipLocation' => 'top', |
|
36 | - 'tipAdjustmentX' => -5, |
|
37 | - 'tipAdjustmentY' => -30, |
|
38 | - ), |
|
39 | - ), |
|
40 | - 30 => array( |
|
41 | - 'id' => 'base_type', |
|
42 | - 'content' => $this->_base_type_stop(), |
|
43 | - 'options' => array( |
|
44 | - 'tipLocation' => 'top', |
|
45 | - 'tipAdjustmentX' => 120, |
|
46 | - 'tipAdjustmentY' => -30, |
|
47 | - ), |
|
48 | - ), |
|
49 | - 40 => array( |
|
50 | - 'id' => 'percent', |
|
51 | - 'content' => $this->_percent_column_stop(), |
|
52 | - 'options' => array( |
|
53 | - 'tipLocation' => 'top', |
|
54 | - 'tipAdjustmentX' => 120, |
|
55 | - 'tipAdjustmentY' => -30, |
|
56 | - ), |
|
57 | - ), |
|
58 | - 50 => array( |
|
59 | - 'id' => 'order', |
|
60 | - 'content' => $this->_order_column_stop(), |
|
61 | - 'options' => array( |
|
62 | - 'tipLocation' => 'left', |
|
63 | - 'tipAdjustmentY' => -30, |
|
64 | - 'tipAdjustmentX' => 100, |
|
65 | - ), |
|
66 | - ), |
|
67 | - 60 => array( |
|
68 | - 'class' => 'bulkactions', |
|
69 | - 'content' => $this->_bulk_actions_stop(), |
|
70 | - 'options' => array( |
|
71 | - 'tipLocation' => 'left', |
|
72 | - 'tipAdjustmentY' => -50, |
|
73 | - 'tipAdjustmentX' => -75, |
|
74 | - ), |
|
75 | - ), |
|
76 | - 70 => array( |
|
77 | - 'id' => 'event-espresso_page_pricing-search-input', |
|
78 | - 'content' => $this->_search_stop(), |
|
79 | - 'options' => array( |
|
80 | - 'tipLocation' => 'left', |
|
81 | - 'tipAdjustmentY' => -50, |
|
82 | - 'tipAdjustmentX' => -15, |
|
83 | - ), |
|
84 | - ), |
|
85 | - ); |
|
86 | - } |
|
25 | + protected function _set_tour_stops() |
|
26 | + { |
|
27 | + $this->_stops = array( |
|
28 | + 10 => array( |
|
29 | + 'content' => $this->_start(), |
|
30 | + ), |
|
31 | + 20 => array( |
|
32 | + 'id' => 'name', |
|
33 | + 'content' => $this->_name_column_stop(), |
|
34 | + 'options' => array( |
|
35 | + 'tipLocation' => 'top', |
|
36 | + 'tipAdjustmentX' => -5, |
|
37 | + 'tipAdjustmentY' => -30, |
|
38 | + ), |
|
39 | + ), |
|
40 | + 30 => array( |
|
41 | + 'id' => 'base_type', |
|
42 | + 'content' => $this->_base_type_stop(), |
|
43 | + 'options' => array( |
|
44 | + 'tipLocation' => 'top', |
|
45 | + 'tipAdjustmentX' => 120, |
|
46 | + 'tipAdjustmentY' => -30, |
|
47 | + ), |
|
48 | + ), |
|
49 | + 40 => array( |
|
50 | + 'id' => 'percent', |
|
51 | + 'content' => $this->_percent_column_stop(), |
|
52 | + 'options' => array( |
|
53 | + 'tipLocation' => 'top', |
|
54 | + 'tipAdjustmentX' => 120, |
|
55 | + 'tipAdjustmentY' => -30, |
|
56 | + ), |
|
57 | + ), |
|
58 | + 50 => array( |
|
59 | + 'id' => 'order', |
|
60 | + 'content' => $this->_order_column_stop(), |
|
61 | + 'options' => array( |
|
62 | + 'tipLocation' => 'left', |
|
63 | + 'tipAdjustmentY' => -30, |
|
64 | + 'tipAdjustmentX' => 100, |
|
65 | + ), |
|
66 | + ), |
|
67 | + 60 => array( |
|
68 | + 'class' => 'bulkactions', |
|
69 | + 'content' => $this->_bulk_actions_stop(), |
|
70 | + 'options' => array( |
|
71 | + 'tipLocation' => 'left', |
|
72 | + 'tipAdjustmentY' => -50, |
|
73 | + 'tipAdjustmentX' => -75, |
|
74 | + ), |
|
75 | + ), |
|
76 | + 70 => array( |
|
77 | + 'id' => 'event-espresso_page_pricing-search-input', |
|
78 | + 'content' => $this->_search_stop(), |
|
79 | + 'options' => array( |
|
80 | + 'tipLocation' => 'left', |
|
81 | + 'tipAdjustmentY' => -50, |
|
82 | + 'tipAdjustmentX' => -15, |
|
83 | + ), |
|
84 | + ), |
|
85 | + ); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - protected function _start() |
|
90 | - { |
|
91 | - $content = '<h3>' . __('Price Types', 'event_espresso') . '</h3>'; |
|
92 | - $content .= '<p>' |
|
93 | - . __( |
|
94 | - 'This tour of the Price Types page will go over different areas of the screen to help you understand what they are used for.', |
|
95 | - 'event_espresso' |
|
96 | - ) . '</p>'; |
|
97 | - return $content; |
|
98 | - } |
|
89 | + protected function _start() |
|
90 | + { |
|
91 | + $content = '<h3>' . __('Price Types', 'event_espresso') . '</h3>'; |
|
92 | + $content .= '<p>' |
|
93 | + . __( |
|
94 | + 'This tour of the Price Types page will go over different areas of the screen to help you understand what they are used for.', |
|
95 | + 'event_espresso' |
|
96 | + ) . '</p>'; |
|
97 | + return $content; |
|
98 | + } |
|
99 | 99 | |
100 | - protected function _name_column_stop() |
|
101 | - { |
|
102 | - return '<p>' |
|
103 | - . __( |
|
104 | - 'The name of the price type. Can be sorted in ascending or descending order.', |
|
105 | - 'event_espresso' |
|
106 | - ) . '</p>'; |
|
107 | - } |
|
100 | + protected function _name_column_stop() |
|
101 | + { |
|
102 | + return '<p>' |
|
103 | + . __( |
|
104 | + 'The name of the price type. Can be sorted in ascending or descending order.', |
|
105 | + 'event_espresso' |
|
106 | + ) . '</p>'; |
|
107 | + } |
|
108 | 108 | |
109 | - protected function _base_type_stop() |
|
110 | - { |
|
111 | - return '<p>' . __('View if a price type is a discount, surcharge, or tax.', 'event_espresso') . '</p>'; |
|
112 | - } |
|
109 | + protected function _base_type_stop() |
|
110 | + { |
|
111 | + return '<p>' . __('View if a price type is a discount, surcharge, or tax.', 'event_espresso') . '</p>'; |
|
112 | + } |
|
113 | 113 | |
114 | - protected function _member_column_stop() |
|
115 | - { |
|
116 | - return '<p>' |
|
117 | - . __( |
|
118 | - 'Here you can see if the discount/surcharge is percentage based or a flat monetary amount.', |
|
119 | - 'event_espresso' |
|
120 | - ) . '</p>'; |
|
121 | - } |
|
114 | + protected function _member_column_stop() |
|
115 | + { |
|
116 | + return '<p>' |
|
117 | + . __( |
|
118 | + 'Here you can see if the discount/surcharge is percentage based or a flat monetary amount.', |
|
119 | + 'event_espresso' |
|
120 | + ) . '</p>'; |
|
121 | + } |
|
122 | 122 | |
123 | - protected function _percent_column_stop() |
|
124 | - { |
|
125 | - return '<p>' |
|
126 | - . __( |
|
127 | - 'View if the discount, surcharge, or tax is percentage-based or a fixed amount.', |
|
128 | - 'event_espresso' |
|
129 | - ) . '</p>'; |
|
130 | - } |
|
123 | + protected function _percent_column_stop() |
|
124 | + { |
|
125 | + return '<p>' |
|
126 | + . __( |
|
127 | + 'View if the discount, surcharge, or tax is percentage-based or a fixed amount.', |
|
128 | + 'event_espresso' |
|
129 | + ) . '</p>'; |
|
130 | + } |
|
131 | 131 | |
132 | - protected function _order_column_stop() |
|
133 | - { |
|
134 | - return '<p>' |
|
135 | - . __( |
|
136 | - 'View the order in which each discount, surcharge, or tax will be applied to the base ticket cost. Zero (0) means it will be applied first.', |
|
137 | - 'event_espresso' |
|
138 | - ) . '</p>'; |
|
139 | - } |
|
132 | + protected function _order_column_stop() |
|
133 | + { |
|
134 | + return '<p>' |
|
135 | + . __( |
|
136 | + 'View the order in which each discount, surcharge, or tax will be applied to the base ticket cost. Zero (0) means it will be applied first.', |
|
137 | + 'event_espresso' |
|
138 | + ) . '</p>'; |
|
139 | + } |
|
140 | 140 | |
141 | - protected function _bulk_actions_stop() |
|
142 | - { |
|
143 | - return '<p>' . __('Perform bulk actions to multiple price types.', 'event_espresso') . '</p>'; |
|
144 | - } |
|
141 | + protected function _bulk_actions_stop() |
|
142 | + { |
|
143 | + return '<p>' . __('Perform bulk actions to multiple price types.', 'event_espresso') . '</p>'; |
|
144 | + } |
|
145 | 145 | |
146 | - protected function _search_stop() |
|
147 | - { |
|
148 | - return '<p>' |
|
149 | - . __( |
|
150 | - 'Search through price types. The following source will be searched: Price Type Name.', |
|
151 | - 'event_espresso' |
|
152 | - ) . '</p>'; |
|
153 | - } |
|
146 | + protected function _search_stop() |
|
147 | + { |
|
148 | + return '<p>' |
|
149 | + . __( |
|
150 | + 'Search through price types. The following source will be searched: Price Type Name.', |
|
151 | + 'event_espresso' |
|
152 | + ) . '</p>'; |
|
153 | + } |
|
154 | 154 | } |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | |
89 | 89 | protected function _start() |
90 | 90 | { |
91 | - $content = '<h3>' . __('Price Types', 'event_espresso') . '</h3>'; |
|
91 | + $content = '<h3>'.__('Price Types', 'event_espresso').'</h3>'; |
|
92 | 92 | $content .= '<p>' |
93 | 93 | . __( |
94 | 94 | 'This tour of the Price Types page will go over different areas of the screen to help you understand what they are used for.', |
95 | 95 | 'event_espresso' |
96 | - ) . '</p>'; |
|
96 | + ).'</p>'; |
|
97 | 97 | return $content; |
98 | 98 | } |
99 | 99 | |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | . __( |
104 | 104 | 'The name of the price type. Can be sorted in ascending or descending order.', |
105 | 105 | 'event_espresso' |
106 | - ) . '</p>'; |
|
106 | + ).'</p>'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | protected function _base_type_stop() |
110 | 110 | { |
111 | - return '<p>' . __('View if a price type is a discount, surcharge, or tax.', 'event_espresso') . '</p>'; |
|
111 | + return '<p>'.__('View if a price type is a discount, surcharge, or tax.', 'event_espresso').'</p>'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | protected function _member_column_stop() |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | . __( |
118 | 118 | 'Here you can see if the discount/surcharge is percentage based or a flat monetary amount.', |
119 | 119 | 'event_espresso' |
120 | - ) . '</p>'; |
|
120 | + ).'</p>'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | protected function _percent_column_stop() |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | . __( |
127 | 127 | 'View if the discount, surcharge, or tax is percentage-based or a fixed amount.', |
128 | 128 | 'event_espresso' |
129 | - ) . '</p>'; |
|
129 | + ).'</p>'; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | protected function _order_column_stop() |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | . __( |
136 | 136 | 'View the order in which each discount, surcharge, or tax will be applied to the base ticket cost. Zero (0) means it will be applied first.', |
137 | 137 | 'event_espresso' |
138 | - ) . '</p>'; |
|
138 | + ).'</p>'; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | protected function _bulk_actions_stop() |
142 | 142 | { |
143 | - return '<p>' . __('Perform bulk actions to multiple price types.', 'event_espresso') . '</p>'; |
|
143 | + return '<p>'.__('Perform bulk actions to multiple price types.', 'event_espresso').'</p>'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | protected function _search_stop() |
@@ -149,6 +149,6 @@ discard block |
||
149 | 149 | . __( |
150 | 150 | 'Search through price types. The following source will be searched: Price Type Name.', |
151 | 151 | 'event_espresso' |
152 | - ) . '</p>'; |
|
152 | + ).'</p>'; |
|
153 | 153 | } |
154 | 154 | } |
@@ -16,188 +16,188 @@ |
||
16 | 16 | class Price_Types_List_Table extends EE_Admin_List_Table |
17 | 17 | { |
18 | 18 | |
19 | - public function __construct($admin_page) |
|
20 | - { |
|
21 | - parent::__construct($admin_page); |
|
22 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
23 | - $this->_PRT = EEM_Price_Type::instance(); |
|
24 | - } |
|
25 | - |
|
26 | - |
|
27 | - protected function _setup_data() |
|
28 | - { |
|
29 | - $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
30 | - $this->_data = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed); |
|
31 | - $this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, false); |
|
32 | - $this->_trashed_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true); |
|
33 | - } |
|
34 | - |
|
35 | - |
|
36 | - protected function _set_properties() |
|
37 | - { |
|
38 | - $this->_wp_list_args = array( |
|
39 | - 'singular' => __('price type', 'event_espresso'), |
|
40 | - 'plural' => __('price types', 'event_espresso'), |
|
41 | - 'ajax' => true, |
|
42 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
43 | - ); |
|
44 | - |
|
45 | - $this->_columns = array( |
|
46 | - 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
47 | - 'name' => __('Name', 'event_espresso'), |
|
48 | - 'base_type' => '<div class="jst-cntr">' . __('Base Type', 'event_espresso') . '</div>', |
|
49 | - 'percent' => '<div class="jst-cntr">' . __('Applied', 'event_espresso') . '<br/>' |
|
50 | - . __('as ', 'event_espresso') . '<span class="big-text">' |
|
51 | - . __('%', 'event_espresso') . '</span>' |
|
52 | - . __(' or ', 'event_espresso') . '<span class="big-text">' |
|
53 | - . __('$', 'event_espresso') . '</span></div>', |
|
54 | - 'order' => '<div class="jst-cntr">' . __('Order of', 'event_espresso') . '<br/>' |
|
55 | - . __('Application', 'event_espresso') . '</div>', |
|
56 | - ); |
|
57 | - |
|
58 | - $this->_sortable_columns = array( |
|
59 | - // TRUE means its already sorted |
|
60 | - 'name' => array('name' => false), |
|
61 | - ); |
|
62 | - |
|
63 | - $this->_hidden_columns = array(); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - protected function _get_table_filters() |
|
68 | - { |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - protected function _add_view_counts() |
|
73 | - { |
|
74 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
75 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
76 | - 'ee_delete_default_price_types', |
|
77 | - 'pricing_trash_price_type' |
|
78 | - )) { |
|
79 | - $this->_views['trashed']['count'] = $this->_trashed_count; |
|
80 | - } |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - public function column_cb($item) |
|
85 | - { |
|
86 | - if ($item->base_type() !== 1) { |
|
87 | - return sprintf( |
|
88 | - '<input type="checkbox" name="checkbox[%1$s]" />', |
|
89 | - $item->ID() |
|
90 | - ); |
|
91 | - } |
|
92 | - return ''; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - public function column_name($item) |
|
97 | - { |
|
98 | - |
|
99 | - // Build row actions |
|
100 | - $actions = array(); |
|
101 | - // edit price link |
|
102 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
103 | - 'ee_edit_default_price_type', |
|
104 | - 'pricing_edit_price_type', |
|
105 | - $item->ID() |
|
106 | - )) { |
|
107 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
108 | - 'action' => 'edit_price_type', |
|
109 | - 'id' => $item->ID(), |
|
110 | - ), PRICING_ADMIN_URL); |
|
111 | - $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="' |
|
112 | - . esc_attr__('Edit Price Type', 'event_espresso') . '">' |
|
113 | - . __('Edit', 'event_espresso') . '</a>'; |
|
114 | - } |
|
115 | - |
|
116 | - $name_link = EE_Registry::instance()->CAP->current_user_can( |
|
117 | - 'ee_edit_default_price_type', |
|
118 | - 'pricing_edit_price_type', |
|
119 | - $item->ID() |
|
120 | - ) |
|
121 | - ? '<a href="' . $edit_lnk_url . '" title="' |
|
122 | - . esc_attr__('Edit Price Type', 'event_espresso') . '">' |
|
123 | - . stripslashes($item->name()) . '</a>' |
|
124 | - : $item->name(); |
|
125 | - |
|
126 | - if ($item->base_type() !== 1) { |
|
127 | - if ($this->_view == 'all') { |
|
128 | - // trash price link |
|
129 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
130 | - 'ee_delete_default_price_type', |
|
131 | - 'pricing_trash_price_type', |
|
132 | - $item->ID() |
|
133 | - )) { |
|
134 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
135 | - 'action' => 'trash_price_type', |
|
136 | - 'id' => $item->ID(), |
|
137 | - 'noheader' => true, |
|
138 | - ), PRICING_ADMIN_URL); |
|
139 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
140 | - . esc_attr__('Move Price Type to Trash', 'event_espresso') . '">' |
|
141 | - . __('Move to Trash', 'event_espresso') . '</a>'; |
|
142 | - } |
|
143 | - } else { |
|
144 | - // restore price link |
|
145 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
146 | - 'ee_delete_default_price_type', |
|
147 | - 'pricing_restore_price_type', |
|
148 | - $item->ID() |
|
149 | - )) { |
|
150 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
151 | - 'action' => 'restore_price_type', |
|
152 | - 'id' => $item->ID(), |
|
153 | - 'noheader' => true, |
|
154 | - ), PRICING_ADMIN_URL); |
|
155 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
156 | - . esc_attr__('Restore Price Type', 'event_espresso') . '">' |
|
157 | - . __('Restore', 'event_espresso') . '</a>'; |
|
158 | - } |
|
159 | - // delete price link |
|
160 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
161 | - 'ee_delete_default_price_type', |
|
162 | - 'pricing_delete_price_type', |
|
163 | - $item->ID() |
|
164 | - )) { |
|
165 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
166 | - 'action' => 'delete_price_type', |
|
167 | - 'id' => $item->ID(), |
|
168 | - 'noheader' => true, |
|
169 | - ), PRICING_ADMIN_URL); |
|
170 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
171 | - . esc_attr__('Delete Price Type Permanently', 'event_espresso') . '">' |
|
172 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
173 | - } |
|
174 | - } |
|
175 | - } |
|
176 | - |
|
177 | - // Return the name contents |
|
178 | - return sprintf( |
|
179 | - '%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
|
180 | - $name_link, |
|
181 | - $item->ID(), |
|
182 | - $this->row_actions($actions) |
|
183 | - ); |
|
184 | - } |
|
185 | - |
|
186 | - |
|
187 | - public function column_base_type($item) |
|
188 | - { |
|
189 | - return '<div class="jst-cntr">' . $item->base_type_name() . '</div>'; |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - public function column_percent($item) |
|
194 | - { |
|
195 | - return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>'; |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - public function column_order($item) |
|
200 | - { |
|
201 | - return '<div class="jst-cntr">' . $item->order() . '</div>'; |
|
202 | - } |
|
19 | + public function __construct($admin_page) |
|
20 | + { |
|
21 | + parent::__construct($admin_page); |
|
22 | + require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
23 | + $this->_PRT = EEM_Price_Type::instance(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _setup_data() |
|
28 | + { |
|
29 | + $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false; |
|
30 | + $this->_data = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed); |
|
31 | + $this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, false); |
|
32 | + $this->_trashed_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true); |
|
33 | + } |
|
34 | + |
|
35 | + |
|
36 | + protected function _set_properties() |
|
37 | + { |
|
38 | + $this->_wp_list_args = array( |
|
39 | + 'singular' => __('price type', 'event_espresso'), |
|
40 | + 'plural' => __('price types', 'event_espresso'), |
|
41 | + 'ajax' => true, |
|
42 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
43 | + ); |
|
44 | + |
|
45 | + $this->_columns = array( |
|
46 | + 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
|
47 | + 'name' => __('Name', 'event_espresso'), |
|
48 | + 'base_type' => '<div class="jst-cntr">' . __('Base Type', 'event_espresso') . '</div>', |
|
49 | + 'percent' => '<div class="jst-cntr">' . __('Applied', 'event_espresso') . '<br/>' |
|
50 | + . __('as ', 'event_espresso') . '<span class="big-text">' |
|
51 | + . __('%', 'event_espresso') . '</span>' |
|
52 | + . __(' or ', 'event_espresso') . '<span class="big-text">' |
|
53 | + . __('$', 'event_espresso') . '</span></div>', |
|
54 | + 'order' => '<div class="jst-cntr">' . __('Order of', 'event_espresso') . '<br/>' |
|
55 | + . __('Application', 'event_espresso') . '</div>', |
|
56 | + ); |
|
57 | + |
|
58 | + $this->_sortable_columns = array( |
|
59 | + // TRUE means its already sorted |
|
60 | + 'name' => array('name' => false), |
|
61 | + ); |
|
62 | + |
|
63 | + $this->_hidden_columns = array(); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + protected function _get_table_filters() |
|
68 | + { |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + protected function _add_view_counts() |
|
73 | + { |
|
74 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
75 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
76 | + 'ee_delete_default_price_types', |
|
77 | + 'pricing_trash_price_type' |
|
78 | + )) { |
|
79 | + $this->_views['trashed']['count'] = $this->_trashed_count; |
|
80 | + } |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + public function column_cb($item) |
|
85 | + { |
|
86 | + if ($item->base_type() !== 1) { |
|
87 | + return sprintf( |
|
88 | + '<input type="checkbox" name="checkbox[%1$s]" />', |
|
89 | + $item->ID() |
|
90 | + ); |
|
91 | + } |
|
92 | + return ''; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + public function column_name($item) |
|
97 | + { |
|
98 | + |
|
99 | + // Build row actions |
|
100 | + $actions = array(); |
|
101 | + // edit price link |
|
102 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
103 | + 'ee_edit_default_price_type', |
|
104 | + 'pricing_edit_price_type', |
|
105 | + $item->ID() |
|
106 | + )) { |
|
107 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
108 | + 'action' => 'edit_price_type', |
|
109 | + 'id' => $item->ID(), |
|
110 | + ), PRICING_ADMIN_URL); |
|
111 | + $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="' |
|
112 | + . esc_attr__('Edit Price Type', 'event_espresso') . '">' |
|
113 | + . __('Edit', 'event_espresso') . '</a>'; |
|
114 | + } |
|
115 | + |
|
116 | + $name_link = EE_Registry::instance()->CAP->current_user_can( |
|
117 | + 'ee_edit_default_price_type', |
|
118 | + 'pricing_edit_price_type', |
|
119 | + $item->ID() |
|
120 | + ) |
|
121 | + ? '<a href="' . $edit_lnk_url . '" title="' |
|
122 | + . esc_attr__('Edit Price Type', 'event_espresso') . '">' |
|
123 | + . stripslashes($item->name()) . '</a>' |
|
124 | + : $item->name(); |
|
125 | + |
|
126 | + if ($item->base_type() !== 1) { |
|
127 | + if ($this->_view == 'all') { |
|
128 | + // trash price link |
|
129 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
130 | + 'ee_delete_default_price_type', |
|
131 | + 'pricing_trash_price_type', |
|
132 | + $item->ID() |
|
133 | + )) { |
|
134 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
135 | + 'action' => 'trash_price_type', |
|
136 | + 'id' => $item->ID(), |
|
137 | + 'noheader' => true, |
|
138 | + ), PRICING_ADMIN_URL); |
|
139 | + $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
140 | + . esc_attr__('Move Price Type to Trash', 'event_espresso') . '">' |
|
141 | + . __('Move to Trash', 'event_espresso') . '</a>'; |
|
142 | + } |
|
143 | + } else { |
|
144 | + // restore price link |
|
145 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
146 | + 'ee_delete_default_price_type', |
|
147 | + 'pricing_restore_price_type', |
|
148 | + $item->ID() |
|
149 | + )) { |
|
150 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
151 | + 'action' => 'restore_price_type', |
|
152 | + 'id' => $item->ID(), |
|
153 | + 'noheader' => true, |
|
154 | + ), PRICING_ADMIN_URL); |
|
155 | + $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
156 | + . esc_attr__('Restore Price Type', 'event_espresso') . '">' |
|
157 | + . __('Restore', 'event_espresso') . '</a>'; |
|
158 | + } |
|
159 | + // delete price link |
|
160 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
161 | + 'ee_delete_default_price_type', |
|
162 | + 'pricing_delete_price_type', |
|
163 | + $item->ID() |
|
164 | + )) { |
|
165 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array( |
|
166 | + 'action' => 'delete_price_type', |
|
167 | + 'id' => $item->ID(), |
|
168 | + 'noheader' => true, |
|
169 | + ), PRICING_ADMIN_URL); |
|
170 | + $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
171 | + . esc_attr__('Delete Price Type Permanently', 'event_espresso') . '">' |
|
172 | + . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
173 | + } |
|
174 | + } |
|
175 | + } |
|
176 | + |
|
177 | + // Return the name contents |
|
178 | + return sprintf( |
|
179 | + '%1$s <span style="color:silver">(id:%2$s)</span>%3$s', |
|
180 | + $name_link, |
|
181 | + $item->ID(), |
|
182 | + $this->row_actions($actions) |
|
183 | + ); |
|
184 | + } |
|
185 | + |
|
186 | + |
|
187 | + public function column_base_type($item) |
|
188 | + { |
|
189 | + return '<div class="jst-cntr">' . $item->base_type_name() . '</div>'; |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + public function column_percent($item) |
|
194 | + { |
|
195 | + return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>'; |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + public function column_order($item) |
|
200 | + { |
|
201 | + return '<div class="jst-cntr">' . $item->order() . '</div>'; |
|
202 | + } |
|
203 | 203 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function __construct($admin_page) |
20 | 20 | { |
21 | 21 | parent::__construct($admin_page); |
22 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
22 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
23 | 23 | $this->_PRT = EEM_Price_Type::instance(); |
24 | 24 | } |
25 | 25 | |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | $this->_columns = array( |
46 | 46 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text |
47 | 47 | 'name' => __('Name', 'event_espresso'), |
48 | - 'base_type' => '<div class="jst-cntr">' . __('Base Type', 'event_espresso') . '</div>', |
|
49 | - 'percent' => '<div class="jst-cntr">' . __('Applied', 'event_espresso') . '<br/>' |
|
50 | - . __('as ', 'event_espresso') . '<span class="big-text">' |
|
51 | - . __('%', 'event_espresso') . '</span>' |
|
52 | - . __(' or ', 'event_espresso') . '<span class="big-text">' |
|
53 | - . __('$', 'event_espresso') . '</span></div>', |
|
54 | - 'order' => '<div class="jst-cntr">' . __('Order of', 'event_espresso') . '<br/>' |
|
55 | - . __('Application', 'event_espresso') . '</div>', |
|
48 | + 'base_type' => '<div class="jst-cntr">'.__('Base Type', 'event_espresso').'</div>', |
|
49 | + 'percent' => '<div class="jst-cntr">'.__('Applied', 'event_espresso').'<br/>' |
|
50 | + . __('as ', 'event_espresso').'<span class="big-text">' |
|
51 | + . __('%', 'event_espresso').'</span>' |
|
52 | + . __(' or ', 'event_espresso').'<span class="big-text">' |
|
53 | + . __('$', 'event_espresso').'</span></div>', |
|
54 | + 'order' => '<div class="jst-cntr">'.__('Order of', 'event_espresso').'<br/>' |
|
55 | + . __('Application', 'event_espresso').'</div>', |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | $this->_sortable_columns = array( |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | 'action' => 'edit_price_type', |
109 | 109 | 'id' => $item->ID(), |
110 | 110 | ), PRICING_ADMIN_URL); |
111 | - $actions['edit'] = '<a href="' . $edit_lnk_url . '" title="' |
|
112 | - . esc_attr__('Edit Price Type', 'event_espresso') . '">' |
|
113 | - . __('Edit', 'event_espresso') . '</a>'; |
|
111 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' |
|
112 | + . esc_attr__('Edit Price Type', 'event_espresso').'">' |
|
113 | + . __('Edit', 'event_espresso').'</a>'; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $name_link = EE_Registry::instance()->CAP->current_user_can( |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | 'pricing_edit_price_type', |
119 | 119 | $item->ID() |
120 | 120 | ) |
121 | - ? '<a href="' . $edit_lnk_url . '" title="' |
|
122 | - . esc_attr__('Edit Price Type', 'event_espresso') . '">' |
|
123 | - . stripslashes($item->name()) . '</a>' |
|
121 | + ? '<a href="'.$edit_lnk_url.'" title="' |
|
122 | + . esc_attr__('Edit Price Type', 'event_espresso').'">' |
|
123 | + . stripslashes($item->name()).'</a>' |
|
124 | 124 | : $item->name(); |
125 | 125 | |
126 | 126 | if ($item->base_type() !== 1) { |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | 'id' => $item->ID(), |
137 | 137 | 'noheader' => true, |
138 | 138 | ), PRICING_ADMIN_URL); |
139 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' |
|
140 | - . esc_attr__('Move Price Type to Trash', 'event_espresso') . '">' |
|
141 | - . __('Move to Trash', 'event_espresso') . '</a>'; |
|
139 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' |
|
140 | + . esc_attr__('Move Price Type to Trash', 'event_espresso').'">' |
|
141 | + . __('Move to Trash', 'event_espresso').'</a>'; |
|
142 | 142 | } |
143 | 143 | } else { |
144 | 144 | // restore price link |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | 'id' => $item->ID(), |
153 | 153 | 'noheader' => true, |
154 | 154 | ), PRICING_ADMIN_URL); |
155 | - $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' |
|
156 | - . esc_attr__('Restore Price Type', 'event_espresso') . '">' |
|
157 | - . __('Restore', 'event_espresso') . '</a>'; |
|
155 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' |
|
156 | + . esc_attr__('Restore Price Type', 'event_espresso').'">' |
|
157 | + . __('Restore', 'event_espresso').'</a>'; |
|
158 | 158 | } |
159 | 159 | // delete price link |
160 | 160 | if (EE_Registry::instance()->CAP->current_user_can( |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | 'id' => $item->ID(), |
168 | 168 | 'noheader' => true, |
169 | 169 | ), PRICING_ADMIN_URL); |
170 | - $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' |
|
171 | - . esc_attr__('Delete Price Type Permanently', 'event_espresso') . '">' |
|
172 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
170 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' |
|
171 | + . esc_attr__('Delete Price Type Permanently', 'event_espresso').'">' |
|
172 | + . __('Delete Permanently', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | } |
@@ -186,18 +186,18 @@ discard block |
||
186 | 186 | |
187 | 187 | public function column_base_type($item) |
188 | 188 | { |
189 | - return '<div class="jst-cntr">' . $item->base_type_name() . '</div>'; |
|
189 | + return '<div class="jst-cntr">'.$item->base_type_name().'</div>'; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
193 | 193 | public function column_percent($item) |
194 | 194 | { |
195 | - return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>'; |
|
195 | + return '<div class="jst-cntr">'.($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign).'</div>'; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
199 | 199 | public function column_order($item) |
200 | 200 | { |
201 | - return '<div class="jst-cntr">' . $item->order() . '</div>'; |
|
201 | + return '<div class="jst-cntr">'.$item->order().'</div>'; |
|
202 | 202 | } |
203 | 203 | } |
@@ -15,42 +15,42 @@ |
||
15 | 15 | class Global_EE_Caf_Hooks |
16 | 16 | { |
17 | 17 | |
18 | - public function __construct() |
|
19 | - { |
|
20 | - $this->_do_hooks(); |
|
21 | - } |
|
22 | - |
|
23 | - |
|
24 | - private function _do_hooks() |
|
25 | - { |
|
26 | - add_filter('FHEE_show_sponsors_meta_box', '__return_false', 10); |
|
27 | - add_filter('FHEE_show_ratings_request_meta_box', '__return_false', 10); |
|
28 | - add_filter( |
|
29 | - 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', |
|
30 | - array($this, 'forums_lazy_loading'), |
|
31 | - 10 |
|
32 | - ); |
|
33 | - add_action( |
|
34 | - 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content', |
|
35 | - array($this, 'extra_news_box_content'), |
|
36 | - 10 |
|
37 | - ); |
|
38 | - } |
|
39 | - |
|
40 | - |
|
41 | - public function extra_news_box_content($content) |
|
42 | - { |
|
43 | - echo '<h3 style="margin:0">' . __('From the Forums', 'event_espresso') . '</h3>'; |
|
44 | - echo '<div id="ee_forum_posts_content">'; |
|
45 | - $url = 'http://eventespresso.com/forum/event-espresso-support/feed/'; |
|
46 | - EE_Admin_Page::cached_rss_display('ee_forum_posts_content', $url); |
|
47 | - echo '</div>'; |
|
48 | - } |
|
49 | - |
|
50 | - |
|
51 | - public function forums_lazy_loading($ids) |
|
52 | - { |
|
53 | - $ids[] = 'ee_forum_posts_content'; |
|
54 | - return $ids; |
|
55 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + $this->_do_hooks(); |
|
21 | + } |
|
22 | + |
|
23 | + |
|
24 | + private function _do_hooks() |
|
25 | + { |
|
26 | + add_filter('FHEE_show_sponsors_meta_box', '__return_false', 10); |
|
27 | + add_filter('FHEE_show_ratings_request_meta_box', '__return_false', 10); |
|
28 | + add_filter( |
|
29 | + 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', |
|
30 | + array($this, 'forums_lazy_loading'), |
|
31 | + 10 |
|
32 | + ); |
|
33 | + add_action( |
|
34 | + 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content', |
|
35 | + array($this, 'extra_news_box_content'), |
|
36 | + 10 |
|
37 | + ); |
|
38 | + } |
|
39 | + |
|
40 | + |
|
41 | + public function extra_news_box_content($content) |
|
42 | + { |
|
43 | + echo '<h3 style="margin:0">' . __('From the Forums', 'event_espresso') . '</h3>'; |
|
44 | + echo '<div id="ee_forum_posts_content">'; |
|
45 | + $url = 'http://eventespresso.com/forum/event-espresso-support/feed/'; |
|
46 | + EE_Admin_Page::cached_rss_display('ee_forum_posts_content', $url); |
|
47 | + echo '</div>'; |
|
48 | + } |
|
49 | + |
|
50 | + |
|
51 | + public function forums_lazy_loading($ids) |
|
52 | + { |
|
53 | + $ids[] = 'ee_forum_posts_content'; |
|
54 | + return $ids; |
|
55 | + } |
|
56 | 56 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | |
41 | 41 | public function extra_news_box_content($content) |
42 | 42 | { |
43 | - echo '<h3 style="margin:0">' . __('From the Forums', 'event_espresso') . '</h3>'; |
|
43 | + echo '<h3 style="margin:0">'.__('From the Forums', 'event_espresso').'</h3>'; |
|
44 | 44 | echo '<div id="ee_forum_posts_content">'; |
45 | 45 | $url = 'http://eventespresso.com/forum/event-espresso-support/feed/'; |
46 | 46 | EE_Admin_Page::cached_rss_display('ee_forum_posts_content', $url); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | + if ( ! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | 42 | /** |
43 | 43 | * espresso_duplicate_plugin_error |
44 | 44 | * displays if more than one version of EE is activated at the same time |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
63 | 63 | } else { |
64 | 64 | define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | 66 | /** |
67 | 67 | * espresso_minimum_php_version_error |
68 | 68 | * |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | |
117 | 117 | register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
119 | + require_once __DIR__.'/core/bootstrap_espresso.php'; |
|
120 | 120 | bootstrap_espresso(); |
121 | 121 | } |
122 | 122 | } |
123 | -if (! function_exists('espresso_deactivate_plugin')) { |
|
123 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
124 | 124 | /** |
125 | 125 | * deactivate_plugin |
126 | 126 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function espresso_deactivate_plugin($plugin_basename = '') |
133 | 133 | { |
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
134 | + if ( ! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
136 | 136 | } |
137 | 137 | unset($_GET['activate'], $_REQUEST['activate']); |
138 | 138 | deactivate_plugins($plugin_basename); |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.79.rc.005'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.79.rc.005'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | /** |
53 | 53 | * Callback for FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks hook |
54 | 54 | * |
55 | - * @param $callbacks |
|
55 | + * @param callable[] $callbacks |
|
56 | 56 | * @return array |
57 | 57 | */ |
58 | 58 | public function modify_callbacks($callbacks) |
@@ -16,210 +16,210 @@ |
||
16 | 16 | class espresso_events_Registration_Form_Hooks extends EE_Admin_Hooks |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var EE_Event|null |
|
21 | - */ |
|
22 | - protected $_event; |
|
23 | - |
|
24 | - |
|
25 | - protected function _set_hooks_properties() |
|
26 | - { |
|
27 | - |
|
28 | - $this->_name = 'registration_form'; |
|
29 | - $this->_metaboxes = array( |
|
30 | - 0 => array( |
|
31 | - 'page_route' => array('edit', 'create_new'), |
|
32 | - 'func' => 'primary_questions', |
|
33 | - 'label' => esc_html__('Questions for Primary Registrant', 'event_espresso'), |
|
34 | - 'priority' => 'default', |
|
35 | - 'context' => 'side', |
|
36 | - ), |
|
37 | - ); |
|
38 | - |
|
39 | - // hook into the handler for saving question groups |
|
40 | - add_filter( |
|
41 | - 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
42 | - array($this, 'modify_callbacks'), |
|
43 | - 10 |
|
44 | - ); |
|
45 | - |
|
46 | - // hook into revision restores (we're hooking into the global action because EE_Admin_Hooks classes are already |
|
47 | - // restricted by page) |
|
48 | - add_action('AHEE_EE_Admin_Page_CPT__restore_revision', array($this, 'restore_revision'), 10, 2); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * Callback for FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks hook |
|
54 | - * |
|
55 | - * @param $callbacks |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function modify_callbacks($callbacks) |
|
59 | - { |
|
60 | - // now let's add the question group callback |
|
61 | - $callbacks[] = array($this, 'primary_question_group_update'); |
|
62 | - return $callbacks; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Hooked into revision restores. |
|
68 | - * |
|
69 | - * @param $post_id |
|
70 | - * @param $revision_id |
|
71 | - * @return EE_Base_Class |
|
72 | - * @throws EE_Error |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws ReflectionException |
|
75 | - * @throws InvalidDataTypeException |
|
76 | - * @throws InvalidInterfaceException |
|
77 | - */ |
|
78 | - public function restore_revision($post_id, $revision_id) |
|
79 | - { |
|
80 | - $EVT_MDL = EE_Registry::instance()->load_model('Event'); |
|
81 | - $post_evt = $EVT_MDL->get_one_by_ID($post_id); |
|
82 | - // restore revision for primary questions |
|
83 | - $post_evt->restore_revision( |
|
84 | - $revision_id, |
|
85 | - array('Question_Group'), |
|
86 | - array('Question_Group' => array('Event_Question_Group.EQG_primary' => 1)) |
|
87 | - ); |
|
88 | - return $post_evt; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * Content of metabox. |
|
94 | - * |
|
95 | - * @param $post_id |
|
96 | - * @param $post |
|
97 | - * @throws EE_Error |
|
98 | - * @throws InvalidArgumentException |
|
99 | - * @throws InvalidDataTypeException |
|
100 | - * @throws InvalidInterfaceException |
|
101 | - */ |
|
102 | - public function primary_questions($post_id, $post) |
|
103 | - { |
|
104 | - $this->_event = $this->_adminpage_obj->get_event_object(); |
|
105 | - $event_id = $this->_event->ID(); |
|
106 | - ?> |
|
19 | + /** |
|
20 | + * @var EE_Event|null |
|
21 | + */ |
|
22 | + protected $_event; |
|
23 | + |
|
24 | + |
|
25 | + protected function _set_hooks_properties() |
|
26 | + { |
|
27 | + |
|
28 | + $this->_name = 'registration_form'; |
|
29 | + $this->_metaboxes = array( |
|
30 | + 0 => array( |
|
31 | + 'page_route' => array('edit', 'create_new'), |
|
32 | + 'func' => 'primary_questions', |
|
33 | + 'label' => esc_html__('Questions for Primary Registrant', 'event_espresso'), |
|
34 | + 'priority' => 'default', |
|
35 | + 'context' => 'side', |
|
36 | + ), |
|
37 | + ); |
|
38 | + |
|
39 | + // hook into the handler for saving question groups |
|
40 | + add_filter( |
|
41 | + 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
42 | + array($this, 'modify_callbacks'), |
|
43 | + 10 |
|
44 | + ); |
|
45 | + |
|
46 | + // hook into revision restores (we're hooking into the global action because EE_Admin_Hooks classes are already |
|
47 | + // restricted by page) |
|
48 | + add_action('AHEE_EE_Admin_Page_CPT__restore_revision', array($this, 'restore_revision'), 10, 2); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * Callback for FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks hook |
|
54 | + * |
|
55 | + * @param $callbacks |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function modify_callbacks($callbacks) |
|
59 | + { |
|
60 | + // now let's add the question group callback |
|
61 | + $callbacks[] = array($this, 'primary_question_group_update'); |
|
62 | + return $callbacks; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Hooked into revision restores. |
|
68 | + * |
|
69 | + * @param $post_id |
|
70 | + * @param $revision_id |
|
71 | + * @return EE_Base_Class |
|
72 | + * @throws EE_Error |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws ReflectionException |
|
75 | + * @throws InvalidDataTypeException |
|
76 | + * @throws InvalidInterfaceException |
|
77 | + */ |
|
78 | + public function restore_revision($post_id, $revision_id) |
|
79 | + { |
|
80 | + $EVT_MDL = EE_Registry::instance()->load_model('Event'); |
|
81 | + $post_evt = $EVT_MDL->get_one_by_ID($post_id); |
|
82 | + // restore revision for primary questions |
|
83 | + $post_evt->restore_revision( |
|
84 | + $revision_id, |
|
85 | + array('Question_Group'), |
|
86 | + array('Question_Group' => array('Event_Question_Group.EQG_primary' => 1)) |
|
87 | + ); |
|
88 | + return $post_evt; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * Content of metabox. |
|
94 | + * |
|
95 | + * @param $post_id |
|
96 | + * @param $post |
|
97 | + * @throws EE_Error |
|
98 | + * @throws InvalidArgumentException |
|
99 | + * @throws InvalidDataTypeException |
|
100 | + * @throws InvalidInterfaceException |
|
101 | + */ |
|
102 | + public function primary_questions($post_id, $post) |
|
103 | + { |
|
104 | + $this->_event = $this->_adminpage_obj->get_event_object(); |
|
105 | + $event_id = $this->_event->ID(); |
|
106 | + ?> |
|
107 | 107 | <div class="inside"> |
108 | 108 | <p><strong> |
109 | 109 | <?php _e('Question Groups', 'event_espresso'); ?> |
110 | 110 | </strong><br/> |
111 | 111 | <?php |
112 | - printf( |
|
113 | - esc_html__( |
|
114 | - 'Add a pre-populated %1$sgroup of questions%2$s to your event. The personal information group is required for all events', |
|
115 | - 'event_espresso' |
|
116 | - ), |
|
117 | - '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
118 | - '</a>' |
|
119 | - ) |
|
120 | - ?> |
|
112 | + printf( |
|
113 | + esc_html__( |
|
114 | + 'Add a pre-populated %1$sgroup of questions%2$s to your event. The personal information group is required for all events', |
|
115 | + 'event_espresso' |
|
116 | + ), |
|
117 | + '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
118 | + '</a>' |
|
119 | + ) |
|
120 | + ?> |
|
121 | 121 | </p> |
122 | 122 | <?php |
123 | 123 | |
124 | - $qsg_where['QSG_deleted'] = false; |
|
125 | - $query_params = apply_filters( |
|
126 | - 'FHEE__espresso_events_Registration_Form_Hooks__primary_questions__question_group_query_parameters', |
|
127 | - array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
128 | - ); |
|
129 | - $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
130 | - $EQGs = ! empty($event_id) |
|
131 | - ? $this->_event->get_many_related( |
|
132 | - 'Question_Group', |
|
133 | - array(array('Event_Question_Group.EQG_primary' => 1)) |
|
134 | - ) |
|
135 | - : array(); |
|
136 | - $EQGids = array_keys($EQGs); |
|
137 | - |
|
138 | - if (! empty($QSGs)) { |
|
139 | - $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
140 | - foreach ($QSGs as $QSG) { |
|
141 | - $checked = in_array($QSG->ID(), $EQGids, true) |
|
142 | - || $QSG->get('QSG_system') === 1 |
|
143 | - ? ' checked="checked"' |
|
144 | - : ''; |
|
145 | - $visibility = $QSG->get('QSG_system') === 1 |
|
146 | - ? ' style="visibility:hidden"' |
|
147 | - : ''; |
|
148 | - $edit_query_args = $this->_adminpage_obj->is_caf() ? array( |
|
149 | - 'action' => 'edit_question_group', |
|
150 | - 'QSG_ID' => $QSG->ID(), |
|
151 | - ) : array('action' => 'question_groups'); |
|
152 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
153 | - $edit_query_args, |
|
154 | - EE_FORMS_ADMIN_URL |
|
155 | - ); |
|
156 | - |
|
157 | - $html .= ' |
|
124 | + $qsg_where['QSG_deleted'] = false; |
|
125 | + $query_params = apply_filters( |
|
126 | + 'FHEE__espresso_events_Registration_Form_Hooks__primary_questions__question_group_query_parameters', |
|
127 | + array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
128 | + ); |
|
129 | + $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
130 | + $EQGs = ! empty($event_id) |
|
131 | + ? $this->_event->get_many_related( |
|
132 | + 'Question_Group', |
|
133 | + array(array('Event_Question_Group.EQG_primary' => 1)) |
|
134 | + ) |
|
135 | + : array(); |
|
136 | + $EQGids = array_keys($EQGs); |
|
137 | + |
|
138 | + if (! empty($QSGs)) { |
|
139 | + $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
140 | + foreach ($QSGs as $QSG) { |
|
141 | + $checked = in_array($QSG->ID(), $EQGids, true) |
|
142 | + || $QSG->get('QSG_system') === 1 |
|
143 | + ? ' checked="checked"' |
|
144 | + : ''; |
|
145 | + $visibility = $QSG->get('QSG_system') === 1 |
|
146 | + ? ' style="visibility:hidden"' |
|
147 | + : ''; |
|
148 | + $edit_query_args = $this->_adminpage_obj->is_caf() ? array( |
|
149 | + 'action' => 'edit_question_group', |
|
150 | + 'QSG_ID' => $QSG->ID(), |
|
151 | + ) : array('action' => 'question_groups'); |
|
152 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
153 | + $edit_query_args, |
|
154 | + EE_FORMS_ADMIN_URL |
|
155 | + ); |
|
156 | + |
|
157 | + $html .= ' |
|
158 | 158 | <p id="event-question-group-' . $QSG->ID() . '"> |
159 | 159 | <input value="' . $QSG->ID() . '" type="checkbox"' |
160 | - . $visibility |
|
161 | - . ' name="question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
160 | + . $visibility |
|
161 | + . ' name="question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
162 | 162 | <a href="' . $edit_link . '" title="' |
163 | - . sprintf( |
|
164 | - esc_attr__('Edit %s Group', 'event_espresso'), |
|
165 | - $QSG->get('QSG_name') |
|
166 | - ) |
|
167 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
163 | + . sprintf( |
|
164 | + esc_attr__('Edit %s Group', 'event_espresso'), |
|
165 | + $QSG->get('QSG_name') |
|
166 | + ) |
|
167 | + . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
168 | 168 | </p>'; |
169 | - } |
|
170 | - $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | - |
|
172 | - echo $html; |
|
173 | - } else { |
|
174 | - esc_html_e( |
|
175 | - 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | - 'event_espresso' |
|
177 | - ); |
|
178 | - } |
|
179 | - do_action('AHEE_event_editor_questions_notice'); |
|
180 | - ?> |
|
169 | + } |
|
170 | + $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | + |
|
172 | + echo $html; |
|
173 | + } else { |
|
174 | + esc_html_e( |
|
175 | + 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | + 'event_espresso' |
|
177 | + ); |
|
178 | + } |
|
179 | + do_action('AHEE_event_editor_questions_notice'); |
|
180 | + ?> |
|
181 | 181 | </div> |
182 | 182 | <?php |
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * @param EE_Event $evtobj |
|
188 | - * @param array $data |
|
189 | - * @return bool |
|
190 | - * @throws EE_Error |
|
191 | - */ |
|
192 | - public function primary_question_group_update($evtobj, $data) |
|
193 | - { |
|
194 | - $question_groups = ! empty($data['question_groups']) ? (array) $data['question_groups'] : array(); |
|
195 | - $added_qgs = array_keys($question_groups); |
|
196 | - $success = array(); |
|
197 | - |
|
198 | - // let's get all current question groups associated with this event. |
|
199 | - $current_qgs = $evtobj->get_many_related( |
|
200 | - 'Question_Group', |
|
201 | - array(array('Event_Question_Group.EQG_primary' => 1)) |
|
202 | - ); |
|
203 | - $current_qgs = array_keys($current_qgs); // we just want the ids |
|
204 | - |
|
205 | - // now let's get the groups selected in the editor and update (IF we have data) |
|
206 | - if (! empty($question_groups)) { |
|
207 | - foreach ($question_groups as $id => $val) { |
|
208 | - // add to event |
|
209 | - if ($val) { |
|
210 | - $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 1)); |
|
211 | - } |
|
212 | - $success[] = ! empty($qg) ? 1 : 0; |
|
213 | - } |
|
214 | - } |
|
215 | - |
|
216 | - // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
217 | - $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
218 | - |
|
219 | - foreach ($removed_qgs as $qgid) { |
|
220 | - $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 1)); |
|
221 | - $success[] = ! empty($qg) ? 1 : 0; |
|
222 | - } |
|
223 | - return in_array(0, $success, true) ? false : true; |
|
224 | - } |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * @param EE_Event $evtobj |
|
188 | + * @param array $data |
|
189 | + * @return bool |
|
190 | + * @throws EE_Error |
|
191 | + */ |
|
192 | + public function primary_question_group_update($evtobj, $data) |
|
193 | + { |
|
194 | + $question_groups = ! empty($data['question_groups']) ? (array) $data['question_groups'] : array(); |
|
195 | + $added_qgs = array_keys($question_groups); |
|
196 | + $success = array(); |
|
197 | + |
|
198 | + // let's get all current question groups associated with this event. |
|
199 | + $current_qgs = $evtobj->get_many_related( |
|
200 | + 'Question_Group', |
|
201 | + array(array('Event_Question_Group.EQG_primary' => 1)) |
|
202 | + ); |
|
203 | + $current_qgs = array_keys($current_qgs); // we just want the ids |
|
204 | + |
|
205 | + // now let's get the groups selected in the editor and update (IF we have data) |
|
206 | + if (! empty($question_groups)) { |
|
207 | + foreach ($question_groups as $id => $val) { |
|
208 | + // add to event |
|
209 | + if ($val) { |
|
210 | + $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 1)); |
|
211 | + } |
|
212 | + $success[] = ! empty($qg) ? 1 : 0; |
|
213 | + } |
|
214 | + } |
|
215 | + |
|
216 | + // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
217 | + $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
218 | + |
|
219 | + foreach ($removed_qgs as $qgid) { |
|
220 | + $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 1)); |
|
221 | + $success[] = ! empty($qg) ? 1 : 0; |
|
222 | + } |
|
223 | + return in_array(0, $success, true) ? false : true; |
|
224 | + } |
|
225 | 225 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | : array(); |
136 | 136 | $EQGids = array_keys($EQGs); |
137 | 137 | |
138 | - if (! empty($QSGs)) { |
|
138 | + if ( ! empty($QSGs)) { |
|
139 | 139 | $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
140 | 140 | foreach ($QSGs as $QSG) { |
141 | 141 | $checked = in_array($QSG->ID(), $EQGids, true) |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | ); |
156 | 156 | |
157 | 157 | $html .= ' |
158 | - <p id="event-question-group-' . $QSG->ID() . '"> |
|
159 | - <input value="' . $QSG->ID() . '" type="checkbox"' |
|
158 | + <p id="event-question-group-' . $QSG->ID().'"> |
|
159 | + <input value="' . $QSG->ID().'" type="checkbox"' |
|
160 | 160 | . $visibility |
161 | - . ' name="question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
162 | - <a href="' . $edit_link . '" title="' |
|
161 | + . ' name="question_groups['.$QSG->ID().']"'.$checked.' /> |
|
162 | + <a href="' . $edit_link.'" title="' |
|
163 | 163 | . sprintf( |
164 | 164 | esc_attr__('Edit %s Group', 'event_espresso'), |
165 | 165 | $QSG->get('QSG_name') |
166 | 166 | ) |
167 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
167 | + . '" target="_blank">'.$QSG->get('QSG_name').'</a> |
|
168 | 168 | </p>'; |
169 | 169 | } |
170 | 170 | $html .= count($QSGs) > 10 ? '</div>' : ''; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $current_qgs = array_keys($current_qgs); // we just want the ids |
204 | 204 | |
205 | 205 | // now let's get the groups selected in the editor and update (IF we have data) |
206 | - if (! empty($question_groups)) { |
|
206 | + if ( ! empty($question_groups)) { |
|
207 | 207 | foreach ($question_groups as $id => $val) { |
208 | 208 | // add to event |
209 | 209 | if ($val) { |
@@ -137,7 +137,7 @@ |
||
137 | 137 | * @param EE_Transaction $transaction |
138 | 138 | * @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved). |
139 | 139 | * By default, searches for approved payments |
140 | - * @return float|false float on success, false on fail |
|
140 | + * @return double float on success, false on fail |
|
141 | 141 | * @throws \EE_Error |
142 | 142 | */ |
143 | 143 | public function recalculate_total_payments_for_transaction( |
@@ -16,423 +16,423 @@ |
||
16 | 16 | class EE_Transaction_Payments |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var EE_Transaction_Payments $_instance |
|
21 | - * @access private |
|
22 | - */ |
|
23 | - private static $_instance; |
|
24 | - |
|
25 | - /** |
|
26 | - * @deprecated |
|
27 | - * @var string |
|
28 | - */ |
|
29 | - protected $_old_txn_status; |
|
30 | - |
|
31 | - /** |
|
32 | - * @deprecated |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $_new_txn_status; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @singleton method used to instantiate class object |
|
40 | - * @access public |
|
41 | - * @return EE_Transaction_Payments instance |
|
42 | - */ |
|
43 | - public static function instance() |
|
44 | - { |
|
45 | - // check if class object is instantiated |
|
46 | - if (! self::$_instance instanceof EE_Transaction_Payments) { |
|
47 | - self::$_instance = new self(); |
|
48 | - } |
|
49 | - return self::$_instance; |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * recalculate_transaction_total |
|
55 | - * |
|
56 | - * @access private |
|
57 | - * @param EE_Transaction $transaction |
|
58 | - * @param bool $update_txn |
|
59 | - * @return bool true if TXN total was updated, false if not |
|
60 | - * @throws \EE_Error |
|
61 | - */ |
|
62 | - public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) |
|
63 | - { |
|
64 | - $total_line_item = $transaction->total_line_item(); |
|
65 | - if (! $total_line_item instanceof EE_Line_Item) { |
|
66 | - EE_Error::add_error( |
|
67 | - sprintf( |
|
68 | - __('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), |
|
69 | - $transaction->ID() |
|
70 | - ), |
|
71 | - __FILE__, |
|
72 | - __FUNCTION__, |
|
73 | - __LINE__ |
|
74 | - ); |
|
75 | - return false; |
|
76 | - } |
|
77 | - $new_total = $total_line_item->recalculate_total_including_taxes(); |
|
78 | - $transaction->set_total($new_total); |
|
79 | - if ($update_txn) { |
|
80 | - return $transaction->save() ? true : false; |
|
81 | - } |
|
82 | - return false; |
|
83 | - } |
|
84 | - |
|
85 | - |
|
86 | - /** |
|
87 | - * Updates the provided EE_Transaction with all the applicable payments |
|
88 | - * returns a boolean for whether the TXN was saved to the db |
|
89 | - * (meaning a status change occurred) |
|
90 | - * or not saved (which could **still** mean that |
|
91 | - * the TXN status changed, but just was not yet saved). |
|
92 | - * So if passing a value of false for the $update_txn param, |
|
93 | - * then client code needs to take responsibility for saving the TXN |
|
94 | - * regardless of what happens within EE_Transaction_Payments; |
|
95 | - * |
|
96 | - * @param EE_Transaction /int $transaction_obj_or_id EE_Transaction or its ID |
|
97 | - * @param boolean $update_txn whether to save the TXN |
|
98 | - * @return boolean whether the TXN was saved |
|
99 | - * @throws \EE_Error |
|
100 | - */ |
|
101 | - public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) |
|
102 | - { |
|
103 | - // verify transaction |
|
104 | - if (! $transaction instanceof EE_Transaction) { |
|
105 | - EE_Error::add_error( |
|
106 | - __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
107 | - __FILE__, |
|
108 | - __FUNCTION__, |
|
109 | - __LINE__ |
|
110 | - ); |
|
111 | - return false; |
|
112 | - } |
|
113 | - // calculate total paid |
|
114 | - $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
115 | - // if total paid has changed |
|
116 | - if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
|
117 | - $transaction->set_paid($total_paid); |
|
118 | - // maybe update status, and make sure to save transaction if not done already |
|
119 | - if (! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
120 | - if ($update_txn) { |
|
121 | - return $transaction->save() ? true : false; |
|
122 | - } |
|
123 | - } else { |
|
124 | - // the status got updated and was saved by |
|
125 | - // update_transaction_status_based_on_total_paid() |
|
126 | - return true; |
|
127 | - } |
|
128 | - } |
|
129 | - return false; |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * recalculate_total_payments_for_transaction |
|
135 | - * |
|
136 | - * @access public |
|
137 | - * @param EE_Transaction $transaction |
|
138 | - * @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved). |
|
139 | - * By default, searches for approved payments |
|
140 | - * @return float|false float on success, false on fail |
|
141 | - * @throws \EE_Error |
|
142 | - */ |
|
143 | - public function recalculate_total_payments_for_transaction( |
|
144 | - EE_Transaction $transaction, |
|
145 | - $payment_status = EEM_Payment::status_id_approved |
|
146 | - ) { |
|
147 | - // verify transaction |
|
148 | - if (! $transaction instanceof EE_Transaction) { |
|
149 | - EE_Error::add_error( |
|
150 | - __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
151 | - __FILE__, |
|
152 | - __FUNCTION__, |
|
153 | - __LINE__ |
|
154 | - ); |
|
155 | - return false; |
|
156 | - } |
|
157 | - // ensure Payment model is loaded |
|
158 | - EE_Registry::instance()->load_model('Payment'); |
|
159 | - // calls EEM_Base::sum() |
|
160 | - return EEM_Payment::instance()->sum( |
|
161 | - // query params |
|
162 | - array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
163 | - // field to sum |
|
164 | - 'PAY_amount' |
|
165 | - ); |
|
166 | - } |
|
167 | - |
|
168 | - |
|
169 | - /** |
|
170 | - * delete_payment_and_update_transaction |
|
171 | - * Before deleting the selected payment, we fetch it's transaction, |
|
172 | - * then delete the payment, and update the transactions' amount paid. |
|
173 | - * |
|
174 | - * @param EE_Payment $payment |
|
175 | - * @return boolean |
|
176 | - * @throws \EE_Error |
|
177 | - */ |
|
178 | - public function delete_payment_and_update_transaction(EE_Payment $payment) |
|
179 | - { |
|
180 | - // verify payment |
|
181 | - if (! $payment instanceof EE_Payment) { |
|
182 | - EE_Error::add_error( |
|
183 | - __('A valid Payment object was not received.', 'event_espresso'), |
|
184 | - __FILE__, |
|
185 | - __FUNCTION__, |
|
186 | - __LINE__ |
|
187 | - ); |
|
188 | - return false; |
|
189 | - } |
|
190 | - if (! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
191 | - return false; |
|
192 | - } |
|
193 | - if (! $payment->delete()) { |
|
194 | - EE_Error::add_error( |
|
195 | - __('The payment could not be deleted.', 'event_espresso'), |
|
196 | - __FILE__, |
|
197 | - __FUNCTION__, |
|
198 | - __LINE__ |
|
199 | - ); |
|
200 | - return false; |
|
201 | - } |
|
202 | - |
|
203 | - $transaction = $payment->transaction(); |
|
204 | - $TXN_status = $transaction->status_ID(); |
|
205 | - if ($TXN_status === EEM_Transaction::abandoned_status_code |
|
206 | - || $TXN_status === EEM_Transaction::failed_status_code |
|
207 | - || $payment->amount() === 0 |
|
208 | - ) { |
|
209 | - EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
210 | - return true; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - // if this fails, that just means that the transaction didn't get its status changed and/or updated. |
|
215 | - // however the payment was still deleted. |
|
216 | - if (! $this->calculate_total_payments_and_update_status($transaction)) { |
|
217 | - EE_Error::add_attention( |
|
218 | - __( |
|
219 | - 'It appears that the Payment was deleted but no change was recorded for the Transaction for an unknown reason. Please verify that all data for this Transaction looks correct..', |
|
220 | - 'event_espresso' |
|
221 | - ), |
|
222 | - __FILE__, |
|
223 | - __FUNCTION__, |
|
224 | - __LINE__ |
|
225 | - ); |
|
226 | - return true; |
|
227 | - } |
|
228 | - |
|
229 | - EE_Error::add_success( |
|
230 | - __( |
|
231 | - 'The Payment was successfully deleted, and the Transaction has been updated accordingly.', |
|
232 | - 'event_espresso' |
|
233 | - ) |
|
234 | - ); |
|
235 | - return true; |
|
236 | - } |
|
237 | - |
|
238 | - |
|
239 | - /** |
|
240 | - * delete_registration_payments_and_update_registrations |
|
241 | - * |
|
242 | - * removes all registration payment records associated with a payment |
|
243 | - * and subtracts their amounts from the corresponding registrations REG_paid field |
|
244 | - * |
|
245 | - * @param EE_Payment $payment |
|
246 | - * @param array $reg_payment_query_params |
|
247 | - * @return bool |
|
248 | - * @throws \EE_Error |
|
249 | - */ |
|
250 | - public function delete_registration_payments_and_update_registrations( |
|
251 | - EE_Payment $payment, |
|
252 | - $reg_payment_query_params = array() |
|
253 | - ) { |
|
254 | - $save_payment = false; |
|
255 | - $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params |
|
256 | - : array(array('PAY_ID' => $payment->ID())); |
|
257 | - $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
258 | - if (! empty($registration_payments)) { |
|
259 | - foreach ($registration_payments as $registration_payment) { |
|
260 | - if ($registration_payment instanceof EE_Registration_Payment) { |
|
261 | - $amount_paid = $registration_payment->amount(); |
|
262 | - $registration = $registration_payment->registration(); |
|
263 | - if ($registration instanceof EE_Registration) { |
|
264 | - $registration->set_paid($registration->paid() - $amount_paid); |
|
265 | - if ($registration->save() !== false) { |
|
266 | - $registration_payment->delete_permanently(); |
|
267 | - $save_payment = true; |
|
268 | - } |
|
269 | - } else { |
|
270 | - EE_Error::add_error( |
|
271 | - sprintf( |
|
272 | - __( |
|
273 | - 'An invalid Registration object was associated with Registration Payment ID# %1$d.', |
|
274 | - 'event_espresso' |
|
275 | - ), |
|
276 | - $registration_payment->ID() |
|
277 | - ), |
|
278 | - __FILE__, |
|
279 | - __FUNCTION__, |
|
280 | - __LINE__ |
|
281 | - ); |
|
282 | - return false; |
|
283 | - } |
|
284 | - } else { |
|
285 | - EE_Error::add_error( |
|
286 | - sprintf( |
|
287 | - __( |
|
288 | - 'An invalid Registration Payment object was associated with payment ID# %1$d.', |
|
289 | - 'event_espresso' |
|
290 | - ), |
|
291 | - $payment->ID() |
|
292 | - ), |
|
293 | - __FILE__, |
|
294 | - __FUNCTION__, |
|
295 | - __LINE__ |
|
296 | - ); |
|
297 | - return false; |
|
298 | - } |
|
299 | - } |
|
300 | - } |
|
301 | - if ($save_payment) { |
|
302 | - $payment->save(); |
|
303 | - } |
|
304 | - return true; |
|
305 | - } |
|
306 | - |
|
307 | - |
|
308 | - |
|
309 | - /********************************** DEPRECATED METHODS **********************************/ |
|
310 | - |
|
311 | - |
|
312 | - /** |
|
313 | - * possibly toggles TXN status |
|
314 | - * |
|
315 | - * @deprecated 4.9.1 |
|
316 | - * @param EE_Transaction $transaction |
|
317 | - * @param boolean $update_txn whether to save the TXN |
|
318 | - * @return boolean whether the TXN was saved |
|
319 | - * @throws \EE_Error |
|
320 | - */ |
|
321 | - public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true) |
|
322 | - { |
|
323 | - EE_Error::doing_it_wrong( |
|
324 | - __CLASS__ . '::' . __FUNCTION__, |
|
325 | - sprintf( |
|
326 | - __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
327 | - 'EE_Transaction::update_status_based_on_total_paid()' |
|
328 | - ), |
|
329 | - '4.9.1', |
|
330 | - '5.0.0' |
|
331 | - ); |
|
332 | - // verify transaction |
|
333 | - if (! $transaction instanceof EE_Transaction) { |
|
334 | - EE_Error::add_error( |
|
335 | - __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
336 | - __FILE__, |
|
337 | - __FUNCTION__, |
|
338 | - __LINE__ |
|
339 | - ); |
|
340 | - return false; |
|
341 | - } |
|
342 | - // set transaction status based on comparison of TXN_paid vs TXN_total |
|
343 | - return $transaction->update_status_based_on_total_paid($update_txn); |
|
344 | - } |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * @deprecated 4.9.12 |
|
349 | - * @return string |
|
350 | - */ |
|
351 | - public function old_txn_status() |
|
352 | - { |
|
353 | - EE_Error::doing_it_wrong( |
|
354 | - __METHOD__, |
|
355 | - esc_html__( |
|
356 | - 'This logic has been moved into \EE_Transaction::old_txn_status(), please use that method instead.', |
|
357 | - 'event_espresso' |
|
358 | - ), |
|
359 | - '4.9.12' |
|
360 | - ); |
|
361 | - return $this->_old_txn_status; |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * @deprecated 4.9.12 |
|
367 | - * @param string $old_txn_status |
|
368 | - */ |
|
369 | - public function set_old_txn_status($old_txn_status) |
|
370 | - { |
|
371 | - EE_Error::doing_it_wrong( |
|
372 | - __METHOD__, |
|
373 | - esc_html__( |
|
374 | - 'This logic has been moved into \EE_Transaction::set_old_txn_status(), please use that method instead.', |
|
375 | - 'event_espresso' |
|
376 | - ), |
|
377 | - '4.9.12' |
|
378 | - ); |
|
379 | - // only set the first time |
|
380 | - if ($this->_old_txn_status === null) { |
|
381 | - $this->_old_txn_status = $old_txn_status; |
|
382 | - } |
|
383 | - } |
|
384 | - |
|
385 | - |
|
386 | - /** |
|
387 | - * @deprecated 4.9.12 |
|
388 | - * @return string |
|
389 | - */ |
|
390 | - public function new_txn_status() |
|
391 | - { |
|
392 | - EE_Error::doing_it_wrong( |
|
393 | - __METHOD__, |
|
394 | - esc_html__( |
|
395 | - 'This logic has been removed. Please just use \EE_Transaction::status_ID() instead.', |
|
396 | - 'event_espresso' |
|
397 | - ), |
|
398 | - '4.9.12' |
|
399 | - ); |
|
400 | - return $this->_new_txn_status; |
|
401 | - } |
|
402 | - |
|
403 | - |
|
404 | - /** |
|
405 | - * @deprecated 4.9.12 |
|
406 | - * @param string $new_txn_status |
|
407 | - */ |
|
408 | - public function set_new_txn_status($new_txn_status) |
|
409 | - { |
|
410 | - EE_Error::doing_it_wrong( |
|
411 | - __METHOD__, |
|
412 | - esc_html__( |
|
413 | - 'This logic has been removed. Please just use \EE_Transaction::set_status() instead.', |
|
414 | - 'event_espresso' |
|
415 | - ), |
|
416 | - '4.9.12' |
|
417 | - ); |
|
418 | - $this->_new_txn_status = $new_txn_status; |
|
419 | - } |
|
420 | - |
|
421 | - |
|
422 | - /** |
|
423 | - * @deprecated 4.9.12 |
|
424 | - * @return bool |
|
425 | - */ |
|
426 | - public function txn_status_updated() |
|
427 | - { |
|
428 | - EE_Error::doing_it_wrong( |
|
429 | - __METHOD__, |
|
430 | - esc_html__( |
|
431 | - 'This logic has been moved into \EE_Transaction::txn_status_updated(), please use that method instead.', |
|
432 | - 'event_espresso' |
|
433 | - ), |
|
434 | - '4.9.12' |
|
435 | - ); |
|
436 | - return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
437 | - } |
|
19 | + /** |
|
20 | + * @var EE_Transaction_Payments $_instance |
|
21 | + * @access private |
|
22 | + */ |
|
23 | + private static $_instance; |
|
24 | + |
|
25 | + /** |
|
26 | + * @deprecated |
|
27 | + * @var string |
|
28 | + */ |
|
29 | + protected $_old_txn_status; |
|
30 | + |
|
31 | + /** |
|
32 | + * @deprecated |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $_new_txn_status; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @singleton method used to instantiate class object |
|
40 | + * @access public |
|
41 | + * @return EE_Transaction_Payments instance |
|
42 | + */ |
|
43 | + public static function instance() |
|
44 | + { |
|
45 | + // check if class object is instantiated |
|
46 | + if (! self::$_instance instanceof EE_Transaction_Payments) { |
|
47 | + self::$_instance = new self(); |
|
48 | + } |
|
49 | + return self::$_instance; |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * recalculate_transaction_total |
|
55 | + * |
|
56 | + * @access private |
|
57 | + * @param EE_Transaction $transaction |
|
58 | + * @param bool $update_txn |
|
59 | + * @return bool true if TXN total was updated, false if not |
|
60 | + * @throws \EE_Error |
|
61 | + */ |
|
62 | + public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) |
|
63 | + { |
|
64 | + $total_line_item = $transaction->total_line_item(); |
|
65 | + if (! $total_line_item instanceof EE_Line_Item) { |
|
66 | + EE_Error::add_error( |
|
67 | + sprintf( |
|
68 | + __('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), |
|
69 | + $transaction->ID() |
|
70 | + ), |
|
71 | + __FILE__, |
|
72 | + __FUNCTION__, |
|
73 | + __LINE__ |
|
74 | + ); |
|
75 | + return false; |
|
76 | + } |
|
77 | + $new_total = $total_line_item->recalculate_total_including_taxes(); |
|
78 | + $transaction->set_total($new_total); |
|
79 | + if ($update_txn) { |
|
80 | + return $transaction->save() ? true : false; |
|
81 | + } |
|
82 | + return false; |
|
83 | + } |
|
84 | + |
|
85 | + |
|
86 | + /** |
|
87 | + * Updates the provided EE_Transaction with all the applicable payments |
|
88 | + * returns a boolean for whether the TXN was saved to the db |
|
89 | + * (meaning a status change occurred) |
|
90 | + * or not saved (which could **still** mean that |
|
91 | + * the TXN status changed, but just was not yet saved). |
|
92 | + * So if passing a value of false for the $update_txn param, |
|
93 | + * then client code needs to take responsibility for saving the TXN |
|
94 | + * regardless of what happens within EE_Transaction_Payments; |
|
95 | + * |
|
96 | + * @param EE_Transaction /int $transaction_obj_or_id EE_Transaction or its ID |
|
97 | + * @param boolean $update_txn whether to save the TXN |
|
98 | + * @return boolean whether the TXN was saved |
|
99 | + * @throws \EE_Error |
|
100 | + */ |
|
101 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) |
|
102 | + { |
|
103 | + // verify transaction |
|
104 | + if (! $transaction instanceof EE_Transaction) { |
|
105 | + EE_Error::add_error( |
|
106 | + __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
107 | + __FILE__, |
|
108 | + __FUNCTION__, |
|
109 | + __LINE__ |
|
110 | + ); |
|
111 | + return false; |
|
112 | + } |
|
113 | + // calculate total paid |
|
114 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
115 | + // if total paid has changed |
|
116 | + if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
|
117 | + $transaction->set_paid($total_paid); |
|
118 | + // maybe update status, and make sure to save transaction if not done already |
|
119 | + if (! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
120 | + if ($update_txn) { |
|
121 | + return $transaction->save() ? true : false; |
|
122 | + } |
|
123 | + } else { |
|
124 | + // the status got updated and was saved by |
|
125 | + // update_transaction_status_based_on_total_paid() |
|
126 | + return true; |
|
127 | + } |
|
128 | + } |
|
129 | + return false; |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * recalculate_total_payments_for_transaction |
|
135 | + * |
|
136 | + * @access public |
|
137 | + * @param EE_Transaction $transaction |
|
138 | + * @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved). |
|
139 | + * By default, searches for approved payments |
|
140 | + * @return float|false float on success, false on fail |
|
141 | + * @throws \EE_Error |
|
142 | + */ |
|
143 | + public function recalculate_total_payments_for_transaction( |
|
144 | + EE_Transaction $transaction, |
|
145 | + $payment_status = EEM_Payment::status_id_approved |
|
146 | + ) { |
|
147 | + // verify transaction |
|
148 | + if (! $transaction instanceof EE_Transaction) { |
|
149 | + EE_Error::add_error( |
|
150 | + __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
151 | + __FILE__, |
|
152 | + __FUNCTION__, |
|
153 | + __LINE__ |
|
154 | + ); |
|
155 | + return false; |
|
156 | + } |
|
157 | + // ensure Payment model is loaded |
|
158 | + EE_Registry::instance()->load_model('Payment'); |
|
159 | + // calls EEM_Base::sum() |
|
160 | + return EEM_Payment::instance()->sum( |
|
161 | + // query params |
|
162 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
163 | + // field to sum |
|
164 | + 'PAY_amount' |
|
165 | + ); |
|
166 | + } |
|
167 | + |
|
168 | + |
|
169 | + /** |
|
170 | + * delete_payment_and_update_transaction |
|
171 | + * Before deleting the selected payment, we fetch it's transaction, |
|
172 | + * then delete the payment, and update the transactions' amount paid. |
|
173 | + * |
|
174 | + * @param EE_Payment $payment |
|
175 | + * @return boolean |
|
176 | + * @throws \EE_Error |
|
177 | + */ |
|
178 | + public function delete_payment_and_update_transaction(EE_Payment $payment) |
|
179 | + { |
|
180 | + // verify payment |
|
181 | + if (! $payment instanceof EE_Payment) { |
|
182 | + EE_Error::add_error( |
|
183 | + __('A valid Payment object was not received.', 'event_espresso'), |
|
184 | + __FILE__, |
|
185 | + __FUNCTION__, |
|
186 | + __LINE__ |
|
187 | + ); |
|
188 | + return false; |
|
189 | + } |
|
190 | + if (! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
191 | + return false; |
|
192 | + } |
|
193 | + if (! $payment->delete()) { |
|
194 | + EE_Error::add_error( |
|
195 | + __('The payment could not be deleted.', 'event_espresso'), |
|
196 | + __FILE__, |
|
197 | + __FUNCTION__, |
|
198 | + __LINE__ |
|
199 | + ); |
|
200 | + return false; |
|
201 | + } |
|
202 | + |
|
203 | + $transaction = $payment->transaction(); |
|
204 | + $TXN_status = $transaction->status_ID(); |
|
205 | + if ($TXN_status === EEM_Transaction::abandoned_status_code |
|
206 | + || $TXN_status === EEM_Transaction::failed_status_code |
|
207 | + || $payment->amount() === 0 |
|
208 | + ) { |
|
209 | + EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
210 | + return true; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + // if this fails, that just means that the transaction didn't get its status changed and/or updated. |
|
215 | + // however the payment was still deleted. |
|
216 | + if (! $this->calculate_total_payments_and_update_status($transaction)) { |
|
217 | + EE_Error::add_attention( |
|
218 | + __( |
|
219 | + 'It appears that the Payment was deleted but no change was recorded for the Transaction for an unknown reason. Please verify that all data for this Transaction looks correct..', |
|
220 | + 'event_espresso' |
|
221 | + ), |
|
222 | + __FILE__, |
|
223 | + __FUNCTION__, |
|
224 | + __LINE__ |
|
225 | + ); |
|
226 | + return true; |
|
227 | + } |
|
228 | + |
|
229 | + EE_Error::add_success( |
|
230 | + __( |
|
231 | + 'The Payment was successfully deleted, and the Transaction has been updated accordingly.', |
|
232 | + 'event_espresso' |
|
233 | + ) |
|
234 | + ); |
|
235 | + return true; |
|
236 | + } |
|
237 | + |
|
238 | + |
|
239 | + /** |
|
240 | + * delete_registration_payments_and_update_registrations |
|
241 | + * |
|
242 | + * removes all registration payment records associated with a payment |
|
243 | + * and subtracts their amounts from the corresponding registrations REG_paid field |
|
244 | + * |
|
245 | + * @param EE_Payment $payment |
|
246 | + * @param array $reg_payment_query_params |
|
247 | + * @return bool |
|
248 | + * @throws \EE_Error |
|
249 | + */ |
|
250 | + public function delete_registration_payments_and_update_registrations( |
|
251 | + EE_Payment $payment, |
|
252 | + $reg_payment_query_params = array() |
|
253 | + ) { |
|
254 | + $save_payment = false; |
|
255 | + $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params |
|
256 | + : array(array('PAY_ID' => $payment->ID())); |
|
257 | + $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
258 | + if (! empty($registration_payments)) { |
|
259 | + foreach ($registration_payments as $registration_payment) { |
|
260 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
261 | + $amount_paid = $registration_payment->amount(); |
|
262 | + $registration = $registration_payment->registration(); |
|
263 | + if ($registration instanceof EE_Registration) { |
|
264 | + $registration->set_paid($registration->paid() - $amount_paid); |
|
265 | + if ($registration->save() !== false) { |
|
266 | + $registration_payment->delete_permanently(); |
|
267 | + $save_payment = true; |
|
268 | + } |
|
269 | + } else { |
|
270 | + EE_Error::add_error( |
|
271 | + sprintf( |
|
272 | + __( |
|
273 | + 'An invalid Registration object was associated with Registration Payment ID# %1$d.', |
|
274 | + 'event_espresso' |
|
275 | + ), |
|
276 | + $registration_payment->ID() |
|
277 | + ), |
|
278 | + __FILE__, |
|
279 | + __FUNCTION__, |
|
280 | + __LINE__ |
|
281 | + ); |
|
282 | + return false; |
|
283 | + } |
|
284 | + } else { |
|
285 | + EE_Error::add_error( |
|
286 | + sprintf( |
|
287 | + __( |
|
288 | + 'An invalid Registration Payment object was associated with payment ID# %1$d.', |
|
289 | + 'event_espresso' |
|
290 | + ), |
|
291 | + $payment->ID() |
|
292 | + ), |
|
293 | + __FILE__, |
|
294 | + __FUNCTION__, |
|
295 | + __LINE__ |
|
296 | + ); |
|
297 | + return false; |
|
298 | + } |
|
299 | + } |
|
300 | + } |
|
301 | + if ($save_payment) { |
|
302 | + $payment->save(); |
|
303 | + } |
|
304 | + return true; |
|
305 | + } |
|
306 | + |
|
307 | + |
|
308 | + |
|
309 | + /********************************** DEPRECATED METHODS **********************************/ |
|
310 | + |
|
311 | + |
|
312 | + /** |
|
313 | + * possibly toggles TXN status |
|
314 | + * |
|
315 | + * @deprecated 4.9.1 |
|
316 | + * @param EE_Transaction $transaction |
|
317 | + * @param boolean $update_txn whether to save the TXN |
|
318 | + * @return boolean whether the TXN was saved |
|
319 | + * @throws \EE_Error |
|
320 | + */ |
|
321 | + public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true) |
|
322 | + { |
|
323 | + EE_Error::doing_it_wrong( |
|
324 | + __CLASS__ . '::' . __FUNCTION__, |
|
325 | + sprintf( |
|
326 | + __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
|
327 | + 'EE_Transaction::update_status_based_on_total_paid()' |
|
328 | + ), |
|
329 | + '4.9.1', |
|
330 | + '5.0.0' |
|
331 | + ); |
|
332 | + // verify transaction |
|
333 | + if (! $transaction instanceof EE_Transaction) { |
|
334 | + EE_Error::add_error( |
|
335 | + __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
336 | + __FILE__, |
|
337 | + __FUNCTION__, |
|
338 | + __LINE__ |
|
339 | + ); |
|
340 | + return false; |
|
341 | + } |
|
342 | + // set transaction status based on comparison of TXN_paid vs TXN_total |
|
343 | + return $transaction->update_status_based_on_total_paid($update_txn); |
|
344 | + } |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * @deprecated 4.9.12 |
|
349 | + * @return string |
|
350 | + */ |
|
351 | + public function old_txn_status() |
|
352 | + { |
|
353 | + EE_Error::doing_it_wrong( |
|
354 | + __METHOD__, |
|
355 | + esc_html__( |
|
356 | + 'This logic has been moved into \EE_Transaction::old_txn_status(), please use that method instead.', |
|
357 | + 'event_espresso' |
|
358 | + ), |
|
359 | + '4.9.12' |
|
360 | + ); |
|
361 | + return $this->_old_txn_status; |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + /** |
|
366 | + * @deprecated 4.9.12 |
|
367 | + * @param string $old_txn_status |
|
368 | + */ |
|
369 | + public function set_old_txn_status($old_txn_status) |
|
370 | + { |
|
371 | + EE_Error::doing_it_wrong( |
|
372 | + __METHOD__, |
|
373 | + esc_html__( |
|
374 | + 'This logic has been moved into \EE_Transaction::set_old_txn_status(), please use that method instead.', |
|
375 | + 'event_espresso' |
|
376 | + ), |
|
377 | + '4.9.12' |
|
378 | + ); |
|
379 | + // only set the first time |
|
380 | + if ($this->_old_txn_status === null) { |
|
381 | + $this->_old_txn_status = $old_txn_status; |
|
382 | + } |
|
383 | + } |
|
384 | + |
|
385 | + |
|
386 | + /** |
|
387 | + * @deprecated 4.9.12 |
|
388 | + * @return string |
|
389 | + */ |
|
390 | + public function new_txn_status() |
|
391 | + { |
|
392 | + EE_Error::doing_it_wrong( |
|
393 | + __METHOD__, |
|
394 | + esc_html__( |
|
395 | + 'This logic has been removed. Please just use \EE_Transaction::status_ID() instead.', |
|
396 | + 'event_espresso' |
|
397 | + ), |
|
398 | + '4.9.12' |
|
399 | + ); |
|
400 | + return $this->_new_txn_status; |
|
401 | + } |
|
402 | + |
|
403 | + |
|
404 | + /** |
|
405 | + * @deprecated 4.9.12 |
|
406 | + * @param string $new_txn_status |
|
407 | + */ |
|
408 | + public function set_new_txn_status($new_txn_status) |
|
409 | + { |
|
410 | + EE_Error::doing_it_wrong( |
|
411 | + __METHOD__, |
|
412 | + esc_html__( |
|
413 | + 'This logic has been removed. Please just use \EE_Transaction::set_status() instead.', |
|
414 | + 'event_espresso' |
|
415 | + ), |
|
416 | + '4.9.12' |
|
417 | + ); |
|
418 | + $this->_new_txn_status = $new_txn_status; |
|
419 | + } |
|
420 | + |
|
421 | + |
|
422 | + /** |
|
423 | + * @deprecated 4.9.12 |
|
424 | + * @return bool |
|
425 | + */ |
|
426 | + public function txn_status_updated() |
|
427 | + { |
|
428 | + EE_Error::doing_it_wrong( |
|
429 | + __METHOD__, |
|
430 | + esc_html__( |
|
431 | + 'This logic has been moved into \EE_Transaction::txn_status_updated(), please use that method instead.', |
|
432 | + 'event_espresso' |
|
433 | + ), |
|
434 | + '4.9.12' |
|
435 | + ); |
|
436 | + return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
437 | + } |
|
438 | 438 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | public static function instance() |
44 | 44 | { |
45 | 45 | // check if class object is instantiated |
46 | - if (! self::$_instance instanceof EE_Transaction_Payments) { |
|
46 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
47 | 47 | self::$_instance = new self(); |
48 | 48 | } |
49 | 49 | return self::$_instance; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) |
63 | 63 | { |
64 | 64 | $total_line_item = $transaction->total_line_item(); |
65 | - if (! $total_line_item instanceof EE_Line_Item) { |
|
65 | + if ( ! $total_line_item instanceof EE_Line_Item) { |
|
66 | 66 | EE_Error::add_error( |
67 | 67 | sprintf( |
68 | 68 | __('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) |
102 | 102 | { |
103 | 103 | // verify transaction |
104 | - if (! $transaction instanceof EE_Transaction) { |
|
104 | + if ( ! $transaction instanceof EE_Transaction) { |
|
105 | 105 | EE_Error::add_error( |
106 | 106 | __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
107 | 107 | __FILE__, |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
117 | 117 | $transaction->set_paid($total_paid); |
118 | 118 | // maybe update status, and make sure to save transaction if not done already |
119 | - if (! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
119 | + if ( ! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
120 | 120 | if ($update_txn) { |
121 | 121 | return $transaction->save() ? true : false; |
122 | 122 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $payment_status = EEM_Payment::status_id_approved |
146 | 146 | ) { |
147 | 147 | // verify transaction |
148 | - if (! $transaction instanceof EE_Transaction) { |
|
148 | + if ( ! $transaction instanceof EE_Transaction) { |
|
149 | 149 | EE_Error::add_error( |
150 | 150 | __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
151 | 151 | __FILE__, |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function delete_payment_and_update_transaction(EE_Payment $payment) |
179 | 179 | { |
180 | 180 | // verify payment |
181 | - if (! $payment instanceof EE_Payment) { |
|
181 | + if ( ! $payment instanceof EE_Payment) { |
|
182 | 182 | EE_Error::add_error( |
183 | 183 | __('A valid Payment object was not received.', 'event_espresso'), |
184 | 184 | __FILE__, |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | ); |
188 | 188 | return false; |
189 | 189 | } |
190 | - if (! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
190 | + if ( ! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
191 | 191 | return false; |
192 | 192 | } |
193 | - if (! $payment->delete()) { |
|
193 | + if ( ! $payment->delete()) { |
|
194 | 194 | EE_Error::add_error( |
195 | 195 | __('The payment could not be deleted.', 'event_espresso'), |
196 | 196 | __FILE__, |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | // if this fails, that just means that the transaction didn't get its status changed and/or updated. |
215 | 215 | // however the payment was still deleted. |
216 | - if (! $this->calculate_total_payments_and_update_status($transaction)) { |
|
216 | + if ( ! $this->calculate_total_payments_and_update_status($transaction)) { |
|
217 | 217 | EE_Error::add_attention( |
218 | 218 | __( |
219 | 219 | 'It appears that the Payment was deleted but no change was recorded for the Transaction for an unknown reason. Please verify that all data for this Transaction looks correct..', |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params |
256 | 256 | : array(array('PAY_ID' => $payment->ID())); |
257 | 257 | $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
258 | - if (! empty($registration_payments)) { |
|
258 | + if ( ! empty($registration_payments)) { |
|
259 | 259 | foreach ($registration_payments as $registration_payment) { |
260 | 260 | if ($registration_payment instanceof EE_Registration_Payment) { |
261 | 261 | $amount_paid = $registration_payment->amount(); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true) |
322 | 322 | { |
323 | 323 | EE_Error::doing_it_wrong( |
324 | - __CLASS__ . '::' . __FUNCTION__, |
|
324 | + __CLASS__.'::'.__FUNCTION__, |
|
325 | 325 | sprintf( |
326 | 326 | __('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
327 | 327 | 'EE_Transaction::update_status_based_on_total_paid()' |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | '5.0.0' |
331 | 331 | ); |
332 | 332 | // verify transaction |
333 | - if (! $transaction instanceof EE_Transaction) { |
|
333 | + if ( ! $transaction instanceof EE_Transaction) { |
|
334 | 334 | EE_Error::add_error( |
335 | 335 | __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
336 | 336 | __FILE__, |
@@ -185,6 +185,7 @@ |
||
185 | 185 | * when retrieving cached registrations from a transaction |
186 | 186 | * @param bool $trigger_notifications whether or not to call |
187 | 187 | * \EE_Registration_Processor::trigger_registration_update_notifications() |
188 | + * @param EE_Payment $payment |
|
188 | 189 | * @return array |
189 | 190 | * @throws \EE_Error |
190 | 191 | */ |
@@ -17,948 +17,948 @@ |
||
17 | 17 | class EE_Transaction_Processor extends EE_Processor_Base |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var EE_Registration_Processor $_instance |
|
22 | - * @access private |
|
23 | - */ |
|
24 | - private static $_instance; |
|
25 | - |
|
26 | - /** |
|
27 | - * array of query WHERE params to use when retrieving cached registrations from a transaction |
|
28 | - * |
|
29 | - * @var array $registration_query_params |
|
30 | - * @access private |
|
31 | - */ |
|
32 | - private $_registration_query_params = array(); |
|
33 | - |
|
34 | - /** |
|
35 | - * @deprecated |
|
36 | - * @var string |
|
37 | - */ |
|
38 | - protected $_old_txn_status; |
|
39 | - |
|
40 | - /** |
|
41 | - * @deprecated |
|
42 | - * @var string |
|
43 | - */ |
|
44 | - protected $_new_txn_status; |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * @singleton method used to instantiate class object |
|
49 | - * @access public |
|
50 | - * @param array $registration_query_params |
|
51 | - * @return EE_Transaction_Processor instance |
|
52 | - */ |
|
53 | - public static function instance($registration_query_params = array()) |
|
54 | - { |
|
55 | - // check if class object is instantiated |
|
56 | - if (! self::$_instance instanceof EE_Transaction_Processor) { |
|
57 | - self::$_instance = new self($registration_query_params); |
|
58 | - } |
|
59 | - return self::$_instance; |
|
60 | - } |
|
61 | - |
|
62 | - |
|
63 | - /** |
|
64 | - * @param array $registration_query_params |
|
65 | - */ |
|
66 | - private function __construct($registration_query_params = array()) |
|
67 | - { |
|
68 | - // make sure some query params are set for retrieving registrations |
|
69 | - $this->_set_registration_query_params($registration_query_params); |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * @access private |
|
75 | - * @param array $registration_query_params |
|
76 | - */ |
|
77 | - private function _set_registration_query_params($registration_query_params) |
|
78 | - { |
|
79 | - $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params |
|
80 | - : array('order_by' => array('REG_count' => 'ASC')); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * manually_update_registration_statuses |
|
86 | - * |
|
87 | - * @access public |
|
88 | - * @param EE_Transaction $transaction |
|
89 | - * @param string $new_reg_status |
|
90 | - * @param array $registration_query_params array of query WHERE params to use |
|
91 | - * when retrieving cached registrations from a transaction |
|
92 | - * @return boolean |
|
93 | - * @throws \EE_Error |
|
94 | - */ |
|
95 | - public function manually_update_registration_statuses( |
|
96 | - EE_Transaction $transaction, |
|
97 | - $new_reg_status = '', |
|
98 | - $registration_query_params = array() |
|
99 | - ) { |
|
100 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( |
|
101 | - 'manually_update_registration_status', |
|
102 | - $transaction, |
|
103 | - $registration_query_params, |
|
104 | - $new_reg_status |
|
105 | - ); |
|
106 | - // send messages |
|
107 | - /** @type EE_Registration_Processor $registration_processor */ |
|
108 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
109 | - $registration_processor->trigger_registration_update_notifications( |
|
110 | - $transaction->primary_registration(), |
|
111 | - array('manually_updated' => true) |
|
112 | - ); |
|
113 | - do_action( |
|
114 | - 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', |
|
115 | - $transaction, |
|
116 | - $status_updates |
|
117 | - ); |
|
118 | - return $status_updates; |
|
119 | - } |
|
120 | - |
|
121 | - |
|
122 | - /** |
|
123 | - * toggle_registration_statuses_for_default_approved_events |
|
124 | - * |
|
125 | - * @access public |
|
126 | - * @param EE_Transaction $transaction |
|
127 | - * @param array $registration_query_params array of query WHERE params to use |
|
128 | - * when retrieving cached registrations from a transaction |
|
129 | - * @return boolean |
|
130 | - * @throws \EE_Error |
|
131 | - */ |
|
132 | - public function toggle_registration_statuses_for_default_approved_events( |
|
133 | - EE_Transaction $transaction, |
|
134 | - $registration_query_params = array() |
|
135 | - ) { |
|
136 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( |
|
137 | - 'toggle_registration_status_for_default_approved_events', |
|
138 | - $transaction, |
|
139 | - $registration_query_params |
|
140 | - ); |
|
141 | - do_action( |
|
142 | - 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', |
|
143 | - $transaction, |
|
144 | - $status_updates |
|
145 | - ); |
|
146 | - return $status_updates; |
|
147 | - } |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * toggle_registration_statuses_if_no_monies_owing |
|
152 | - * |
|
153 | - * @access public |
|
154 | - * @param EE_Transaction $transaction |
|
155 | - * @param array $registration_query_params array of query WHERE params to use |
|
156 | - * when retrieving cached registrations from a transaction |
|
157 | - * @return boolean |
|
158 | - * @throws \EE_Error |
|
159 | - */ |
|
160 | - public function toggle_registration_statuses_if_no_monies_owing( |
|
161 | - EE_Transaction $transaction, |
|
162 | - $registration_query_params = array() |
|
163 | - ) { |
|
164 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( |
|
165 | - 'toggle_registration_status_if_no_monies_owing', |
|
166 | - $transaction, |
|
167 | - $registration_query_params |
|
168 | - ); |
|
169 | - do_action( |
|
170 | - 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', |
|
171 | - $transaction, |
|
172 | - $status_updates |
|
173 | - ); |
|
174 | - return $status_updates; |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * update_transaction_and_registrations_after_checkout_or_payment |
|
180 | - * cycles thru related registrations and calls update_registration_after_checkout_or_payment() on each |
|
181 | - * |
|
182 | - * @param EE_Transaction $transaction |
|
183 | - * @param \EE_Payment | NULL $payment |
|
184 | - * @param array $registration_query_params array of query WHERE params to use |
|
185 | - * when retrieving cached registrations from a transaction |
|
186 | - * @param bool $trigger_notifications whether or not to call |
|
187 | - * \EE_Registration_Processor::trigger_registration_update_notifications() |
|
188 | - * @return array |
|
189 | - * @throws \EE_Error |
|
190 | - */ |
|
191 | - public function update_transaction_and_registrations_after_checkout_or_payment( |
|
192 | - EE_Transaction $transaction, |
|
193 | - $payment = null, |
|
194 | - $registration_query_params = array(), |
|
195 | - $trigger_notifications = true |
|
196 | - ) { |
|
197 | - // make sure some query params are set for retrieving registrations |
|
198 | - $this->_set_registration_query_params($registration_query_params); |
|
199 | - // get final reg step status |
|
200 | - $finalized = $transaction->final_reg_step_completed(); |
|
201 | - // if the 'finalize_registration' step has been initiated (has a timestamp) |
|
202 | - // but has not yet been fully completed (TRUE) |
|
203 | - if (is_int($finalized) && $finalized !== false && $finalized !== true) { |
|
204 | - $transaction->set_reg_step_completed('finalize_registration'); |
|
205 | - $finalized = true; |
|
206 | - } |
|
207 | - $transaction->save(); |
|
208 | - // array of details to aid in decision making by systems |
|
209 | - $update_params = array( |
|
210 | - 'old_txn_status' => $transaction->old_txn_status(), |
|
211 | - 'new_txn_status' => $transaction->status_ID(), |
|
212 | - 'finalized' => $finalized, |
|
213 | - 'revisit' => $this->_revisit, |
|
214 | - 'payment_updates' => $payment instanceof EE_Payment ? true : false, |
|
215 | - 'last_payment' => $payment, |
|
216 | - ); |
|
217 | - // now update the registrations and add the results to our $update_params |
|
218 | - $update_params['status_updates'] = $this->_call_method_on_registrations_via_Registration_Processor( |
|
219 | - 'update_registration_after_checkout_or_payment', |
|
220 | - $transaction, |
|
221 | - $this->_registration_query_params, |
|
222 | - $update_params |
|
223 | - ); |
|
224 | - if ($trigger_notifications) { |
|
225 | - // send messages |
|
226 | - /** @type EE_Registration_Processor $registration_processor */ |
|
227 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
228 | - $registration_processor->trigger_registration_update_notifications( |
|
229 | - $transaction->primary_registration(), |
|
230 | - $update_params |
|
231 | - ); |
|
232 | - } |
|
233 | - do_action( |
|
234 | - 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', |
|
235 | - $transaction, |
|
236 | - $update_params |
|
237 | - ); |
|
238 | - return $update_params; |
|
239 | - } |
|
240 | - |
|
241 | - |
|
242 | - /** |
|
243 | - * update_transaction_after_registration_reopened |
|
244 | - * readjusts TXN and Line Item totals after a registration is changed from |
|
245 | - * cancelled or declined to another reg status such as pending payment or approved |
|
246 | - * |
|
247 | - * @param \EE_Registration $registration |
|
248 | - * @param array $closed_reg_statuses |
|
249 | - * @param bool $update_txn |
|
250 | - * @return bool |
|
251 | - * @throws \EE_Error |
|
252 | - */ |
|
253 | - public function update_transaction_after_reinstating_canceled_registration( |
|
254 | - EE_Registration $registration, |
|
255 | - $closed_reg_statuses = array(), |
|
256 | - $update_txn = true |
|
257 | - ) { |
|
258 | - // these reg statuses should not be considered in any calculations involving monies owing |
|
259 | - $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
260 | - : EEM_Registration::closed_reg_statuses(); |
|
261 | - if (in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
262 | - return false; |
|
263 | - } |
|
264 | - try { |
|
265 | - $transaction = $this->get_transaction_for_registration($registration); |
|
266 | - $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( |
|
267 | - $transaction, |
|
268 | - $registration |
|
269 | - ); |
|
270 | - // un-cancel the ticket |
|
271 | - $success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item); |
|
272 | - } catch (EE_Error $e) { |
|
273 | - EE_Error::add_error( |
|
274 | - sprintf( |
|
275 | - __( |
|
276 | - 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', |
|
277 | - 'event_espresso' |
|
278 | - ), |
|
279 | - $registration->ID(), |
|
280 | - '<br />', |
|
281 | - $e->getMessage() |
|
282 | - ), |
|
283 | - __FILE__, |
|
284 | - __FUNCTION__, |
|
285 | - __LINE__ |
|
286 | - ); |
|
287 | - return false; |
|
288 | - } |
|
289 | - if ($update_txn) { |
|
290 | - return $transaction->save() ? $success : false; |
|
291 | - } |
|
292 | - return $success; |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - /** |
|
297 | - * update_transaction_after_canceled_or_declined_registration |
|
298 | - * readjusts TXN and Line Item totals after a registration is cancelled or declined |
|
299 | - * |
|
300 | - * @param \EE_Registration $registration |
|
301 | - * @param array $closed_reg_statuses |
|
302 | - * @param bool $update_txn |
|
303 | - * @return bool |
|
304 | - * @throws \EE_Error |
|
305 | - */ |
|
306 | - public function update_transaction_after_canceled_or_declined_registration( |
|
307 | - EE_Registration $registration, |
|
308 | - $closed_reg_statuses = array(), |
|
309 | - $update_txn = true |
|
310 | - ) { |
|
311 | - // these reg statuses should not be considered in any calculations involving monies owing |
|
312 | - $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
313 | - : EEM_Registration::closed_reg_statuses(); |
|
314 | - if (! in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
315 | - return false; |
|
316 | - } |
|
317 | - try { |
|
318 | - $transaction = $this->get_transaction_for_registration($registration); |
|
319 | - if (apply_filters( |
|
320 | - 'FHEE__EE_Transaction_Processor__update_transaction_after_canceled_or_declined_registration__cancel_ticket_line_item', |
|
321 | - true, |
|
322 | - $registration, |
|
323 | - $transaction |
|
324 | - )) { |
|
325 | - $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( |
|
326 | - $transaction, |
|
327 | - $registration |
|
328 | - ); |
|
329 | - EEH_Line_Item::cancel_ticket_line_item($ticket_line_item); |
|
330 | - } |
|
331 | - } catch (EE_Error $e) { |
|
332 | - EE_Error::add_error( |
|
333 | - sprintf( |
|
334 | - __( |
|
335 | - 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', |
|
336 | - 'event_espresso' |
|
337 | - ), |
|
338 | - $registration->ID(), |
|
339 | - '<br />', |
|
340 | - $e->getMessage() |
|
341 | - ), |
|
342 | - __FILE__, |
|
343 | - __FUNCTION__, |
|
344 | - __LINE__ |
|
345 | - ); |
|
346 | - return false; |
|
347 | - } |
|
348 | - if ($update_txn) { |
|
349 | - return $transaction->save() ? true : false; |
|
350 | - } |
|
351 | - return true; |
|
352 | - } |
|
353 | - |
|
354 | - |
|
355 | - /** |
|
356 | - * get_transaction_for_registration |
|
357 | - * |
|
358 | - * @access public |
|
359 | - * @param EE_Registration $registration |
|
360 | - * @return EE_Transaction |
|
361 | - * @throws EE_Error |
|
362 | - */ |
|
363 | - public function get_transaction_for_registration(EE_Registration $registration) |
|
364 | - { |
|
365 | - $transaction = $registration->transaction(); |
|
366 | - if (! $transaction instanceof EE_Transaction) { |
|
367 | - throw new EE_Error( |
|
368 | - sprintf( |
|
369 | - __('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'), |
|
370 | - $registration->ID() |
|
371 | - ) |
|
372 | - ); |
|
373 | - } |
|
374 | - return $transaction; |
|
375 | - } |
|
376 | - |
|
377 | - |
|
378 | - /** |
|
379 | - * get_ticket_line_item_for_transaction_registration |
|
380 | - * |
|
381 | - * @access public |
|
382 | - * @param EE_Transaction $transaction |
|
383 | - * @param EE_Registration $registration |
|
384 | - * @return EE_Line_Item |
|
385 | - * @throws EE_Error |
|
386 | - */ |
|
387 | - public function get_ticket_line_item_for_transaction_registration( |
|
388 | - EE_Transaction $transaction, |
|
389 | - EE_Registration $registration |
|
390 | - ) { |
|
391 | - EE_Registry::instance()->load_helper('Line_Item'); |
|
392 | - $ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction( |
|
393 | - $transaction->ID(), |
|
394 | - $registration->ticket_ID() |
|
395 | - ); |
|
396 | - if (! $ticket_line_item instanceof EE_Line_Item) { |
|
397 | - throw new EE_Error( |
|
398 | - sprintf( |
|
399 | - __( |
|
400 | - 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.', |
|
401 | - 'event_espresso' |
|
402 | - ), |
|
403 | - $transaction->ID(), |
|
404 | - $registration->ticket_ID() |
|
405 | - ) |
|
406 | - ); |
|
407 | - } |
|
408 | - return $ticket_line_item; |
|
409 | - } |
|
410 | - |
|
411 | - |
|
412 | - /** |
|
413 | - * cancel_transaction_if_all_registrations_canceled |
|
414 | - * cycles thru related registrations and checks their statuses |
|
415 | - * if ALL registrations are Cancelled or Declined, then this sets the TXN status to |
|
416 | - * |
|
417 | - * @access public |
|
418 | - * @param EE_Transaction $transaction |
|
419 | - * @param string $new_TXN_status |
|
420 | - * @param array $registration_query_params - array of query WHERE params to use when |
|
421 | - * retrieving cached registrations from a transaction |
|
422 | - * @param array $closed_reg_statuses |
|
423 | - * @param bool $update_txn |
|
424 | - * @return bool true if TXN status was updated, false if not |
|
425 | - */ |
|
426 | - public function toggle_transaction_status_if_all_registrations_canceled_or_declined( |
|
427 | - EE_Transaction $transaction, |
|
428 | - $new_TXN_status = '', |
|
429 | - $registration_query_params = array(), |
|
430 | - $closed_reg_statuses = array(), |
|
431 | - $update_txn = true |
|
432 | - ) { |
|
433 | - // make sure some query params are set for retrieving registrations |
|
434 | - $this->_set_registration_query_params($registration_query_params); |
|
435 | - // these reg statuses should not be considered in any calculations involving monies owing |
|
436 | - $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
437 | - : EEM_Registration::closed_reg_statuses(); |
|
438 | - // loop through cached registrations |
|
439 | - foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
440 | - if ($registration instanceof EE_Registration |
|
441 | - && ! in_array($registration->status_ID(), $closed_reg_statuses) |
|
442 | - ) { |
|
443 | - return false; |
|
444 | - } |
|
445 | - } |
|
446 | - if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) { |
|
447 | - $transaction->set_status($new_TXN_status); |
|
448 | - } |
|
449 | - if ($update_txn) { |
|
450 | - return $transaction->save() ? true : false; |
|
451 | - } |
|
452 | - return true; |
|
453 | - } |
|
454 | - |
|
455 | - |
|
456 | - /** |
|
457 | - * _call_method_on_registrations_via_Registration_Processor |
|
458 | - * cycles thru related registrations and calls the requested method on each |
|
459 | - * |
|
460 | - * @access private |
|
461 | - * @param string $method_name |
|
462 | - * @param EE_Transaction $transaction |
|
463 | - * @param array $registration_query_params array of query WHERE params to use |
|
464 | - * when retrieving cached registrations from a transaction |
|
465 | - * @param string $additional_param |
|
466 | - * @throws \EE_Error |
|
467 | - * @return boolean |
|
468 | - */ |
|
469 | - private function _call_method_on_registrations_via_Registration_Processor( |
|
470 | - $method_name, |
|
471 | - EE_Transaction $transaction, |
|
472 | - $registration_query_params = array(), |
|
473 | - $additional_param = null |
|
474 | - ) { |
|
475 | - $response = false; |
|
476 | - /** @type EE_Registration_Processor $registration_processor */ |
|
477 | - $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
478 | - // check that method exists |
|
479 | - if (! method_exists($registration_processor, $method_name)) { |
|
480 | - throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
481 | - } |
|
482 | - // make sure some query params are set for retrieving registrations |
|
483 | - $this->_set_registration_query_params($registration_query_params); |
|
484 | - // loop through cached registrations |
|
485 | - foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
486 | - if ($registration instanceof EE_Registration) { |
|
487 | - if ($additional_param) { |
|
488 | - $response = $registration_processor->{$method_name}($registration, $additional_param) |
|
489 | - ? true |
|
490 | - : $response; |
|
491 | - } else { |
|
492 | - $response = $registration_processor->{$method_name}($registration) |
|
493 | - ? true |
|
494 | - : $response; |
|
495 | - } |
|
496 | - } |
|
497 | - } |
|
498 | - return $response; |
|
499 | - } |
|
500 | - |
|
501 | - |
|
502 | - /** |
|
503 | - * set_transaction_payment_method_based_on_registration_statuses |
|
504 | - * sets or unsets the PMD_ID field on the TXN based on the related REG statuses |
|
505 | - * basically if ALL Registrations are "Not Approved", then the EE_Transaction.PMD_ID is set to null, |
|
506 | - * but if any Registration has a different status, then EE_Transaction.PMD_ID is set to either: |
|
507 | - * the first "default" Payment Method |
|
508 | - * the first active Payment Method |
|
509 | - * whichever is found first. |
|
510 | - * |
|
511 | - * @param EE_Registration $edited_registration |
|
512 | - * @return void |
|
513 | - * @throws \EE_Error |
|
514 | - */ |
|
515 | - public function set_transaction_payment_method_based_on_registration_statuses( |
|
516 | - EE_Registration $edited_registration |
|
517 | - ) { |
|
518 | - if ($edited_registration instanceof EE_Registration) { |
|
519 | - $transaction = $edited_registration->transaction(); |
|
520 | - if ($transaction instanceof EE_Transaction) { |
|
521 | - $all_not_approved = true; |
|
522 | - foreach ($transaction->registrations() as $registration) { |
|
523 | - if ($registration instanceof EE_Registration) { |
|
524 | - // if any REG != "Not Approved" then toggle to false |
|
525 | - $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
|
526 | - } |
|
527 | - } |
|
528 | - // if ALL Registrations are "Not Approved" |
|
529 | - if ($all_not_approved) { |
|
530 | - $transaction->set_payment_method_ID(null); |
|
531 | - $transaction->save(); |
|
532 | - } else { |
|
533 | - $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
|
534 | - $transaction, |
|
535 | - EEM_Payment_Method::scope_cart |
|
536 | - ); |
|
537 | - if (! empty($available_payment_methods)) { |
|
538 | - $PMD_ID = 0; |
|
539 | - foreach ($available_payment_methods as $available_payment_method) { |
|
540 | - if ($available_payment_method instanceof EE_Payment_Method |
|
541 | - && $available_payment_method->open_by_default() |
|
542 | - ) { |
|
543 | - $PMD_ID = $available_payment_method->ID(); |
|
544 | - break; |
|
545 | - } |
|
546 | - } |
|
547 | - if (! $PMD_ID) { |
|
548 | - $first_payment_method = reset($available_payment_methods); |
|
549 | - if ($first_payment_method instanceof EE_Payment_Method) { |
|
550 | - $PMD_ID = $first_payment_method->ID(); |
|
551 | - } else { |
|
552 | - EE_Error::add_error( |
|
553 | - __( |
|
554 | - 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', |
|
555 | - 'event_espresso' |
|
556 | - ), |
|
557 | - __FILE__, |
|
558 | - __LINE__, |
|
559 | - __FUNCTION__ |
|
560 | - ); |
|
561 | - } |
|
562 | - } |
|
563 | - $transaction->set_payment_method_ID($PMD_ID); |
|
564 | - $transaction->save(); |
|
565 | - } else { |
|
566 | - EE_Error::add_error( |
|
567 | - __( |
|
568 | - 'Please activate at least one Payment Method in order for things to operate correctly.', |
|
569 | - 'event_espresso' |
|
570 | - ), |
|
571 | - __FILE__, |
|
572 | - __LINE__, |
|
573 | - __FUNCTION__ |
|
574 | - ); |
|
575 | - } |
|
576 | - } |
|
577 | - } |
|
578 | - } |
|
579 | - } |
|
580 | - |
|
581 | - |
|
582 | - |
|
583 | - /********************************** DEPRECATED METHODS **********************************/ |
|
584 | - |
|
585 | - |
|
586 | - /** |
|
587 | - * @deprecated 4.9.12 |
|
588 | - * @return string |
|
589 | - */ |
|
590 | - public function old_txn_status() |
|
591 | - { |
|
592 | - EE_Error::doing_it_wrong( |
|
593 | - __METHOD__, |
|
594 | - esc_html__( |
|
595 | - 'This logic has been moved into \EE_Transaction::old_txn_status(), please use that method instead.', |
|
596 | - 'event_espresso' |
|
597 | - ), |
|
598 | - '4.9.12' |
|
599 | - ); |
|
600 | - return $this->_old_txn_status; |
|
601 | - } |
|
602 | - |
|
603 | - |
|
604 | - /** |
|
605 | - * @deprecated 4.9.12 |
|
606 | - * @param string $old_txn_status |
|
607 | - */ |
|
608 | - public function set_old_txn_status($old_txn_status) |
|
609 | - { |
|
610 | - EE_Error::doing_it_wrong( |
|
611 | - __METHOD__, |
|
612 | - esc_html__( |
|
613 | - 'This logic has been moved into \EE_Transaction::set_old_txn_status(), please use that method instead.', |
|
614 | - 'event_espresso' |
|
615 | - ), |
|
616 | - '4.9.12' |
|
617 | - ); |
|
618 | - // only set the first time |
|
619 | - if ($this->_old_txn_status === null) { |
|
620 | - $this->_old_txn_status = $old_txn_status; |
|
621 | - } |
|
622 | - } |
|
623 | - |
|
624 | - |
|
625 | - /** |
|
626 | - * @deprecated 4.9.12 |
|
627 | - * @return string |
|
628 | - */ |
|
629 | - public function new_txn_status() |
|
630 | - { |
|
631 | - EE_Error::doing_it_wrong( |
|
632 | - __METHOD__, |
|
633 | - esc_html__( |
|
634 | - 'This logic has been removed. Please just use \EE_Transaction::status_ID() instead.', |
|
635 | - 'event_espresso' |
|
636 | - ), |
|
637 | - '4.9.12' |
|
638 | - ); |
|
639 | - return $this->_new_txn_status; |
|
640 | - } |
|
641 | - |
|
642 | - |
|
643 | - /** |
|
644 | - * @deprecated 4.9.12 |
|
645 | - * @param string $new_txn_status |
|
646 | - */ |
|
647 | - public function set_new_txn_status($new_txn_status) |
|
648 | - { |
|
649 | - EE_Error::doing_it_wrong( |
|
650 | - __METHOD__, |
|
651 | - esc_html__( |
|
652 | - 'This logic has been removed. Please just use \EE_Transaction::set_status() instead.', |
|
653 | - 'event_espresso' |
|
654 | - ), |
|
655 | - '4.9.12' |
|
656 | - ); |
|
657 | - $this->_new_txn_status = $new_txn_status; |
|
658 | - } |
|
659 | - |
|
660 | - |
|
661 | - /** |
|
662 | - * reg_status_updated |
|
663 | - * |
|
664 | - * @deprecated 4.9.12 |
|
665 | - * @return bool |
|
666 | - */ |
|
667 | - public function txn_status_updated() |
|
668 | - { |
|
669 | - EE_Error::doing_it_wrong( |
|
670 | - __METHOD__, |
|
671 | - esc_html__( |
|
672 | - 'This logic has been moved into \EE_Transaction::txn_status_updated(), please use that method instead.', |
|
673 | - 'event_espresso' |
|
674 | - ), |
|
675 | - '4.9.12' |
|
676 | - ); |
|
677 | - return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
678 | - } |
|
679 | - |
|
680 | - |
|
681 | - /** |
|
682 | - * all_reg_steps_completed |
|
683 | - * returns: |
|
684 | - * true if ALL reg steps have been marked as completed |
|
685 | - * or false if any step is not completed |
|
686 | - * |
|
687 | - * @deprecated 4.9.12 |
|
688 | - * @param EE_Transaction $transaction |
|
689 | - * @return boolean |
|
690 | - */ |
|
691 | - public function all_reg_steps_completed(EE_Transaction $transaction) |
|
692 | - { |
|
693 | - EE_Error::doing_it_wrong( |
|
694 | - __METHOD__, |
|
695 | - esc_html__( |
|
696 | - 'This logic has been moved into \EE_Transaction::all_reg_steps_completed(), please use that method instead.', |
|
697 | - 'event_espresso' |
|
698 | - ), |
|
699 | - '4.9.12', |
|
700 | - '5.0.0' |
|
701 | - ); |
|
702 | - return $transaction->all_reg_steps_completed(); |
|
703 | - } |
|
704 | - |
|
705 | - |
|
706 | - /** |
|
707 | - * all_reg_steps_completed_except |
|
708 | - * returns: |
|
709 | - * true if ALL reg steps, except a particular step that you wish to skip over, have been marked as completed |
|
710 | - * or false if any other step is not completed |
|
711 | - * or false if ALL steps are completed including the exception you are testing !!! |
|
712 | - * |
|
713 | - * @deprecated 4.9.12 |
|
714 | - * @param EE_Transaction $transaction |
|
715 | - * @param string $exception |
|
716 | - * @return boolean |
|
717 | - */ |
|
718 | - public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') |
|
719 | - { |
|
720 | - EE_Error::doing_it_wrong( |
|
721 | - __METHOD__, |
|
722 | - esc_html__( |
|
723 | - 'This logic has been moved into \EE_Transaction::all_reg_steps_completed_except(), please use that method instead.', |
|
724 | - 'event_espresso' |
|
725 | - ), |
|
726 | - '4.9.12', |
|
727 | - '5.0.0' |
|
728 | - ); |
|
729 | - return $transaction->all_reg_steps_completed_except($exception); |
|
730 | - } |
|
731 | - |
|
732 | - |
|
733 | - /** |
|
734 | - * all_reg_steps_completed_except |
|
735 | - * returns: |
|
736 | - * true if ALL reg steps, except the final step, have been marked as completed |
|
737 | - * or false if any step is not completed |
|
738 | - * or false if ALL steps are completed including the final step !!! |
|
739 | - * |
|
740 | - * @deprecated 4.9.12 |
|
741 | - * @param EE_Transaction $transaction |
|
742 | - * @return boolean |
|
743 | - */ |
|
744 | - public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) |
|
745 | - { |
|
746 | - EE_Error::doing_it_wrong( |
|
747 | - __METHOD__, |
|
748 | - esc_html__( |
|
749 | - 'This logic has been moved into \EE_Transaction::all_reg_steps_completed_except_final_step(), please use that method instead.', |
|
750 | - 'event_espresso' |
|
751 | - ), |
|
752 | - '4.9.12', |
|
753 | - '5.0.0' |
|
754 | - ); |
|
755 | - return $transaction->all_reg_steps_completed_except_final_step(); |
|
756 | - } |
|
757 | - |
|
758 | - |
|
759 | - /** |
|
760 | - * reg_step_completed |
|
761 | - * returns: |
|
762 | - * true if a specific reg step has been marked as completed |
|
763 | - * a Unix timestamp if it has been initialized but not yet completed, |
|
764 | - * or false if it has not yet been initialized |
|
765 | - * |
|
766 | - * @deprecated 4.9.12 |
|
767 | - * @param EE_Transaction $transaction |
|
768 | - * @param string $reg_step_slug |
|
769 | - * @return boolean | int |
|
770 | - */ |
|
771 | - public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) |
|
772 | - { |
|
773 | - EE_Error::doing_it_wrong( |
|
774 | - __METHOD__, |
|
775 | - esc_html__( |
|
776 | - 'This logic has been moved into \EE_Transaction::reg_step_completed(), please use that method instead.', |
|
777 | - 'event_espresso' |
|
778 | - ), |
|
779 | - '4.9.12', |
|
780 | - '5.0.0' |
|
781 | - ); |
|
782 | - return $transaction->reg_step_completed($reg_step_slug); |
|
783 | - } |
|
784 | - |
|
785 | - |
|
786 | - /** |
|
787 | - * completed_final_reg_step |
|
788 | - * returns: |
|
789 | - * true if the finalize_registration reg step has been marked as completed |
|
790 | - * a Unix timestamp if it has been initialized but not yet completed, |
|
791 | - * or false if it has not yet been initialized |
|
792 | - * |
|
793 | - * @deprecated 4.9.12 |
|
794 | - * @param EE_Transaction $transaction |
|
795 | - * @return boolean | int |
|
796 | - */ |
|
797 | - public function final_reg_step_completed(EE_Transaction $transaction) |
|
798 | - { |
|
799 | - EE_Error::doing_it_wrong( |
|
800 | - __METHOD__, |
|
801 | - esc_html__( |
|
802 | - 'This logic has been moved into \EE_Transaction::final_reg_step_completed(), please use that method instead.', |
|
803 | - 'event_espresso' |
|
804 | - ), |
|
805 | - '4.9.12', |
|
806 | - '5.0.0' |
|
807 | - ); |
|
808 | - return $transaction->final_reg_step_completed(); |
|
809 | - } |
|
810 | - |
|
811 | - |
|
812 | - /** |
|
813 | - * set_reg_step_initiated |
|
814 | - * given a valid TXN_reg_step, this sets it's value to a unix timestamp |
|
815 | - * |
|
816 | - * @deprecated 4.9.12 |
|
817 | - * @access public |
|
818 | - * @param \EE_Transaction $transaction |
|
819 | - * @param string $reg_step_slug |
|
820 | - * @return boolean |
|
821 | - * @throws \EE_Error |
|
822 | - */ |
|
823 | - public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) |
|
824 | - { |
|
825 | - EE_Error::doing_it_wrong( |
|
826 | - __METHOD__, |
|
827 | - esc_html__( |
|
828 | - 'This logic has been moved into \EE_Transaction::set_reg_step_initiated(), please use that method instead.', |
|
829 | - 'event_espresso' |
|
830 | - ), |
|
831 | - '4.9.12', |
|
832 | - '5.0.0' |
|
833 | - ); |
|
834 | - return $transaction->set_reg_step_initiated($reg_step_slug); |
|
835 | - } |
|
836 | - |
|
837 | - |
|
838 | - /** |
|
839 | - * set_reg_step_completed |
|
840 | - * given a valid TXN_reg_step, this sets the step as completed |
|
841 | - * |
|
842 | - * @deprecated 4.9.12 |
|
843 | - * @access public |
|
844 | - * @param \EE_Transaction $transaction |
|
845 | - * @param string $reg_step_slug |
|
846 | - * @return boolean |
|
847 | - * @throws \EE_Error |
|
848 | - */ |
|
849 | - public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) |
|
850 | - { |
|
851 | - EE_Error::doing_it_wrong( |
|
852 | - __METHOD__, |
|
853 | - esc_html__( |
|
854 | - 'This logic has been moved into \EE_Transaction::set_reg_step_completed(), please use that method instead.', |
|
855 | - 'event_espresso' |
|
856 | - ), |
|
857 | - '4.9.12', |
|
858 | - '5.0.0' |
|
859 | - ); |
|
860 | - return $transaction->set_reg_step_completed($reg_step_slug); |
|
861 | - } |
|
862 | - |
|
863 | - |
|
864 | - /** |
|
865 | - * set_reg_step_completed |
|
866 | - * given a valid TXN_reg_step slug, this sets the step as NOT completed |
|
867 | - * |
|
868 | - * @deprecated 4.9.12 |
|
869 | - * @access public |
|
870 | - * @param \EE_Transaction $transaction |
|
871 | - * @param string $reg_step_slug |
|
872 | - * @return boolean |
|
873 | - * @throws \EE_Error |
|
874 | - */ |
|
875 | - public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) |
|
876 | - { |
|
877 | - EE_Error::doing_it_wrong( |
|
878 | - __METHOD__, |
|
879 | - esc_html__( |
|
880 | - 'This logic has been moved into \EE_Transaction::set_reg_step_not_completed(), please use that method instead.', |
|
881 | - 'event_espresso' |
|
882 | - ), |
|
883 | - '4.9.12', |
|
884 | - '5.0.0' |
|
885 | - ); |
|
886 | - return $transaction->set_reg_step_not_completed($reg_step_slug); |
|
887 | - } |
|
888 | - |
|
889 | - |
|
890 | - /** |
|
891 | - * remove_reg_step |
|
892 | - * given a valid TXN_reg_step slug, this will remove (unset) |
|
893 | - * the reg step from the TXN reg step array |
|
894 | - * |
|
895 | - * @deprecated 4.9.12 |
|
896 | - * @access public |
|
897 | - * @param \EE_Transaction $transaction |
|
898 | - * @param string $reg_step_slug |
|
899 | - * @return void |
|
900 | - */ |
|
901 | - public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) |
|
902 | - { |
|
903 | - EE_Error::doing_it_wrong( |
|
904 | - __METHOD__, |
|
905 | - esc_html__( |
|
906 | - 'This logic has been moved into \EE_Transaction::remove_reg_step(), please use that method instead.', |
|
907 | - 'event_espresso' |
|
908 | - ), |
|
909 | - '4.9.12', |
|
910 | - '5.0.0' |
|
911 | - ); |
|
912 | - $transaction->remove_reg_step($reg_step_slug); |
|
913 | - } |
|
914 | - |
|
915 | - |
|
916 | - /** |
|
917 | - * toggle_failed_transaction_status |
|
918 | - * upgrades a TXNs status from failed to abandoned, |
|
919 | - * meaning that contact information has been captured for at least one registrant |
|
920 | - * |
|
921 | - * @deprecated 4.9.12 |
|
922 | - * @access public |
|
923 | - * @param EE_Transaction $transaction |
|
924 | - * @return boolean |
|
925 | - * @throws \EE_Error |
|
926 | - */ |
|
927 | - public function toggle_failed_transaction_status(EE_Transaction $transaction) |
|
928 | - { |
|
929 | - EE_Error::doing_it_wrong( |
|
930 | - __METHOD__, |
|
931 | - esc_html__( |
|
932 | - 'This logic has been moved into \EE_Transaction::toggle_failed_transaction_status(), please use that method instead.', |
|
933 | - 'event_espresso' |
|
934 | - ), |
|
935 | - '4.9.12', |
|
936 | - '5.0.0' |
|
937 | - ); |
|
938 | - return $transaction->toggle_failed_transaction_status(); |
|
939 | - } |
|
940 | - |
|
941 | - |
|
942 | - /** |
|
943 | - * toggle_abandoned_transaction_status |
|
944 | - * upgrades a TXNs status from failed or abandoned to incomplete |
|
945 | - * |
|
946 | - * @deprecated 4.9.12 |
|
947 | - * @access public |
|
948 | - * @param EE_Transaction $transaction |
|
949 | - * @return boolean |
|
950 | - */ |
|
951 | - public function toggle_abandoned_transaction_status(EE_Transaction $transaction) |
|
952 | - { |
|
953 | - EE_Error::doing_it_wrong( |
|
954 | - __METHOD__, |
|
955 | - esc_html__( |
|
956 | - 'This logic has been moved into \EE_Transaction::toggle_abandoned_transaction_status(), please use that method instead.', |
|
957 | - 'event_espresso' |
|
958 | - ), |
|
959 | - '4.9.12', |
|
960 | - '5.0.0' |
|
961 | - ); |
|
962 | - return $transaction->toggle_abandoned_transaction_status(); |
|
963 | - } |
|
20 | + /** |
|
21 | + * @var EE_Registration_Processor $_instance |
|
22 | + * @access private |
|
23 | + */ |
|
24 | + private static $_instance; |
|
25 | + |
|
26 | + /** |
|
27 | + * array of query WHERE params to use when retrieving cached registrations from a transaction |
|
28 | + * |
|
29 | + * @var array $registration_query_params |
|
30 | + * @access private |
|
31 | + */ |
|
32 | + private $_registration_query_params = array(); |
|
33 | + |
|
34 | + /** |
|
35 | + * @deprecated |
|
36 | + * @var string |
|
37 | + */ |
|
38 | + protected $_old_txn_status; |
|
39 | + |
|
40 | + /** |
|
41 | + * @deprecated |
|
42 | + * @var string |
|
43 | + */ |
|
44 | + protected $_new_txn_status; |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * @singleton method used to instantiate class object |
|
49 | + * @access public |
|
50 | + * @param array $registration_query_params |
|
51 | + * @return EE_Transaction_Processor instance |
|
52 | + */ |
|
53 | + public static function instance($registration_query_params = array()) |
|
54 | + { |
|
55 | + // check if class object is instantiated |
|
56 | + if (! self::$_instance instanceof EE_Transaction_Processor) { |
|
57 | + self::$_instance = new self($registration_query_params); |
|
58 | + } |
|
59 | + return self::$_instance; |
|
60 | + } |
|
61 | + |
|
62 | + |
|
63 | + /** |
|
64 | + * @param array $registration_query_params |
|
65 | + */ |
|
66 | + private function __construct($registration_query_params = array()) |
|
67 | + { |
|
68 | + // make sure some query params are set for retrieving registrations |
|
69 | + $this->_set_registration_query_params($registration_query_params); |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * @access private |
|
75 | + * @param array $registration_query_params |
|
76 | + */ |
|
77 | + private function _set_registration_query_params($registration_query_params) |
|
78 | + { |
|
79 | + $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params |
|
80 | + : array('order_by' => array('REG_count' => 'ASC')); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * manually_update_registration_statuses |
|
86 | + * |
|
87 | + * @access public |
|
88 | + * @param EE_Transaction $transaction |
|
89 | + * @param string $new_reg_status |
|
90 | + * @param array $registration_query_params array of query WHERE params to use |
|
91 | + * when retrieving cached registrations from a transaction |
|
92 | + * @return boolean |
|
93 | + * @throws \EE_Error |
|
94 | + */ |
|
95 | + public function manually_update_registration_statuses( |
|
96 | + EE_Transaction $transaction, |
|
97 | + $new_reg_status = '', |
|
98 | + $registration_query_params = array() |
|
99 | + ) { |
|
100 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( |
|
101 | + 'manually_update_registration_status', |
|
102 | + $transaction, |
|
103 | + $registration_query_params, |
|
104 | + $new_reg_status |
|
105 | + ); |
|
106 | + // send messages |
|
107 | + /** @type EE_Registration_Processor $registration_processor */ |
|
108 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
109 | + $registration_processor->trigger_registration_update_notifications( |
|
110 | + $transaction->primary_registration(), |
|
111 | + array('manually_updated' => true) |
|
112 | + ); |
|
113 | + do_action( |
|
114 | + 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', |
|
115 | + $transaction, |
|
116 | + $status_updates |
|
117 | + ); |
|
118 | + return $status_updates; |
|
119 | + } |
|
120 | + |
|
121 | + |
|
122 | + /** |
|
123 | + * toggle_registration_statuses_for_default_approved_events |
|
124 | + * |
|
125 | + * @access public |
|
126 | + * @param EE_Transaction $transaction |
|
127 | + * @param array $registration_query_params array of query WHERE params to use |
|
128 | + * when retrieving cached registrations from a transaction |
|
129 | + * @return boolean |
|
130 | + * @throws \EE_Error |
|
131 | + */ |
|
132 | + public function toggle_registration_statuses_for_default_approved_events( |
|
133 | + EE_Transaction $transaction, |
|
134 | + $registration_query_params = array() |
|
135 | + ) { |
|
136 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( |
|
137 | + 'toggle_registration_status_for_default_approved_events', |
|
138 | + $transaction, |
|
139 | + $registration_query_params |
|
140 | + ); |
|
141 | + do_action( |
|
142 | + 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', |
|
143 | + $transaction, |
|
144 | + $status_updates |
|
145 | + ); |
|
146 | + return $status_updates; |
|
147 | + } |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * toggle_registration_statuses_if_no_monies_owing |
|
152 | + * |
|
153 | + * @access public |
|
154 | + * @param EE_Transaction $transaction |
|
155 | + * @param array $registration_query_params array of query WHERE params to use |
|
156 | + * when retrieving cached registrations from a transaction |
|
157 | + * @return boolean |
|
158 | + * @throws \EE_Error |
|
159 | + */ |
|
160 | + public function toggle_registration_statuses_if_no_monies_owing( |
|
161 | + EE_Transaction $transaction, |
|
162 | + $registration_query_params = array() |
|
163 | + ) { |
|
164 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( |
|
165 | + 'toggle_registration_status_if_no_monies_owing', |
|
166 | + $transaction, |
|
167 | + $registration_query_params |
|
168 | + ); |
|
169 | + do_action( |
|
170 | + 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', |
|
171 | + $transaction, |
|
172 | + $status_updates |
|
173 | + ); |
|
174 | + return $status_updates; |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * update_transaction_and_registrations_after_checkout_or_payment |
|
180 | + * cycles thru related registrations and calls update_registration_after_checkout_or_payment() on each |
|
181 | + * |
|
182 | + * @param EE_Transaction $transaction |
|
183 | + * @param \EE_Payment | NULL $payment |
|
184 | + * @param array $registration_query_params array of query WHERE params to use |
|
185 | + * when retrieving cached registrations from a transaction |
|
186 | + * @param bool $trigger_notifications whether or not to call |
|
187 | + * \EE_Registration_Processor::trigger_registration_update_notifications() |
|
188 | + * @return array |
|
189 | + * @throws \EE_Error |
|
190 | + */ |
|
191 | + public function update_transaction_and_registrations_after_checkout_or_payment( |
|
192 | + EE_Transaction $transaction, |
|
193 | + $payment = null, |
|
194 | + $registration_query_params = array(), |
|
195 | + $trigger_notifications = true |
|
196 | + ) { |
|
197 | + // make sure some query params are set for retrieving registrations |
|
198 | + $this->_set_registration_query_params($registration_query_params); |
|
199 | + // get final reg step status |
|
200 | + $finalized = $transaction->final_reg_step_completed(); |
|
201 | + // if the 'finalize_registration' step has been initiated (has a timestamp) |
|
202 | + // but has not yet been fully completed (TRUE) |
|
203 | + if (is_int($finalized) && $finalized !== false && $finalized !== true) { |
|
204 | + $transaction->set_reg_step_completed('finalize_registration'); |
|
205 | + $finalized = true; |
|
206 | + } |
|
207 | + $transaction->save(); |
|
208 | + // array of details to aid in decision making by systems |
|
209 | + $update_params = array( |
|
210 | + 'old_txn_status' => $transaction->old_txn_status(), |
|
211 | + 'new_txn_status' => $transaction->status_ID(), |
|
212 | + 'finalized' => $finalized, |
|
213 | + 'revisit' => $this->_revisit, |
|
214 | + 'payment_updates' => $payment instanceof EE_Payment ? true : false, |
|
215 | + 'last_payment' => $payment, |
|
216 | + ); |
|
217 | + // now update the registrations and add the results to our $update_params |
|
218 | + $update_params['status_updates'] = $this->_call_method_on_registrations_via_Registration_Processor( |
|
219 | + 'update_registration_after_checkout_or_payment', |
|
220 | + $transaction, |
|
221 | + $this->_registration_query_params, |
|
222 | + $update_params |
|
223 | + ); |
|
224 | + if ($trigger_notifications) { |
|
225 | + // send messages |
|
226 | + /** @type EE_Registration_Processor $registration_processor */ |
|
227 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
228 | + $registration_processor->trigger_registration_update_notifications( |
|
229 | + $transaction->primary_registration(), |
|
230 | + $update_params |
|
231 | + ); |
|
232 | + } |
|
233 | + do_action( |
|
234 | + 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', |
|
235 | + $transaction, |
|
236 | + $update_params |
|
237 | + ); |
|
238 | + return $update_params; |
|
239 | + } |
|
240 | + |
|
241 | + |
|
242 | + /** |
|
243 | + * update_transaction_after_registration_reopened |
|
244 | + * readjusts TXN and Line Item totals after a registration is changed from |
|
245 | + * cancelled or declined to another reg status such as pending payment or approved |
|
246 | + * |
|
247 | + * @param \EE_Registration $registration |
|
248 | + * @param array $closed_reg_statuses |
|
249 | + * @param bool $update_txn |
|
250 | + * @return bool |
|
251 | + * @throws \EE_Error |
|
252 | + */ |
|
253 | + public function update_transaction_after_reinstating_canceled_registration( |
|
254 | + EE_Registration $registration, |
|
255 | + $closed_reg_statuses = array(), |
|
256 | + $update_txn = true |
|
257 | + ) { |
|
258 | + // these reg statuses should not be considered in any calculations involving monies owing |
|
259 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
260 | + : EEM_Registration::closed_reg_statuses(); |
|
261 | + if (in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
262 | + return false; |
|
263 | + } |
|
264 | + try { |
|
265 | + $transaction = $this->get_transaction_for_registration($registration); |
|
266 | + $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( |
|
267 | + $transaction, |
|
268 | + $registration |
|
269 | + ); |
|
270 | + // un-cancel the ticket |
|
271 | + $success = EEH_Line_Item::reinstate_canceled_ticket_line_item($ticket_line_item); |
|
272 | + } catch (EE_Error $e) { |
|
273 | + EE_Error::add_error( |
|
274 | + sprintf( |
|
275 | + __( |
|
276 | + 'The Ticket Line Item for Registration %1$d could not be reinstated because :%2$s%3$s', |
|
277 | + 'event_espresso' |
|
278 | + ), |
|
279 | + $registration->ID(), |
|
280 | + '<br />', |
|
281 | + $e->getMessage() |
|
282 | + ), |
|
283 | + __FILE__, |
|
284 | + __FUNCTION__, |
|
285 | + __LINE__ |
|
286 | + ); |
|
287 | + return false; |
|
288 | + } |
|
289 | + if ($update_txn) { |
|
290 | + return $transaction->save() ? $success : false; |
|
291 | + } |
|
292 | + return $success; |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + /** |
|
297 | + * update_transaction_after_canceled_or_declined_registration |
|
298 | + * readjusts TXN and Line Item totals after a registration is cancelled or declined |
|
299 | + * |
|
300 | + * @param \EE_Registration $registration |
|
301 | + * @param array $closed_reg_statuses |
|
302 | + * @param bool $update_txn |
|
303 | + * @return bool |
|
304 | + * @throws \EE_Error |
|
305 | + */ |
|
306 | + public function update_transaction_after_canceled_or_declined_registration( |
|
307 | + EE_Registration $registration, |
|
308 | + $closed_reg_statuses = array(), |
|
309 | + $update_txn = true |
|
310 | + ) { |
|
311 | + // these reg statuses should not be considered in any calculations involving monies owing |
|
312 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
313 | + : EEM_Registration::closed_reg_statuses(); |
|
314 | + if (! in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
315 | + return false; |
|
316 | + } |
|
317 | + try { |
|
318 | + $transaction = $this->get_transaction_for_registration($registration); |
|
319 | + if (apply_filters( |
|
320 | + 'FHEE__EE_Transaction_Processor__update_transaction_after_canceled_or_declined_registration__cancel_ticket_line_item', |
|
321 | + true, |
|
322 | + $registration, |
|
323 | + $transaction |
|
324 | + )) { |
|
325 | + $ticket_line_item = $this->get_ticket_line_item_for_transaction_registration( |
|
326 | + $transaction, |
|
327 | + $registration |
|
328 | + ); |
|
329 | + EEH_Line_Item::cancel_ticket_line_item($ticket_line_item); |
|
330 | + } |
|
331 | + } catch (EE_Error $e) { |
|
332 | + EE_Error::add_error( |
|
333 | + sprintf( |
|
334 | + __( |
|
335 | + 'The Ticket Line Item for Registration %1$d could not be cancelled because :%2$s%3$s', |
|
336 | + 'event_espresso' |
|
337 | + ), |
|
338 | + $registration->ID(), |
|
339 | + '<br />', |
|
340 | + $e->getMessage() |
|
341 | + ), |
|
342 | + __FILE__, |
|
343 | + __FUNCTION__, |
|
344 | + __LINE__ |
|
345 | + ); |
|
346 | + return false; |
|
347 | + } |
|
348 | + if ($update_txn) { |
|
349 | + return $transaction->save() ? true : false; |
|
350 | + } |
|
351 | + return true; |
|
352 | + } |
|
353 | + |
|
354 | + |
|
355 | + /** |
|
356 | + * get_transaction_for_registration |
|
357 | + * |
|
358 | + * @access public |
|
359 | + * @param EE_Registration $registration |
|
360 | + * @return EE_Transaction |
|
361 | + * @throws EE_Error |
|
362 | + */ |
|
363 | + public function get_transaction_for_registration(EE_Registration $registration) |
|
364 | + { |
|
365 | + $transaction = $registration->transaction(); |
|
366 | + if (! $transaction instanceof EE_Transaction) { |
|
367 | + throw new EE_Error( |
|
368 | + sprintf( |
|
369 | + __('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'), |
|
370 | + $registration->ID() |
|
371 | + ) |
|
372 | + ); |
|
373 | + } |
|
374 | + return $transaction; |
|
375 | + } |
|
376 | + |
|
377 | + |
|
378 | + /** |
|
379 | + * get_ticket_line_item_for_transaction_registration |
|
380 | + * |
|
381 | + * @access public |
|
382 | + * @param EE_Transaction $transaction |
|
383 | + * @param EE_Registration $registration |
|
384 | + * @return EE_Line_Item |
|
385 | + * @throws EE_Error |
|
386 | + */ |
|
387 | + public function get_ticket_line_item_for_transaction_registration( |
|
388 | + EE_Transaction $transaction, |
|
389 | + EE_Registration $registration |
|
390 | + ) { |
|
391 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
392 | + $ticket_line_item = EEM_Line_Item::instance()->get_ticket_line_item_for_transaction( |
|
393 | + $transaction->ID(), |
|
394 | + $registration->ticket_ID() |
|
395 | + ); |
|
396 | + if (! $ticket_line_item instanceof EE_Line_Item) { |
|
397 | + throw new EE_Error( |
|
398 | + sprintf( |
|
399 | + __( |
|
400 | + 'The Line Item for Transaction %1$d and Ticket %2$d was not found or is invalid.', |
|
401 | + 'event_espresso' |
|
402 | + ), |
|
403 | + $transaction->ID(), |
|
404 | + $registration->ticket_ID() |
|
405 | + ) |
|
406 | + ); |
|
407 | + } |
|
408 | + return $ticket_line_item; |
|
409 | + } |
|
410 | + |
|
411 | + |
|
412 | + /** |
|
413 | + * cancel_transaction_if_all_registrations_canceled |
|
414 | + * cycles thru related registrations and checks their statuses |
|
415 | + * if ALL registrations are Cancelled or Declined, then this sets the TXN status to |
|
416 | + * |
|
417 | + * @access public |
|
418 | + * @param EE_Transaction $transaction |
|
419 | + * @param string $new_TXN_status |
|
420 | + * @param array $registration_query_params - array of query WHERE params to use when |
|
421 | + * retrieving cached registrations from a transaction |
|
422 | + * @param array $closed_reg_statuses |
|
423 | + * @param bool $update_txn |
|
424 | + * @return bool true if TXN status was updated, false if not |
|
425 | + */ |
|
426 | + public function toggle_transaction_status_if_all_registrations_canceled_or_declined( |
|
427 | + EE_Transaction $transaction, |
|
428 | + $new_TXN_status = '', |
|
429 | + $registration_query_params = array(), |
|
430 | + $closed_reg_statuses = array(), |
|
431 | + $update_txn = true |
|
432 | + ) { |
|
433 | + // make sure some query params are set for retrieving registrations |
|
434 | + $this->_set_registration_query_params($registration_query_params); |
|
435 | + // these reg statuses should not be considered in any calculations involving monies owing |
|
436 | + $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
|
437 | + : EEM_Registration::closed_reg_statuses(); |
|
438 | + // loop through cached registrations |
|
439 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
440 | + if ($registration instanceof EE_Registration |
|
441 | + && ! in_array($registration->status_ID(), $closed_reg_statuses) |
|
442 | + ) { |
|
443 | + return false; |
|
444 | + } |
|
445 | + } |
|
446 | + if (in_array($new_TXN_status, EEM_Transaction::txn_status_array())) { |
|
447 | + $transaction->set_status($new_TXN_status); |
|
448 | + } |
|
449 | + if ($update_txn) { |
|
450 | + return $transaction->save() ? true : false; |
|
451 | + } |
|
452 | + return true; |
|
453 | + } |
|
454 | + |
|
455 | + |
|
456 | + /** |
|
457 | + * _call_method_on_registrations_via_Registration_Processor |
|
458 | + * cycles thru related registrations and calls the requested method on each |
|
459 | + * |
|
460 | + * @access private |
|
461 | + * @param string $method_name |
|
462 | + * @param EE_Transaction $transaction |
|
463 | + * @param array $registration_query_params array of query WHERE params to use |
|
464 | + * when retrieving cached registrations from a transaction |
|
465 | + * @param string $additional_param |
|
466 | + * @throws \EE_Error |
|
467 | + * @return boolean |
|
468 | + */ |
|
469 | + private function _call_method_on_registrations_via_Registration_Processor( |
|
470 | + $method_name, |
|
471 | + EE_Transaction $transaction, |
|
472 | + $registration_query_params = array(), |
|
473 | + $additional_param = null |
|
474 | + ) { |
|
475 | + $response = false; |
|
476 | + /** @type EE_Registration_Processor $registration_processor */ |
|
477 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
478 | + // check that method exists |
|
479 | + if (! method_exists($registration_processor, $method_name)) { |
|
480 | + throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
481 | + } |
|
482 | + // make sure some query params are set for retrieving registrations |
|
483 | + $this->_set_registration_query_params($registration_query_params); |
|
484 | + // loop through cached registrations |
|
485 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
486 | + if ($registration instanceof EE_Registration) { |
|
487 | + if ($additional_param) { |
|
488 | + $response = $registration_processor->{$method_name}($registration, $additional_param) |
|
489 | + ? true |
|
490 | + : $response; |
|
491 | + } else { |
|
492 | + $response = $registration_processor->{$method_name}($registration) |
|
493 | + ? true |
|
494 | + : $response; |
|
495 | + } |
|
496 | + } |
|
497 | + } |
|
498 | + return $response; |
|
499 | + } |
|
500 | + |
|
501 | + |
|
502 | + /** |
|
503 | + * set_transaction_payment_method_based_on_registration_statuses |
|
504 | + * sets or unsets the PMD_ID field on the TXN based on the related REG statuses |
|
505 | + * basically if ALL Registrations are "Not Approved", then the EE_Transaction.PMD_ID is set to null, |
|
506 | + * but if any Registration has a different status, then EE_Transaction.PMD_ID is set to either: |
|
507 | + * the first "default" Payment Method |
|
508 | + * the first active Payment Method |
|
509 | + * whichever is found first. |
|
510 | + * |
|
511 | + * @param EE_Registration $edited_registration |
|
512 | + * @return void |
|
513 | + * @throws \EE_Error |
|
514 | + */ |
|
515 | + public function set_transaction_payment_method_based_on_registration_statuses( |
|
516 | + EE_Registration $edited_registration |
|
517 | + ) { |
|
518 | + if ($edited_registration instanceof EE_Registration) { |
|
519 | + $transaction = $edited_registration->transaction(); |
|
520 | + if ($transaction instanceof EE_Transaction) { |
|
521 | + $all_not_approved = true; |
|
522 | + foreach ($transaction->registrations() as $registration) { |
|
523 | + if ($registration instanceof EE_Registration) { |
|
524 | + // if any REG != "Not Approved" then toggle to false |
|
525 | + $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
|
526 | + } |
|
527 | + } |
|
528 | + // if ALL Registrations are "Not Approved" |
|
529 | + if ($all_not_approved) { |
|
530 | + $transaction->set_payment_method_ID(null); |
|
531 | + $transaction->save(); |
|
532 | + } else { |
|
533 | + $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
|
534 | + $transaction, |
|
535 | + EEM_Payment_Method::scope_cart |
|
536 | + ); |
|
537 | + if (! empty($available_payment_methods)) { |
|
538 | + $PMD_ID = 0; |
|
539 | + foreach ($available_payment_methods as $available_payment_method) { |
|
540 | + if ($available_payment_method instanceof EE_Payment_Method |
|
541 | + && $available_payment_method->open_by_default() |
|
542 | + ) { |
|
543 | + $PMD_ID = $available_payment_method->ID(); |
|
544 | + break; |
|
545 | + } |
|
546 | + } |
|
547 | + if (! $PMD_ID) { |
|
548 | + $first_payment_method = reset($available_payment_methods); |
|
549 | + if ($first_payment_method instanceof EE_Payment_Method) { |
|
550 | + $PMD_ID = $first_payment_method->ID(); |
|
551 | + } else { |
|
552 | + EE_Error::add_error( |
|
553 | + __( |
|
554 | + 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', |
|
555 | + 'event_espresso' |
|
556 | + ), |
|
557 | + __FILE__, |
|
558 | + __LINE__, |
|
559 | + __FUNCTION__ |
|
560 | + ); |
|
561 | + } |
|
562 | + } |
|
563 | + $transaction->set_payment_method_ID($PMD_ID); |
|
564 | + $transaction->save(); |
|
565 | + } else { |
|
566 | + EE_Error::add_error( |
|
567 | + __( |
|
568 | + 'Please activate at least one Payment Method in order for things to operate correctly.', |
|
569 | + 'event_espresso' |
|
570 | + ), |
|
571 | + __FILE__, |
|
572 | + __LINE__, |
|
573 | + __FUNCTION__ |
|
574 | + ); |
|
575 | + } |
|
576 | + } |
|
577 | + } |
|
578 | + } |
|
579 | + } |
|
580 | + |
|
581 | + |
|
582 | + |
|
583 | + /********************************** DEPRECATED METHODS **********************************/ |
|
584 | + |
|
585 | + |
|
586 | + /** |
|
587 | + * @deprecated 4.9.12 |
|
588 | + * @return string |
|
589 | + */ |
|
590 | + public function old_txn_status() |
|
591 | + { |
|
592 | + EE_Error::doing_it_wrong( |
|
593 | + __METHOD__, |
|
594 | + esc_html__( |
|
595 | + 'This logic has been moved into \EE_Transaction::old_txn_status(), please use that method instead.', |
|
596 | + 'event_espresso' |
|
597 | + ), |
|
598 | + '4.9.12' |
|
599 | + ); |
|
600 | + return $this->_old_txn_status; |
|
601 | + } |
|
602 | + |
|
603 | + |
|
604 | + /** |
|
605 | + * @deprecated 4.9.12 |
|
606 | + * @param string $old_txn_status |
|
607 | + */ |
|
608 | + public function set_old_txn_status($old_txn_status) |
|
609 | + { |
|
610 | + EE_Error::doing_it_wrong( |
|
611 | + __METHOD__, |
|
612 | + esc_html__( |
|
613 | + 'This logic has been moved into \EE_Transaction::set_old_txn_status(), please use that method instead.', |
|
614 | + 'event_espresso' |
|
615 | + ), |
|
616 | + '4.9.12' |
|
617 | + ); |
|
618 | + // only set the first time |
|
619 | + if ($this->_old_txn_status === null) { |
|
620 | + $this->_old_txn_status = $old_txn_status; |
|
621 | + } |
|
622 | + } |
|
623 | + |
|
624 | + |
|
625 | + /** |
|
626 | + * @deprecated 4.9.12 |
|
627 | + * @return string |
|
628 | + */ |
|
629 | + public function new_txn_status() |
|
630 | + { |
|
631 | + EE_Error::doing_it_wrong( |
|
632 | + __METHOD__, |
|
633 | + esc_html__( |
|
634 | + 'This logic has been removed. Please just use \EE_Transaction::status_ID() instead.', |
|
635 | + 'event_espresso' |
|
636 | + ), |
|
637 | + '4.9.12' |
|
638 | + ); |
|
639 | + return $this->_new_txn_status; |
|
640 | + } |
|
641 | + |
|
642 | + |
|
643 | + /** |
|
644 | + * @deprecated 4.9.12 |
|
645 | + * @param string $new_txn_status |
|
646 | + */ |
|
647 | + public function set_new_txn_status($new_txn_status) |
|
648 | + { |
|
649 | + EE_Error::doing_it_wrong( |
|
650 | + __METHOD__, |
|
651 | + esc_html__( |
|
652 | + 'This logic has been removed. Please just use \EE_Transaction::set_status() instead.', |
|
653 | + 'event_espresso' |
|
654 | + ), |
|
655 | + '4.9.12' |
|
656 | + ); |
|
657 | + $this->_new_txn_status = $new_txn_status; |
|
658 | + } |
|
659 | + |
|
660 | + |
|
661 | + /** |
|
662 | + * reg_status_updated |
|
663 | + * |
|
664 | + * @deprecated 4.9.12 |
|
665 | + * @return bool |
|
666 | + */ |
|
667 | + public function txn_status_updated() |
|
668 | + { |
|
669 | + EE_Error::doing_it_wrong( |
|
670 | + __METHOD__, |
|
671 | + esc_html__( |
|
672 | + 'This logic has been moved into \EE_Transaction::txn_status_updated(), please use that method instead.', |
|
673 | + 'event_espresso' |
|
674 | + ), |
|
675 | + '4.9.12' |
|
676 | + ); |
|
677 | + return $this->_new_txn_status !== $this->_old_txn_status && $this->_old_txn_status !== null ? true : false; |
|
678 | + } |
|
679 | + |
|
680 | + |
|
681 | + /** |
|
682 | + * all_reg_steps_completed |
|
683 | + * returns: |
|
684 | + * true if ALL reg steps have been marked as completed |
|
685 | + * or false if any step is not completed |
|
686 | + * |
|
687 | + * @deprecated 4.9.12 |
|
688 | + * @param EE_Transaction $transaction |
|
689 | + * @return boolean |
|
690 | + */ |
|
691 | + public function all_reg_steps_completed(EE_Transaction $transaction) |
|
692 | + { |
|
693 | + EE_Error::doing_it_wrong( |
|
694 | + __METHOD__, |
|
695 | + esc_html__( |
|
696 | + 'This logic has been moved into \EE_Transaction::all_reg_steps_completed(), please use that method instead.', |
|
697 | + 'event_espresso' |
|
698 | + ), |
|
699 | + '4.9.12', |
|
700 | + '5.0.0' |
|
701 | + ); |
|
702 | + return $transaction->all_reg_steps_completed(); |
|
703 | + } |
|
704 | + |
|
705 | + |
|
706 | + /** |
|
707 | + * all_reg_steps_completed_except |
|
708 | + * returns: |
|
709 | + * true if ALL reg steps, except a particular step that you wish to skip over, have been marked as completed |
|
710 | + * or false if any other step is not completed |
|
711 | + * or false if ALL steps are completed including the exception you are testing !!! |
|
712 | + * |
|
713 | + * @deprecated 4.9.12 |
|
714 | + * @param EE_Transaction $transaction |
|
715 | + * @param string $exception |
|
716 | + * @return boolean |
|
717 | + */ |
|
718 | + public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') |
|
719 | + { |
|
720 | + EE_Error::doing_it_wrong( |
|
721 | + __METHOD__, |
|
722 | + esc_html__( |
|
723 | + 'This logic has been moved into \EE_Transaction::all_reg_steps_completed_except(), please use that method instead.', |
|
724 | + 'event_espresso' |
|
725 | + ), |
|
726 | + '4.9.12', |
|
727 | + '5.0.0' |
|
728 | + ); |
|
729 | + return $transaction->all_reg_steps_completed_except($exception); |
|
730 | + } |
|
731 | + |
|
732 | + |
|
733 | + /** |
|
734 | + * all_reg_steps_completed_except |
|
735 | + * returns: |
|
736 | + * true if ALL reg steps, except the final step, have been marked as completed |
|
737 | + * or false if any step is not completed |
|
738 | + * or false if ALL steps are completed including the final step !!! |
|
739 | + * |
|
740 | + * @deprecated 4.9.12 |
|
741 | + * @param EE_Transaction $transaction |
|
742 | + * @return boolean |
|
743 | + */ |
|
744 | + public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) |
|
745 | + { |
|
746 | + EE_Error::doing_it_wrong( |
|
747 | + __METHOD__, |
|
748 | + esc_html__( |
|
749 | + 'This logic has been moved into \EE_Transaction::all_reg_steps_completed_except_final_step(), please use that method instead.', |
|
750 | + 'event_espresso' |
|
751 | + ), |
|
752 | + '4.9.12', |
|
753 | + '5.0.0' |
|
754 | + ); |
|
755 | + return $transaction->all_reg_steps_completed_except_final_step(); |
|
756 | + } |
|
757 | + |
|
758 | + |
|
759 | + /** |
|
760 | + * reg_step_completed |
|
761 | + * returns: |
|
762 | + * true if a specific reg step has been marked as completed |
|
763 | + * a Unix timestamp if it has been initialized but not yet completed, |
|
764 | + * or false if it has not yet been initialized |
|
765 | + * |
|
766 | + * @deprecated 4.9.12 |
|
767 | + * @param EE_Transaction $transaction |
|
768 | + * @param string $reg_step_slug |
|
769 | + * @return boolean | int |
|
770 | + */ |
|
771 | + public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) |
|
772 | + { |
|
773 | + EE_Error::doing_it_wrong( |
|
774 | + __METHOD__, |
|
775 | + esc_html__( |
|
776 | + 'This logic has been moved into \EE_Transaction::reg_step_completed(), please use that method instead.', |
|
777 | + 'event_espresso' |
|
778 | + ), |
|
779 | + '4.9.12', |
|
780 | + '5.0.0' |
|
781 | + ); |
|
782 | + return $transaction->reg_step_completed($reg_step_slug); |
|
783 | + } |
|
784 | + |
|
785 | + |
|
786 | + /** |
|
787 | + * completed_final_reg_step |
|
788 | + * returns: |
|
789 | + * true if the finalize_registration reg step has been marked as completed |
|
790 | + * a Unix timestamp if it has been initialized but not yet completed, |
|
791 | + * or false if it has not yet been initialized |
|
792 | + * |
|
793 | + * @deprecated 4.9.12 |
|
794 | + * @param EE_Transaction $transaction |
|
795 | + * @return boolean | int |
|
796 | + */ |
|
797 | + public function final_reg_step_completed(EE_Transaction $transaction) |
|
798 | + { |
|
799 | + EE_Error::doing_it_wrong( |
|
800 | + __METHOD__, |
|
801 | + esc_html__( |
|
802 | + 'This logic has been moved into \EE_Transaction::final_reg_step_completed(), please use that method instead.', |
|
803 | + 'event_espresso' |
|
804 | + ), |
|
805 | + '4.9.12', |
|
806 | + '5.0.0' |
|
807 | + ); |
|
808 | + return $transaction->final_reg_step_completed(); |
|
809 | + } |
|
810 | + |
|
811 | + |
|
812 | + /** |
|
813 | + * set_reg_step_initiated |
|
814 | + * given a valid TXN_reg_step, this sets it's value to a unix timestamp |
|
815 | + * |
|
816 | + * @deprecated 4.9.12 |
|
817 | + * @access public |
|
818 | + * @param \EE_Transaction $transaction |
|
819 | + * @param string $reg_step_slug |
|
820 | + * @return boolean |
|
821 | + * @throws \EE_Error |
|
822 | + */ |
|
823 | + public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) |
|
824 | + { |
|
825 | + EE_Error::doing_it_wrong( |
|
826 | + __METHOD__, |
|
827 | + esc_html__( |
|
828 | + 'This logic has been moved into \EE_Transaction::set_reg_step_initiated(), please use that method instead.', |
|
829 | + 'event_espresso' |
|
830 | + ), |
|
831 | + '4.9.12', |
|
832 | + '5.0.0' |
|
833 | + ); |
|
834 | + return $transaction->set_reg_step_initiated($reg_step_slug); |
|
835 | + } |
|
836 | + |
|
837 | + |
|
838 | + /** |
|
839 | + * set_reg_step_completed |
|
840 | + * given a valid TXN_reg_step, this sets the step as completed |
|
841 | + * |
|
842 | + * @deprecated 4.9.12 |
|
843 | + * @access public |
|
844 | + * @param \EE_Transaction $transaction |
|
845 | + * @param string $reg_step_slug |
|
846 | + * @return boolean |
|
847 | + * @throws \EE_Error |
|
848 | + */ |
|
849 | + public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) |
|
850 | + { |
|
851 | + EE_Error::doing_it_wrong( |
|
852 | + __METHOD__, |
|
853 | + esc_html__( |
|
854 | + 'This logic has been moved into \EE_Transaction::set_reg_step_completed(), please use that method instead.', |
|
855 | + 'event_espresso' |
|
856 | + ), |
|
857 | + '4.9.12', |
|
858 | + '5.0.0' |
|
859 | + ); |
|
860 | + return $transaction->set_reg_step_completed($reg_step_slug); |
|
861 | + } |
|
862 | + |
|
863 | + |
|
864 | + /** |
|
865 | + * set_reg_step_completed |
|
866 | + * given a valid TXN_reg_step slug, this sets the step as NOT completed |
|
867 | + * |
|
868 | + * @deprecated 4.9.12 |
|
869 | + * @access public |
|
870 | + * @param \EE_Transaction $transaction |
|
871 | + * @param string $reg_step_slug |
|
872 | + * @return boolean |
|
873 | + * @throws \EE_Error |
|
874 | + */ |
|
875 | + public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) |
|
876 | + { |
|
877 | + EE_Error::doing_it_wrong( |
|
878 | + __METHOD__, |
|
879 | + esc_html__( |
|
880 | + 'This logic has been moved into \EE_Transaction::set_reg_step_not_completed(), please use that method instead.', |
|
881 | + 'event_espresso' |
|
882 | + ), |
|
883 | + '4.9.12', |
|
884 | + '5.0.0' |
|
885 | + ); |
|
886 | + return $transaction->set_reg_step_not_completed($reg_step_slug); |
|
887 | + } |
|
888 | + |
|
889 | + |
|
890 | + /** |
|
891 | + * remove_reg_step |
|
892 | + * given a valid TXN_reg_step slug, this will remove (unset) |
|
893 | + * the reg step from the TXN reg step array |
|
894 | + * |
|
895 | + * @deprecated 4.9.12 |
|
896 | + * @access public |
|
897 | + * @param \EE_Transaction $transaction |
|
898 | + * @param string $reg_step_slug |
|
899 | + * @return void |
|
900 | + */ |
|
901 | + public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) |
|
902 | + { |
|
903 | + EE_Error::doing_it_wrong( |
|
904 | + __METHOD__, |
|
905 | + esc_html__( |
|
906 | + 'This logic has been moved into \EE_Transaction::remove_reg_step(), please use that method instead.', |
|
907 | + 'event_espresso' |
|
908 | + ), |
|
909 | + '4.9.12', |
|
910 | + '5.0.0' |
|
911 | + ); |
|
912 | + $transaction->remove_reg_step($reg_step_slug); |
|
913 | + } |
|
914 | + |
|
915 | + |
|
916 | + /** |
|
917 | + * toggle_failed_transaction_status |
|
918 | + * upgrades a TXNs status from failed to abandoned, |
|
919 | + * meaning that contact information has been captured for at least one registrant |
|
920 | + * |
|
921 | + * @deprecated 4.9.12 |
|
922 | + * @access public |
|
923 | + * @param EE_Transaction $transaction |
|
924 | + * @return boolean |
|
925 | + * @throws \EE_Error |
|
926 | + */ |
|
927 | + public function toggle_failed_transaction_status(EE_Transaction $transaction) |
|
928 | + { |
|
929 | + EE_Error::doing_it_wrong( |
|
930 | + __METHOD__, |
|
931 | + esc_html__( |
|
932 | + 'This logic has been moved into \EE_Transaction::toggle_failed_transaction_status(), please use that method instead.', |
|
933 | + 'event_espresso' |
|
934 | + ), |
|
935 | + '4.9.12', |
|
936 | + '5.0.0' |
|
937 | + ); |
|
938 | + return $transaction->toggle_failed_transaction_status(); |
|
939 | + } |
|
940 | + |
|
941 | + |
|
942 | + /** |
|
943 | + * toggle_abandoned_transaction_status |
|
944 | + * upgrades a TXNs status from failed or abandoned to incomplete |
|
945 | + * |
|
946 | + * @deprecated 4.9.12 |
|
947 | + * @access public |
|
948 | + * @param EE_Transaction $transaction |
|
949 | + * @return boolean |
|
950 | + */ |
|
951 | + public function toggle_abandoned_transaction_status(EE_Transaction $transaction) |
|
952 | + { |
|
953 | + EE_Error::doing_it_wrong( |
|
954 | + __METHOD__, |
|
955 | + esc_html__( |
|
956 | + 'This logic has been moved into \EE_Transaction::toggle_abandoned_transaction_status(), please use that method instead.', |
|
957 | + 'event_espresso' |
|
958 | + ), |
|
959 | + '4.9.12', |
|
960 | + '5.0.0' |
|
961 | + ); |
|
962 | + return $transaction->toggle_abandoned_transaction_status(); |
|
963 | + } |
|
964 | 964 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public static function instance($registration_query_params = array()) |
54 | 54 | { |
55 | 55 | // check if class object is instantiated |
56 | - if (! self::$_instance instanceof EE_Transaction_Processor) { |
|
56 | + if ( ! self::$_instance instanceof EE_Transaction_Processor) { |
|
57 | 57 | self::$_instance = new self($registration_query_params); |
58 | 58 | } |
59 | 59 | return self::$_instance; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | // these reg statuses should not be considered in any calculations involving monies owing |
312 | 312 | $closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses |
313 | 313 | : EEM_Registration::closed_reg_statuses(); |
314 | - if (! in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
314 | + if ( ! in_array($registration->status_ID(), $closed_reg_statuses, true)) { |
|
315 | 315 | return false; |
316 | 316 | } |
317 | 317 | try { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function get_transaction_for_registration(EE_Registration $registration) |
364 | 364 | { |
365 | 365 | $transaction = $registration->transaction(); |
366 | - if (! $transaction instanceof EE_Transaction) { |
|
366 | + if ( ! $transaction instanceof EE_Transaction) { |
|
367 | 367 | throw new EE_Error( |
368 | 368 | sprintf( |
369 | 369 | __('The Transaction for Registration %1$d was not found or is invalid.', 'event_espresso'), |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $transaction->ID(), |
394 | 394 | $registration->ticket_ID() |
395 | 395 | ); |
396 | - if (! $ticket_line_item instanceof EE_Line_Item) { |
|
396 | + if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
397 | 397 | throw new EE_Error( |
398 | 398 | sprintf( |
399 | 399 | __( |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | /** @type EE_Registration_Processor $registration_processor */ |
477 | 477 | $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
478 | 478 | // check that method exists |
479 | - if (! method_exists($registration_processor, $method_name)) { |
|
479 | + if ( ! method_exists($registration_processor, $method_name)) { |
|
480 | 480 | throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
481 | 481 | } |
482 | 482 | // make sure some query params are set for retrieving registrations |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $transaction, |
535 | 535 | EEM_Payment_Method::scope_cart |
536 | 536 | ); |
537 | - if (! empty($available_payment_methods)) { |
|
537 | + if ( ! empty($available_payment_methods)) { |
|
538 | 538 | $PMD_ID = 0; |
539 | 539 | foreach ($available_payment_methods as $available_payment_method) { |
540 | 540 | if ($available_payment_method instanceof EE_Payment_Method |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | break; |
545 | 545 | } |
546 | 546 | } |
547 | - if (! $PMD_ID) { |
|
547 | + if ( ! $PMD_ID) { |
|
548 | 548 | $first_payment_method = reset($available_payment_methods); |
549 | 549 | if ($first_payment_method instanceof EE_Payment_Method) { |
550 | 550 | $PMD_ID = $first_payment_method->ID(); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * Set Answer value |
62 | 62 | * |
63 | 63 | * @access public |
64 | - * @param mixed $ANS_value |
|
64 | + * @param string $ANS_value |
|
65 | 65 | */ |
66 | 66 | public function set_value($ANS_value = '') |
67 | 67 | { |
@@ -10,144 +10,144 @@ |
||
10 | 10 | class EE_Answer extends EE_Base_Class |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * |
|
15 | - * @param array $props_n_values |
|
16 | - * @return EE_Answer |
|
17 | - */ |
|
18 | - public static function new_instance($props_n_values = array()) |
|
19 | - { |
|
20 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
21 | - return $has_object ? $has_object : new self($props_n_values); |
|
22 | - } |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * |
|
27 | - * @param array $props_n_values |
|
28 | - * @return EE_Answer |
|
29 | - */ |
|
30 | - public static function new_instance_from_db($props_n_values = array()) |
|
31 | - { |
|
32 | - return new self($props_n_values, true); |
|
33 | - } |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * Set Question ID |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * @param int $QST_ID |
|
41 | - */ |
|
42 | - public function set_question($QST_ID = 0) |
|
43 | - { |
|
44 | - $this->set('QST_ID', $QST_ID); |
|
45 | - } |
|
46 | - |
|
47 | - |
|
48 | - /** |
|
49 | - * Set Registration ID |
|
50 | - * |
|
51 | - * @access public |
|
52 | - * @param int $REG_ID |
|
53 | - */ |
|
54 | - public function set_registration($REG_ID = 0) |
|
55 | - { |
|
56 | - $this->set('REG_ID', $REG_ID); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * Set Answer value |
|
62 | - * |
|
63 | - * @access public |
|
64 | - * @param mixed $ANS_value |
|
65 | - */ |
|
66 | - public function set_value($ANS_value = '') |
|
67 | - { |
|
68 | - $this->set('ANS_value', $ANS_value); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * get Attendee First Name |
|
74 | - * |
|
75 | - * @access public |
|
76 | - * @return int |
|
77 | - */ |
|
78 | - public function registration_ID() |
|
79 | - { |
|
80 | - return $this->get('REG_ID'); |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * get Attendee Last Name |
|
86 | - * |
|
87 | - * @access public |
|
88 | - * @return int |
|
89 | - */ |
|
90 | - public function question_ID() |
|
91 | - { |
|
92 | - return $this->get('QST_ID'); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * get Attendee Address |
|
98 | - * |
|
99 | - * @access public |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public function value() |
|
103 | - { |
|
104 | - return $this->get('ANS_value'); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * Gets a pretty form of the value (mostly applies to answers that have multiple answers) |
|
110 | - * |
|
111 | - * @param null $schema |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - public function pretty_value($schema = null) |
|
115 | - { |
|
116 | - return $this->get_pretty('ANS_value', $schema); |
|
117 | - } |
|
118 | - |
|
119 | - |
|
120 | - /** |
|
121 | - * Echoes out a pretty value (even for multi-choice options) |
|
122 | - * |
|
123 | - * @param string $schema |
|
124 | - */ |
|
125 | - public function e_value($schema = null) |
|
126 | - { |
|
127 | - $this->e('ANS_value', $schema); |
|
128 | - } |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * Gets the related EE_Question to this EE_Answer |
|
133 | - * |
|
134 | - * @return EE_Question |
|
135 | - */ |
|
136 | - public function question() |
|
137 | - { |
|
138 | - return $this->get_first_related('Question'); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - /** |
|
143 | - * Gets the related EE_Registration to this EE_Answer |
|
144 | - * |
|
145 | - * @return EE_Registration |
|
146 | - */ |
|
147 | - public function registration() |
|
148 | - { |
|
149 | - return $this->get_first_related('Registration'); |
|
150 | - } |
|
13 | + /** |
|
14 | + * |
|
15 | + * @param array $props_n_values |
|
16 | + * @return EE_Answer |
|
17 | + */ |
|
18 | + public static function new_instance($props_n_values = array()) |
|
19 | + { |
|
20 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
21 | + return $has_object ? $has_object : new self($props_n_values); |
|
22 | + } |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * |
|
27 | + * @param array $props_n_values |
|
28 | + * @return EE_Answer |
|
29 | + */ |
|
30 | + public static function new_instance_from_db($props_n_values = array()) |
|
31 | + { |
|
32 | + return new self($props_n_values, true); |
|
33 | + } |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * Set Question ID |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * @param int $QST_ID |
|
41 | + */ |
|
42 | + public function set_question($QST_ID = 0) |
|
43 | + { |
|
44 | + $this->set('QST_ID', $QST_ID); |
|
45 | + } |
|
46 | + |
|
47 | + |
|
48 | + /** |
|
49 | + * Set Registration ID |
|
50 | + * |
|
51 | + * @access public |
|
52 | + * @param int $REG_ID |
|
53 | + */ |
|
54 | + public function set_registration($REG_ID = 0) |
|
55 | + { |
|
56 | + $this->set('REG_ID', $REG_ID); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * Set Answer value |
|
62 | + * |
|
63 | + * @access public |
|
64 | + * @param mixed $ANS_value |
|
65 | + */ |
|
66 | + public function set_value($ANS_value = '') |
|
67 | + { |
|
68 | + $this->set('ANS_value', $ANS_value); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * get Attendee First Name |
|
74 | + * |
|
75 | + * @access public |
|
76 | + * @return int |
|
77 | + */ |
|
78 | + public function registration_ID() |
|
79 | + { |
|
80 | + return $this->get('REG_ID'); |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * get Attendee Last Name |
|
86 | + * |
|
87 | + * @access public |
|
88 | + * @return int |
|
89 | + */ |
|
90 | + public function question_ID() |
|
91 | + { |
|
92 | + return $this->get('QST_ID'); |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * get Attendee Address |
|
98 | + * |
|
99 | + * @access public |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public function value() |
|
103 | + { |
|
104 | + return $this->get('ANS_value'); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * Gets a pretty form of the value (mostly applies to answers that have multiple answers) |
|
110 | + * |
|
111 | + * @param null $schema |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + public function pretty_value($schema = null) |
|
115 | + { |
|
116 | + return $this->get_pretty('ANS_value', $schema); |
|
117 | + } |
|
118 | + |
|
119 | + |
|
120 | + /** |
|
121 | + * Echoes out a pretty value (even for multi-choice options) |
|
122 | + * |
|
123 | + * @param string $schema |
|
124 | + */ |
|
125 | + public function e_value($schema = null) |
|
126 | + { |
|
127 | + $this->e('ANS_value', $schema); |
|
128 | + } |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * Gets the related EE_Question to this EE_Answer |
|
133 | + * |
|
134 | + * @return EE_Question |
|
135 | + */ |
|
136 | + public function question() |
|
137 | + { |
|
138 | + return $this->get_first_related('Question'); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + /** |
|
143 | + * Gets the related EE_Registration to this EE_Answer |
|
144 | + * |
|
145 | + * @return EE_Registration |
|
146 | + */ |
|
147 | + public function registration() |
|
148 | + { |
|
149 | + return $this->get_first_related('Registration'); |
|
150 | + } |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /* End of file EE_Answer.class.php */ |