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 (-3 / +58 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 => 5;
22
use Test::More tests => 6;
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 243-249 subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes Link Here
243
    $schema->storage->txn_rollback;
246
    $schema->storage->txn_rollback;
244
};
247
};
245
248
246
247
subtest 'LookupPatron test' => sub {
249
subtest 'LookupPatron test' => sub {
248
250
249
    plan tests => 9;
251
    plan tests => 9;
Lines 449-451 subtest 'Holds test' => sub { Link Here
449
451
450
    $schema->storage->txn_rollback;
452
    $schema->storage->txn_rollback;
451
};
453
};
452
- 
454
455
subtest 'GetRecords' => sub {
456
457
    plan tests => 1;
458
459
    $schema->storage->txn_begin;
460
461
    t::lib::Mocks::mock_preference( 'ILS-DI', 1 );
462
463
    my $branch1 = $builder->build({
464
        source => 'Branch',
465
    });
466
    my $branch2 = $builder->build({
467
        source => 'Branch',
468
    });
469
470
    my $biblio = $builder->build({
471
        source => 'Biblio',
472
    });
473
    my $biblioitem = $builder->build({
474
        source => 'Biblioitem',
475
        value => {
476
            biblionumber => $biblio->{biblionumber},
477
        },
478
    });
479
    my $item = $builder->build({
480
        source => 'Item',
481
        value => {
482
            biblionumber => $biblio->{biblionumber},
483
            biblioitemnumber => $biblioitem->{biblioitemnumber},
484
            homebranch => $branch1->{branchcode},
485
            holdingbranch => $branch1->{branchcode},
486
        },
487
    });
488
489
    ModItemTransfer($item->{itemnumber}, $branch1->{branchcode}, $branch2->{branchcode});
490
491
    my $cgi = new CGI;
492
    $cgi->param(service => 'GetRecords');
493
    $cgi->param(id => $biblio->{biblionumber});
494
495
    my $reply = C4::ILSDI::Services::GetRecords($cgi);
496
497
    my ($datesent, $frombranch, $tobranch) = GetTransfers($item->{itemnumber});
498
    my $expected = {
499
        datesent => $datesent,
500
        frombranch => $frombranch,
501
        tobranch => $tobranch,
502
    };
503
    is_deeply($reply->{record}->[0]->{items}->{item}->[0]->{transfer}, $expected,
504
        'GetRecords returns transfer informations');
505
506
    $schema->storage->txn_rollback;
507
};

Return to bug 19380