Bugzilla – Attachment 14197 Details for
Bug 9307
Allow libraries to add/edit status for suggestion management.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9307 [2] - Allow libraries to add/edit status for suggestion management.
Bug-9307-2---Allow-libraries-to-addedit-status-for.patch (text/plain), 35.54 KB, created by
Kyle M Hall (khall)
on 2012-12-19 16:33:22 UTC
(
hide
)
Description:
Bug 9307 [2] - Allow libraries to add/edit status for suggestion management.
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-12-19 16:33:22 UTC
Size:
35.54 KB
patch
obsolete
>From b70a8b286bb187338524cc2a1f2098ec7d69be61 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 19 Dec 2012 11:17:19 -0500 >Subject: [PATCH] Bug 9307 [2] - Allow libraries to add/edit status for suggestion management. > >This patch moves the suggestion status from being hard coded values to being >a an authorised value list. In this way, statuses may be added and edited. > >This patch creates a new authorised value list SUGGESTION_STATUS with the same >list of statuses that were previously hard coded into Koha. >--- > .../data/mysql/en/mandatory/suggest_status.sql | 6 + > .../data/mysql/en/mandatory/suggest_status.txt | 1 + > .../prog/en/modules/suggestion/suggestion.tt | 163 +++++++++++--------- > .../opac-tmpl/prog/en/modules/opac-suggestions.tt | 7 +- > suggestion/suggestion.pl | 150 +++++++++--------- > 5 files changed, 177 insertions(+), 150 deletions(-) > create mode 100644 installer/data/mysql/en/mandatory/suggest_status.sql > create mode 100644 installer/data/mysql/en/mandatory/suggest_status.txt > >diff --git a/installer/data/mysql/en/mandatory/suggest_status.sql b/installer/data/mysql/en/mandatory/suggest_status.sql >new file mode 100644 >index 0000000..46e8ed6 >--- /dev/null >+++ b/installer/data/mysql/en/mandatory/suggest_status.sql >@@ -0,0 +1,6 @@ >+INSERT INTO authorised_values ( category, authorised_value, lib, lib_opac) VALUES >+('SUGGEST_STATUS', 'ACCEPTED', 'Accepted', 'Accepted'), >+('SUGGEST_STATUS', 'CHECKED', 'Checked', 'Checked'), >+('SUGGEST_STATUS', 'REJECTED', 'Rejected', 'Rejected'), >+('SUGGEST_STATUS', 'ORDERED', 'Ordered', 'Ordered'), >+('SUGGEST_STATUS', 'ASKED', 'Pending', 'Requested'); >diff --git a/installer/data/mysql/en/mandatory/suggest_status.txt b/installer/data/mysql/en/mandatory/suggest_status.txt >new file mode 100644 >index 0000000..e9e6119 >--- /dev/null >+++ b/installer/data/mysql/en/mandatory/suggest_status.txt >@@ -0,0 +1 @@ >+Default Koha system suggestion statuses >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 fb73fd1..0dc5712 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' %] > <title>Koha › Acquisitions › > [% IF ( op_save ) %] >@@ -194,12 +196,14 @@ $(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 %] >+ [% FOREACH s IN SuggestionStatuses %] >+ [% IF STATUS == s.authorised_value %] >+ [% s.lib %] >+ [% SET status_found = 1 %] >+ [% END %] > [% END %] >+ [% UNLESS status_found %]No Status[% END %] > </li> > <li> > <table> >@@ -208,18 +212,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 +294,39 @@ $(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> >+ [% 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> >@@ -364,21 +373,25 @@ $(document).ready(function() { calcNewsuggTotal(); }); > <h1>Suggestions management</h1> > > [% UNLESS ( notabs ) %] >-<div id="sorting" class="overlay">Sorting...</div> >-<div id="loadingtab" class="overlay">Loading tab...</div> >-<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="sorting" class="overlay">Sorting...</div> >+ <div id="loadingtab" class="overlay">Loading tab...</div> >+ <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.suggestiontype ) %] >+ [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %] >+ [% ELSE %] >+ No name >+ [% END %] >+ ([% suggestion.suggestions_loop.size %])</a></li> >+ [% END %] > </ul> > [% END %] > >@@ -422,42 +435,49 @@ $(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 %] >+ [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %] >+ [% 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> >- </div> > >+ <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label> >+ <select name="STATUS" id="STATUS[% suggestion.suggestiontype %]"> >+ <option value=""> -- Choose a status --</option> >+ [% 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 %]" /> > <input type="hidden" name="op" value="change" /> >@@ -498,16 +518,19 @@ $(document).ready(function() { calcNewsuggTotal(); }); > </fieldset> > <fieldset class="brief"><h4 class="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> >+ [% 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 3c62e55..2902c37 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,8 @@ $.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 %] >+ [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS, 1 ) %] > [% IF ( suggestions_loo.reason ) %]([% suggestions_loo.reason %])[% END %] > </td> > </tr> >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 94088f8..894abcd 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -51,6 +51,7 @@ sub Init { > # suggesteddate, when coming from the DB, needs to be formated > $suggestion->{'suggesteddate'} = format_date( $suggestion->{'suggesteddate'} ); > } >+ > foreach my $date (qw(rejecteddate accepteddate)) { > $suggestion->{$date} = ( > ( $suggestion->{$date} eq "0000-00-00" || $suggestion->{$date} eq "" ) >@@ -58,13 +59,12 @@ sub Init { > : format_date( $suggestion->{$date} ) > ); > } >+ > $suggestion->{'branchcode'} = C4::Context->userenv->{"branch"} unless ( $suggestion->{'branchcode'} ); > } > > sub GetCriteriumDesc { > my ( $criteriumvalue, $displayby ) = @_; >- return ( $criteriumvalue eq 'ASKED' ? "Pending" : ucfirst( lc($criteriumvalue) ) ) if ( $displayby =~ /status/i ); >- return ( GetBranchName($criteriumvalue) ) if ( $displayby =~ /branchcode/ ); > return ( GetSupportName($criteriumvalue) ) if ( $displayby =~ /itemtype/ ); > if ( $displayby =~ /suggestedby/ || $displayby =~ /managedby/ || $displayby =~ /acceptedby/ ) { > my $borr = C4::Members::GetMember( borrowernumber => $criteriumvalue ); >@@ -91,11 +91,11 @@ my $branchfilter = ( $displayby ne "branchcode" ) ? $input->param('branchco > my $tabcode = $input->param('tabcode'); > > # filter informations which are not suggestion related. >-my $suggestion_ref = $input->Vars; >+my $input_vars = $input->Vars; > >-delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field ); >-foreach ( keys %$suggestion_ref ) { >- delete $$suggestion_ref{$_} if ( !$$suggestion_ref{$_} && ( $op eq 'else' || $op eq 'change' ) ); >+delete $$input_vars{$_} foreach qw( suggestedbyme op displayby tabcode edit_field ); >+foreach ( keys %$input_vars ) { >+ delete $$input_vars{$_} if ( !$$input_vars{$_} && ( $op eq 'else' || $op eq 'change' ) ); > } > my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user( > { template_name => "suggestion/suggestion.tmpl", >@@ -109,71 +109,71 @@ my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user( > ## Operations > ## > if ( $op =~ /save/i ) { >- if ( $$suggestion_ref{"STATUS"} ) { >- if ( my $tmpstatus = lc( $$suggestion_ref{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) { >- $$suggestion_ref{ lc( $$suggestion_ref{"STATUS"} ) . "date" } = C4::Dates->today; >- $$suggestion_ref{ lc( $$suggestion_ref{"STATUS"} ) . "by" } = C4::Context->userenv->{number}; >+ if ( $$input_vars{"STATUS"} ) { >+ if ( my $tmpstatus = lc( $$input_vars{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) { >+ $$input_vars{ lc( $$input_vars{"STATUS"} ) . "date" } = C4::Dates->today; >+ $$input_vars{ lc( $$input_vars{"STATUS"} ) . "by" } = C4::Context->userenv->{number}; > } >- $$suggestion_ref{"manageddate"} = C4::Dates->today; >- $$suggestion_ref{"managedby"} = C4::Context->userenv->{number}; >+ $$input_vars{"manageddate"} = C4::Dates->today; >+ $$input_vars{"managedby"} = C4::Context->userenv->{number}; > } >- if ( $$suggestion_ref{'suggestionid'} > 0 ) { >- &ModSuggestion($suggestion_ref); >+ if ( $$input_vars{'suggestionid'} > 0 ) { >+ &ModSuggestion($input_vars); > } else { > ###FIXME:Search here if suggestion already exists. >- my $suggestions_loop = SearchSuggestion($suggestion_ref); >+ my $suggestions_loop = SearchSuggestion($input_vars); > if ( @$suggestions_loop >= 1 ) { > > #some suggestion are answering the request Donot Add > } else { > ## Adding some informations related to suggestion >- &NewSuggestion($suggestion_ref); >+ &NewSuggestion($input_vars); > } > > # empty fields, to avoid filter in "SearchSuggestion" > } >- map { delete $$suggestion_ref{$_} } keys %$suggestion_ref; >+ map { delete $$input_vars{$_} } keys %$input_vars; > $op = 'else'; > } elsif ( $op =~ /add/ ) { > > #Adds suggestion >- Init($suggestion_ref); >+ Init($input_vars); > $op = 'save'; > } elsif ( $op =~ /edit/ ) { > > #Edit suggestion >- $suggestion_ref = &GetSuggestion( $$suggestion_ref{'suggestionid'} ); >- Init($suggestion_ref); >+ $input_vars = &GetSuggestion( $$input_vars{'suggestionid'} ); >+ Init($input_vars); > $op = 'save'; > } elsif ( $op eq "change" ) { > > # set accepted/rejected/managed informations if applicable > # ie= if the librarian has choosen some action on the suggestions >- if ( $$suggestion_ref{"STATUS"} eq "ACCEPTED" ) { >- $$suggestion_ref{"accepteddate"} = C4::Dates->today; >- $$suggestion_ref{"acceptedby"} = C4::Context->userenv->{number}; >- } elsif ( $$suggestion_ref{"STATUS"} eq "REJECTED" ) { >- $$suggestion_ref{"rejecteddate"} = C4::Dates->today; >- $$suggestion_ref{"rejectedby"} = C4::Context->userenv->{number}; >+ if ( $$input_vars{"STATUS"} eq "ACCEPTED" ) { >+ $$input_vars{"accepteddate"} = C4::Dates->today; >+ $$input_vars{"acceptedby"} = C4::Context->userenv->{number}; >+ } elsif ( $$input_vars{"STATUS"} eq "REJECTED" ) { >+ $$input_vars{"rejecteddate"} = C4::Dates->today; >+ $$input_vars{"rejectedby"} = C4::Context->userenv->{number}; > } >- if ( $$suggestion_ref{"STATUS"} ) { >- $$suggestion_ref{"manageddate"} = C4::Dates->today; >- $$suggestion_ref{"managedby"} = C4::Context->userenv->{number}; >+ if ( $$input_vars{"STATUS"} ) { >+ $$input_vars{"manageddate"} = C4::Dates->today; >+ $$input_vars{"managedby"} = C4::Context->userenv->{number}; > } >- if ( my $reason = $$suggestion_ref{"reason$tabcode"} ) { >+ if ( my $reason = $$input_vars{"reason$tabcode"} ) { > if ( $reason eq "other" ) { >- $reason = $$suggestion_ref{"other_reason$tabcode"}; >+ $reason = $$input_vars{"other_reason$tabcode"}; > } >- $$suggestion_ref{'reason'} = $reason; >+ $$input_vars{'reason'} = $reason; > } >- delete $$suggestion_ref{$_} foreach ( "reason$tabcode", "other_reason$tabcode" ); >- foreach ( keys %$suggestion_ref ) { >- delete $$suggestion_ref{$_} unless ( $$suggestion_ref{$_} ); >+ delete $$input_vars{$_} foreach ( "reason$tabcode", "other_reason$tabcode" ); >+ foreach ( keys %$input_vars ) { >+ delete $$input_vars{$_} unless ( $$input_vars{$_} ); > } > foreach my $suggestionid (@editsuggestions) { > next unless $suggestionid; >- $$suggestion_ref{'suggestionid'} = $suggestionid; >- &ModSuggestion($suggestion_ref); >+ $$input_vars{'suggestionid'} = $suggestionid; >+ &ModSuggestion($input_vars); > } > $op = 'else'; > } elsif ( $op eq "delete" ) { >@@ -182,17 +182,17 @@ if ( $op =~ /save/i ) { > } > $op = 'else'; > } elsif ( $op eq 'show' ) { >- $suggestion_ref = &GetSuggestion( $$suggestion_ref{'suggestionid'} ); >- $$suggestion_ref{branchname} = GetBranchName $$suggestion_ref{branchcode}; >- my $budget = GetBudget $$suggestion_ref{budgetid}; >- $$suggestion_ref{budgetname} = $$budget{budget_name}; >- Init($suggestion_ref); >+ $input_vars = &GetSuggestion( $$input_vars{'suggestionid'} ); >+ $$input_vars{branchname} = GetBranchName $$input_vars{branchcode}; >+ my $budget = GetBudget $$input_vars{budgetid}; >+ $$input_vars{budgetname} = $$budget{budget_name}; >+ Init($input_vars); > } > if ( $op =~ /else/ ) { > $op = 'else'; > > $displayby ||= "STATUS"; >- delete $$suggestion_ref{'branchcode'} if ( $displayby eq "branchcode" ); >+ delete $$input_vars{'branchcode'} if ( $displayby eq "branchcode" ); > my $criteria_list = GetDistinctValues( "suggestions." . $displayby ); > my @allsuggestions; > my $reasonsloop = GetAuthorisedValues("SUGGEST"); >@@ -200,14 +200,14 @@ if ( $op =~ /else/ ) { > > # By default, display suggestions from current working branch > if ( not defined $branchfilter ) { >- $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; >+ $$input_vars{'branchcode'} = C4::Context->userenv->{'branch'}; > } >- my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; >+ my $definedvalue = defined $$input_vars{$displayby} && $$input_vars{$displayby} ne ""; > >- next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); >- $$suggestion_ref{$displayby} = $criteriumvalue; >+ next if ( $definedvalue && $$input_vars{$displayby} ne $criteriumvalue ); >+ $$input_vars{$displayby} = $criteriumvalue; > >- my $suggestions = &SearchSuggestion($suggestion_ref); >+ my $suggestions = &SearchSuggestion($input_vars); > foreach my $suggestion (@$suggestions) { > if ( $suggestion->{budgetid} ) { > my $bud = GetBudget( $suggestion->{budgetid} ); >@@ -223,13 +223,11 @@ if ( $op =~ /else/ ) { > } > push @allsuggestions, > { "suggestiontype" => $criteriumvalue || "suggest", >- "suggestiontypelabel" => GetCriteriumDesc( $criteriumvalue, $displayby ) || "", >- "suggestionscount" => scalar(@$suggestions), >- 'suggestions_loop' => $suggestions, >- 'reasonsloop' => $reasonsloop, >+ 'suggestions_loop' => $suggestions, >+ 'reasonsloop' => $reasonsloop, > }; > >- delete $$suggestion_ref{$displayby} unless $definedvalue; >+ delete $$input_vars{$displayby} unless $definedvalue; > } > > $template->param( >@@ -241,9 +239,9 @@ if ( $op =~ /else/ ) { > > foreach my $element (qw(managedby suggestedby acceptedby)) { > >- # $debug || warn $$suggestion_ref{$element}; >- if ( $$suggestion_ref{$element} ) { >- my $member = GetMember( borrowernumber => $$suggestion_ref{$element} ); >+ # $debug || warn $$input_vars{$element}; >+ if ( $$input_vars{$element} ) { >+ my $member = GetMember( borrowernumber => $$input_vars{$element} ); > $template->param( > $element . "_borrowernumber" => $$member{borrowernumber}, > $element . "_firstname" => $$member{firstname}, >@@ -255,7 +253,7 @@ foreach my $element (qw(managedby suggestedby acceptedby)) { > } > } > $template->param( >- %$suggestion_ref, >+ %$input_vars, > "op_$op" => 1, > dateformat => C4::Context->preference("dateformat"), > "op" => $op, >@@ -282,7 +280,7 @@ foreach my $thisbranch ( sort { $branches->{$a}->{'branchname'} cmp $branches->{ > value => $thisbranch, > branchname => $branches->{$thisbranch}->{'branchname'}, > selected => ( $branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter ) >- || ( $$suggestion_ref{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'} ) >+ || ( $$input_vars{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$input_vars{'branchcode'} ) > ); > push @branchloop, \%row; > } >@@ -298,8 +296,8 @@ my $supportlist = GetSupportList(); > > foreach my $support (@$supportlist) { > $$support{'selected'} = >- ( defined $$suggestion_ref{'itemtype'} ) >- ? $$support{'itemtype'} eq $$suggestion_ref{'itemtype'} >+ ( defined $$input_vars{'itemtype'} ) >+ ? $$support{'itemtype'} eq $$input_vars{'itemtype'} > : 0; > if ( $$support{'imageurl'} ) { > $$support{'imageurl'} = getitemtypeimagelocation( 'intranet', $$support{'imageurl'} ); >@@ -310,7 +308,7 @@ foreach my $support (@$supportlist) { > $template->param( itemtypeloop => $supportlist ); > $template->param( returnsuggestedby => $returnsuggestedby ); > >-my $patron_reason_loop = GetAuthorisedValues( "OPAC_SUG", $$suggestion_ref{'patronreason'} ); >+my $patron_reason_loop = GetAuthorisedValues( "OPAC_SUG", $$input_vars{'patronreason'} ); > $template->param( patron_reason_loop => $patron_reason_loop ); > > #Budgets management >@@ -328,22 +326,22 @@ foreach my $budget ( @{$budgets} ) { > > ## Please see file perltidy.ERR > $budget->{'selected'} = 1 >- if ( $$suggestion_ref{'budgetid'} >- && $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'} ); >+ if ( $$input_vars{'budgetid'} >+ && $budget->{'budget_id'} eq $$input_vars{'budgetid'} ); > > push @budgets_loop, $budget; > } > > $template->param( budgetsloop => \@budgets_loop ); >-$template->param( "statusselected_$$suggestion_ref{'STATUS'}" => 1 ) if ( $$suggestion_ref{'STATUS'} ); >+$template->param( "selected_status" => $$input_vars{'STATUS'} ) if ( $$input_vars{'STATUS'} ); > > # get currencies and rates > my @rates = GetCurrencies(); > my $count = scalar @rates; > my $active_currency = GetCurrency(); > my $selected_currency; >-if ( $$suggestion_ref{'currency'} ) { >- $selected_currency = $$suggestion_ref{'currency'}; >+if ( $$input_vars{'currency'} ) { >+ $selected_currency = $$input_vars{'currency'}; > } else { > $selected_currency = $active_currency->{currency}; > } >@@ -360,22 +358,24 @@ for ( my $i = 0 ; $i < $count ; $i++ ) { > $template->param( loop_currency => \@loop_currency ); > > $template->param( >- price => sprintf( "%.2f", $$suggestion_ref{'price'} || 0 ), >- total => sprintf( "%.2f", $$suggestion_ref{'total'} || 0 ), >+ price => sprintf( "%.2f", $$input_vars{'price'} || 0 ), >+ total => sprintf( "%.2f", $$input_vars{'total'} || 0 ), > ); > > my %hashlists; > foreach my $field (qw(managedby acceptedby suggestedby budgetid)) { > my $values_list; > $values_list = GetDistinctValues( "suggestions." . $field ); >- my @codes_list = map { >- { 'code' => $$_{'value'}, >- 'desc' => GetCriteriumDesc( $$_{'value'}, $field ), >- 'selected' => ( $$suggestion_ref{$field} ) ? $$_{'value'} eq $$suggestion_ref{$field} : 0, >- } >- } @$values_list; >+ my @codes_list = >+ map { { 'code' => $$_{'value'}, 'desc' => GetCriteriumDesc( $$_{'value'}, $field ), 'selected' => ( $$input_vars{$field} ) ? $$_{'value'} eq $$input_vars{$field} : 0, } } >+ @$values_list; > $hashlists{ lc($field) . "_loop" } = \@codes_list; > } > $template->param(%hashlists); >-$template->param( DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); >+ >+$template->param( >+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >+ SuggestionStatuses => GetAuthorisedValues('SUGGEST_STATUS'), >+); >+ > output_html_with_http_headers $input, $cookie, $template->output; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9307
:
14196
|
14197
|
14211
|
14684
|
16648
|
16785
|
19085
|
19112
|
19113