| @@ 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 | } |
|
| @@ 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__); |
|
| @@ 1141-1155 (lines=15) @@ | ||
| 1138 | public function get_DateTime_object($field_name) |
|
| 1139 | { |
|
| 1140 | $field_settings = $this->get_model()->field_settings_for($field_name); |
|
| 1141 | if ( ! $field_settings instanceof EE_Datetime_Field) { |
|
| 1142 | EE_Error::add_error( |
|
| 1143 | sprintf( |
|
| 1144 | __( |
|
| 1145 | 'The field %s is not an EE_Datetime_Field field. There is no DateTime object stored on this field type.', |
|
| 1146 | 'event_espresso' |
|
| 1147 | ), |
|
| 1148 | $field_name |
|
| 1149 | ), |
|
| 1150 | __FILE__, |
|
| 1151 | __FUNCTION__, |
|
| 1152 | __LINE__ |
|
| 1153 | ); |
|
| 1154 | return false; |
|
| 1155 | } |
|
| 1156 | return $this->_fields[$field_name]; |
|
| 1157 | } |
|
| 1158 | ||