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 | site/helpers/error_form.php +135 -97 1.6.7 → 1.8.16 View file →
@@ -18,24 +18,23 @@
18 18 $session = JFactory::getSession();
19 19
20 20 $vbo_tn = VikBooking::getTranslator();
21 21 $vbo_app = VikBooking::getVboApplication();
22 -$vbo_app->loadDatePicker();
22 +$vbo_app->loadDatePicker(['type' => 'dates_range']);
23 23
24 24 if (VikBooking::allowBooking()) {
25 25 $is_mobile = VikBooking::detectUserAgent(false, false);
26 - //vikbooking 1.1
26 +
27 27 $calendartype = VikBooking::calendarType();
28 28 $document = JFactory::getDocument();
29 - //load modalframe lib for search suggestions
29 + // load modalframe lib for search suggestions
30 30 $document->addStyleSheet(VBO_SITE_URI.'resources/jquery.fancybox.css');
31 31 JHtml::fetch('script', VBO_SITE_URI.'resources/jquery.fancybox.js');
32 - //
33 - //vikbooking 1.2
32 +
33 + // restrictions and values
34 34 $restrictions = VikBooking::loadRestrictions();
35 35 $oldroomsnum = $session->get('vbroomsnum', '');
36 36 $oldarrpeople = $session->get('vbarrpeople', '');
37 - //
38 37 $pcheckin = VikRequest::getInt('checkin', '', 'request');
39 38 $pcheckout = VikRequest::getInt('checkout', '', 'request');
40 39 $sesscheckin = $session->get('vbcheckin', '');
41 40 $sesscheckout = $session->get('vbcheckout', '');
@@ -40,8 +39,9 @@
40 39 $sesscheckin = $session->get('vbcheckin', '');
41 40 $sesscheckout = $session->get('vbcheckout', '');
42 41 $pcategories = VikRequest::getString('categories', '', 'request');
43 42 $pitemid = VikRequest::getInt('Itemid', '', 'request');
43 +
44 44 $pval = "";
45 45 $rval = "";
46 46 $vbdateformat = VikBooking::getDateFormat();
47 47 if ($vbdateformat == "%d/%m/%Y") {
@@ -50,8 +50,9 @@
50 50 $df = 'm/d/Y';
51 51 } else {
52 52 $df = 'Y/m/d';
53 53 }
54 +
54 55 if (!empty($pcheckin) || !empty($sesscheckin)) {
55 56 $pcheckin = !empty($pcheckin) ? $pcheckin : $sesscheckin;
56 57 $dp = date($df, $pcheckin);
57 58 if (VikBooking::dateIsValid($dp)) {
@@ -87,9 +88,9 @@
87 88 $hcheckout = 0;
88 89 $mcheckout = 0;
89 90 }
90 91
91 - //vikbooking 1.1
92 + // datepicker calendar setup
92 93 if ($calendartype == "jqueryui") {
93 94 if ($vbdateformat == "%d/%m/%Y") {
94 95 $juidf = 'dd/mm/yy';
95 96 } elseif ($vbdateformat == "%m/%d/%Y") {
@@ -111,33 +112,33 @@
111 112 }
112 113 }
113 114 var vbrestrctarange, vbrestrctdrange, vbrestrcta, vbrestrctd;';
114 115 $document->addScriptDeclaration($ldecl);
115 - //
116 - //VikBooking 1.4
117 - $totrestrictions = count($restrictions);
118 - $wdaysrestrictions = array();
119 - $wdaystworestrictions = array();
120 - $wdaysrestrictionsrange = array();
121 - $wdaysrestrictionsmonths = array();
122 - $ctarestrictionsrange = array();
123 - $ctarestrictionsmonths = array();
124 - $ctdrestrictionsrange = array();
125 - $ctdrestrictionsmonths = array();
126 - $monthscomborestr = array();
127 - $minlosrestrictions = array();
128 - $minlosrestrictionsrange = array();
129 - $maxlosrestrictions = array();
130 - $maxlosrestrictionsrange = array();
131 - $notmultiplyminlosrestrictions = array();
116 +
117 + // global restrictions
118 + $totrestrictions = count($restrictions);
119 + $wdaysrestrictions = [];
120 + $wdaystworestrictions = [];
121 + $wdaysrestrictionsrange = [];
122 + $wdaysrestrictionsmonths = [];
123 + $ctarestrictionsrange = [];
124 + $ctarestrictionsmonths = [];
125 + $ctdrestrictionsrange = [];
126 + $ctdrestrictionsmonths = [];
127 + $monthscomborestr = [];
128 + $minlosrestrictions = [];
129 + $minlosrestrictionsrange = [];
130 + $maxlosrestrictions = [];
131 + $maxlosrestrictionsrange = [];
132 + $notmultiplyminlosrestrictions = [];
132 133 if ($totrestrictions > 0) {
133 134 foreach ($restrictions as $rmonth => $restr) {
134 135 if ($rmonth != 'range') {
135 136 if (strlen((string)$restr['wday'])) {
136 - $wdaysrestrictions[] = "'".($rmonth - 1)."': '".$restr['wday']."'";
137 + $wdaysrestrictions[($rmonth - 1)] = $restr['wday'];
137 138 $wdaysrestrictionsmonths[] = $rmonth;
138 139 if (strlen((string)$restr['wdaytwo'])) {
139 - $wdaystworestrictions[] = "'".($rmonth - 1)."': '".$restr['wdaytwo']."'";
140 + $wdaystworestrictions[($rmonth - 1)] = $restr['wdaytwo'];
140 141 $monthscomborestr[($rmonth - 1)] = VikBooking::parseJsDrangeWdayCombo($restr);
141 142 }
142 143 } elseif (!empty($restr['ctad']) || !empty($restr['ctdd'])) {
143 144 if (!empty($restr['ctad'])) {
@@ -149,11 +150,11 @@
149 150 }
150 151 if ($restr['multiplyminlos'] == 0) {
151 152 $notmultiplyminlosrestrictions[] = $rmonth;
152 153 }
153 - $minlosrestrictions[] = "'".($rmonth - 1)."': '".$restr['minlos']."'";
154 - if (!empty($restr['maxlos']) && $restr['maxlos'] > 0 && $restr['maxlos'] > $restr['minlos']) {
155 - $maxlosrestrictions[] = "'".($rmonth - 1)."': '".$restr['maxlos']."'";
154 + $minlosrestrictions[($rmonth - 1)] = $restr['minlos'];
155 + if (!empty($restr['maxlos']) && $restr['maxlos'] > 0 && $restr['maxlos'] >= $restr['minlos']) {
156 + $maxlosrestrictions[($rmonth - 1)] = $restr['maxlos'];
156 157 }
157 158 } else {
158 159 foreach ($restr as $kr => $drestr) {
159 160 if (strlen((string)$drestr['wday'])) {
@@ -188,22 +189,23 @@
188 189 }
189 190 }
190 191
191 192 $resdecl = "
192 -var vbrestrmonthswdays = [".implode(", ", $wdaysrestrictionsmonths)."];
193 -var vbrestrmonths = [".implode(", ", array_keys($restrictions))."];
194 -var vbrestrmonthscombojn = JSON.parse('".json_encode($monthscomborestr)."');
195 -var vbrestrminlos = {".implode(", ", $minlosrestrictions)."};
196 -var vbrestrminlosrangejn = JSON.parse('".json_encode($minlosrestrictionsrange)."');
197 -var vbrestrmultiplyminlos = [".implode(", ", $notmultiplyminlosrestrictions)."];
198 -var vbrestrmaxlos = {".implode(", ", $maxlosrestrictions)."};
199 -var vbrestrmaxlosrangejn = JSON.parse('".json_encode($maxlosrestrictionsrange)."');
200 -var vbrestrwdaysrangejn = JSON.parse('".json_encode($wdaysrestrictionsrange)."');
201 -var vbrestrcta = JSON.parse('".json_encode($ctarestrictionsmonths)."');
202 -var vbrestrctarange = JSON.parse('".json_encode($ctarestrictionsrange)."');
203 -var vbrestrctd = JSON.parse('".json_encode($ctdrestrictionsmonths)."');
204 -var vbrestrctdrange = JSON.parse('".json_encode($ctdrestrictionsrange)."');
193 +var vbrestrmonthswdays = " . json_encode($wdaysrestrictionsmonths) . ";
194 +var vbrestrmonths = " . json_encode(array_keys($restrictions)) . ";
195 +var vbrestrmonthscombojn = " . json_encode($monthscomborestr) . ";
196 +var vbrestrminlos = " . json_encode((object) $minlosrestrictions) . ";
197 +var vbrestrminlosrangejn = " . json_encode($minlosrestrictionsrange) . ";
198 +var vbrestrmultiplyminlos = " . json_encode($notmultiplyminlosrestrictions) . ";
199 +var vbrestrmaxlos = " . json_encode((object) $maxlosrestrictions) . ";
200 +var vbrestrmaxlosrangejn = " . json_encode($maxlosrestrictionsrange) . ";
201 +var vbrestrwdaysrangejn = " . json_encode($wdaysrestrictionsrange) . ";
202 +var vbrestrcta = " . json_encode($ctarestrictionsmonths) . ";
203 +var vbrestrctarange = " . json_encode($ctarestrictionsrange) . ";
204 +var vbrestrctd = " . json_encode($ctdrestrictionsmonths) . ";
205 +var vbrestrctdrange = " . json_encode($ctdrestrictionsrange) . ";
205 206 var vbcombowdays = {};
207 +
206 208 function vbRefreshCheckout(darrive) {
207 209 if (vbFullObject(vbcombowdays)) {
208 210 var vbtosort = new Array();
209 211 for(var vbi in vbcombowdays) {
@@ -217,19 +219,20 @@
217 219 });
218 220 for(var vbnext in vbtosort) {
219 221 if (vbtosort.hasOwnProperty(vbnext)) {
220 222 var vbfirstnextd = new Date(vbtosort[vbnext]);
221 - jQuery('#checkoutdate').datepicker( 'option', 'minDate', vbfirstnextd );
222 - jQuery('#checkoutdate').datepicker( 'setDate', vbfirstnextd );
223 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'minDate', vbfirstnextd);
224 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'setcheckoutdate', vbfirstnextd);
223 225 break;
224 226 }
225 227 }
226 228 }
227 229 }
230 +
228 231 function vbSetMinCheckoutDate(selectedDate) {
229 232 var minlos = ".VikBooking::getDefaultNightsCalendar().";
230 233 var maxlosrange = 0;
231 - var nowcheckin = jQuery('#checkindate').datepicker('getDate');
234 + var nowcheckin = jQuery('#checkindate').vboDatesRangePicker('getCheckinDate');
232 235 var nowd = nowcheckin.getDay();
233 236 var nowcheckindate = new Date(nowcheckin.getTime());
234 237 vbcombowdays = {};
235 238 if (vbFullObject(vbrestrminlosrangejn)) {
@@ -262,37 +265,37 @@
262 265 if (jQuery.inArray((nowm + 1), vbrestrmonths) != -1) {
263 266 minlos = parseInt(vbrestrminlos[nowm]);
264 267 }
265 268 nowcheckindate.setDate(nowcheckindate.getDate() + minlos);
266 - jQuery('#checkoutdate').datepicker( 'option', 'minDate', nowcheckindate );
269 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'minDate', nowcheckindate);
270 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'minStayNights', minlos);
267 271 if (maxlosrange > 0) {
268 272 var diffmaxminlos = maxlosrange - minlos;
269 273 var maxcheckoutdate = new Date(nowcheckindate.getTime());
270 274 maxcheckoutdate.setDate(maxcheckoutdate.getDate() + diffmaxminlos);
271 - jQuery('#checkoutdate').datepicker( 'option', 'maxDate', maxcheckoutdate );
275 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'maxDate', maxcheckoutdate);
272 276 }
273 277 if (nowm in vbrestrmaxlos) {
274 278 var diffmaxminlos = parseInt(vbrestrmaxlos[nowm]) - minlos;
275 279 var maxcheckoutdate = new Date(nowcheckindate.getTime());
276 280 maxcheckoutdate.setDate(maxcheckoutdate.getDate() + diffmaxminlos);
277 - jQuery('#checkoutdate').datepicker( 'option', 'maxDate', maxcheckoutdate );
281 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'maxDate', maxcheckoutdate);
278 282 }
279 283 if (!vbFullObject(vbcombowdays)) {
280 284 var is_checkout_disabled = false;
281 - if (typeof selectedDate !== 'undefined' && typeof jQuery('#checkoutdate').datepicker('option', 'beforeShowDay') === 'function') {
285 + if (typeof selectedDate !== 'undefined' && typeof jQuery('#checkindate').vboDatesRangePicker('drpoption', 'beforeShowDay.checkout') === 'function') {
282 286 // let the datepicker validate if the min date to set for check-out is disabled due to CTD rules
283 - is_checkout_disabled = !jQuery('#checkoutdate').datepicker('option', 'beforeShowDay')(nowcheckindate)[0];
287 + is_checkout_disabled = !jQuery('#checkindate').vboDatesRangePicker('drpoption', 'beforeShowDay.checkout')(nowcheckindate)[0];
284 288 }
285 289 if (!is_checkout_disabled) {
286 - jQuery('#checkoutdate').datepicker( 'setDate', nowcheckindate );
290 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'setCheckoutDate', nowcheckindate);
287 291 } else {
288 292 setTimeout(() => {
289 293 // make sure the minimum date just set for the checkout has not populated a CTD date that we do not want
290 - var current_out_dt = jQuery('#checkoutdate').datepicker('getDate');
294 + var current_out_dt = jQuery('#checkindate').vboDatesRangePicker('getCheckoutDate');
291 295 if (current_out_dt && current_out_dt.getTime() === nowcheckindate.getTime()) {
292 - jQuery('#checkoutdate').datepicker( 'setDate', null );
296 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'setCheckoutDate', null);
293 297 }
294 - jQuery('#checkoutdate').focus();
295 298 }, 100);
296 299 }
297 300 } else {
298 301 vbRefreshCheckout(nowcheckin);
@@ -297,13 +300,13 @@
297 300 } else {
298 301 vbRefreshCheckout(nowcheckin);
299 302 }
300 303 }";
301 -
302 - if (count($wdaysrestrictions) > 0 || count($wdaysrestrictionsrange) > 0) {
304 +
305 + if ($wdaysrestrictions || $wdaysrestrictionsrange) {
303 306 $resdecl .= "
304 -var vbrestrwdays = {".implode(", ", $wdaysrestrictions)."};
305 -var vbrestrwdaystwo = {".implode(", ", $wdaystworestrictions)."};
307 +var vbrestrwdays = " . json_encode((object) $wdaysrestrictions) . ";
308 +var vbrestrwdaystwo = " . json_encode((object) $wdaystworestrictions) . ";
306 309 function vbIsDayDisabled(date) {
307 310 if (!vbIsDayOpen(date) || !vboValidateCta(date)) {
308 311 return [false];
309 312 }
@@ -381,12 +384,13 @@
381 384 }";
382 385 }
383 386 $document->addScriptDeclaration($resdecl);
384 387 }
385 - //
388 +
389 + // global closing dates
386 390 $closing_dates = VikBooking::parseJsClosingDates();
387 391 $sdecl = "
388 -var vbclosingdates = JSON.parse('".json_encode($closing_dates)."');
392 +var vbclosingdates = " . json_encode($closing_dates) . ";
389 393 function vbCheckClosingDatesIn(date) {
390 394 if (!vbIsDayOpen(date) || !vboValidateCta(date)) {
391 395 return [false];
392 396 }
@@ -460,46 +464,79 @@
460 464 }
461 465 return true;
462 466 }
463 467 function vbSetGlobalMinCheckoutDate() {
464 - var nowcheckin = jQuery('#checkindate').datepicker('getDate');
468 + var minlos = ".VikBooking::getDefaultNightsCalendar().";
469 + var nowcheckin = jQuery('#checkindate').vboDatesRangePicker('getCheckinDate');
465 470 var nowcheckindate = new Date(nowcheckin.getTime());
466 - nowcheckindate.setDate(nowcheckindate.getDate() + ".VikBooking::getDefaultNightsCalendar().");
467 - jQuery('#checkoutdate').datepicker( 'option', 'minDate', nowcheckindate );
468 - jQuery('#checkoutdate').datepicker( 'setDate', nowcheckindate );
471 + nowcheckindate.setDate(nowcheckindate.getDate() + minlos);
472 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'minDate', nowcheckindate);
473 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'minStayNights', minlos);
474 + jQuery('#checkindate').vboDatesRangePicker('checkout', 'setCheckoutDate', nowcheckindate);
469 475 }
476 +
470 477 jQuery(function() {
471 - jQuery.datepicker.setDefaults( jQuery.datepicker.regional[ '' ] );
472 - jQuery('#checkindate').datepicker({
478 + // reset regional
479 + jQuery.datepicker.setDefaults(jQuery.datepicker.regional['']);
480 +
481 + // start DRP
482 + jQuery('#checkindate').vboDatesRangePicker({
483 + checkout: '#checkoutdate',
484 + dateFormat: '{$juidf}',
473 485 showOn: 'focus',
474 - numberOfMonths: ".($is_mobile ? '1' : '2').",".(count($wdaysrestrictions) > 0 || count($wdaysrestrictionsrange) > 0 ? "\nbeforeShowDay: vbIsDayDisabled,\n" : "\nbeforeShowDay: vbCheckClosingDatesIn,\n")."
475 - onSelect: function( selectedDate ) {
476 - ".($totrestrictions > 0 ? "vbSetMinCheckoutDate(selectedDate);" : "vbSetGlobalMinCheckoutDate();")."
477 - vbCalcNights();
478 - }
486 + numberOfMonths: " . ($is_mobile ? '1' : '2') . ",
487 + minDate: '" . VikBooking::getMinDaysAdvance() . "d',
488 + maxDate: '" . VikBooking::getMaxDateFuture() . "',
489 + beforeShowDay: {
490 + checkin: " . ($wdaysrestrictions || $wdaysrestrictionsrange ? 'vbIsDayDisabled' : 'vbCheckClosingDatesIn') . ",
491 + checkout: " . ($wdaysrestrictions || $wdaysrestrictionsrange ? 'vbIsDayDisabledCheckout' : 'vbCheckClosingDatesOut') . ",
492 + },
493 + onSelect: {
494 + checkin: (selectedDate) => {
495 + " . ($totrestrictions ? 'vbSetMinCheckoutDate(selectedDate);' : 'vbSetGlobalMinCheckoutDate();') . "
496 + vbCalcNights();
497 + },
498 + checkout: (selectedDate) => {
499 + vbCalcNights();
500 + },
501 + },
502 + labels: {
503 + checkin: Joomla.JText._('VBPICKUPROOM'),
504 + checkout: Joomla.JText._('VBRETURNROOM'),
505 + minStayNights: (nights) => {
506 + return (Joomla.JText._('VBO_MIN_STAY_NIGHTS') + '').replace('%d', nights);
507 + },
508 + },
509 + bottomCommands: {
510 + clear: Joomla.JText._('VBO_CLEAR_DATES'),
511 + close: Joomla.JText._('VBO_CLOSE'),
512 + onClear: () => {
513 + vbCalcNights();
514 + },
515 + },
479 516 });
480 - jQuery('#checkindate').datepicker( 'option', 'dateFormat', '".$juidf."');
481 - jQuery('#checkindate').datepicker( 'option', 'minDate', '".VikBooking::getMinDaysAdvance()."d');
482 - jQuery('#checkindate').datepicker( 'option', 'maxDate', '".VikBooking::getMaxDateFuture()."');
483 - jQuery('#checkoutdate').datepicker({
484 - showOn: 'focus',
485 - numberOfMonths: ".($is_mobile ? '1' : '2').",".(count($wdaysrestrictions) > 0 || count($wdaysrestrictionsrange) > 0 ? "\nbeforeShowDay: vbIsDayDisabledCheckout,\n" : "\nbeforeShowDay: vbCheckClosingDatesOut,\n")."
486 - onSelect: function( selectedDate ) {
487 - vbCalcNights();
517 +
518 + // set proper regional
519 + jQuery('#checkindate').datepicker('option', jQuery.datepicker.regional['vikbooking']);
520 +
521 + // register additional triggers
522 + jQuery('.vb-cal-img, .vbo-caltrigger').click(function() {
523 + let dp = jQuery(this).prev('input');
524 + if (!dp.length) {
525 + return;
488 526 }
489 - });
490 - jQuery('#checkoutdate').datepicker( 'option', 'dateFormat', '".$juidf."');
491 - jQuery('#checkoutdate').datepicker( 'option', 'minDate', '".VikBooking::getMinDaysAdvance()."d');
492 - jQuery('#checkindate').datepicker( 'option', jQuery.datepicker.regional[ 'vikbooking' ] );
493 - jQuery('#checkoutdate').datepicker( 'option', jQuery.datepicker.regional[ 'vikbooking' ] );
494 - jQuery('.vb-cal-img, .vbo-caltrigger').click(function(){
495 - var jdp = jQuery(this).prev('input.hasDatepicker');
496 - if (jdp.length) {
497 - jdp.focus();
527 + if (dp.hasClass('hasDatepicker')) {
528 + dp.focus();
529 + } else if (dp.attr('id') == 'checkoutdate') {
530 + jQuery('#checkindate').focus();
498 531 }
499 532 });
500 533 });";
534 +
535 + // add script declaration to document
501 536 $document->addScriptDeclaration($sdecl);
537 +
538 + // add HTML code to the form
502 539 $selform .= "<div class=\"vbo-search-inpblock vbo-search-inpblock-checkin\"><label for=\"checkindate\">" . JText::translate('VBPICKUPROOM') . "</label><div class=\"input-group\"><input type=\"text\" name=\"checkindate\" id=\"checkindate\" size=\"10\" autocomplete=\"off\" onfocus=\"this.blur();\" readonly/><i class=\"".VikBookingIcons::i('calendar', 'vbo-caltrigger')."\"></i></div><input type=\"hidden\" name=\"checkinh\" value=\"".$hcheckin."\"/><input type=\"hidden\" name=\"checkinm\" value=\"".$mcheckin."\"/></div>\n";
503 540 $selform .= "<div class=\"vbo-search-inpblock vbo-search-inpblock-checkout\"><label for=\"checkoutdate\">" . JText::translate('VBRETURNROOM') . "</label><div class=\"input-group\"><input type=\"text\" name=\"checkoutdate\" id=\"checkoutdate\" size=\"10\" autocomplete=\"off\" onfocus=\"this.blur();\" readonly/><i class=\"".VikBookingIcons::i('calendar', 'vbo-caltrigger')."\"></i></div><input type=\"hidden\" name=\"checkouth\" value=\"".$hcheckout."\"/><input type=\"hidden\" name=\"checkoutm\" value=\"".$mcheckout."\"/></div>\n";
504 541 } else {
505 542 // default platform Calendar
@@ -507,10 +544,10 @@
507 544 $selform .= "<input type=\"hidden\" name=\"checkinh\" value=\"".$hcheckin."\"/><input type=\"hidden\" name=\"checkinm\" value=\"".$mcheckin."\"/></div></div>\n";
508 545 $selform .= "<div class=\"vbo-search-inpblock vbo-search-inpblock-checkout\"><label for=\"checkoutdate\">" . JText::translate('VBRETURNROOM') . "</label><div class=\"input-group\">" . $vbo_app->getCalendar('', 'checkoutdate', 'checkoutdate', $vbdateformat, array ('class' => '','size' => '10','maxlength' => '19'));
509 546 $selform .= "<input type=\"hidden\" name=\"checkouth\" value=\"".$hcheckout."\"/><input type=\"hidden\" name=\"checkoutm\" value=\"".$mcheckout."\"/></div></div>\n";
510 547 }
511 - //
512 - //rooms, adults, children
548 +
549 + // rooms, adults, children
513 550 $showchildren = VikBooking::showChildrenFront();
514 551 $guests_label = VBOFactory::getConfig()->get('guests_label', 'adults');
515 552 $use_guests_label = 'VBFORMADULTS';
516 553 if (!$showchildren && !strcasecmp($guests_label, 'guests')) {
@@ -515,9 +552,10 @@
515 552 $use_guests_label = 'VBFORMADULTS';
516 553 if (!$showchildren && !strcasecmp($guests_label, 'guests')) {
517 554 $use_guests_label = 'VBOINVTOTGUESTS';
518 555 }
519 - //max number of rooms
556 +
557 + // max number of rooms
520 558 $maxsearchnumrooms = VikBooking::getSearchNumRooms();
521 559 if (intval($maxsearchnumrooms) > 1) {
522 560 $roomsel = "<label for=\"vbo-roomsnum\">".JText::translate('VBFORMROOMSN')."</label><select id=\"vbo-roomsnum\" name=\"roomsnum\" onchange=\"vbSetRoomsAdults(this.value);\">\n";
523 561 for($r = 1; $r <= $maxsearchnumrooms; $r++) {
@@ -526,10 +564,10 @@
526 564 $roomsel .= "</select>\n";
527 565 } else {
528 566 $roomsel = "<input type=\"hidden\" name=\"roomsnum\" value=\"1\">\n";
529 567 }
530 - //
531 - //max number of adults per room
568 +
569 + // max number of adults per room
532 570 $globnumadults = VikBooking::getSearchNumAdults();
533 571 $adultsparts = explode('-', $globnumadults);
534 572 $adultsel = "<select name=\"adults[]\">";
535 573 for($a = $adultsparts[0]; $a <= $adultsparts[1]; $a++) {
@@ -535,10 +573,10 @@
535 573 for($a = $adultsparts[0]; $a <= $adultsparts[1]; $a++) {
536 574 $adultsel .= "<option value=\"".$a."\"".((is_array($oldarrpeople) && isset($oldarrpeople[1]) && $oldarrpeople[1]['adults'] == $a) || (intval($adultsparts[0]) < 1 && $a == 1) ? " selected=\"selected\"" : "").">".$a."</option>";
537 575 }
538 576 $adultsel .= "</select>";
539 - //
540 - //max number of children per room
577 +
578 + // max number of children per room
541 579 $globnumchildren = VikBooking::getSearchNumChildren();
542 580 $childrenparts = explode('-', $globnumchildren);
543 581 $childrensel = "<select name=\"children[]\">";
544 582 for($c = $childrenparts[0]; $c <= $childrenparts[1]; $c++) {
@@ -808,9 +846,9 @@
808 846 $globnumadults = VikBooking::getSearchNumAdults();
809 847 $adultsparts = explode('-', $globnumadults);
810 848 $adultsel = "<select name=\"adults[]\">";
811 849 for($a = $adultsparts[0]; $a <= $adultsparts[1]; $a++) {
812 - $adultsel .= "<option value=\"".$a."\"".($oldarrpeople[$i]['adults'] == $a ? " selected=\"selected\"" : "").">".$a."</option>";
850 + $adultsel .= "<option value=\"".$a."\"".(($oldarrpeople[$i]['adults'] ?? null) == $a ? " selected=\"selected\"" : "").">".$a."</option>";
813 851 }
814 852 $adultsel .= "</select>";
815 853 $oldroomscountadults[$i] = $adultsel;
816 854 $globnumchildren = VikBooking::getSearchNumChildren();
@@ -816,9 +854,9 @@
816 854 $globnumchildren = VikBooking::getSearchNumChildren();
817 855 $childrenparts = explode('-', $globnumchildren);
818 856 $childrensel = "<select name=\"children[]\">";
819 857 for($c = $childrenparts[0]; $c <= $childrenparts[1]; $c++) {
820 - $childrensel .= "<option value=\"".$c."\"".($oldarrpeople[$i]['children'] == $c ? " selected=\"selected\"" : "").">".$c."</option>";
858 + $childrensel .= "<option value=\"".$c."\"".(($oldarrpeople[$i]['children'] ?? null) == $c ? " selected=\"selected\"" : "").">".$c."</option>";
821 859 }
822 860 $childrensel .= "</select>";
823 861 $oldroomscountchildren[$i] = $childrensel;
824 862 }