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

@@ 291-310 (lines=20) @@
288
                $payment_methods = array();
289
                $gateway_txn_ids_etc = array();
290
                $payment_times = array();
291
                if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
292
                    $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array(
293
                        array(
294
                            'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
295
                            'STS_ID' => \EEM_Payment::status_id_approved,
296
                        ),
297
                        'force_join' => array('Payment_Method'),
298
                    ), ARRAY_A,
299
                        'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time');
300
                    foreach ($payments_info as $payment_method_and_gateway_txn_id) {
301
                        $payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
302
                            ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
303
                        $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
304
                            ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
305
                        $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
306
                            ? $payment_method_and_gateway_txn_id['payment_time'] : '';
307
                    }
308
                }
309
                $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
310
                $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
311
                $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
312
                //get whether or not the user has checked in
313
                $reg_csv_array[__("Check-Ins",