Bugzilla – Attachment 149655 Details for
Bug 32450
Make it possible to exclude debit types from charges counted for circulation restriction (noissuecharge)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32450: Noissuescharge debit type exclusions
Bug-32450-Noissuescharge-debit-type-exclusions.patch (text/plain), 8.02 KB, created by
Marcel de Rooy
on 2023-04-14 09:52:28 UTC
(
hide
)
Description:
Bug 32450: Noissuescharge debit type exclusions
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-04-14 09:52:28 UTC
Size:
8.02 KB
patch
obsolete
>From 2c5e779bbdfe073c851fe8bbfc95139e2d775ca2 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Fri, 6 Jan 2023 13:51:00 +0000 >Subject: [PATCH] Bug 32450: Noissuescharge debit type exclusions >Content-Type: text/plain; charset=utf-8 > >Currently the debit types to be excluded from the noissuescharge syspref are >hardcoded in non_issues_charges which gives no flexibility for selecting which >debit types should be included. This patch amends the subroutine to use a >database flag to identify which debit types should be included. It also adds a >column to the table in the Debit Types area of System Preferences which shows >which debit types are included. The ability to edit all debit types has been >added rather than just the non-system ones and the flag to include/exclude the >debit type from noissuescharge can be changed by clicking that edit button. > >Test plan: >1) Choose a patron and add some fines to this patron that have different debit_types >2) Navigate to system preferences and observe that currently you can only amend > the noissuescharge included debit types using three preferences: > ManInvInNoissuesCharge, RentalsInNoissuesCharge, HoldsInNoissuesCharge >3) Apply both commits attached to this bug >4) Navigate as above and observe that these three system preferences are now gone >5) Navigate to Debit Types in System Preferences, the table should have a column > called No issues charge that shows whether a debit_type is Included or Not > included >6) Click the edit button and there should be a checkbox for Included in > noissuescharge >7) Change some of the debit_types using this option and observe that the patron > you added fines to will either be blocked from checkouts or able to checkout > depending on which debit_types you include and the value of these fines. > >Mentored-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Account.pm | 20 ++++--------------- > admin/debit_types.pl | 2 ++ > .../prog/en/modules/admin/debit_types.tt | 18 ++++++++++++++++- > 3 files changed, 23 insertions(+), 17 deletions(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index e37e646596..515189ae7c 100644 >--- a/Koha/Account.pm >+++ b/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,31 +703,18 @@ 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 @blocking_debit_types = Koha::Account::DebitTypes->search({ restricts_checkouts => 1 }, { columns => 'code' })->get_column('code'); > > return $self->lines->search( > { >- debit_type_code => { -not_in => \@not_fines } >+ debit_type_code => { -in => \@blocking_debit_types } > }, > )->total_outstanding; > } >diff --git a/admin/debit_types.pl b/admin/debit_types.pl >index 0b1546d8e5..ba14a23010 100755 >--- a/admin/debit_types.pl >+++ b/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 $restricts_checkouts = $input->param('restricts_checkouts') || 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->restricts_checkouts($restricts_checkouts); > > try { > $debit_type->store; >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 a91c46a7ba..7f60cbc71e 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 >@@ -113,6 +113,14 @@ > <input type="checkbox" name="can_be_sold" id="can_be_sold" value="1" /> > [% END %] > </li> >+ <li> >+ <label for="restricts_checkouts">Included in noissuescharge? </label> >+ [% IF debit_type.restricts_checkouts %] >+ <input type="checkbox" name="restricts_checkouts" id="restricts_checkouts" checked="checked" value="1" /> >+ [% ELSE %] >+ <input type="checkbox" name="restricts_checkouts" id="restricts_checkouts" value="1" /> >+ [% END %] >+ </li> > <li> > <label for="branches">Libraries limitation: </label> > <select id="branches" name="branches" multiple size="10"> >@@ -154,6 +162,7 @@ > <th>Default amount</th> > <th>Available for</th> > <th>Library limitations</th> >+ <th>No issues charge</th> > <th class="noExport">Actions</th> > </thead> > <tbody> >@@ -192,8 +201,15 @@ > <span>No limitation</span> > [% END %] > </td> >+ <td> >+ [% IF debit_type.restricts_checkouts %] >+ <span>Included</span> >+ [% ELSE %] >+ <span>Not Included</span> >+ [% END %] >+ </td> > <td class="actions"> >- [% IF !debit_type.is_system && !debit_type.archived %] >+ [% IF !debit_type.archived %] > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=add_form&code=[% debit_type.code | uri %]&type=debit"><i class="fa fa-pencil"></i> Edit</a> > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/debit_types.pl?op=archive&code=[% debit_type.code | uri %]"><i class="fa fa-archive"></i> Archive</a> > [% ELSIF debit_type.archived %] >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32450
:
145080
|
145081
|
145127
|
145128
|
145171
|
145172
|
145189
|
145190
|
145191
|
145194
|
145198
|
147563
|
149653
|
149654
|
149655
|
149656
|
149657
|
149658
|
149659
|
149660
|
149858
|
149859
|
149872
|
149873
|
149874
|
149875
|
149876
|
149877
|
149878
|
149879
|
149880
|
149881
|
149882