Bugzilla – Attachment 92576 Details for
Bug 23265
Update to DB revision 16.12.00.032 fails: Unknown column 'me.item_level_hold'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23265: (bug 12063 follow-up) Remove Koha::Holds from updatedatabase
Bug-23265-bug-12063-follow-up-Remove-KohaHolds-fro.patch (text/plain), 3.02 KB, created by
Victor Grousset/tuxayo
on 2019-09-03 15:31:36 UTC
(
hide
)
Description:
Bug 23265: (bug 12063 follow-up) Remove Koha::Holds from updatedatabase
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2019-09-03 15:31:36 UTC
Size:
3.02 KB
patch
obsolete
>From 076beddf283a623b804eff49a8d5fdf5435d1210 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 6 Aug 2019 09:09:18 -0500 >Subject: [PATCH] Bug 23265: (bug 12063 follow-up) Remove Koha::Holds from > updatedatabase > >Test plan: >Have a DB that fail the 16.12.00.032 update, then apply this patch and >verify the expiration dates > >RM: Please inforce this rule, no use of Koha:: in updatedatabase! > >Signed-off-by: Victor Grousset <victor.grousset@biblibre.com> >--- > installer/data/mysql/updatedatabase.pl | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 341cdcb65f..a4edfbbce9 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -14348,32 +14348,40 @@ if( CheckVersion( $DBversion ) ) { > $DBversion = '16.12.00.032'; > if( CheckVersion( $DBversion ) ) { > require Koha::Calendar; >- require Koha::Holds; > > $dbh->do(q{ > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) > VALUES ('ExcludeHolidaysFromMaxPickUpDelay', '0', 'If ON, reserves max pickup delay takes into account the closed days.', NULL, 'Integer'); > }); > >- my $waiting_holds = Koha::Holds->search({ found => 'W', priority => 0 }); >+ my $waiting_holds = $dbh->selectall_arrayref(q| >+ SELECT expirationdate, waitingdate, branchcode >+ FROM reserves >+ WHERE found = 'W' AND priority = 0 >+ |); >+ my $update_sth = $dbh->prepare(q| >+ UPDATE reserves >+ SET expirationdate = ? >+ WHERE reserve_id = ? >+ |); > my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); >- while ( my $hold = $waiting_holds->next ) { >+ for my $hold ( @$waiting_holds ) { > > my $requested_expiration; >- if ($hold->expirationdate) { >- $requested_expiration = dt_from_string($hold->expirationdate); >+ if ($hold->{expirationdate}) { >+ $requested_expiration = dt_from_string($hold->{expirationdate}); > } > >- my $expirationdate = dt_from_string($hold->waitingdate); >+ my $expirationdate = dt_from_string($hold->{waitingdate}); > if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >- my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode ); >+ my $calendar = Koha::Calendar->new( branchcode => $hold->{branchcode} ); > $expirationdate = $calendar->days_forward( $expirationdate, $max_pickup_delay ); > } else { > $expirationdate->add( days => $max_pickup_delay ); > } > > my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0; >- $hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store; >+ $update_sth->execute($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd, $hold->{reserve_id}); > } > > SetVersion( $DBversion ); >-- >2.23.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 23265
:
92029
|
92576
|
92612