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

(-)a/C4/SIP/ILS/Patron.pm (-32 / +16 lines)
Lines 121-126 sub new { Link Here
121
        }
121
        }
122
    }
122
    }
123
123
124
    # Get currency 3 chars max
125
    my $currency = substr Koha::Acquisition::Currencies->get_active->currency, 0, 3;
126
124
    my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" &&  defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
127
    my $circ_blocked =( C4::Context->preference('OverduesBlockCirc') ne "noblock" &&  defined $flags->{ODUES}->{itemlist} ) ? 1 : 0;
125
    {
128
    {
126
    no warnings;    # any of these $kp->{fields} being concat'd could be undef
129
    no warnings;    # any of these $kp->{fields} being concat'd could be undef
Lines 164-169 sub new { Link Here
164
        fine_blocked    => $fine_blocked,
167
        fine_blocked    => $fine_blocked,
165
        fee_limit       => $fee_limit,
168
        fee_limit       => $fee_limit,
166
        userid          => $kp->{userid},
169
        userid          => $kp->{userid},
170
        currency        => $currency,
167
    );
171
    );
168
    }
172
    }
169
173
Lines 205-213 sub new { Link Here
205
        }
209
        }
206
    }
210
    }
207
211
208
    # FIXME: populate fine_items recall_items
212
    # FIXME: populate recall_items
209
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
213
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
210
214
215
    # fine items
216
    my $debits = $patron->account->outstanding_debits;
217
    my @fine_items;
218
    while ( my $debit = $debits->next ) {
219
        push @fine_items, { account_line => sprintf '%s %.02f', $debit->description, $debit->amountoutstanding };
220
    }
221
    $ilspatron{fine_items} =\@fine_items;
222
211
    my $pending_checkouts = $patron->pending_checkouts;
223
    my $pending_checkouts = $patron->pending_checkouts;
212
    my @barcodes;
224
    my @barcodes;
213
    while ( my $c = $pending_checkouts->next ) {
225
    while ( my $c = $pending_checkouts->next ) {
Lines 390-395 sub x_items { Link Here
390
402
391
    my $item_list = [];
403
    my $item_list = [];
392
    if ($self->{$array_var}) {
404
    if ($self->{$array_var}) {
405
393
        if ($start && $start > 1) {
406
        if ($start && $start > 1) {
394
            --$start;
407
            --$start;
395
        }
408
        }
Lines 397-402 sub x_items { Link Here
397
            $start = 0;
410
            $start = 0;
398
        }
411
        }
399
        if ( $end && $end < @{$self->{$array_var}} ) {
412
        if ( $end && $end < @{$self->{$array_var}} ) {
413
          --$end;
400
        }
414
        }
401
        else {
415
        else {
402
            $end = @{$self->{$array_var}};
416
            $end = @{$self->{$array_var}};
Lines 430-467 sub charged_items { Link Here
430
    return $self->x_items('items', @_);
444
    return $self->x_items('items', @_);
431
}
445
}
432
sub fine_items {
446
sub fine_items {
433
    require Koha::Database;
434
    require Template;
435
436
    my $self = shift;
447
    my $self = shift;
437
    my $start = shift;
448
    return $self->x_items('fine_items', @_);
438
    my $end = shift;
439
    my $server = shift;
440
441
    my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
442
        {
443
            borrowernumber    => $self->{borrowernumber},
444
            amountoutstanding => { '>' => '0' },
445
        }
446
    );
447
448
    $start = $start ? $start - 1 : 0;
449
    $end   = $end   ? $end - 1   : scalar @fees - 1;
450
451
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
452
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
453
454
    my @return_values;
455
    for ( my $i = $start; $i <= $end; $i++ ) {
456
        my $fee = $fees[$i];
457
458
        next unless $fee;
459
460
        my $output = process_tt( $av_field_template, { accountline => $fee } );
461
        push( @return_values, { barcode => $output } );
462
    }
463
464
    return \@return_values;
465
}
449
}
466
sub recall_items {
450
sub recall_items {
467
    my $self = shift;
451
    my $self = shift;
(-)a/C4/SIP/Sip/MsgType.pm (-5 / +14 lines)
Lines 954-964 sub summary_info { Link Here
954
        { func => $patron->can("fine_items"),    fid => FID_FINE_ITEMS },
954
        { func => $patron->can("fine_items"),    fid => FID_FINE_ITEMS },
955
        { func => $patron->can("recall_items"),  fid => FID_RECALL_ITEMS },
955
        { func => $patron->can("recall_items"),  fid => FID_RECALL_ITEMS },
956
        { func => $patron->can("unavail_holds"), fid => FID_UNAVAILABLE_HOLD_ITEMS },
956
        { func => $patron->can("unavail_holds"), fid => FID_UNAVAILABLE_HOLD_ITEMS },
957
        { func => $patron->can("fine_items"),    fid => FID_FINE_ITEMS },
957
    );
958
    );
958
959
959
    my $summary_type = index( $summary, 'Y' );
960
    my $summary_type = index( $summary, 'Y' );
960
    return q{} if $summary_type == -1;    # No detailed information required.
961
    return q{} if $summary_type == -1;    # No detailed information required.
961
    return q{} if $summary_type > 5;      # Positions 6-9 are not defined in the sip spec,
962
    return q{} if $summary_type > 6;      # Positions 7-9 are not defined in the sip spec,
962
                                          # and we have no extensions to handle them.
963
                                          # and we have no extensions to handle them.
963
964
964
    siplog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} );
965
    siplog( "LOG_DEBUG", "Summary_info: index == '%d', field '%s'", $summary_type, $summary_map[$summary_type]->{fid} );
Lines 967-975 sub summary_info { Link Here
967
    my $fid      = $summary_map[$summary_type]->{fid};
968
    my $fid      = $summary_map[$summary_type]->{fid};
968
    my $itemlist = &$func( $patron, $start, $end, $server );
969
    my $itemlist = &$func( $patron, $start, $end, $server );
969
970
970
    siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map{ $_->{barcode} } @{$itemlist} ) );
971
    # fine items use account_line as key
971
    foreach my $i ( @{$itemlist} ) {
972
    if ( $summary_type == 6 ) {
972
        $resp .= add_field( $fid, $i->{barcode}, $server );
973
        siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map { $_->{account_line} } @{$itemlist} ) );
974
        foreach my $i ( @{$itemlist} ) {
975
            $resp .= add_field( $fid, $i->{account_line}, $server );
976
        }
977
    }
978
    else {
979
        siplog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", map{ $_->{barcode} } @{$itemlist} ) );
980
        foreach my $i ( @{$itemlist} ) {
981
            $resp .= add_field( $fid, $i->{barcode}, $server );
982
        }
973
    }
983
    }
974
984
975
    return $resp;
985
    return $resp;
976
- 

Return to bug 23426