PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.2.9
LatePoint – Calendar Booking Plugin for Appointments and Events v5.2.9
5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / misc / booked_period.php
latepoint / lib / misc Last commit date
blocked_period.php 1 year ago booked_period.php 1 year ago booking_request.php 1 year ago booking_resource.php 1 year ago booking_slot.php 1 year ago filter.php 1 year ago process_action.php 9 months ago process_event.php 1 year ago role.php 1 year ago router.php 1 year ago step.php 1 year ago stripe_connect_customer.php 1 year ago time_period.php 1 year ago user.php 1 year ago work_period.php 1 year ago
booked_period.php
50 lines
1 <?php
2 /*
3 * Copyright (c) 2022 LatePoint LLC. All rights reserved.
4 *
5 * This class is used to create booked periods in resources
6 */
7
8 namespace LatePoint\Misc;
9
10 class BookedPeriod extends BlockedPeriod {
11 public int $buffer_before = 0;
12 public int $buffer_after = 0;
13 public int $total_attendees = 1;
14
15
16 public static function create_from_booking_model(\OsBookingModel $booking): BookedPeriod{
17 return new BookedPeriod([ 'start_date' => $booking->start_date,
18 'end_date' => $booking->end_date,
19 'start_time' => $booking->start_time,
20 'end_time' => $booking->end_time,
21 'buffer_before' => $booking->buffer_before,
22 'buffer_after' => $booking->buffer_after,
23 'total_attendees' => $booking->total_attendees ?? 1,
24 'agent_id' => $booking->agent_id,
25 'service_id' => $booking->service_id,
26 'location_id' => $booking->location_id
27 ]);
28 }
29
30 function start_time_with_buffer(): int{
31 return $this->start_time - $this->buffer_before;
32 }
33
34 function end_time_with_buffer(): int{
35 return $this->end_time + $this->buffer_after;
36 }
37
38 public static function allowed_props(): array{
39 return ['start_date',
40 'end_date',
41 'start_time',
42 'end_time',
43 'buffer_before',
44 'buffer_after',
45 'total_attendees',
46 'service_id',
47 'agent_id',
48 'location_id'];
49 }
50 }