Bug 30055: Use /patrons for routing list
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 9 Feb 2022 11:15:33 +0000 (12:15 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 4 Apr 2022 07:46:57 +0000 (09:46 +0200)
Test plan:
Add new users to a serial routing list

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
api/v1/swagger/paths/patrons.yaml
koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt
koha-tmpl/intranet-tmpl/prog/en/modules/serials/tables/members_results.tt [deleted file]
serials/add_user_search.pl [deleted file]

index 452b982..dc3f25a 100644 (file)
       permissions:
         - borrowers: "1"
         - tools: "label_creator"
+        - serials: "routing"
     x-koha-embed:
       - extended_attributes
   post:
index 81c33b7..d9c8bf6 100644 (file)
         }
 
         function userPopup() {
-            window.open("/cgi-bin/koha/serials/add_user_search.pl",
+            window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,category,branch,action&selection_type=add",
                 'PatronPopup',
                 'width=740,height=450,location=yes,toolbar=no,'
                 + 'scrollbars=yes,resize=yes'
         }
 
         function add_user(borrowernumber) {
-            var myurl = "routing.pl?subscriptionid="+[% subscriptionid | html %]+"&borrowernumber="+borrowernumber+"&op=add";
+            var myurl = "/cgi-bin/koha/serials/routing.pl?subscriptionid="+[% subscriptionid | html %]+"&borrowernumber="+borrowernumber+"&op=add";
             window.location.href = myurl;
         }
     </script>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/tables/members_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/tables/members_results.tt
deleted file mode 100644 (file)
index 25912d4..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-[% USE To %]
-{
-    "sEcho": [% sEcho | html %],
-    "iTotalRecords": [% iTotalRecords | html %],
-    "iTotalDisplayRecords": [% iTotalDisplayRecords | html %],
-    "aaData": [
-        [% FOREACH data IN aaData %]
-            {
-                "dt_cardnumber":
-                    "[% data.cardnumber | html %]",
-                "dt_name":
-                    "<a href=\"/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber | html %]\" class=\"patron_preview\" data-borrowernumber=\"[% data.borrowernumber | html %]\" style='white-space:nowrap'>[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = To.json(data.firstname) surname = To.json(data.surname) othernames = To.json(data.othernames) cardnumber = data.cardnumber invert_name = 1 %]</a>",
-                "dt_branch":
-                    "[% data.branchname | html %]",
-                "dt_action":
-                    "<a href=\"#\" class=\"add_user btn btn-default btn-xs\" data-borrowernumber=\"[% data.borrowernumber | html %]\" data-firstname=\"[% data.firstname | html %]\" data-surname=\"[% data.surname | html %]\">Add</a>"
-            }[% UNLESS loop.last %],[% END %]
-        [% END %]
-    ]
-}
diff --git a/serials/add_user_search.pl b/serials/add_user_search.pl
deleted file mode 100755 (executable)
index 1240670..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/perl
-
-# This file is part of Koha.
-#
-# Copyright 2014 BibLibre
-#
-# Koha is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see <http://www.gnu.org/licenses>.
-
-use Modern::Perl;
-
-use CGI qw ( -utf8 );
-use C4::Auth qw( get_template_and_user );
-use C4::Output qw( output_html_with_http_headers );
-use C4::Members;
-
-use Koha::Patron::Categories;
-
-my $input = CGI->new;
-
-my $dbh = C4::Context->dbh;
-
-my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user(
-    {   template_name   => "common/patron_search.tt",
-        query           => $input,
-        type            => "intranet",
-        flagsrequired => { serials => 'routing' },
-    }
-);
-
-my $q = $input->param('q') || '';
-my $op = $input->param('op') || '';
-
-my $referer = $input->referer();
-
-my $patron_categories = Koha::Patron::Categories->search_with_library_limits;
-$template->param(
-    view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results",
-    columns => ['cardnumber', 'name', 'branch', 'action'],
-    json_template => 'serials/tables/members_results.tt',
-    selection_type => 'add',
-    alphabet        => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ),
-    categories      => $patron_categories,
-    aaSorting       => 1,
-);
-output_html_with_http_headers( $input, $cookie, $template->output );