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 <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2019-06-07 14:53:16 +00:00 committed by Martin Renvoize
parent 3de89b98ce
commit 07d6e9f142
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -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) {