PluginProbe
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.2.2
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.2.2
5.6.11 5.6.10 5.6.9 5.6.8 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 All 48 releases
← All changes | lib/misc/filter.php +22 -25 trunk5.2.2 View file →
@@ -5,25 +5,25 @@
5 5
6 6 namespace LatePoint\Misc;
7 7
8 8 class Filter {
9 - public $service_id = 0;
10 - public $agent_id = 0;
9 + public $service_id = 0;
10 + public $agent_id = 0;
11 11 public $location_id = 0;
12 12
13 13 public $connections = [];
14 14
15 - public ?int $week_day = null;
15 + public ?int $week_day = null;
16 16 public ?string $date_from = null;
17 - public ?string $date_to = null;
17 + public ?string $date_to = null;
18 18
19 19 public ?int $start_time = null;
20 - public ?int $end_time = null;
20 + public ?int $end_time = null;
21 21
22 - public array $statuses = [];
22 + public array $statuses = [];
23 23 public array $exclude_booking_ids = [];
24 - public bool $consider_cart_items = false;
25 - public bool $exact_match = false;
24 + public bool $consider_cart_items = false;
25 + public bool $exact_match = false;
26 26
27 27 function __construct( array $args = [] ) {
28 28 $allowed_args = [
29 29 'service_id',
@@ -36,9 +36,9 @@
36 36 'end_time',
37 37 'week_day',
38 38 'statuses',
39 39 'exclude_booking_ids',
40 - 'exact_match',
40 + 'exact_match'
41 41 ];
42 42 foreach ( $args as $key => $arg ) {
43 43 if ( in_array( $key, $allowed_args ) ) {
44 44 $this->$key = $arg;
@@ -53,14 +53,12 @@
53 53 // if connections are passed - query by connection
54 54 if ( $this->connections ) {
55 55 $connection_conditions = [];
56 56 foreach ( $this->connections as $connection ) {
57 - $connection_conditions[] = [
58 - 'AND' => [
59 - 'agent_id' => [ 0, $connection->agent_id ],
60 - 'service_id' => [ 0, $connection->service_id ],
61 - 'location_id' => [ 0, $connection->location_id ],
62 - ],
57 + $connection_conditions[] = [ 'AND' => [ 'agent_id' => [ 0, $connection->agent_id ],
58 + 'service_id' => [ 0, $connection->service_id ],
59 + 'location_id' => [ 0, $connection->location_id ]
60 + ]
63 61 ];
64 62 }
65 63 $query_args['AND'][] = [ 'OR' => $connection_conditions ];
66 64 } else {
@@ -98,16 +96,15 @@
98 96 return $query_args;
99 97 }
100 98
101 99 public static function create_from_booking_request( BookingRequest $booking_request ): Filter {
102 - return new self(
103 - [
104 - 'date_from' => $booking_request->start_date,
105 - 'start_time' => $booking_request->start_time,
106 - 'end_time' => $booking_request->end_time,
107 - 'agent_id' => $booking_request->agent_id,
108 - 'location_id' => $booking_request->location_id,
109 - 'service_id' => $booking_request->service_id,
110 - ]
111 - );
100 + return new self( [
101 + 'date_from' => $booking_request->start_date,
102 + 'start_time' => $booking_request->start_time,
103 + 'end_time' => $booking_request->end_time,
104 + 'agent_id' => $booking_request->agent_id,
105 + 'location_id' => $booking_request->location_id,
106 + 'service_id' => $booking_request->service_id
107 + ] );
112 108 }
109 +
113 110 }