Hi,
I'm trying to add a custom field, but I just can't add it the way I would like.
I need that when someone is making a reservation, a check field shows a few checkboxes, like checkbox 1, checkbox 2 and so on. if one of those checkboxes are thicked then a e-mail is sent to the e-mail that is associated to it.
I've tried with this:
I added a DB field named facilities to the tables entry, repeat and room, type text.
added in the file config.inc.php the code:
$select_options['entry.facilities'] = array('' => 'Nada', 'it@centimfe.com' => 'Videoprojetor', 'it@centimfe.com' => 'PC Portatil', 'food@centimfe.com' => 'Catering');
I only have a text box and the word facilities, nothing else happens, so I didn't get to the part of sending e-mail to the it or food department...
Any help will be great.
Thank you.
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
UPDATE
changed to type char in DB adn also update the code in config.inc.php to:$select_options['entry.facilities'] = array('0' => 'Nada', '1' => 'Projetor', '2' => 'PC Portatil', '3' => 'PC + Projetor', '4' => 'Catering');
now I get a dropbox wich also fits my goal... but the field in the DB always show P or C no matter what I chose.
Last edit: Anonymous 2017-10-24
You might be better off indexing the array by 'a', 'b', 'c', 'd', instead of '0', '1', '2', '3'. It'll ensure that PHP and MRBS treat this as an associative array.
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
UPDATE 2
solved the DB... now how do I get a email sent to the right department acording to the facilities choices???
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
How do I associate 'a' to it@domain.com, 'b' to the food@domain.com and so on?
At its simplest you create an array (say in the config file) looking something like this:
Then in functions_mail.inc you look up the address and add it to the list of people that get sent an email.
Last edit: Campbell Morrison 2017-10-24
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Since I'm not a coder I need a little help on this :)
I have in config.inc.php
$select_options['entry.facilities'] = array('a' => 'Nada', 'b' => 'Projetor', 'c' => 'PC Portatil', 'd' => 'PC e Projetor');
$select_options['entry.catering'] = array('a' => 'Nada', 'b' => 'Café', 'c' => 'Águas', 'd' => 'Lanche');
$email_addresses = array( 'a' => 'it@domain.com', 'b' => 'food@domain.com')
so I need some code in functions_mail.inc that works this out:
check if entry.facilities is b, c or d then returns email_addresses a and send mail when booking is done.
check if entry.catering is b, c or d then returns email_addresses b and send mail when booking is done.
Can you spare a few more minutes with this?
Thank you.
Paulo R
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
in functions_mail.inc where is the function that sends email on new/edit bookings? where is the start line?
maybe it's possible to insert this piece of code in there (probably with a ton of errors, since I'm not a coder, but I will get this working... :)
if $select_options['entry.facilities'] !== 'Nada' then $address == $email_addresses[a]';
if $select_options['entry.catering'] !== 'Nada' then $address == $email_addresses[b]';
share a little light on my path plz.
thank you.
Paulo R
Assuming you are using MRBS 1.6.1 then you need to insert the following lines in the function create_addresses() in functions_mail.inc at line 763:
This assumes that your $email_addresses array in the config file loooks like this:
$email_addresses = array( 'facilities' => 'it@domain.com', 'catering' => 'food@domain.com')
(I changed the key from 'a' to 'facilities' etc. so as not to confuse the keys with the $select_options keys.)
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
No... not working... at first it seems to work because the room admin mail I use is the same as catering.
But the IT mail never gets the email.
And yes I'm using MRBS 1.6.1
Thanks
PR
Last edit: Anonymous 2017-10-27
Sorry, if you edit a post a new notification doesn't get sent, so all I saw was the original "Works like a charm. Thank you."!
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Any help here plz.
You could try turning on mail debugging to see what is happening:
Also try adding the following (temporarily) to the bottom of internalconfig.inc.php:
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
Hi,
problem solved... Thank you.
just put the code 3 or 4 lines down... It was before the $to and it should be below those lines