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

(-)a/C4/SIP/ILS/Patron.pm (-32 / +16 lines)
Lines 124-129 sub new { Link Here
124
        }
124
        }
125
    }
125
    }
126
126
127
    # Get currency 3 chars max
128
    my $currency = substr Koha::Acquisition::Currencies->get_active->currency, 0, 3;
129
127
    my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" &&  defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
130
    my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" &&  defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
128
    {
131
    {
129
    no warnings;    # any of these $kp->{fields} being concat'd could be undef
132
    no warnings;    # any of these $kp->{fields} being concat'd could be undef
Lines 167-172 sub new { Link Here
167
        fine_blocked    => $fine_blocked,
170
        fine_blocked    => $fine_blocked,
168
        fee_limit       => $fee_limit,
171
        fee_limit       => $fee_limit,
169
        userid          => $kp->{userid},
172
        userid          => $kp->{userid},
173
        currency        => $currency,
170
    );
174
    );
171
    }
175
    }
172
176
Lines 208-216 sub new { Link Here
208
        }
212
        }
209
    }
213
    }
210
214
211
    # FIXME: populate fine_items recall_items
215
    # FIXME: populate recall_items
212
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
216
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
213
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
214
    my $pending_checkouts = $patron->pending_checkouts;
226
    my $pending_checkouts = $patron->pending_checkouts;
215
    my @barcodes;
227
    my @barcodes;
216
    while ( my $c = $pending_checkouts->next ) {
228
    while ( my $c = $pending_checkouts->next ) {
Lines 393-398 sub x_items { Link Here
393
405
394
    my $item_list = [];
406
    my $item_list = [];
395
    if ($self->{$array_var}) {
407
    if ($self->{$array_var}) {
408
396
        if ($start && $start > 1) {
409
        if ($start && $start > 1) {
397
            --$start;
410
            --$start;
398
        }
411
        }
Lines 400-405 sub x_items { Link Here
400
            $start = 0;
413
            $start = 0;
401
        }
414
        }
402
        if ( $end && $end < @{$self->{$array_var}} ) {
415
        if ( $end && $end < @{$self->{$array_var}} ) {
416
          --$end;
403
        }
417
        }
404
        else {
418
        else {
405
            $end = @{$self->{$array_var}};
419
            $end = @{$self->{$array_var}};
Lines 433-470 sub charged_items { Link Here
433
    return $self->x_items('items', @_);
447
    return $self->x_items('items', @_);
434
}
448
}
435
sub fine_items {
449
sub fine_items {
436
    require Koha::Database;
437
    require Template;
438
439
    my $self = shift;
450
    my $self = shift;
440
    my $start = shift;
451
    return $self->x_items('fine_items', @_);
441
    my $end = shift;
442
    my $server = shift;
443
444
    my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
445
        {
446
            borrowernumber    => $self->{borrowernumber},
447
            amountoutstanding => { '>' => '0' },
448
        }
449
    );
450
451
    $start = $start ? $start - 1 : 0;
452
    $end   = $end   ? $end - 1   : scalar @fees - 1;
453
454
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
455
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
456
457
    my @return_values;
458
    for ( my $i = $start; $i <= $end; $i++ ) {
459
        my $fee = $fees[$i];
460
461
        next unless $fee;
462
463
        my $output = process_tt( $av_field_template, { accountline => $fee } );
464
        push( @return_values, { barcode => $output } );
465
    }
466
467
    return \@return_values;
468
}
452
}
469
sub recall_items {
453
sub recall_items {
470
    my $self = shift;
454
    my $self = shift;
(-)a/C4/SIP/Sip/MsgType.pm (-5 / +13 lines)
Lines 958-968 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 },
961
    );
962
    );
962
963
963
    my $summary_type = index( $summary, 'Y' );
964
    my $summary_type = index( $summary, 'Y' );
964
    return q{} if $summary_type == -1;    # No detailed information required.
965
    return q{} if $summary_type == -1;    # No detailed information required.
965
    return q{} if $summary_type > 5;      # Positions 6-9 are not defined in the sip spec,
966
    return q{} if $summary_type > 6;      # Positions 7-9 are not defined in the sip spec,
966
                                          # and we have no extensions to handle them.
967
                                          # and we have no extensions to handle them.
967
968
968
    siplog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} );
969
    siplog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} );
Lines 971-979 sub summary_info { Link Here
971
    my $fid      = $summary_map[$summary_type]->{fid};
972
    my $fid      = $summary_map[$summary_type]->{fid};
972
    my $itemlist = &$func( $patron, $start, $end, $server );
973
    my $itemlist = &$func( $patron, $start, $end, $server );
973
974
974
    siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map{ $_->{barcode} } @{$itemlist} ) );
975
    # fine items use account_line as key
975
    foreach my $i ( @{$itemlist} ) {
976
    if ( $summary_type == 6 ) {
976
        $resp .= add_field( $fid, $i->{barcode}, $server );
977
        siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map { $_->{account_line} } @{$itemlist} ) );
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
        }
977
    }
986
    }
978
987
979
    return $resp;
988
    return $resp;
980
- 

Return to bug 23426