Code Duplication    Length = 15-15 lines in 2 locations

includes/admin/tools/data/class-give-tools-recount-form-stats.php 1 location

@@ 91-105 (lines=15) @@
88
		$payments = $payments->get_payments();
89
90
		if ( $payments ) {
91
			foreach ( $payments as $payment ) {
92
93
				// Ensure acceptable status only.
94
				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
95
					continue;
96
				}
97
98
				// Ensure only payments for this form are counted.
99
				if ( $payment->form_id != $this->form_id ) {
100
					continue;
101
				}
102
103
				$totals['sales'] ++;
104
				$totals['earnings'] += $payment->total;
105
106
			}
107
108
			$this->store_data( 'give_temp_recount_form_stats', $totals );

includes/misc-functions.php 1 location

@@ 1476-1490 (lines=15) @@
1473
		$payments = $payments->get_payments();
1474
1475
		if ( $payments ) {
1476
			foreach ( $payments as $payment ) {
1477
				// Ensure acceptible status only
1478
				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1479
					continue;
1480
				}
1481
1482
				// Ensure only payments for this form are counted
1483
				if ( $payment->form_id != $form_id ) {
1484
					continue;
1485
				}
1486
1487
				$totals['sales'] ++;
1488
				$totals['earnings'] += $payment->total;
1489
1490
			}
1491
		}
1492
		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1493
		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );