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

(-)a/C4/ILSDI/Services.pm (+9 lines)
Lines 243-248 sub GetRecords { Link Here
243
            my $holding_library = Koha::Libraries->find( $item->{holdingbranch} );
243
            my $holding_library = Koha::Libraries->find( $item->{holdingbranch} );
244
            $item->{'homebranchname'}    = $home_library    ? $home_library->branchname    : '';
244
            $item->{'homebranchname'}    = $home_library    ? $home_library->branchname    : '';
245
            $item->{'holdingbranchname'} = $holding_library ? $holding_library->branchname : '';
245
            $item->{'holdingbranchname'} = $holding_library ? $holding_library->branchname : '';
246
247
            my ($transferDate, $transferFrom, $transferTo) = GetTransfers($item->{itemnumber});
248
            if ($transferDate) {
249
                $item->{transfer} = {
250
                    datesent => $transferDate,
251
                    frombranch => $transferFrom,
252
                    tobranch => $transferTo,
253
                };
254
            }
246
        }
255
        }
247
256
248
        # Hashref building...
257
        # Hashref building...
(-)a/t/db_dependent/ILSDI_Services.t (-4 / +59 lines)
Lines 19-29 use Modern::Perl; Link Here
19
19
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
21
22
use Test::More tests => 6;
22
use Test::More tests => 7;
23
use Test::MockModule;
23
use Test::MockModule;
24
use t::lib::Mocks;
24
use t::lib::Mocks;
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
26
26
27
use C4::Items qw( ModItemTransfer );
28
use C4::Circulation qw( GetTransfers );
29
27
use Koha::AuthUtils;
30
use Koha::AuthUtils;
28
31
29
BEGIN {
32
BEGIN {
Lines 242-248 subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes Link Here
242
    $schema->storage->txn_rollback;
245
    $schema->storage->txn_rollback;
243
};
246
};
244
247
245
246
subtest 'LookupPatron test' => sub {
248
subtest 'LookupPatron test' => sub {
247
249
248
    plan tests => 9;
250
    plan tests => 9;
Lines 540-543 subtest 'Holds test for branch transfer limits' => sub { Link Here
540
    is( $reply->{code}, undef, "Record hold, Item con be transferred" );
542
    is( $reply->{code}, undef, "Record hold, Item con be transferred" );
541
543
542
    $schema->storage->txn_rollback;
544
    $schema->storage->txn_rollback;
543
}
545
};
546
547
subtest 'GetRecords' => sub {
548
549
    plan tests => 1;
550
551
    $schema->storage->txn_begin;
552
553
    t::lib::Mocks::mock_preference( 'ILS-DI', 1 );
554
555
    my $branch1 = $builder->build({
556
        source => 'Branch',
557
    });
558
    my $branch2 = $builder->build({
559
        source => 'Branch',
560
    });
561
562
    my $biblio = $builder->build({
563
        source => 'Biblio',
564
    });
565
    my $biblioitem = $builder->build({
566
        source => 'Biblioitem',
567
        value => {
568
            biblionumber => $biblio->{biblionumber},
569
        },
570
    });
571
    my $item = $builder->build({
572
        source => 'Item',
573
        value => {
574
            biblionumber => $biblio->{biblionumber},
575
            biblioitemnumber => $biblioitem->{biblioitemnumber},
576
            homebranch => $branch1->{branchcode},
577
            holdingbranch => $branch1->{branchcode},
578
        },
579
    });
580
581
    ModItemTransfer($item->{itemnumber}, $branch1->{branchcode}, $branch2->{branchcode});
582
583
    my $cgi = new CGI;
584
    $cgi->param(service => 'GetRecords');
585
    $cgi->param(id => $biblio->{biblionumber});
586
587
    my $reply = C4::ILSDI::Services::GetRecords($cgi);
588
589
    my ($datesent, $frombranch, $tobranch) = GetTransfers($item->{itemnumber});
590
    my $expected = {
591
        datesent => $datesent,
592
        frombranch => $frombranch,
593
        tobranch => $tobranch,
594
    };
595
    is_deeply($reply->{record}->[0]->{items}->{item}->[0]->{transfer}, $expected,
596
        'GetRecords returns transfer informations');
597
598
    $schema->storage->txn_rollback;
599
};
544
- 

Return to bug 19380