@@ -, +, @@ --- Koha/Account.pm | 25 ++++++++----------- admin/debit_types.pl | 2 ++ .../prog/en/modules/admin/debit_types.tt | 18 ++++++++++++- 3 files changed, 29 insertions(+), 16 deletions(-) --- a/Koha/Account.pm +++ a/Koha/Account.pm @@ -28,6 +28,7 @@ use C4::Letters; use C4::Log qw( logaction ); use C4::Stats qw( UpdateStats ); use C4::Overdues qw(GetFine); +use C4::Context; use Koha::Patrons; use Koha::Account::Lines; @@ -702,33 +703,27 @@ my $non_issues_charges = $self->non_issues_charges Calculates amount immediately owing by the patron - non-issue charges. -Charges exempt from non-issue are: -* Res (holds) if HoldsInNoissuesCharge syspref is set to false -* Rent (rental) if RentalsInNoissuesCharge syspref is set to false -* Manual invoices if ManInvInNoissuesCharge syspref is set to false +Charges can be set as exempt from non-issue by editing the debit type in the Debit Types area of System Preferences. =cut sub non_issues_charges { my ($self) = @_; - #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, 'RESERVE' - unless C4::Context->preference('HoldsInNoissuesCharge'); - push @not_fines, ( 'RENT', 'RENT_DAILY', 'RENT_RENEW', 'RENT_DAILY_RENEW' ) - unless C4::Context->preference('RentalsInNoissuesCharge'); - unless ( C4::Context->preference('ManInvInNoissuesCharge') ) { - my @man_inv = Koha::Account::DebitTypes->search({ is_system => 0 })->get_column('code'); - push @not_fines, @man_inv; + my @fines; + my $dbh=C4::Context->dbh; + my $sth = $dbh->prepare("SELECT code FROM account_debit_types WHERE no_issues_charge = 1"); + $sth->execute; + while (my $code = $sth->fetchrow_array) { + push @fines, $code; } return $self->lines->search( { - debit_type_code => { -not_in => \@not_fines } + debit_type_code => { -in => \@fines } }, )->total_outstanding; + } =head3 lines --- a/admin/debit_types.pl +++ a/admin/debit_types.pl @@ -77,6 +77,7 @@ elsif ( $op eq 'add_validate' ) { my $can_be_invoiced = $input->param('can_be_invoiced') || 0; my $can_be_sold = $input->param('can_be_sold') || 0; my $default_amount = $input->param('default_amount') || undef; + my $no_issues_charge = $input->param('no_issues_charge') || 0; my @branches = grep { $_ ne q{} } $input->multi_param('branches'); if ( not defined $debit_type ) { @@ -86,6 +87,7 @@ elsif ( $op eq 'add_validate' ) { $debit_type->can_be_invoiced($can_be_invoiced); $debit_type->can_be_sold($can_be_sold); $debit_type->default_amount($default_amount); + $debit_type->no_issues_charge($no_issues_charge); try { $debit_type->store; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt @@ -122,6 +122,14 @@ [% END %] +
  • + + [% IF debit_type.no_issues_charge %] + + [% ELSE %] + + [% END %] +