Bug 23854: Fix failure on dates when editing a suggestion
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 22 Oct 2019 09:10:59 +0000 (11:10 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 13 Nov 2019 17:16:24 +0000 (17:16 +0000)
- Watch plack-error-log
- Change an accepted suggestion to 'No Status'
- Verify error in the logs (use strict mode, depending on DBMS version)
- Status changed was not saved
- Apply patch
- Verify the error is gone, change is saved now.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
suggestion/suggestion.pl

index e1fca26..ef153ba 100755 (executable)
@@ -123,8 +123,11 @@ my $branchfilter = $input->param('branchcode') || C4::Context->userenv->{'branch
 ##  Operations
 ##
 if ( $op =~ /save/i ) {
-    $suggestion_only->{suggesteddate} = dt_from_string( $suggestion_only->{suggesteddate} )
-        if $suggestion_only->{suggesteddate};
+
+    for my $date_key ( qw( suggesteddate manageddate accepteddate rejecteddate ) ) {
+        $suggestion_only->{$date_key} = dt_from_string( $suggestion_only->{$date_key} )
+            if $suggestion_only->{$date_key};
+    }
 
     if ( $suggestion_only->{"STATUS"} ) {
         if ( my $tmpstatus = lc( $suggestion_only->{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) {