PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | admin/helpers/src/booking/registry.php +21 -4 1.8.14 → 1.8.16 View file →
@@ -466,18 +466,21 @@
466 466 /**
467 467 * Returns the booking or customer phone number, if any.
468 468 * Note that the + prefix may not be included.
469 469 *
470 + * @param ?string $forcedPhone Optional phone number to sanitize.
471 + *
470 472 * @return ?string
471 473 *
472 474 * @since 1.18.8 (J) - 1.8.8 (WP)
475 + * @since 1.18.16 (J) - 1.8.16 (WP) added argument $forcedPhone.
473 476 */
474 - public function getPhoneNumber()
477 + public function getPhoneNumber(?string $forcedPhone = null)
475 478 {
476 - // give higher priority to booking-level phone number
477 - $phoneNumber = $this->getProperty('phone');
479 + // give higher priority to passed or booking-level phone number
480 + $phoneNumber = $forcedPhone ?: $this->getProperty('phone');
478 481
479 - if (!$phoneNumber) {
482 + if (!$phoneNumber && $forcedPhone !== null) {
480 483 // fetch booking customer details
481 484 $customer = $this->getCustomer();
482 485
483 486 // check customer-level phone number
@@ -495,8 +498,22 @@
495 498 $phoneNumber = substr_replace($phoneNumber, '+', 0, 2);
496 499 }
497 500
498 501 return $phoneNumber ?: null;
502 + }
503 +
504 + /**
505 + * Returns the booking alias phone number (masked phone), if any.
506 + *
507 + * @return ?string
508 + *
509 + * @since 1.18.16 (J) - 1.8.16 (WP)
510 + */
511 + public function getAliasPhoneNumber()
512 + {
513 + $phoneAlias = (string) $this->getProperty('phone_alias');
514 +
515 + return $phoneAlias ? $this->getPhoneNumber($phoneAlias) : null;
499 516 }
500 517
501 518 /**
502 519 * Returns the booking or customer email address, if any.