Code Duplication    Length = 20-20 lines in 2 locations

core/db_classes/EE_Export.class.php 1 location

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

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

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