PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 2.0.11 All 82 releases
← All changes | app/Controllers/SettingsController.php +44 -6 3.0.10trunk View file →
@@ -102,8 +102,10 @@
102 102 'scheduled_payment_days' => 15, // Days until first scheduled payment
103 103 'scheduled_payment_installments' => 1, // Number of installments (if type is installments)
104 104 'scheduled_payment_interval' => 30, // Days between installments
105 105 'scheduled_payment_reminder_days' => 3, // Days before to send reminder
106 + 'balance_anchor' => 'booking', // 'booking' (BC default) | 'tour' (relative to tour date)
107 + 'balance_due_days' => 14, // When anchor=tour: balance due this many days before the tour
106 108 'allow_save_payment_methods' => false,
107 109
108 110 // Email Settings (WordPress site defaults when Yatra options are missing)
109 111 'admin_email' => $wpAdminEmail,
@@ -108,10 +110,16 @@
108 110 // Email Settings (WordPress site defaults when Yatra options are missing)
109 111 'admin_email' => $wpAdminEmail,
110 112 'from_email' => $wpAdminEmail,
111 113 'from_name' => $wpSiteName,
114 + // Blind copy of every outgoing Yatra email, for archiving/monitoring.
115 + // Empty means no copy is sent; accepts several comma-separated addresses.
116 + 'email_always_bcc' => '',
112 117 'email_template_booking' => true,
113 118 'email_template_confirmation' => true,
119 + // Separate part-payment email. Off by default so existing sites keep
120 + // sending the single payment template for every payment.
121 + 'email_template_partial_payment' => false,
114 122 'email_template_cancellation' => true,
115 123 'email_template_reminder' => true,
116 124 'email_template_admin_new_booking' => true,
117 125 'email_template_admin_payment' => true,
@@ -210,8 +218,13 @@
210 218 'trip_category_base' => 'trip-category',
211 219 'booking_base' => 'book',
212 220 // Wishlist (Pro) — stored in free options; active only when Pro + setting on
213 221 'enable_wishlist' => false,
222 + // Sold-out date visibility on the storefront. Default true keeps the
223 + // existing behaviour (sold-out dates stay visible, badged "sold out" and
224 + // able to drive the waitlist); owners can switch it off to hide them the
225 + // same way blocked dates are hidden.
226 + 'show_sold_out' => true,
214 227
215 228 // Search & Listing storefront UX. Defaults preserve current behaviour:
216 229 // every search field shown (true) and mobile filters expanded (false),
217 230 // so existing installs are unchanged until the owner opts in. Booleans
@@ -220,8 +233,12 @@
220 233 'search_show_destination' => true,
221 234 'search_show_activities' => true,
222 235 'search_show_duration' => true,
223 236 'search_show_budget' => true,
237 + // Date field is opt-in (default false) so updating the plugin never
238 + // changes an existing site's search bar. Operators enable it to let
239 + // customers find trips with a departure on a specific date.
240 + 'search_show_date' => false,
224 241 'collapse_filters_on_mobile' => false,
225 242
226 243 // Booking Page Settings
227 244 'use_booking_page' => false,
@@ -378,15 +395,23 @@
378 395 {
379 396 try {
380 397 $settings = [];
381 398
382 - // Get all settings from WordPress options table with yatra_ prefix
399 + // Get all settings from WordPress options table with yatra_ prefix.
400 + // A sentinel default is essential here: get_option() returns boolean
401 + // false for a stored-false option just as it does for a missing one,
402 + // so checking `=== false` would reset every saved-off boolean back to
403 + // its default. That is exactly the "Show sold-out dates" bug — the
404 + // storefront honoured the saved value (isEnabled coerces '' -> false)
405 + // while the admin checkbox re-appeared enabled because this endpoint
406 + // handed React the default (true) instead of the saved false.
407 + $unset_sentinel = "\0__yatra_option_unset__\0";
383 408 foreach ($this->default_settings as $key => $default_value) {
384 409 $option_name = 'yatra_' . $key;
385 - $value = get_option($option_name, false);
386 -
387 - // Only use default if option doesn't exist (wasn't set by InstallerService)
388 - if ($value === false) {
410 + $value = get_option($option_name, $unset_sentinel);
411 +
412 + // Only use default when the option truly does not exist.
413 + if ($value === $unset_sentinel) {
389 414 $value = $default_value;
390 415 }
391 416
392 417 // Stored empty string should behave like "unset" for delivery identity (matches installer / backfill).
@@ -407,9 +432,18 @@
407 432 // Ensure arrays are returned as arrays (not objects)
408 433 if (is_array($default_value) && !is_array($value)) {
409 434 $value = [];
410 435 }
411 -
436 +
437 + // Boolean settings must round-trip to the admin as real booleans.
438 + // update_option() stores false as '' and the object cache can
439 + // return boolean false, so without this a disabled toggle would
440 + // reach React as '' / false and the checkbox (checked unless the
441 + // value is strictly !== false) would render enabled again.
442 + if (is_bool($default_value)) {
443 + $value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
444 + }
445 +
412 446 $settings[$key] = $value;
413 447 }
414 448
415 449 // Special handling for booking_form_config - always use getBookingFormConfig which handles locked fields
@@ -434,8 +468,10 @@
434 468 'scheduled_payment_days',
435 469 'scheduled_payment_installments',
436 470 'scheduled_payment_interval',
437 471 'scheduled_payment_reminder_days',
472 + 'balance_anchor',
473 + 'balance_due_days',
438 474 ] as $sk
439 475 ) {
440 476 if (array_key_exists($sk, $this->default_settings)) {
441 477 $settings[$sk] = \Yatra\Services\SettingsService::get(
@@ -494,8 +530,10 @@
494 530 'scheduled_payment_days',
495 531 'scheduled_payment_installments',
496 532 'scheduled_payment_interval',
497 533 'scheduled_payment_reminder_days',
534 + 'balance_anchor',
535 + 'balance_due_days',
498 536 ];
499 537
500 538 // Collect flexible payment settings to delegate to Pro
501 539 $flexible_payment_settings = [];