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

(-)a/C4/SIP/ILS/Patron.pm (-1 / +32 lines)
Lines 299-306 sub charged_items { Link Here
299
    return $self->x_items('items', @_);
299
    return $self->x_items('items', @_);
300
}
300
}
301
sub fine_items {
301
sub fine_items {
302
    require Koha::Database;
303
    require Template;
304
302
    my $self = shift;
305
    my $self = shift;
303
    return $self->x_items('fine_items', @_);
306
    my $start = shift;
307
    my $end = shift;
308
    my $server = shift;
309
310
    my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
311
        {
312
            borrowernumber    => $self->{borrowernumber},
313
            amountoutstanding => { '>' => '0' },
314
        }
315
    );
316
317
    $start = $start ? $start - 1 : 0;
318
    $end   = $end   ? $end       : scalar @fees - 1;
319
320
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
321
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
322
323
    my $tt = Template->new();
324
325
    my @return_values;
326
    for ( my $i = $start; $i <= $end; $i++ ) {
327
        my $fee = $fees[$i];
328
329
        my $output;
330
        $tt->process( \$av_field_template, { accountline => $fee }, \$output );
331
        push( @return_values, { barcode => $output } );
332
    }
333
334
    return \@return_values;
304
}
335
}
305
sub recall_items {
336
sub recall_items {
306
    my $self = shift;
337
    my $self = shift;
(-)a/C4/SIP/Sip/MsgType.pm (-3 / +3 lines)
Lines 890-896 sub handle_login { Link Here
890
# and we're going to believe it.
890
# and we're going to believe it.
891
#
891
#
892
sub summary_info {
892
sub summary_info {
893
    my ( $ils, $patron, $summary, $start, $end ) = @_;
893
    my ( $ils, $patron, $summary, $start, $end, $server ) = @_;
894
    my $resp = '';
894
    my $resp = '';
895
    my $summary_type;
895
    my $summary_type;
896
896
Lines 915-921 sub summary_info { Link Here
915
915
916
    my $func     = $summary_map[$summary_type]->{func};
916
    my $func     = $summary_map[$summary_type]->{func};
917
    my $fid      = $summary_map[$summary_type]->{fid};
917
    my $fid      = $summary_map[$summary_type]->{fid};
918
    my $itemlist = &$func( $patron, $start, $end );
918
    my $itemlist = &$func( $patron, $start, $end, $server );
919
919
920
    syslog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", @{$itemlist} ) );
920
    syslog( "LOG_DEBUG", "summary_info: list = (%s)", join( ", ", @{$itemlist} ) );
921
    foreach my $i ( @{$itemlist} ) {
921
    foreach my $i ( @{$itemlist} ) {
Lines 987-993 sub handle_patron_info { Link Here
987
        #          fine_items
987
        #          fine_items
988
        #        recall_items
988
        #        recall_items
989
989
990
        $resp .= summary_info( $ils, $patron, $summary, $start, $end );
990
        $resp .= summary_info( $ils, $patron, $summary, $start, $end, $server );
991
991
992
        $resp .= maybe_add( FID_HOME_ADDR,  $patron->address );
992
        $resp .= maybe_add( FID_HOME_ADDR,  $patron->address );
993
        $resp .= maybe_add( FID_EMAIL,      $patron->email_addr );
993
        $resp .= maybe_add( FID_EMAIL,      $patron->email_addr );
(-)a/etc/SIPconfig.xml (-1 / +2 lines)
Lines 42-48 Link Here
42
      <login id="lpl-sc" password="1234" institution="LPL" />
42
      <login id="lpl-sc" password="1234" institution="LPL" />
43
      <login id="lpl-sc-beacock" password="xyzzy"
43
      <login id="lpl-sc-beacock" password="xyzzy"
44
             delimiter="|" error-detect="enabled" institution="LPL"
44
             delimiter="|" error-detect="enabled" institution="LPL"
45
             send_patron_home_library_in_af="1" >
45
             send_patron_home_library_in_af="1"
46
             av_field_template="[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]" >
46
          <screen_msg_regex find="Greetings from Koha." replace="Welcome to your library!" />
47
          <screen_msg_regex find="Greetings from Koha." replace="Welcome to your library!" />
47
          <screen_msg_regex find="Invalid patron barcode." replace="Barcode not found, are you sure this is your library card?" />
48
          <screen_msg_regex find="Invalid patron barcode." replace="Barcode not found, are you sure this is your library card?" />
48
      </login>
49
      </login>
(-)a/misc/sip_cli_emulator.pl (-5 / +13 lines)
Lines 40-45 my $location_code; Link Here
40
my $patron_identifier;
40
my $patron_identifier;
41
my $patron_password;
41
my $patron_password;
42
42
43
my $summary;
44
43
my $item_identifier;
45
my $item_identifier;
44
46
45
my $fee_acknowledged = 0;
47
my $fee_acknowledged = 0;
Lines 55-67 GetOptions( Link Here
55
    "sp|sip_pass=s"                => \$login_password,    # sip password
57
    "sp|sip_pass=s"                => \$login_password,    # sip password
56
    "l|location|location_code=s"   => \$location_code,     # sip location code
58
    "l|location|location_code=s"   => \$location_code,     # sip location code
57
59
58
    "patron=s"   => \$patron_identifier,    # patron cardnumber or login
60
    "patron=s"   => \$patron_identifier,                   # patron cardnumber or login
59
    "password=s" => \$patron_password,      # patron's password
61
    "password=s" => \$patron_password,                     # patron's password
60
62
61
    "i|item=s" => \$item_identifier,
63
    "i|item=s" => \$item_identifier,
62
64
63
    "fa|fee-acknowledged" => \$fee_acknowledged,
65
    "fa|fee-acknowledged" => \$fee_acknowledged,
64
66
67
    "s|summary=s" => \$summary,
68
65
    "t|terminator=s" => \$terminator,
69
    "t|terminator=s" => \$terminator,
66
70
67
    "m|message=s" => \@messages,
71
    "m|message=s" => \@messages,
Lines 126-133 my $handlers = { Link Here
126
            patron_identifier => $patron_identifier,
130
            patron_identifier => $patron_identifier,
127
            terminal_password => $terminal_password,
131
            terminal_password => $terminal_password,
128
            patron_password   => $patron_password,
132
            patron_password   => $patron_password,
133
            summary           => $summary,
129
        },
134
        },
130
        optional => [ 'patron_password', ],
135
        optional => [ 'patron_password', 'summary' ],
131
    },
136
    },
132
    item_information => {
137
    item_information => {
133
        name       => 'Item Information',
138
        name       => 'Item Information',
Lines 312-319 sub build_patron_information_command_message { Link Here
312
    my $patron_identifier = $params->{patron_identifier};
317
    my $patron_identifier = $params->{patron_identifier};
313
    my $terminal_password = $params->{terminal_password};
318
    my $terminal_password = $params->{terminal_password};
314
    my $patron_password   = $params->{patron_password};
319
    my $patron_password   = $params->{patron_password};
320
    my $summary           = $params->{summary};
315
321
316
    my $summary = "          ";
322
    $summary //= "          ";
317
323
318
    return
324
    return
319
        PATRON_INFO
325
        PATRON_INFO
Lines 484-489 Options: Link Here
484
  --patron         ILS patron cardnumber or username
490
  --patron         ILS patron cardnumber or username
485
  --password       ILS patron password
491
  --password       ILS patron password
486
492
493
  -s --summary     Optionally define the patron information request summary field.
494
                   Please refer to the SIP2 protocol specification for details
495
487
  --item           ILS item identifier ( item barcode )
496
  --item           ILS item identifier ( item barcode )
488
497
489
  -t --terminator  SIP2 message terminator, either CR, or CRLF
498
  -t --terminator  SIP2 message terminator, either CR, or CRLF
490
- 

Return to bug 14512