WordPress Online Booking and Scheduling Plugin – Bookly - Version 17.1

Version Description

Download this release

Release Info

Developer Ladela
Plugin Icon 128x128 WordPress Online Booking and Scheduling Plugin – Bookly
Version 17.1
Comparing to
See all releases

Code changes from version 17.0 to 17.1

backend/components/dialogs/appointment/edit/Ajax.php CHANGED
@@ -59,10 +59,11 @@ class Ajax extends Lib\Base\Ajax
59
 
60
  // Staff list.
61
  $staff = Lib\Entities\Staff::query()->findOne();
62
- $staff_members = $staff ? Lib\Config::proActive() ? Lib\Utils\Common::isCurrentUserSupervisor() ? Lib\Entities\Staff::query()->find() : Lib\Entities\Staff::query()->where( 'wp_user_id', get_current_user_id() )->find() : array( $staff ) : array();
63
  $postfix_archived = sprintf( ' (%s)', __( 'Archived', 'bookly' ) );
64
 
65
  $max_duration = 0;
 
66
 
67
  foreach ( $staff_members as $staff_member ) {
68
  $services = array();
@@ -74,6 +75,7 @@ class Ajax extends Lib\Base\Ajax
74
  if ( $type == Lib\Entities\Service::TYPE_SIMPLE || ! empty( $sub_services ) ) {
75
  if ( $staff_service->getLocationId() === null || Lib\Proxy\Locations::prepareStaffLocationId( $staff_service->getLocationId(), $staff_service->getStaffId() ) == $staff_service->getLocationId() ) {
76
  if ( ! in_array( $staff_service->service->getId(), array_map( function ( $service ) { return $service['id']; }, $services ) ) ) {
 
77
  $services[] = array(
78
  'id' => $staff_service->service->getId(),
79
  'title' => sprintf(
@@ -81,6 +83,7 @@ class Ajax extends Lib\Base\Ajax
81
  $staff_service->service->getTitle(),
82
  Lib\Utils\DateTime::secondsToInterval( $staff_service->service->getDuration() )
83
  ),
 
84
  'duration' => $staff_service->service->getDuration(),
85
  'units_min' => $staff_service->service->getUnitsMin(),
86
  'units_max' => $staff_service->service->getUnitsMax(),
@@ -118,6 +121,7 @@ class Ajax extends Lib\Base\Ajax
118
  'archived' => $staff_member->getVisibility() == 'archive',
119
  'services' => $services,
120
  'locations' => $locations,
 
121
  );
122
  }
123
 
59
 
60
  // Staff list.
61
  $staff = Lib\Entities\Staff::query()->findOne();
62
+ $staff_members = $staff ? Lib\Config::proActive() ? Lib\Utils\Common::isCurrentUserSupervisor() ? Lib\Entities\Staff::query()->sortBy( 'position' )->find() : Lib\Entities\Staff::query()->where( 'wp_user_id', get_current_user_id() )->find() : array( $staff ) : array();
63
  $postfix_archived = sprintf( ' (%s)', __( 'Archived', 'bookly' ) );
64
 
65
  $max_duration = 0;
66
+ $has_categories = (bool) Lib\Entities\Category::query()->findOne();
67
 
68
  foreach ( $staff_members as $staff_member ) {
69
  $services = array();
75
  if ( $type == Lib\Entities\Service::TYPE_SIMPLE || ! empty( $sub_services ) ) {
76
  if ( $staff_service->getLocationId() === null || Lib\Proxy\Locations::prepareStaffLocationId( $staff_service->getLocationId(), $staff_service->getStaffId() ) == $staff_service->getLocationId() ) {
77
  if ( ! in_array( $staff_service->service->getId(), array_map( function ( $service ) { return $service['id']; }, $services ) ) ) {
78
+ $category = Lib\Entities\Category::find( Lib\Entities\Service::find( $staff_service->getServiceId() )->getCategoryId() );
79
  $services[] = array(
80
  'id' => $staff_service->service->getId(),
81
  'title' => sprintf(
83
  $staff_service->service->getTitle(),
84
  Lib\Utils\DateTime::secondsToInterval( $staff_service->service->getDuration() )
85
  ),
86
+ 'category' => $category ? $category->getName() : ( $has_categories ? __( 'Uncategorized', 'bookly' ) : ''),
87
  'duration' => $staff_service->service->getDuration(),
88
  'units_min' => $staff_service->service->getUnitsMin(),
89
  'units_max' => $staff_service->service->getUnitsMax(),
121
  'archived' => $staff_member->getVisibility() == 'archive',
122
  'services' => $services,
123
  'locations' => $locations,
124
+ 'category' => Lib\Proxy\Pro::getStaffCategoryName( $staff_member->getCategoryId() ),
125
  );
126
  }
127
 
backend/components/dialogs/appointment/edit/templates/edit.php CHANGED
@@ -22,13 +22,13 @@ use Bookly\Lib\Entities\CustomerAppointment;
22
  <div ng-hide="loading || form.screen != 'main'" class="modal-body">
23
  <div class=form-group>
24
  <label for="bookly-provider"><?php esc_html_e( 'Provider', 'bookly' ) ?></label>
25
- <select id="bookly-provider" class="form-control" ng-model="form.staff" ng-options="s.full_name + (form.staff_any == s ? ' (' + dataSource.l10n.staff_any + ')' : '') for s in dataSource.data.staff | filter:filterStaff" ng-change="onStaffChange()"></select>
26
  </div>
27
 
28
  <div class=form-group>
29
  <label for="bookly-service"><?php esc_html_e( 'Service', 'bookly' ) ?></label>
30
  <select id="bookly-service" class="form-control" ng-model="form.service"
31
- ng-options="s.title for s in form.staff.services" ng-change="onServiceChange()">
32
  <option value=""><?php esc_html_e( '-- Select a service --', 'bookly' ) ?></option>
33
  </select>
34
  <p class="text-danger" my-slide-up="errors.service_required">
22
  <div ng-hide="loading || form.screen != 'main'" class="modal-body">
23
  <div class=form-group>
24
  <label for="bookly-provider"><?php esc_html_e( 'Provider', 'bookly' ) ?></label>
25
+ <select id="bookly-provider" class="form-control" ng-model="form.staff" ng-options="s.full_name + (form.staff_any == s ? ' (' + dataSource.l10n.staff_any + ')' : '') group by s.category for s in dataSource.data.staff | filter:filterStaff" ng-change="onStaffChange()"></select>
26
  </div>
27
 
28
  <div class=form-group>
29
  <label for="bookly-service"><?php esc_html_e( 'Service', 'bookly' ) ?></label>
30
  <select id="bookly-service" class="form-control" ng-model="form.service"
31
+ ng-options="s.title group by s.category for s in form.staff.services" ng-change="onServiceChange()">
32
  <option value=""><?php esc_html_e( '-- Select a service --', 'bookly' ) ?></option>
33
  </select>
34
  <p class="text-danger" my-slide-up="errors.service_required">
backend/components/dialogs/sms/Ajax.php CHANGED
@@ -20,7 +20,7 @@ class Ajax extends Lib\Base\Ajax
20
  /**
21
  * Save notification.
22
  */
23
- public function saveNotification()
24
  {
25
  $data = self::parameter( 'notification' );
26
  $notification = new Lib\Entities\Notification();
20
  /**
21
  * Save notification.
22
  */
23
+ public static function saveNotification()
24
  {
25
  $data = self::parameter( 'notification' );
26
  $notification = new Lib\Entities\Notification();
lib/entities/Service.php CHANGED
@@ -305,7 +305,7 @@ class Service extends Lib\Base\Entity
305
  ->where( 'a.service_id', $service_id )
306
  ->where( 'ca.compound_service_id', $compound_service_id )
307
  ->where( 'ca.customer_id', $customer_id )
308
- ->whereGt( 'a.start_date', $bound_start )
309
  ->whereLt( 'a.start_date', $bound_end )
310
  ->whereNot( 'ca.status', CustomerAppointment::STATUS_WAITLISTED )
311
  ->count();
305
  ->where( 'a.service_id', $service_id )
306
  ->where( 'ca.compound_service_id', $compound_service_id )
307
  ->where( 'ca.customer_id', $customer_id )
308
+ ->whereGte( 'a.start_date', $bound_start )
309
  ->whereLt( 'a.start_date', $bound_end )
310
  ->whereNot( 'ca.status', CustomerAppointment::STATUS_WAITLISTED )
311
  ->count();
lib/notifications/Routine.php CHANGED
@@ -256,8 +256,6 @@ abstract class Routine
256
 
257
  $query = strtr( $query, $replace );
258
 
259
- $query .= self::getAndWhereServiceType( $settings );
260
-
261
  foreach ( (array) $wpdb->get_results( $query, ARRAY_A ) as $fields ) {
262
  $ca_list[] = new CustomerAppointment( $fields );
263
  }
@@ -507,7 +505,7 @@ abstract class Routine
507
  */
508
  private static function getAndWhereServiceType( Settings $settings )
509
  {
510
- $query = '';
511
  /* [
512
  * 'simple' => [ 1 => [1] ],
513
  * 'compound' => [ 4 => [2,3]],
@@ -518,28 +516,28 @@ abstract class Routine
518
  if ( $services != 'any' ) {
519
  foreach ( $services as $service_type => $service ) {
520
  $ids = array();
521
- foreach ( $service as $simple_service_ids ) {
522
- $ids[] = array_merge( $ids, $simple_service_ids );
523
  }
524
  if ( $ids ) {
525
  $ids = array_unique( $ids );
526
  switch ( $service_type ) {
527
  case Service::TYPE_SIMPLE:
528
  case Service::TYPE_PACKAGE:
529
- $query .= sprintf( ' AND `a`.`service_id` IN (%s)', implode( ', ', $ids ) );
530
  break;
531
  case Service::TYPE_COMPOUND:
532
- $query .= sprintf( ' AND `ca`.`compound_service_id` IN (%s)', implode( ', ', $ids ) );
533
  break;
534
  case Service::TYPE_COLLABORATIVE:
535
- $query .= sprintf( ' AND `ca`.`collaborative_service_id` IN (%s)', implode( ', ', $ids ) );
536
  break;
537
  }
538
  }
539
  }
540
  }
541
 
542
- return $query;
543
  }
544
 
545
  /**
256
 
257
  $query = strtr( $query, $replace );
258
 
 
 
259
  foreach ( (array) $wpdb->get_results( $query, ARRAY_A ) as $fields ) {
260
  $ca_list[] = new CustomerAppointment( $fields );
261
  }
505
  */
506
  private static function getAndWhereServiceType( Settings $settings )
507
  {
508
+ $query = array();
509
  /* [
510
  * 'simple' => [ 1 => [1] ],
511
  * 'compound' => [ 4 => [2,3]],
516
  if ( $services != 'any' ) {
517
  foreach ( $services as $service_type => $service ) {
518
  $ids = array();
519
+ foreach ( $service as $service_id => $simple_service_ids ) {
520
+ $ids[] = $service_id;
521
  }
522
  if ( $ids ) {
523
  $ids = array_unique( $ids );
524
  switch ( $service_type ) {
525
  case Service::TYPE_SIMPLE:
526
  case Service::TYPE_PACKAGE:
527
+ $query[] = sprintf( '`a`.`service_id` IN (%s)', implode( ', ', $ids ) );
528
  break;
529
  case Service::TYPE_COMPOUND:
530
+ $query[] = sprintf( '`ca`.`compound_service_id` IN (%s)', implode( ', ', $ids ) );
531
  break;
532
  case Service::TYPE_COLLABORATIVE:
533
+ $query[] = sprintf( '`ca`.`collaborative_service_id` IN (%s)', implode( ', ', $ids ) );
534
  break;
535
  }
536
  }
537
  }
538
  }
539
 
540
+ return $query ? ' AND ( ' . implode( ' OR ', $query ) . ') ' : '';
541
  }
542
 
543
  /**
lib/proxy/Pro.php CHANGED
@@ -22,6 +22,7 @@ use Bookly\Lib\DataHolders\Booking as DataHolders;
22
  * @method static string getLastCustomerTimezone( int $customer_id ) Get last appointment timezone for customer.
23
  * @method static int getMinimumTimePriorBooking() Get minimum time ( in seconds ) prior to booking.
24
  * @method static int getMinimumTimePriorCancel() Get minimum time ( in seconds ) prior to cancel.
 
25
  * @method static array getStaffDataForDropDown() Get staff grouped by categories for drop-down list.
26
  * @method static array getTimeZoneOffset( string $time_zone_value ) Get timezone offset from string.
27
  * @method static bool graceExpired() Check whether grace period has expired or not.
22
  * @method static string getLastCustomerTimezone( int $customer_id ) Get last appointment timezone for customer.
23
  * @method static int getMinimumTimePriorBooking() Get minimum time ( in seconds ) prior to booking.
24
  * @method static int getMinimumTimePriorCancel() Get minimum time ( in seconds ) prior to cancel.
25
+ * @method static array getStaffCategoryName() Get staff category name.
26
  * @method static array getStaffDataForDropDown() Get staff grouped by categories for drop-down list.
27
  * @method static array getTimeZoneOffset( string $time_zone_value ) Get timezone offset from string.
28
  * @method static bool graceExpired() Check whether grace period has expired or not.
lib/utils/Price.php CHANGED
@@ -78,7 +78,7 @@ abstract class Price
78
  'VND' => array( 'symbol' => 'VNĐ', 'format' => '{price|0} {symbol}' ),
79
  'XAF' => array( 'symbol' => 'FCFA', 'format' => '{price|0} {symbol}' ),
80
  'XOF' => array( 'symbol' => 'CFA', 'format' => '{symbol} {price|2}' ),
81
- 'XPF' => array( 'symbol' => 'CFP', 'format' => '{price|0} {symbol}' ),
82
  'ZAR' => array( 'symbol' => 'R', 'format' => '{symbol} {price|2}' ),
83
  'ZMW' => array( 'symbol' => 'K', 'format' => '{symbol}{price|2}' ),
84
  );
78
  'VND' => array( 'symbol' => 'VNĐ', 'format' => '{price|0} {symbol}' ),
79
  'XAF' => array( 'symbol' => 'FCFA', 'format' => '{price|0} {symbol}' ),
80
  'XOF' => array( 'symbol' => 'CFA', 'format' => '{symbol} {price|2}' ),
81
+ 'XPF' => array( 'symbol' => '', 'format' => '{price|0} {symbol}' ),
82
  'ZAR' => array( 'symbol' => 'R', 'format' => '{symbol} {price|2}' ),
83
  'ZMW' => array( 'symbol' => 'K', 'format' => '{symbol}{price|2}' ),
84
  );
main.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Bookly
4
  Plugin URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
5
  Description: Bookly Plugin – is a great easy-to-use and easy-to-manage booking tool for service providers who think about their customers. The plugin supports a wide range of services provided by business and individuals who offer reservations through websites. Set up any reservation quickly, pleasantly and easily with Bookly!
6
- Version: 17.0
7
  Author: Bookly
8
  Author URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
9
  Text Domain: bookly
3
  Plugin Name: Bookly
4
  Plugin URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
5
  Description: Bookly Plugin – is a great easy-to-use and easy-to-manage booking tool for service providers who think about their customers. The plugin supports a wide range of services provided by business and individuals who offer reservations through websites. Set up any reservation quickly, pleasantly and easily with Bookly!
6
+ Version: 17.1
7
  Author: Bookly
8
  Author URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
9
  Text Domain: bookly
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: Ladela
3
  Tags: Booking, booking system, appointment booking, Booking calendar, reservation calendar, appointment scheduler, appointment calendar
4
  Donate link: https://www.booking-wp-plugin.com/
5
  Requires at least: 3.7
6
- Tested up to: 5.1
7
  Requires PHP: 5.3.7
8
- Stable tag: 17.0
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -277,4 +277,4 @@ Upon the completion of these steps, customers can book appointments. In the Cale
277
  Visit our [changelog page](https://www.booking-wp-plugin.com/change-log/?utm_campaign=wp_FAQ&utm_medium=cpc&utm_source=WP_ORG) to stay up-to-date.
278
 
279
  == Upgrade Notice ==
280
- Upgrade now to the most recent version of Bookly.
3
  Tags: Booking, booking system, appointment booking, Booking calendar, reservation calendar, appointment scheduler, appointment calendar
4
  Donate link: https://www.booking-wp-plugin.com/
5
  Requires at least: 3.7
6
+ Tested up to: 5.1.1
7
  Requires PHP: 5.3.7
8
+ Stable tag: 17.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
277
  Visit our [changelog page](https://www.booking-wp-plugin.com/change-log/?utm_campaign=wp_FAQ&utm_medium=cpc&utm_source=WP_ORG) to stay up-to-date.
278
 
279
  == Upgrade Notice ==
280
+ Upgrade now to the most recent version of Bookly.