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

(-)a/C4/SIP/ILS/Item.pm (-5 / +9 lines)
Lines 83-92 sub new { Link Here
83
        return;
83
        return;
84
    }
84
    }
85
    my $self = $item->unblessed;
85
    my $self = $item->unblessed;
86
    $self->{      'id'       } = $item->barcode;     # to SIP, the barcode IS the id.
86
    $self->{_object}            = $item;
87
    $self->{permanent_location}= $item->homebranch;
87
    $self->{id}                 = $item->barcode; # to SIP, the barcode IS the id.
88
    $self->{'collection_code'} = $item->ccode;
88
    $self->{permanent_location} = $item->homebranch;
89
    $self->{  'call_number'  } = $item->itemcallnumber;
89
    $self->{collection_code}    = $item->ccode;
90
    $self->{call_number}        = $item->itemcallnumber;
90
91
91
    $self->{object} = $item;
92
    $self->{object} = $item;
92
93
Lines 257-263 sub title_id { Link Here
257
258
258
sub sip_circulation_status {
259
sub sip_circulation_status {
259
    my $self = shift;
260
    my $self = shift;
260
    if ( $self->{borrowernumber} ) {
261
    if ( $self->{_object}->get_transfer ) {
262
        return '10'; # in transit between libraries
263
    }
264
    elsif ( $self->{borrowernumber} ) {
261
        return '04';    # charged
265
        return '04';    # charged
262
    }
266
    }
263
    elsif ( grep { $_->{itemnumber} == $self->{itemnumber}  } @{ $self->{hold_shelf} } ) {
267
    elsif ( grep { $_->{itemnumber} == $self->{itemnumber}  } @{ $self->{hold_shelf} } ) {
(-)a/t/db_dependent/SIP/Transaction.t (-2 / +42 lines)
Lines 4-10 Link Here
4
# Current state is very rudimentary. Please help to extend it!
4
# Current state is very rudimentary. Please help to extend it!
5
5
6
use Modern::Perl;
6
use Modern::Perl;
7
use Test::More tests => 10;
7
use Test::More tests => 11;
8
8
9
use Koha::Database;
9
use Koha::Database;
10
use t::lib::TestBuilder;
10
use t::lib::TestBuilder;
Lines 20-25 use C4::SIP::ILS::Transaction::Checkin; Link Here
20
20
21
use C4::Reserves;
21
use C4::Reserves;
22
use Koha::CirculationRules;
22
use Koha::CirculationRules;
23
use Koha::Item::Transfer;
23
use Koha::DateUtils qw( dt_from_string output_pref );
24
use Koha::DateUtils qw( dt_from_string output_pref );
24
25
25
my $schema = Koha::Database->new->schema;
26
my $schema = Koha::Database->new->schema;
Lines 396-399 subtest checkin_withdrawn => sub { Link Here
396
    $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp );
397
    $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp );
397
    is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" );
398
    is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" );
398
};
399
};
400
401
subtest item_circulation_status => sub {
402
    plan tests => 2;
403
404
    my $library  = $builder->build_object( { class => 'Koha::Libraries' } );
405
    my $library2 = $builder->build_object( { class => 'Koha::Libraries' } );
406
407
    my $patron = $builder->build_object(
408
        {
409
            class => 'Koha::Patrons',
410
            value => {
411
                branchcode => $library->branchcode,
412
            }
413
        }
414
    );
415
416
    t::lib::Mocks::mock_userenv(
417
        { branchcode => $library->branchcode, flags => 1 } );
418
419
    my $item = $builder->build_sample_item(
420
        {
421
            library => $library->branchcode,
422
        }
423
    );
424
425
    my $sip_item = C4::SIP::ILS::Item->new( $item->barcode );
426
    my $status = $sip_item->sip_circulation_status;
427
    is( $status, '03', "Item circulation status is available");
428
429
    my $transfer = Koha::Item::Transfer->new({
430
        itemnumber => $item->id,
431
        datesent   => '2020-01-01',
432
        frombranch => $library->branchcode,
433
        tobranch   => $library2->branchcode,
434
    })->store();
435
436
    $sip_item = C4::SIP::ILS::Item->new( $item->barcode );
437
    $status = $sip_item->sip_circulation_status;
438
    is( $status, '10', "Item circulation status is in transit" );
439
};
399
$schema->storage->txn_rollback;
440
$schema->storage->txn_rollback;
400
- 

Return to bug 25344