Bugzilla – Attachment 93196 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]
(ANOTHER IMPLEMENTATION) Bug 7376: Transfer limits should be checked at check-in
Bug-7376-Transfer-limits-should-be-checked-at-chec.patch (text/plain), 6.45 KB, created by
Lari Taskula
on 2019-09-27 11:52:43 UTC
(
hide
)
Description:
(ANOTHER IMPLEMENTATION) Bug 7376: Transfer limits should be checked at check-in
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2019-09-27 11:52:43 UTC
Size:
6.45 KB
patch
obsolete
>From 499a75791bc20143796be85507861486f24f9235 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 >--- > C4/Circulation.pm | 36 +++++++++++++++---- > C4/SIP/ILS/Transaction/Checkin.pm | 3 ++ > circ/returns.pl | 3 ++ > .../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 c693105df5..3c6f2b1bde 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1132,7 +1132,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 > >@@ -1144,18 +1147,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); >@@ -1803,6 +1818,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 >@@ -1928,8 +1947,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 f0e8bbdf49..a506919cd0 100644 >--- a/C4/SIP/ILS/Transaction/Checkin.pm >+++ b/C4/SIP/ILS/Transaction/Checkin.pm >@@ -96,6 +96,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 657229a10e..220c1fda42 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -521,6 +521,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 42d7a19089..e8ed642517 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -611,6 +611,9 @@ > [% END %] > <p class="problem">Item is withdrawn.</p> > [% END %] >+ [% IF ( errmsgloo.transferlimit ) %] >+ <p class="problem">Transfer is forbidden between [% Branches.GetName( holdingbranch ) %] (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.17.1
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