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

(-)a/C4/Circulation.pm (-10 lines)
Lines 2463-2470 sub _FixAccountForLostAndReturned { Link Here
2463
    $accountline->discard_changes->status('RETURNED');
2463
    $accountline->discard_changes->status('RETURNED');
2464
    $accountline->store;
2464
    $accountline->store;
2465
2465
2466
    ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } );
2467
2468
    if ( defined $account and C4::Context->preference('AccountAutoReconcile') ) {
2466
    if ( defined $account and C4::Context->preference('AccountAutoReconcile') ) {
2469
        $account->reconcile_balance;
2467
        $account->reconcile_balance;
2470
    }
2468
    }
Lines 3669-3683 sub DeleteBranchTransferLimits { Link Here
3669
3667
3670
sub ReturnLostItem{
3668
sub ReturnLostItem{
3671
    my ( $borrowernumber, $itemnum ) = @_;
3669
    my ( $borrowernumber, $itemnum ) = @_;
3672
3673
    MarkIssueReturned( $borrowernumber, $itemnum );
3670
    MarkIssueReturned( $borrowernumber, $itemnum );
3674
    my $patron = Koha::Patrons->find( $borrowernumber );
3675
    my $item = Koha::Items->find($itemnum);
3676
    my $old_note = ($item->paidfor && ($item->paidfor ne q{})) ? $item->paidfor.' / ' : q{};
3677
    my @datearr = localtime(time);
3678
    my $date = ( 1900 + $datearr[5] ) . "-" . ( $datearr[4] + 1 ) . "-" . $datearr[3];
3679
    my $bor = $patron->firstname . ' ' . $patron->surname . ' ' . $patron->cardnumber;
3680
    ModItem({ paidfor =>  $old_note."Paid for by $bor $date" }, undef, $itemnum);
3681
}
3671
}
3682
3672
3683
3673
(-)a/C4/Items.pm (-3 lines)
Lines 390-396 sub _build_default_values_for_mod_marc { Link Here
390
        materials                => undef,
390
        materials                => undef,
391
        new_status               => undef,
391
        new_status               => undef,
392
        notforloan               => 0,
392
        notforloan               => 0,
393
        # paidfor => undef, # commented, see bug 12817
394
        price                    => undef,
393
        price                    => undef,
395
        replacementprice         => undef,
394
        replacementprice         => undef,
396
        replacementpricedate     => undef,
395
        replacementpricedate     => undef,
Lines 1569-1575 sub _koha_new_item { Link Here
1569
            itemnotes           = ?,
1568
            itemnotes           = ?,
1570
            itemnotes_nonpublic = ?,
1569
            itemnotes_nonpublic = ?,
1571
            holdingbranch       = ?,
1570
            holdingbranch       = ?,
1572
            paidfor             = ?,
1573
            location            = ?,
1571
            location            = ?,
1574
            permanent_location  = ?,
1572
            permanent_location  = ?,
1575
            onloan              = ?,
1573
            onloan              = ?,
Lines 1613-1619 sub _koha_new_item { Link Here
1613
            $item->{'itemnotes'},
1611
            $item->{'itemnotes'},
1614
            $item->{'itemnotes_nonpublic'},
1612
            $item->{'itemnotes_nonpublic'},
1615
            $item->{'holdingbranch'},
1613
            $item->{'holdingbranch'},
1616
            $item->{'paidfor'},
1617
            $item->{'location'},
1614
            $item->{'location'},
1618
            $item->{'permanent_location'},
1615
            $item->{'permanent_location'},
1619
            $item->{'onloan'},
1616
            $item->{'onloan'},
(-)a/Koha/Account/Line.pm (+13 lines)
Lines 41-46 Koha::Account::Line - Koha accountline Object class Link Here
41
41
42
=cut
42
=cut
43
43
44
=head3 patron
45
46
Return the patron linked to this account line
47
48
=cut
49
50
sub patron {
51
    my ( $self ) = @_;
52
    my $rs = $self->_result->borrowernumber;
53
    return unless $rs;
54
    return Koha::Patron->_new_from_dbic( $rs );
55
}
56
44
=head3 item
57
=head3 item
45
58
46
Return the item linked to this account line if exists
59
Return the item linked to this account line if exists
(-)a/admin/columns_settings.yml (-2 lines)
Lines 272-279 modules: Link Here
272
          columnname: itemnotes_nonpublic
272
          columnname: itemnotes_nonpublic
273
        -
273
        -
274
          columnname: holdingbranch
274
          columnname: holdingbranch
275
        -
276
          columnname: paidfor
277
        -
275
        -
278
          columnname: timestamp
276
          columnname: timestamp
279
        -
277
        -
(-)a/catalogue/moredetail.pl (+38 lines)
Lines 174-179 foreach my $item (@items){ Link Here
174
        $item->{status_advisory} = 1;
174
        $item->{status_advisory} = 1;
175
    }
175
    }
176
176
177
    # Add paidfor info
178
    if ( $item->{itemlost} ) {
179
        my $accountlines = Koha::Account::Lines->search(
180
            {
181
                itemnumber        => $item->{itemnumber},
182
                accounttype       => 'LOST',
183
                status            => [ undef, { '<>' => 'RETURNED' } ],
184
                amountoutstanding => 0
185
            },
186
            {
187
                order_by => { '-desc' => 'date' },
188
                rows     => 1
189
            }
190
        );
191
192
        if ( my $accountline = $accountlines->next ) {
193
            my $payment_offsets = Koha::Account::Offsets->search(
194
                {
195
                    debit_id  => $accountline->id,
196
                    credit_id => { '!=' => undef }, # it is not the debit itself
197
                    type => { '!=' => [ 'Writeoff', 'Forgiven' ] },
198
                    amount => { '<' => 0 }    # credits are negative on the DB
199
                },
200
                { order_by => { '-desc' => 'created_on' } }
201
            );
202
203
            if ($payment_offsets->count) {
204
                my $patron = $accountline->patron;
205
                my $payment_offset = $payment_offsets->next;
206
                $item->{paidfor} =
207
                    $patron->firstname . " "
208
                  . $patron->surname . " "
209
                  . $patron->cardnumber . " "
210
                  . $payment_offset->created_on;
211
            }
212
        }
213
    }
214
177
    if (C4::Context->preference("IndependentBranches")) {
215
    if (C4::Context->preference("IndependentBranches")) {
178
        #verifying rights
216
        #verifying rights
179
        my $userenv = C4::Context->userenv();
217
        my $userenv = C4::Context->userenv();
(-)a/koha-tmpl/intranet-tmpl/prog/en/columns.def (-2 lines)
Lines 92-98 Link Here
92
<field name="items.itemnotes">Public note</field>
92
<field name="items.itemnotes">Public note</field>
93
<field name="items.itemnotes_nonpublic">Internal note</field>
93
<field name="items.itemnotes_nonpublic">Internal note</field>
94
<field name="items.holdingbranch">Current library</field>
94
<field name="items.holdingbranch">Current library</field>
95
<field name="items.paidfor">Paid for (unused)</field>
96
<field name="items.timestamp">Timestamp</field>
95
<field name="items.timestamp">Timestamp</field>
97
<field name="items.location">Shelving location</field>
96
<field name="items.location">Shelving location</field>
98
<field name="items.permanent_location">Permanent shelving location</field>
97
<field name="items.permanent_location">Permanent shelving location</field>
99
- 

Return to bug 19919