From 72e10519e3b7185c0322c144df5e54d5b203b995 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 28 Feb 2019 16:58:06 +0000 Subject: [PATCH] Bug 23049: Add debit_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Add account_debit_types table * Add ac_debit_types_branches table * Add account_debit_types defaults * Add Koha::Account::DebitType and Koha::Account::DebitTypes * Prevent deletion of defaults * Migrate MANUAL_INV values * Remove MANUAL_INV references * Migrate accounttype values Signed-off-by: Séverine QUEUNE Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- C4/Installer.pm | 1 + Koha/Account.pm | 19 +-- Koha/Account/DebitType.pm | 60 +++++++++ Koha/Account/DebitTypes.pm | 70 ++++++++++ Koha/Schema/Result/Accountline.pm | 33 ++++- Koha/Schema/Result/Branch.pm | 19 ++- installer/data/mysql/account_debit_types.sql | 14 ++ .../mysql/atomicupdate/bug_23049_debit.perl | 125 ++++++++++++++++++ .../en/mandatory/account_debit_types.sql | 14 ++ installer/data/mysql/en/optional/auth_val.sql | 3 - installer/data/mysql/kohastructure.sql | 31 ++++- .../data/mysql/mandatory/auth_val_cat.sql | 1 - .../en/modules/admin/authorised_values.tt | 2 - .../admin/preferences/circulation.pref | 2 +- misc/devel/populate_db.pl | 1 + t/db_dependent/Accounts.t | 16 +-- 16 files changed, 378 insertions(+), 33 deletions(-) create mode 100644 Koha/Account/DebitType.pm create mode 100644 Koha/Account/DebitTypes.pm create mode 100644 installer/data/mysql/account_debit_types.sql create mode 100644 installer/data/mysql/atomicupdate/bug_23049_debit.perl create mode 100644 installer/data/mysql/en/mandatory/account_debit_types.sql diff --git a/C4/Installer.pm b/C4/Installer.pm index 9b24ff3d2d..e4cae05c06 100644 --- a/C4/Installer.pm +++ b/C4/Installer.pm @@ -332,6 +332,7 @@ sub load_sql_in_order { push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/userpermissions.sql"; push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/audio_alerts.sql"; push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/account_offset_types.sql"; + push @fnames, C4::Context->config('intranetdir') . "/installer/data/mysql/account_debit_types.sql"; foreach my $file (@fnames) { # warn $file; undef $/; diff --git a/Koha/Account.pm b/Koha/Account.pm index afff235822..743b4b7d04 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -628,28 +628,21 @@ Charges exempt from non-issue are: sub non_issues_charges { my ($self) = @_; - # FIXME REMOVE And add a warning in the about page + update DB if length(MANUAL_INV) > 5 - my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous... - + #NOTE: With bug 23049 these preferences could be moved to being attached + #to individual debit types to give more flexability and specificity. my @not_fines; push @not_fines, 'Res' unless C4::Context->preference('HoldsInNoissuesCharge'); - push @not_fines, 'Rent' + push @not_fines, ( 'RENT', 'RENT_DAILY', 'RENT_RENEW', 'RENT_DAILY_RENEW' ) unless C4::Context->preference('RentalsInNoissuesCharge'); unless ( C4::Context->preference('ManInvInNoissuesCharge') ) { - my $dbh = C4::Context->dbh; - push @not_fines, - @{ - $dbh->selectcol_arrayref(q| - SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV' - |) - }; + my @man_inv = Koha::Account::DebitTypes->search({ system => 0 })->get_column('code'); + push @not_fines, @man_inv; } - @not_fines = map { substr( $_, 0, $ACCOUNT_TYPE_LENGTH ) } uniq(@not_fines); return $self->lines->search( { - accounttype => { -not_in => \@not_fines } + debit_type => { -not_in => \@not_fines } }, )->total_outstanding; } diff --git a/Koha/Account/DebitType.pm b/Koha/Account/DebitType.pm new file mode 100644 index 0000000000..59bb5c1e5e --- /dev/null +++ b/Koha/Account/DebitType.pm @@ -0,0 +1,60 @@ +package Koha::Account::DebitType; + +# Copyright PTFS Europe 2019 +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; +use List::Util qw/any/; + +use Koha::Database; +use Koha::Exceptions; + +use base qw(Koha::Object); + +=head1 NAME + +Koha::Account::DebitType - Koha Account debit type Object class + +=head1 API + +=head2 Class Methods + +=cut + +=head3 delete + +Overridden delete method to prevent system default deletions + +=cut + +sub delete { + my ($self) = @_; + + Koha::Exceptions::CannotDeleteDefault->throw if $self->is_system; + + return $self->SUPER::delete; +} + +=head3 type + +=cut + +sub _type { + return 'AccountDebitType'; +} + +1; diff --git a/Koha/Account/DebitTypes.pm b/Koha/Account/DebitTypes.pm new file mode 100644 index 0000000000..2e6eb2c9b6 --- /dev/null +++ b/Koha/Account/DebitTypes.pm @@ -0,0 +1,70 @@ +package Koha::Account::DebitTypes; + +# Copyright PTFS Europe 2019 +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +use Modern::Perl; +use List::Util qw/any/; + +use Koha::Database; + +use base qw(Koha::Objects); + +=head1 NAME + +Koha::Account::DebitTypes - Koha Account debit types Object set class + +=head1 API + +=head2 Class Methods + +=head3 delete + +Overridden delete method to prevent system default deletions + +=cut + +sub delete { + my ($self) = @_; + + my @set = $self->as_list; + for my $type (@set) { + if ( $type->is_system ) { + Koha::Exceptions::CannotDeleteDefault->throw; + } + } + + return $self->SUPER::delete; +} + +=head3 type + +=cut + +sub _type { + return 'AccountDebitType'; +} + +=head3 object_class + +=cut + +sub object_class { + return 'Koha::Account::DebitType'; +} + +1; diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm index c2ae858a96..5082443f64 100644 --- a/Koha/Schema/Result/Accountline.pm +++ b/Koha/Schema/Result/Accountline.pm @@ -69,6 +69,13 @@ __PACKAGE__->table("accountlines"); is_nullable: 1 size: 80 +=head2 debit_type + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 16 + =head2 status data_type: 'varchar' @@ -143,6 +150,8 @@ __PACKAGE__->add_columns( { data_type => "longtext", is_nullable => 1 }, "accounttype", { data_type => "varchar", is_nullable => 1, size => 80 }, + "debit_type", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 16 }, "status", { data_type => "varchar", is_nullable => 1, size => 16 }, "payment_type", @@ -252,6 +261,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 debit_type + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "debit_type", + "Koha::Schema::Result::AccountDebitType", + { code => "debit_type" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 itemnumber Type: belongs_to @@ -313,8 +342,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-23 10:45:21 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L+QlTTT+MdGoA3shpyaBgQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-11 10:47:58 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RKg4gDSu0WwJ1C9YmDv3pw sub koha_objects_class { 'Koha::Account::Lines'; diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 6191b31a65..fa9679eb2e 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -211,6 +211,21 @@ __PACKAGE__->set_primary_key("branchcode"); =head1 RELATIONS +=head2 ac_debit_types_branches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "ac_debit_types_branches", + "Koha::Schema::Result::AcDebitTypesBranch", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 accountlines Type: has_many @@ -677,8 +692,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-23 10:45:22 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KDg4i49bpMxXQ1LP6OZFWQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-09-26 15:59:23 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IiEBfDpMBAi9cv7OqevVRQ __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 } diff --git a/installer/data/mysql/account_debit_types.sql b/installer/data/mysql/account_debit_types.sql new file mode 100644 index 0000000000..db769631cc --- /dev/null +++ b/installer/data/mysql/account_debit_types.sql @@ -0,0 +1,14 @@ +INSERT INTO account_debit_types ( code, description, can_be_added_manually, default_amount, is_system ) VALUES +('ACCOUNT', 'Account creation fee', 0, NULL, 1), +('ACCOUNT_RENEW', 'Account renewal fee', 0, NULL, 1), +('HE', 'Hold waiting too long', 0, NULL, 1), +('LOST', 'Lost item', 1, NULL, 1), +('M', 'Manual fee', 1, NULL, 0), +('N', 'New card fee', 1, NULL, 1), +('OVERDUE', 'Overdue fine', 0, NULL, 1), +('PF', 'Lost item processing fee', 0, NULL, 1), +('RENT', 'Rental fee', 0, NULL, 1), +('RENT_DAILY', 'Daily rental fee', 0, NULL, 1), +('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1), +('RENT_DAILY_RENEW', 'Rewewal of daily rental item', 0, NULL, 1), +('Res', 'Hold fee', 0, NULL, 1); diff --git a/installer/data/mysql/atomicupdate/bug_23049_debit.perl b/installer/data/mysql/atomicupdate/bug_23049_debit.perl new file mode 100644 index 0000000000..f5fa7c2c97 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23049_debit.perl @@ -0,0 +1,125 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if ( CheckVersion($DBversion) ) { + + $dbh->do( + qq{ + CREATE TABLE IF NOT EXISTS account_debit_types ( + code varchar(64) NOT NULL, + description varchar(200) NULL, + can_be_added_manually tinyint(4) NOT NULL DEFAULT 1, + default_amount decimal(28, 6) NULL, + is_system tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (code) + ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci + } + ); + + $dbh->do( + qq{ + CREATE TABLE IF NOT EXISTS ac_debit_types_branches ( + debit_type_code VARCHAR(64), + branchcode VARCHAR(10), + FOREIGN KEY (debit_type_code) REFERENCES account_debit_types(code) ON DELETE CASCADE, + FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci + } + ); + + $dbh->do( + qq{ + INSERT IGNORE INTO account_debit_types ( + code, + description, + can_be_added_manually, + default_amount, + is_system + ) + VALUES + ('ACCOUNT', 'Account creation fee', 0, NULL, 1), + ('ACCOUNT_RENEW', 'Account renewal fee', 0, NULL, 1), + ('HE', 'Hold waiting too long', 0, NULL, 1), + ('LOST', 'Lost item', 1, NULL, 1), + ('M', 'Manual fee', 1, NULL, 0), + ('N', 'New card fee', 1, NULL, 1), + ('OVERDUE', 'Overdue fine', 0, NULL, 1), + ('PF', 'Lost item processing fee', 0, NULL, 1), + ('RENT', 'Rental fee', 0, NULL, 1), + ('RENT_DAILY', 'Daily rental fee', 0, NULL, 1), + ('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1), + ('RENT_DAILY_RENEW', 'Rewewal of daily rental item', 0, NULL, 1), + ('Res', 'Hold fee', 0, NULL, 1) + } + ); + + $dbh->do( + qq{ + INSERT IGNORE INTO account_debit_types ( + code, + default_amount, + description, + can_be_added_manually, + is_system + ) + SELECT + SUBSTR(authorised_value, 1, 64), + lib, + authorised_value, + 1, + 0 + FROM + authorised_values + WHERE + category = 'MANUAL_INV' + } + ); + + $dbh->do( + qq{ + ALTER IGNORE TABLE accountlines + ADD + debit_type varchar(64) DEFAULT NULL + AFTER + accounttype + } + ); + + $dbh->do( + qq{ + ALTER TABLE accountlines ADD CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type`) REFERENCES `account_debit_types` (`code`) ON DELETE SET NULL ON UPDATE CASCADE + } + ); + + $dbh->do( + qq{ + UPDATE accountlines SET debit_type = accounttype, accounttype = NULL WHERE accounttype IN (SELECT code from account_debit_types) + } + ); + + # Clean up MANUAL_INV + $dbh->do( + qq{ + DELETE FROM authorised_values WHERE category = 'MANUAL_INV' + } + ); + $dbh->do( + qq{ + DELETE FROM authorised_value_categories WHERE category_name = 'MANUAL_INV' + } + ); + + # Add new permission + $dbh->do( + q{ + INSERT IGNORE INTO permissions (module_bit, code, description) + VALUES + ( + 3, + 'manage_accounts', + 'Manage Account Debit and Credit Types' + ) + } + ); + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 23049 - Add account debit_types)\n"; +} diff --git a/installer/data/mysql/en/mandatory/account_debit_types.sql b/installer/data/mysql/en/mandatory/account_debit_types.sql new file mode 100644 index 0000000000..db769631cc --- /dev/null +++ b/installer/data/mysql/en/mandatory/account_debit_types.sql @@ -0,0 +1,14 @@ +INSERT INTO account_debit_types ( code, description, can_be_added_manually, default_amount, is_system ) VALUES +('ACCOUNT', 'Account creation fee', 0, NULL, 1), +('ACCOUNT_RENEW', 'Account renewal fee', 0, NULL, 1), +('HE', 'Hold waiting too long', 0, NULL, 1), +('LOST', 'Lost item', 1, NULL, 1), +('M', 'Manual fee', 1, NULL, 0), +('N', 'New card fee', 1, NULL, 1), +('OVERDUE', 'Overdue fine', 0, NULL, 1), +('PF', 'Lost item processing fee', 0, NULL, 1), +('RENT', 'Rental fee', 0, NULL, 1), +('RENT_DAILY', 'Daily rental fee', 0, NULL, 1), +('RENT_RENEW', 'Renewal of rental item', 0, NULL, 1), +('RENT_DAILY_RENEW', 'Rewewal of daily rental item', 0, NULL, 1), +('Res', 'Hold fee', 0, NULL, 1); diff --git a/installer/data/mysql/en/optional/auth_val.sql b/installer/data/mysql/en/optional/auth_val.sql index 24f036bd20..b4e00fd8b2 100644 --- a/installer/data/mysql/en/optional/auth_val.sql +++ b/installer/data/mysql/en/optional/auth_val.sql @@ -48,9 +48,6 @@ INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('NOT_L -- restricted status of an item, linked to items.restricted INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('RESTRICTED','1','Restricted Access'); --- manual invoice types -INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('MANUAL_INV','Copier Fees','.25'); - -- custom borrower notes INSERT INTO `authorised_values` (category, authorised_value, lib) VALUES ('BOR_NOTES','ADDR','Address Notes'); diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 7073c9a2d1..87d219ab29 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2621,6 +2621,32 @@ CREATE TABLE `cash_registers` ( CONSTRAINT cash_registers_branch FOREIGN KEY (branch) REFERENCES branches (branchcode) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci; +-- +-- Table structure for table `account_debit_types` +-- + +DROP TABLE IF EXISTS `account_debit_types`; +CREATE TABLE `account_debit_types` ( + `code` varchar(64) NOT NULL, + `description` varchar(200) DEFAULT NULL, + `can_be_added_manually` tinyint(4) NOT NULL DEFAULT 1, + `default_amount` decimal(28,6) DEFAULT NULL, + `is_system` tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `ac_debit_types_branches` +-- + +DROP TABLE IF EXISTS `ac_debit_types_branches`; +CREATE TABLE `ac_debit_types_branches` ( + `debit_type_code` VARCHAR(64), + `branchcode` VARCHAR(10), + FOREIGN KEY (`debit_type_code`) REFERENCES `account_debit_types` (`code`) ON DELETE CASCADE, + FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `accountlines` -- @@ -2635,6 +2661,7 @@ CREATE TABLE `accountlines` ( `amount` decimal(28,6) default NULL, `description` LONGTEXT, `accounttype` varchar(80) default NULL, + `debit_type` varchar(64) default NULL, `status` varchar(16) default NULL, `payment_type` varchar(80) default NULL, -- optional authorised value PAYMENT_TYPE `amountoutstanding` decimal(28,6) default NULL, @@ -2647,6 +2674,7 @@ CREATE TABLE `accountlines` ( PRIMARY KEY (`accountlines_id`), KEY `acctsborridx` (`borrowernumber`), KEY `timeidx` (`timestamp`), + KEY `debit_type` (`debit_type`), KEY `itemnumber` (`itemnumber`), KEY `branchcode` (`branchcode`), KEY `manager_id` (`manager_id`), @@ -2654,7 +2682,8 @@ CREATE TABLE `accountlines` ( CONSTRAINT `accountlines_ibfk_items` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `accountlines_ibfk_branches` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `accountlines_ibfk_registers` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `accountlines_ibfk_debit_type` FOREIGN KEY (`debit_type`) REFERENCES `account_debit_types` (`code`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index 70e7d19a95..f39bf93502 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -32,7 +32,6 @@ INSERT IGNORE INTO authorised_value_categories( category_name ) ('NOT_LOAN'), ('CCODE'), ('LOC'), - ('MANUAL_INV'), ('BOR_NOTES'), ('OPAC_SUG'), ('SIP_MEDIA_TYPE'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 7715e0b6f5..0c8e1fccab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -384,8 +384,6 @@

Shelving location (usually appears when adding or editing an item). LOC maps to items.location in the Koha database.

[% CASE 'LOST' %]

Descriptions for the items marked as lost (appears when adding or editing an item)

- [% CASE 'MANUAL_INV' %] -

Values for manual invoicing types

[% CASE 'NOT_LOAN' %]

Reasons why a title is not for loan

[% CASE 'OPAC_SUG' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 9f7c0dcb48..3c24d51273 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -352,7 +352,7 @@ Circulation: choices: yes: Include no: "Don't include" - - MANUAL_INV charges when summing up charges for noissuescharge. + - custom debit type charges when summing up charges for noissuescharge. - - pref: HoldsInNoissuesCharge choices: diff --git a/misc/devel/populate_db.pl b/misc/devel/populate_db.pl index f2cb974655..341c53008f 100755 --- a/misc/devel/populate_db.pl +++ b/misc/devel/populate_db.pl @@ -108,6 +108,7 @@ my @sample_files_mandatory = ( "$data_dir/userflags.sql", "$data_dir/userpermissions.sql", "$data_dir/account_offset_types.sql", + "$data_dir/account_debit_types.sql", ); my @sample_lang_files_mandatory = ( glob $root . "/installer/data/mysql/$lang/mandatory/*.sql" ); my @sample_lang_files_optional = ( glob $root . "/installer/data/mysql/$lang/optional/*.sql" ); diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t index 4a450632eb..d6fd47524d 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -786,23 +786,23 @@ subtest "Koha::Account::non_issues_charges tests" => sub { interface => 'commandline' } ); + Koha::Account::DebitTypes->new( + { + code => 'Copie', + description => 'Fee for copie', + is_system => 0 + } + )->store; Koha::Account::Line->new( { borrowernumber => $patron->borrowernumber, date => $today, description => 'a Manual invoice fee', - accounttype => 'Copie', + debit_type => 'Copie', amountoutstanding => $manual, interface => 'commandline' } )->store; - Koha::AuthorisedValue->new( - { - category => 'MANUAL_INV', - authorised_value => 'Copie', - lib => 'Fee for copie', - } - )->store; t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 0 ); -- 2.39.5