From 085d1b6d228a08bbbb03b53580ace6b7617dca79 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 22 Dec 2014 00:46:47 -0500 Subject: [PATCH] Multiselect is already working --- admin/admin_submit_ticket.php | 10 ++++++++++ language/en/text.php | 1 + 2 files changed, 11 insertions(+) diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php index 8b229636..60cc2ff8 100644 --- a/admin/admin_submit_ticket.php +++ b/admin/admin_submit_ticket.php @@ -92,6 +92,16 @@ foreach ($hesk_settings['custom_fields'] as $k=>$v) { if ($v['use'] && isset($_POST[$k])) { + // Dates must be in YYYY-MM-DD format. Thanks to + // http://stackoverflow.com/questions/19773418/regex-to-validate-date-in-php-using-format-as-yyyy-mm-dd for the regex! + if( $v['type'] == 'date' && $_POST[$k] != '') + { + if (!preg_match('^(19|20)\d\d[\-\/.](0[1-9]|1[012])[\-\/.](0[1-9]|[12][0-9]|3[01])$', $_POST[$k]) || strtotime($_POST[$k]) < 0) + $hesk_error_buffer[$k]=$hesklang['invalid_date_format']; + } else { + $tmpvar[$k] = hesk_dateToString($_POST[$k]); + } + if (is_array($_POST[$k])) { $tmpvar[$k]=''; diff --git a/language/en/text.php b/language/en/text.php index 9d281c77..cb6e6414 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -26,6 +26,7 @@ $hesklang['date_custom_field'] = 'Date'; $hesklang['date_custom_field_text'] = 'No options for this custom field type.'; $hesklang['multiple_select_custom_field'] = 'Multiple Select box'; $hesklang['multiple_select_custom_field_text'] = 'Options for this multi-select box, enter one option per line (each line will be a choice your customers can choose from). You need to enter at least two options!'; +$hesklang['invalid_date_format'] = 'Date must be in YYYY-MM-DD format.'; // ADDED OR MODIFIED IN Mods For HESK 1.6.0 $hesklang['ticket_closed'] = '[#%%TRACK_ID%%] Ticket closed/resolved';