From f3b2b20bb8d1dde8d1126c95d197249df51849b2 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Wed, 3 Jul 2013 08:26:06 +0200 Subject: [PATCH] Bug 10519: Suggestions: 'Organize by' and correct display of tab descriptions broken The tabbed display in suggestions offers different options to organize the tabs. The descriptions on the tabs and some of the search options were not working correctly. To test: - Add several suggestions to your installation, make sure you have: - suggestions from various libraries and at least one for 'Any library' that has been created from the intranet - suggestions from different users - suggestions with different status - suggestions with different selected itypes Test all the 'organize by' options, make sure that the tabs have correct descriptions. - Add 1 or 2 custom status to SUGGEST_STATUS authorized value. - Verify display is still correct and your new status are displayed. Test setting the library option in the acquisition section of the filters keeps "Any" when you select it, so you can make use of the 'organize by libraries'. Before this patch the pull down would always jump back to your own branch. Note: Patch best tested in combination with bug 4907. Conflicts: suggestion/suggestion.pl Signed-off-by: Kyle M Hall --- .../prog/en/modules/suggestion/suggestion.tt | 28 ++++++++++++-------- suggestion/suggestion.pl | 15 ++++++++--- 2 files changed, 28 insertions(+), 15 deletions(-) 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 0b4a4ab..0f8942c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -422,19 +422,25 @@ $(document).ready(function() { calcNewsuggTotal(); }); [% 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 ) %] + [% IF (displayby == "STATUS") %] + [% 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 + [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]Unknown + [% ELSIF ( suggestion.suggestiontype ) %] + [% KohaAuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) %] + [% ELSE %] + Unknown + [% END %] [% ELSE %] - No name + [% IF (suggestion.suggestiontypelabel == "Any") %]Any library + [% ELSE %][% suggestion.suggestiontypelabel %][% END %] [% END %] + [% ELSE %] + Unknown [% END %] ([% suggestion.suggestions_loop.size %]) diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 6d8350f..d0b0965 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -58,11 +58,17 @@ sub Init{ sub GetCriteriumDesc{ my ($criteriumvalue,$displayby)=@_; - unless ( grep { /$criteriumvalue/ } qw(ASKED ACCEPTED REJECTED CHECKED ORDERED AVAILABLE) ) { + if ($displayby =~ /status/i ) { + if ( grep { /$criteriumvalue/ } qw(ASKED ACCEPTED REJECTED CHECKED ORDERED AVAILABLE) ) { + return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) + } + else { return GetAuthorisedValueByCode('SUGGEST_STATUS', $criteriumvalue ) || $criteriumvalue; + } + } + if ($displayby =~/branchcode/) { + return (GetBranchName($criteriumvalue)) || "Any"; } - 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); @@ -86,6 +92,7 @@ my $returnsuggested = $input->param('returnsuggested'); my $managedby = $input->param('managedby'); my $displayby = $input->param('displayby') || ''; my $tabcode = $input->param('tabcode'); +my $branchcodesel = $input->param('branchcode'); # filter informations which are not suggestion related. my $suggestion_ref = $input->Vars; @@ -209,7 +216,7 @@ if ($op=~/else/) { my $reasonsloop = GetAuthorisedValues("SUGGEST"); foreach my $criteriumvalue ( @criteria_dv ) { # By default, display suggestions from current working branch - unless ( exists $$suggestion_ref{'branchcode'} ) { + unless ( exists $$suggestion_ref{'branchcode'} || $branchcodesel eq "__ANY__" ) { $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; } my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; -- 1.7.2.5