Bugzilla – Attachment 49988 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: (QA followup) use deleted{items|biblioitems} during upgrade
Bug-14598-QA-followup-use-deleteditemsbiblioitems-.patch (text/plain), 3.73 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-04-06 14:47:43 UTC
(
hide
)
Description:
Bug 14598: (QA followup) use deleted{items|biblioitems} during upgrade
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-04-06 14:47:43 UTC
Size:
3.73 KB
patch
obsolete
>From 0a237278990507c8ea62e3a10d1c781dbfd9b310 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@unc.edu.ar> >Date: Wed, 6 Apr 2016 11:34:26 -0300 >Subject: [PATCH] Bug 14598: (QA followup) use deleted{items|biblioitems} > during upgrade > >If the 'statistics' table contains circulation information about items >that are no longer on the DB it will raise a warning. This patch >makes the updatedatabase.pl script use the deleteditems and deletedbiblioitems >tables to get information for those items on the statistics table. > >To reproduce: >- Have your sample DB contain some circulation data on the statistics table >- Make sure some of them have NULL itemtype: >> UPDATE statistics SET itemtype = NULL WHERE type='return'; >- Check the upgrade query catches them: >> SELECT s.itemnumber, i.itype, b.itemtype FROM ( SELECT DISTINCT itemnumber FROM statistics WHERE ( type = "return" OR type = "localuse" ) AND itemtype IS NULL ) s LEFT JOIN ( SELECT itemnumber,biblionumber, itype FROM items UNION SELECT itemnumber,biblionumber, itype FROM deleteditems ) i ON (s.itemnumber=i.itemnumber) LEFT JOIN ( SELECT biblionumber, itemtype FROM biblioitems UNION SELECT biblionumber, itemtype FROM deletedbiblioitems ) b ON (i.biblionumber=b.biblionumber); >+------------+-------+----------+ >| itemnumber | itype | itemtype | >+------------+-------+----------+ >| 732 | BK | BK | >| 731 | BK | BK | >+------------+-------+----------+ >2 rows in set (0.00 sec) > >- Delete the items, and some biblio too. >- Re-run the query >=> SUCCESS: Same results >- Go reset to NULL the itemtypes >> UPDATE statistics SET itemtype = NULL WHERE type='return'; >- Run the updatedatabase.pl script: > $ sudo koha-shell koahdev ; cd kohaclone > $ perl installer/data/mysql/updatedatabase.pl >=> SUCCESS: No warnings > >Note: It is possible that on production sites, if the sysadmin is cleaning the >deleted{items|biblioitems|biblio} tables, there will be warnings. This is expected >as they need to know some data lacks information. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar> >--- > installer/data/mysql/updatedatabase.pl | 35 ++++++++++++++++++++++------------ > 1 file changed, 23 insertions(+), 12 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 56f02b5..d33a40d 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -12210,18 +12210,29 @@ $DBversion = "3.23.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" OR type = "localuse" ) 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) >+ SELECT s.itemnumber, i.itype, b.itemtype >+ FROM >+ ( SELECT DISTINCT itemnumber >+ FROM statistics >+ WHERE ( type = "return" OR type = "localuse" ) AND >+ itemtype IS NULL >+ ) s >+ LEFT JOIN >+ ( SELECT itemnumber,biblionumber, itype >+ FROM items >+ UNION >+ SELECT itemnumber,biblionumber, itype >+ FROM deleteditems >+ ) i >+ ON (s.itemnumber=i.itemnumber) >+ LEFT JOIN >+ ( SELECT biblionumber, itemtype >+ FROM biblioitems >+ UNION >+ SELECT biblionumber, itemtype >+ FROM deletedbiblioitems >+ ) b >+ ON (i.biblionumber=b.biblionumber); > }); > $sth->execute(); > >-- >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