From 1818119c8c57370f3cb37996f022cf6861cfe6d5 Mon Sep 17 00:00:00 2001
From: Julian Maurice <julian.maurice@biblibre.com>
Date: Tue, 8 Nov 2022 15:19:20 +0100
Subject: [PATCH] Bug 32134: Show the bundle size when checked out

When checking out a bundle, it can be useful to know the number of items
in this bundle, so that librarians can quickly check if items are
missing.

Test plan:
1. Create a bundle (see bug 28854 comment 458)
2. Check out the bundle.
3. Verify that you have the bundle size in the message below the barcode
   input ("Checked out: [...]. Bundle of X items. Due on [...]")
4. Checkout an item that is not a bundle.
5. Verify that the bundle message does not appear
---
 .../prog/en/modules/circ/circulation.tt             | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index 00cd8d5c20..064db6f099 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -9,6 +9,7 @@
 [% USE ItemTypes %]
 [% USE Price %]
 [% USE AuthorisedValues %]
+[% PROCESS 'i18n.inc' %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
 [% Asset.css("lib/jquery/plugins/rowGroup/stylesheets/rowGroup.dataTables.min.css") | $raw %]
@@ -773,7 +774,17 @@
 
                                         [% IF ( issue ) %]
                                             <div class="lastchecked">
-                                                <p><strong>Checked out: </strong>[% issue.item.biblio.title | html %] ([% issue.item.barcode | html %]). Due on [% issue.date_due | $KohaDates as_due_date => 1 %]</p>
+                                                <p>
+                                                    <strong>Checked out: </strong>
+                                                    [% issue.item.biblio.title | html %] ([% issue.item.barcode | html %]).
+
+                                                    [% IF issue.item.is_bundle %]
+                                                        [% SET bundle_items_count = issue.item.bundle_items.count %]
+                                                        [% tnx('Bundle of {count} item', 'Bundle of {count} items', bundle_items_count, { count = bundle_items_count }) | html %].
+                                                    [% END %]
+
+                                                    Due on [% issue.date_due | $KohaDates as_due_date => 1 %]
+                                                </p>
                                             </div>
                                         [% END %]
                                     </form> <!-- /#mainform -->
-- 
2.30.2