From d910b03b7830f2f1ac8b1beaf97bb7b876b696ba Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Tue, 6 Nov 2012 09:50:48 +0100 Subject: [PATCH 1/3] Bug 8443: Suggestions publication year and copyright date --- C4/Suggestions.pm | 6 +++--- .../prog/en/modules/suggestion/suggestion.tt | 20 ++++++++++---------- suggestion/suggestion.pl | 19 +++++++++++++++++-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 0cb484a..3c6a3ed 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -121,7 +121,7 @@ sub SearchSuggestion { push @sql_params,'%'.$s.'%'; " and suggestions.$_ like ? "; } else { () } - } qw( title author isbn publishercode collectiontitle ) + } qw( title author isbn publishercode copyrightdate collectiontitle ) ); my $userenv = C4::Context->userenv; @@ -137,7 +137,7 @@ sub SearchSuggestion { foreach my $field (grep { my $fieldname=$_; any {$fieldname eq $_ } qw< STATUS branchcode itemtype suggestedby managedby acceptedby - bookfundid biblionumber + budgetid biblionumber >} keys %$suggestion ) { if ($$suggestion{$field}){ @@ -155,7 +155,7 @@ sub SearchSuggestion { my $from = $_ . "_from"; my $to = $_ . "_to"; if ($$suggestion{$from} || $$suggestion{$to}) { - push @query, " AND suggestions.suggesteddate BETWEEN '" + push @query, " AND suggestions.$_ BETWEEN '" . (format_date_in_iso($$suggestion{$from}) || 0000-00-00) . "' AND '" . (format_date_in_iso($$suggestion{$to}) || $today) . "'"; } } 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..d1b38ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -493,7 +493,7 @@ $(document).ready(function() { calcNewsuggTotal(); });
  • -
  • +
  • Suggestion information

    @@ -511,39 +511,39 @@ $(document).ready(function() { calcNewsuggTotal(); });
  • -
  • [% suggesteddate %] +
  • - + - +
  • -
  • [% manageddate %] +
  • - + - +
  • -
  • [% accepteddate %] +
  • - + - +
  • diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 99f38eb..a2073cd 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -190,10 +190,22 @@ if ($op=~/else/) { $displayby||="STATUS"; delete $$suggestion_ref{'branchcode'} if($displayby eq "branchcode"); + # distinct values of display by my $criteria_list=GetDistinctValues("suggestions.".$displayby); + my (@criteria_dv, $criteria_has_empty); + foreach (@$criteria_list) { + if ($_->{value}) { + push @criteria_dv, $_->{value}; + } else { + $criteria_has_empty = 1; + } + } + # agregate null and empty values under empty value + push @criteria_dv, '' if $criteria_has_empty; + my @allsuggestions; my $reasonsloop = GetAuthorisedValues("SUGGEST"); - foreach my $criteriumvalue ( map { $$_{'value'} } @$criteria_list ) { + foreach my $criteriumvalue ( @criteria_dv ) { # By default, display suggestions from current working branch if(not defined $branchfilter) { $$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; @@ -356,15 +368,18 @@ $template->param( total => sprintf("%.2f", $$suggestion_ref{'total'}||0), ); +# lists of distinct values (without empty) for filters 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 ), + 'desc' => GetCriteriumDesc( $$_{'value'}, $field ) || $$_{'value'}, 'selected' => ($$suggestion_ref{$field}) ? $$_{'value'} eq $$suggestion_ref{$field} : 0, } + } grep { + $$_{'value'} } @$values_list; $hashlists{ lc($field) . "_loop" } = \@codes_list; } -- 1.7.9.5