From aecbe07af9bf3bb5f23b7c1a3180c20e64e65984 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 20 Dec 2012 09:31:23 -0500 Subject: [PATCH] Bug 9307 - Allow libraries to add/edit status for suggestion management. This patch allows for the addition of new suggestion status by adding authorised values of the category SUGGEST_STATUS I sign it off. Details of my test plan : 1. Applying the patch 2. Checking existing suggestions, in staff view and opac : ok 3. Creating a new suggestion in staff and in opac : ok 4. Moving a suggestion into one of the old categories : ok 5. Adding a new authorized value category named SUGGEST_VALUES and fill it with 3 values : value Description Description (OPAC) =)> tata tatapro tataopac titi titipro titiopac toto totopro totoopac For "tata", I defined a branch restriction on branche B. 6. Connecting in staff interface as a librarian of branch A : I could only use codes titipro and totopro. On OPAC, these codes were displayed as totoopac and titiopac 7. Connecting as librarian of branch B : I could use the 3 codes 8. Checking tabs visible : new tabs for tata, titi, toto, but also a new "Unknown" tab with 0 record. Maybe point 8 could be fixed in a followup. I sign off the patch. Signed-off-by: Mathieu Saby --- .../prog/en/modules/admin/authorised_values.tt | 2 +- .../prog/en/modules/help/suggestion/suggestion.tt | 2 + .../prog/en/modules/suggestion/suggestion.tt | 273 +++++++++++++++----- .../opac-tmpl/prog/en/modules/opac-suggestions.tt | 15 +- suggestion/suggestion.pl | 7 + 5 files changed, 225 insertions(+), 74 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 411a93a..f45749b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -81,7 +81,7 @@ $(document).ready(function() {
  1. [% IF ( action_add_category ) %] - + [% ELSE %]Category [% category %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/suggestion/suggestion.tt index 1c923b5..b00ecf9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/suggestion/suggestion.tt @@ -36,6 +36,8 @@

    Once you have clicked 'Submit' the suggestion will be moved to the matching tab. The status will also be updated on the patron's account in the OPAC and an email notice will be sent to the patron using the template that matches the status you have chosen.

    +

    Customization: You can create additional custom suggestion statuses by creating new authorised values of the category SUGGEST_STATUS

    +

    See the full documentation for Purchase Suggestions in the manual (online).

    [% INCLUDE 'help-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 876c21e..c1f54e3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1,3 +1,5 @@ +[% USE KohaAuthorisedValues %] +[% USE KohaBranchName %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › [% IF ( op_save ) %] @@ -194,12 +196,28 @@ $(document).ready(function() { calcNewsuggTotal(); }); <ol> <li> <span class="label">Status:</span> - [% IF ( STATUS == 'ASKED' ) %]Pending - [% ELSIF ( STATUS == 'ACCEPTED' ) %]Accepted - [% ELSIF ( STATUS == 'CHECKED' ) %]Checked - [% ELSIF ( STATUS == 'REJECTED' ) %]Rejected - [% ELSE %]No Status + [% SET status_found = 0 %] + [% IF ( STATUS == 'ASKED' ) %] + Pending + [% SET status_found = 1 %] + [% ELSIF ( STATUS == 'ACCEPTED' ) %] + Accepted + [% SET status_found = 1 %] + [% ELSIF ( STATUS == 'CHECKED' ) %] + Checked + [% SET status_found = 1 %] + [% ELSIF ( STATUS == 'REJECTED' ) %] + Rejected + [% SET status_found = 1 %] + [% ELSE %] + [% FOREACH s IN SuggestionStatuses %] + [% IF STATUS == s.authorised_value %] + [% s.lib %] + [% SET status_found = 1 %] + [% END %] + [% END %] [% END %] + </li> <li> <table> @@ -208,18 +226,18 @@ $(document).ready(function() { calcNewsuggTotal(); }); <tr> <th><span class="label">Suggestion creation</span> </th> <td>[% suggesteddate %]</td> - <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %] + <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode | $KohaBranchName %] ([% suggestedby_description %])[% END %] </td> </tr> <tr> <th><span class="label">Suggestion management</span> </th> <td>[% manageddate %]</td> - <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode %] ([% managedby_description %])[% END %]</td> + <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $KohaBranchName %] ([% managedby_description %])[% END %]</td> </tr> <tr> <th><span class="label">Suggestion accepted</span> </th> <td>[% accepteddate %]</td> - <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]</td> + <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $KohaBranchName %] ([% acceptedby_description %])[% END %]</td> </tr> </tbody> </table></li></ol> @@ -290,34 +308,64 @@ $(document).ready(function() { calcNewsuggTotal(); }); </fieldset> <fieldset class="rows"> <legend>Suggestion management</legend> <ol> - [% IF ( suggestionid ) %]<li><label for="status">Status:</label><select id="STATUS" name="STATUS"><option value="">No Status</option> - [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Pending</option> - [% ELSE %]<option value="ASKED">Pending</option>[% END %] - [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option> - [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %] - [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option> - [% ELSE %]<option value="CHECKED">Checked</option>[% END %] - [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option> - [% ELSE %]<option value="REJECTED">Rejected</option>[% END %] - </select></li>[% END %] + [% IF ( suggestionid ) %] + <li> + <label for="status">Status:</label> + <select id="STATUS" name="STATUS"> + <option value="">No Status</option> + + [% IF (statusselected_ASKED ) %] + <option value="ASKED" selected="selected">Pending</option> + [% ELSE %] + <option value="ASKED">Pending</option> + [% END %] + + [% IF (statusselected_ACCEPTED ) %] + <option value="ACCEPTED" selected="selected">Accepted</option> + [% ELSE %] + <option value="ACCEPTED">Accepted</option> + [% END %] + + [% IF (statusselected_CHECKED ) %] + <option value="CHECKED" selected="selected">Checked</option> + [% ELSE %] + <option value="CHECKED">Checked</option> + [% END %] + + [% IF ( statusselected_REJECTED ) %] + <option value="REJECTED" selected="selected">Rejected</option> + [% ELSE %] + <option value="REJECTED">Rejected</option> + [% END %] + + [% FOREACH s IN SuggestionStatuses %] + [% IF s.authorised_value == selected_status %] + <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option> + [% ELSE %] + <option value="[% s.authorised_value %]">[% s.lib %]</option> + [% END %] + [% END %] + </select> + </li> + [% END %] <li><table> <thead><tr><th> </th><th>Date</th><th>By</th></tr></thead> <tbody> <tr> <th><label for="suggesteddate">Suggestion creation</label> </th> <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td> - <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %] + <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode | $KohaBranchName %] ([% suggestedby_description %])[% END %] </td> </tr> <tr> <th><label for="managedon">Suggestion management</label> </th> <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td> - <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode %] ([% managedby_description %])[% END %]</td> + <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $KohaBranchName %] ([% managedby_description %])[% END %]</td> </tr> <tr> <th><label for="accepteddate">Suggestion accepted</label> </th> <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td> - <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]</td> + <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $KohaBranchName %] ([% acceptedby_description %])[% END %]</td> </tr> </tbody> </table></li></ol> @@ -363,19 +411,34 @@ $(document).ready(function() { calcNewsuggTotal(); }); <h1>Suggestions management</h1> [% UNLESS ( notabs ) %] -<div id="suggestiontabs" class="toptabs"> -<ul class="ui-tabs-nav"> -[% FOREACH suggestion IN suggestions %] -[% IF ( suggestion.first ) %]<li class="ui-tabs-selected">[% ELSE %]<li>[% END %]<a href="#[% suggestion.suggestiontype %]">[% IF ( suggestion.suggestiontypelabel ) %] - [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending - [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted - [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked - [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected - [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available - [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered[% ELSE %] - [% suggestion.suggestiontypelabel %][% END %] - [% ELSE %]No name[% END %] ([% suggestion.suggestionscount %])</a></li> -[% END %] + <div id="suggestiontabs" class="toptabs"> + <ul class="ui-tabs-nav"> + [% FOREACH suggestion IN suggestions %] + [% IF ( suggestion.first ) %] + <li class="ui-tabs-selected"> + [% ELSE %] + <li> + [% END %] + + <a href="#[% suggestion.suggestiontype %]"> + [% IF ( suggestion.suggestiontypelabel ) %] + [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending + [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted + [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked + [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected + [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available + [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered + [% ELSE %][% suggestion.suggestiontypelabel %][% END %] + [% ELSE %] + [% IF ( suggestion.suggestiontype ) %] + [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %] + [% ELSE %] + No name + [% END %] + [% END %] + ([% suggestion.suggestions_loop.size %])</a></li> + + [% END %] </ul> [% END %] @@ -419,41 +482,88 @@ $(document).ready(function() { calcNewsuggTotal(); }); [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %] </td> <td> - [% suggestions_loo.branchcode %] + [% suggestions_loo.branchcode | $KohaBranchName %] </td> <td> [% suggestions_loo.budget_name %] </td> <td> - [% IF ( suggestions_loo.ASKED ) %]Pending[% END %] [% IF ( suggestions_loo.ACCEPTED ) %]Accepted[% END %] [% IF ( suggestions_loo.ORDERED ) %]Ordered[% END %] [% IF ( suggestions_loo.REJECTED ) %]Rejected[% END %] [% IF ( suggestions_loo.CHECKED ) %]Checked[% END %] [% IF ( suggestions_loo.reason ) %]<br />([% suggestions_loo.reason %])[% END %] + [% IF ( suggestions_loo.ASKED ) %] + Pending + [% ELSIF ( suggestions_loo.ACCEPTED ) %] + Accepted + [% ELSIF ( suggestions_loo.ORDERED ) %] + Ordered + [% ELSIF ( suggestions_loo.REJECTED ) %] + Rejected + [% ELSIF ( suggestions_loo.CHECKED ) %] + Checked + [% ELSIF KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %] + [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %] + [% END %] + + [% IF ( suggestions_loo.reason ) %] + <br />([% suggestions_loo.reason %]) + [% END %] </td> </tr> [% END %]</tbody> </table> <fieldset> <div id="select-reason[% suggestion.suggestiontype %]"> <div id="status[% suggestion.suggestiontype %]"> - <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label><select name="STATUS" id="STATUS[% suggestion.suggestiontype %]"> - <option value=""> -- Choose a status --</option> - [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Pending</option> - [% ELSE %]<option value="ASKED">Pending</option>[% END %] - [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option> - [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %] - [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option> - [% ELSE %]<option value="CHECKED">Checked</option>[% END %] - [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option> - [% ELSE %]<option value="REJECTED">Rejected</option>[% END %] - </select> - <label for="reason[% suggestion.suggestiontype %]">with this reason:</label> <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]"> - <option value=""> -- Choose a reason -- </option> - [% FOREACH reasonsloo IN suggestion.reasonsloop %] - <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option> - [% END %] - <option value="other">Others...</option> - </select> <span id="other_reason[% suggestion.suggestiontype %]"> - <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" value="please note your reason here..." /> <a href="#back[% suggestion.suggestiontype %]">Cancel</a> - </span> <strong style="padding: 0 1em;">OR:</strong> <label for="[% suggestion.suggestiontype %]delete">Delete selected</label> <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" /> - </div> + <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label> + <select name="STATUS" id="STATUS[% suggestion.suggestiontype %]"> + <option value=""> -- Choose a status --</option> + + [% IF (statusselected_ASKED ) %] + <option value="ASKED" selected="selected">Pending</option> + [% ELSE %] + <option value="ASKED">Pending</option> + [% END %] + + [% IF (statusselected_ACCEPTED ) %] + <option value="ACCEPTED" selected="selected">Accepted</option> + [% ELSE %] + <option value="ACCEPTED">Accepted</option> + [% END %] + + [% IF (statusselected_CHECKED ) %] + <option value="CHECKED" selected="selected">Checked</option> + [% ELSE %] + <option value="CHECKED">Checked</option> + [% END %] + + [% IF ( statusselected_REJECTED ) %] + <option value="REJECTED" selected="selected">Rejected</option> + [% ELSE %] + <option value="REJECTED">Rejected</option> + [% END %] + + [% FOREACH s IN SuggestionStatuses %] + <option value="[% s.authorised_value %]">[% s.lib %]</option> + [% END %] + </select> + + <label for="reason[% suggestion.suggestiontype %]">with this reason:</label> + <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]"> + <option value=""> -- Choose a reason -- </option> + [% FOREACH reasonsloo IN suggestion.reasonsloop %] + <option value="[% reasonsloo.lib %]">[% reasonsloo.lib %]</option> + [% END %] + <option value="other">Others...</option> + </select> + + <span id="other_reason[% suggestion.suggestiontype %]"> + <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype %]" name="other_reason[% suggestion.suggestiontype %]" value="please note your reason here..." /> + <a href="#back[% suggestion.suggestiontype %]">Cancel</a> + </span> + + <strong style="padding: 0 1em;">OR:</strong> + + <label for="[% suggestion.suggestiontype %]delete">Delete selected</label> + <input type="checkbox" name="op" id="[% suggestion.suggestiontype %]delete" /> </div> + </div> <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype %]" /> @@ -495,16 +605,45 @@ $(document).ready(function() { calcNewsuggTotal(); }); </fieldset> <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4> <ol> - <li><label for="STATUS"> Status:</label><select name="STATUS" id="STATUS"><option value="">Any</option> - [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Pending</option> - [% ELSE %]<option value="ASKED">Pending</option>[% END %] - [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option> - [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %] - [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option> - [% ELSE %]<option value="CHECKED">Checked</option>[% END %] - [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option> - [% ELSE %]<option value="REJECTED">Rejected</option>[% END %] - </select></li> + <li> + <label for="STATUS"> Status:</label> + <select name="STATUS" id="STATUS"> + <option value="">Any</option> + + [% IF (statusselected_ASKED ) %] + <option value="ASKED" selected="selected">Pending</option> + [% ELSE %] + <option value="ASKED">Pending</option> + [% END %] + + [% IF (statusselected_ACCEPTED ) %] + <option value="ACCEPTED" selected="selected">Accepted</option> + [% ELSE %] + <option value="ACCEPTED">Accepted</option> + [% END %] + + [% IF (statusselected_CHECKED ) %] + <option value="CHECKED" selected="selected">Checked</option> + [% ELSE %] + <option value="CHECKED">Checked</option> + [% END %] + + [% IF ( statusselected_REJECTED ) %] + <option value="REJECTED" selected="selected">Rejected</option> + [% ELSE %] + <option value="REJECTED">Rejected</option> + [% END %] + + [% FOREACH s IN SuggestionStatuses %] + [% IF s.authorised_value == selected_status %] + <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option> + [% ELSE %] + <option value="[% s.authorised_value %]">[% s.lib %]</option> + [% END %] + [% END %] + </select> + </li> + <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option> [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %] </select></li> diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt index 51f898c..b5a20a9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-suggestions.tt @@ -1,3 +1,4 @@ +[% USE KohaAuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › [% IF ( op_add ) %]Enter a new purchase suggestion[% END %] [% IF ( op_else ) %]Purchase Suggestions[% END %] @@ -216,12 +217,14 @@ $.tablesorter.addParser({ [% IF ( suggestions_loo.surnamemanagedby ) %][% suggestions_loo.surnamemanagedby %][% IF ( suggestions_loo.firstnamemanagedby ) %],[% END %] [% suggestions_loo.firstnamemanagedby %][% ELSE %] [% END %] </td> <td> - [% IF ( suggestions_loo.ASKED ) %]Requested[% END %] - [% IF ( suggestions_loo.CHECKED ) %]Checked by the library[% END %] - [% IF ( suggestions_loo.ACCEPTED ) %]Accepted by the library[% END %] - [% IF ( suggestions_loo.ORDERED ) %]Ordered by the library[% END %] - [% IF ( suggestions_loo.REJECTED ) %]Suggestion declined [% END %] - [% IF ( suggestions_loo.AVAILABLE ) %]Available in the library[% END %] + [% IF ( suggestions_loo.ASKED ) %]Requested + [% ELSIF ( suggestions_loo.CHECKED ) %]Checked by the library + [% ELSIF ( suggestions_loo.ACCEPTED ) %]Accepted by the library + [% ELSIF ( suggestions_loo.ORDERED ) %]Ordered by the library + [% ELSIF ( suggestions_loo.REJECTED ) %]Suggestion declined + [% ELSIF ( suggestions_loo.AVAILABLE ) %]Available in the library + [% ELSE %] [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %] [% END %] + [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %] </td> </tr> diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 4788266..27c7951 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -58,6 +58,9 @@ sub Init{ sub GetCriteriumDesc{ my ($criteriumvalue,$displayby)=@_; + unless ( grep { /$criteriumvalue/ } qw(ASKED ACCEPTED REJECTED CHECKED) ) { + return GetAuthorisedValueByCode('SUGGEST_STATUS', $criteriumvalue ) || "Unknown"; + } return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i); return (GetBranchName($criteriumvalue)) if ($displayby =~/branchcode/); return (GetSupportName($criteriumvalue)) if ($displayby =~/itemtype/); @@ -383,4 +386,8 @@ foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) { $hashlists{ lc($field) . "_loop" } = \@codes_list; } $template->param(%hashlists); +$template->param( + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + SuggestionStatuses => GetAuthorisedValues('SUGGEST_STATUS'), +); output_html_with_http_headers $input, $cookie, $template->output; -- 1.7.2.5