How to add a unique number in the mails beeing sent?
Brought to you by:
jberanek
Hi
MRBS version: 1.7.1
For the subject of the mails that are beeing sent, if an event is created i need to add a unique number at the begining. I.e.
[Buchung-432453] ....
This number should be unique for each booking.
Is there a possibility for this and if so, how? :)
Best,
Thomas
The booking id will be unique, although you need to remember that there are ids for individual entries and ids for series, so you will need to do something like prefix a series id with 'S'. You will need to modify the function notifyAdminOnBooking() in functions_mail.inc.
Hi
Does somebody have a clue?
Best,
Thomas
Last edit: Campbell Morrison 2019-09-30
If you are using 1.7.1 then add at line 924 of functions_mail.inc the following
Last edit: Campbell Morrison 2019-09-30
Hi
We are using v1.7.3 (my bad) and it doesn't work. I added the code exactly as you wrote.
I always get the subject like:
Buchung E Fahrt nach Berlin
So the id is empty, what am i doing wrong?
Sorry, my fault, it should be
Last edit: Campbell Morrison 2019-10-04
There was a typo in the line above (the " in the end should not be there). The line i use now is:
$subject = '[Fahrauftrag ' . (($series) ? 'S' : 'E') . $data['id'] . "] " . $subject;
Example:
[Buchung E3] Neuer Eintrag für MRBS.
However i have the issue that when i modify the event, the id increments:
[Fahrauftrag E4] Eintrag für MRBS geändert
This should not be the case. How can i fix this?
Best,
Thomas
I have now edited out the typo.
The id changes because when you edit a booking MRBS creates a new one and deletes the old one. It's a bit of a philosophical question though: when does an edit become an entirely new booking? If you just change one letter in the full description, probably not. If you change the time, date, length, description, type, etc. then it probably is a new booking.
If you want to keep a unique id for bookings even after editing them, then you'll need to do a bit more. You'll need to add a custom field to hold your unique id and make sure that is not writable. Then when a booking is first created you'll need to fill it with a unique id.