|
@@ 357-370 (lines=14) @@
|
| 354 |
|
* |
| 355 |
|
* @return bool |
| 356 |
|
*/ |
| 357 |
|
public function increment_stats( $donor_id = 0, $amount = 0.00 ) { |
| 358 |
|
|
| 359 |
|
$donor = new Give_Donor( $donor_id ); |
| 360 |
|
|
| 361 |
|
if ( empty( $donor->id ) ) { |
| 362 |
|
return false; |
| 363 |
|
} |
| 364 |
|
|
| 365 |
|
$increased_count = $donor->increase_purchase_count(); |
| 366 |
|
$increased_value = $donor->increase_value( $amount ); |
| 367 |
|
|
| 368 |
|
return ( $increased_count && $increased_value ) ? true : false; |
| 369 |
|
|
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
/** |
| 373 |
|
* Decrements donor's donation stats. |
|
@@ 383-396 (lines=14) @@
|
| 380 |
|
* |
| 381 |
|
* @return bool |
| 382 |
|
*/ |
| 383 |
|
public function decrement_stats( $donor_id = 0, $amount = 0.00 ) { |
| 384 |
|
|
| 385 |
|
$donor = new Give_Donor( $donor_id ); |
| 386 |
|
|
| 387 |
|
if ( ! $donor ) { |
| 388 |
|
return false; |
| 389 |
|
} |
| 390 |
|
|
| 391 |
|
$decreased_count = $donor->decrease_donation_count(); |
| 392 |
|
$decreased_value = $donor->decrease_value( $amount ); |
| 393 |
|
|
| 394 |
|
return ( $decreased_count && $decreased_value ) ? true : false; |
| 395 |
|
|
| 396 |
|
} |
| 397 |
|
|
| 398 |
|
/** |
| 399 |
|
* Retrieves a single donor from the database |