Bugzilla – Attachment 49964 Details for
Bug 14598
itemtype is not set on statistics by C4::Circulation::AddReturn
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Rebased
Bug-14598-Make-C4CirculationAddReturn-store-the-ri.patch (text/plain), 3.45 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-04-06 13:43:37 UTC
(
hide
)
Description:
Rebased
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-04-06 13:43:37 UTC
Size:
3.45 KB
patch
obsolete
>From be5669863923cd00fb23df641eec913a34ab3084 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 27 Jul 2015 11:40:38 -0300 >Subject: [PATCH] Bug 14598: Make C4::Circulation::AddReturn store the right > itemtype > >This patch makes C4::Circulation::AddReturn correctly store the itemtype >on the 'statistics' table. > >To reproduce: >- Checkout master. >- Make a checkout. >- Check the 'statistics' table and notice the itemtype is correctly set > > SELECT * FROM statistics; >- Check the item in. >- Check the 'statistics' table and notice the itemtype is not set > > SELECT * FROM statistics WHERE type="return"; >=> FAIL: itemtype is set to NULL > >To test: >- Apply the regression tests patch >- Run the tests: > $ prove t/db_dependent/Circulation/Returns.t >=> FAIL: Tests fail >- Apply this patch >- Run the regression tests: > $ prove t/db_dependent/Circulation/Returns.t >=> SUCCESS: Tests now pass. >- Repeat the 'To reproduce' steps >=> SUCCESS: itemtype is now correctly set (in real life) >- Happily sign off :-D > >Sponsored-by: Universidad Empresarial Siglo 21 > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> >--- > C4/Circulation.pm | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 70ae3fd..a300ad1 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1852,13 +1852,19 @@ 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 $item = GetItem( undef, $barcode ) >+ or die "GetItem( undef, $barcode ) failed"; >+ my $itemnumber = $item->{ itemnumber }; >+ my $biblio = GetBiblioData( $item->{ biblionumber } ); >+ my $itemtype = ( C4::Context->preference("item-level_itypes") ) >+ ? $item->{ itype } >+ : $biblio->{ itemtype }; >+ > unless ($itemnumber) { > return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. > } >@@ -1879,8 +1885,6 @@ sub AddReturn { > } > } > >- my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed"; >- > if ( $item->{'location'} eq 'PROC' ) { > if ( C4::Context->preference("InProcessingToShelvingCart") ) { > $item->{'location'} = 'CART'; >@@ -2113,15 +2117,14 @@ sub AddReturn { > } > > # Record the fact that this book was returned. >- # FIXME itemtype should record item level type, not bibliolevel type > UpdateStats({ >- branch => $branch, >- type => $stat_type, >- itemnumber => $item->{'itemnumber'}, >- itemtype => $biblio->{'itemtype'}, >- borrowernumber => $borrowernumber, >- ccode => $item->{'ccode'}} >- ); >+ branch => $branch, >+ type => $stat_type, >+ itemnumber => $itemnumber, >+ itemtype => $itemtype, >+ borrowernumber => $borrowernumber, >+ ccode => $item->{ ccode } >+ }); > > # Send a check-in slip. # NOTE: borrower may be undef. probably shouldn't try to send messages then. > my $circulation_alert = 'C4::ItemCirculationAlertPreference'; >-- >2.7.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 14598
:
41198
|
41199
|
41200
|
41201
|
41202
|
41203
|
41204
|
41205
|
41383
|
41384
|
41385
|
41627
|
41628
|
41629
|
41637
|
42171
|
42177
|
44665
|
44666
|
44667
|
44668
|
45030
|
45047
|
45838
|
45843
|
45844
|
46546
|
46877
|
47108
|
47109
|
47110
|
47111
|
47112
|
47113
|
47114
|
47115
|
47116
|
49797
|
49798
|
49799
|
49800
|
49801
|
49802
|
49803
|
49804
|
49805
|
49807
|
49963
|
49964
|
49965
|
49966
|
49967
|
49968
|
49969
|
49970
|
49971
|
49972
|
49978
|
49979
|
49980
|
49981
|
49982
|
49983
|
49984
|
49985
|
49986
|
49987
|
49988
|
50018
|
56941
|
56942
|
56943
|
56944
|
56945
|
56946
|
56947
|
56948
|
56949
|
56950
|
56951
|
56952
|
56953
|
62539
|
62555
|
62682