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

(-)a/C4/SIP/Sip/MsgType.pm (-10 / +13 lines)
Lines 574-585 sub handle_checkout { Link Here
574
        $resp .= add_field( FID_ITEM_ID,   $item_id, $server );
574
        $resp .= add_field( FID_ITEM_ID,   $item_id, $server );
575
        $resp .= add_field( FID_TITLE_ID,  $item->title_id, $server );
575
        $resp .= add_field( FID_TITLE_ID,  $item->title_id, $server );
576
        if ( $item->due_date ) {
576
        if ( $item->due_date ) {
577
            my $due_date;
577
            my $due_date =
578
            if( $account->{format_due_date} ){
578
              $account->{format_due_date}
579
                $due_date = output_pref({ str => $item->due_date, as_due_date => 1 });
579
              ? output_pref( { str => $item->due_date, as_due_date => 1 } )
580
            } else {
580
              : timestamp( $item->due_date );
581
                $due_date = timestamp( $item->due_date );
582
            }
583
            $resp .= add_field( FID_DUE_DATE, $due_date, $server );
581
            $resp .= add_field( FID_DUE_DATE, $due_date, $server );
584
        } else {
582
        } else {
585
            $resp .= add_field( FID_DUE_DATE, q{}, $server );
583
            $resp .= add_field( FID_DUE_DATE, q{}, $server );
Lines 1203-1212 sub handle_fee_paid { Link Here
1203
1201
1204
sub handle_item_information {
1202
sub handle_item_information {
1205
    my ( $self, $server ) = @_;
1203
    my ( $self, $server ) = @_;
1206
    my $ils = $server->{ils};
1204
    my $account = $server->{account};
1205
    my $ils     = $server->{ils};
1206
    my $fields  = $self->{fields};
1207
    my $resp    = ITEM_INFO_RESP;
1207
    my $trans_date;
1208
    my $trans_date;
1208
    my $fields = $self->{fields};
1209
    my $resp   = ITEM_INFO_RESP;
1210
    my $item;
1209
    my $item;
1211
    my $i;
1210
    my $i;
1212
1211
Lines 1266-1272 sub handle_item_information { Link Here
1266
            $resp .= add_field( FID_HOLD_QUEUE_LEN, $i, $server );
1265
            $resp .= add_field( FID_HOLD_QUEUE_LEN, $i, $server );
1267
        }
1266
        }
1268
        if ( $item->due_date ) {
1267
        if ( $item->due_date ) {
1269
            $resp .= add_field( FID_DUE_DATE, timestamp( $item->due_date ), $server );
1268
            my $due_date =
1269
              $account->{format_due_date}
1270
              ? output_pref( { str => $item->due_date, as_due_date => 1 } )
1271
              : timestamp( $item->due_date );
1272
            $resp .= add_field( FID_DUE_DATE, $due_date, $server );
1270
        }
1273
        }
1271
        if ( ( $i = $item->recall_date ) != 0 ) {
1274
        if ( ( $i = $item->recall_date ) != 0 ) {
1272
            $resp .= add_field( FID_RECALL_DATE, timestamp($i), $server );
1275
            $resp .= add_field( FID_RECALL_DATE, timestamp($i), $server );
(-)a/t/db_dependent/SIP/Message.t (-2 / +13 lines)
Lines 231-237 subtest "Test build_additional_item_fields_string" => sub { Link Here
231
};
231
};
232
232
233
subtest "Test cr_item_field" => sub {
233
subtest "Test cr_item_field" => sub {
234
    plan tests => 2;
234
    plan tests => 3;
235
235
236
    my $builder = t::lib::TestBuilder->new();
236
    my $builder = t::lib::TestBuilder->new();
237
    my $branchcode  = $builder->build({ source => 'Branch' })->{branchcode};
237
    my $branchcode  = $builder->build({ source => 'Branch' })->{branchcode};
Lines 303-308 subtest "Test cr_item_field" => sub { Link Here
303
303
304
    my $itype = $item_object->itype;
304
    my $itype = $item_object->itype;
305
    ok( $response =~ m/CR$itype/, "Found correct CR field in response");
305
    ok( $response =~ m/CR$itype/, "Found correct CR field in response");
306
307
    $server->{account}->{format_due_date} = 1;
308
    t::lib::Mocks::mock_preference( 'dateFormat',  'sql' );
309
    my $issue = Koha::Checkout->new({ branchcode => $branchcode, borrowernumber => $patron1->{borrowernumber}, itemnumber => $item_object->itemnumber, date_due => "1999-01-01 12:59:00" })->store;
310
    $siprequest = ITEM_INFORMATION . 'YYYYMMDDZZZZHHMMSS' .
311
        FID_INST_ID . $branchcode . '|'.
312
        FID_ITEM_ID . $item_object->barcode . '|' .
313
        FID_TERMINAL_PWD . 'ignored' . '|';
314
    undef $response;
315
    $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
316
    $msg->handle_item_information( $server );
317
    ok( $response =~ m/AH1999-01-01 12:59/, "Found correct CR field in response");
306
};
318
};
307
319
308
subtest 'Patron info summary > 5 should not crash server' => sub {
320
subtest 'Patron info summary > 5 should not crash server' => sub {
309
- 

Return to bug 31552