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/views/booking/view.html.php +79 -19 1.7.2 → 1.8.16 View file →
@@ -126,20 +126,47 @@
126 126 break;
127 127 }
128 128 }
129 129
130 + // tell if the booking has been automatically cancelled
131 + $autoremove = false;
132 +
133 + // make sure we are not beyond the check-in date and time
130 134 $today_midnight = mktime(0, 0, 0, date('n'), date('j'), date('Y'));
131 - $autoremove = false;
132 135 if ($today_midnight > $order['checkin']) {
133 136 $roomavail = false;
134 137 }
135 - $minautoremove = VikBooking::getMinutesAutoRemove();
136 - $mins_elapsed = floor((time() - $order['ts']) / 60);
137 - if ($minautoremove > 0 && $mins_elapsed > $minautoremove) {
138 - $roomavail = false;
139 - $autoremove = true;
138 +
139 + /**
140 + * Check if we are dealing with a pending booking solution of a quote.
141 + *
142 + * @since 1.18.8 (J) - 1.8.8 (WP)
143 + */
144 + $quoteValidUntilDt = null;
145 + if (!empty($order['idquote'])) {
146 + // load quote record
147 + $quoteRecord = VBOMvcModel::getInstance('quote')->getItem((int) $order['idquote']);
148 + if (!empty($quoteRecord->valid_until)) {
149 + $quoteValidUntilDt = JFactory::getDate($quoteRecord->valid_until);
150 + }
140 151 }
141 152
153 + if ($quoteValidUntilDt) {
154 + // make sure the quote is still valid
155 + if (JFactory::getDate('now') > $quoteValidUntilDt) {
156 + $roomavail = false;
157 + $autoremove = true;
158 + }
159 + } else {
160 + // check global settings for booking auto-cancellation
161 + $minautoremove = VikBooking::getMinutesAutoRemove();
162 + $mins_elapsed = floor((time() - $order['ts']) / 60);
163 + if ($minautoremove > 0 && $mins_elapsed > $minautoremove) {
164 + $roomavail = false;
165 + $autoremove = true;
166 + }
167 + }
168 +
142 169 /**
143 170 * Make sure not to cancel an OTA pending reservation.
144 171 *
145 172 * @since 1.15.4 (J) - 1.5.10 (WP)
@@ -201,9 +228,9 @@
201 228
202 229 // render the booking details
203 230
204 231 // set noindex instruction for robots
205 - $document->setMetaData('robots', 'noindex,follow');
232 + $document->setMetaData('robots', 'noindex, nofollow');
206 233
207 234 // load jQuery
208 235 if (VikBooking::loadJquery()) {
209 236 JHtml::fetch('jquery.framework', true, true);
@@ -233,12 +260,28 @@
233 260 }
234 261 }
235 262 }
236 263 $is_package = !empty($order['pkg']) ? true : false;
237 - $orderrooms = [];
238 - $q = "SELECT `or`.`idroom`,`or`.`adults`,`or`.`children`,`or`.`idtar`,`or`.`optionals`,`or`.`roomindex`,`or`.`pkg_id`,`or`.`pkg_name`,`or`.`cust_cost`,`or`.`cust_idiva`,`or`.`extracosts`,`or`.`room_cost`,`or`.`otarplan`,`r`.`id` AS `r_reference_id`,`r`.`name`,`r`.`img`,`r`.`idcarat`,`r`.`fromadult`,`r`.`toadult` FROM `#__vikbooking_ordersrooms` AS `or`,`#__vikbooking_rooms` AS `r` WHERE `or`.`idorder`='".$order['id']."' AND `or`.`idroom`=`r`.`id` ORDER BY `or`.`id` ASC;";
239 - $dbo->setQuery($q);
264 +
265 + // get the rooms booked list
266 + $dbo->setQuery(
267 + $dbo->getQuery(true)
268 + ->select($dbo->qn('or') . '.*')
269 + ->select($dbo->qn('r.id', 'r_reference_id'))
270 + ->select([
271 + $dbo->qn('r.name'),
272 + $dbo->qn('r.img'),
273 + $dbo->qn('r.idcarat'),
274 + $dbo->qn('r.fromadult'),
275 + $dbo->qn('r.toadult'),
276 + ])
277 + ->from($dbo->qn('#__vikbooking_ordersrooms', 'or'))
278 + ->leftJoin($dbo->qn('#__vikbooking_rooms', 'r') . ' ON ' . $dbo->qn('or.idroom') . ' = ' . $dbo->qn('r.id'))
279 + ->where($dbo->qn('or.idorder') . ' = ' . (int)$order['id'])
280 + ->order($dbo->qn('or.id') . ' ASC')
281 + );
240 282 $orderrooms = $dbo->loadAssocList();
283 +
241 284 if ($orderrooms) {
242 285 $vbo_tn->translateContents($orderrooms, '#__vikbooking_rooms', array('id' => 'r_reference_id'));
243 286 foreach ($orderrooms as $kor => $or) {
244 287 $num = $kor + 1;
@@ -324,8 +367,30 @@
324 367 $cnodep = $cookie->get('vboFA', '', 'string');
325 368 $nodep = intval($pnodep) > 0 || intval($cnodep) > 0 ? 1 : 0;
326 369
327 370 /**
371 + * Scan the booking and related rooms for damage deposit payment data.
372 + * Obtain also the information about possible previous payments.
373 + *
374 + * @since 1.17.6 (J) - 1.7.6 (WP)
375 + */
376 + $damage_deposit_payment = VBORoomHelper::getInstance()->getDamageDepositSplitPayment($order, $orderrooms);
377 + $prev_dd_payments = [];
378 + if ($damage_deposit_payment['damagedep_gross'] ?? 0) {
379 + $prev_dd_payments = VikBooking::getBookingHistoryInstance($order['id'])
380 + ->getEventsWithData('PN', function($data) {
381 + return (is_object($data) && !empty($data->damage_deposit));
382 + });
383 + if (!$prev_dd_payments) {
384 + // check also the first payment event in case of OTA bookings
385 + $prev_dd_payments = VikBooking::getBookingHistoryInstance($order['id'])
386 + ->getEventsWithData('P0', function($data) {
387 + return (is_object($data) && !empty($data->damage_deposit));
388 + });
389 + }
390 + }
391 +
392 + /**
328 393 * Upselling extra services only for non-cancelled bookings
329 394 * with a check-out date in the future.
330 395 *
331 396 * @since 1.13.0 (J) - 1.3.0 (WP)
@@ -353,17 +418,9 @@
353 418 }
354 419 }
355 420 array_push($upsell_data, $room_data);
356 421 }
357 - $upselling = VikBooking::loadUpsellingData(
358 - $upsell_data,
359 - array(
360 - 'id' => $order['id'],
361 - 'checkin' => $order['checkin'],
362 - 'checkout' => $order['checkout'],
363 - ),
364 - $vbo_tn
365 - );
422 + $upselling = VikBooking::loadUpsellingData($upsell_data, $order, $vbo_tn);
366 423 }
367 424
368 425 /**
369 426 * Trigger first tracking conversion on booking.
@@ -381,8 +438,11 @@
381 438 $this->canc_policy = $canc_policy;
382 439 $this->payment = $payment;
383 440 $this->nodep = $nodep;
384 441 $this->upselling = $upselling;
442 + $this->damage_deposit_payment = $damage_deposit_payment;
443 + $this->prev_dd_payments = $prev_dd_payments;
444 + $this->quoteValidUntilDt = $quoteValidUntilDt ?? null;
385 445 $this->vbo_tn = $vbo_tn;
386 446
387 447 // theme
388 448 $theme = VikBooking::getTheme();