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

(-)a/Koha/Account/Offset.pm (+23 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Carp;
20
use Carp;
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Account::Line;
23
24
24
use base qw(Koha::Object);
25
use base qw(Koha::Object);
25
26
Lines 35-40 Account offsets are used to track the changes in account lines Link Here
35
36
36
=cut
37
=cut
37
38
39
=head3 debit
40
41
=cut
42
43
sub debit {
44
    my ( $self ) = @_;
45
    my $debit_rs = $self->_result->debit;
46
    return unless $debit_rs;
47
    return Koha::Account::Line->_new_from_dbic( $debit_rs );
48
}
49
50
=head3 credit
51
52
=cut
53
54
sub credit {
55
    my ( $self ) = @_;
56
    my $credit_rs = $self->_result->credit;
57
    return unless $credit_rs;
58
    return Koha::Account::Line->_new_from_dbic( $credit_rs );
59
}
60
38
=head3 _type
61
=head3 _type
39
62
40
=cut
63
=cut
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-24 / +2 lines)
Lines 55-84 Link Here
55
   <tr>
55
   <tr>
56
   <td><span title="[% account.date %]">[% account.date |$KohaDates %]</span></td>
56
   <td><span title="[% account.date %]">[% account.date |$KohaDates %]</span></td>
57
      <td>
57
      <td>
58
        [% SWITCH account.accounttype %]
58
        [% INCLUDE 'accounttype.inc' accountline => account %]
59
          [% CASE 'Pay' %]Payment, thanks
60
          [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
61
          [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
62
          [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
63
          [% CASE 'VOID' %]Payment, Voided
64
          [% CASE 'N' %]New card
65
          [% CASE 'F' %]Fine
66
          [% CASE 'A' %]Account management fee
67
          [% CASE 'M' %]Sundry
68
          [% CASE 'L' %]Lost item
69
          [% CASE 'W' %]Writeoff
70
          [% CASE 'FU' %]Accruing fine
71
          [% CASE 'HE' %]Hold waiting too long
72
          [% CASE 'Rent' %]Rental fee
73
          [% CASE 'FOR' %]Forgiven
74
          [% CASE 'LR' %]Lost item fee refund
75
          [% CASE 'PF' %]Processing fee
76
          [% CASE 'PAY' %]Payment
77
          [% CASE 'WO' %]Writeoff
78
          [% CASE 'C' %]Credit
79
          [% CASE 'CR' %]Credit
80
          [% CASE %][% account.accounttype %]
81
        [%- END -%]
82
        [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) %][% END %]
59
        [%- IF account.payment_type %], [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) %][% END %]
83
        [%- IF account.description %], [% account.description %][% END %]
60
        [%- IF account.description %], [% account.description %][% END %]
84
        &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% account.title |html %]</a>[% END %]</td>
61
        &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">[% account.title |html %]</a>[% END %]</td>
Lines 91-96 Link Here
91
        [% ELSE %]
68
        [% ELSE %]
92
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
69
          <a target="_blank" href="printinvoice.pl?action=print&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
93
        [% END %]
70
        [% END %]
71
        <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
94
        [% IF ( reverse_col) %]
72
        [% IF ( reverse_col) %]
95
          [% IF ( account.payment ) %]
73
          [% IF ( account.payment ) %]
96
            <a href="boraccount.pl?action=reverse&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-undo"></i> Reverse</a>
74
            <a href="boraccount.pl?action=reverse&amp;accountlines_id=[% account.accountlines_id %]&amp;borrowernumber=[% account.borrowernumber %]" class="btn btn-default btn-xs"><i class="fa fa-undo"></i> Reverse</a>
(-)a/t/db_dependent/Accounts.t (-2 / +7 lines)
Lines 632-638 subtest "Koha::Account::chargelostitem tests" => sub { Link Here
632
632
633
subtest "Koha::Account::Line::void tests" => sub {
633
subtest "Koha::Account::Line::void tests" => sub {
634
634
635
    plan tests => 12;
635
    plan tests => 14;
636
636
637
    # Create a borrower
637
    # Create a borrower
638
    my $categorycode = $builder->build({ source => 'Category' })->{ categorycode };
638
    my $categorycode = $builder->build({ source => 'Category' })->{ categorycode };
Lines 662-667 subtest "Koha::Account::Line::void tests" => sub { Link Here
662
            amount => 30,
662
            amount => 30,
663
        }
663
        }
664
    );
664
    );
665
666
    # Test debit and credit methods fo Koha::Account::Offset
667
    my $account_offset = Koha::Account::Offsets->find( { credit_id => $id, debit_id => $line1->id } );
668
    is( $account_offset->debit->id, $line1->id, "Koha::Account::Offset->debit gets correct accountline" );
669
    is( $account_offset->credit->id, $id, "Koha::Account::Offset->credit gets correct accountline" );
670
665
    my $account_payment = Koha::Account::Lines->find( $id );
671
    my $account_payment = Koha::Account::Lines->find( $id );
666
672
667
    is( $account->balance(), "0.000000", "Account balance is 0" );
673
    is( $account->balance(), "0.000000", "Account balance is 0" );
668
- 

Return to bug 2696