WordPress Online Booking and Scheduling Plugin – Bookly - Version 18.3

Version Description

Download this release

Release Info

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

Code changes from version 18.2 to 18.3

backend/components/dialogs/customer/edit/resources/js/ng-customer.js CHANGED
@@ -14,7 +14,7 @@
14
  // Init properties.
15
  // Form fields.
16
  if (!scope.form) {
17
- scope.form = {
18
  id : '',
19
  wp_user_id : '',
20
  group_id : '',
@@ -30,13 +30,15 @@
30
  street : '',
31
  street_number : '',
32
  additional_address : '',
33
- info_fields : [],
34
  notes : '',
35
  birthday : ''
36
  };
37
  BooklyL10nCustDialog.infoFields.forEach(function (field) {
38
- scope.form.info_fields.push({id: field.id, value: field.type === 'checkboxes' ? [] : ''});
39
  });
 
 
40
  }
41
  // Form errors.
42
  scope.errors = {
@@ -145,26 +147,8 @@
145
  response.customer.status = BooklyL10nCustDialog.default_status;
146
  // Send new customer to the parent scope.
147
  scope.callback({customer : response.customer});
148
- scope.form = {
149
- id : '',
150
- wp_user_id : '',
151
- group_id : '',
152
- full_name : '',
153
- first_name : '',
154
- last_name : '',
155
- phone : '',
156
- email : '',
157
- country : '',
158
- state : '',
159
- postcode : '',
160
- city : '',
161
- street : '',
162
- street_number : '',
163
- additional_address : '',
164
- info_fields : [],
165
- notes : '',
166
- birthday : ''
167
- };
168
  // Close the dialog.
169
  element.booklyModal('hide');
170
 
14
  // Init properties.
15
  // Form fields.
16
  if (!scope.form) {
17
+ scope.defaultForm = {
18
  id : '',
19
  wp_user_id : '',
20
  group_id : '',
30
  street : '',
31
  street_number : '',
32
  additional_address : '',
33
+ info_fields : {},
34
  notes : '',
35
  birthday : ''
36
  };
37
  BooklyL10nCustDialog.infoFields.forEach(function (field) {
38
+ scope.defaultForm.info_fields[field.id] = {id: field.id, value: field.type === 'checkboxes' ? [] : ''};
39
  });
40
+ scope.form = {};
41
+ booklyAngular.copy(scope.defaultForm, scope.form);
42
  }
43
  // Form errors.
44
  scope.errors = {
147
  response.customer.status = BooklyL10nCustDialog.default_status;
148
  // Send new customer to the parent scope.
149
  scope.callback({customer : response.customer});
150
+ scope.form = {};
151
+ booklyAngular.copy(scope.defaultForm, scope.form);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  // Close the dialog.
153
  element.booklyModal('hide');
154
 
backend/components/dialogs/payment/Ajax.php CHANGED
@@ -16,7 +16,7 @@ class Ajax extends Lib\Base\Ajax
16
  {
17
  return array(
18
  'completePayment' => array( 'staff', 'supervisor' ),
19
- 'getPaymentDetails' => array( 'staff', 'supervisor' ),
20
  'getPaymentInfo' => array( 'staff', 'supervisor' ),
21
  );
22
  }
@@ -27,6 +27,17 @@ class Ajax extends Lib\Base\Ajax
27
  public static function getPaymentDetails()
28
  {
29
  $payment = Lib\Entities\Payment::find( self::parameter( 'payment_id' ) );
 
 
 
 
 
 
 
 
 
 
 
30
  if ( $payment ) {
31
  $data = $payment->getPaymentData();
32
  $show_deposit = Lib\Config::depositPaymentsActive();
16
  {
17
  return array(
18
  'completePayment' => array( 'staff', 'supervisor' ),
19
+ 'getPaymentDetails' => array( 'customer' ),
20
  'getPaymentInfo' => array( 'staff', 'supervisor' ),
21
  );
22
  }
27
  public static function getPaymentDetails()
28
  {
29
  $payment = Lib\Entities\Payment::find( self::parameter( 'payment_id' ) );
30
+ if ( $payment && ! Lib\Utils\Common::isCurrentUserSupervisor() && ! Lib\Utils\Common::isCurrentUserStaff() ) {
31
+ // Check if customer trying to get his own payment.
32
+ $customer = Lib\Entities\Customer::query( 'c' )
33
+ ->select( 'c.wp_user_id' )
34
+ ->leftJoin( 'CustomerAppointment', 'ca', 'ca.customer_id = c.id' )
35
+ ->where( 'ca.payment_id', $payment->getId() )
36
+ ->fetchCol( 'wp_user_id' );
37
+ if ( ! $customer || $customer[0] != get_current_user_id() ) {
38
+ $payment = false;
39
+ }
40
+ }
41
  if ( $payment ) {
42
  $data = $payment->getPaymentData();
43
  $show_deposit = Lib\Config::depositPaymentsActive();
backend/components/dialogs/payment/templates/details.php CHANGED
@@ -7,12 +7,7 @@ use Bookly\Lib\Utils\DateTime;
7
  use Bookly\Lib\Entities;
8
  use Bookly\Lib\Config;
9
  /** @var array $show = ['deposit' => int, 'taxes' => int, 'gateway' => bool, 'customer_groups' => bool, 'coupons' => bool] */
10
- $can_edit = Common::isCurrentUserAdmin();
11
- if ( ! $can_edit ) {
12
- $staff = new Entities\Staff();
13
-
14
- $can_edit = $staff->loadBy( array( 'wp_user_id' => get_current_user_id() ) ) !== false;
15
- }
16
  ?>
17
  <?php if ( $payment ) : ?>
18
  <div class="table-responsive">
7
  use Bookly\Lib\Entities;
8
  use Bookly\Lib\Config;
9
  /** @var array $show = ['deposit' => int, 'taxes' => int, 'gateway' => bool, 'customer_groups' => bool, 'coupons' => bool] */
10
+ $can_edit = Common::isCurrentUserSupervisor() || Common::isCurrentUserStaff();
 
 
 
 
 
11
  ?>
12
  <?php if ( $payment ) : ?>
13
  <div class="table-responsive">
frontend/modules/booking/templates/_css.php CHANGED
@@ -5,9 +5,9 @@
5
  ?>
6
  <style type="text/css">
7
  /* Color */
8
- .bookly-form-group > label,
9
- .bookly-label-error,
10
- .bookly-progress-tracker > .active,
11
  .bookly-form .picker__nav--next,
12
  .bookly-form .pickadate__nav--prev,
13
  .bookly-form .picker__day:hover,
@@ -15,25 +15,25 @@
15
  .bookly-form .picker--opened .picker__day--selected,
16
  .bookly-form .picker__button--clear,
17
  .bookly-form .picker__button--today,
18
- .bookly-columnizer .bookly-hour span.bookly-waiting-list {
19
  color: <?php echo $color ?>!important;
20
  }
21
  /* Background */
22
- .bookly-progress-tracker > .active .step,
23
  .bookly-form .picker__frame,
24
- .bookly-service-step .bookly-week-days label,
25
- .bookly-repeat-step .bookly-week-days label,
26
- .bookly-columnizer .bookly-hour:hover .bookly-hour-icon span,
27
- .bookly-btn,
28
- .bookly-btn:active,
29
- .bookly-btn:focus,
30
- .bookly-btn:hover,
31
- .bookly-btn-submit,
32
- .bookly-round,
33
- .bookly-square {
34
  background-color: <?php echo $color ?>!important;
35
  }
36
- .bookly-triangle {
37
  border-bottom-color: <?php echo $color ?>!important;
38
  }
39
  /* Border */
@@ -48,10 +48,10 @@
48
  .bookly-form .picker__header { border-bottom: 1px solid <?php echo $color ?>!important; }
49
  .bookly-form .picker__nav--next:before { border-left: 6px solid <?php echo $color ?>!important; }
50
  .bookly-form .picker__nav--prev:before { border-right: 6px solid <?php echo $color ?>!important; }
51
- .bookly-service-step .bookly-week-days label.active, .bookly-repeat-step .bookly-week-days label.active { background: <?php echo $color ?> url(<?php echo $checkbox_img ?>) 0 0 no-repeat!important; }
52
- .bookly-pagination > li.active, .bookly-columnizer .bookly-day, .bookly-schedule-date { background: <?php echo $color ?>!important; border: 1px solid <?php echo $color ?>!important; }
53
- .bookly-columnizer .bookly-hour:hover { border: 2px solid <?php echo $color ?>!important; color: <?php echo $color ?>!important; }
54
- .bookly-columnizer .bookly-hour:hover .bookly-hour-icon { background: none; border: 2px solid <?php echo $color ?>!important; color: <?php echo $color ?>!important; }
55
  </style>
56
 
57
  <?php if ( $custom_css != '' ) : ?>
5
  ?>
6
  <style type="text/css">
7
  /* Color */
8
+ .bookly-form .bookly-form-group > label,
9
+ .bookly-form .bookly-label-error,
10
+ .bookly-form .bookly-progress-tracker > .active,
11
  .bookly-form .picker__nav--next,
12
  .bookly-form .pickadate__nav--prev,
13
  .bookly-form .picker__day:hover,
15
  .bookly-form .picker--opened .picker__day--selected,
16
  .bookly-form .picker__button--clear,
17
  .bookly-form .picker__button--today,
18
+ .bookly-form .bookly-columnizer .bookly-hour span.bookly-waiting-list {
19
  color: <?php echo $color ?>!important;
20
  }
21
  /* Background */
22
+ .bookly-form .bookly-progress-tracker > .active .step,
23
  .bookly-form .picker__frame,
24
+ .bookly-form .bookly-service-step .bookly-week-days label,
25
+ .bookly-form .bookly-repeat-step .bookly-week-days label,
26
+ .bookly-form .bookly-columnizer .bookly-hour:hover .bookly-hour-icon span,
27
+ .bookly-form .bookly-btn,
28
+ .bookly-form .bookly-btn:active,
29
+ .bookly-form .bookly-btn:focus,
30
+ .bookly-form .bookly-btn:hover,
31
+ .bookly-form .bookly-btn-submit,
32
+ .bookly-form .bookly-round,
33
+ .bookly-form .bookly-square {
34
  background-color: <?php echo $color ?>!important;
35
  }
36
+ .bookly-form .bookly-triangle {
37
  border-bottom-color: <?php echo $color ?>!important;
38
  }
39
  /* Border */
48
  .bookly-form .picker__header { border-bottom: 1px solid <?php echo $color ?>!important; }
49
  .bookly-form .picker__nav--next:before { border-left: 6px solid <?php echo $color ?>!important; }
50
  .bookly-form .picker__nav--prev:before { border-right: 6px solid <?php echo $color ?>!important; }
51
+ .bookly-form .bookly-service-step .bookly-week-days label.active,.bookly-form .bookly-repeat-step .bookly-week-days label.active { background: <?php echo $color ?> url(<?php echo $checkbox_img ?>) 0 0 no-repeat!important; }
52
+ .bookly-form .bookly-pagination > li.active,.bookly-form .bookly-columnizer .bookly-day,.bookly-form .bookly-schedule-date { background: <?php echo $color ?>!important; border: 1px solid <?php echo $color ?>!important; }
53
+ .bookly-form .bookly-columnizer .bookly-hour:hover { border: 2px solid <?php echo $color ?>!important; color: <?php echo $color ?>!important; }
54
+ .bookly-form .bookly-columnizer .bookly-hour:hover .bookly-hour-icon { background: none; border: 2px solid <?php echo $color ?>!important; color: <?php echo $color ?>!important; }
55
  </style>
56
 
57
  <?php if ( $custom_css != '' ) : ?>
frontend/resources/css/bookly-main.css CHANGED
@@ -883,7 +883,7 @@ label.bookly-square {
883
  display: block;
884
  }
885
  .bookly-details-step .bookly-form-group .intl-tel-input input {
886
- padding: 6px 7px 5px 45px !important;
887
  }
888
  .bookly-details-step .bookly-table,
889
  .bookly-details-step .bookly-table > * {
883
  display: block;
884
  }
885
  .bookly-details-step .bookly-form-group .intl-tel-input input {
886
+ padding-left: 45px !important;
887
  }
888
  .bookly-details-step .bookly-table,
889
  .bookly-details-step .bookly-table > * {
lib/Installer.php CHANGED
@@ -677,6 +677,7 @@ class Installer extends Base\Installer
677
  `paid_type` ENUM("in_full","deposit") NOT NULL DEFAULT "in_full",
678
  `gateway_price_correction` DECIMAL(10,2) NULL DEFAULT 0.00,
679
  `status` ENUM("pending","completed","rejected") NOT NULL DEFAULT "completed",
 
680
  `details` TEXT DEFAULT NULL,
681
  `created` DATETIME NOT NULL
682
  ) ENGINE = INNODB
677
  `paid_type` ENUM("in_full","deposit") NOT NULL DEFAULT "in_full",
678
  `gateway_price_correction` DECIMAL(10,2) NULL DEFAULT 0.00,
679
  `status` ENUM("pending","completed","rejected") NOT NULL DEFAULT "completed",
680
+ `token` VARCHAR(255) DEFAULT NULL,
681
  `details` TEXT DEFAULT NULL,
682
  `created` DATETIME NOT NULL
683
  ) ENGINE = INNODB
lib/Updater.php CHANGED
@@ -7,6 +7,34 @@ namespace Bookly\Lib;
7
  */
8
  class Updater extends Base\Updater
9
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  function update_18_0()
11
  {
12
  $this->alterTables( array(
7
  */
8
  class Updater extends Base\Updater
9
  {
10
+ function update_18_3()
11
+ {
12
+ $disposable_options[] = $this->disposable( __FUNCTION__ . '-add-tokens-1', function () {
13
+ $this->alterTables( array(
14
+ 'bookly_payments' => array(
15
+ 'ALTER TABLE `%s` ADD COLUMN `token` VARCHAR(255) DEFAULT NULL AFTER `status`',
16
+ ),
17
+ ) );
18
+ });
19
+
20
+
21
+ $disposable_options[] = $this->disposable( __FUNCTION__ . '-add-tokens-2', function () {
22
+ /** @global \wpdb $wpdb */
23
+ global $wpdb;
24
+
25
+ // Setup tokens for existing payments
26
+ $payments_table = $this->getTableName( 'bookly_payments' );
27
+
28
+ foreach ( $wpdb->get_results( 'SELECT id FROM `' . $payments_table . '` WHERE token IS NULL' ) as $record ) {
29
+ $wpdb->query( $wpdb->prepare( 'UPDATE `' . $payments_table . '` SET `token` = %s WHERE id = %d', Utils\Common::generateToken( 'Bookly\Lib\Entities\Payment', 'token' ), $record->id ) );
30
+ }
31
+ } );
32
+
33
+ foreach ( $disposable_options as $option_name ) {
34
+ delete_option( $option_name );
35
+ }
36
+ }
37
+
38
  function update_18_0()
39
  {
40
  $this->alterTables( array(
lib/base/Updater.php CHANGED
@@ -16,12 +16,12 @@ abstract class Updater extends Schema
16
  $transient_name = $plugin_class::getPrefix() . 'updating_db';
17
  $lock = (int) get_transient( $transient_name );
18
  if ( $lock + 30 < time() ) {
19
- // Lock concurrent updates for 30 seconds.
20
- set_transient( $transient_name, time() );
21
  $version_option_name = $plugin_class::getPrefix() . 'db_version';
22
  $db_version = get_option( $version_option_name );
23
  $plugin_version = $plugin_class::getVersion();
24
  if ( $db_version !== false && version_compare( $plugin_version, $db_version, '>' ) ) {
 
 
25
  set_time_limit( 0 );
26
 
27
  $updates = array_filter(
@@ -42,9 +42,9 @@ abstract class Updater extends Schema
42
  }
43
  // Make sure db_version is set to plugin version (even though there were no updates).
44
  update_option( $version_option_name, $plugin_version );
 
 
45
  }
46
- // Remove the lock.
47
- delete_transient( $transient_name );
48
  }
49
  }
50
 
16
  $transient_name = $plugin_class::getPrefix() . 'updating_db';
17
  $lock = (int) get_transient( $transient_name );
18
  if ( $lock + 30 < time() ) {
 
 
19
  $version_option_name = $plugin_class::getPrefix() . 'db_version';
20
  $db_version = get_option( $version_option_name );
21
  $plugin_version = $plugin_class::getVersion();
22
  if ( $db_version !== false && version_compare( $plugin_version, $db_version, '>' ) ) {
23
+ // Lock concurrent updates for 30 seconds.
24
+ set_transient( $transient_name, time() );
25
  set_time_limit( 0 );
26
 
27
  $updates = array_filter(
42
  }
43
  // Make sure db_version is set to plugin version (even though there were no updates).
44
  update_option( $version_option_name, $plugin_version );
45
+ // Remove the lock.
46
+ delete_transient( $transient_name );
47
  }
 
 
48
  }
49
  }
50
 
lib/entities/Payment.php CHANGED
@@ -48,6 +48,8 @@ class Payment extends Lib\Base\Entity
48
  /** @var string */
49
  protected $status = self::STATUS_COMPLETED;
50
  /** @var string */
 
 
51
  protected $details;
52
  /** @var string */
53
  protected $created;
@@ -64,6 +66,7 @@ class Payment extends Lib\Base\Entity
64
  'paid_type' => array( 'format' => '%s' ),
65
  'gateway_price_correction' => array( 'format' => '%f' ),
66
  'status' => array( 'format' => '%s' ),
 
67
  'details' => array( 'format' => '%s' ),
68
  'created' => array( 'format' => '%s' ),
69
  );
@@ -236,6 +239,7 @@ class Payment extends Lib\Base\Entity
236
  'status' => $this->status,
237
  'type' => $this->type,
238
  'created' => $this->created,
 
239
  'customer' => empty ( $customer ) ? $details['customer'] : $customer['full_name'],
240
  'items' => $details['items'],
241
  'subtotal' => $details['subtotal'],
@@ -466,6 +470,29 @@ class Payment extends Lib\Base\Entity
466
  return $this;
467
  }
468
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
469
  /**
470
  * Gets created
471
  *
@@ -510,6 +537,10 @@ class Payment extends Lib\Base\Entity
510
  if ( $this->getId() == null ) {
511
  $this->setCreated( current_time( 'mysql' ) );
512
  }
 
 
 
 
513
  return parent::save();
514
  }
515
  }
48
  /** @var string */
49
  protected $status = self::STATUS_COMPLETED;
50
  /** @var string */
51
+ protected $token;
52
+ /** @var string */
53
  protected $details;
54
  /** @var string */
55
  protected $created;
66
  'paid_type' => array( 'format' => '%s' ),
67
  'gateway_price_correction' => array( 'format' => '%f' ),
68
  'status' => array( 'format' => '%s' ),
69
+ 'token' => array( 'format' => '%s' ),
70
  'details' => array( 'format' => '%s' ),
71
  'created' => array( 'format' => '%s' ),
72
  );
239
  'status' => $this->status,
240
  'type' => $this->type,
241
  'created' => $this->created,
242
+ 'token' => $this->token,
243
  'customer' => empty ( $customer ) ? $details['customer'] : $customer['full_name'],
244
  'items' => $details['items'],
245
  'subtotal' => $details['subtotal'],
470
  return $this;
471
  }
472
 
473
+ /**
474
+ * Gets token
475
+ *
476
+ * @return string
477
+ */
478
+ public function getToken()
479
+ {
480
+ return $this->token;
481
+ }
482
+
483
+ /**
484
+ * Sets token
485
+ *
486
+ * @param string $token
487
+ * @return $this
488
+ */
489
+ public function setToken( $token )
490
+ {
491
+ $this->token = $token;
492
+
493
+ return $this;
494
+ }
495
+
496
  /**
497
  * Gets created
498
  *
537
  if ( $this->getId() == null ) {
538
  $this->setCreated( current_time( 'mysql' ) );
539
  }
540
+ // Generate new token if it is not set.
541
+ if ( $this->getToken() == '' ) {
542
+ $this->setToken( Lib\Utils\Common::generateToken( get_class( $this ), 'token' ) );
543
+ }
544
  return parent::save();
545
  }
546
  }
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: 18.2
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: 18.3
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
@@ -5,7 +5,7 @@ Donate link: https://www.booking-wp-plugin.com/
5
  Requires at least: 3.7
6
  Tested up to: 5.4.1
7
  Requires PHP: 5.3.7
8
- Stable tag: 18.2
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
5
  Requires at least: 3.7
6
  Tested up to: 5.4.1
7
  Requires PHP: 5.3.7
8
+ Stable tag: 18.3
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11