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

(-)a/C4/SIP/ILS/Item.pm (-5 / +9 lines)
Lines 82-91 sub new { Link Here
82
        return;
82
        return;
83
    }
83
    }
84
    my $self = $item->unblessed;
84
    my $self = $item->unblessed;
85
    $self->{      'id'       } = $item->barcode;     # to SIP, the barcode IS the id.
85
    $self->{_object}            = $item;
86
    $self->{permanent_location}= $item->homebranch;
86
    $self->{id}                 = $item->barcode; # to SIP, the barcode IS the id.
87
    $self->{'collection_code'} = $item->ccode;
87
    $self->{permanent_location} = $item->homebranch;
88
    $self->{  'call_number'  } = $item->itemcallnumber;
88
    $self->{collection_code}    = $item->ccode;
89
    $self->{call_number}        = $item->itemcallnumber;
89
90
90
    my $it = $item->effective_itemtype;
91
    my $it = $item->effective_itemtype;
91
    my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it );
92
    my $itemtype = Koha::Database->new()->schema()->resultset('Itemtype')->find( $it );
Lines 254-260 sub title_id { Link Here
254
255
255
sub sip_circulation_status {
256
sub sip_circulation_status {
256
    my $self = shift;
257
    my $self = shift;
257
    if ( $self->{patron} ) {
258
    if ( $self->{_object}->get_transfer ) {
259
        return '10'; # in transit between libraries
260
    }
261
    elsif ( $self->{patron} ) {
258
        return '04';    # charged
262
        return '04';    # charged
259
    }
263
    }
260
    elsif ( grep { $_->{itemnumber} == $self->{itemnumber}  } @{ $self->{hold_shelf} } ) {
264
    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 394-397 subtest checkin_withdrawn => sub { Link Here
394
    $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp );
395
    $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp );
395
    is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" );
396
    is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" );
396
};
397
};
398
399
subtest item_circulation_status => sub {
400
    plan tests => 2;
401
402
    my $library  = $builder->build_object( { class => 'Koha::Libraries' } );
403
    my $library2 = $builder->build_object( { class => 'Koha::Libraries' } );
404
405
    my $patron = $builder->build_object(
406
        {
407
            class => 'Koha::Patrons',
408
            value => {
409
                branchcode => $library->branchcode,
410
            }
411
        }
412
    );
413
414
    t::lib::Mocks::mock_userenv(
415
        { branchcode => $library->branchcode, flags => 1 } );
416
417
    my $item = $builder->build_sample_item(
418
        {
419
            library => $library->branchcode,
420
        }
421
    );
422
423
    my $sip_item = C4::SIP::ILS::Item->new( $item->barcode );
424
    my $status = $sip_item->sip_circulation_status;
425
    is( $status, '03', "Item circulation status is available");
426
427
    my $transfer = Koha::Item::Transfer->new({
428
        itemnumber => $item->id,
429
        datesent   => '2020-01-01',
430
        frombranch => $library->branchcode,
431
        tobranch   => $library2->branchcode,
432
    })->store();
433
434
    $sip_item = C4::SIP::ILS::Item->new( $item->barcode );
435
    $status = $sip_item->sip_circulation_status;
436
    is( '10', '10', "Item circulation status is in transit" );
437
};
397
$schema->storage->txn_rollback;
438
$schema->storage->txn_rollback;
398
- 

Return to bug 25344