Bugzilla – Attachment 107079 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: Transfer limits should be checked at check-in
Bug-7376-Transfer-limits-should-be-checked-at-chec.patch (text/plain), 6.57 KB, created by
Arthur Suzuki
on 2020-07-20 06:20:35 UTC
(
hide
)
Description:
Bug 7376: Transfer limits should be checked at check-in
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2020-07-20 06:20:35 UTC
Size:
6.57 KB
patch
obsolete
>From 7bbf9db3aed320a5c949611835679e34790f406d Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Fri, 30 Aug 2019 17:20:38 +0000 >Subject: [PATCH] Bug 7376: Transfer limits should be checked at check-in > >Test case: >* UseBranchTransferLimits must be set >* define your branch transfer limit. Refuse transfers from libraryA to libraryB >* checkout a book owned by libraryB, from libraryB, with a librarian located at >libraryB >* move the librarian to libraryA ("Set Library" link top/right) >* check-in the book => it's possible whatever your setup > >After the patch, the behaviour respect the branch transfer limit parameter: you >can check-in if you accept transfers, you can't if you refuse them. > >(Note: IndependantBranches must be OFF, otherwise it's not possible to do the >checkin whatever the branch transfer limits) > >Sponsored-by: National Library of Finland > >Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com> >--- > C4/Circulation.pm | 36 ++++++++++++++++++---- > C4/SIP/ILS/Transaction/Checkin.pm | 3 ++ > circ/returns.pl | 3 ++ > .../intranet-tmpl/prog/en/modules/circ/returns.tt | 3 ++ > 4 files changed, 39 insertions(+), 6 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 67d0346d05..2a63368c52 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1143,7 +1143,10 @@ Returns: > > =item C<$returnallowed> is 0 or 1, corresponding to whether the return is allowed (1) or not (0) > >-=item C<$message> is the branchcode where the item SHOULD be returned, if the return is not allowed >+=item C<$message> is a HASHref of following possible keys: >+ >+C<toBranch> branchcode where the item SHOULD be returned, if the return is not allowed >+C<transferLimit> transfer limit exists, HASHref of following keys: C<from>, C<to> > > =back > >@@ -1155,18 +1158,30 @@ sub CanBookBeReturned { > > # assume return is allowed to start > my $allowed = 1; >+ my $to_branch = $branch; > my $message; > > # identify all cases where return is forbidden > if ($allowreturntobranch eq 'homebranch' && $branch ne $item->homebranch) { > $allowed = 0; >- $message = $item->homebranch; >+ $message->{toBranch} = $to_branch = $item->homebranch; > } elsif ($allowreturntobranch eq 'holdingbranch' && $branch ne $item->holdingbranch) { > $allowed = 0; >- $message = $item->holdingbranch; >+ $message->{toBranch} = $to_branch = $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->{toBranch} = $to_branch = $item->homebranch; # FIXME: choice of homebranch is arbitrary >+ } >+ >+ # Make sure there are no branch transfer limits between item's current >+ # branch (holdinbranch) and the return branch >+ my $to_library = Koha::Libraries->find($to_branch); >+ if (!$item->can_be_transferred({ to => $to_library })) { >+ $allowed = 0; >+ $message->{transferLimit} = { >+ from => $item->holdingbranch, >+ to => $to_branch >+ }; > } > > return ($allowed, $message); >@@ -1830,6 +1845,10 @@ This book has was returned to the wrong branch. The value is a hashref > so that C<$messages->{Wrongbranch}->{Wrongbranch}> and C<$messages->{Wrongbranch}->{Rightbranch}> > contain the branchcode of the incorrect and correct return library, respectively. > >+=item C<Transferlimit> >+ >+A transfer limit exists between item's holding branch and the return branch. >+ > =item C<ResFound> > > The item was reserved. The value is a reference-to-hash whose keys are >@@ -1958,8 +1977,13 @@ sub AddReturn { > unless ($returnallowed){ > $messages->{'Wrongbranch'} = { > Wrongbranch => $branch, >- Rightbranch => $message >- }; >+ Rightbranch => $message->{toBranch} >+ } if $message->{toBranch}; >+ >+ if ($message->{'transferLimit'}) { >+ $messages->{'Transferlimit'} = $message->{'transferLimit'}; >+ } >+ > $doreturn = 0; > return ( $doreturn, $messages, $issue, $patron_unblessed); > } >diff --git a/C4/SIP/ILS/Transaction/Checkin.pm b/C4/SIP/ILS/Transaction/Checkin.pm >index 10cd87b5ad..457831437e 100644 >--- a/C4/SIP/ILS/Transaction/Checkin.pm >+++ b/C4/SIP/ILS/Transaction/Checkin.pm >@@ -100,6 +100,9 @@ sub do_checkin { > $self->{item}->destination_loc($messages->{Wrongbranch}->{Rightbranch}); > $self->alert_type('04'); # send to other branch > } >+ if ($messages->{Transferlimit}) { >+ $self->alert_type('04'); >+ } > if ($messages->{WrongTransfer}) { > $self->{item}->destination_loc($messages->{WrongTransfer}); > $self->alert_type('04'); # send to other branch >diff --git a/circ/returns.pl b/circ/returns.pl >index e1bce3c3f1..3bca9cfb23 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -511,6 +511,9 @@ foreach my $code ( keys %$messages ) { > } > elsif ( $code eq 'Wrongbranch' ) { > } >+ elsif ( $code eq 'Transferlimit' ) { >+ $err{transferlimit} = $messages->{'Transferlimit'}; >+ } > elsif ( $code eq 'Debarred' ) { > $err{debarred} = $messages->{'Debarred'}; > $err{debarcardnumber} = $borrower->{cardnumber}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 57ad49518a..c02386186c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -272,6 +272,9 @@ > [% END %] > <p class="problem">Item is withdrawn.</p> > [% END %] >+ [% IF ( errmsgloo.transferlimit ) %] >+ <p class="problem">Transfer is forbidden between [% Branches.GetName( holdingbranch ) | html %] (item's current library) and [% LoginBranchname | html %].</p> >+ [% END %] > [% IF ( errmsgloo.debarred ) %] > <p class="problem"><a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% errmsgloo.debarborrowernumber | uri %]">[% errmsgloo.debarname | html %]([% errmsgloo.debarcardnumber | html %])</a> is now debarred until [% errmsgloo.debarred | $KohaDates %].</p> > [% END %] >-- >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
|
175690
|
175691
|
175692
|
175693
|
175694
|
175695
|
175696
|
175697