Bugzilla – Attachment 30099 Details for
Bug 12375
Store serials enumeration data in separate fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12375 [1] - Update database
Bug-12375-1---Update-database.patch (text/plain), 2.68 KB, created by
Kyle M Hall (khall)
on 2014-07-25 13:31:54 UTC
(
hide
)
Description:
Bug 12375 [1] - Update database
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-07-25 13:31:54 UTC
Size:
2.68 KB
patch
obsolete
>From 0eded46081033241b96e8407538847a2a080ce07 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 23 Oct 2012 14:48:41 -0400 >Subject: [PATCH] Bug 12375 [1] - Update database > >Signed-off-by: Paul Landers <paul.landers@ttuhsc.edu> >--- > installer/data/mysql/updatedatabase.pl | 51 ++++++++++++++++++++++++++++++++ > 1 files changed, 51 insertions(+), 0 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 94bb4ff..bb549d1 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -37,6 +37,7 @@ use Getopt::Long; > use C4::Context; > use C4::Installer; > use C4::Dates; >+use Koha::Database; > > use MARC::Record; > use MARC::File::XML ( BinaryEncoding => 'utf8' ); >@@ -8577,6 +8578,56 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.17.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do(" >+ ALTER TABLE serial >+ ADD serialseq_x VARCHAR( 100 ) NULL DEFAULT NULL AFTER serialseq, >+ ADD serialseq_y VARCHAR( 100 ) NULL DEFAULT NULL AFTER serialseq_x, >+ ADD serialseq_z VARCHAR( 100 ) NULL DEFAULT NULL AFTER serialseq_y >+ "); >+ >+ my $schema = Koha::Database->new()->schema(); >+ my @subscriptions = $schema->resultset('Subscription')->all(); >+ >+ foreach my $subscription (@subscriptions) { >+ my $number_pattern = $subscription->numberpattern(); >+ >+ my @splits = split( /\{[XYZ]\}/, $number_pattern->numberingmethod() ); >+ >+ my @serials = >+ $schema->resultset('Serial') >+ ->search( { subscriptionid => $subscription->subscriptionid() } ); >+ >+ foreach my $serial (@serials) { >+ my $serialseq = $serial->serialseq(); >+ my ( $x, $y, $z ); >+ >+ ## We cannot split on multiple values at once, >+ ## so let's replace each of those values with __SPLIT__ >+ if (@splits) { >+ map( $serialseq =~ s/$_/__SPLIT__/, @splits ); >+ ( undef, $x, $y, $z ) = split( /__SPLIT__/, $serialseq ); >+ } >+ else >+ { ## Nothing to split on means the only thing in serialseq is {X} >+ $x = $serialseq; >+ } >+ >+ $serial->update( >+ { >+ serialseq_x => $x, >+ serialseq_y => $y, >+ serialseq_z => $z, >+ } >+ ); >+ } >+ } >+ >+ print "Upgrade to $DBversion done ( Bug 8956 - Split serials enumeration data into separate fields )\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 12375
:
28675
|
28676
|
28677
|
28678
|
28679
|
28680
|
28681
|
28682
|
28683
|
28843
|
28844
|
28845
|
28846
|
29928
|
29929
|
30099
|
30100
|
30101
|
30102
|
30103
|
30104
|
30108
|
35155
|
35156
|
35157
|
35158
|
35159
|
35160
|
35161
|
40710
|
40711
|
40712
|
40713
|
40714
|
40715
|
40716
|
46122
|
46123
|
46124
|
46125
|
46126
|
46127
|
46128
|
46319