Changeset 3444962
- Timestamp:
- 01/22/2026 03:39:07 PM (2 months ago)
- Location:
- bookingor/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (2 diffs)
-
app/Frontend/Controller/Service/ServiceControlFront.php (modified) (10 diffs)
-
bookingor.php (modified) (3 diffs)
-
includes/class-bookingor.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
bookingor/trunk/README.txt
r3444926 r3444962 5 5 Tested up to: 6.9 6 6 Donate link: https://bookingor.com 7 Stable tag: 2.0. 07 Stable tag: 2.0.1 8 8 Requires PHP: 7.2 9 9 License: GPLv2 or later … … 327 327 * New Version release 328 328 329 = 2.0.1 = 330 * Fix Service View issue 331 329 332 330 333 == Upgrade Notice == -
bookingor/trunk/app/Frontend/Controller/Service/ServiceControlFront.php
r3444926 r3444962 7 7 class ServiceControlFront 8 8 { 9 private static $bookingorDb;10 public static $f_extra; 11 public static $f_service_all;12 public static $f_service_woocommcerce;13 public static $dp_prefix = 'bookingor_';14 15 /**16 * Retrieves the list of services including their details like ID, name, icon, duration, cost, capacity, tax, padding before, recurring status, recurring type, and padding after.17 *18 * @param int $service_get_id The ID of the service to retrieve if provided.19 * @param int $category_get_id The ID of the category to retrieve if provided.20 *21 * @return array|null An array of services or null if no data is found.22 */23 public static function bp_front_services_view($service_get_id = null, $category_get_id = null)24 {25 global $wpdb;26 self::$bookingorDb = $wpdb;27 $category = $wpdb->prefix . self::$dp_prefix . 'categories';28 $service = $wpdb->prefix . self::$dp_prefix . 'services';29 $location = $wpdb->prefix . self::$dp_prefix . 'location';30 $subcategory = $wpdb->prefix . self::$dp_prefix . 'subcategory';31 $extra = $wpdb->prefix . self::$dp_prefix . 'extra'; 32 $location_assign = $wpdb->prefix . self::$dp_prefix . 'location_assign_service';33 $staff_assign = $wpdb->prefix . self::$dp_prefix . 'staff_assign_service';34 $posts = $wpdb->prefix . 'posts';35 $service_id = $service_get_id;36 $category_id = $category_get_id;37 38 if (class_exists('Bookingor\Frontend\Controller\ServiceSubcategory\ServiceSubcategoryControl')) {39 self::$f_service_all = \Bookingor\Frontend\Controller\ServiceSubcategory\ServiceSubcategoryControl::subcategory_service_front();40 return self::$f_service_all;41 } else {42 if (!empty($service_get_id)) {43 if (!empty($location_assign)) {44 return self::$f_service_all = self::$bookingorDb->get_results(45 $wpdb->prepare(46 "SELECT9 private static $bookingorDb; 10 11 public static $f_service_all; 12 public static $f_service_woocommcerce; 13 public static $dp_prefix = 'bookingor_'; 14 15 /** 16 * Retrieves the list of services including their details like ID, name, icon, duration, cost, capacity, tax, padding before, recurring status, recurring type, and padding after. 17 * 18 * @param int $service_get_id The ID of the service to retrieve if provided. 19 * @param int $category_get_id The ID of the category to retrieve if provided. 20 * 21 * @return array|null An array of services or null if no data is found. 22 */ 23 public static function bp_front_services_view($service_get_id = null, $category_get_id = null) 24 { 25 global $wpdb; 26 self::$bookingorDb = $wpdb; 27 $category = $wpdb->prefix . self::$dp_prefix . 'categories'; 28 $service = $wpdb->prefix . self::$dp_prefix . 'services'; 29 $location = $wpdb->prefix . self::$dp_prefix . 'location'; 30 $subcategory = $wpdb->prefix . self::$dp_prefix . 'subcategory'; 31 32 $location_assign = $wpdb->prefix . self::$dp_prefix . 'location_assign_service'; 33 $staff_assign = $wpdb->prefix . self::$dp_prefix . 'staff_assign_service'; 34 $posts = $wpdb->prefix . 'posts'; 35 $service_id = $service_get_id; 36 $category_id = $category_get_id; 37 38 if (class_exists('Bookingor\Frontend\Controller\ServiceSubcategory\ServiceSubcategoryControl')) { 39 self::$f_service_all = \Bookingor\Frontend\Controller\ServiceSubcategory\ServiceSubcategoryControl::subcategory_service_front(); 40 return self::$f_service_all; 41 } else { 42 if (!empty($service_get_id)) { 43 if (!empty($location_assign)) { 44 return self::$f_service_all = self::$bookingorDb->get_results( 45 $wpdb->prepare( 46 "SELECT 47 47 DISTINCT s.service_id, 48 48 la.service_get_id AS service_get_id_location, 49 49 s.service_description, 50 50 s.service_duration_type, 51 e.extra_id,51 52 52 la.location_get_id, 53 53 l.location_address, … … 78 78 LEFT JOIN 79 79 %4\$s l ON l.location_id = la.location_get_id 80 LEFT JOIN 81 %5\$s e ON s.service_id = e.service_get_id 80 82 81 WHERE 83 82 s.status = 1 and s.service_id = $service_id 84 83 GROUP BY 85 84 s.service_id = $service_id", 86 $service,87 $location_assign,88 $staff_assign,89 $location,90 $extra, 91 )92 );93 }94 }95 if (!empty($category_get_id && get_option('bookingor_settings_staff_active') === 'off') && get_option('bookingor_settings_location_active') === 'off') {96 if (!empty($location_assign)) {97 return self::$f_service_all = self::$bookingorDb->get_results(98 $wpdb->prepare(99 "SELECT85 $service, 86 $location_assign, 87 $staff_assign, 88 $location, 89 $location 90 ) 91 ); 92 } 93 } 94 if (!empty($category_get_id && get_option('bookingor_settings_staff_active') === 'off') && get_option('bookingor_settings_location_active') === 'off') { 95 if (!empty($location_assign)) { 96 return self::$f_service_all = self::$bookingorDb->get_results( 97 $wpdb->prepare( 98 "SELECT 100 99 DISTINCT s.category_get_id, 101 100 s.service_description, 102 e.extra_id,101 103 102 s.service_icon, 104 103 sa.staff_get_id, … … 119 118 LEFT JOIN 120 119 %3\$s sa ON s.service_id = sa.service_get_id 121 LEFT JOIN 122 %5\$s e ON s.service_id = e.service_get_id 120 123 121 WHERE 124 122 s.status = 1 and s.category_get_id = $category_id 125 123 GROUP BY 126 124 s.service_id = $category_id", 127 $staff_assign,128 $service,129 $extra, 130 )131 );132 }133 }134 if (!empty($category_get_id)) {135 // print_r($category_id);136 if (!empty($location_assign)) {137 return self::$f_service_all = self::$bookingorDb->get_results(138 $wpdb->prepare(139 "SELECT125 $staff_assign, 126 $service, 127 $service 128 ) 129 ); 130 } 131 } 132 if (!empty($category_get_id)) { 133 // print_r($category_id); 134 if (!empty($location_assign)) { 135 return self::$f_service_all = self::$bookingorDb->get_results( 136 $wpdb->prepare( 137 "SELECT 140 138 DISTINCT s.category_get_id, 141 139 la.service_get_id AS service_get_id_location, 142 140 s.service_description, 143 141 s.service_duration_type, 144 e.extra_id,142 145 143 la.location_get_id, 146 144 l.location_address, … … 171 169 LEFT JOIN 172 170 %4\$s l ON l.location_id = la.location_get_id 173 LEFT JOIN 174 %5\$s e ON s.service_id = e.service_get_id 171 175 172 WHERE 176 173 s.status = 1 and s.category_get_id = $category_id 177 174 GROUP BY 178 175 s.service_id", 179 $service,180 $location_assign,181 $staff_assign,182 $location,183 $extra, 184 )185 );186 }187 }188 if (get_option('bookingor_settings_woocommcerce_payment_active') === 'on') {189 self::$f_service_all = [];190 191 $wc_products = WooCommercePaymentService::get_all_wooCommerce_products();192 $results = self::$bookingorDb->get_results(193 $wpdb->prepare("SELECT DISTINCT176 $service, 177 $location_assign, 178 $staff_assign, 179 $location, 180 $location 181 ) 182 ); 183 } 184 } 185 if (get_option('bookingor_settings_woocommcerce_payment_active') === 'on') { 186 self::$f_service_all = []; 187 188 $wc_products = WooCommercePaymentService::get_all_wooCommerce_products(); 189 $results = self::$bookingorDb->get_results( 190 $wpdb->prepare("SELECT DISTINCT 194 191 s.service_id, 195 192 la.service_get_id AS service_get_id_location, 196 193 s.service_description, 197 194 s.service_duration_type, 198 e.extra_id,195 199 196 la.location_get_id, 200 197 l.location_address, … … 227 224 LEFT JOIN 228 225 {$wpdb->prefix}bookingor_location l ON l.location_id = la.location_get_id 229 LEFT JOIN 230 {$wpdb->prefix}bookingor_extra e ON s.service_id = e.service_get_id 226 231 227 LEFT JOIN 232 228 {$wpdb->prefix}bookingor_categories c ON s.category_get_id = c.category_id … … 237 233 s.wc_id 238 234 ") 239 );240 241 self::$f_service_all[] = array_merge((array) $results, $wc_products);242 $flattenedData = array_map(function ($item) {243 return (array) $item;244 }, self::$f_service_all[0]);245 $mergedData = [];246 247 foreach ($flattenedData as $item) {248 if (isset($item['wc_id'])) {249 foreach ($flattenedData as $product) {250 if (isset($product['id']) && $item['wc_id'] == $product['id']) {251 $mergedData[] = array_merge($item, $product);252 }253 }254 }255 }256 257 return $mergedData;258 }259 if (!empty($location_assign)) {260 return self::$f_service_all = self::$bookingorDb->get_results(261 $wpdb->prepare(262 'SELECT DISTINCT235 ); 236 237 self::$f_service_all[] = array_merge((array) $results, $wc_products); 238 $flattenedData = array_map(function ($item) { 239 return (array) $item; 240 }, self::$f_service_all[0]); 241 $mergedData = []; 242 243 foreach ($flattenedData as $item) { 244 if (isset($item['wc_id'])) { 245 foreach ($flattenedData as $product) { 246 if (isset($product['id']) && $item['wc_id'] == $product['id']) { 247 $mergedData[] = array_merge($item, $product); 248 } 249 } 250 } 251 } 252 253 return $mergedData; 254 } 255 if (!empty($location_assign)) { 256 return self::$f_service_all = self::$bookingorDb->get_results( 257 $wpdb->prepare( 258 'SELECT DISTINCT 263 259 s.service_id, 264 260 la.location_get_id, 265 261 s.service_description, 266 262 s.service_duration_type, 267 e.extra_id,263 268 264 la.location_get_id, 269 265 l.location_address, … … 295 291 LEFT JOIN 296 292 %4$s l ON l.location_id = la.location_get_id 297 LEFT JOIN 298 %5$s e ON s.service_id = e.service_get_id 299 LEFT JOIN 300 %6$s c ON s.category_get_id = c.category_id 293 294 LEFT JOIN 295 %5$s c ON s.category_get_id = c.category_id 301 296 WHERE 302 297 s.status = 1 303 298 GROUP BY 304 299 s.service_id', 305 $service,306 $location_assign,307 $staff_assign,308 $location,309 $extra, 310 $category311 )312 );313 } else {314 return self::$f_service_all = self::$bookingorDb->get_results(315 $wpdb->prepare(316 'SELECT300 $service, 301 $location_assign, 302 $staff_assign, 303 $location, 304 305 $category 306 ) 307 ); 308 } else { 309 return self::$f_service_all = self::$bookingorDb->get_results( 310 $wpdb->prepare( 311 'SELECT 317 312 s.service_id, 318 313 s.service_icon, … … 336 331 WHERE 337 332 s.status = 1', 338 $service,339 $location_assign340 )341 );342 }343 }344 $serviceAll = [];345 foreach (self::$f_service_all as $key => $value) {346 $serviceAll[] = [347 'service_id' => $value->service_id,348 'service_name' => $value->service_name,349 'service_icon' => $value->service_icon,350 'service_duration' => $value->service_duration,351 'service_tax' => $value->service_tax,352 ];353 }354 }355 356 /**357 * Get all services to display on frontend with their details.358 *359 * @return void360 */361 public static function bp_front_services_data()362 {363 global $wpdb;364 self::$bookingorDb = $wpdb;365 $service = $wpdb->prefix . self::$dp_prefix . 'services';366 $default_img = plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/images/serv-image.jpg';367 $service_get_id = isset($_REQUEST['service_get_id']) ? intval($_REQUEST['service_get_id']) : 0;368 if (isset($_POST['nonce'])) {369 if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) {370 $response = [371 'status' => htmlspecialchars('error'),372 'message' => htmlspecialchars('Nonce verification failed.')373 ];374 echo wp_json_encode($response);375 }376 }377 378 self::$f_service_all = self::$bookingorDb->get_results(379 $wpdb->prepare(380 "SELECT333 $service, 334 $location_assign 335 ) 336 ); 337 } 338 } 339 $serviceAll = []; 340 foreach (self::$f_service_all as $key => $value) { 341 $serviceAll[] = [ 342 'service_id' => $value->service_id, 343 'service_name' => $value->service_name, 344 'service_icon' => $value->service_icon, 345 'service_duration' => $value->service_duration, 346 'service_tax' => $value->service_tax, 347 ]; 348 } 349 } 350 351 /** 352 * Get all services to display on frontend with their details. 353 * 354 * @return void 355 */ 356 public static function bp_front_services_data() 357 { 358 global $wpdb; 359 self::$bookingorDb = $wpdb; 360 $service = $wpdb->prefix . self::$dp_prefix . 'services'; 361 $default_img = plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/images/serv-image.jpg'; 362 $service_get_id = isset($_REQUEST['service_get_id']) ? intval($_REQUEST['service_get_id']) : 0; 363 if (isset($_POST['nonce'])) { 364 if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) { 365 $response = [ 366 'status' => htmlspecialchars('error'), 367 'message' => htmlspecialchars('Nonce verification failed.') 368 ]; 369 echo wp_json_encode($response); 370 } 371 } 372 373 self::$f_service_all = self::$bookingorDb->get_results( 374 $wpdb->prepare( 375 "SELECT 381 376 service_id, 382 377 service_icon, … … 402 397 status = 1 403 398 AND service_id = %d", 404 $service_get_id405 )406 );407 $serviceAll = [];408 foreach (self::$f_service_all as $key => $value) {409 $icon = $value->service_icon ? wp_get_attachment_url($value->service_icon) : $default_img;410 $serviceAll[] = [411 'category_get_id' => $value->category_get_id,412 'service_id' => $value->service_id,413 'service_name' => $value->service_name,414 'service_icon' => $icon,415 'service_duration_type' => $value->service_duration_type,416 'service_cost' => $value->service_cost,417 'service_deposit' => $value->service_deposit,418 'service_deposit_type' => $value->service_deposit_type,419 'service_duration' => $value->service_duration,420 'service_tax' => $value->service_tax,421 'recurring_status' => $value->recurring_status,422 'recurring_type' => $value->recurring_type,423 'recurring_payment' => $value->recurring_payment,424 'wc_id' => $value->wc_id,425 'service_capacity_min' => $value->service_capacity_min,426 'service_capacity_max' => $value->service_capacity_max,427 ];428 }429 echo wp_json_encode($serviceAll);430 die();431 }432 433 /**434 * bp_front_services_data_by_id_shortcode.435 *436 * Get services data by id to use in shortcode437 *438 * @since 1.0.0439 */440 public static function bp_front_services_data_by_id_shortcode()441 {442 global $wpdb;443 self::$bookingorDb = $wpdb;444 $service = $wpdb->prefix . self::$dp_prefix . 'services';445 $default_img = plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/images/serv-image.jpg';446 $service_get_id = isset($_REQUEST['shortcode_service_id']) ? intval($_REQUEST['shortcode_service_id']) : 0;447 if (isset($_POST['nonce'])) {448 if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) {449 $response = [450 'status' => htmlspecialchars('error'),451 'message' => htmlspecialchars('Nonce verification failed.')452 ];453 echo wp_json_encode($response);454 }455 }456 457 self::$f_service_all = self::$bookingorDb->get_results(458 $wpdb->prepare(459 "SELECT399 $service_get_id 400 ) 401 ); 402 $serviceAll = []; 403 foreach (self::$f_service_all as $key => $value) { 404 $icon = $value->service_icon ? wp_get_attachment_url($value->service_icon) : $default_img; 405 $serviceAll[] = [ 406 'category_get_id' => $value->category_get_id, 407 'service_id' => $value->service_id, 408 'service_name' => $value->service_name, 409 'service_icon' => $icon, 410 'service_duration_type' => $value->service_duration_type, 411 'service_cost' => $value->service_cost, 412 'service_deposit' => $value->service_deposit, 413 'service_deposit_type' => $value->service_deposit_type, 414 'service_duration' => $value->service_duration, 415 'service_tax' => $value->service_tax, 416 'recurring_status' => $value->recurring_status, 417 'recurring_type' => $value->recurring_type, 418 'recurring_payment' => $value->recurring_payment, 419 'wc_id' => $value->wc_id, 420 'service_capacity_min' => $value->service_capacity_min, 421 'service_capacity_max' => $value->service_capacity_max, 422 ]; 423 } 424 echo wp_json_encode($serviceAll); 425 die(); 426 } 427 428 /** 429 * bp_front_services_data_by_id_shortcode. 430 * 431 * Get services data by id to use in shortcode 432 * 433 * @since 1.0.0 434 */ 435 public static function bp_front_services_data_by_id_shortcode() 436 { 437 global $wpdb; 438 self::$bookingorDb = $wpdb; 439 $service = $wpdb->prefix . self::$dp_prefix . 'services'; 440 $default_img = plugin_dir_url(dirname(dirname(__FILE__))) . 'assets/images/serv-image.jpg'; 441 $service_get_id = isset($_REQUEST['shortcode_service_id']) ? intval($_REQUEST['shortcode_service_id']) : 0; 442 if (isset($_POST['nonce'])) { 443 if (!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'bookingor_ajax_nonce')) { 444 $response = [ 445 'status' => htmlspecialchars('error'), 446 'message' => htmlspecialchars('Nonce verification failed.') 447 ]; 448 echo wp_json_encode($response); 449 } 450 } 451 452 self::$f_service_all = self::$bookingorDb->get_results( 453 $wpdb->prepare( 454 "SELECT 460 455 service_id, 461 456 service_icon, … … 479 474 status = 1 480 475 AND service_id = %d", 481 $service_get_id 482 ) 483 ); 484 $serviceAll = []; 485 foreach (self::$f_service_all as $key => $value) { 486 $icon = $value->service_icon ? wp_get_attachment_url($value->service_icon) : $default_img; 487 $serviceAll[] = [ 488 'category_get_id' => $value->category_get_id, 489 'service_id' => $value->service_id, 490 'service_name' => $value->service_name, 491 'service_icon' => $icon, 492 'service_cost' => $value->service_cost, 493 'service_deposit' => $value->service_deposit, 494 'service_deposit_type' => $value->service_deposit_type, 495 'service_duration' => $value->service_duration, 496 'service_tax' => $value->service_tax, 497 'recurring_status' => $value->recurring_status, 498 'recurring_type' => $value->recurring_type, 499 'recurring_payment' => $value->recurring_payment, 500 'service_capacity_min' => $value->service_capacity_min, 501 'service_capacity_max' => $value->service_capacity_max, 502 ]; 503 } 504 echo wp_json_encode($serviceAll); 505 die(); 506 } 507 508 509 510 476 $service_get_id 477 ) 478 ); 479 $serviceAll = []; 480 foreach (self::$f_service_all as $key => $value) { 481 $icon = $value->service_icon ? wp_get_attachment_url($value->service_icon) : $default_img; 482 $serviceAll[] = [ 483 'category_get_id' => $value->category_get_id, 484 'service_id' => $value->service_id, 485 'service_name' => $value->service_name, 486 'service_icon' => $icon, 487 'service_cost' => $value->service_cost, 488 'service_deposit' => $value->service_deposit, 489 'service_deposit_type' => $value->service_deposit_type, 490 'service_duration' => $value->service_duration, 491 'service_tax' => $value->service_tax, 492 'recurring_status' => $value->recurring_status, 493 'recurring_type' => $value->recurring_type, 494 'recurring_payment' => $value->recurring_payment, 495 'service_capacity_min' => $value->service_capacity_min, 496 'service_capacity_max' => $value->service_capacity_max, 497 ]; 498 } 499 echo wp_json_encode($serviceAll); 500 die(); 501 } 511 502 } -
bookingor/trunk/bookingor.php
r3444926 r3444962 9 9 * 10 10 * @link Bookingor 11 * @since 2.0. 011 * @since 2.0.1 12 12 * @package Bookingor 13 13 * … … 15 15 * Plugin Name: Bookingor - Booking System for Appointment Calendar, Meeting Scheduler & WooCommerce Bookings 16 16 * Description: Bookingor is an all-in-one appointment and booking management system. Streamline scheduling processes for any business or individuals. Bookingor helps you efficiently handle bookings, save time, and enhance the customer experience. 17 * Version: 2.0. 017 * Version: 2.0.1 18 18 * License: GPL-2.0+ 19 19 * Tags: booking, appointment, booking System, Schedule appointment, calendar, scheduling … … 37 37 * Currently plugin version. 38 38 */ 39 define('BOOKINGOR_VERSION', '2.0. 0');39 define('BOOKINGOR_VERSION', '2.0.1'); 40 40 41 41 /** -
bookingor/trunk/includes/class-bookingor.php
r3444926 r3444962 96 96 $this->version = BOOKINGOR_VERSION; 97 97 } else { 98 $this->version = '2.0. 0';98 $this->version = '2.0.1'; 99 99 } 100 100 $this->plugin_name = 'bookingor';
Note: See TracChangeset
for help on using the changeset viewer.