/**
  * Gets the invoice image
  *
  * @param   object  $booking - The booking
  * @param   object  $event   - The event (opt)
  *
  * @return  string
  */
 public static function getInvoiceImage($booking, $event = null)
 {
     if ($event != null && $event->fees <= 0) {
         return "";
     }
     if ($event == null && $booking->eventfees == 0) {
         return "";
     }
     $invoice_link = MatukioHelperInvoice::getInvoiceNumber($booking->sid, JHTML::_('date', $booking->bookingdate, 'Y')) . " " . MatukioHelperUtilsAdmin::getBackendPrintWindow(6, $booking->semid, $booking->sid);
     return $invoice_link;
 }
 /**
  * Gets the replacements for the event & (booking)
  *
  * @param   object  $event    - The event data
  * @param   object  $booking  - The booking data
  * @param   int     $nr       - the number
  *
  * @return mixed
  */
 public static function getReplaces($event, $booking = null, $nr = null)
 {
     $needles = array('event' => (int) $event->id, 'category' => 0);
     $itemId = MatukioHelperRoute::_findItem($needles)->id;
     if ($nr != null) {
         $replaces["MAT_NR"] = $nr;
     }
     // Current date
     $replaces["MAT_DATE"] = JHTML::_('date', '', MatukioHelperSettings::getSettings('date_format_without_time', 'd-m-Y'));
     // Signature
     $replaces["MAT_SIGNATURE"] = MatukioHelperSettings::getSettings('mat_signature', 'Please do not answer this E-Mail.');
     // Event data
     $replaces["MAT_EVENT_SEMNUM"] = $event->semnum;
     // Alias
     $replaces["MAT_EVENT_NUMBER"] = $event->semnum;
     $replaces["MAT_EVENT_CATID"] = $event->catid;
     $replaces["MAT_EVENT_CATEGORY"] = JText::_($event->category);
     $replaces["MAT_EVENT_TITLE"] = JText::_($event->title);
     $replaces["MAT_EVENT_TARGET"] = JText::_($event->target);
     $replaces["MAT_EVENT_SHORTDESC"] = JText::_($event->shortdesc);
     // TODO change image path
     $replaces["MAT_EVENT_DESCRIPTION"] = JHTML::_('content.prepare', $event->description);
     $location = $event->place;
     // Locations
     if ($event->place_id > 0) {
         $locobj = MatukioHelperUtilsEvents::getLocation($event->place_id);
         $location = $locobj->location;
     }
     $replaces["MAT_EVENT_PLACE"] = $location;
     $replaces["MAT_EVENT_LOCATION"] = $location;
     $replaces["MAT_EVENT_TEACHER"] = $event->teacher;
     // Alias
     $replaces["MAT_EVENT_TUTOR"] = $event->teacher;
     if ($event->fees > 0) {
         $replaces["MAT_EVENT_FEES"] = MatukioHelperUtilsEvents::getFormatedCurrency($event->fees, MatukioHelperSettings::_('currency_symbol', '$'));
     } else {
         $replaces["MAT_EVENT_FEES"] = JText::_("COM_MATUKIO_FREE");
     }
     $replaces["MAT_EVENT_ORGANIZER_ID"] = $event->publisher;
     $replaces["MAT_EVENT_ORGANIZER"] = JFactory::getUser($event->publisher)->name;
     $replaces["MAT_EVENT_MAXPUPIL"] = $event->maxpupil;
     $replaces["MAT_EVENT_BOOKEDPUPIL"] = $event->bookedpupil;
     $replaces["MAT_EVENT_BEGIN"] = JHTML::_('date', $event->begin, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i'));
     $replaces["MAT_EVENT_END"] = JHTML::_('date', $event->end, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i'));
     $replaces["MAT_EVENT_BOOKED"] = JHTML::_('date', $event->booked, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i'));
     $replaces["MAT_EVENT_GMAPLOC"] = $event->gmaploc;
     $replaces["MAT_EVENT_NRBOOKED"] = $event->nrbooked;
     /* Alias */
     $custom10 = explode("|", $event->zusatz10);
     $custom11 = explode("|", $event->zusatz11);
     $custom12 = explode("|", $event->zusatz12);
     $custom13 = explode("|", $event->zusatz13);
     $custom14 = explode("|", $event->zusatz14);
     $custom15 = explode("|", $event->zusatz15);
     $custom16 = explode("|", $event->zusatz16);
     $custom17 = explode("|", $event->zusatz17);
     $custom18 = explode("|", $event->zusatz18);
     $custom19 = explode("|", $event->zusatz19);
     $custom20 = explode("|", $event->zusatz20);
     $custom1 = explode("|", $event->zusatz1);
     $custom2 = explode("|", $event->zusatz2);
     $custom3 = explode("|", $event->zusatz3);
     $custom4 = explode("|", $event->zusatz4);
     $custom5 = explode("|", $event->zusatz5);
     $custom6 = explode("|", $event->zusatz6);
     $custom7 = explode("|", $event->zusatz7);
     $custom8 = explode("|", $event->zusatz8);
     $custom9 = explode("|", $event->zusatz9);
     $replaces["MAT_EVENT_CUSTOM10"] = $custom10[0];
     $replaces["MAT_EVENT_CUSTOM11"] = $custom11[0];
     $replaces["MAT_EVENT_CUSTOM12"] = $custom12[0];
     $replaces["MAT_EVENT_CUSTOM13"] = $custom13[0];
     $replaces["MAT_EVENT_CUSTOM14"] = $custom14[0];
     $replaces["MAT_EVENT_CUSTOM15"] = $custom15[0];
     $replaces["MAT_EVENT_CUSTOM16"] = $custom16[0];
     $replaces["MAT_EVENT_CUSTOM17"] = $custom17[0];
     $replaces["MAT_EVENT_CUSTOM18"] = $custom18[0];
     $replaces["MAT_EVENT_CUSTOM19"] = $custom19[0];
     $replaces["MAT_EVENT_CUSTOM20"] = $custom20[0];
     $replaces["MAT_EVENT_CUSTOM1"] = $custom1[0];
     $replaces["MAT_EVENT_CUSTOM2"] = $custom2[0];
     $replaces["MAT_EVENT_CUSTOM3"] = $custom3[0];
     $replaces["MAT_EVENT_CUSTOM4"] = $custom4[0];
     $replaces["MAT_EVENT_CUSTOM5"] = $custom5[0];
     $replaces["MAT_EVENT_CUSTOM6"] = $custom6[0];
     $replaces["MAT_EVENT_CUSTOM7"] = $custom7[0];
     $replaces["MAT_EVENT_CUSTOM8"] = $custom8[0];
     $replaces["MAT_EVENT_CUSTOM9"] = $custom9[0];
     $replaces["MAT_EVENT_ZUSATZ10"] = $replaces["MAT_EVENT_CUSTOM10"];
     $replaces["MAT_EVENT_ZUSATZ11"] = $replaces["MAT_EVENT_CUSTOM11"];
     $replaces["MAT_EVENT_ZUSATZ12"] = $replaces["MAT_EVENT_CUSTOM12"];
     $replaces["MAT_EVENT_ZUSATZ13"] = $replaces["MAT_EVENT_CUSTOM13"];
     $replaces["MAT_EVENT_ZUSATZ14"] = $replaces["MAT_EVENT_CUSTOM14"];
     $replaces["MAT_EVENT_ZUSATZ15"] = $replaces["MAT_EVENT_CUSTOM15"];
     $replaces["MAT_EVENT_ZUSATZ16"] = $replaces["MAT_EVENT_CUSTOM16"];
     $replaces["MAT_EVENT_ZUSATZ17"] = $replaces["MAT_EVENT_CUSTOM17"];
     $replaces["MAT_EVENT_ZUSATZ18"] = $replaces["MAT_EVENT_CUSTOM18"];
     $replaces["MAT_EVENT_ZUSATZ19"] = $replaces["MAT_EVENT_CUSTOM19"];
     $replaces["MAT_EVENT_ZUSATZ20"] = $replaces["MAT_EVENT_CUSTOM20"];
     $replaces["MAT_EVENT_ZUSATZ1"] = $replaces["MAT_EVENT_CUSTOM1"];
     $replaces["MAT_EVENT_ZUSATZ2"] = $replaces["MAT_EVENT_CUSTOM2"];
     $replaces["MAT_EVENT_ZUSATZ3"] = $replaces["MAT_EVENT_CUSTOM3"];
     $replaces["MAT_EVENT_ZUSATZ4"] = $replaces["MAT_EVENT_CUSTOM4"];
     $replaces["MAT_EVENT_ZUSATZ5"] = $replaces["MAT_EVENT_CUSTOM5"];
     $replaces["MAT_EVENT_ZUSATZ6"] = $replaces["MAT_EVENT_CUSTOM6"];
     $replaces["MAT_EVENT_ZUSATZ7"] = $replaces["MAT_EVENT_CUSTOM7"];
     $replaces["MAT_EVENT_ZUSATZ8"] = $replaces["MAT_EVENT_CUSTOM8"];
     $replaces["MAT_EVENT_ZUSATZ9"] = $replaces["MAT_EVENT_CUSTOM9"];
     $replaces["MAT_EVENT_ZUSATZ10HINT"] = $event->zusatz10hint;
     $replaces["MAT_EVENT_ZUSATZ11HINT"] = $event->zusatz11hint;
     $replaces["MAT_EVENT_ZUSATZ12HINT"] = $event->zusatz12hint;
     $replaces["MAT_EVENT_ZUSATZ13HINT"] = $event->zusatz13hint;
     $replaces["MAT_EVENT_ZUSATZ14HINT"] = $event->zusatz14hint;
     $replaces["MAT_EVENT_ZUSATZ15HINT"] = $event->zusatz15hint;
     $replaces["MAT_EVENT_ZUSATZ16HINT"] = $event->zusatz16hint;
     $replaces["MAT_EVENT_ZUSATZ17HINT"] = $event->zusatz17hint;
     $replaces["MAT_EVENT_ZUSATZ18HINT"] = $event->zusatz18hint;
     $replaces["MAT_EVENT_ZUSATZ19HINT"] = $event->zusatz19hint;
     $replaces["MAT_EVENT_ZUSATZ20HINT"] = $event->zusatz20hint;
     $replaces["MAT_EVENT_ZUSATZ1HINT"] = $event->zusatz1hint;
     $replaces["MAT_EVENT_ZUSATZ2HINT"] = $event->zusatz2hint;
     $replaces["MAT_EVENT_ZUSATZ3HINT"] = $event->zusatz3hint;
     $replaces["MAT_EVENT_ZUSATZ4HINT"] = $event->zusatz4hint;
     $replaces["MAT_EVENT_ZUSATZ5HINT"] = $event->zusatz5hint;
     $replaces["MAT_EVENT_ZUSATZ6HINT"] = $event->zusatz6hint;
     $replaces["MAT_EVENT_ZUSATZ7HINT"] = $event->zusatz7hint;
     $replaces["MAT_EVENT_ZUSATZ8HINT"] = $event->zusatz8hint;
     $replaces["MAT_EVENT_ZUSATZ9HINT"] = $event->zusatz9hint;
     /* ALIAS */
     $replaces["MAT_EVENT_CUSTOM10HINT"] = $event->zusatz10hint;
     $replaces["MAT_EVENT_CUSTOM11HINT"] = $event->zusatz11hint;
     $replaces["MAT_EVENT_CUSTOM12HINT"] = $event->zusatz12hint;
     $replaces["MAT_EVENT_CUSTOM13HINT"] = $event->zusatz13hint;
     $replaces["MAT_EVENT_CUSTOM14HINT"] = $event->zusatz14hint;
     $replaces["MAT_EVENT_CUSTOM15HINT"] = $event->zusatz15hint;
     $replaces["MAT_EVENT_CUSTOM16HINT"] = $event->zusatz16hint;
     $replaces["MAT_EVENT_CUSTOM17HINT"] = $event->zusatz17hint;
     $replaces["MAT_EVENT_CUSTOM18HINT"] = $event->zusatz18hint;
     $replaces["MAT_EVENT_CUSTOM19HINT"] = $event->zusatz19hint;
     $replaces["MAT_EVENT_CUSTOM20HINT"] = $event->zusatz20hint;
     $replaces["MAT_EVENT_CUSTOM1HINT"] = $event->zusatz1hint;
     $replaces["MAT_EVENT_CUSTOM2HINT"] = $event->zusatz2hint;
     $replaces["MAT_EVENT_CUSTOM3HINT"] = $event->zusatz3hint;
     $replaces["MAT_EVENT_CUSTOM4HINT"] = $event->zusatz4hint;
     $replaces["MAT_EVENT_CUSTOM5HINT"] = $event->zusatz5hint;
     $replaces["MAT_EVENT_CUSTOM6HINT"] = $event->zusatz6hint;
     $replaces["MAT_EVENT_CUSTOM7HINT"] = $event->zusatz7hint;
     $replaces["MAT_EVENT_CUSTOM8HINT"] = $event->zusatz8hint;
     $replaces["MAT_EVENT_CUSTOM9HINT"] = $event->zusatz9hint;
     $replaces["MAT_EVENT_CREATED_BY"] = $event->created_by;
     $replaces["MAT_EVENT_MODIFIED_BY"] = $event->modified_by;
     $replaces["MAT_EVENT_CREATED"] = JHTML::_('date', $event->created, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i'));
     $replaces["MAT_EVENT_WEBINAR"] = $event->webinar;
     if ($booking != null) {
         if (empty($booking->sid)) {
             $booking->sid = $booking->id;
         }
         // Booking data
         $replaces["MAT_BOOKING_ID"] = $booking->sid;
         $replaces["MAT_BOOKING_NUMBER"] = MatukioHelperUtilsBooking::getBookingId($booking->sid);
         $replaces["MAT_SIGN"] = "<span> </span>";
         $user = JFactory::getUser($booking->userid);
         $replaces["MAT_BOOKING_USERNAME"] = "";
         if ($booking->userid > 0) {
             $replaces["MAT_BOOKING_USERNAME"] = $user->username;
         }
         if (isset($booking->aname)) {
             $booking->aname = trim($booking->aname);
         }
         if (isset($booking->name)) {
             $booking->name = trim($booking->name);
         }
         // Old form
         if (isset($booking->aname) && !empty($booking->aname)) {
             $replaces["MAT_BOOKING_NAME"] = $booking->aname;
         } elseif (isset($booking->name) && !empty($booking->name)) {
             $replaces["MAT_BOOKING_NAME"] = $booking->name;
         }
         if (isset($booking->aemail) && !empty($booking->aemail)) {
             $replaces["MAT_BOOKING_EMAIL"] = $booking->aemail;
         } elseif (isset($booking->email) && !empty($booking->email)) {
             $replaces["MAT_BOOKING_EMAIL"] = $booking->email;
         }
         // Fix for empty E-Mail
         if (empty($replaces["MAT_BOOKING_EMAIL"])) {
             $replaces["MAT_BOOKING_EMAIL"] = $booking->email;
         }
         $replaces["MAT_BOOKING_SID"] = $booking->sid;
         $replaces["MAT_BOOKING_SEMID"] = $booking->semid;
         $replaces["MAT_BOOKING_USERID"] = $booking->userid;
         $replaces["MAT_BOOKING_CERTIFICATED"] = $booking->certificated;
         $replaces["MAT_EVENT_BOOKINGDATE"] = JHTML::_('date', $booking->bookingdate, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i'));
         $replaces["MAT_EVENT_UPDATED"] = JHTML::_('date', $booking->updated, MatukioHelperSettings::getSettings('date_format', 'd-m-Y, H:i'));
         $replaces["MAT_INVOICE_DATE"] = JHTML::_('date', $booking->bookingdate, MatukioHelperSettings::getSettings('date_format_without_time', 'd-m-Y'));
         if ($booking->payment_brutto > 0) {
             $replaces["MAT_INVOICE_NUMBER"] = MatukioHelperInvoice::getInvoiceNumber($booking->id, JHTML::_('date', $booking->bookingdate, 'Y'));
         } else {
             $replaces["MAT_INVOICE_NUMBER"] = "";
         }
         $replaces["MAT_BOOKING_PAID"] = MatukioHelperUtilsBooking::getBookingPaidName($booking->paid);
         $replaces["MAT_BOOKING_PAID_NUM"] = $booking->paid;
         $replaces["MAT_BOOKING_PAYMENT_STATUS"] = $booking->payment_status;
         $replaces["MAT_BOOKING_PAYMENT_PLUGIN_DATA"] = $booking->payment_plugin_data;
         $replaces["MAT_BOOKING_NRBOOKED"] = $booking->nrbooked;
         // Alias
         $replaces["MAT_BOOKING_BOOKEDNR"] = $booking->nrbooked;
         $replaces["MAT_BOOKING_ZUSATZ10"] = $booking->zusatz10;
         $replaces["MAT_BOOKING_ZUSATZ11"] = $booking->zusatz11;
         $replaces["MAT_BOOKING_ZUSATZ12"] = $booking->zusatz12;
         $replaces["MAT_BOOKING_ZUSATZ13"] = $booking->zusatz13;
         $replaces["MAT_BOOKING_ZUSATZ14"] = $booking->zusatz14;
         $replaces["MAT_BOOKING_ZUSATZ15"] = $booking->zusatz15;
         $replaces["MAT_BOOKING_ZUSATZ16"] = $booking->zusatz16;
         $replaces["MAT_BOOKING_ZUSATZ17"] = $booking->zusatz17;
         $replaces["MAT_BOOKING_ZUSATZ18"] = $booking->zusatz18;
         $replaces["MAT_BOOKING_ZUSATZ19"] = $booking->zusatz19;
         $replaces["MAT_BOOKING_ZUSATZ20"] = $booking->zusatz20;
         $replaces["MAT_BOOKING_ZUSATZ1"] = $booking->zusatz1;
         $replaces["MAT_BOOKING_ZUSATZ2"] = $booking->zusatz2;
         $replaces["MAT_BOOKING_ZUSATZ3"] = $booking->zusatz3;
         $replaces["MAT_BOOKING_ZUSATZ4"] = $booking->zusatz4;
         $replaces["MAT_BOOKING_ZUSATZ5"] = $booking->zusatz5;
         $replaces["MAT_BOOKING_ZUSATZ6"] = $booking->zusatz6;
         $replaces["MAT_BOOKING_ZUSATZ7"] = $booking->zusatz7;
         $replaces["MAT_BOOKING_ZUSATZ8"] = $booking->zusatz8;
         $replaces["MAT_BOOKING_ZUSATZ9"] = $booking->zusatz9;
         /* Alias */
         $replaces["MAT_BOOKING_CUSTOM10"] = $booking->zusatz10;
         $replaces["MAT_BOOKING_CUSTOM11"] = $booking->zusatz11;
         $replaces["MAT_BOOKING_CUSTOM12"] = $booking->zusatz12;
         $replaces["MAT_BOOKING_CUSTOM13"] = $booking->zusatz13;
         $replaces["MAT_BOOKING_CUSTOM14"] = $booking->zusatz14;
         $replaces["MAT_BOOKING_CUSTOM15"] = $booking->zusatz15;
         $replaces["MAT_BOOKING_CUSTOM16"] = $booking->zusatz16;
         $replaces["MAT_BOOKING_CUSTOM17"] = $booking->zusatz17;
         $replaces["MAT_BOOKING_CUSTOM18"] = $booking->zusatz18;
         $replaces["MAT_BOOKING_CUSTOM19"] = $booking->zusatz19;
         $replaces["MAT_BOOKING_CUSTOM20"] = $booking->zusatz20;
         $replaces["MAT_BOOKING_CUSTOM1"] = $booking->zusatz1;
         $replaces["MAT_BOOKING_CUSTOM2"] = $booking->zusatz2;
         $replaces["MAT_BOOKING_CUSTOM3"] = $booking->zusatz3;
         $replaces["MAT_BOOKING_CUSTOM4"] = $booking->zusatz4;
         $replaces["MAT_BOOKING_CUSTOM5"] = $booking->zusatz5;
         $replaces["MAT_BOOKING_CUSTOM6"] = $booking->zusatz6;
         $replaces["MAT_BOOKING_CUSTOM7"] = $booking->zusatz7;
         $replaces["MAT_BOOKING_CUSTOM8"] = $booking->zusatz8;
         $replaces["MAT_BOOKING_CUSTOM9"] = $booking->zusatz9;
         $replaces["MAT_BOOKING_UUID"] = $booking->uuid;
         if (!empty($booking->payment_method)) {
             $replaces["MAT_BOOKING_PAYMENT_METHOD"] = self::getPaymentMethodTitle($booking->payment_method);
         } else {
             $replaces["MAT_BOOKING_PAYMENT_METHOD"] = "";
         }
         $replaces["MAT_BOOKING_PAYMENT_METHOD_RAW"] = $booking->payment_method;
         $replaces["MAT_BOOKING_PAYMENT_NUMBER"] = $booking->payment_number;
         $replaces["MAT_BOOKING_PAYMENT_NETTO"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_netto, MatukioHelperSettings::_('currency_symbol', '$'));
         $replaces["MAT_BOOKING_PAYMENT_NET"] = $replaces["MAT_BOOKING_PAYMENT_NETTO"];
         $replaces["MAT_BOOKING_PAYMENT_TAX"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_tax, MatukioHelperSettings::_('currency_symbol', '$'));
         $replaces["MAT_BOOKING_PAYMENT_BRUTTO"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_brutto, MatukioHelperSettings::_('currency_symbol', '$'));
         $replaces["MAT_BOOKING_PAYMENT_GROSS"] = $replaces["MAT_BOOKING_PAYMENT_BRUTTO"];
         $replaces["MAT_BOOKING_COUPON_CODE"] = $booking->coupon_code;
         $replaces["MAT_BOOKING_STATUS"] = MatukioHelperUtilsBooking::getBookingStatusName($booking->status);
         /* Mark since 4.5 */
         $replaces["MAT_BOOKING_MARK"] = $booking->mark;
         /* QR Codes */
         $replaces["MAT_BOOKING_QRCODE_ID"] = MatukioHelperUtilsBooking::getBookingIdQRCode($booking->sid);
         $replaces["MAT_BOOKING_QRCODE"] = $replaces["MAT_BOOKING_QRCODE_ID"];
         $replaces["MAT_BOOKING_BARCODE"] = MatukioHelperUtilsBooking::getBookingIdBarcode($booking->sid);
         // Checkin URLs and QR-Codes since 4.5
         $checkinurl = JRoute::_("index.php?option=com_matukio&view=booking&task=checkin&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1);
         $replaces["MAT_BOOKING_CHECKIN_URL"] = $checkinurl;
         $replaces["MAT_BOOKING_CHECKIN_LINK"] = '<a href="' . $checkinurl . '">' . JText::_("COM_MATUKIO_CHECKIN_BOOKING") . "</a>";
         $replaces["MAT_BOOKING_CHECKIN_QRCODE"] = MatukioHelperUtilsBooking::getBookingCheckinQRCode($checkinurl, $booking->sid);
         if ($event->fees > 0) {
             $replaces["MAT_BOOKING_FEES_STATUS"] = MatukioHelperUtilsEvents::getFormatedCurrency($booking->payment_brutto, MatukioHelperSettings::_('currency_symbol', '$')) . " (" . MatukioHelperUtilsBooking::getBookingPaidName($booking->paid) . ")";
         } else {
             $replaces["MAT_BOOKING_FEES_STATUS"] = JText::_("COM_MATUKIO_FREE_EVENT");
         }
         // Booking detail page @since 4.1.1
         $replaces["MAT_BOOKING_DETAILPAGE_URL"] = JRoute::_("index.php?option=com_matukio&view=booking&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1);
         $replaces["MAT_BOOKING_DETAILPAGE"] = '<a href="' . JRoute::_("index.php?option=com_matukio&view=booking&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1) . '">' . JText::_("COM_MATUKIO_BOOKING_DETAILS") . "</a>";
         $editbookinglink = JRoute::_("index.php?option=com_matukio&view=bookevent&cid=" . $booking->semid . "&uuid=" . $booking->uuid . "&Itemid=" . $itemId, true, -1);
         if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 1) {
             $editbookinglink = JRoute::_(MatukioHelperRoute::getEventRoute($event->id, $event->catid, 1, $booking->id, $booking->uuid), true, -1);
         }
         $replaces["MAT_BOOKING_EDIT_URL"] = $editbookinglink;
         $replaces["MAT_BOOKING_EDIT"] = '<a href="' . $editbookinglink . '">' . JText::_("COM_MATUKIO_EDIT_YOUR_BOOKING") . "</a>";
         // TODO Different fees
     }
     // Event info complete no booking here
     $replaces["MAT_EVENT_ALL_DETAILS_HTML"] = self::getEmailEventInfoHTML($event);
     $replaces["MAT_EVENT_ALL_DETAILS_TEXT"] = self::getEmailEventInfoTEXT($event);
     /* Other things */
     $replaces["MAT_BANK_TRANSFER_INFORMATIONS"] = MatukioHelperPayment::getBanktransferInfo(MatukioHelperSettings::getSettings("banktransfer_account", ''), MatukioHelperSettings::getSettings("banktransfer_blz", ''), MatukioHelperSettings::getSettings("banktransfer_bank", ''), MatukioHelperSettings::getSettings("banktransfer_accountholder", ''), MatukioHelperSettings::getSettings("banktransfer_iban", ''), MatukioHelperSettings::getSettings("banktransfer_bic", ''));
     // CSV
     $bookingnewname = "";
     if ($booking != null) {
         $replaces["MAT_CSV_BOOKING_DETAILS"] = self::getExportCSVBookingDetails($booking, $event, MatukioHelperSettings::getSettings('export_csv_separator', ';'));
         if (MatukioHelperSettings::getSettings('oldbookingform', 0) == 1) {
             // Old booking form
             if ($booking->userid > 0) {
                 $user = JFactory::getUser($booking->userid);
                 $replaces["MAT_BOOKING_NAME"] = $user->name;
                 $replaces["MAT_BOOKING_EMAIL"] = $user->email;
             }
         } else {
             // New booking form fields
             $fields = MatukioHelperUtilsBooking::getBookingFields();
             $fieldvals = explode(";", $booking->newfields);
             $value = array();
             foreach ($fieldvals as $val) {
                 $tmp = explode("::", $val);
                 if (count($tmp) > 1) {
                     $value[$tmp[0]] = $tmp[1];
                 } else {
                     $value[$tmp[0]] = "";
                 }
             }
             foreach ($fields as $field) {
                 if (!empty($value[$field->id])) {
                     // Not use the Spacer fields
                     if ($field->type != "spacer" && $field->type != "spacertext") {
                         $replaces["MAT_BOOKING_" . strtoupper($field->field_name)] = $value[$field->id];
                     }
                     if ($field->field_name == "firstname") {
                         $bookingnewname .= $value[$field->id];
                     }
                     if ($field->field_name == "lastname") {
                         $bookingnewname .= " " . $value[$field->id];
                     }
                 } else {
                     // Not use the Spacer fields
                     if ($field->type != "spacer" && $field->type != "spacertext") {
                         $replaces["MAT_BOOKING_" . strtoupper($field->field_name)] = "";
                     }
                 }
             }
             $bookingnewname = trim($bookingnewname);
             $replaces["MAT_BOOKING_COMMENT"] = $booking->comment;
             if (empty($replaces["MAT_BOOKING_NAME"])) {
                 if (!empty($bookingnewname)) {
                     $replaces["MAT_BOOKING_NAME"] = $bookingnewname;
                 } else {
                     if ($booking->userid > 0) {
                         $user = JFactory::getUser($booking->userid);
                         $replaces["MAT_BOOKING_NAME"] = $user->name;
                     }
                 }
             }
         }
         if (empty($replaces["MAT_BOOKING_EMAIL"])) {
             if ($booking->userid > 0) {
                 $user = JFactory::getUser($booking->userid);
                 $replaces["MAT_BOOKING_EMAIL"] = $user->email;
             }
         }
         // Booking complete
         $replaces["MAT_BOOKING_ALL_DETAILS_HTML"] = self::getEmailBookingInfoHTML($event, $booking, $bookingnewname);
         $replaces["MAT_BOOKING_ALL_DETAILS_TEXT"] = self::getEmailBookingInfoTEXT($event, $booking, $bookingnewname);
     }
     return $replaces;
 }