Bugzilla – Attachment 42177 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]
[SIGNED-OFF] Bug 14598: (DB update) fix NULL itemtypes in statistics on 'return' rows
SIGNED-OFF-Bug-14598-DB-update-fix-NULL-itemtypes-.patch (text/plain), 2.63 KB, created by
Kyle M Hall (khall)
on 2015-09-01 16:30:15 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 14598: (DB update) fix NULL itemtypes in statistics on 'return' rows
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-09-01 16:30:15 UTC
Size:
2.63 KB
patch
obsolete
>From de1523c19423459195241dab94a9c1d8e8e8c585 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 1 Sep 2015 11:52:17 -0300 >Subject: [PATCH] [SIGNED-OFF] Bug 14598: (DB update) fix NULL itemtypes in statistics on 'return' rows > >This patch introduces an updatedatabase.pl entry that takes care of >updating existing statistics rows. > >It does so by looping on the statistics rows, collecting itemnumber occurences >that are have NULL itemtypes. >It then chooses the right itemtype following what is proposed on bug 14651, and >then updates the rows in statistics using the calculated itemtype. > >Regards > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/updatedatabase.pl | 40 ++++++++++++++++++++++++++++++++ > 1 files changed, 40 insertions(+), 0 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 6e99abb..ecadf30 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -10796,6 +10796,46 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.21.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ >+ $sth = $dbh->prepare(q{ >+ SELECT s.itemnumber, i.itype, b.itemtype FROM >+ ( SELECT DISTINCT itemnumber >+ FROM statistics >+ WHERE type="return" AND itemtype IS NULL ) s >+ LEFT JOIN >+ ( SELECT itemnumber,biblionumber, itype >+ FROM items ) i >+ ON (s.itemnumber=i.itemnumber) >+ LEFT JOIN >+ ( SELECT biblionumber, itemtype >+ FROM biblioitems ) b >+ ON (i.biblionumber=b.biblionumber) >+ }); >+ $sth->execute(); >+ >+ my $update_sth = $dbh->prepare(q{ >+ UPDATE statistics >+ SET itemtype=? >+ WHERE itemnumber=? AND itemtype IS NULL >+ }); >+ my $ilevel_itypes = C4::Context->preference('item-level_itypes'); >+ >+ while ( my ($itemnumber,$item_itype,$biblio_itype) = $sth->fetchrow_array ) { >+ >+ my $effective_itemtype = $ilevel_itypes >+ ? $item_itype // $biblio_itype >+ : $biblio_itype; >+ warn "item-level_itypes set but no itype defined for item ($itemnumber)" >+ if $ilevel_itypes and !defined $item_itype; >+ $update_sth->execute( $effective_itemtype, $itemnumber ); >+ } >+ >+ print "Upgrade to $DBversion done (Bug 14598: itemtype is not set on statistics by C4::Circulation::AddReturn)\n"; >+ SetVersion($DBversion); >+} >+ > # DEVELOPER PROCESS, search for anything to execute in the db_update directory > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. >-- >1.7.2.5
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