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

@@ 249-268 (lines=20) @@
246
				$payment_methods = array();
247
				$gateway_txn_ids_etc = array();
248
				$payment_times = array();
249
				if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){
250
					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(
251
							array(
252
								array(
253
									'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ],
254
									'STS_ID' => \EEM_Payment::status_id_approved
255
								),
256
								'force_join' => array( 'Payment_Method' ),
257
258
							),
259
							ARRAY_A,
260
							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
261
262
					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
263
						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
264
						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
265
						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
266
					}
267
268
				}
269
				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
270
				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
271
				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );