Bug 21048: Fix display of suggestion's status (SUGGEST_STATUS)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 11 Jul 2018 21:23:49 +0000 (18:23 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Wed, 8 Aug 2018 20:58:23 +0000 (20:58 +0000)
When a suggestion's status is set to a customized value (AV
SUGGEST_STATUS), the description is not always displayed correctly.

Test plan:
- Create different values for the AV SUGGEST_STATUS
- Create several suggestions
- Change the status using the SUGGEST_STATUS values
- Edit the suggestion and change again the status
- View the suggestions for a given patron
(members/purchase-suggestions.pl?borrowernumber=XX), the statuses must
displayed correctly

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt

index 6794bc0..0f37bbb 100644 (file)
                                     [% END %]
                                 </td>
                                 <td>
-                                    [% IF ( s.ASKED ) %]Requested[% END %]
-                                    [% IF ( s.CHECKED ) %]Checked by the library[% END %]
-                                    [% IF ( s.ACCEPTED ) %]Accepted by the library[% END %]
-                                    [% IF ( s.ORDERED ) %]Ordered by the library[% END %]
-                                    [% IF ( s.REJECTED ) %]Suggestion declined [% END %]
-                                    [% IF ( s.AVAILABLE ) %]Available in the library[% END %]
-                                    [% IF ( s.reason ) %]([% s.reason %])[% END %]
+                                    [% SWITCH s.STATUS %]
+                                    [% CASE "ASKED" %]<span>Requested</span>
+                                    [% CASE "CHECKED" %]<span>Checked by the library</span>
+                                    [% CASE "ACCEPTED" %]<span>Accepted by the library</span>
+                                    [% CASE "ORDERED" %]<span>Ordered by the library</span>
+                                    [% CASE "REJECTED" %]<span>Suggestion declined<span>
+                                    [% CASE "AVAILABLE" %]<span>Available in the library</span>
+                                    [% CASE %]
+                                        [% SET status_description = AuthorisedValues.GetByCode('SUGGEST_STATUS', s.STATUS) %]
+                                        [% IF status_description %]
+                                            [% status_description %]
+                                        [% ELSE %]
+                                            <span>Unknown</span>
+                                        [% END %]
+                                    [% END %]
+                                    [% IF s.reason %]([% s.reason %])[% END %]
                                 </td>
                             </tr>
                         [% END %]
index 16f4ccf..63bcab8 100644 (file)
                         [% END %]
 
                         [% FOREACH s IN SuggestionStatuses %]
-                            [% IF s.authorised_value == selected_status %]
+                            [% IF s.authorised_value == suggestion.STATUS %]
                                 <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
                             [% ELSE %]
                                 <option value="[% s.authorised_value %]">[% s.lib %]</option>