Bugzilla – Attachment 41637 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]
Bug 14598: (DB update) fix NULL itemtypes in statistics on 'return' rows
Bug-14598-DB-update-fix-NULL-itemtypes-in-statisti.patch (text/plain), 2.12 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-08-18 19:49:01 UTC
(
hide
)
Description:
Bug 14598: (DB update) fix NULL itemtypes in statistics on 'return' rows
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-08-18 19:49:01 UTC
Size:
2.12 KB
patch
obsolete
>From 973680bf4cfb44d9f7f04053654a39b06e71b71d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@unc.edu.ar> >Date: Tue, 18 Aug 2015 16:21:27 -0300 >Subject: [PATCH] Bug 14598: (DB update) fix NULL itemtypes in statistics on > 'return' rows > >This patch introduces an updatedatabase.pl block that updates the rows that >lack itemtype. It relies on Koha::Item->effective_itemtype() to choose the rigt one. > >I wrote it using SQL because the statistics table lacks PKs. > >Note: I'm not sure about making this dependent on 14651, I need a QA POV on this, >and I'm biased as I wrote all the related patches... >--- > installer/data/mysql/updatedatabase.pl | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 10809a1..1e015f4 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -39,6 +39,7 @@ use C4::Installer; > use C4::Dates; > use Koha::Database; > use Koha; >+use Koha::Items; > > use MARC::Record; > use MARC::File::XML ( BinaryEncoding => 'utf8' ); >@@ -10761,6 +10762,30 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.21.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ # Fix return statistic itemtypes >+ my $stats = $schema->resultset('Statistic')->search({ >+ type => 'return', >+ itemtype => undef }); >+ >+ while ( my $stat = $stats->next() ) { >+ >+ my $itemnumber = $stat->itemnumber(); >+ my $itemtype = Koha::Items->find( $itemnumber )->effective_itemtype(); >+ >+ $sth = $dbh->prepare(q{ >+ UPDATE statistics >+ SET itemtype=? >+ WHERE type='return' AND itemnumber=? AND itemtype IS NULL >+ }); >+ $sth->execute( $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. >-- >2.5.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 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