@@ 499-503 (lines=5) @@ | ||
496 | return false; |
|
497 | } |
|
498 | foreach ($data as $key => $value) { |
|
499 | if (isset($this->_default_session_vars[ $key ])) { |
|
500 | EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', |
|
501 | 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__); |
|
502 | return false; |
|
503 | } |
|
504 | $this->_session_data[ $key ] = $value; |
|
505 | } |
|
506 | return true; |
@@ 98-101 (lines=4) @@ | ||
95 | */ |
|
96 | public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
97 | // verify transaction |
|
98 | if ( ! $transaction instanceof EE_Transaction ) { |
|
99 | EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
100 | return false; |
|
101 | } |
|
102 | // calculate total paid |
|
103 | $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
104 | // if total paid has changed |
|
@@ 135-138 (lines=4) @@ | ||
132 | */ |
|
133 | public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
134 | // verify transaction |
|
135 | if ( ! $transaction instanceof EE_Transaction ) { |
|
136 | EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
137 | return false; |
|
138 | } |
|
139 | // ensure Payment model is loaded |
|
140 | EE_Registry::instance()->load_model( 'Payment' ); |
|
141 | // calls EEM_Base::sum() |
|
@@ 292-298 (lines=7) @@ | ||
289 | '5.0.0' |
|
290 | ); |
|
291 | // verify transaction |
|
292 | if ( ! $transaction instanceof EE_Transaction) { |
|
293 | EE_Error::add_error( |
|
294 | __('Please provide a valid EE_Transaction object.', 'event_espresso'), |
|
295 | __FILE__, __FUNCTION__, __LINE__ |
|
296 | ); |
|
297 | return false; |
|
298 | } |
|
299 | // set transaction status based on comparison of TXN_paid vs TXN_total |
|
300 | return $transaction->update_status_based_on_total_paid($update_txn); |
|
301 | } |
|
@@ 64-70 (lines=7) @@ | ||
61 | */ |
|
62 | public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) { |
|
63 | $total_line_item = $transaction->total_line_item(); |
|
64 | if ( ! $total_line_item instanceof EE_Line_Item ) { |
|
65 | EE_Error::add_error( |
|
66 | sprintf( __( 'The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso' ), $transaction->ID() ), |
|
67 | __FILE__, __FUNCTION__, __LINE__ |
|
68 | ); |
|
69 | return false; |
|
70 | } |
|
71 | $new_total = $total_line_item->recalculate_total_including_taxes(); |
|
72 | $transaction->set_total( $new_total ); |
|
73 | if ( $update_txn ) { |
@@ 1098-1112 (lines=15) @@ | ||
1095 | public function get_DateTime_object($field_name) |
|
1096 | { |
|
1097 | $field_settings = $this->get_model()->field_settings_for($field_name); |
|
1098 | if ( ! $field_settings instanceof EE_Datetime_Field) { |
|
1099 | EE_Error::add_error( |
|
1100 | sprintf( |
|
1101 | __( |
|
1102 | 'The field %s is not an EE_Datetime_Field field. There is no DateTime object stored on this field type.', |
|
1103 | 'event_espresso' |
|
1104 | ), |
|
1105 | $field_name |
|
1106 | ), |
|
1107 | __FILE__, |
|
1108 | __FUNCTION__, |
|
1109 | __LINE__ |
|
1110 | ); |
|
1111 | return false; |
|
1112 | } |
|
1113 | return $this->_fields[$field_name]; |
|
1114 | } |
|
1115 |
@@ 204-210 (lines=7) @@ | ||
201 | // instantiate module class |
|
202 | $module = new $module_name(); |
|
203 | // ensure that class is actually a module |
|
204 | if (! $module instanceof EED_Module) { |
|
205 | EE_Error::add_error( |
|
206 | sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name), |
|
207 | __FILE__, __FUNCTION__, __LINE__ |
|
208 | ); |
|
209 | return null; |
|
210 | } |
|
211 | return $module; |
|
212 | } |
|
213 | ||
@@ 190-200 (lines=11) @@ | ||
187 | */ |
|
188 | public static function module_factory($module_name) |
|
189 | { |
|
190 | if ($module_name === 'EED_Module') { |
|
191 | EE_Error::add_error( |
|
192 | sprintf( |
|
193 | __( |
|
194 | 'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.', |
|
195 | 'event_espresso' |
|
196 | ), $module_name |
|
197 | ), __FILE__, __FUNCTION__, __LINE__ |
|
198 | ); |
|
199 | return null; |
|
200 | } |
|
201 | // instantiate module class |
|
202 | $module = new $module_name(); |
|
203 | // ensure that class is actually a module |
@@ 493-496 (lines=4) @@ | ||
490 | */ |
|
491 | protected function _save_billing_info_to_attendee($billing_form, $transaction) |
|
492 | { |
|
493 | if (!$transaction || !$transaction instanceof EE_Transaction) { |
|
494 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
495 | return false; |
|
496 | } |
|
497 | $primary_reg = $transaction->primary_registration(); |
|
498 | if (!$primary_reg) { |
|
499 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |