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

(-)a/C4/SIP/ILS/Patron.pm (-1 / +32 lines)
Lines 295-302 sub charged_items { Link Here
295
    return $self->x_items('items', @_);
295
    return $self->x_items('items', @_);
296
}
296
}
297
sub fine_items {
297
sub fine_items {
298
    require Koha::Database;
299
    require Template;
300
298
    my $self = shift;
301
    my $self = shift;
299
    return $self->x_items('fine_items', @_);
302
    my $start = shift;
303
    my $end = shift;
304
    my $server = shift;
305
306
    my @fees = Koha::Database->new()->schema()->resultset('Accountline')->search(
307
        {
308
            borrowernumber    => $self->{borrowernumber},
309
            amountoutstanding => { '>' => '0' },
310
        }
311
    );
312
313
    $start = $start ? $start - 1 : 0;
314
    $end   = $end   ? $end       : scalar @fees - 1;
315
316
    my $av_field_template = $server ? $server->{account}->{av_field_template} : undef;
317
    $av_field_template ||= "[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]";
318
319
    my $tt = Template->new();
320
321
    my @return_values;
322
    for ( my $i = $start; $i <= $end; $i++ ) {
323
        my $fee = $fees[$i];
324
325
        my $output;
326
        $tt->process( \$av_field_template, { accountline => $fee }, \$output );
327
        push( @return_values, { barcode => $output } );
328
    }
329
330
    return \@return_values;
300
}
331
}
301
sub recall_items {
332
sub recall_items {
302
    my $self = shift;
333
    my $self = shift;
(-)a/C4/SIP/Sip/MsgType.pm (-8 / +8 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 898-908 sub summary_info { Link Here
898
    # message to the corresponding field and handler
898
    # message to the corresponding field and handler
899
    #
899
    #
900
    my @summary_map = (
900
    my @summary_map = (
901
        { func => $patron->can(   "hold_items"), fid => FID_HOLD_ITEMS             },
901
        { func => $patron->can("hold_items"),    fid => FID_HOLD_ITEMS },
902
        { func => $patron->can("overdue_items"), fid => FID_OVERDUE_ITEMS          },
902
        { func => $patron->can("overdue_items"), fid => FID_OVERDUE_ITEMS },
903
        { func => $patron->can("charged_items"), fid => FID_CHARGED_ITEMS          },
903
        { func => $patron->can("charged_items"), fid => FID_CHARGED_ITEMS },
904
        { func => $patron->can(   "fine_items"), fid => FID_FINE_ITEMS             },
904
        { func => $patron->can("fine_items"),    fid => FID_FINE_ITEMS },
905
        { func => $patron->can( "recall_items"), fid => FID_RECALL_ITEMS           },
905
        { func => $patron->can("recall_items"),  fid => FID_RECALL_ITEMS },
906
        { func => $patron->can("unavail_holds"), fid => FID_UNAVAILABLE_HOLD_ITEMS },
906
        { func => $patron->can("unavail_holds"), fid => FID_UNAVAILABLE_HOLD_ITEMS },
907
    );
907
    );
908
908
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 991-997 sub handle_patron_info { Link Here
991
        #          fine_items
991
        #          fine_items
992
        #        recall_items
992
        #        recall_items
993
993
994
        $resp .= summary_info($ils, $patron, $summary, $start, $end);
994
        $resp .= summary_info($ils, $patron, $summary, $start, $end, $server);
995
995
996
        $resp .= maybe_add(FID_HOME_ADDR,  $patron->address);
996
        $resp .= maybe_add(FID_HOME_ADDR,  $patron->address);
997
        $resp .= maybe_add(FID_EMAIL,      $patron->email_addr);
997
        $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