From 93d9313dab11054c74bf9c0fce026a52ba99feb3 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 11 Feb 2015 15:26:02 +0100 Subject: [PATCH] Bug 13392: QA fixes 1/ Add tests descriptions 2/ Do not use Koha::I18N for suggestion statuses, and add statuses from SUGGEST_STATUS authorised values 3/ Use copyrightdate instead of publicationyear which seems to be unused 4/ Display free text filters if there is no values in corresponding authorised values list 5/ Rename 'Branch' to 'Library' and 'Reject reason' to 'Reason' Signed-off-by: Nicole Engard --- .../en/includes/reports/display_values_status.inc | 12 ++++++++++ .../prog/en/includes/reports/fields.inc | 10 ++++---- .../prog/en/modules/reports/suggestions_stats.tt | 27 ++++++++++++++-------- .../modules/reports/suggestions_stats_results.tt | 1 + reports/suggestions_stats.pl | 23 ++++++------------ t/db_dependent/Budgets.t | 8 +++---- 6 files changed, 46 insertions(+), 35 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/reports/display_values_status.inc diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports/display_values_status.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports/display_values_status.inc new file mode 100644 index 0000000000..956231c0e2 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports/display_values_status.inc @@ -0,0 +1,12 @@ +[% USE AuthorisedValues %] + +[% display_values.status.ACCEPTED = BLOCK %]Accepted[% END %] +[% display_values.status.ASKED = BLOCK %]Pending[% END %] +[% display_values.status.AVAILABLE = BLOCK %]Available[% END %] +[% display_values.status.CHECKED = BLOCK %]Checked[% END %] +[% display_values.status.ORDERED = BLOCK %]Ordered[% END %] +[% display_values.status.REJECTED = BLOCK %]Rejected[% END %] +[% FOREACH av IN AuthorisedValues.Get('SUGGEST_STATUS') %] + [% value = av.authorised_value %] + [% display_values.status.$value = av.lib %] +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports/fields.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports/fields.inc index 5500c146bb..dc7df421e0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports/fields.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports/fields.inc @@ -9,17 +9,17 @@ [% CASE 'ordereddate' %]Order date [% CASE 'ordereddate_from' %]Order date (from) [% CASE 'ordereddate_to' %]Order date (to) - [% CASE 'publicationyear' %]Publication year - [% CASE 'publicationyear_from' %]Publication year (from) - [% CASE 'publicationyear_to' %]Publication year (to) + [% CASE 'copyrightdate' %]Copyright date + [% CASE 'copyrightdate_from' %]Copyright date (from) + [% CASE 'copyrightdate_to' %]Copyright date (to) [% CASE 'status' %]Status [% CASE 'budgetid' %]Fund [% CASE 'budgetid_children' %]Include child funds [% CASE 'categorycode' %]Borrower category [% CASE 'sort1' %]Borrower sort field 1 [% CASE 'sort2' %]Borrower sort field 2 - [% CASE 'branchcode' %]Branch - [% CASE 'reason' %]Reject reason + [% CASE 'branchcode' %]Library + [% CASE 'reason' %]Reason [% CASE 'itemtype' %]Item type [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats.tt index e1a2914565..ee538467bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats.tt @@ -1,4 +1,7 @@ [% PROCESS 'reports/fields.inc' %] +[% PROCESS 'reports/display_values_status.inc' %] + +[% USE AuthorisedValues %] [% BLOCK tr %] @@ -37,12 +40,16 @@ [% BLOCK select_tr %] [% select_filter = BLOCK %] - + [% IF display_values.$name.keys.size > 0 %] + + [% ELSE %] + + [% END %] [% END %] [% INCLUDE tr filter=select_filter %] @@ -126,13 +133,13 @@ [% INCLUDE date_tr name='rejecteddate' %] [% INCLUDE date_tr name='ordereddate' %] - [% publicationyear_filter = BLOCK %] + [% copyrightdate_filter = BLOCK %] From - + To - + [% END %] - [% INCLUDE tr name='publicationyear' filter=publicationyear_filter %] + [% INCLUDE tr name='copyrightdate' filter=copyrightdate_filter %] [% INCLUDE select_tr name='status' %] [% INCLUDE select_tr name='categorycode' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats_results.tt index c507eb17f3..2e00d47c14 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats_results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats_results.tt @@ -1,4 +1,5 @@ [% PROCESS 'reports/fields.inc' %] +[% PROCESS 'reports/display_values_status.inc' %] [% INCLUDE 'doc-head-open.inc' %] Koha › Reports › Acquisitions statistics results diff --git a/reports/suggestions_stats.pl b/reports/suggestions_stats.pl index e88aba7cd5..6c0cef8fc5 100755 --- a/reports/suggestions_stats.pl +++ b/reports/suggestions_stats.pl @@ -87,15 +87,6 @@ if ($line and $column) { my $display_values = {}; -$display_values->{status} = { - ACCEPTED => gettext('Accepted'), - ASKED => gettext('Pending'), - AVAILABLE => gettext('Available'), - CHECKED => gettext('Checked'), - ORDERED => gettext('Ordered'), - REJECTED => gettext('Rejected'), -}; - my $budgets = C4::Budgets::GetBudgets; foreach my $budget (@$budgets) { my $budget_id = $budget->{budget_id}; @@ -167,7 +158,7 @@ sub calculate { my ($line, $column, $groupby, $filters) = @_; my @valid_fields = (qw( - suggesteddate rejecteddate ordereddate publicationyear status budgetid + suggesteddate rejecteddate ordereddate copyrightdate status budgetid categorycode sort1 sort2 branchcode reason itemtype )); return unless (grep /^$line$/, @valid_fields); @@ -208,13 +199,13 @@ sub calculate { } } - if ($filters->{publicationyear_from}) { - push @conditions, 'publicationyear >= ?'; - push @bind_values, $filters->{publicationyear_from}; + if ($filters->{copyrightdate_from}) { + push @conditions, 'copyrightdate >= ?'; + push @bind_values, $filters->{copyrightdate_from}; } - if ($filters->{publicationyear_to}) { - push @conditions, 'publicationyear <= ?'; - push @bind_values, $filters->{publicationyear_to}; + if ($filters->{copyrightdate_to}) { + push @conditions, 'copyrightdate <= ?'; + push @bind_values, $filters->{copyrightdate_to}; } if ($filters->{budgetid}) { diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t index a01da0e49e..7b0f0869f6 100755 --- a/t/db_dependent/Budgets.t +++ b/t/db_dependent/Budgets.t @@ -633,13 +633,13 @@ is( C4::Budgets::GetBudget($budget_id21)->{budget_owner_id}, undef, "SetOwnerToFundHierarchy should have set John Doe $john_doe for budget 21 ($budget_id21)" ); my @descendants_ids = C4::Budgets::GetBudgetDescendantsIds($budget_id1); -is_deeply(\@descendants_ids, [$budget_id12, $budget_id11, $budget_id111]); +is_deeply(\@descendants_ids, [$budget_id12, $budget_id11, $budget_id111], "descendants of budget 1 are 12, 11, 111"); @descendants_ids = C4::Budgets::GetBudgetDescendantsIds($budget_id11); -is_deeply(\@descendants_ids, [$budget_id111]); +is_deeply(\@descendants_ids, [$budget_id111], "descendant of buget 11 is 111"); @descendants_ids = C4::Budgets::GetBudgetDescendantsIds($budget_id111); -is_deeply(\@descendants_ids, []); +is_deeply(\@descendants_ids, [], "budget 111 has no descendants"); @descendants_ids = C4::Budgets::GetBudgetDescendantsIds(undef); -is_deeply(\@descendants_ids, []); +is_deeply(\@descendants_ids, [], "GetBudgetDescendantsIds returns an empty list when parameter is undef"); # Test GetBudgetAuthCats -- 2.11.0