Lines 16066-16100
if ( CheckVersion($DBversion) ) {
Link Here
|
16066 |
print "Upgrade to $DBversion done (18.05.02 release)\n"; |
16066 |
print "Upgrade to $DBversion done (18.05.02 release)\n"; |
16067 |
} |
16067 |
} |
16068 |
|
16068 |
|
16069 |
|
|
|
16070 |
$DBversion = "18.06.00.XXX"; |
16071 |
if ( CheckVersion($DBversion) ) { |
16072 |
my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0; #MaxPickupDelay |
16073 |
$dbh->do(q{ DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay'; }); |
16074 |
$dbh->do(q{ DELETE FROM systempreferences WHERE variable='ExpireReservesOnHolidays'; }); |
16075 |
# //DELETE FROM systempreferences WHERE variable='ExpireReservesMaxPickUpDelay'; #This syspref is not needed and would be better suited to be calculated from the holdspickupwait |
16076 |
# //ExpireReservesMaxPickUpDelayCharge #This could be added as a column to the issuing rules. |
16077 |
$dbh->do(q{ ALTER TABLE issuingrules ADD COLUMN holdspickupwait INT(11) NULL default NULL AFTER reservesallowed; }); |
16078 |
$dbh->do(q{ ALTER TABLE reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; }); |
16079 |
$dbh->do(q{ ALTER TABLE old_reserves ADD COLUMN lastpickupdate DATE NULL default NULL AFTER suspend_until; }); |
16080 |
my $sth = $dbh->prepare(q{ |
16081 |
UPDATE issuingrules SET holdspickupwait = ? |
16082 |
}); |
16083 |
$sth->execute( $maxpickupdelay ) if $maxpickupdelay; #Don't want to accidentally nullify all! |
16084 |
|
16085 |
##Populate the lastpickupdate-column from existing 'ReservesMaxPickUpDelay' |
16086 |
print "Populating the new lastpickupdate-column for all waiting holds. This might take a while.\n"; |
16087 |
$sth = $dbh->prepare(q{ SELECT * FROM reserves WHERE found = 'W'; }); |
16088 |
$sth->execute( ); |
16089 |
my $dtdur = DateTime::Duration->new( days => 0 ); |
16090 |
|
16091 |
while ( my $res = $sth->fetchrow_hashref ) { |
16092 |
C4::Reserves::MoveWaitingdate( $res, $dtdur ); #We call MoveWaitingdate with a 0 duration to simply recalculate the lastpickupdate and store the new values to DB. |
16093 |
} |
16094 |
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"; |
16095 |
SetVersion($DBversion); |
16096 |
} |
16097 |
|
16098 |
# SEE bug 13068 |
16069 |
# SEE bug 13068 |
16099 |
# if there is anything in the atomicupdate, read and execute it. |
16070 |
# if there is anything in the atomicupdate, read and execute it. |
16100 |
|
16071 |
|
16101 |
- |
|
|