From: Galen Charlton Date: Wed, 2 Aug 2017 15:49:08 +0000 (-0400) Subject: LP#1189989: (follow-up) ignore invalid thaw date X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=64008ef2f43d4d7c964e9b1f49639713a16e322f;p=evergreen%2Fpines.git LP#1189989: (follow-up) ignore invalid thaw date This patch ensures that the specified thaw date is valid, as otherwise specifying a thaw date of "13/08/2017" (when, at present, only dates of the form mm/dd/yyyy are accepted) would result in an Apache internal server error. If an invalid date is supplied, the thaw date is ignored, meaning that the hold request will be placed as suspended but will not automatically reactivate. Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 9c5f14d1db..765ecf39a3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -12,6 +12,7 @@ use Digest::MD5 qw(md5_hex); use Data::Dumper; $Data::Dumper::Indent = 0; use DateTime; +use DateTime::Format::ISO8601; my $U = 'OpenILS::Application::AppUtils'; sub prepare_extended_user_info { @@ -1040,7 +1041,13 @@ sub load_place_hold { # We should use a date input type on the forms once it is supported by Firefox. # I didn't do that now because it is not available in a general release. if ($cgi->param('thaw_date') =~ m:^(\d{2})/(\d{2})/(\d{4})$:){ - $ctx->{thaw_date} = "$3-$1-$2"; + eval { + my $dt = DateTime::Format::ISO8601->parse_datetime("$3-$1-$2"); + $ctx->{thaw_date} = $dt->ymd; + }; + if ($@) { + $logger->warn("ignoring invalid thaw_date when placing hold request"); + } } }