@@ 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() |
|
@@ 239-248 (lines=10) @@ | ||
236 | $registration_payment->delete_permanently(); |
|
237 | $save_payment = true; |
|
238 | } |
|
239 | } else { |
|
240 | EE_Error::add_error( |
|
241 | sprintf( |
|
242 | __( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ), |
|
243 | $registration_payment->ID() |
|
244 | ), |
|
245 | __FILE__, __FUNCTION__, __LINE__ |
|
246 | ); |
|
247 | return false; |
|
248 | } |
|
249 | } else { |
|
250 | EE_Error::add_error( |
|
251 | sprintf( |
|
@@ 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 | } |
@@ 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 |
@@ 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__); |