From e491ba33c888a1f0271ddb9c5f48a022d421b0c3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 18 Dec 2015 15:01:15 +0000 Subject: [PATCH] Bug 15332: Sent DateTime object to DBIx::Class, not formatted dates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If formatted dates are sent to DBIx::Class on update/insert, the date will be set as 0000-00-00 (except if the format is yyyy-mm-dd). Test plan: Use the batch patron modification tools to update the dateenrolled or dateexpiry values for at least 1 patron. Without this patch, the modified value will be updated to 0000-00-00, with this patch, the correct value will be set. Signed-off-by: Nick Clemens Signed-off-by: Marcel de Rooy Signed-off-by: Brendan A Gallagher (cherry picked from commit af7fb9cd48cdb47329e7b9bbe651e856e017aa13) Signed-off-by: Julian Maurice (cherry picked from commit d5fd02e4a17383e984c31e427dc2c64ce4726b51) Signed-off-by: Frédéric Demians --- tools/modborrowers.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl index 4172bc3c61..71588c02d3 100755 --- a/tools/modborrowers.pl +++ b/tools/modborrowers.pl @@ -35,6 +35,7 @@ use C4::Members::Attributes; use C4::Members::AttributeTypes qw/GetAttributeTypes_hashref/; use C4::Output; use List::MoreUtils qw /any uniq/; +use Koha::DateUtils qw( dt_from_string ); use Koha::List::Patron; my $input = new CGI; @@ -261,6 +262,10 @@ if ( $op eq 'do' ) { $infos->{$field} = "" if grep { /^$field$/ } @disabled; } + for my $field ( qw( dateenrolled dateexpiry ) ) { + $infos->{$field} = dt_from_string($infos->{$field}); + } + my @attributes = $input->param('patron_attributes'); my @attr_values = $input->param('patron_attributes_value'); -- 2.39.5