# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
-$VERSION = "16.12.00.031";
+$VERSION = "16.12.00.032";
sub version {
return $VERSION;
+++ /dev/null
-$DBversion = 'XXX';
-if( CheckVersion( $DBversion ) ) {
- require Koha::Calendar;
- require Koha::Holds;
-
- my $waiting_holds = Koha::Holds->search({ found => 'W', priority => 0 });
- my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
- while ( my $hold = $waiting_holds->next ) {
-
- my $requested_expiration;
- if ($hold->expirationdate) {
- $requested_expiration = dt_from_string($hold->expirationdate);
- }
-
- my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode );
- my $expirationdate = dt_from_string();
- $expirationdate->add(days => $max_pickup_delay);
-
- if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
- $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
- }
-
- my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0;
- $hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store;
- }
-
- SetVersion( $DBversion );
- print "Upgrade to $DBversion done (Bug 12063 - Update reserves.expirationdate)\n";
-}
print "Upgrade to $DBversion done (Bug 15108: OAI-PMH provider improvements)\n";
}
+$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 $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
+ while ( my $hold = $waiting_holds->next ) {
+
+ my $requested_expiration;
+ if ($hold->expirationdate) {
+ $requested_expiration = dt_from_string($hold->expirationdate);
+ }
+
+ my $calendar = Koha::Calendar->new( branchcode => $hold->branchcode );
+ my $expirationdate = dt_from_string();
+ $expirationdate->add(days => $max_pickup_delay);
+
+ if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
+ $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay );
+ }
+
+ my $cmp = $requested_expiration ? DateTime->compare($requested_expiration, $expirationdate) : 0;
+ $hold->expirationdate($cmp == -1 ? $requested_expiration->ymd : $expirationdate->ymd)->store;
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 12063 - Update reserves.expirationdate)\n";
+}
+
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.