meeting-room-booking-system / mrbs-code

MRBS application code
Other
127 stars 62 forks source link

$vocab_override sometimes don't work #1576

Open jberanek opened 8 years ago

jberanek commented 8 years ago

Hello,

in my config file I use several $vocab_override but some are not working:

$select_options['entry.name'] = array( '' => 'Please select one', 'ad' => 'Reservation', 'bg' => 'Club Hire' ); $is_mandatory_field['entry.name'] = TRUE; $vocab_override["en"]["type.ad"] = "Reservation"; $vocab_override["en"]["type.bg"] = "Club Hire";

but this works:

$select_options['entry.payment'] = array( '' => 'Please select the payment', 'ab' => 'Cash in shop', 'bc' => 'Bank transfer', 'cd' => 'Credit card in shop', 'de' => 'Credit card on phone' ); $is_mandatory_field['entry.payment'] = TRUE; $vocab_override["en"]["type.ab"] = "Cash in shop"; $vocab_override["en"]["type.bc"] = "Bank transfer"; $vocab_override["en"]["type.cd"] = "Credit card in shop"; $vocab_override["en"]["type.de"] = "Credit card on phone";

Has somebody an idea why?

Reported by: sundalf

Original Ticket: mrbs/support-requests/852

jberanek commented 8 years ago

I don't think either of them should work. I'm afraid there isn't multiple language support at the moment for the strings in the select drop-down. $vocab_override["en"]["type.ab"] will just change the language string for the type with value 'ab' - but types are only one character long so it doesn't make sense anyway.

Original comment by: campbell-m

jberanek commented 8 years ago

Hi. I changed it to ...

$select_options['entry.name'] = array( '' => 'Please select one', 'Y' => 'Reservation', 'Z' => 'Club Hire' ); $is_mandatory_field['entry.name'] = TRUE; $vocab_override["en"]["type.Y"] = "Reservation"; $vocab_override["en"]["type.Z"] = "Club Hire";

... and it also do not work. The output is Y instead of Reservation :-(

Original comment by: sundalf

jberanek commented 8 years ago

The $vocab_overrides won't work with select options - except those for the "Type" field.

I have just tried

$select_options['entry.name'] = array(
'' => 'Please select one',
'Y' => 'Reservation',
'Z' => 'Club Hire'
);
$is_mandatory_field['entry.name'] = TRUE;

on my system and it works OK.

Original comment by: campbell-m

jberanek commented 8 years ago

I deleted my code and pasted yours. I also deleted the $vocab_overrides. The output is Y

Original comment by: sundalf

jberanek commented 8 years ago

This is for the first field on the booking form?

Original comment by: campbell-m

jberanek commented 8 years ago

Yes, all (4) others work perfectly

Original comment by: sundalf

jberanek commented 8 years ago

Have you got something else later in the config file which would override this?

Original comment by: campbell-m

jberanek commented 8 years ago

This is the last part of the config file:

/**

//$booking_types[] = "E"; //$booking_types[] = "I"; $booking_types[] = "C"; $booking_types[] = "D"; $vocab_override["en"]["type.C"] = "Altea"; $vocab_override["en"]["type.D"] = "Teulada";

$select_options['entry.payment'] = array( '' => 'Please select the payment', 'E' => 'Cash in shop', 'F' => 'Bank transfer', 'G' => 'Credit card in shop', 'H' => 'Credit card on phone' ); $is_mandatory_field['entry.payment'] = TRUE;

$select_options['entry.rentals'] = array( '' => 'Please select the rentals', 'I' => 'None', 'J' => 'Buggy', 'K' => 'Trolley' ); $is_mandatory_field['entry.rentals'] = TRUE;

$select_options['entry.participants_no'] = array( '' => 'Please select a number', 'a' => '1', 'b' => '2', 'c' => '3', 'd' => '4', 'e' => '5', 'f' => '6', 'g' => '7', 'h' => '8', 'i' => '9', 'j' => '10', 'k' => '11', 'l' => '12', 'm' => '13', 'n' => '14', 'o' => '15', 'p' => '16', 'q' => '17', 'r' => '18', 's' => '19', 't' => '20', 'u' => '21', 'v' => '22', 'w' => '23', 'x' => '24', 'y' => '25', 'z' => '26', 'W' => '27', 'X' => '28', 'Y' => '29', 'Z' => '30' ); $is_mandatory_field['entry.participants_no'] = TRUE;

$is_mandatory_field['entry.customer_name'] = TRUE; $is_mandatory_field['entry.customer_phone'] = TRUE; $is_mandatory_field['entry.fee'] = TRUE;

Original comment by: sundalf

jberanek commented 8 years ago

Mmmm. I don't understand how you are getting 'Y' at all. What does the rest of your config file look like (leaving out confidential stuff like database settings, email addresses and urls)?

Original comment by: campbell-m

jberanek commented 8 years ago

Ohh, sorry, changed it from Y to A... Now the output is A

The complete config without database stuff:

<?php

// $Id$

/**

/**

/***

/***

/***

/**

// [These are all variables that control the appearance of pages and could in time // become per-user settings]

// Start of week: 0 for Sunday, 1 for Monday, etc. $weekstarts = 1;

// Page refresh time (in seconds). Set to 0 to disable $refresh_rate = 30;

// To display week numbers in the mini-calendars, set this to true. The week // numbers are only accurate if you set $weekstarts to 1, i.e. set the // start of the week to Monday $mincals_week_numbers = TRUE;

// To display the row labels (times, rooms or days) on the right hand side as well as the // left hand side in the day and week views, set to TRUE; // (was called $times_right_side in earlier versions of MRBS) $row_labels_both_sides = TRUE;

// Days of the week that are working days (Sunday = 0, etc.) $working_days = array(0,1,2,3,4,5,6); // Mon-Fri

// Resolution - what blocks can be booked, in seconds. // Default is half an hour: 1800 seconds. $resolution = (1 * 60); // DEFAULT VALUE FOR NEW AREAS

// If the following variable is set to TRUE, the resolution of bookings // is forced to be the value of $resolution, rather than the resolution set // for the area in the database. $force_resolution = TRUE;

// Default duration - default length (in seconds) of a booking. // Defaults to (60 60) seconds, i.e. an hour $default_duration = (5 60); // DEFAULT VALUE FOR NEW AREAS // Whether the "All Day" checkbox should be checked by default. (Note // that even if this is set to true, $default_duration should still // be set as that is the duration that will be used when the All Day // checkbox is unchecked) $default_duration_all_day = FALSE; // DEFAULT VALUE FOR NEW AREAS

// To display the column headers (times, rooms or days) on the bottom of the table as // well as the top in the day and week views, set to TRUE; $column_labels_both_ends = TRUE;

// Define default starting view (month, week or day) // Default is day $default_view = "month";

/**

//$booking_types[] = "E"; //$booking_types[] = "I"; $booking_types[] = "C"; $booking_types[] = "D"; $vocab_override["en"]["type.C"] = "Altea"; $vocab_override["en"]["type.D"] = "Teulada";

$select_options['entry.payment'] = array( '' => 'Please select the payment', 'E' => 'Cash in shop', 'F' => 'Bank transfer', 'G' => 'Credit card in shop', 'H' => 'Credit card on phone' ); $is_mandatory_field['entry.payment'] = TRUE;

$select_options['entry.rentals'] = array( '' => 'Please select the rentals', 'I' => 'None', 'J' => 'Buggy', 'K' => 'Trolley' ); $is_mandatory_field['entry.rentals'] = TRUE;

$select_options['entry.participants_no'] = array( '' => 'Please select a number', 'a' => '1', 'b' => '2', 'c' => '3', 'd' => '4', 'e' => '5', 'f' => '6', 'g' => '7', 'h' => '8', 'i' => '9', 'j' => '10', 'k' => '11', 'l' => '12', 'm' => '13', 'n' => '14', 'o' => '15', 'p' => '16', 'q' => '17', 'r' => '18', 's' => '19', 't' => '20', 'u' => '21', 'v' => '22', 'w' => '23', 'x' => '24', 'y' => '25', 'z' => '26', 'W' => '27', 'X' => '28', 'Y' => '29', 'Z' => '30' ); $is_mandatory_field['entry.participants_no'] = TRUE;

$is_mandatory_field['entry.customer_name'] = TRUE; $is_mandatory_field['entry.customer_phone'] = TRUE; $is_mandatory_field['entry.fee'] = TRUE;

Original comment by: sundalf

jberanek commented 8 years ago

Ah, OK, I see what you mean. You get 'Y' or 'A' after you've saved the booking. I was looking on the booking form. That looks like a bug - I'll take a look.

Original comment by: campbell-m

jberanek commented 8 years ago

Yes, in the view and calendar. Sorry for the misunderstanding. Thanks for your help!!!

Original comment by: sundalf

jberanek commented 8 years ago

Mmmm. It's not a trivial change. I'll have to have a look sometime in the next few days. In the meantime my suggestion is

either to use the 'name' field for something else, and have the Reservation/Club Hire info in another field,

or to use the simple form

$select_options['entry.name'] = array('', 'Reservation', 'Club Hire');

Original comment by: campbell-m

jberanek commented 8 years ago

I took the second suggestion and this works.

I wish you ahealthy start into the New Year!!!

Original comment by: sundalf