@@ -, +, @@ --- .../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 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports/display_values_status.inc +++ a/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 %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports/fields.inc +++ a/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 %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats.tt +++ a/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' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/suggestions_stats_results.tt +++ a/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 --- a/reports/suggestions_stats.pl +++ a/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}) { --- a/t/db_dependent/Budgets.t +++ a/t/db_dependent/Budgets.t @@ -583,13 +583,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_id11, $budget_id12, $budget_id111]); +is_deeply(\@descendants_ids, [$budget_id11, $budget_id12, $budget_id111], "descendants of budget 1 are 11, 12, 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"); $schema->storage->txn_rollback(); --