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

@@ 1617-1631 (lines=15) @@
1614
		$payments = $payments->get_payments();
1615
1616
		if ( $payments ) {
1617
			foreach ( $payments as $payment ) {
1618
				// Ensure acceptible status only
1619
				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
1620
					continue;
1621
				}
1622
1623
				// Ensure only payments for this form are counted
1624
				if ( $payment->form_id != $form_id ) {
1625
					continue;
1626
				}
1627
1628
				$totals['sales'] ++;
1629
				$totals['earnings'] += $payment->total;
1630
1631
			}
1632
		}
1633
		give_update_meta( $form_id, '_give_form_sales', $totals['sales'] );
1634
		give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );