From 75ab9ff8f8b203203eb03a4d9bd69ede7fcb6fcc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 28 Jul 2021 12:04:43 +0200 Subject: [PATCH] Bug 28773: (bug 23302 follow-up) Fix add order from z3950 search results For translated interface. Using 'Order' (the button text) was not a good idea as the interface can be translated :) Signed-off-by: Mark Hofstetter Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../prog/en/modules/acqui/z3950_search.tt | 6 +++--- .../intranet-tmpl/prog/js/z3950_search.js | 20 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt index 4637803dea..561895d5fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt @@ -184,9 +184,9 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : diff --git a/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js b/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js index 10b4149fa0..1e34fd0945 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js +++ b/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js @@ -126,9 +126,9 @@ $( document ).ready( function() { $( "#resultst" ).on("click", ".chosen", function(e) { e.preventDefault(); - var title = $(this).attr('title'); - ChangeLastAction( title, 0 ); - if( title == 'Order' ) window.location = $(this).attr('href'); + var action = $(this).data('action'); + ChangeLastAction( action, 0 ); + if( action == 'order' ) window.location = $(this).attr('href'); else { opener.document.location = $(this).attr('href'); window.close(); @@ -140,15 +140,17 @@ function InitLastAction() { if( $("#resultst").length == 0 ) return; try { last_action = localStorage.getItem('z3950search_last_action'); } catch (err) {} if( last_action ) { - var linkcount = $(".z3950actions:eq(0)").siblings(".dropdown-menu").find("a[title='"+last_action+"']").length; - if( linkcount == 0 ) return; - if( last_action != 'MARC' ) $( ".z3950actions" ).text( last_action ); + var z3950_action_li = $(".z3950actions:eq(0)").siblings(".dropdown-menu").find("a[data-action='"+last_action+"']"); + if( z3950_action_li.length == 0 ) return; + if( last_action != 'show_marc' ) { + $( ".z3950actions" ).text($(z3950_action_li).text()).data('action', last_action); + } } } -function ChangeLastAction(title, change_text) { - if( last_action && last_action == title ) return; - last_action = title; +function ChangeLastAction(action, change_text) { + if( last_action && last_action == action ) return; + last_action = action; if( change_text ) $( ".z3950actions" ).text( last_action ); if( previewed == 0 || change_text == 1 ) try { localStorage.setItem('z3950search_last_action', last_action); } catch(err) {} -- 2.39.5