| @@ 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 ); |
|
| @@ 1460-1474 (lines=15) @@ | ||
| 1457 | $payments = $payments->get_payments(); |
|
| 1458 | ||
| 1459 | if ( $payments ) { |
|
| 1460 | foreach ( $payments as $payment ) { |
|
| 1461 | // Ensure acceptible status only |
|
| 1462 | if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
| 1463 | continue; |
|
| 1464 | } |
|
| 1465 | ||
| 1466 | // Ensure only payments for this form are counted |
|
| 1467 | if ( $payment->form_id != $form_id ) { |
|
| 1468 | continue; |
|
| 1469 | } |
|
| 1470 | ||
| 1471 | $totals['sales'] ++; |
|
| 1472 | $totals['earnings'] += $payment->total; |
|
| 1473 | ||
| 1474 | } |
|
| 1475 | } |
|
| 1476 | give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
| 1477 | give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|