Bugzilla – Attachment 79853 Details for
Bug 8367
How long is a hold waiting for pickup at a more granular level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8367: Moved database update out of updatedatabase.pl into atomicupdates dir
Bug-8367-Moved-database-update-out-of-updatedataba.patch (text/plain), 5.03 KB, created by
Alex Buckley
on 2018-10-02 22:10:59 UTC
(
hide
)
Description:
Bug 8367: Moved database update out of updatedatabase.pl into atomicupdates dir
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-10-02 22:10:59 UTC
Size:
5.03 KB
patch
obsolete
>From 1d98f354eb34943fee3a992589a660c036e1038d Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 3 Oct 2018 09:25:45 +1300 >Subject: [PATCH] Bug 8367: Moved database update out of updatedatabase.pl into > atomicupdates dir > >--- > installer/data/mysql/atomicupdate/bug_8367.perl | 23 ++++++++++++++++++++ > installer/data/mysql/updatedatabase.pl | 29 ------------------------- > 2 files changed, 23 insertions(+), 29 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_8367.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_8367.perl b/installer/data/mysql/atomicupdate/bug_8367.perl >new file mode 100644 >index 0000000..464b3a6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_8367.perl >@@ -0,0 +1,23 @@ >+my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0; #MaxPickupDelay >+$dbh->do(q{ DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay'; }); >+$dbh->do(q{ DELETE FROM systempreferences WHERE variable='ExpireReservesOnHolidays'; }); >+# //DELETE FROM systempreferences WHERE variable='ExpireReservesMaxPickUpDelay'; #This syspref is not needed and would be better suited to be calculated from the holdspickupwait >+# //ExpireReservesMaxPickUpDelayCharge #This could be added as a column to the issuing rules. >+$dbh->do(q{ ALTER TABLE issuingrules ADD COLUMN holdspickupwait INT(11) NULL default NULL AFTER reservesallowed; }); >+$dbh->do(q{ ALTER TABLE reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; }); >+$dbh->do(q{ ALTER TABLE old_reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; }); >+my $sth = $dbh->prepare(q{ >+ UPDATE issuingrules SET holdspickupwait = ? >+}); >+$sth->execute( $maxpickupdelay ) if $maxpickupdelay; #Don't want to accidentally nullify all! >+##Populate the lastpickupdate-column from existing 'ReservesMaxPickUpDelay' >+print "Populating the new lastpickupdate-column for all waiting holds. This might take a while.\n"; >+$sth = $dbh->prepare(q{ SELECT * FROM reserves WHERE found = 'W'; }); >+$sth->execute( ); >+my $dtdur = DateTime::Duration->new( days => 0 ); >+ >+while ( my $res = $sth->fetchrow_hashref ) { >+ C4::Reserves::MoveWaitingdate( $res, $dtdur ); #We call MoveWaitingdate with a 0 duration to simply recalculate the lastpickupdate and store the new values to DB. >+} >+print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupwait and reserves.lastpickupdate. Populates introduced columns from the expiring ReservesMaxPickUpDelay. Deletes the ReservesMaxPickUpDelay and ExpireReservesOnHolidays -sysprefs)\n"; >+ >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 5b57b7c..90c6100 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -16066,35 +16066,6 @@ if ( CheckVersion($DBversion) ) { > print "Upgrade to $DBversion done (18.05.02 release)\n"; > } > >- >-$DBversion = "18.06.00.XXX"; >-if ( CheckVersion($DBversion) ) { >- my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0; #MaxPickupDelay >- $dbh->do(q{ DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay'; }); >- $dbh->do(q{ DELETE FROM systempreferences WHERE variable='ExpireReservesOnHolidays'; }); >- # //DELETE FROM systempreferences WHERE variable='ExpireReservesMaxPickUpDelay'; #This syspref is not needed and would be better suited to be calculated from the holdspickupwait >- # //ExpireReservesMaxPickUpDelayCharge #This could be added as a column to the issuing rules. >- $dbh->do(q{ ALTER TABLE issuingrules ADD COLUMN holdspickupwait INT(11) NULL default NULL AFTER reservesallowed; }); >- $dbh->do(q{ ALTER TABLE reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; }); >- $dbh->do(q{ ALTER TABLE old_reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; }); >- my $sth = $dbh->prepare(q{ >- UPDATE issuingrules SET holdspickupwait = ? >- }); >- $sth->execute( $maxpickupdelay ) if $maxpickupdelay; #Don't want to accidentally nullify all! >- >- ##Populate the lastpickupdate-column from existing 'ReservesMaxPickUpDelay' >- print "Populating the new lastpickupdate-column for all waiting holds. This might take a while.\n"; >- $sth = $dbh->prepare(q{ SELECT * FROM reserves WHERE found = 'W'; }); >- $sth->execute( ); >- my $dtdur = DateTime::Duration->new( days => 0 ); >- >- while ( my $res = $sth->fetchrow_hashref ) { >- C4::Reserves::MoveWaitingdate( $res, $dtdur ); #We call MoveWaitingdate with a 0 duration to simply recalculate the lastpickupdate and store the new values to DB. >- } >- print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupwait and reserves.lastpickupdate. Populates introduced columns from the expiring ReservesMaxPickUpDelay. Deletes the ReservesMaxPickUpDelay and ExpireReservesOnHolidays -sysprefs)\n"; >- SetVersion($DBversion); >-} >- > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. > >-- >2.1.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 8367
:
12130
|
13139
|
13602
|
13603
|
13604
|
13624
|
15334
|
15335
|
15369
|
15498
|
15613
|
15658
|
15659
|
19093
|
19094
|
19095
|
19096
|
19104
|
19105
|
19107
|
19108
|
19116
|
19180
|
19181
|
19182
|
19360
|
19361
|
19362
|
20300
|
20301
|
20302
|
20303
|
20304
|
32786
|
32826
|
32884
|
32885
|
32916
|
32930
|
42706
|
42754
|
79790
|
79791
|
79798
|
79799
|
79800
|
79853
|
79854
|
79855
|
79859
|
92412
|
92413
|
92414
|
92415
|
92416
|
92417
|
92418
|
92419
|
92420
|
92421
|
92422
|
92423
|
92424
|
92425
|
92426
|
92427
|
92428
|
92958
|
92959
|
92960
|
92961
|
103425
|
113211
|
117284
|
118017
|
118021
|
124568
|
125087
|
131299
|
131300
|
131301
|
131302
|
131646
|
131647
|
131718
|
131719
|
131720
|
131722
|
131723
|
131724
|
133089
|
133090
|
133091
|
133092
|
133093
|
133094
|
142897
|
142898
|
142899
|
142900
|
142901
|
142902
|
142903
|
144097
|
144098
|
144099
|
144100
|
144101
|
144102
|
144103
|
144146
|
145644
|
145657
|
147798
|
147799
|
147800
|
147801
|
147802
|
147803
|
147804
|
147805
|
147806
|
147807
|
148536
|
148537
|
148538
|
148539
|
148540
|
148541
|
148542
|
148543
|
148544
|
148545
|
150437
|
150438
|
150439
|
153235
|
153237
|
153238
|
153239
|
153240
|
153241
|
153242
|
153243
|
153244
|
153245
|
153246
|
157138
|
157139
|
157140
|
157141
|
157142
|
157143
|
157144
|
157145
|
157146
|
157147
|
157148
|
157149
|
157150
|
157298
|
157343
|
157344
|
157345
|
157346
|
157347
|
157348
|
157349
|
157350
|
157351
|
157352
|
157354
|
157355
|
157356
|
157697
|
157698
|
157699
|
157700
|
157701
|
157702
|
157703
|
157704
|
157705
|
157706
|
157707
|
157708
|
157709
|
157715
|
158023
|
158024
|
158025
|
158026
|
158027
|
158028
|
158029
|
158030
|
158031
|
158032
|
158033
|
158034
|
158035
|
158254
|
158255