← All changes
|
includes/admin/tools/data/class-give-tools-recount-single-donor-stats.php
+18
-10
2.3.0
→
4.18.0
View file →
| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * This class handles batch processing of recounting a single donor's stats. |
| 6 | 6 | * |
| 7 | 7 | * @subpackage Admin/Tools/Give_Tools_Recount_Single_Customer_Stats |
| 8 | - * @copyright Copyright (c) 2016, WordImpress | |
| 8 | + * @copyright Copyright (c) 2016, GiveWP | |
| 9 | 9 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 10 | 10 | * @since 1.5 |
| 11 | 11 | */ |
| 12 | 12 | |
| @@ -23,8 +23,9 @@ | ||
| 23 | 23 | class Give_Tools_Recount_Single_Customer_Stats extends Give_Batch_Export { |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Our export type. Used for export-type specific filters/actions |
| 27 | + * | |
| 27 | 28 | * @var string |
| 28 | 29 | * @since 1.5 |
| 29 | 30 | */ |
| 30 | 31 | public $export_type = ''; |
| @@ -30,8 +31,9 @@ | ||
| 30 | 31 | public $export_type = ''; |
| 31 | 32 | |
| 32 | 33 | /** |
| 33 | 34 | * Allows for a non-form batch processing to be run. |
| 35 | + * | |
| 34 | 36 | * @since 1.5 |
| 35 | 37 | * @var boolean |
| 36 | 38 | */ |
| 37 | 39 | public $is_void = true; |
| @@ -37,8 +39,9 @@ | ||
| 37 | 39 | public $is_void = true; |
| 38 | 40 | |
| 39 | 41 | /** |
| 40 | 42 | * Sets the number of items to pull on each step |
| 43 | + * | |
| 41 | 44 | * @since 1.5 |
| 42 | 45 | * @var integer |
| 43 | 46 | */ |
| 44 | 47 | public $per_step = 10; |
| @@ -94,13 +97,11 @@ | ||
| 94 | 97 | $found_payment_ids[] = $payment->ID; |
| 95 | 98 | |
| 96 | 99 | if ( apply_filters( 'give_donor_recount_should_increase_value', true, $payment ) ) { |
| 97 | 100 | $payment_amount = (float) give_donation_amount( $payment->ID, array( 'type' => 'stats' ) ); |
| 98 | - $step_total += $payment_amount; | |
| 101 | + $step_total += $payment_amount; | |
| 99 | 102 | } |
| 100 | - | |
| 101 | 103 | } |
| 102 | - | |
| 103 | 104 | } |
| 104 | 105 | |
| 105 | 106 | $updated_total = $pending_total + $step_total; |
| 106 | 107 | $this->store_data( 'give_stats_donor_pending_total' . $donor->id, $updated_total ); |
| @@ -194,13 +195,15 @@ | ||
| 194 | 195 | $this->delete_data( 'give_recount_donor_stats_' . $donor->id ); |
| 195 | 196 | $this->delete_data( 'give_recount_donor_payments_' . $this->customer_id ); |
| 196 | 197 | |
| 197 | 198 | $payment_ids = implode( ',', $payment_ids ); |
| 198 | - $donor->update( array( | |
| 199 | - 'payment_ids' => $payment_ids, | |
| 200 | - 'purchase_count' => $purchase_count, | |
| 201 | - 'purchase_value' => $pending_total, | |
| 202 | - ) ); | |
| 199 | + $donor->update( | |
| 200 | + array( | |
| 201 | + 'payment_ids' => $payment_ids, | |
| 202 | + 'purchase_count' => $purchase_count, | |
| 203 | + 'purchase_value' => $pending_total, | |
| 204 | + ) | |
| 205 | + ); | |
| 203 | 206 | |
| 204 | 207 | $this->done = true; |
| 205 | 208 | $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
| 206 | 209 | |
| @@ -239,9 +242,14 @@ | ||
| 239 | 242 | $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
| 240 | 243 | |
| 241 | 244 | // Before we start, let's zero out the customer's data |
| 242 | 245 | $donor = new Give_Donor( $this->customer_id ); |
| 243 | - $donor->update( array( 'purchase_value' => give_format_amount( 0, array( 'sanitize' => false ) ), 'purchase_count' => 0 ) ); | |
| 246 | + $donor->update( | |
| 247 | + array( | |
| 248 | + 'purchase_value' => give_format_amount( 0, array( 'sanitize' => false ) ), | |
| 249 | + 'purchase_count' => 0, | |
| 250 | + ) | |
| 251 | + ); | |
| 244 | 252 | |
| 245 | 253 | $attached_payment_ids = explode( ',', $donor->payment_ids ); |
| 246 | 254 | |
| 247 | 255 | $attached_args = array( |