Code Duplication    Length = 15-15 lines in 2 locations

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

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

includes/misc-functions.php 1 location

@@ 1916-1930 (lines=15) @@
1913
		$payments = $payments->get_payments();
1914
1915
		if ( $payments ) {
1916
			foreach ( $payments as $payment ) {
1917
				// Ensure acceptible status only
1918
				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1919
					continue;
1920
				}
1921
1922
				// Ensure only payments for this form are counted
1923
				if ( $payment->form_id != $form_id ) {
1924
					continue;
1925
				}
1926
1927
				$totals['sales'] ++;
1928
				$totals['earnings'] += $payment->total;
1929
1930
			}
1931
		}
1932
		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1933
		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );