Bugzilla – Attachment 27093 Details for
Bug 11846
Correct database update for debarments with 9999-12-31
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11846 - Correct database update for debarments with 9999-12-31
Bug-11846---Correct-database-update-for-debarments.patch (text/plain), 3.16 KB, created by
Kyle M Hall (khall)
on 2014-04-14 12:50:34 UTC
(
hide
)
Description:
Bug 11846 - Correct database update for debarments with 9999-12-31
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-04-14 12:50:34 UTC
Size:
3.16 KB
patch
obsolete
>From cce55c41d8c450a392144a3fc833596a404fddf2 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Mon, 24 Feb 2014 12:15:55 +0100 >Subject: [PATCH] Bug 11846 - Correct database update for debarments with 9999-12-31 > >The borrowers with infinite debarments have borrowers.debarred with '9999-12-31'. >Database update for this bug contained : > INSERT INTO borrower_debarments ( borrowernumber, expiration, comment ) SELECT borrowernumber, debarred, debarredcomment FROM borrowers WHERE debarred IS NOT NULL >For borrowers where borrowers.debarred is '9999-12-31', this value is copied into borrower_debarments.expiration. >This is not correct because borrower_debarments.expiration must be NULL for infinite debarments. > >This patch corrects update 3.13.00.035 and also adds an update for databases already updated. > >Test plan : >- Use a database with version 3.13.00.000 >- Set a borrower as restricted for ever (leave until empty) >- Use sources to master + patch >- Perform updatedatabase >- Look at borrower details, tab "Restrictions" >=> Without patch, you see Expiration 31/12/9999 >=> With patch, you see Expiration Infinite > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >I tested both db revisions by resetting Version of my database (and >adding a SetVersion after the revised older dbrev). This was possible since >the debarred field still exists in borrowers. (I have my doubts about that, >but that goes outside the scope of this report.) >Also note that routine _UpdateBorrowerDebarmentFlags puts back 9999-12-31 >into borrowers for indefinite debarments (which looks not very consistent). > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/updatedatabase.pl | 16 +++++++++++++++- > 1 files changed, 15 insertions(+), 1 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 194df7d..afbdf64 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7613,8 +7613,13 @@ CREATE TABLE borrower_debarments ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > }); > >+ # debarments with end date > $dbh->do(q{ >-INSERT INTO borrower_debarments ( borrowernumber, expiration, comment ) SELECT borrowernumber, debarred, debarredcomment FROM borrowers WHERE debarred IS NOT NULL >+INSERT INTO borrower_debarments ( borrowernumber, expiration, comment ) SELECT borrowernumber, debarred, debarredcomment FROM borrowers WHERE debarred IS NOT NULL AND debarred <> '9999-12-31' >+ }); >+ # debarments with no end date >+ $dbh->do(q{ >+INSERT INTO borrower_debarments ( borrowernumber, comment ) SELECT borrowernumber, debarredcomment FROM borrowers WHERE debarred = '9999-12-31' > }); > > $dbh->do(q{ >@@ -8106,6 +8111,15 @@ if(CheckVersion($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "3.15.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q{ >+ UPDATE borrower_debarments SET expiration = NULL WHERE expiration = '9999-12-31' >+ }); >+ print "Upgrade to $DBversion done (Bug 11846 - correct borrower_debarments with expiration 9999-12-31)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >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 11846
:
25637
|
26542
|
27079
| 27093