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 | admin/controllers/bookings.php +50 -0 1.8.12 → 1.8.16 View file →
@@ -1288,5 +1288,55 @@
1288 1288 VBOHttpDocument::getInstance($app)->json([
1289 1289 'success' => true,
1290 1290 ]);
1291 1291 }
1292 +
1293 + /**
1294 + * Regular task to create passcodes for a booking that should have had them.
1295 + *
1296 + * @since 1.18.16 (J) - 1.8.16 (WP)
1297 + */
1298 + public function generatePasscodes()
1299 + {
1300 + $app = JFactory::getApplication();
1301 +
1302 + $bookingId = $app->input->getUInt('bid', 0);
1303 +
1304 + if (!$bookingId) {
1305 + $app->enqueueMessage('Missing booking ID.', 'error');
1306 + $app->redirect('index.php?option=com_vikbooking');
1307 + $app->close();
1308 + }
1309 +
1310 + if (!JSession::checkToken() && !JSession::checkToken('get')) {
1311 + $app->enqueueMessage(JText::translate('JINVALID_TOKEN'), 'error');
1312 + $app->redirect('index.php?option=com_vikbooking&task=editorder&cid[]=' . $bookingId);
1313 + $app->close();
1314 + }
1315 +
1316 + try {
1317 + // access booking registry
1318 + $registry = VBOBookingRegistry::getInstance(['id' => $bookingId]);
1319 + } catch (Exception $e) {
1320 + $app->enqueueMessage($e->getMessage(), 'error');
1321 + $app->redirect('index.php?option=com_vikbooking');
1322 + $app->close();
1323 + }
1324 +
1325 + // do not check the history to see if previous passcode generation events occurred
1326 + // always simulate the creation of this booking
1327 + $generated = VBOFactory::getDoorAccessControl()->processBookingConfirmation($registry->getData(), $registry->getRooms());
1328 +
1329 + if ($registry->hasPreCheckedIn()) {
1330 + // simulate the pre-check-in completion of the booking
1331 + $generatedTwo = VBOFactory::getDoorAccessControl()->processPrecheckinCompleted($registry->getData(), $registry->getRooms());
1332 + }
1333 +
1334 + // evaluate result
1335 + $generated = $generated || $generatedTwo;
1336 +
1337 + // complete with a successful message
1338 + $app->enqueueMessage(JText::translate('VBO_W_DOORACCESSCONTROL_TITLE'), ($generated ? 'success' : 'warning'));
1339 + $app->redirect('index.php?option=com_vikbooking&task=editorder&cid[]=' . $bookingId);
1340 + $app->close();
1341 + }
1292 1342 }