Bugzilla – Attachment 107077 Details for
Bug 7376
Transfer limits should be checked at check-in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7376: Refactoring subroutines
Bug-7376-Refactoring-subroutines.patch (text/plain), 3.62 KB, created by
Arthur Suzuki
on 2020-07-20 06:20:24 UTC
(
hide
)
Description:
Bug 7376: Refactoring subroutines
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2020-07-20 06:20:24 UTC
Size:
3.62 KB
patch
obsolete
>From 268b41a13dba26cbc61afec10a6b78e2b575cadc Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Fri, 30 Aug 2019 16:30:07 +0000 >Subject: [PATCH] Bug 7376: Refactoring subroutines > >CanBookBeReturned: >- Take Koha::Item as parameter instead of HASHref of an item > >To test: >1. cd into your Koha root directory >2. grep -rn 'CanBookBeReturned(' >3. Make sure all returned occurences are using Koha::Item > >Sponsored-by: National Library of Finland > >Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com> >--- > C4/Circulation.pm | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 2fe1dcdede..579911e159 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -879,7 +879,7 @@ sub CanBookBeIssued { > > my $patron = Koha::Patrons->find( $issue->borrowernumber ); > >- my ( $can_be_returned, $message ) = CanBookBeReturned( $item_unblessed, C4::Context->userenv->{branch} ); >+ my ( $can_be_returned, $message ) = CanBookBeReturned( $item_object, C4::Context->userenv->{branch} ); > > unless ( $can_be_returned ) { > $issuingimpossible{RETURN_IMPOSSIBLE} = 1; >@@ -1131,7 +1131,7 @@ Check whether the item can be returned to the provided branch > > =over 4 > >-=item C<$item> is a hash of item information as returned Koha::Items->find->unblessed (Temporary, should be a Koha::Item instead) >+=item C<$item> is a Koha::Item object > > =item C<$branch> is the branchcode where the return is taking place > >@@ -1158,15 +1158,15 @@ sub CanBookBeReturned { > my $message; > > # identify all cases where return is forbidden >- if ($allowreturntobranch eq 'homebranch' && $branch ne $item->{'homebranch'}) { >+ if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { > $allowed = 0; >- $message = $item->{'homebranch'}; >- } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->{'holdingbranch'}) { >+ $message = $item->homebranch; >+ } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { > $allowed = 0; >- $message = $item->{'holdingbranch'}; >- } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->{'homebranch'} && $branch ne $item->{'holdingbranch'}) { >+ $message = $item->holdingbranch; >+ } elsif ($allowreturntobranch eq 'homeorholdingbranch' && $branch ne $item->homebranch && $branch ne $item->holdingbranch) { > $allowed = 0; >- $message = $item->{'homebranch'}; # FIXME: choice of homebranch is arbitrary >+ $message = $item->homebranch; # FIXME: choice of homebranch is arbitrary > } > > return ($allowed, $message); >@@ -1379,7 +1379,7 @@ sub AddIssue { > if ( $actualissue and not $switch_onsite_checkout ) { > # This book is currently on loan, but not to the person > # who wants to borrow it now. mark it returned before issuing to the new borrower >- my ( $allowed, $message ) = CanBookBeReturned( $item_unblessed, C4::Context->userenv->{branch} ); >+ my ( $allowed, $message ) = CanBookBeReturned( $item_object, C4::Context->userenv->{branch} ); > return unless $allowed; > AddReturn( $item_object->barcode, C4::Context->userenv->{'branch'} ); > } >@@ -1953,7 +1953,8 @@ sub AddReturn { > } > > # check if the return is allowed at this branch >- my ($returnallowed, $message) = CanBookBeReturned($item->unblessed, $branch); >+ my ($returnallowed, $message) = CanBookBeReturned($item, $branch); >+ > unless ($returnallowed){ > $messages->{'Wrongbranch'} = { > Wrongbranch => $branch, >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7376
:
6954
|
21715
|
21805
|
22016
|
22017
|
22323
|
22357
|
22696
|
23168
|
76559
|
76866
|
76876
|
92740
|
92774
|
93190
|
93191
|
93192
|
93193
|
93194
|
93195
|
93196
|
107077
|
107078
|
107079
|
115369
|
115370
|
116493
|
116494
|
116927
|
116928
|
116937
|
116938
|
120897
|
120898
|
120899
|
120900
|
120901
|
120902
|
120903
|
144435
|
144436
|
144437
|
144438
|
144439
|
144440
|
144441