| @@ -414,14 +414,19 @@ | ||
| 414 | 414 | * |
| 415 | 415 | * @return WP_Query |
| 416 | 416 | */ |
| 417 | 417 | private function booking_query() { |
| 418 | - $default_booking_status = timetics_get_option( 'default_booking_status', 'approved' ); | |
| 418 | + // Not tied to "default_booking_status" (that's what status a NEW | |
| 419 | + // booking starts in, not which bookings count here) — otherwise an | |
| 420 | + // approved booking can vanish from the customer's count/history the | |
| 421 | + // moment it's approved, on any site where new bookings default to | |
| 422 | + // pending. See core/reports/api-report.php for the same fix. | |
| 423 | + $counted_statuses = apply_filters( 'timetics/report/counted_statuses', [ 'approved', 'completed' ] ); | |
| 419 | 424 | |
| 420 | 425 | $query = new \WP_Query( |
| 421 | 426 | [ |
| 422 | 427 | 'post_type' => 'timetics-booking', |
| 423 | - 'post_status' => $default_booking_status, | |
| 428 | + 'post_status' => $counted_statuses, | |
| 424 | 429 | // @codingStandardsIgnoreStart |
| 425 | 430 | 'meta_key' => '_tt_booking_customer', |
| 426 | 431 | 'meta_value' => $this->id, |
| 427 | 432 | // @codingStandardsIgnoreEnd |