From 7c12c7274e236df90c1feef03e68f6b0accc0220 Mon Sep 17 00:00:00 2001
From: Katrin Fischer <katrin.fischer@bsz-bw.de>
Date: Fri, 21 Jul 2023 15:25:00 +0000
Subject: [PATCH] Bug 34171: Use barcodedecode when attaching items to another
 record

Bug 26351 added barcodecode that transforms scanned barcodes either
by using itemBarcodeInputFilter  or via a plugin to various pages in
Koha, including checkout and checkin. But the feature for attaching
items to a new record was missed.

To test:
* Add an item with barcode "ab" to any record
* Set itemBarcodeInputFilter to "Remove spaces from"
* Search for another record in the catalog
* Edit > attach item > "a b"
* The item is not found.
* Apply patch, restart_all
* Try again with "a b"
* Verify that the item is found and attached to the record
---
 cataloguing/moveitem.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cataloguing/moveitem.pl b/cataloguing/moveitem.pl
index ec59c258ff..03ca711694 100755
--- a/cataloguing/moveitem.pl
+++ b/cataloguing/moveitem.pl
@@ -23,6 +23,7 @@ use Modern::Perl;
 
 use CGI qw ( -utf8 );
 use C4::Auth qw( get_template_and_user );
+use C4::Circulation qw( barcodedecode );
 use C4::Output qw( output_html_with_http_headers );
 
 use Koha::Biblios;
@@ -34,7 +35,8 @@ my $query = CGI->new;
 my $biblionumber = $query->param('biblionumber');
 
 # The barcode of the item to move
-my $barcode	 = $query->param('barcode');
+my $barcode = barcodedecode($query->param('barcode'));
+
 
 my ($template, $loggedinuser, $cookie) = get_template_and_user(
     {
-- 
2.30.2