Code Duplication    Length = 20-20 lines in 2 locations

core/db_classes/EE_Export.class.php 1 location

@@ 400-419 (lines=20) @@
397
				$payment_methods = array();
398
				$gateway_txn_ids_etc = array();
399
				$payment_times = array();
400
				if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){
401
					$payments_info = EEM_Payment::instance()->get_all_wpdb_results(
402
							array(
403
								array(
404
									'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ],
405
									'STS_ID' => EEM_Payment::status_id_approved
406
								),
407
								'force_join' => array( 'Payment_Method' ),
408
409
							),
410
							ARRAY_A,
411
							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
412
413
					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
414
						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
415
						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
416
						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
417
					}
418
419
				}
420
				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
421
				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
422
				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );

core/libraries/batch/JobHandlers/RegistrationsReport.php 1 location

@@ 221-240 (lines=20) @@
218
				$payment_methods = array();
219
				$gateway_txn_ids_etc = array();
220
				$payment_times = array();
221
				if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){
222
					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(
223
							array(
224
								array(
225
									'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ],
226
									'STS_ID' => \EEM_Payment::status_id_approved
227
								),
228
								'force_join' => array( 'Payment_Method' ),
229
230
							),
231
							ARRAY_A,
232
							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
233
234
					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
235
						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
236
						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
237
						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
238
					}
239
240
				}
241
				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
242
				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
243
				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );