From 48988e57fc34e5970618e4f970f915d6781d3e82 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Oct 2025 15:22:12 +0200 Subject: [PATCH] Bug 32176: [25.05.x] Rebase for 25.05 Rebased the applicable patches for 25.05.x: - Remove duplicated code to select patron from autocomplete - Use patron_to_html - Fix list transfer Skipped patches which targeted files deleted in 25.05.x: - Fix punctuation in patron search - Add Cypress tests --- .../prog/css/src/staff-global.scss | 4 ++ .../prog/en/modules/acqui/duplicate_orders.tt | 29 ++--------- .../prog/en/modules/acqui/histsearch.tt | 23 +-------- .../prog/en/modules/course_reserves/course.tt | 49 +++---------------- .../prog/en/modules/patron_lists/list.tt | 21 ++------ .../prog/en/modules/virtualshelves/shelves.tt | 36 ++++++++------ .../intranet-tmpl/prog/js/staff-global.js | 29 ++++++++++- patron_lists/list.pl | 2 +- 8 files changed, 70 insertions(+), 123 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 03bab18deb1..25b3e996972 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -2863,6 +2863,10 @@ td.bundle { background: #FFF url( "../img/spinner-small.gif" ) right center no-repeat; } +.patron-detail-autocomplete-selection { + padding: 0.3em; +} + .toptabs { margin: 1rem 0; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt index c2aa5452452..c660a925bb2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/duplicate_orders.tt @@ -323,7 +323,6 @@ $("input[name='ordernumbers']").val(ordernumbers.join(',')); } - var MSG_REMOVE_PATRON = _("Remove"); var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); var MSG_NO_FUND_SELECTED = _("No fund selected."); $(document).ready(function() { @@ -333,34 +332,16 @@ }); [% IF op == 'search' OR op == 'select' %] - function AddPatron( patron_name, value, container, input_name ) { - div = "
" + patron_name + " ( " + MSG_REMOVE_PATRON + " )
"; - $(container).append( div ); - - $(container).parent().show( 800 ); - } - function RemovePatron( cardnumber, container ) { - $( '#borrower_' + cardnumber ).remove(); - - if ( ! $(container).html() ) { - $(container).parent("fieldset").hide( 800 ); - } - } patron_autocomplete($("#find_patron"), { - 'on-select-callback': function( event, ui ) { - var field = ui.item.patron_id; - AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#basket_creators"), 'created_by' ); + "on-select-add-to": { + container: $("#basket_creators"), + input_name: 'created_by' + }, + "on-select-callback": function( event, ui ) { $("#find_patron").val('').focus(); return false; } }); - $("body").on("click",".removePatron",function(e){ - e.preventDefault(); - var divid = $(this).parent().attr("id"); - var cardnumber = divid.replace("borrower_",""); - RemovePatron(cardnumber, $("#basket_creators")); - }); - [% END %] $("#show_orders_filters, #hide_orders_filters").on('click', function(e) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt index 59a838856be..5f6656c9cdd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt @@ -168,7 +168,6 @@ [% INCLUDE 'calendar.inc' %] [% INCLUDE 'datatables.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt index d61e2d08c73..ac3202e5cf3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt @@ -19,9 +19,6 @@ #course_instructors { float: left; } - .instructor_line { - padding: 0.3em; - } fieldset.rows label[for="find_instructor"] { text-align: left; margin: 0; @@ -131,13 +128,13 @@
[% FOREACH i IN instructors %] -
[% i.surname | html %], [% i.firstname | html %] ( Remove ) +
+ [% INCLUDE 'patron-title.inc' patron=i no_cardnumber=1 %] ( Remove )
[% END %]
-