Fixes bug reported by Colin Campbell where reserves.expiratedate was defaulting to '0000-00-00' instead of NULL.
Signed-off-by: Galen Charlton <[email protected]> --- C4/Reserves.pm | 6 +++++- installer/data/mysql/updatedatabase.pl | 6 ++++++ kohaversion.pl | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index b4c6b43..6328d17 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -142,7 +142,11 @@ sub AddReserve { my $const = lc substr( $constraint, 0, 1 ); $resdate = format_date_in_iso( $resdate ) if ( $resdate ); $resdate = C4::Dates->today( 'iso' ) unless ( $resdate ); - $expdate = format_date_in_iso( $expdate ) if ( $expdate ); + if ($expdate) { + $expdate = format_date_in_iso( $expdate ); + } else { + undef $expdate; # make reserves.expirationdate default to null rather than '0000-00-00' + } if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) { # Make room in reserves for this before those of a later reserve date $priority = _ShiftPriorityByDateAndPriority( $biblionumber, $resdate, $priority ); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 778319f..d5ccfe2 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3564,6 +3564,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.01.00.130"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("UPDATE reserves SET expirationdate = NULL WHERE expirationdate = '0000-00-00'"); + print "Upgrade done (change reserves.expirationdate values of 0000-00-00 to NULL (bug 1532)"; + SetVersion ($DBversion); +} =item DropAllForeignKeys($table) diff --git a/kohaversion.pl b/kohaversion.pl index 884c0e2..509c6e2 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.129'; + our $VERSION = '3.01.00.130'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 1.7.0 _______________________________________________ Koha-patches mailing list [email protected] http://lists.koha.org/mailman/listinfo/koha-patches
