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

(-)a/C4/SIP/ILS/Patron.pm (-10 / +38 lines)
Lines 215-228 sub new { Link Here
215
    # FIXME: populate recall_items
215
    # FIXME: populate recall_items
216
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
216
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
217
217
218
    # fine items
219
    my $debits = $patron->account->outstanding_debits;
220
    my @fine_items;
221
    while ( my $debit = $debits->next ) {
222
        push @fine_items, { account_line => sprintf '%s %.02f', $debit->description, $debit->amountoutstanding };
223
    }
224
    $ilspatron{fine_items} =\@fine_items;
225
226
    my $pending_checkouts = $patron->pending_checkouts;
218
    my $pending_checkouts = $patron->pending_checkouts;
227
    my @barcodes;
219
    my @barcodes;
228
    while ( my $c = $pending_checkouts->next ) {
220
    while ( my $c = $pending_checkouts->next ) {
Lines 447-455 sub charged_items { Link Here
447
    return $self->x_items('items', @_);
439
    return $self->x_items('items', @_);
448
}
440
}
449
sub fine_items {
441
sub fine_items {
450
    my $self = shift;
442
451
    return $self->x_items('fine_items', @_);
443
    require Koha::Database;
444
    require Template;
445
446
    my $self   = shift;
447
    my $start  = shift;
448
    my $end    = shift;
449
    my $server = shift;
450
451
    my @fees =
452
      Koha::Database->new()->schema()->resultset('Accountline')->search(
453
        {
454
            borrowernumber    => $self->{borrowernumber},
455
            amountoutstanding => { '>' => '0' },
456
        }
457
      );
458
459
    $start = $start ? $start - 1 : 0;
460
    $end   = $end   ? $end - 1   : scalar @fees - 1;
461
462
    my $av_field_template =
463
      $server ? $server->{account}->{av_field_template} : undef;
464
    $av_field_template ||=
465
"[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
466
467
    my @return_values;
468
    for ( my $i = $start ; $i <= $end ; $i++ ) {
469
        my $fee = $fees[$i];
470
471
        next unless $fee;
472
473
        my $output = process_tt( $av_field_template, { accountline => $fee } );
474
        push( @return_values, { barcode => $output } );
475
    }
476
477
    return \@return_values;
478
452
}
479
}
480
453
sub recall_items {
481
sub recall_items {
454
    my $self = shift;
482
    my $self = shift;
455
    return $self->x_items('recall_items', @_);
483
    return $self->x_items('recall_items', @_);
(-)a/C4/SIP/Sip/MsgType.pm (-14 / +4 lines)
Lines 958-969 sub summary_info { Link Here
958
        { func => $patron->can("fine_items"),    fid => FID_FINE_ITEMS },
958
        { func => $patron->can("fine_items"),    fid => FID_FINE_ITEMS },
959
        { func => $patron->can("recall_items"),  fid => FID_RECALL_ITEMS },
959
        { func => $patron->can("recall_items"),  fid => FID_RECALL_ITEMS },
960
        { func => $patron->can("unavail_holds"), fid => FID_UNAVAILABLE_HOLD_ITEMS },
960
        { func => $patron->can("unavail_holds"), fid => FID_UNAVAILABLE_HOLD_ITEMS },
961
        { func => $patron->can("fine_items"),    fid => FID_FINE_ITEMS },
962
    );
961
    );
963
962
964
    my $summary_type = index( $summary, 'Y' );
963
    my $summary_type = index( $summary, 'Y' );
965
    return q{} if $summary_type == -1;    # No detailed information required.
964
    return q{} if $summary_type == -1;    # No detailed information required.
966
    return q{} if $summary_type > 6;      # Positions 7-9 are not defined in the sip spec,
965
    return q{} if $summary_type > 5;      # Positions 6-9 are not defined in the sip spec,
967
                                          # and we have no extensions to handle them.
966
                                          # and we have no extensions to handle them.
968
967
969
    siplog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} );
968
    siplog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} );
Lines 972-988 sub summary_info { Link Here
972
    my $fid      = $summary_map[$summary_type]->{fid};
971
    my $fid      = $summary_map[$summary_type]->{fid};
973
    my $itemlist = &$func( $patron, $start, $end, $server );
972
    my $itemlist = &$func( $patron, $start, $end, $server );
974
973
975
    # fine items use account_line as key
974
    siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map { $_->{barcode} } @{$itemlist} ) );
976
    if ( $summary_type == 6 ) {
975
    foreach my $i ( @{$itemlist} ) {
977
        siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map { $_->{account_line} } @{$itemlist} ) );
976
        $resp .= add_field( $fid, $i->{barcode}, $server );
978
        foreach my $i ( @{$itemlist} ) {
979
            $resp .= add_field( $fid, $i->{account_line}, $server );
980
        }
981
    } else {
982
        siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map { $_->{barcode} } @{$itemlist} ) );
983
        foreach my $i ( @{$itemlist} ) {
984
            $resp .= add_field( $fid, $i->{barcode}, $server );
985
        }
986
    }
977
    }
987
978
988
    return $resp;
979
    return $resp;
989
- 

Return to bug 23426