ordersrooms; $ord = $this->ord; $all_rooms = $this->all_rooms; $customer = $this->customer; $dbo = JFactory::getDbo(); $vbo_app = VikBooking::getVboApplication(); $vbo_app->loadSelect2(); $vbo_app->loadDatePicker(); // availability helper $av_helper = VikBooking::getAvailabilityInstance(); // room stay dates in case of split stay (or modified room nights) $room_stay_dates = []; $js_cal_def_vals = []; $room_stay_records = []; if ($ord['split_stay']) { if ($ord['status'] == 'confirmed') { $room_stay_dates = $av_helper->loadSplitStayBusyRecords($ord['id']); } else { $room_stay_dates = VBOFactory::getConfig()->getArray('split_stay_' . $ord['id'], []); } // immediately count the number of nights of stay for each split room foreach ($room_stay_dates as $sps_r_k => $sps_r_v) { if (!empty($sps_r_v['checkin_ts']) && !empty($sps_r_v['checkout_ts'])) { // overwrite values for compatibility with non-confirmed bookings $sps_r_v['checkin'] = $sps_r_v['checkin_ts']; $sps_r_v['checkout'] = $sps_r_v['checkout_ts']; } $sps_r_v['nights'] = $av_helper->countNightsOfStay($sps_r_v['checkin'], $sps_r_v['checkout']); // overwrite the whole array $room_stay_dates[$sps_r_k] = $sps_r_v; } } elseif (!$ord['split_stay'] && !$ord['closure'] && $ord['roomsnum'] > 1 && $ord['days'] > 1 && $ord['status'] == 'confirmed') { // load the occupied stay dates for each room in case they were modified $room_stay_records = $av_helper->loadSplitStayBusyRecords($ord['id']); } $pgoto = VikRequest::getString('goto', '', 'request'); $currencysymb = VikBooking::getCurrencySymb(true); $nowdf = VikBooking::getDateFormat(true); if ($nowdf == "%d/%m/%Y") { $rit = date('d/m/Y', $ord['checkin']); $con = date('d/m/Y', $ord['checkout']); $df = 'd/m/Y'; $juidf = 'dd/mm/yy'; } elseif ($nowdf == "%m/%d/%Y") { $rit = date('m/d/Y', $ord['checkin']); $con = date('m/d/Y', $ord['checkout']); $df = 'm/d/Y'; $juidf = 'mm/dd/yy'; } else { $rit = date('Y/m/d', $ord['checkin']); $con = date('Y/m/d', $ord['checkout']); $df = 'Y/m/d'; $juidf = 'yy/mm/dd'; } $datesep = VikBooking::getDateSeparator(true); // stay dates details $checkin_info = getdate($ord['checkin']); $checkout_info = getdate($ord['checkout']); $ritho = ''; $conho = ''; $ritmi = ''; $conmi = ''; for ($i = 0; $i < 24; $i++) { $ritho .= "\n"; $conho .= "\n"; } for ($i = 0; $i < 60; $i++) { $ritmi .= "\n"; $conmi .= "\n"; } if ($ord) { $pcheckin = $ord['checkin']; $pcheckout = $ord['checkout']; $secdiff = $pcheckout - $pcheckin; $daysdiff = $secdiff / 86400; if (is_int($daysdiff)) { if ($daysdiff < 1) { $daysdiff = 1; } } else { if ($daysdiff < 1) { $daysdiff = 1; } else { $sum = floor($daysdiff) * 86400; $newdiff = $secdiff - $sum; $maxhmore = VikBooking::getHoursMoreRb() * 3600; if ($maxhmore >= $newdiff) { $daysdiff = floor($daysdiff); } else { $daysdiff = ceil($daysdiff); } } } } $otachannel = ''; $otachannel_name = ''; $otachannel_bid = ''; $otacurrency = ''; if (!empty($ord['channel'])) { $channelparts = explode('_', $ord['channel']); $otachannel = array_key_exists(1, $channelparts) && strlen($channelparts[1]) > 0 ? $channelparts[1] : ucwords($channelparts[0]); $otachannel_name = $otachannel; $otachannel_bid = $otachannel.(!empty($ord['idorderota']) ? ' - Booking ID: '.$ord['idorderota'] : ''); if (strstr($otachannel, '.') !== false) { $otaccparts = explode('.', $otachannel); $otachannel = $otaccparts[0]; } $otacurrency = !empty($ord['chcurrency']) ? $ord['chcurrency'] : ''; } $status_type = ''; if (!empty($ord['type'])) { $status_type = JText::translate('VBO_BTYPE_' . strtoupper($ord['type'])); if (!strcasecmp($ord['type'], 'overbooking')) { $status_type = '' . $status_type . ''; } $status_type .= ' / '; } if ($ord['status'] == "confirmed") { $saystaus = '' . $status_type . JText::translate('VBCONFIRMED') . ''; } elseif ($ord['status']=="standby") { $saystaus = '' . $status_type . JText::translate('VBSTANDBY') . ''; } else { $saystaus = '' . $status_type . JText::translate('VBCANCELLED') . ''; } //Package or custom rate $is_package = !empty($ord['pkg']) ? true : false; $is_cust_cost = false; foreach ($ordersrooms as $kor => $or) { if ($is_package !== true && !empty($or['cust_cost']) && $or['cust_cost'] > 0.00) { $is_cust_cost = true; break; } } $ivas = array(); $wiva = ""; $jstaxopts = ''; $q = "SELECT * FROM `#__vikbooking_iva`;"; $dbo->setQuery($q); $dbo->execute(); if ($dbo->getNumRows() > 0) { $ivas = $dbo->loadAssocList(); $wiva = "\n"; } // room switching $switching = false; $switcher = ''; if ($ord && count($all_rooms) > 1 && (!empty($ordersrooms[0]['idtar']) || $is_package || $is_cust_cost)) { $switching = true; $occ_rooms = array(); foreach ($all_rooms as $r) { $rkey = $r['fromadult'] < $r['toadult'] ? $r['fromadult'].' - '.$r['toadult'] : $r['toadult']; $occ_rooms[$rkey][] = $r; } $switcher = ''."\n"; } $canDo = JFactory::getUser(); JText::script('VBPEDITBUSYEXTRACOSTS'); JText::script('VBDASHBOOKINGID'); JText::script('VBPVIEWORDERSONE'); JText::script('VBEDITORDERTHREE'); JText::script('VBDAYS'); JText::script('VBEDITORDERADULTS'); JText::script('VBEDITORDERCHILDREN'); JText::script('VBPEDITBUSYADDEXTRAC'); JText::script('VBO_CONF_RM_OVERBOOKING_FLAG'); ?>


ID
authorise('core.edit', 'com_vikbooking') && $canDo->authorise('core.vbo.management', 'com_vikbooking')): ?>
'; } ?>

printYesNoButtons('forcebooking', JText::translate('VBYES'), JText::translate('VBNO'), 0, 1, 0); ?>
getCalendar($rit, 'checkindate', 'checkindate', $nowdf, array('class'=>'', 'size'=>'10', 'maxlength'=>'19', 'todayBtn' => 'true')); ?> :
getCalendar($con, 'checkoutdate', 'checkoutdate', $nowdf, array('class'=>'', 'size'=>'10', 'maxlength'=>'19', 'todayBtn' => 'true')); ?> :
= 1.8.24 */ if (!empty($otachannel_name) && class_exists('VCMOtaReporting') && VCMOtaReporting::getInstance($ord)->stayChangeAllowed()) { ?>
printYesNoButtons('ota_stay_change_all', JText::translate('VBYES'), JText::translate('VBNO'), 0, 1, 0, "jQuery('#vbo-report-stay-change-ota-allr').toggle();"); ?>
$or) { $num = $kor + 1; $rooms[$num] = $or; $arrpeople[$num]['adults'] = $or['adults']; $arrpeople[$num]['children'] = $or['children']; if ($is_package) { continue; } // default values to be considered $room_nights = (int)$ord['days']; $room_checkin = $ord['checkin']; $room_checkout = $ord['checkout']; if ($ord['split_stay'] && count($room_stay_dates) && isset($room_stay_dates[$kor]) && $room_stay_dates[$kor]['idroom'] == $or['idroom']) { // use appropriate values for split stays $room_nights = $room_stay_dates[$kor]['nights']; $room_checkin = $room_stay_dates[$kor]['checkin']; $room_checkout = $room_stay_dates[$kor]['checkout']; } // seek for rates $q = "SELECT * FROM `#__vikbooking_dispcost` WHERE `days`=" . $room_nights . " AND `idroom`=" . (int)$or['idroom'] . " ORDER BY `#__vikbooking_dispcost`.`cost` ASC;"; $dbo->setQuery($q); $tar = $dbo->loadAssocList(); if (!$tar) { $proceedtars = false; break; } $tar = VikBooking::applySeasonsRoom($tar, $room_checkin, $room_checkout); // apply OBP rules $tar = VBORoomHelper::getInstance()->applyOBPRules($tar, $or, $or['adults']); // push tariffs for this room $tars[$num] = $tar; } if ($proceedtars) { ?>
$or) { $num = $kor + 1; // default values to be considered $room_nights = (int)$ord['days']; $room_checkin = $ord['checkin']; $room_checkout = $ord['checkout']; if ($ord['split_stay'] && count($room_stay_dates) && isset($room_stay_dates[$kor]) && $room_stay_dates[$kor]['idroom'] == $or['idroom']) { // use appropriate values for split stays $room_nights = $room_stay_dates[$kor]['nights']; $room_checkin = $room_stay_dates[$kor]['checkin']; $room_checkout = $room_stay_dates[$kor]['checkout']; } ?>
1) { ?>
:
0) { ?>
:
'room-splitstay-checkin' . $num, 'value' => $cal_def_checkin, ]; $js_cal_def_vals[] = [ 'id' => 'room-splitstay-checkout' . $num, 'value' => $cal_def_checkout, ]; ?>

1 ? JText::translate('VBDAYS') : JText::translate('VBDAY')); ?>

getCalendar($cal_def_checkin, 'split_stay_data[' . $kor . '][checkin]', 'room-splitstay-checkin' . $num, $nowdf, array('class'=>'', 'size'=>'10', 'maxlength'=>'19', 'todayBtn' => 'true')); ?>
getCalendar($cal_def_checkout, 'split_stay_data[' . $kor . '][checkout]', 'room-splitstay-checkout' . $num, $nowdf, array('class'=>'', 'size'=>'10', 'maxlength'=>'19', 'todayBtn' => 'true')); ?>
1 && $ord['days'] > 1 && $ord['status'] == 'confirmed') { /** * We allow to modify the nights of stay for each room in the limits of the booking dates. * This function will only affect the availability, not the calculation of the rate plans/options. * It is meant to simply free up rooms on dates within the booking check-in and check-out dates. * * @since 1.16.0 (J) - 1.6.0 (WP) */ $room_now_checkin = $ord['checkin']; $room_now_checkout = $ord['checkout']; $room_now_nights = $ord['days']; if (isset($room_stay_records[$kor]) && $room_stay_records[$kor]['idroom'] == $or['idroom']) { $room_now_checkin = $room_stay_records[$kor]['checkin']; $room_now_checkout = $room_stay_records[$kor]['checkout']; $room_now_nights = $av_helper->countNightsOfStay($room_now_checkin, $room_now_checkout); } ?>

1 ? JText::translate('VBDAYS') : JText::translate('VBDAY')); ?>

printYesNoButtons('room_modify_dates' . $kor, JText::translate('VBYES'), JText::translate('VBNO'), 0, 1, 0, 'vboEditbusyModifyRoomDates(this.checked, ' . $kor . ')'); ?>
$or['adults'] ? $or['adults'] : $from_a; $to_a = $or['toadult']; $to_a = $to_a < $or['adults'] ? $or['adults'] : $to_a; $from_c = $or['fromchild']; $from_c = $from_c > $or['children'] ? $or['children'] : $from_c; $to_c = $or['tochild']; $to_c = $to_c < $or['children'] ? $or['children'] : $to_c; $adults_opts = ''; $children_opts = ''; for ($z = $from_a; $z <= $to_a; $z++) { $adults_opts .= ''; } for ($z = $from_c; $z <= $to_c; $z++) { $children_opts .= ''; } ?>

0.00 ? true : false; $active_rplan_id = 0; if ($is_package || $is_cust_cost) { if ($is_package) { $pkg_name = (!empty($or['pkg_name']) ? $or['pkg_name'] : JText::translate('VBOROOMCUSTRATEPLAN')); ?>
$t) { ?>
$t) { $sel_rate_changed = $t['id'] == $or['idtar'] && !empty($or['room_cost']) ? $or['room_cost'] : $sel_rate_changed; $format_cost = VikBooking::numberFormat($t['cost']); if ($t['id'] == $or['idtar'] && !empty($or['room_cost'])) { $active_rplan_id = $t['idprice']; } ?>
/>

getPlans() as $meal_enum => $meal_name) { if (!empty($or['meals'])) { // check if meal is included in room-reservation record $meal_included = $meal_plan_manager->roomRateMealIncluded($or, $meal_enum); } else { // check if meal is included in the selected rate plan $meal_included = $active_rplan_id ? $meal_plan_manager->ratePlanMealIncluded($active_rplan_id, $meal_enum) : false; } if (!$meal_included && empty($or['meals']) && !empty($ord['idorderota']) && !empty($ord['channel']) && !empty($ord['custdata'])) { // check if meal is included by using the raw customer data or OTA reservation and room $meal_included = $meal_plan_manager->otaDataMealIncluded($ord, $or, $meal_enum); } ?>
/>

$ageintervals); $optionals = array_merge($ageintervals, $optionals); } else { $optionals = array(0 => $ageintervals); } } if (!empty($or['optionals'])) { $haveopt = explode(";", $or['optionals']); foreach ($haveopt as $ho) { if (!empty($ho)) { $havetwo = explode(":", $ho); if (strstr($havetwo[1], '-') != false) { $arropt[$havetwo[0]][] = $havetwo[1]; } else { $arropt[$havetwo[0]] = $havetwo[1]; } } } } else { $arropt[] = ""; } foreach ($optionals as $k => $o) { $oval = ""; if (intval($o['hmany']) == 1) { if (array_key_exists($o['id'], $arropt)) { $oval = $arropt[$o['id']]; } } else { if (array_key_exists($o['id'], $arropt) && !is_array($arropt[$o['id']])) { $oval = " checked=\"checked\""; } } if (!empty($o['ageintervals'])) { if ($or['children'] > 0) { for ($ch = 1; $ch <= $or['children']; $ch++) { $chageselect = ''."\n"; ?>
0 && $thisoptcost > $o['maxprice']) { $thisoptcost = $o['maxprice']; } $thisoptcost = $thisoptcost * $optquancheckb; if (intval($o['perperson']) == 1) { $thisoptcost = $thisoptcost * $arrpeople[$num]['adults']; } if ($o['pcentroom']) { // it's a percent value, so we do not multiply anything $thisoptcost = $o['cost']; } ?>
" : ""); ?>

$ecv) { $ec_taxopts = ''; foreach ($ivas as $iv) { $ec_taxopts .= "\n"; } ?>

$or) { $num = $kor + 1; $rooms[$num] = $or; $arrpeople[$num]['adults'] = $or['adults']; $arrpeople[$num]['children'] = $or['children']; // default values to be considered $room_nights = (int)$ord['days']; $room_checkin = $ord['checkin']; $room_checkout = $ord['checkout']; if ($ord['split_stay'] && count($room_stay_dates) && isset($room_stay_dates[$kor]) && $room_stay_dates[$kor]['idroom'] == $or['idroom']) { // use appropriate values for split stays $room_nights = $room_stay_dates[$kor]['nights']; $room_checkin = $room_stay_dates[$kor]['checkin']; $room_checkout = $room_stay_dates[$kor]['checkout']; } // seek for rates $q = "SELECT * FROM `#__vikbooking_dispcost` WHERE `days`=" . $room_nights . " AND `idroom`=" . (int)$or['idroom'] . " ORDER BY `#__vikbooking_dispcost`.`cost` ASC;"; $dbo->setQuery($q); $tar = $dbo->loadAssocList(); if (!$tar) { $proceedtars = false; break; } $tar = VikBooking::applySeasonsRoom($tar, $room_checkin, $room_checkout); // apply OBP rules $tar = VBORoomHelper::getInstance()->applyOBPRules($tar, $or, $or['adults']); // push tariffs for this room $tars[$num] = $tar; } if ($proceedtars) { ?>
$or) { $num = $kor + 1; // default values to be considered $room_nights = (int)$ord['days']; $room_checkin = $ord['checkin']; $room_checkout = $ord['checkout']; if ($ord['split_stay'] && count($room_stay_dates) && isset($room_stay_dates[$kor]) && $room_stay_dates[$kor]['idroom'] == $or['idroom']) { // use appropriate values for split stays $room_nights = $room_stay_dates[$kor]['nights']; $room_checkin = $room_stay_dates[$kor]['checkin']; $room_checkout = $room_stay_dates[$kor]['checkout']; } ?>
:
0) { ?>
:

createPopover(array('title' => JText::translate('VBPEDITBUSYSEVEN'), 'content' => JText::translate('VBOMISSPRTYPEROOMH'))) : ''; ?>

$t) { ?>
$ageintervals); $optionals = array_merge($ageintervals, $optionals); } else { $optionals = array(0 => $ageintervals); } } if (!empty($or['optionals'])) { $haveopt = explode(";", $or['optionals']); foreach ($haveopt as $ho) { if (!empty($ho)) { $havetwo = explode(":", $ho); if (strstr($havetwo[1], '-') != false) { $arropt[$havetwo[0]][] = $havetwo[1]; } else { $arropt[$havetwo[0]] = $havetwo[1]; } } } } else { $arropt[] = ""; } ?>

$o) { $oval = ""; if (intval($o['hmany']) == 1) { if (array_key_exists($o['id'], $arropt)) { $oval = $arropt[$o['id']]; } } else { if (array_key_exists($o['id'], $arropt) && !is_array($arropt[$o['id']])) { $oval = " checked=\"checked\""; } } if (!empty($o['ageintervals'])) { if ($or['children'] > 0) { for ($ch = 1; $ch <= $or['children']; $ch++) { $chageselect = ''."\n"; ?>
0 && $thisoptcost > $o['maxprice']) { $thisoptcost = $o['maxprice']; } $thisoptcost = $thisoptcost * $optquancheckb; if (intval($o['perperson']) == 1) { $thisoptcost = $thisoptcost * $arrpeople[$num]['adults']; } ?>
" : ""); ?>

$ecv) { $ec_taxopts = ''; foreach ($ivas as $iv) { $ec_taxopts .= "\n"; } ?>

' : ''; $pvcm = VikRequest::getInt('vcm', '', 'request'); echo $pvcm == 1 ? '' : ''; echo $pgoto == 'overv' ? '' : ''; ?>