From 3161c24e8ee2b88670e0541f54b2979a6befa259 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 7 Jun 2019 14:53:16 +0000 Subject: [PATCH] Bug 14794: Display JS tooltip whenever dateofbirth is being searched This updates the code that adds a tooltip for the correct date format to display after the initial search To test: 1 - Do a patron search, choosing date of birth as the search field 2 - Note on choosing that field you get a tooltip defining the format 3 - Do a search 4 - Note tooltip is gone, but date fo birth is still selected as the field to search 5 - Apply patch, reload 6 - Note tooltip shows after initial search and until field is changed Signed-off-by: Maryse Simard Signed-off-by: Katrin Fischer --- koha-tmpl/intranet-tmpl/prog/js/members-menu.js | 36 ++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js index 235467dd1c..ad39b990cb 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js @@ -15,22 +15,10 @@ $(document).ready(function(){ } else { $("#filteraction_off").toggle(); } + + searchfield_date_tooltip(); $("#searchfieldstype").change(function() { - var MSG_DATE_FORMAT = ""; - if ( $(this).val() == 'dateofbirth' ) { - if( dateformat == 'us' ){ - MSG_DATE_FORMAT = MSG_DATE_FORMAT_US; - } else if( dateformat == 'iso' ){ - MSG_DATE_FORMAT = MSG_DATE_FORMAT_ISO; - } else if( dateformat == 'metric' ){ - MSG_DATE_FORMAT = MSG_DATE_FORMAT_METRIC; - } else if( dateformat == 'dmydot' ){ - MSG_DATE_FORMAT = MSG_DATE_FORMAT_DMYDOT; - } - $('#searchmember').attr("title", MSG_DATE_FORMAT).tooltip('show'); - } else { - $('#searchmember').tooltip('destroy'); - } + searchfield_date_tooltip(); }); if( CAN_user_borrowers_edit_borrowers ){ @@ -104,6 +92,24 @@ $(document).ready(function(){ }); }); +function searchfield_date_tooltip() { + var MSG_DATE_FORMAT = ""; + if ( $("#searchfieldstype").val() == 'dateofbirth' ) { + if( dateformat == 'us' ){ + MSG_DATE_FORMAT = MSG_DATE_FORMAT_US; + } else if( dateformat == 'iso' ){ + MSG_DATE_FORMAT = MSG_DATE_FORMAT_ISO; + } else if( dateformat == 'metric' ){ + MSG_DATE_FORMAT = MSG_DATE_FORMAT_METRIC; + } else if( dateformat == 'dmydot' ){ + MSG_DATE_FORMAT = MSG_DATE_FORMAT_DMYDOT; + } + $('#searchmember').attr("title", MSG_DATE_FORMAT).tooltip('show'); + } else { + $('#searchmember').tooltip('destroy'); + } +} + function confirm_updatechild() { var is_confirmed = window.confirm( MSG_CONFIRM_UPDATE_CHILD ); if (is_confirmed) { -- 2.11.0