From b2d76129e3939c0af9884e7a9f0771ef8c3ea8a7 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Thu, 10 Oct 2019 16:41:22 +0100
Subject: [PATCH] Bug 23049: Capitalise type passed to add_debit for lost_item
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
---
 C4/Accounts.pm                                        | 2 +-
 Koha/Account.pm                                       | 6 +++---
 t/db_dependent/Circulation/NoIssuesChargeGuarantees.t | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/C4/Accounts.pm b/C4/Accounts.pm
index b9ea2097ce..4923c6d4d4 100644
--- a/C4/Accounts.pm
+++ b/C4/Accounts.pm
@@ -124,7 +124,7 @@ sub chargelostitem {
                     user_id     => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
                     interface   => C4::Context->interface,
                     library_id  => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
-                    type        => 'lost_item',
+                    type        => 'LOST_ITEM',
                     item_id     => $itemnumber,
                     issue_id    => $issue_id,
                 }
diff --git a/Koha/Account.pm b/Koha/Account.pm
index 2c8c4a1e7d..34b865463c 100644
--- a/Koha/Account.pm
+++ b/Koha/Account.pm
@@ -447,7 +447,7 @@ $debit_type can be any of:
   - ACCOUNT
   - ACCOUNT_RENEW
   - RESERVE_EXPIRED
-  - lost_item
+  - LOST_ITEM
   - sundry
   - new_card
   - overdue
@@ -713,7 +713,7 @@ our $offset_type = {
     'ACCOUNT_RENEW'    => 'Account Fee',
     'RESERVE'          => 'Reserve Fee',
     'PROCESSING'       => 'Processing Fee',
-    'lost_item'        => 'Lost Item',
+    'LOST_ITEM'        => 'Lost Item',
     'RENT'             => 'Rental Fee',
     'RENT_DAILY'       => 'Rental Fee',
     'RENT_RENEW'       => 'Rental Fee',
@@ -743,7 +743,7 @@ our $account_type_debit = {
     'ACCOUNT'          => 'ACCOUNT',
     'ACCOUNT_RENEW'    => 'ACCOUNT_RENEW',
     'RESERVE_EXPIRED'  => 'RESERVE_EXPIRED',
-    'lost_item'        => 'LOST',
+    'LOST_ITEM'        => 'LOST',
     'sundry'           => 'M',
     'new_card'         => 'N',
     'overdue'          => 'OVERDUE',
diff --git a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t b/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t
index ed15c4fd18..376e9ef7df 100644
--- a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t
+++ b/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t
@@ -81,7 +81,7 @@ my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item-
 is( $issuingimpossible->{DEBT_GUARANTEES}, undef, "Patron can check out item" );
 
 my $account = Koha::Account->new( { patron_id => $guarantee->id } );
-$account->add_debit({ amount => 10.00, type => 'lost_item', interface => 'test' });
+$account->add_debit({ amount => 10.00, type => 'LOST_ITEM', interface => 'test' });
 ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} );
 is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
 
-- 
2.20.1