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

(-)a/Koha/Account/Line.pm (-6 / +6 lines)
Lines 54-72 sub item { Link Here
54
    return Koha::Item->_new_from_dbic( $rs );
54
    return Koha::Item->_new_from_dbic( $rs );
55
}
55
}
56
56
57
=head3 issue
57
=head3 checkout
58
58
59
Return the item linked to this account line if exists
59
Return the checkout linked to this account line if exists
60
60
61
=cut
61
=cut
62
62
63
sub issue {
63
sub checkout {
64
    my ( $self ) = @_;
64
    my ( $self ) = @_;
65
    return unless $self->issue_id ;
65
    return unless $self->issue_id ;
66
66
67
    my $issue = Koha::Checkouts->find( $self->issue_id );
67
    my $checkout = Koha::Checkouts->find( $self->issue_id );
68
    $issue = Koha::Old::Checkouts->find( $self->issue_id ) unless $issue;
68
    $checkout = Koha::Old::Checkouts->find( $self->issue_id ) unless $checkout;
69
    return $issue;
69
    return $checkout;
70
}
70
}
71
71
72
=head3 void
72
=head3 void
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/accountline-details.tt (-2 / +2 lines)
Lines 80-92 Link Here
80
80
81
                            <td>
81
                            <td>
82
                                [% IF ( accountline.issue_id ) %]
82
                                [% IF ( accountline.issue_id ) %]
83
                                    [% accountline.issue.date_due | $KohaDates as_due_date => 1 %]
83
                                    [% accountline.checkout.date_due | $KohaDates as_due_date => 1 %]
84
                                [% END %]
84
                                [% END %]
85
                            </td>
85
                            </td>
86
86
87
                            <td>
87
                            <td>
88
                                [% IF ( accountline.issue_id ) %]
88
                                [% IF ( accountline.issue_id ) %]
89
                                    [% accountline.issue.returndate | $KohaDates with_hours => 1 %]
89
                                    [% accountline.checkout.returndate | $KohaDates with_hours => 1 %]
90
                                [% END %]
90
                                [% END %]
91
                            </td>
91
                            </td>
92
92
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (-2 / +2 lines)
Lines 67-74 Link Here
67
        [%- IF account.description %], [% account.description | html %][% END %]
67
        [%- IF account.description %], [% account.description | html %][% END %]
68
        &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
68
        &nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
69
      <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&amp;biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
69
      <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&amp;biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
70
      <td>[% IF ( account.issue_id ) %][% account.issue.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
70
      <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
71
      <td>[% IF ( account.issue_id ) %][% account.issue.returndate | $KohaDates with_hours => 1 %][% END %]</td>
71
      <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
72
      <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
72
      <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
73
      <td>[% account.note | html_line_break %]</td>
73
      <td>[% account.note | html_line_break %]</td>
74
      [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
74
      [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt (-2 / +2 lines)
Lines 117-128 Link Here
117
    </td>
117
    </td>
118
    <td>
118
    <td>
119
        [% IF line.issue_id %]
119
        [% IF line.issue_id %]
120
            [% line.issue.date_due | $KohaDates as_due_date => 1 %]
120
            [% line.checkout.date_due | $KohaDates as_due_date => 1 %]
121
        [% END %]
121
        [% END %]
122
    </td>
122
    </td>
123
    <td>
123
    <td>
124
        [% IF line.issue_id %]
124
        [% IF line.issue_id %]
125
            [% line.issue.returndate | $KohaDates with_hours => 1 %]
125
            [% line.checkout.returndate | $KohaDates with_hours => 1 %]
126
        [% END %]
126
        [% END %]
127
    </td>
127
    </td>
128
    <td class="actions">
128
    <td class="actions">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt (-2 / +2 lines)
Lines 61-68 Link Here
61
        [%- IF account.description %], [% account.description | html %][% END %]
61
        [%- IF account.description %], [% account.description | html %][% END %]
62
      </td>
62
      </td>
63
      <td>[% account.item.barcode | html %]</td>
63
      <td>[% account.item.barcode | html %]</td>
64
      <td>[% account.issue.date_due | $KohaDates as_due_date => 1 %]</td>
64
      <td>[% account.checkout.date_due | $KohaDates as_due_date => 1 %]</td>
65
      <td>[% account.issue.returndate | $KohaDates with_hours => 1 %]</td>
65
      <td>[% account.checkout.returndate | $KohaDates with_hours => 1 %]</td>
66
      <td>[% account.note | html %]</td>
66
      <td>[% account.note | html %]</td>
67
      [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount | $Price %]</td>
67
      [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount | $Price %]</td>
68
      [% IF ( account.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amountoutstanding | $Price %]</td>
68
      [% IF ( account.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amountoutstanding | $Price %]</td>
(-)a/members/printinvoice.pl (-1 / +1 lines)
Lines 58-64 my $total = $patron->account->balance; Link Here
58
my $accountline_object = Koha::Account::Lines->find($accountlines_id);
58
my $accountline_object = Koha::Account::Lines->find($accountlines_id);
59
my $accountline = $accountline_object->unblessed;
59
my $accountline = $accountline_object->unblessed;
60
$accountline->{item} = $accountline_object->item || "" ;
60
$accountline->{item} = $accountline_object->item || "" ;
61
$accountline->{issue} = $accountline_object->issue || "";
61
$accountline->{checkout} = $accountline_object->checkout || "";
62
62
63
my $totalcredit;
63
my $totalcredit;
64
if ( $total <= 0 ) {
64
if ( $total <= 0 ) {
(-)a/t/db_dependent/Koha/Account/Lines.t (-8 / +7 lines)
Lines 438-456 subtest 'issue() tests' => sub { Link Here
438
            amount          => 10,
438
            amount          => 10,
439
        })->store;
439
        })->store;
440
440
441
    my $line_issue = $line->issue;
441
    my $line_checkout = $line->checkout;
442
    is( ref($line_issue), 'Koha::Checkout', 'Result type is correct' );
442
    is( ref($line_checkout), 'Koha::Checkout', 'Result type is correct' );
443
    is( $line_issue->issue_id, $checkout->issue_id, 'Koha::Account::Line->issue should return the correct issue');
443
    is( $line_checkout->issue_id, $checkout->issue_id, 'Koha::Account::Line->issue should return the correct issue');
444
444
445
    my ( $returned, undef, $old_checkout) = C4::Circulation::AddReturn( $item->{barcode} ,$library->{branchcode} );
445
    my ( $returned, undef, $old_checkout) = C4::Circulation::AddReturn( $item->{barcode} ,$library->{branchcode} );
446
    is( $returned, 1, 'The item should have been returned' );
446
    is( $returned, 1, 'The item should have been returned' );
447
447
448
    my $old_line_issue = $line->issue;
448
    my $old_line_checkout = $line->checkout;
449
    is( ref($old_line_issue), 'Koha::Old::Checkout', 'Result type is correct' );
449
    is( ref($old_line_checkout), 'Koha::Old::Checkout', 'Result type is correct' );
450
    is( $old_line_issue->issue_id, $old_checkout->issue_id, 'Koha::Account::Line->issue should return the correct old_issue' );
450
    is( $old_line_checkout->issue_id, $old_checkout->issue_id, 'Koha::Account::Line->issue should return the correct old_issue' );
451
451
452
    $line->issue_id(undef)->store;
452
    $line->issue_id(undef)->store;
453
    is( $line->issue, undef, 'Koha::Account::Line->issue should return undef if no issue linked' );
453
    is( $line->checkout, undef, 'Koha::Account::Line->issue should return undef if no issue linked' );
454
454
455
    $schema->storage->txn_rollback;
455
    $schema->storage->txn_rollback;
456
};
456
};
457
- 

Return to bug 19489