From 6c7587d2faee75af4f89ccb429c2e8fa58edd7b3 Mon Sep 17 00:00:00 2001
From: Lucas Gass <lucas@bywatersolutions.com>
Date: Tue, 27 Sep 2022 16:44:24 +0000
Subject: [PATCH] Bug 31633: Add holding and home data attributes to
 spinelabel-print.tt

To test:

1. Apply patch
2. Have some items with call numbers and different holding/home branches.
3. Generate some quick spine labels and use your browsers dev tools to inscept the #spinelabel element. It should have 2 new data-attributes, data-homebranch and data-holdingbranch
4. You can then apply this CSS via IntraNnetUserCSS to make sure you can select these properly now:

	background: red;
}
---
 .../intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt  | 2 +-
 labels/spinelabel-print.pl                                    | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt
index 6a48276f57..b81f77281d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/spinelabel-print.tt
@@ -22,7 +22,7 @@
             </div>
 	[% ELSE %]
             <body id="labels_spinelabel-print" class="tools labels">
-            <div id="spinelabel" class="[% Branches.GetLoggedInBranchcode | html %]">
+            <div id="spinelabel" class="[% Branches.GetLoggedInBranchcode | html %]" data-homebranch="[% itemhomebranch | html %]" data-holdingbranch="[% itemholdingbranch | html %]">
 				[% content | $raw %]
             </div>
             <div id="print_button" class="noprint">
diff --git a/labels/spinelabel-print.pl b/labels/spinelabel-print.pl
index 76a6fc5e36..265498c208 100755
--- a/labels/spinelabel-print.pl
+++ b/labels/spinelabel-print.pl
@@ -82,6 +82,10 @@ while ( my ( $key, $value ) = each(%$data) ) {
 
 $body = $scheme;
 
+$template->param(
+        'itemhomebranch' => $item->{homebranch},
+        'itemholdingbranch' => $item->{holdingbranch}
+);
 $template->param( autoprint => C4::Context->preference("SpineLabelAutoPrint") );
 $template->param( content   => $body );
 
-- 
2.30.2