From 52b5a22edfbab0e211f5c5a3a8aa51b6fbd25202 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Thu, 29 Jul 2021 17:23:01 +0300 Subject: [PATCH] Bug 28782: Use query param list instead of splitting elements using '/' This removes the need to handle single and multiple cases separately, thus removing bunch if-else cases and simplifying our code. This coding style is also in line with our other .pl scripts. To test: 1) Make sure placing a hold still works from the following pages: /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX /cgi-bin/koha/catalogue/search.pl?q=a /cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=XXXX /cgi-bin/koha/clubs/clubs.pl (create a new club and add a patron there and through the clubs.pl create a hold to a bib) Signed-off-by: Hayley Pelham Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- .../prog/en/includes/clubs-table.inc | 8 +-- .../prog/en/modules/catalogue/results.tt | 2 - .../prog/en/modules/reserve/request.tt | 51 ++++++++----------- .../prog/en/modules/virtualshelves/shelves.tt | 8 ++- koha-tmpl/intranet-tmpl/prog/js/cart.js | 21 +++----- .../intranet-tmpl/prog/js/pages/results.js | 9 ++-- reserve/modrequest.pl | 5 +- reserve/placerequest.pl | 18 +++---- reserve/request.pl | 24 ++------- 9 files changed, 59 insertions(+), 87 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc index 99d1d861e8..171656144f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc @@ -24,10 +24,12 @@ [% FOREACH c IN clubs %] [% IF destination == 'holds' %] + [% SET data_url = "/cgi-bin/koha/reserve/request.pl?club=" _ c.id %] + [% FOREACH biblionumber IN biblionumbers %] + [% SET data_url = data_url _ "&biblionumber=" _ biblionumber %] + [% END %] [% IF multi_hold %] - [% SET data_url = "/cgi-bin/koha/reserve/request.pl?club=" _ c.id _ "&multi_hold=1&biblionumbers=" _ biblionumbers %] - [% ELSE %] - [% SET data_url = "/cgi-bin/koha/reserve/request.pl?club=" _ c.id _ "&biblionumber=" _ biblionumber %] + [% SET data_url = data_url _ "&multi_hold=1" %] [% END %] [% c.name | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 59def93d62..e1c0da18c5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -671,14 +671,12 @@
-
-
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index ad847d0c10..eaa700a9d3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -163,14 +163,12 @@ [% END %]
-
+
Enter patron card number or partial name:
- [% IF multi_hold %] - - [% ELSE %] - + [% FOREACH biblionumber IN biblionumbers %] + [% END %]
@@ -180,14 +178,12 @@
[% IF clubcount %]
-
+
Enter club ID or partial name:
- [% IF multi_hold %] - - [% ELSE %] - + [% FOREACH biblionumber IN biblionumbers %] + [% END %]
@@ -206,7 +202,6 @@
[% IF ( multi_hold ) %] - [% FOREACH biblioloo IN biblioloop %] @@ -214,7 +209,6 @@ [% END %] [% ELSE %] - [% END # /IF multi_hold %] @@ -449,8 +443,10 @@ + [% FOREACH biblionumber IN biblionumbers %] + + [% END %] [% IF ( multi_hold ) %] - @@ -459,7 +455,6 @@ [% END %] [% ELSE %] - [% END # /IF multi_hold %] @@ -923,7 +918,9 @@ [% IF ( reserveloop ) %] [% IF ( multi_hold ) %] - + [% FOREACH biblionumber IN biblionumbers %] + + [% END %] [% END %] [% IF enqueued %] @@ -1154,7 +1151,7 @@ [% Asset.js("js/holds.js") | $raw%]