| @@ -43,8 +43,12 @@ | ||
| 43 | 43 | public ?array $exceptions = null; |
| 44 | 44 | public string $exception_type = 'exclude'; |
| 45 | 45 | public string $capacity_type = 'fixed'; |
| 46 | 46 | public ?int $capacity_value = null; |
| 47 | + // The rule editor persists the seat cap here; `capacity_value` is only written | |
| 48 | + // by the legacy `/trips/{id}/recurring-rules` path. Both are read (seats_total | |
| 49 | + // first) so rules created by either path resolve to the same capacity. | |
| 50 | + public ?int $seats_total = null; | |
| 47 | 51 | public float $pricing_adjustment = 0.00; |
| 48 | 52 | public string $pricing_adjustment_type = 'amount'; |
| 49 | 53 | public ?int $cutoff_hours = null; |
| 50 | 54 | public ?int $cutoff_days = null; |
| @@ -80,8 +84,11 @@ | ||
| 80 | 84 | $rule->recurrence_type = sanitize_text_field($data['recurrence_type'] ?? 'weekly'); |
| 81 | 85 | $rule->start_date = !empty($data['start_date']) ? sanitize_text_field($data['start_date']) : null; |
| 82 | 86 | $rule->end_date = !empty($data['end_date']) ? sanitize_text_field($data['end_date']) : null; |
| 83 | 87 | $rule->capacity_value = (int) ($data['capacity_value'] ?? 0); |
| 88 | + $rule->seats_total = isset($data['seats_total']) && $data['seats_total'] !== null && $data['seats_total'] !== '' | |
| 89 | + ? (int) $data['seats_total'] | |
| 90 | + : null; | |
| 84 | 91 | $rule->price_override = !empty($data['price_override']) ? (float) $data['price_override'] : null; |
| 85 | 92 | $rule->created_at = $data['created_at'] ?? ''; |
| 86 | 93 | $rule->updated_at = $data['updated_at'] ?? ''; |
| 87 | 94 | $rule->availability_status = sanitize_text_field($data['availability_status'] ?? 'available'); |