View | Details | Raw Unified | Return to bug 32450
Collapse All | Expand All

(-)a/Koha/Account.pm (-1 / +1 lines)
Lines 709-715 Charges can be set as exempt from non-issue by editing the debit type in the Deb Link Here
709
709
710
sub non_issues_charges {
710
sub non_issues_charges {
711
    my ($self) = @_;
711
    my ($self) = @_;
712
   
712
713
    my @blocking_debit_types = Koha::Account::DebitTypes->search({ restricts_checkouts => 1 }, { columns => 'code' })->get_column('code');
713
    my @blocking_debit_types = Koha::Account::DebitTypes->search({ restricts_checkouts => 1 }, { columns => 'code' })->get_column('code');
714
714
715
    return $self->lines->search(
715
    return $self->lines->search(
(-)a/installer/data/mysql/atomicupdate/bug_32450-add_debit_type_flag.pl (-4 / +4 lines)
Lines 4-13 return { Link Here
4
    bug_number => "32450",
4
    bug_number => "32450",
5
    description => "Create a database flag for whether a debit type should be included in the noissuescharge block on circulation and remove redundant sysprefs.",
5
    description => "Create a database flag for whether a debit type should be included in the noissuescharge block on circulation and remove redundant sysprefs.",
6
    up => sub {
6
    up => sub {
7
        my ($args) = @_; 
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
9
10
        if( !column_exists( 'account_debit_types', 'restricts_checkouts' ) ) { 
10
        if( !column_exists( 'account_debit_types', 'restricts_checkouts' ) ) {
11
          $dbh->do(q{
11
          $dbh->do(q{
12
              ALTER TABLE account_debit_types ADD COLUMN `restricts_checkouts` tinyint(1) NOT NULL DEFAULT 1 AFTER `archived`
12
              ALTER TABLE account_debit_types ADD COLUMN `restricts_checkouts` tinyint(1) NOT NULL DEFAULT 1 AFTER `archived`
13
          });
13
          });
Lines 35-41 return { Link Here
35
            $sth->execute;
35
            $sth->execute;
36
            my $exists = $sth->fetchrow();
36
            my $exists = $sth->fetchrow();
37
            $sth->finish;
37
            $sth->finish;
38
            
38
39
            if($exists) {
39
            if($exists) {
40
                # If it exists, retrieve its value
40
                # If it exists, retrieve its value
41
                my $find_syspref_value = "SELECT value FROM systempreferences WHERE variable = '$_'";
41
                my $find_syspref_value = "SELECT value FROM systempreferences WHERE variable = '$_'";
Lines 66-72 return { Link Here
66
                # Delete syspref as it is no longer required and the value has been transferred to account_debit_types
66
                # Delete syspref as it is no longer required and the value has been transferred to account_debit_types
67
                my $delete_redundant_syspref = "DELETE FROM systempreferences WHERE variable = '$_'";
67
                my $delete_redundant_syspref = "DELETE FROM systempreferences WHERE variable = '$_'";
68
                $dbh->do($delete_redundant_syspref);
68
                $dbh->do($delete_redundant_syspref);
69
                
69
70
            } else {
70
            } else {
71
                # If it doesn't exist then revert to default value in the database schema
71
                # If it doesn't exist then revert to default value in the database schema
72
                say $out "$_ was not found in this Koha instance, default value has been applied.";
72
                say $out "$_ was not found in this Koha instance, default value has been applied.";
(-)a/t/db_dependent/Accounts.t (-5 / +4 lines)
Lines 835-850 subtest "Koha::Account::non_issues_charges tests" => sub { Link Here
835
        }
835
        }
836
    )->store;
836
    )->store;
837
837
838
    my ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges );
838
    my ( $new_total, $new_non_issues_charges ) = ( $account->balance, $account->non_issues_charges );
839
    my $other_charges = $total - $non_issues_charges;
839
    my $new_other_charges = $new_total - $new_non_issues_charges;
840
    is(
840
    is(
841
        $account->balance,
841
        $account->balance,
842
        $res + $rent + $manual + $print,
842
        $res + $rent + $manual + $print,
843
        'Total charges should be Res + Rent + Manual + Print'
843
        'Total charges should be Res + Rent + Manual + Print'
844
    );
844
    );
845
    is( $non_issues_charges, 15,
845
    is( $new_non_issues_charges, 15,
846
        'All types except Print should count towards the non issue charge' );
846
        'All types except Print should count towards the non issue charge' );
847
    is( $other_charges, 4, 'There should be non-included charges for Print' );
847
    is( $new_other_charges, 4, 'There should be non-included charges for Print' );
848
848
849
};
849
};
850
850
851
- 

Return to bug 32450