Bugzilla – Attachment 188662 Details for
Bug 41119
Autocompletion of basket creator does not work in acquisition-home.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41119: Refacto histsearch js to use it in acqui-home.tt
Bug-41119-Refacto-histsearch-js-to-use-it-in-acqui.patch (text/plain), 6.17 KB, created by
Baptiste Wojtkowski (bwoj)
on 2025-10-30 15:24:27 UTC
(
hide
)
Description:
Bug 41119: Refacto histsearch js to use it in acqui-home.tt
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2025-10-30 15:24:27 UTC
Size:
6.17 KB
patch
obsolete
>From 5d3f4c495f17dd25692772b6952de814571a0002 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Thu, 30 Oct 2025 15:18:55 +0000 >Subject: [PATCH] Bug 41119: Refacto histsearch js to use it in acqui-home.tt > >TEST PLAN: >DO NOT APPLY PATCH BEFORE TESTING >1 - Go to histsearch.pl, type "ko" in "Basket created by" -> autocompletion starts >2 - Go to acqui-home.pl, type "ko" in "Basket created by" -> autocompletion is ko >3 - Apply patch >4 - Go to histsearch.pl, type "ko" in "Basket created by" -> autocompletion starts >5 - Go to acqui-home.pl, type "ko" in "Basket created by" -> autocompletion starts >--- > .../prog/en/includes/acq-histsearch_js.inc | 46 +++++++++++++++++++ > .../prog/en/modules/acqui/acqui-home.tt | 1 + > .../prog/en/modules/acqui/histsearch.tt | 45 +----------------- > 3 files changed, 48 insertions(+), 44 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/acq-histsearch_js.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acq-histsearch_js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acq-histsearch_js.inc >new file mode 100644 >index 00000000000..3eb6074dc25 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acq-histsearch_js.inc >@@ -0,0 +1,46 @@ >+[% USE raw %] >+[% Asset.js("js/acquisitions-menu.js") | $raw %] >+[% INCLUDE 'calendar.inc' %] >+[% INCLUDE 'datatables.inc' %] >+<script> >+ var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'histsearch', 'histsearcht', 'json' ) | $raw %]; >+ var MSG_REMOVE_PATRON = _("Remove"); >+ $(document).ready(function() { >+ var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'histsearch', 'histsearcht', 'json' ) | $raw %]; >+ $("#histsearcht").kohaTable( >+ { >+ pagingType: "full", >+ }, >+ table_settings >+ ); >+ >+ function AddPatron( patron_name, value, container, input_name ) { >+ div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash-can' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>"; >+ $(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' ); >+ $("#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")); >+ }); >+ >+ }); >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >index 1951395a132..5fc66264b69 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt >@@ -283,6 +283,7 @@ > > }); > </script> >+ [% INCLUDE 'acq-histsearch_js.inc' %] > [% END %] > [% END %] > [% INCLUDE 'intranet-bottom.inc' %] >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..f9f7715fb07 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >@@ -164,50 +164,7 @@ > <!-- /.main.container-fluid --> > > [% MACRO jsinclude BLOCK %] >- [% Asset.js("js/acquisitions-menu.js") | $raw %] >- [% INCLUDE 'calendar.inc' %] >- [% INCLUDE 'datatables.inc' %] >- <script> >- var MSG_REMOVE_PATRON = _("Remove"); >- $(document).ready(function() { >- var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'histsearch', 'histsearcht', 'json' ) | $raw %]; >- $("#histsearcht").kohaTable( >- { >- pagingType: "full", >- }, >- table_settings >- ); >- >- function AddPatron( patron_name, value, container, input_name ) { >- div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash-can' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>"; >- $(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' ); >- $("#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")); >- }); >- >- }); >- </script> >+ [% INCLUDE 'acq-histsearch_js.inc' %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >-- >2.43.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41119
:
188662
|
188920
|
188921
|
188927
|
188931