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

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