From 9e64d17adbb8682ed523f786ea1bb475b1634fea Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 5 Jan 2024 14:50:38 +0100 Subject: [PATCH] Bug 35329: Move patron search to modal - routing list The behaviour is a bit different here. Adding a patron from the popup refreshed the parent page with the newly added patron. With this patch the refresh of the page will happen when the modal is closed (if patrons have been added). Test plan: Create a subscription, receive one item, create a routing list. Add users. Signed-off-by: Owen Leonard --- .../prog/en/modules/serials/routing.tt | 60 ++++++++++++++----- serials/routing.pl | 8 ++- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt index e74b373f74..66d9c6f6e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt @@ -1,6 +1,8 @@ [% USE raw %] [% USE KohaDates %] [% SET footerjs = 1 %] +[% PROCESS 'i18n.inc' %] +[% PROCESS 'patron-search.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( op ) %]Create routing list[% ELSE %]Edit routing list[% END %] › [% title | html %] › Serials › Koha [% INCLUDE 'doc-head-close.inc' %] @@ -87,9 +89,10 @@ [% END %] [% END %] +

- Add recipients + Add recipients [% IF memberloop %] Delete all [% END %] @@ -115,10 +118,6 @@ [% MACRO jsinclude BLOCK %] + + [% INCLUDE 'select2.inc' %] + [% SET columns = ['cardnumber','name','category','branch','action'] %] + [% PROCESS patron_search_modal columns => columns, modal_title => t("Add recipients") %] + [% PROCESS patron_search_js columns => columns, actions => ["add"], preview_on_name_click => 1 %] + + [% END %] diff --git a/serials/routing.pl b/serials/routing.pl index 2e3122d3b5..167184924e 100755 --- a/serials/routing.pl +++ b/serials/routing.pl @@ -41,7 +41,7 @@ my $query = CGI->new; my $subscriptionid = $query->param('subscriptionid'); my $serialseq = $query->param('serialseq'); my $routingid = $query->param('routingid'); -my $borrowernumber = $query->param('borrowernumber'); +my $borrowernumbers = $query->param('borrowernumbers'); my $notes = $query->param('notes'); my $op = $query->param('op') || q{}; my $date_selected = $query->param('date_selected'); @@ -66,8 +66,10 @@ if($op eq 'delete'){ delroutingmember($routingid,$subscriptionid); } -if($op eq 'add'){ - addroutingmember($borrowernumber,$subscriptionid); +if ( $op eq 'add_new_recipients' ) { + for my $borrowernumber ( split ':', $borrowernumbers ) { + addroutingmember( $borrowernumber, $subscriptionid ); + } } if($op eq 'save'){ my $sth = $dbh->prepare('UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?'); -- 2.30.2