From bd10a67b31ddf6b2624eadd90bd6cdf826fd7859 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 3 Oct 2019 06:18:42 +0100 Subject: [PATCH] Bug 23049: Split system and local types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test plan 1) Apply patches up to this point 2) View the new debit types management page and comment whether the split table view is clearer/better. Signed-off-by: Séverine QUEUNE --- Koha/Account/DebitTypes.pm | 1 + admin/debit_types.pl | 12 +++++++-- .../intranet-tmpl/prog/en/includes/accounts.inc | 10 ++++---- .../prog/en/modules/admin/debit_types.tt | 29 ++++++++++++++++++++++ 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/Koha/Account/DebitTypes.pm b/Koha/Account/DebitTypes.pm index a9fa462..e7bf4c2 100644 --- a/Koha/Account/DebitTypes.pm +++ b/Koha/Account/DebitTypes.pm @@ -45,6 +45,7 @@ sub delete { my @set = $self->as_list; my $defaults = Koha::Account::DebitType::defaults; for my $type (@set) { + if ( any { $type->code eq $_ } @{$defaults} ) { Koha::Exceptions::CannotDeleteDefault->throw; } diff --git a/admin/debit_types.pl b/admin/debit_types.pl index a8336e6..3b1dc0f 100755 --- a/admin/debit_types.pl +++ b/admin/debit_types.pl @@ -23,6 +23,7 @@ use C4::Context; use C4::Auth; use C4::Output; +use Koha::Account::DebitType; use Koha::Account::DebitTypes; my $input = new CGI; @@ -133,8 +134,15 @@ elsif ( $op eq 'delete_confirmed' ) { } if ( $op eq 'list' ) { - my $debit_types = Koha::Account::DebitTypes->search(); - $template->param( debit_types => $debit_types ); + my $defaults = Koha::Account::DebitType::defaults; + my $system_types = + Koha::Account::DebitTypes->search( { code => { 'in' => $defaults } } ); + my $debit_types = Koha::Account::DebitTypes->search( + { code => { 'not_in' => $defaults } } ); + $template->param( + debit_types => $debit_types, + system_types => $system_types + ); } $template->param( diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc index 75bd7f7..c863e98 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc @@ -13,18 +13,18 @@ [%- END -%] [%- ELSIF account.debit_type -%] [%- SWITCH account.debit_type -%] - [%- CASE 'N' -%]New card - [%- CASE 'OVERDUE' -%]Fine [%- CASE 'ACCOUNT' -%]Account creation fee [%- CASE 'ACCOUNT_RENEW' -%]Account renewal fee - [%- CASE 'M' -%]Sundry - [%- CASE 'LOST' -%]Lost item [%- CASE 'HE' -%]Hold waiting too long + [%- CASE 'LOST' -%]Lost item + [%- CASE 'M' -%]Sundry + [%- CASE 'N' -%]New card + [%- CASE 'OVERDUE' -%]Fine + [%- CASE 'PF' -%]Lost item processing fee [%- CASE 'RENT' -%]Rental fee [%- CASE 'RENT_DAILY' -%]Daily rental fee [%- CASE 'RENT_RENEW' -%]Renewal of rental item [%- CASE 'RENT_DAILY_RENEW' -%]Rewewal of daily rental item - [%- CASE 'PF' -%]Lost item processing fee [%- CASE 'Res' -%]Hold fee [%- CASE -%][% account.debit_type.description | html %] [%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt index 5f8d3ac..c963881 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt @@ -152,6 +152,7 @@

Account debit types

+

Custom types

[% IF debit_types.count %] @@ -204,6 +205,25 @@ There are no account debit types defined. Create new debit type [% END %] +

System types

+
+ + + + + + + + [% FOREACH system_type IN system_types %] + + + + + + + [% END %] + +
Account type codeDescriptionDefault amountCan be added manually
[% system_type.code | html %][% system_type.description | html %][% system_type.default_amount | $Price %][% IF system_type.can_be_added_manually %]Yes[% ELSE %]No[% END %]
[% END %] @@ -229,6 +249,15 @@ "iDisplayLength": 10, "sPaginationType": "full_numbers" })); + + $("#table_system_types").dataTable($.extend(true, {}, dataTablesDefaults, { + "aoColumnDefs": [ + { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, + ], + "aaSorting": [[ 1, "asc" ]], + "iDisplayLength": 10, + "sPaginationType": "full_numbers" + })); }); [% END %] -- 2.7.4