| @@ -19,8 +19,12 @@ | ||
| 19 | 19 | { |
| 20 | 20 | // Set the toolbar |
| 21 | 21 | $this->addToolBar(); |
| 22 | 22 | |
| 23 | + if (!JFactory::getUser()->authorise('core.vbo.bookings', 'com_vikbooking')) { | |
| 24 | + VBOHttpDocument::getInstance()->close(403, JText::translate('JERROR_ALERTNOAUTHOR')); | |
| 25 | + } | |
| 26 | + | |
| 23 | 27 | $cid = VikRequest::getVar('cid', array(0)); |
| 24 | 28 | $ido = $cid[0]; |
| 25 | 29 | |
| 26 | 30 | if (is_file(VCM_ADMIN_PATH.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'css'.DIRECTORY_SEPARATOR.'vcm-channels.css')) { |
| @@ -26,8 +30,11 @@ | ||
| 26 | 30 | if (is_file(VCM_ADMIN_PATH.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'css'.DIRECTORY_SEPARATOR.'vcm-channels.css')) { |
| 27 | 31 | $document = JFactory::getDocument(); |
| 28 | 32 | $document->addStyleSheet(VCM_ADMIN_URI.'assets/css/vikchannelmanager.css'); |
| 29 | 33 | $document->addStyleSheet(VCM_ADMIN_URI.'assets/css/vcm-channels.css'); |
| 34 | + if (method_exists('VikChannelManager', 'loadAppearancePreferenceAssets')) { | |
| 35 | + VikChannelManager::loadAppearancePreferenceAssets(); | |
| 36 | + } | |
| 30 | 37 | } |
| 31 | 38 | |
| 32 | 39 | $dbo = JFactory::getDbo(); |
| 33 | 40 | $app = JFactory::getApplication(); |
| @@ -104,8 +111,9 @@ | ||
| 104 | 111 | $ptot_taxes = VikRequest::getString('tot_taxes', '', 'request'); |
| 105 | 112 | $ptot_city_taxes = VikRequest::getString('tot_city_taxes', '', 'request'); |
| 106 | 113 | $ptot_fees = VikRequest::getString('tot_fees', '', 'request'); |
| 107 | 114 | $pcmms = VikRequest::getString('cmms', '', 'request'); |
| 115 | + $ptot_damage_dep = VikRequest::getString('tot_damage_dep', '', 'request'); | |
| 108 | 116 | $pcustmail = VikRequest::getString('custmail', '', 'request'); |
| 109 | 117 | $pcustphone = VikRequest::getString('custphone', '', 'request'); |
| 110 | 118 | $pmakepay = VikRequest::getInt('makepay', 0, 'request'); |
| 111 | 119 | $pnewamountpaid = VikRequest::getFloat('newamountpaid', -1, 'request'); |
| @@ -153,9 +161,13 @@ | ||
| 153 | 161 | $dbo->execute(); |
| 154 | 162 | $row['total'] = $newtotal; |
| 155 | 163 | $row['refund'] = $pnewamountrefunded; |
| 156 | 164 | // booking history log for new amount refunded |
| 157 | - VikBooking::getBookingHistoryInstance()->setBid($row['id'])->store('RU', JText::sprintf('VBO_NEWREFUND_AMOUNT', VikBooking::numberFormat($prevrefunded), VikBooking::numberFormat($pnewamountrefunded))); | |
| 165 | + VikBooking::getBookingHistoryInstance($row['id']) | |
| 166 | + ->setExtraData([ | |
| 167 | + 'amount_paid' => ($pnewamountrefunded - $prevrefunded), | |
| 168 | + ]) | |
| 169 | + ->store('RU', JText::sprintf('VBO_NEWREFUND_AMOUNT', VikBooking::numberFormat($prevrefunded), VikBooking::numberFormat($pnewamountrefunded))); | |
| 158 | 170 | } |
| 159 | 171 | $pnewamountpayable = VikRequest::getFloat('newamountpayable', -1, 'request'); |
| 160 | 172 | // we update the amount payable also if the input is 0.0 (float) as the default value is -1 (int) |
| 161 | 173 | if (($pnewamountpayable > 0 || ($pnewamountpayable == 0 && is_float($pnewamountpayable))) && (float)$row['payable'] != $pnewamountpayable) { |
| @@ -262,8 +274,14 @@ | ||
| 262 | 274 | $dbo->setQuery($q); |
| 263 | 275 | $dbo->execute(); |
| 264 | 276 | $row['cmms'] = $pcmms; |
| 265 | 277 | } |
| 278 | + if (strlen($ptot_damage_dep) > 0) { | |
| 279 | + $q = "UPDATE `#__vikbooking_orders` SET `tot_damage_dep`='".floatval($ptot_damage_dep)."' WHERE `id`=".$row['id'].";"; | |
| 280 | + $dbo->setQuery($q); | |
| 281 | + $dbo->execute(); | |
| 282 | + $row['tot_damage_dep'] = $ptot_damage_dep; | |
| 283 | + } | |
| 266 | 284 | if (strlen($pcustmail) > 0) { |
| 267 | 285 | $q = "UPDATE `#__vikbooking_orders` SET `custmail`=".$dbo->quote($pcustmail)." WHERE `id`=".$row['id'].";"; |
| 268 | 286 | $dbo->setQuery($q); |
| 269 | 287 | $dbo->execute(); |
| @@ -402,22 +420,20 @@ | ||
| 402 | 420 | $row['paymentlog'] = null; |
| 403 | 421 | } |
| 404 | 422 | |
| 405 | 423 | // detect if VCM exists |
| 406 | - $vcm_exists = is_file(VCM_SITE_PATH . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'lib.vikchannelmanager.php'); | |
| 424 | + $vcm_exists = class_exists('VikChannelManager'); | |
| 407 | 425 | |
| 408 | - // attempt to get the VCM review ID with a try-catch to avoid SQL errors | |
| 409 | - $vcm_review = array(); | |
| 426 | + // attempt to get the VCM review ID within a try-catch statement to avoid SQL errors | |
| 427 | + $vcm_review = null; | |
| 410 | 428 | if ($vcm_exists) { |
| 411 | 429 | try { |
| 412 | 430 | $q = "SELECT * FROM `#__vikchannelmanager_otareviews` WHERE `idorder`=" . (int)$row['id'] . ";"; |
| 413 | 431 | $dbo->setQuery($q); |
| 414 | - $dbo->execute(); | |
| 415 | - if ($dbo->getNumRows()) { | |
| 416 | - $vcm_review = $dbo->loadAssoc(); | |
| 417 | - } | |
| 432 | + $vcm_review = $dbo->loadAssoc(); | |
| 418 | 433 | } catch (Exception $e) { |
| 419 | 434 | // do nothing as VCM is probably not available/enabled/updated |
| 435 | + $vcm_review = null; | |
| 420 | 436 | } |
| 421 | 437 | } |
| 422 | 438 | |
| 423 | 439 | /** |
| @@ -431,9 +447,8 @@ | ||
| 431 | 447 | $vcm_host_to_guest_review = 0; |
| 432 | 448 | $vcm_cancel_active_res = 0; |
| 433 | 449 | if ($vcm_exists) { |
| 434 | 450 | try { |
| 435 | - require_once VCM_SITE_PATH . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'lib.vikchannelmanager.php'; | |
| 436 | 451 | if (method_exists('VikChannelManager', 'reservationNeedsDeclineReasons')) { |
| 437 | 452 | $vcm_decline_actions = (int)VikChannelManager::reservationNeedsDeclineReasons($row); |
| 438 | 453 | } |
| 439 | 454 | if (method_exists('VikChannelManager', 'reservationSupportsPreApproval')) { |