From 9900883004cb797bfbd0e9805aa60bd57ee5ede4 Mon Sep 17 00:00:00 2001
From: Hammat Wele
Date: Thu, 1 May 2025 18:58:29 +0000
Subject: [PATCH] Bug 33646: Better organize availability in cataloging search
This change adds "Available", "Unavailable", and "Not for loan"
categories in the availability cell of the "cataloging search"
found at /cgi-bin/koha/cataloguing/addbooks.pl
This change also adds missing location information for the
"Not for loan" items.
Test plan:
0. Apply the patch
1. Add available, checked out, and not for loan items for a test record
(like "Gairm" in koha-testing-docker)
2. Go to the cataloging search,
http://localhost:8081/cgi-bin/koha/cataloguing/addbooks.pl?q=test
3. Note that the items in the "Location" column now have labels
to differentiate which items are available, unavailable, and not for loan.
4. Note that the "Not for loan" data is similar to the "Available" data
---
.../prog/en/modules/cataloguing/addbooks.tt | 67 ++++++++++++++-----
1 file changed, 50 insertions(+), 17 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
index 0e61ec2d8b..321595948a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
@@ -4,6 +4,7 @@
[% USE TablesSettings %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
[% FILTER collapse %]
@@ -137,35 +138,67 @@
[% END %]
-
- [% IF ( resultsloo.available_items_loop ) %]
+ |
+
+ [% IF resultsloo.availablecount > 0 %]
+ Available:
[% FOREACH items_loo IN resultsloo.available_items_loop %]
[% items_loo.count | html %]
- [% items_loo.branchname | html %]
+ [% IF ( items_loo.branchname ) %][% items_loo.branchname | html %][% END %]
[% IF ( items_loo.location ) %][% items_loo.location | html %][% END %]
[% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %]
- [% IF ( items_loo.classification ) %]
- [% items_loo.classification | html %]
- [% END %]
[% END %]
[% END %]
-
- [% IF ( resultsloo.onloancount ) %]Checked out ([% resultsloo.onloancount | html %]), [% END %]
- [% IF ( resultsloo.withdrawncount ) %]Withdrawn ([% resultsloo.withdrawncount | html %]), [% END %]
- [% IF ( resultsloo.itemlostcount ) %]Lost ([% resultsloo.itemlostcount | html %]) [% END %]
- [% IF ( resultsloo.recalledcount ) %]Waiting to fill recall ([% resultsloo.recalled | html %])[% END %]
- [% IF ( resultsloo.onholdcount ) %]Waiting on hold ([% resultsloo.onholdcount | html %])[% END %]
-
-
- [% IF ( resultsloo.other_items_loop ) %]
+
+ [% IF resultsloo.onloancount > 0 || resultsloo.othercount > 0 && !( resultsloo.notforloancount || resultsloo.orderedcount) %]
+ Unavailable:
+
+
+ [% IF ( resultsloo.onloancount ) %]Checked out (
+ [% FOREACH items_loo IN resultsloo.onloan_items_loop %]
+ [% IF (!items_loo.notforloan ) %]
+ [% items_loo.count | html %]
+ [% IF ( items_loo.branchname ) %][% items_loo.branchname | html %][% END %]
+ [% IF ( items_loo.location ) %][% items_loo.location | html %][% END %]
+ [% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %]
+
+ [% END %]
+ [% END %]),
+ [%END%]
[% FOREACH items_loo IN resultsloo.other_items_loop %]
- [% IF ( items_loo.notforloan ) %][% items_loo.notforloan | html %] ([% items_loo.count | html %]) [% END %]
+ [% IF (!items_loo.notforloan ) %]
+ [% items_loo.count | html %]
+ [% IF ( items_loo.branchname ) %][% items_loo.branchname | html %][% END %]
+ [% IF ( items_loo.location ) %][% items_loo.location | html %][% END %]
+ [% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %]
+ [% IF ( items_loo.withdrawn ) %]([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => items_loo.withdrawn ) | html %])[% END %]
+ [% IF ( items_loo.itemlost ) %]([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => items_loo.itemlost ) | html %])[% END %]
+ [% IF ( items_loo.damaged ) %]([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => items_loo.damaged ) | html %])[% END %]
+ [% IF ( items_loo.intransit ) %](In transit) [% END %]
+ [% IF ( items_loo.onhold ) %](On hold) [% END %]
+
+ [% END %]
[% END %]
+
+ [% END %]
+
+ [% IF ( resultsloo.notforloancount || resultsloo.orderedcount) %]
+ Not for loan:
+
+ [% FOREACH items_loo IN resultsloo.other_items_loop %]
+ [% IF ( items_loo.notforloan ) %]
+ [% items_loo.count | html %] [% items_loo.branchname | html %]
+ [% IF ( items_loo.location ) %][% items_loo.location | html %][% END %]
+ [% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %]
+ ([% items_loo.notforloan | html %])
+
+ [% END %]
+ [% END %]
+
[% END %]
-
|
--
2.34.1 |