| @@ -30,8 +30,11 @@ | ||
| 30 | 30 | if (is_file(VCM_ADMIN_PATH.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'css'.DIRECTORY_SEPARATOR.'vcm-channels.css')) { |
| 31 | 31 | $document = JFactory::getDocument(); |
| 32 | 32 | $document->addStyleSheet(VCM_ADMIN_URI.'assets/css/vikchannelmanager.css'); |
| 33 | 33 | $document->addStyleSheet(VCM_ADMIN_URI.'assets/css/vcm-channels.css'); |
| 34 | + if (method_exists('VikChannelManager', 'loadAppearancePreferenceAssets')) { | |
| 35 | + VikChannelManager::loadAppearancePreferenceAssets(); | |
| 36 | + } | |
| 34 | 37 | } |
| 35 | 38 | |
| 36 | 39 | $dbo = JFactory::getDbo(); |
| 37 | 40 | $app = JFactory::getApplication(); |
| @@ -108,8 +111,9 @@ | ||
| 108 | 111 | $ptot_taxes = VikRequest::getString('tot_taxes', '', 'request'); |
| 109 | 112 | $ptot_city_taxes = VikRequest::getString('tot_city_taxes', '', 'request'); |
| 110 | 113 | $ptot_fees = VikRequest::getString('tot_fees', '', 'request'); |
| 111 | 114 | $pcmms = VikRequest::getString('cmms', '', 'request'); |
| 115 | + $ptot_damage_dep = VikRequest::getString('tot_damage_dep', '', 'request'); | |
| 112 | 116 | $pcustmail = VikRequest::getString('custmail', '', 'request'); |
| 113 | 117 | $pcustphone = VikRequest::getString('custphone', '', 'request'); |
| 114 | 118 | $pmakepay = VikRequest::getInt('makepay', 0, 'request'); |
| 115 | 119 | $pnewamountpaid = VikRequest::getFloat('newamountpaid', -1, 'request'); |
| @@ -157,9 +161,13 @@ | ||
| 157 | 161 | $dbo->execute(); |
| 158 | 162 | $row['total'] = $newtotal; |
| 159 | 163 | $row['refund'] = $pnewamountrefunded; |
| 160 | 164 | // booking history log for new amount refunded |
| 161 | - 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))); | |
| 162 | 170 | } |
| 163 | 171 | $pnewamountpayable = VikRequest::getFloat('newamountpayable', -1, 'request'); |
| 164 | 172 | // we update the amount payable also if the input is 0.0 (float) as the default value is -1 (int) |
| 165 | 173 | if (($pnewamountpayable > 0 || ($pnewamountpayable == 0 && is_float($pnewamountpayable))) && (float)$row['payable'] != $pnewamountpayable) { |
| @@ -266,8 +274,14 @@ | ||
| 266 | 274 | $dbo->setQuery($q); |
| 267 | 275 | $dbo->execute(); |
| 268 | 276 | $row['cmms'] = $pcmms; |
| 269 | 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 | + } | |
| 270 | 284 | if (strlen($pcustmail) > 0) { |
| 271 | 285 | $q = "UPDATE `#__vikbooking_orders` SET `custmail`=".$dbo->quote($pcustmail)." WHERE `id`=".$row['id'].";"; |
| 272 | 286 | $dbo->setQuery($q); |
| 273 | 287 | $dbo->execute(); |
| @@ -406,22 +420,20 @@ | ||
| 406 | 420 | $row['paymentlog'] = null; |
| 407 | 421 | } |
| 408 | 422 | |
| 409 | 423 | // detect if VCM exists |
| 410 | - $vcm_exists = is_file(VCM_SITE_PATH . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'lib.vikchannelmanager.php'); | |
| 424 | + $vcm_exists = class_exists('VikChannelManager'); | |
| 411 | 425 | |
| 412 | - // attempt to get the VCM review ID with a try-catch to avoid SQL errors | |
| 413 | - $vcm_review = array(); | |
| 426 | + // attempt to get the VCM review ID within a try-catch statement to avoid SQL errors | |
| 427 | + $vcm_review = null; | |
| 414 | 428 | if ($vcm_exists) { |
| 415 | 429 | try { |
| 416 | 430 | $q = "SELECT * FROM `#__vikchannelmanager_otareviews` WHERE `idorder`=" . (int)$row['id'] . ";"; |
| 417 | 431 | $dbo->setQuery($q); |
| 418 | - $dbo->execute(); | |
| 419 | - if ($dbo->getNumRows()) { | |
| 420 | - $vcm_review = $dbo->loadAssoc(); | |
| 421 | - } | |
| 432 | + $vcm_review = $dbo->loadAssoc(); | |
| 422 | 433 | } catch (Exception $e) { |
| 423 | 434 | // do nothing as VCM is probably not available/enabled/updated |
| 435 | + $vcm_review = null; | |
| 424 | 436 | } |
| 425 | 437 | } |
| 426 | 438 | |
| 427 | 439 | /** |
| @@ -435,9 +447,8 @@ | ||
| 435 | 447 | $vcm_host_to_guest_review = 0; |
| 436 | 448 | $vcm_cancel_active_res = 0; |
| 437 | 449 | if ($vcm_exists) { |
| 438 | 450 | try { |
| 439 | - require_once VCM_SITE_PATH . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'lib.vikchannelmanager.php'; | |
| 440 | 451 | if (method_exists('VikChannelManager', 'reservationNeedsDeclineReasons')) { |
| 441 | 452 | $vcm_decline_actions = (int)VikChannelManager::reservationNeedsDeclineReasons($row); |
| 442 | 453 | } |
| 443 | 454 | if (method_exists('VikChannelManager', 'reservationSupportsPreApproval')) { |