@@ -10,138 +10,138 @@ |
||
10 | 10 | class EE_Taxes extends EE_Base |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * This is used for when EE_Taxes is used statically by the admin |
|
15 | - * |
|
16 | - * @var array |
|
17 | - */ |
|
18 | - private static $_subtotal = array(); |
|
13 | + /** |
|
14 | + * This is used for when EE_Taxes is used statically by the admin |
|
15 | + * |
|
16 | + * @var array |
|
17 | + */ |
|
18 | + private static $_subtotal = array(); |
|
19 | 19 | |
20 | - /** |
|
21 | - * This holds an array of EE_Price objects that are of PRT_ID == 4 (tax price types) |
|
22 | - * |
|
23 | - * @var EE_Price[] |
|
24 | - */ |
|
25 | - private static $_default_taxes = array(); |
|
20 | + /** |
|
21 | + * This holds an array of EE_Price objects that are of PRT_ID == 4 (tax price types) |
|
22 | + * |
|
23 | + * @var EE_Price[] |
|
24 | + */ |
|
25 | + private static $_default_taxes = array(); |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * This method simply calculates the total taxes for a given ticket (by pulling the prices attached to the ticket |
|
30 | - * and applying default taxes to it). Note: this is just an intermediary helper method added to facilitate quick |
|
31 | - * calc of taxes for tickets listed in the event editor. |
|
32 | - * |
|
33 | - * @param EE_Ticket $ticket incoming EE_Ticket |
|
34 | - * @return float total taxes to apply to ticket. |
|
35 | - * @throws \EE_Error |
|
36 | - */ |
|
37 | - public static function get_total_taxes_for_admin(EE_Ticket $ticket) |
|
38 | - { |
|
39 | - $tax = 0; |
|
40 | - $total_tax = 0; |
|
41 | - // This first checks to see if the given ticket is taxable. |
|
42 | - if (! $ticket->get('TKT_taxable')) { |
|
43 | - return $tax; |
|
44 | - } |
|
45 | - // get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
|
46 | - $subtotal = self::get_subtotal_for_admin($ticket); |
|
47 | - // get taxes |
|
48 | - $taxes = self::get_taxes_for_admin(); |
|
49 | - // apply taxes to subtotal |
|
50 | - foreach ($taxes as $tax) { |
|
51 | - // assuming taxes are not cumulative |
|
52 | - $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
53 | - } |
|
54 | - return $total_tax; |
|
55 | - } |
|
28 | + /** |
|
29 | + * This method simply calculates the total taxes for a given ticket (by pulling the prices attached to the ticket |
|
30 | + * and applying default taxes to it). Note: this is just an intermediary helper method added to facilitate quick |
|
31 | + * calc of taxes for tickets listed in the event editor. |
|
32 | + * |
|
33 | + * @param EE_Ticket $ticket incoming EE_Ticket |
|
34 | + * @return float total taxes to apply to ticket. |
|
35 | + * @throws \EE_Error |
|
36 | + */ |
|
37 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) |
|
38 | + { |
|
39 | + $tax = 0; |
|
40 | + $total_tax = 0; |
|
41 | + // This first checks to see if the given ticket is taxable. |
|
42 | + if (! $ticket->get('TKT_taxable')) { |
|
43 | + return $tax; |
|
44 | + } |
|
45 | + // get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
|
46 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
47 | + // get taxes |
|
48 | + $taxes = self::get_taxes_for_admin(); |
|
49 | + // apply taxes to subtotal |
|
50 | + foreach ($taxes as $tax) { |
|
51 | + // assuming taxes are not cumulative |
|
52 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
53 | + } |
|
54 | + return $total_tax; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * Gets the total percentage of tax that should be applied to taxable line items |
|
60 | - * |
|
61 | - * @return float the percentage of tax that should be added to taxable items |
|
62 | - * @throws \EE_Error |
|
63 | - * eg 20 for %20 tax (NOT 0.20, which |
|
64 | - */ |
|
65 | - public static function get_total_taxes_percentage() |
|
66 | - { |
|
67 | - $total_tax_percent = 0; |
|
68 | - foreach (self::get_taxes_for_admin() as $tax_price) { |
|
69 | - $total_tax_percent += $tax_price->get('PRC_amount'); |
|
70 | - } |
|
71 | - return $total_tax_percent; |
|
72 | - } |
|
58 | + /** |
|
59 | + * Gets the total percentage of tax that should be applied to taxable line items |
|
60 | + * |
|
61 | + * @return float the percentage of tax that should be added to taxable items |
|
62 | + * @throws \EE_Error |
|
63 | + * eg 20 for %20 tax (NOT 0.20, which |
|
64 | + */ |
|
65 | + public static function get_total_taxes_percentage() |
|
66 | + { |
|
67 | + $total_tax_percent = 0; |
|
68 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
69 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
70 | + } |
|
71 | + return $total_tax_percent; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * @param EE_Ticket $ticket |
|
77 | - * @return float |
|
78 | - * @throws \EE_Error |
|
79 | - */ |
|
80 | - public static function get_subtotal_for_admin(EE_Ticket $ticket) |
|
81 | - { |
|
82 | - $TKT_ID = $ticket->ID(); |
|
83 | - return isset(self::$_subtotal[ $TKT_ID ]) |
|
84 | - ? self::$_subtotal[ $TKT_ID ] |
|
85 | - : self::_get_subtotal_for_admin($ticket); |
|
86 | - } |
|
75 | + /** |
|
76 | + * @param EE_Ticket $ticket |
|
77 | + * @return float |
|
78 | + * @throws \EE_Error |
|
79 | + */ |
|
80 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) |
|
81 | + { |
|
82 | + $TKT_ID = $ticket->ID(); |
|
83 | + return isset(self::$_subtotal[ $TKT_ID ]) |
|
84 | + ? self::$_subtotal[ $TKT_ID ] |
|
85 | + : self::_get_subtotal_for_admin($ticket); |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * simply take an incoming ticket and calculate the subtotal for the ticket |
|
91 | - * |
|
92 | - * @param EE_Ticket $ticket |
|
93 | - * @return float subtotal calculated from all EE_Price[] on Ticket. |
|
94 | - * @throws \EE_Error |
|
95 | - */ |
|
96 | - private static function _get_subtotal_for_admin(EE_Ticket $ticket) |
|
97 | - { |
|
98 | - $subtotal = 0; |
|
99 | - // get all prices |
|
100 | - $prices = $ticket->get_many_related( |
|
101 | - 'Price', |
|
102 | - array( |
|
103 | - 'default_where_conditions' => 'none', |
|
104 | - 'order_by' => array('PRC_order' => 'ASC'), |
|
105 | - ) |
|
106 | - ); |
|
107 | - // let's loop through them (base price is always the first item) |
|
108 | - foreach ($prices as $price) { |
|
109 | - if ($price instanceof EE_Price) { |
|
110 | - $price_type = $price->type_obj(); |
|
111 | - if ($price_type instanceof EE_Price_Type) { |
|
112 | - switch ($price->type_obj()->base_type()) { |
|
113 | - case 1: // base price |
|
114 | - case 3: // surcharges |
|
115 | - $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
116 | - : $price->get('PRC_amount'); |
|
117 | - break; |
|
118 | - case 2: // discounts |
|
119 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
120 | - : $price->get('PRC_amount'); |
|
121 | - break; |
|
122 | - } |
|
123 | - } |
|
124 | - } |
|
125 | - } |
|
126 | - $TKT_ID = $ticket->ID(); |
|
127 | - self::$_subtotal = array($TKT_ID => $subtotal); |
|
128 | - return $subtotal; |
|
129 | - } |
|
89 | + /** |
|
90 | + * simply take an incoming ticket and calculate the subtotal for the ticket |
|
91 | + * |
|
92 | + * @param EE_Ticket $ticket |
|
93 | + * @return float subtotal calculated from all EE_Price[] on Ticket. |
|
94 | + * @throws \EE_Error |
|
95 | + */ |
|
96 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) |
|
97 | + { |
|
98 | + $subtotal = 0; |
|
99 | + // get all prices |
|
100 | + $prices = $ticket->get_many_related( |
|
101 | + 'Price', |
|
102 | + array( |
|
103 | + 'default_where_conditions' => 'none', |
|
104 | + 'order_by' => array('PRC_order' => 'ASC'), |
|
105 | + ) |
|
106 | + ); |
|
107 | + // let's loop through them (base price is always the first item) |
|
108 | + foreach ($prices as $price) { |
|
109 | + if ($price instanceof EE_Price) { |
|
110 | + $price_type = $price->type_obj(); |
|
111 | + if ($price_type instanceof EE_Price_Type) { |
|
112 | + switch ($price->type_obj()->base_type()) { |
|
113 | + case 1: // base price |
|
114 | + case 3: // surcharges |
|
115 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
116 | + : $price->get('PRC_amount'); |
|
117 | + break; |
|
118 | + case 2: // discounts |
|
119 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 |
|
120 | + : $price->get('PRC_amount'); |
|
121 | + break; |
|
122 | + } |
|
123 | + } |
|
124 | + } |
|
125 | + } |
|
126 | + $TKT_ID = $ticket->ID(); |
|
127 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
128 | + return $subtotal; |
|
129 | + } |
|
130 | 130 | |
131 | 131 | |
132 | - /** |
|
133 | - * get all default prices that are a Tax price type (PRT_ID = 4) and return |
|
134 | - * |
|
135 | - * @return EE_Price[] EE_Price objects that have PRT_ID == 4 |
|
136 | - * @throws \EE_Error |
|
137 | - */ |
|
138 | - public static function get_taxes_for_admin() |
|
139 | - { |
|
140 | - if (empty(self::$_default_taxes)) { |
|
141 | - self::$_default_taxes = EE_Registry::instance()->load_model('Price')->get_all( |
|
142 | - array(array('Price_Type.PBT_ID' => 4)) |
|
143 | - ); |
|
144 | - } |
|
145 | - return self::$_default_taxes; |
|
146 | - } |
|
132 | + /** |
|
133 | + * get all default prices that are a Tax price type (PRT_ID = 4) and return |
|
134 | + * |
|
135 | + * @return EE_Price[] EE_Price objects that have PRT_ID == 4 |
|
136 | + * @throws \EE_Error |
|
137 | + */ |
|
138 | + public static function get_taxes_for_admin() |
|
139 | + { |
|
140 | + if (empty(self::$_default_taxes)) { |
|
141 | + self::$_default_taxes = EE_Registry::instance()->load_model('Price')->get_all( |
|
142 | + array(array('Price_Type.PBT_ID' => 4)) |
|
143 | + ); |
|
144 | + } |
|
145 | + return self::$_default_taxes; |
|
146 | + } |
|
147 | 147 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $tax = 0; |
40 | 40 | $total_tax = 0; |
41 | 41 | // This first checks to see if the given ticket is taxable. |
42 | - if (! $ticket->get('TKT_taxable')) { |
|
42 | + if ( ! $ticket->get('TKT_taxable')) { |
|
43 | 43 | return $tax; |
44 | 44 | } |
45 | 45 | // get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | public static function get_subtotal_for_admin(EE_Ticket $ticket) |
81 | 81 | { |
82 | 82 | $TKT_ID = $ticket->ID(); |
83 | - return isset(self::$_subtotal[ $TKT_ID ]) |
|
84 | - ? self::$_subtotal[ $TKT_ID ] |
|
83 | + return isset(self::$_subtotal[$TKT_ID]) |
|
84 | + ? self::$_subtotal[$TKT_ID] |
|
85 | 85 | : self::_get_subtotal_for_admin($ticket); |
86 | 86 | } |
87 | 87 |
@@ -13,173 +13,173 @@ |
||
13 | 13 | class EE_Message_Template extends EE_Base_Class |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @param array $props_n_values |
|
18 | - * @param string $timezone |
|
19 | - * @return EE_Message_Template|mixed |
|
20 | - */ |
|
21 | - public static function new_instance($props_n_values = array(), $timezone = '') |
|
22 | - { |
|
23 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
24 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * @param array $props_n_values |
|
30 | - * @param string $timezone |
|
31 | - * @return EE_Message_Template |
|
32 | - */ |
|
33 | - public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
34 | - { |
|
35 | - return new self($props_n_values, true, $timezone); |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - /** |
|
40 | - * @param bool $GRP_ID |
|
41 | - * @throws EE_Error |
|
42 | - */ |
|
43 | - public function set_group_template_id($GRP_ID = false) |
|
44 | - { |
|
45 | - if (! $GRP_ID) { |
|
46 | - throw new EE_Error(__('Missing required value for the message template group id', 'event_espresso')); |
|
47 | - } |
|
48 | - $this->set('GRP_ID', $GRP_ID); |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * get Group ID |
|
54 | - * |
|
55 | - * @access public |
|
56 | - * @return int |
|
57 | - */ |
|
58 | - public function GRP_ID() |
|
59 | - { |
|
60 | - return $this->get('GRP_ID'); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * get User ID |
|
66 | - * |
|
67 | - * @access public |
|
68 | - * @return int |
|
69 | - */ |
|
70 | - public function user() |
|
71 | - { |
|
72 | - return $this->get_first_related('Message_Template_Group')->get('MTP_user_id'); |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * get Message Messenger |
|
78 | - * |
|
79 | - * @access public |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - public function messenger() |
|
83 | - { |
|
84 | - return $this->get_first_related('Message_Template_Group')->messenger(); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * get Message Messenger OBJECT |
|
90 | - * |
|
91 | - * @access public |
|
92 | - * @return object Messenger Object for the given messenger |
|
93 | - */ |
|
94 | - public function messenger_obj() |
|
95 | - { |
|
96 | - return $this->get_first_related('Message_Template_Group')->messenger_obj(); |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * get Message Type |
|
102 | - * |
|
103 | - * @access public |
|
104 | - * @return string |
|
105 | - */ |
|
106 | - public function message_type() |
|
107 | - { |
|
108 | - return $this->get_first_related('Message_Template_Group')->message_type(); |
|
109 | - } |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * get Message type OBJECT |
|
114 | - * |
|
115 | - * @access public |
|
116 | - * @return object Message Type object for the given message type |
|
117 | - */ |
|
118 | - public function message_type_obj() |
|
119 | - { |
|
120 | - return $this->get_first_related('Message_Template_Group')->message_type_obj(); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - /** |
|
125 | - * This returns the set context array configured in the message type object |
|
126 | - * |
|
127 | - * @access public |
|
128 | - * @return array array of contexts and their configuration. |
|
129 | - */ |
|
130 | - public function contexts_config() |
|
131 | - { |
|
132 | - return $this->get_first_related('Message_Template_Group')->contexts_config(); |
|
133 | - } |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * This returns the context_label for contexts as set in the message type object |
|
138 | - * |
|
139 | - * @access public |
|
140 | - * @return string label for "context" |
|
141 | - */ |
|
142 | - public function context_label() |
|
143 | - { |
|
144 | - return $this->get_first_related('Message_Template_Group')->context_label(); |
|
145 | - } |
|
146 | - |
|
147 | - |
|
148 | - /** |
|
149 | - * this returns if the template group this template belongs to is global |
|
150 | - * |
|
151 | - * @return boolean true if it is, false if it isn't |
|
152 | - */ |
|
153 | - public function is_global() |
|
154 | - { |
|
155 | - return $this->get_first_related('Message_Template_Group')->is_global(); |
|
156 | - } |
|
157 | - |
|
158 | - |
|
159 | - /** |
|
160 | - * this returns if the template group this template belongs to is active (i.e. turned "on" or not) |
|
161 | - * |
|
162 | - * @return boolean true if it is, false if it isn't |
|
163 | - */ |
|
164 | - public function is_active() |
|
165 | - { |
|
166 | - return $this->get_first_related('Message_Template_Group')->is_active(); |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * This will return an array of shortcodes => labels from the messenger and message_type objects associated with |
|
172 | - * this template. |
|
173 | - * |
|
174 | - * @access public |
|
175 | - * @param string $context what context we're going to return shortcodes for |
|
176 | - * @param array $fields what fields we're returning valid shortcodes for. If empty then we assume all fields are |
|
177 | - * to be merged and returned. |
|
178 | - * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no |
|
179 | - * shortcodes found. |
|
180 | - */ |
|
181 | - public function get_shortcodes($context, $fields = array()) |
|
182 | - { |
|
183 | - return $this->get_first_related('Message_Template_Group')->get_shortcodes($context, $fields); |
|
184 | - } |
|
16 | + /** |
|
17 | + * @param array $props_n_values |
|
18 | + * @param string $timezone |
|
19 | + * @return EE_Message_Template|mixed |
|
20 | + */ |
|
21 | + public static function new_instance($props_n_values = array(), $timezone = '') |
|
22 | + { |
|
23 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
24 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * @param array $props_n_values |
|
30 | + * @param string $timezone |
|
31 | + * @return EE_Message_Template |
|
32 | + */ |
|
33 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
34 | + { |
|
35 | + return new self($props_n_values, true, $timezone); |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + /** |
|
40 | + * @param bool $GRP_ID |
|
41 | + * @throws EE_Error |
|
42 | + */ |
|
43 | + public function set_group_template_id($GRP_ID = false) |
|
44 | + { |
|
45 | + if (! $GRP_ID) { |
|
46 | + throw new EE_Error(__('Missing required value for the message template group id', 'event_espresso')); |
|
47 | + } |
|
48 | + $this->set('GRP_ID', $GRP_ID); |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * get Group ID |
|
54 | + * |
|
55 | + * @access public |
|
56 | + * @return int |
|
57 | + */ |
|
58 | + public function GRP_ID() |
|
59 | + { |
|
60 | + return $this->get('GRP_ID'); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * get User ID |
|
66 | + * |
|
67 | + * @access public |
|
68 | + * @return int |
|
69 | + */ |
|
70 | + public function user() |
|
71 | + { |
|
72 | + return $this->get_first_related('Message_Template_Group')->get('MTP_user_id'); |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * get Message Messenger |
|
78 | + * |
|
79 | + * @access public |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + public function messenger() |
|
83 | + { |
|
84 | + return $this->get_first_related('Message_Template_Group')->messenger(); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * get Message Messenger OBJECT |
|
90 | + * |
|
91 | + * @access public |
|
92 | + * @return object Messenger Object for the given messenger |
|
93 | + */ |
|
94 | + public function messenger_obj() |
|
95 | + { |
|
96 | + return $this->get_first_related('Message_Template_Group')->messenger_obj(); |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * get Message Type |
|
102 | + * |
|
103 | + * @access public |
|
104 | + * @return string |
|
105 | + */ |
|
106 | + public function message_type() |
|
107 | + { |
|
108 | + return $this->get_first_related('Message_Template_Group')->message_type(); |
|
109 | + } |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * get Message type OBJECT |
|
114 | + * |
|
115 | + * @access public |
|
116 | + * @return object Message Type object for the given message type |
|
117 | + */ |
|
118 | + public function message_type_obj() |
|
119 | + { |
|
120 | + return $this->get_first_related('Message_Template_Group')->message_type_obj(); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + /** |
|
125 | + * This returns the set context array configured in the message type object |
|
126 | + * |
|
127 | + * @access public |
|
128 | + * @return array array of contexts and their configuration. |
|
129 | + */ |
|
130 | + public function contexts_config() |
|
131 | + { |
|
132 | + return $this->get_first_related('Message_Template_Group')->contexts_config(); |
|
133 | + } |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * This returns the context_label for contexts as set in the message type object |
|
138 | + * |
|
139 | + * @access public |
|
140 | + * @return string label for "context" |
|
141 | + */ |
|
142 | + public function context_label() |
|
143 | + { |
|
144 | + return $this->get_first_related('Message_Template_Group')->context_label(); |
|
145 | + } |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * this returns if the template group this template belongs to is global |
|
150 | + * |
|
151 | + * @return boolean true if it is, false if it isn't |
|
152 | + */ |
|
153 | + public function is_global() |
|
154 | + { |
|
155 | + return $this->get_first_related('Message_Template_Group')->is_global(); |
|
156 | + } |
|
157 | + |
|
158 | + |
|
159 | + /** |
|
160 | + * this returns if the template group this template belongs to is active (i.e. turned "on" or not) |
|
161 | + * |
|
162 | + * @return boolean true if it is, false if it isn't |
|
163 | + */ |
|
164 | + public function is_active() |
|
165 | + { |
|
166 | + return $this->get_first_related('Message_Template_Group')->is_active(); |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * This will return an array of shortcodes => labels from the messenger and message_type objects associated with |
|
172 | + * this template. |
|
173 | + * |
|
174 | + * @access public |
|
175 | + * @param string $context what context we're going to return shortcodes for |
|
176 | + * @param array $fields what fields we're returning valid shortcodes for. If empty then we assume all fields are |
|
177 | + * to be merged and returned. |
|
178 | + * @return mixed (array|bool) an array of shortcodes in the format array( '[shortcode] => 'label') OR FALSE if no |
|
179 | + * shortcodes found. |
|
180 | + */ |
|
181 | + public function get_shortcodes($context, $fields = array()) |
|
182 | + { |
|
183 | + return $this->get_first_related('Message_Template_Group')->get_shortcodes($context, $fields); |
|
184 | + } |
|
185 | 185 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | */ |
43 | 43 | public function set_group_template_id($GRP_ID = false) |
44 | 44 | { |
45 | - if (! $GRP_ID) { |
|
45 | + if ( ! $GRP_ID) { |
|
46 | 46 | throw new EE_Error(__('Missing required value for the message template group id', 'event_espresso')); |
47 | 47 | } |
48 | 48 | $this->set('GRP_ID', $GRP_ID); |
@@ -11,25 +11,25 @@ |
||
11 | 11 | class EE_Ticket_Price extends EE_Base_Class |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @param array $props_n_values |
|
16 | - * @param string $timezone |
|
17 | - * @return EE_Ticket_Price|mixed |
|
18 | - */ |
|
19 | - public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) |
|
20 | - { |
|
21 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
22 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
23 | - } |
|
14 | + /** |
|
15 | + * @param array $props_n_values |
|
16 | + * @param string $timezone |
|
17 | + * @return EE_Ticket_Price|mixed |
|
18 | + */ |
|
19 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) |
|
20 | + { |
|
21 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
22 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @param array $props_n_values |
|
28 | - * @param string $timezone |
|
29 | - * @return EE_Ticket_Price |
|
30 | - */ |
|
31 | - public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
32 | - { |
|
33 | - return new self($props_n_values, true, $timezone); |
|
34 | - } |
|
26 | + /** |
|
27 | + * @param array $props_n_values |
|
28 | + * @param string $timezone |
|
29 | + * @return EE_Ticket_Price |
|
30 | + */ |
|
31 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
32 | + { |
|
33 | + return new self($props_n_values, true, $timezone); |
|
34 | + } |
|
35 | 35 | } |
@@ -12,25 +12,25 @@ |
||
12 | 12 | class EE_Ticket_Template extends EE_Base_Class |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @param array $props_n_values |
|
17 | - * @param string $timezone |
|
18 | - * @return EE_Ticket_Template|mixed |
|
19 | - */ |
|
20 | - public static function new_instance($props_n_values = array(), $timezone = '') |
|
21 | - { |
|
22 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
23 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone); |
|
24 | - } |
|
15 | + /** |
|
16 | + * @param array $props_n_values |
|
17 | + * @param string $timezone |
|
18 | + * @return EE_Ticket_Template|mixed |
|
19 | + */ |
|
20 | + public static function new_instance($props_n_values = array(), $timezone = '') |
|
21 | + { |
|
22 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
23 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @param array $props_n_values |
|
29 | - * @param string $timezone |
|
30 | - * @return EE_Ticket_Template |
|
31 | - */ |
|
32 | - public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
33 | - { |
|
34 | - return new self($props_n_values, true, $timezone); |
|
35 | - } |
|
27 | + /** |
|
28 | + * @param array $props_n_values |
|
29 | + * @param string $timezone |
|
30 | + * @return EE_Ticket_Template |
|
31 | + */ |
|
32 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
33 | + { |
|
34 | + return new self($props_n_values, true, $timezone); |
|
35 | + } |
|
36 | 36 | } |
@@ -10,23 +10,23 @@ |
||
10 | 10 | class EE_Term_Relationship extends EE_Base_Class |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * @param array $props_n_values |
|
15 | - * @return EE_Term_Relationship |
|
16 | - */ |
|
17 | - public static function new_instance($props_n_values = array()) |
|
18 | - { |
|
19 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
20 | - return $has_object ? $has_object : new self($props_n_values); |
|
21 | - } |
|
13 | + /** |
|
14 | + * @param array $props_n_values |
|
15 | + * @return EE_Term_Relationship |
|
16 | + */ |
|
17 | + public static function new_instance($props_n_values = array()) |
|
18 | + { |
|
19 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
20 | + return $has_object ? $has_object : new self($props_n_values); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * @param array $props_n_values |
|
26 | - * @return EE_Term_Relationship |
|
27 | - */ |
|
28 | - public static function new_instance_from_db($props_n_values = array()) |
|
29 | - { |
|
30 | - return new self($props_n_values, true); |
|
31 | - } |
|
24 | + /** |
|
25 | + * @param array $props_n_values |
|
26 | + * @return EE_Term_Relationship |
|
27 | + */ |
|
28 | + public static function new_instance_from_db($props_n_values = array()) |
|
29 | + { |
|
30 | + return new self($props_n_values, true); |
|
31 | + } |
|
32 | 32 | } |
@@ -10,123 +10,123 @@ |
||
10 | 10 | class EE_Country extends EE_Base_Class |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * @param array $props_n_values |
|
15 | - * @return EE_Country|mixed |
|
16 | - */ |
|
17 | - public static function new_instance($props_n_values = array()) |
|
18 | - { |
|
19 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
20 | - return $has_object ? $has_object : new self($props_n_values); |
|
21 | - } |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @param array $props_n_values |
|
26 | - * @return EE_Country |
|
27 | - */ |
|
28 | - public static function new_instance_from_db($props_n_values = array()) |
|
29 | - { |
|
30 | - return new self($props_n_values, true); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * Gets the country name |
|
36 | - * |
|
37 | - * @return string |
|
38 | - */ |
|
39 | - public function name() |
|
40 | - { |
|
41 | - return $this->get('CNT_name'); |
|
42 | - } |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * gets the country's currency code |
|
47 | - * |
|
48 | - * @return string |
|
49 | - */ |
|
50 | - public function currency_code() |
|
51 | - { |
|
52 | - return $this->get('CNT_cur_code'); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * gets the country's currency sign/symbol |
|
58 | - * |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function currency_sign() |
|
62 | - { |
|
63 | - $CNT_cur_sign = $this->get('CNT_cur_sign'); |
|
64 | - return $CNT_cur_sign ? $CNT_cur_sign : ''; |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * Currency name singular |
|
70 | - * |
|
71 | - * @return string |
|
72 | - */ |
|
73 | - public function currency_name_single() |
|
74 | - { |
|
75 | - return $this->get('CNT_cur_single'); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Currency name plural |
|
81 | - * |
|
82 | - * @return string |
|
83 | - */ |
|
84 | - public function currency_name_plural() |
|
85 | - { |
|
86 | - return $this->get('CNT_cur_plural'); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - /** |
|
91 | - * currency_sign_before - ie: $TRUE or FALSE$ |
|
92 | - * |
|
93 | - * @return boolean |
|
94 | - */ |
|
95 | - public function currency_sign_before() |
|
96 | - { |
|
97 | - return $this->get('CNT_cur_sign_b4'); |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * currency_decimal_places : 2 = 0.00 3 = 0.000 |
|
103 | - * |
|
104 | - * @return integer |
|
105 | - */ |
|
106 | - public function currency_decimal_places() |
|
107 | - { |
|
108 | - return $this->get('CNT_cur_dec_plc'); |
|
109 | - } |
|
110 | - |
|
111 | - |
|
112 | - /** |
|
113 | - * currency_decimal_mark : (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
114 | - * |
|
115 | - * @return string |
|
116 | - */ |
|
117 | - public function currency_decimal_mark() |
|
118 | - { |
|
119 | - return $this->get('CNT_cur_dec_mrk'); |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - /** |
|
124 | - * currency thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
125 | - * |
|
126 | - * @return string |
|
127 | - */ |
|
128 | - public function currency_thousands_separator() |
|
129 | - { |
|
130 | - return $this->get('CNT_cur_thsnds'); |
|
131 | - } |
|
13 | + /** |
|
14 | + * @param array $props_n_values |
|
15 | + * @return EE_Country|mixed |
|
16 | + */ |
|
17 | + public static function new_instance($props_n_values = array()) |
|
18 | + { |
|
19 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
20 | + return $has_object ? $has_object : new self($props_n_values); |
|
21 | + } |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @param array $props_n_values |
|
26 | + * @return EE_Country |
|
27 | + */ |
|
28 | + public static function new_instance_from_db($props_n_values = array()) |
|
29 | + { |
|
30 | + return new self($props_n_values, true); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * Gets the country name |
|
36 | + * |
|
37 | + * @return string |
|
38 | + */ |
|
39 | + public function name() |
|
40 | + { |
|
41 | + return $this->get('CNT_name'); |
|
42 | + } |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * gets the country's currency code |
|
47 | + * |
|
48 | + * @return string |
|
49 | + */ |
|
50 | + public function currency_code() |
|
51 | + { |
|
52 | + return $this->get('CNT_cur_code'); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * gets the country's currency sign/symbol |
|
58 | + * |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function currency_sign() |
|
62 | + { |
|
63 | + $CNT_cur_sign = $this->get('CNT_cur_sign'); |
|
64 | + return $CNT_cur_sign ? $CNT_cur_sign : ''; |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * Currency name singular |
|
70 | + * |
|
71 | + * @return string |
|
72 | + */ |
|
73 | + public function currency_name_single() |
|
74 | + { |
|
75 | + return $this->get('CNT_cur_single'); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Currency name plural |
|
81 | + * |
|
82 | + * @return string |
|
83 | + */ |
|
84 | + public function currency_name_plural() |
|
85 | + { |
|
86 | + return $this->get('CNT_cur_plural'); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + /** |
|
91 | + * currency_sign_before - ie: $TRUE or FALSE$ |
|
92 | + * |
|
93 | + * @return boolean |
|
94 | + */ |
|
95 | + public function currency_sign_before() |
|
96 | + { |
|
97 | + return $this->get('CNT_cur_sign_b4'); |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * currency_decimal_places : 2 = 0.00 3 = 0.000 |
|
103 | + * |
|
104 | + * @return integer |
|
105 | + */ |
|
106 | + public function currency_decimal_places() |
|
107 | + { |
|
108 | + return $this->get('CNT_cur_dec_plc'); |
|
109 | + } |
|
110 | + |
|
111 | + |
|
112 | + /** |
|
113 | + * currency_decimal_mark : (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
114 | + * |
|
115 | + * @return string |
|
116 | + */ |
|
117 | + public function currency_decimal_mark() |
|
118 | + { |
|
119 | + return $this->get('CNT_cur_dec_mrk'); |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + /** |
|
124 | + * currency thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
125 | + * |
|
126 | + * @return string |
|
127 | + */ |
|
128 | + public function currency_thousands_separator() |
|
129 | + { |
|
130 | + return $this->get('CNT_cur_thsnds'); |
|
131 | + } |
|
132 | 132 | } |
@@ -12,25 +12,25 @@ |
||
12 | 12 | class EE_Extra_Join extends EE_Base_Class |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @param array $props_n_values |
|
17 | - * @param null $timezone |
|
18 | - * @return EE_Extra_Join|mixed |
|
19 | - */ |
|
20 | - public static function new_instance($props_n_values = array(), $timezone = null) |
|
21 | - { |
|
22 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
23 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone); |
|
24 | - } |
|
15 | + /** |
|
16 | + * @param array $props_n_values |
|
17 | + * @param null $timezone |
|
18 | + * @return EE_Extra_Join|mixed |
|
19 | + */ |
|
20 | + public static function new_instance($props_n_values = array(), $timezone = null) |
|
21 | + { |
|
22 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
23 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @param array $props_n_values |
|
29 | - * @param null $timezone |
|
30 | - * @return EE_Extra_Join |
|
31 | - */ |
|
32 | - public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
33 | - { |
|
34 | - return new self($props_n_values, true, $timezone); |
|
35 | - } |
|
27 | + /** |
|
28 | + * @param array $props_n_values |
|
29 | + * @param null $timezone |
|
30 | + * @return EE_Extra_Join |
|
31 | + */ |
|
32 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
33 | + { |
|
34 | + return new self($props_n_values, true, $timezone); |
|
35 | + } |
|
36 | 36 | } |
@@ -10,163 +10,163 @@ |
||
10 | 10 | class EE_Price_Type extends EE_Soft_Delete_Base_Class |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * @param array $props_n_values |
|
15 | - * @return EE_Price_Type |
|
16 | - */ |
|
17 | - public static function new_instance($props_n_values = array()) |
|
18 | - { |
|
19 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
20 | - return $has_object ? $has_object : new self($props_n_values); |
|
21 | - } |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @param array $props_n_values |
|
26 | - * @return EE_Price_Type |
|
27 | - */ |
|
28 | - public static function new_instance_from_db($props_n_values = array()) |
|
29 | - { |
|
30 | - return new self($props_n_values, true); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * Set Price Type Name |
|
36 | - * |
|
37 | - * @access public |
|
38 | - * @param string $PRT_name |
|
39 | - */ |
|
40 | - public function set_name($PRT_name = '') |
|
41 | - { |
|
42 | - $this->set('PRT_name', $PRT_name); |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * Set Price Type a percent |
|
48 | - * |
|
49 | - * @access public |
|
50 | - * @param bool $PRT_is_percent |
|
51 | - */ |
|
52 | - public function set_is_percent($PRT_is_percent = false) |
|
53 | - { |
|
54 | - $this->set('PRT_is_percent', $PRT_is_percent); |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - /** |
|
59 | - * Set Price Type order |
|
60 | - * |
|
61 | - * @access public |
|
62 | - * @param int $PRT_order |
|
63 | - */ |
|
64 | - public function set_order($PRT_order = 0) |
|
65 | - { |
|
66 | - $this->set('PRT_order', $PRT_order); |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * |
|
72 | - */ |
|
73 | - public function move_to_trash() |
|
74 | - { |
|
75 | - $this->set('PRT_deleted', true); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * |
|
81 | - */ |
|
82 | - public function restore_from_trash() |
|
83 | - { |
|
84 | - $this->set('PRT_deleted', false); |
|
85 | - } |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * get Price Type Name |
|
90 | - * |
|
91 | - * @access public |
|
92 | - */ |
|
93 | - public function name() |
|
94 | - { |
|
95 | - return $this->get('PRT_name'); |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * get is Price Type a discount? |
|
101 | - * |
|
102 | - * @access public |
|
103 | - */ |
|
104 | - public function base_type() |
|
105 | - { |
|
106 | - return $this->get('PBT_ID'); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @return mixed |
|
112 | - */ |
|
113 | - public function base_type_name() |
|
114 | - { |
|
115 | - return $this->get_pretty('PBT_ID'); |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * get is Price Type a percent? |
|
121 | - * |
|
122 | - * @access public |
|
123 | - */ |
|
124 | - public function is_percent() |
|
125 | - { |
|
126 | - return $this->get('PRT_is_percent'); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * @return bool |
|
132 | - */ |
|
133 | - public function is_discount() |
|
134 | - { |
|
135 | - return $this->get('PBT_ID') == 2 ? true : false; |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * get the author of the price type. |
|
141 | - * |
|
142 | - * @since 4.5.0 |
|
143 | - * |
|
144 | - * @return int |
|
145 | - */ |
|
146 | - public function wp_user() |
|
147 | - { |
|
148 | - return $this->get('PRT_wp_user'); |
|
149 | - } |
|
150 | - |
|
151 | - |
|
152 | - /** |
|
153 | - * get Price Type order |
|
154 | - * |
|
155 | - * @access public |
|
156 | - */ |
|
157 | - public function order() |
|
158 | - { |
|
159 | - return $this->get('PRT_order'); |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * get is Price Type deleted ? |
|
165 | - * |
|
166 | - * @access public |
|
167 | - */ |
|
168 | - public function deleted() |
|
169 | - { |
|
170 | - return $this->get('PRT_deleted'); |
|
171 | - } |
|
13 | + /** |
|
14 | + * @param array $props_n_values |
|
15 | + * @return EE_Price_Type |
|
16 | + */ |
|
17 | + public static function new_instance($props_n_values = array()) |
|
18 | + { |
|
19 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
20 | + return $has_object ? $has_object : new self($props_n_values); |
|
21 | + } |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @param array $props_n_values |
|
26 | + * @return EE_Price_Type |
|
27 | + */ |
|
28 | + public static function new_instance_from_db($props_n_values = array()) |
|
29 | + { |
|
30 | + return new self($props_n_values, true); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * Set Price Type Name |
|
36 | + * |
|
37 | + * @access public |
|
38 | + * @param string $PRT_name |
|
39 | + */ |
|
40 | + public function set_name($PRT_name = '') |
|
41 | + { |
|
42 | + $this->set('PRT_name', $PRT_name); |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * Set Price Type a percent |
|
48 | + * |
|
49 | + * @access public |
|
50 | + * @param bool $PRT_is_percent |
|
51 | + */ |
|
52 | + public function set_is_percent($PRT_is_percent = false) |
|
53 | + { |
|
54 | + $this->set('PRT_is_percent', $PRT_is_percent); |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + /** |
|
59 | + * Set Price Type order |
|
60 | + * |
|
61 | + * @access public |
|
62 | + * @param int $PRT_order |
|
63 | + */ |
|
64 | + public function set_order($PRT_order = 0) |
|
65 | + { |
|
66 | + $this->set('PRT_order', $PRT_order); |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * |
|
72 | + */ |
|
73 | + public function move_to_trash() |
|
74 | + { |
|
75 | + $this->set('PRT_deleted', true); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * |
|
81 | + */ |
|
82 | + public function restore_from_trash() |
|
83 | + { |
|
84 | + $this->set('PRT_deleted', false); |
|
85 | + } |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * get Price Type Name |
|
90 | + * |
|
91 | + * @access public |
|
92 | + */ |
|
93 | + public function name() |
|
94 | + { |
|
95 | + return $this->get('PRT_name'); |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * get is Price Type a discount? |
|
101 | + * |
|
102 | + * @access public |
|
103 | + */ |
|
104 | + public function base_type() |
|
105 | + { |
|
106 | + return $this->get('PBT_ID'); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @return mixed |
|
112 | + */ |
|
113 | + public function base_type_name() |
|
114 | + { |
|
115 | + return $this->get_pretty('PBT_ID'); |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * get is Price Type a percent? |
|
121 | + * |
|
122 | + * @access public |
|
123 | + */ |
|
124 | + public function is_percent() |
|
125 | + { |
|
126 | + return $this->get('PRT_is_percent'); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * @return bool |
|
132 | + */ |
|
133 | + public function is_discount() |
|
134 | + { |
|
135 | + return $this->get('PBT_ID') == 2 ? true : false; |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * get the author of the price type. |
|
141 | + * |
|
142 | + * @since 4.5.0 |
|
143 | + * |
|
144 | + * @return int |
|
145 | + */ |
|
146 | + public function wp_user() |
|
147 | + { |
|
148 | + return $this->get('PRT_wp_user'); |
|
149 | + } |
|
150 | + |
|
151 | + |
|
152 | + /** |
|
153 | + * get Price Type order |
|
154 | + * |
|
155 | + * @access public |
|
156 | + */ |
|
157 | + public function order() |
|
158 | + { |
|
159 | + return $this->get('PRT_order'); |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * get is Price Type deleted ? |
|
165 | + * |
|
166 | + * @access public |
|
167 | + */ |
|
168 | + public function deleted() |
|
169 | + { |
|
170 | + return $this->get('PRT_deleted'); |
|
171 | + } |
|
172 | 172 | } |
@@ -11,86 +11,86 @@ |
||
11 | 11 | { |
12 | 12 | |
13 | 13 | |
14 | - /** |
|
15 | - * Used to reference when a registration has been checked out. |
|
16 | - * |
|
17 | - * @type int |
|
18 | - */ |
|
19 | - const status_checked_out = 0; |
|
20 | - |
|
21 | - /** |
|
22 | - * Used to reference when a registration has been checked in. |
|
23 | - * |
|
24 | - * @type int |
|
25 | - */ |
|
26 | - const status_checked_in = 1; |
|
27 | - |
|
28 | - /** |
|
29 | - * Used to reference when a registration has never been checked in. |
|
30 | - * |
|
31 | - * @type int |
|
32 | - */ |
|
33 | - const status_checked_never = 2; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * |
|
38 | - * @param array $props_n_values incoming values |
|
39 | - * @param string $timezone incoming timezone (if not set the timezone set for the website will be used.) |
|
40 | - * @param array $date_formats incoming date_formats in an array |
|
41 | - * where the first value is the date_format |
|
42 | - * and the second value is the time format |
|
43 | - * @return EE_Checkin |
|
44 | - * @throws EE_Error |
|
45 | - */ |
|
46 | - public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
47 | - { |
|
48 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
49 | - return $has_object |
|
50 | - ? $has_object |
|
51 | - : new self($props_n_values, false, $timezone, $date_formats); |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * @param array $props_n_values incoming values from the database |
|
57 | - * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
58 | - * the website will be used. |
|
59 | - * @return EE_Checkin |
|
60 | - * @throws EE_Error |
|
61 | - */ |
|
62 | - public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
63 | - { |
|
64 | - return new self($props_n_values, true, $timezone); |
|
65 | - } |
|
66 | - |
|
67 | - |
|
68 | - public function ID() |
|
69 | - { |
|
70 | - return $this->get('CHK_ID'); |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - public function registration_id() |
|
75 | - { |
|
76 | - return $this->get('REG_ID'); |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - public function datetime_id() |
|
81 | - { |
|
82 | - return $this->get('DTT_ID'); |
|
83 | - } |
|
84 | - |
|
85 | - |
|
86 | - public function status() |
|
87 | - { |
|
88 | - return $this->get('CHK_in'); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - public function timestamp() |
|
93 | - { |
|
94 | - return $this->get('CHK_timestamp'); |
|
95 | - } |
|
14 | + /** |
|
15 | + * Used to reference when a registration has been checked out. |
|
16 | + * |
|
17 | + * @type int |
|
18 | + */ |
|
19 | + const status_checked_out = 0; |
|
20 | + |
|
21 | + /** |
|
22 | + * Used to reference when a registration has been checked in. |
|
23 | + * |
|
24 | + * @type int |
|
25 | + */ |
|
26 | + const status_checked_in = 1; |
|
27 | + |
|
28 | + /** |
|
29 | + * Used to reference when a registration has never been checked in. |
|
30 | + * |
|
31 | + * @type int |
|
32 | + */ |
|
33 | + const status_checked_never = 2; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * |
|
38 | + * @param array $props_n_values incoming values |
|
39 | + * @param string $timezone incoming timezone (if not set the timezone set for the website will be used.) |
|
40 | + * @param array $date_formats incoming date_formats in an array |
|
41 | + * where the first value is the date_format |
|
42 | + * and the second value is the time format |
|
43 | + * @return EE_Checkin |
|
44 | + * @throws EE_Error |
|
45 | + */ |
|
46 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) |
|
47 | + { |
|
48 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
49 | + return $has_object |
|
50 | + ? $has_object |
|
51 | + : new self($props_n_values, false, $timezone, $date_formats); |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * @param array $props_n_values incoming values from the database |
|
57 | + * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
58 | + * the website will be used. |
|
59 | + * @return EE_Checkin |
|
60 | + * @throws EE_Error |
|
61 | + */ |
|
62 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) |
|
63 | + { |
|
64 | + return new self($props_n_values, true, $timezone); |
|
65 | + } |
|
66 | + |
|
67 | + |
|
68 | + public function ID() |
|
69 | + { |
|
70 | + return $this->get('CHK_ID'); |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + public function registration_id() |
|
75 | + { |
|
76 | + return $this->get('REG_ID'); |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + public function datetime_id() |
|
81 | + { |
|
82 | + return $this->get('DTT_ID'); |
|
83 | + } |
|
84 | + |
|
85 | + |
|
86 | + public function status() |
|
87 | + { |
|
88 | + return $this->get('CHK_in'); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + public function timestamp() |
|
93 | + { |
|
94 | + return $this->get('CHK_timestamp'); |
|
95 | + } |
|
96 | 96 | } |