[Koha-bugs] [Bug 32450] Make it possible to exclude debit types from charges counted for circulation restriction (noissuecharge)

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Jan 9 12:27:29 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32450

--- Comment #6 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
Comment on attachment 145127
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=145127
Bug 32450: Noissuescharge debit type exclusions

Review of attachment 145127:
 --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=32450&attachment=145127)
-----------------------------------------------------------------

::: Koha/Account.pm
@@ +711,5 @@
>      my ($self) = @_;
>  
> +    my @fines;
> +    my $dbh=C4::Context->dbh;
> +    my $sth = $dbh->prepare("SELECT code FROM account_debit_types WHERE no_issues_charge = 1");

Sorry Matt, this will need to be converted to a DBIC style lookup rather than
using a handle.. we dis-sallow direct SQL in the Koha:: namespace.

https://metacpan.org/pod/DBIx::Class::ResultSet#search is a good starting place
for how this works.. especially the WHERE clause link from it.

tl:dr;  It'll be something along the lines

my $blocking_types => Koha::Debit::Types->search({ no_issues_charge => 1 }, {
columns => 'code' });

Then the ->lines->search could use it inline.

$self->lines->search(
  {
    debit_type_code => { '-in' => $blocking_types }
  }
);

This so pseudo code untested ;P

::: koha-tmpl/intranet-tmpl/prog/en/modules/admin/debit_types.tt
@@ +220,2 @@
>                                          <td class="actions">
> +                                            [% IF !debit_type.archived %]

Hmm, I wonder if at least some of the fields in system level types need to be
marked as read only.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list