Bugzilla – Attachment 21715 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), 3.34 KB, created by
Jonathan Druart
on 2013-10-02 13:03:26 UTC
(
hide
)
Description:
Bug 7376 Transfer limits should be checked at check-in
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-10-02 13:03:26 UTC
Size:
3.34 KB
patch
obsolete
>From eb768bc752f36be9ca8f9d339817ce32dc5b3c6f Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Thu, 29 Dec 2011 15:49:53 +0100 >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) >--- > C4/Circulation.pm | 27 +++++++++++++++++++++++++-- > 1 file changed, 25 insertions(+), 2 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 578f8eb..00bc733 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1717,13 +1717,13 @@ sub AddReturn { > $branch = C4::Context->userenv->{'branch'} unless $branch; # we trust userenv to be a safe fallback/default > my $messages; > my $borrower; >- my $biblio; > my $doreturn = 1; > my $validTransfert = 0; > my $stat_type = 'return'; > > # get information on item > my $itemnumber = GetItemnumberFromBarcode( $barcode ); >+ my $biblio = GetBiblioFromItemNumber($itemnumber); > unless ($itemnumber) { > return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. > } >@@ -1773,6 +1773,30 @@ sub AddReturn { > return ( $doreturn, $messages, $issue, $borrower ); > } > >+ # if we try a checkin that would result in a forbidden branchtransfer, refuse the return as well >+ # first, find branchtransferlimit value for this item >+ my $branchtransferlimitvalue = $biblio->{itemtype}; >+ $branchtransferlimitvalue = $item->{itype} >+ if C4::Context->preference("item-level_itypes") >+ && C4::Context->preference("BranchTransferLimitsType") eq 'itemtype'; >+ $branchtransferlimitvalue = $item->{ccode} >+ if C4::Context->preference("item-level_itypes") >+ && C4::Context->preference("BranchTransferLimitsType") eq 'ccode'; >+ if ( $hbr ne $branch >+ && ( >+ C4::Context->preference("IndependentBranches") >+ or ( C4::Context->preference("UseBranchTransferLimits") >+ and not IsBranchTransferAllowed($hbr, $branch, $branchtransferlimitvalue ) ) >+ ) >+ ) { >+ $messages->{'Wrongbranch'} = { >+ Wrongbranch => $branch, >+ Rightbranch => $message >+ }; >+ $doreturn = 0; >+ return ( $doreturn, $messages, $issue, $borrower ); >+ } >+ > if ( $item->{'withdrawn'} ) { # book has been cancelled > $messages->{'withdrawn'} = 1; > $doreturn = 0 if C4::Context->preference("BlockReturnOfWithdrawnItems"); >@@ -3225,7 +3249,6 @@ Code is either an itemtype or collection doe depending on the pref BranchTransfe > > sub IsBranchTransferAllowed { > my ( $toBranch, $fromBranch, $code ) = @_; >- > if ( $toBranch eq $fromBranch ) { return 1; } ## Short circuit for speed. > > my $limitType = C4::Context->preference("BranchTransferLimitsType"); >-- >1.7.10.4
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