Bug 13731: Suggestions reason does not save on updating the status
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 23 Feb 2015 11:32:33 +0000 (12:32 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 2 Mar 2015 14:47:24 +0000 (15:47 +0100)
On the suggestion list view, if you set a status, it won't be saved.

Test plan:
1/ Create a suggestion
2/ Go on the suggestion list view (suggestion/suggestion.pl)
3/ Select a suggestion and marked it as "rejected" (or the status you
want) and choose a reason
4/ Save
5/ Browse you suggestions DB table (using your favorite MySQL CLI) and
verify that the "reason" field is correctly filled.

Works as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as expected, thx!

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

suggestion/suggestion.pl

index b54703a..3d10111 100755 (executable)
@@ -176,14 +176,11 @@ elsif ($op eq "change" ) {
     }
     if ( my $reason = $$suggestion_ref{"reason$tabcode"}){
         if ( $reason eq "other" ) {
-                $reason = $$suggestion_ref{"other_reason$tabcode"};
+            $reason = $$suggestion_ref{"other_reason$tabcode"};
         }
-        $$suggestion_ref{'reason'}=$reason;
-    }
-    delete $$suggestion_ref{$_} foreach ("reason$tabcode", "other_reason$tabcode");
-     foreach (keys %$suggestion_ref){
-        delete $$suggestion_ref{$_} unless ($$suggestion_ref{$_});
+        $suggestion_only->{reason}=$reason;
     }
+
     foreach my $suggestionid (@editsuggestions) {
         next unless $suggestionid;
         $suggestion_only->{'suggestionid'}=$suggestionid;