| @@ -48,8 +48,9 @@ | ||
| 48 | 48 | ->where($dbo->qn('status') . ' = ' . $dbo->q('confirmed')) |
| 49 | 49 | ->where($dbo->qn('closure') . ' = 0'); |
| 50 | 50 | |
| 51 | 51 | if (!empty($bid)) { |
| 52 | + $q->clear('where'); | |
| 52 | 53 | $q->where($dbo->qn('id') . ' = ' . $bid); |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | 56 | $q->order($dbo->qn('id') . ' DESC'); |
| @@ -56,8 +57,9 @@ | ||
| 56 | 57 | |
| 57 | 58 | $dbo->setQuery($q, 0, 1); |
| 58 | 59 | $booking = $dbo->loadAssoc(); |
| 59 | 60 | |
| 61 | + $booking_rooms = []; | |
| 60 | 62 | if ($booking) { |
| 61 | 63 | $booking_rooms = VikBooking::loadOrdersRoomsData($booking['id']); |
| 62 | 64 | // inject properties for parsing the conditional text rules later |
| 63 | 65 | VikBooking::getConditionalRulesInstance()->set(['booking', 'rooms'], [$booking, $booking_rooms]); |
| @@ -75,8 +77,13 @@ | ||
| 75 | 77 | ]); |
| 76 | 78 | |
| 77 | 79 | // prepare the final email content |
| 78 | 80 | $mail_content = VBOFactory::getPlatform()->getMailer()->prepare($mail_data); |
| 81 | + | |
| 82 | + if ($booking) { | |
| 83 | + // apply a common replacement method for the special tags | |
| 84 | + $mail_content = VBOMailParser::replaceSpecialTags($mail_content, $booking, $booking_rooms); | |
| 85 | + } | |
| 79 | 86 | |
| 80 | 87 | // send JSON response to output |
| 81 | 88 | VBOHttpDocument::getInstance($app)->json([$mail_content]); |
| 82 | 89 | } |