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

(-)a/C4/Items.pm (-1 / +1 lines)
Lines 636-642 sub GetItemsForInventory { Link Here
636
            '+select' => [ 'marc_subfield_structures.kohafield', 'marc_subfield_structures.frameworkcode', 'me.authorised_value', 'me.lib' ],
636
            '+select' => [ 'marc_subfield_structures.kohafield', 'marc_subfield_structures.frameworkcode', 'me.authorised_value', 'me.lib' ],
637
            '+as'     => [ 'kohafield',                          'frameworkcode',                          'authorised_value',    'lib' ],
637
            '+as'     => [ 'kohafield',                          'frameworkcode',                          'authorised_value',    'lib' ],
638
        }
638
        }
639
    );
639
    )->as_list;
640
640
641
    my $avmapping = { map { $_->get_column('kohafield') . ',' . $_->get_column('frameworkcode') . ',' . $_->get_column('authorised_value') => $_->get_column('lib') } @avs };
641
    my $avmapping = { map { $_->get_column('kohafield') . ',' . $_->get_column('frameworkcode') . ',' . $_->get_column('authorised_value') => $_->get_column('lib') } @avs };
642
642
(-)a/Koha/ItemType.pm (-1 / +1 lines)
Lines 80-86 sub translated_descriptions { Link Here
80
        {   entity => 'itemtypes',
80
        {   entity => 'itemtypes',
81
            code   => $self->itemtype,
81
            code   => $self->itemtype,
82
        }
82
        }
83
    );
83
    )->as_list;
84
    return [ map {
84
    return [ map {
85
        {
85
        {
86
            lang => $_->lang,
86
            lang => $_->lang,
(-)a/Koha/Patron/HouseboundProfile.pm (-1 / +1 lines)
Lines 51-57 Returns an arrayref of all visits associated this houseboundProfile. Link Here
51
sub housebound_visits {
51
sub housebound_visits {
52
    my ( $self ) = @_;
52
    my ( $self ) = @_;
53
    my @visits = Koha::Patron::HouseboundVisits
53
    my @visits = Koha::Patron::HouseboundVisits
54
        ->special_search({ borrowernumber => $self->borrowernumber });
54
        ->special_search({ borrowernumber => $self->borrowernumber })->as_list;
55
    return \@visits;
55
    return \@visits;
56
}
56
}
57
57
(-)a/reports/guided_reports.pl (-2 / +2 lines)
Lines 749-755 elsif ($phase eq 'Run this report'){ Link Here
749
                        }
749
                        }
750
                    }
750
                    }
751
                    elsif ( $authorised_value eq "biblio_framework" ) {
751
                    elsif ( $authorised_value eq "biblio_framework" ) {
752
                        my @frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] });
752
                        my @frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] })->as_list;
753
                        my $default_source = '';
753
                        my $default_source = '';
754
                        push @authorised_values,$default_source;
754
                        push @authorised_values,$default_source;
755
                        $authorised_lib{$default_source} = 'Default';
755
                        $authorised_lib{$default_source} = 'Default';
Lines 769-775 elsif ($phase eq 'Run this report'){ Link Here
769
                        }
769
                        }
770
                    }
770
                    }
771
                    elsif ( $authorised_value eq "categorycode" ) {
771
                    elsif ( $authorised_value eq "categorycode" ) {
772
                        my @patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description']});
772
                        my @patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description']})->as_list;
773
                        %authorised_lib = map { $_->categorycode => $_->description } @patron_categories;
773
                        %authorised_lib = map { $_->categorycode => $_->description } @patron_categories;
774
                        push @authorised_values, $_->categorycode for @patron_categories;
774
                        push @authorised_values, $_->categorycode for @patron_categories;
775
                    }
775
                    }
(-)a/t/db_dependent/Acquisition.t (-5 / +5 lines)
Lines 911-922 subtest 'Acquisition logging' => sub { Link Here
911
911
912
    Koha::ActionLogs->delete;
912
    Koha::ActionLogs->delete;
913
    my $basketno = NewBasket( $booksellerid, 1 );
913
    my $basketno = NewBasket( $booksellerid, 1 );
914
    my @create_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'ADD_BASKET', object => $basketno });
914
    my @create_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'ADD_BASKET', object => $basketno })->as_list;
915
    is (scalar @create_logs, 1, 'Basket creation is logged');
915
    is (scalar @create_logs, 1, 'Basket creation is logged');
916
916
917
    Koha::ActionLogs->delete;
917
    Koha::ActionLogs->delete;
918
    C4::Acquisition::ReopenBasket($basketno);
918
    C4::Acquisition::ReopenBasket($basketno);
919
    my @reopen_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'REOPEN_BASKET', object => $basketno });
919
    my @reopen_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'REOPEN_BASKET', object => $basketno })->as_list;
920
    is (scalar @reopen_logs, 1, 'Basket reopen is logged');
920
    is (scalar @reopen_logs, 1, 'Basket reopen is logged');
921
921
922
    Koha::ActionLogs->delete;
922
    Koha::ActionLogs->delete;
Lines 924-940 subtest 'Acquisition logging' => sub { Link Here
924
        basketno => $basketno,
924
        basketno => $basketno,
925
        booksellerid => $booksellerid
925
        booksellerid => $booksellerid
926
    });
926
    });
927
    my @mod_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'MODIFY_BASKET', object => $basketno });
927
    my @mod_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'MODIFY_BASKET', object => $basketno })->as_list;
928
    is (scalar @mod_logs, 1, 'Basket modify is logged');
928
    is (scalar @mod_logs, 1, 'Basket modify is logged');
929
929
930
    Koha::ActionLogs->delete;
930
    Koha::ActionLogs->delete;
931
    C4::Acquisition::ModBasketHeader($basketno,"Test","","","",$booksellerid);
931
    C4::Acquisition::ModBasketHeader($basketno,"Test","","","",$booksellerid);
932
    my @mod_header_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'MODIFY_BASKET_HEADER', object => $basketno });
932
    my @mod_header_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'MODIFY_BASKET_HEADER', object => $basketno })->as_list;
933
    is (scalar @mod_header_logs, 1, 'Basket header modify is logged');
933
    is (scalar @mod_header_logs, 1, 'Basket header modify is logged');
934
934
935
    Koha::ActionLogs->delete;
935
    Koha::ActionLogs->delete;
936
    C4::Acquisition::ModBasketUsers($basketno,(1));
936
    C4::Acquisition::ModBasketUsers($basketno,(1));
937
    my @mod_users_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'MODIFY_BASKET_USERS', object => $basketno });
937
    my @mod_users_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'MODIFY_BASKET_USERS', object => $basketno })->as_list;
938
    is (scalar @mod_users_logs, 1, 'Basket users modify is logged');
938
    is (scalar @mod_users_logs, 1, 'Basket users modify is logged');
939
939
940
    t::lib::Mocks::mock_preference('AcquisitionLog', 0);
940
    t::lib::Mocks::mock_preference('AcquisitionLog', 0);
(-)a/t/db_dependent/Koha/Acquisition/Basket.t (-1 / +1 lines)
Lines 425-431 subtest 'close() tests' => sub { Link Here
425
        'Koha::Exceptions::Acquisition::Basket::AlreadyClosed',
425
        'Koha::Exceptions::Acquisition::Basket::AlreadyClosed',
426
        'Trying to close an already closed basket throws an exception';
426
        'Trying to close an already closed basket throws an exception';
427
427
428
    my @close_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'CLOSE_BASKET', object => $basket->id });
428
    my @close_logs = Koha::ActionLogs->search({ module =>'ACQUISITIONS', action => 'CLOSE_BASKET', object => $basket->id })->as_list;
429
    is (scalar @close_logs, 1, 'Basket closure is logged');
429
    is (scalar @close_logs, 1, 'Basket closure is logged');
430
430
431
    $schema->storage->txn_rollback;
431
    $schema->storage->txn_rollback;
(-)a/t/db_dependent/Patron/HouseboundProfiles.t (-1 / +1 lines)
Lines 41-47 is( Link Here
41
);
41
);
42
42
43
my @profiles = Koha::Patron::HouseboundProfiles
43
my @profiles = Koha::Patron::HouseboundProfiles
44
    ->search({ day => $profile->{day} });
44
    ->search({ day => $profile->{day} })->as_list;
45
my $found_profile = shift @profiles;
45
my $found_profile = shift @profiles;
46
is(
46
is(
47
    $found_profile->borrowernumber,
47
    $found_profile->borrowernumber,
(-)a/t/db_dependent/Patron/HouseboundRoles.t (-1 / +1 lines)
Lines 42-48 is( Link Here
42
);
42
);
43
43
44
my @roles = Koha::Patron::HouseboundRoles
44
my @roles = Koha::Patron::HouseboundRoles
45
    ->search({ borrowernumber_id => $role->{borrowernumber_id} });
45
    ->search({ borrowernumber_id => $role->{borrowernumber_id} })->as_list;
46
my $found_role = shift @roles;
46
my $found_role = shift @roles;
47
is(
47
is(
48
    $found_role->borrowernumber_id,
48
    $found_role->borrowernumber_id,
(-)a/t/db_dependent/Patron/HouseboundVisits.t (-3 / +3 lines)
Lines 45-51 is( Link Here
45
45
46
# Does it work implicitly?
46
# Does it work implicitly?
47
my @visits = Koha::Patron::HouseboundVisits
47
my @visits = Koha::Patron::HouseboundVisits
48
    ->special_search({ borrowernumber => $visit->{borrowernumber} });
48
    ->special_search({ borrowernumber => $visit->{borrowernumber} })->as_list;
49
my $found_visit = shift @visits;
49
my $found_visit = shift @visits;
50
is(
50
is(
51
    $found_visit->borrowernumber,
51
    $found_visit->borrowernumber,
Lines 55-61 is( Link Here
55
55
56
# Does it work Explicitly?
56
# Does it work Explicitly?
57
@visits = Koha::Patron::HouseboundVisits
57
@visits = Koha::Patron::HouseboundVisits
58
    ->special_search({ 'me.borrowernumber' => $visit->{borrowernumber} });
58
    ->special_search({ 'me.borrowernumber' => $visit->{borrowernumber} })->as_list;
59
$found_visit = shift @visits;
59
$found_visit = shift @visits;
60
is(
60
is(
61
    $found_visit->borrowernumber,
61
    $found_visit->borrowernumber,
Lines 65-71 is( Link Here
65
65
66
# Does it work without prefetcing?
66
# Does it work without prefetcing?
67
@visits = Koha::Patron::HouseboundVisits
67
@visits = Koha::Patron::HouseboundVisits
68
    ->special_search({ borrowernumber => $visit->{borrowernumber} }, { prefetch => [] });
68
    ->special_search({ borrowernumber => $visit->{borrowernumber} }, { prefetch => [] })->as_list;
69
$found_visit = shift @visits;
69
$found_visit = shift @visits;
70
is(
70
is(
71
    $found_visit->borrowernumber,
71
    $found_visit->borrowernumber,
(-)a/t/db_dependent/Patron/Relationships.t (-11 / +4 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 59;
20
use Test::More tests => 54;
21
21
22
use C4::Context;
22
use C4::Context;
23
23
Lines 90-96 Koha::Patron::Relationship->new({ guarantor_id => $chelsea->id, guarantee_id => Link Here
90
90
91
my @gr;
91
my @gr;
92
92
93
@gr = $kyle->guarantee_relationships();
93
@gr = $kyle->guarantee_relationships()->as_list;
94
is( @gr, 2, 'Found 2 guarantee relationships for father' );
94
is( @gr, 2, 'Found 2 guarantee relationships for father' );
95
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' );
95
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' );
96
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' );
96
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' );
Lines 108-114 is( $gr[1]->guarantee->id, $kylie->id, 'Koha::Patron returned is the correct gua Link Here
108
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' );
108
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' );
109
is( $gr[1]->guarantor->id, $kyle->id, 'Koha::Patron returned is the correct guarantor' );
109
is( $gr[1]->guarantor->id, $kyle->id, 'Koha::Patron returned is the correct guarantor' );
110
110
111
@gr = $chelsea->guarantee_relationships();
111
@gr = $chelsea->guarantee_relationships()->as_list;
112
is( @gr, 2, 'Found 2 guarantee relationships for mother' );
112
is( @gr, 2, 'Found 2 guarantee relationships for mother' );
113
is( $gr[0]->guarantor_id, $chelsea->id, 'Guarantor matches for first relationship' );
113
is( $gr[0]->guarantor_id, $chelsea->id, 'Guarantor matches for first relationship' );
114
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' );
114
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' );
Lines 126-132 is( $gr[1]->guarantee->id, $kylie->id, 'Koha::Patron returned is the correct gua Link Here
126
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' );
126
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' );
127
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' );
127
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' );
128
128
129
@gr = $daria->guarantor_relationships();
129
@gr = $daria->guarantor_relationships()->as_list;
130
is( @gr, 2, 'Found 4 guarantor relationships for child' );
130
is( @gr, 2, 'Found 4 guarantor relationships for child' );
131
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' );
131
is( $gr[0]->guarantor_id, $kyle->id, 'Guarantor matches for first relationship' );
132
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' );
132
is( $gr[0]->guarantee_id, $daria->id, 'Guarantee matches for first relationship' );
Lines 144-156 is( $gr[1]->guarantee->id, $daria->id, 'Koha::Patron returned is the correct gua Link Here
144
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' );
144
is( ref($gr[1]->guarantor), 'Koha::Patron', 'Method guarantor returns a Koha::Patron' );
145
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' );
145
is( $gr[1]->guarantor->id, $chelsea->id, 'Koha::Patron returned is the correct guarantor' );
146
146
147
my @siblings = $daria->siblings;
148
is( @siblings, 1, 'Method siblings called in list context returns list' );
149
is( ref($siblings[0]), 'Koha::Patron', 'List contains a Koha::Patron' );
150
is( $siblings[0]->firstname, 'Kylie', 'Sibling from list first name matches correctly' );
151
is( $siblings[0]->surname, 'Hall', 'Sibling from list surname matches correctly' );
152
is( $siblings[0]->id, $kylie->id, 'Sibling from list patron id matches correctly' );
153
154
my $siblings = $daria->siblings;
147
my $siblings = $daria->siblings;
155
my $sibling = $siblings->next();
148
my $sibling = $siblings->next();
156
is( ref($siblings), 'Koha::Patrons', 'Calling siblings in scalar context results in a Koha::Patrons object' );
149
is( ref($siblings), 'Koha::Patrons', 'Calling siblings in scalar context results in a Koha::Patrons object' );
(-)a/t/db_dependent/Template/Plugin/Categories.t (-2 / +2 lines)
Lines 36-46 my $nb_categories = Koha::Patron::Categories->count; Link Here
36
36
37
# Create sample categories
37
# Create sample categories
38
my $category_1 = $builder->build( { source => 'Category' } );
38
my $category_1 = $builder->build( { source => 'Category' } );
39
my @categories = Koha::Template::Plugin::Categories->new->all;
39
my @categories = Koha::Template::Plugin::Categories->new->all->as_list;
40
is( scalar(@categories), 1 + $nb_categories, '->all returns all defined categories' );
40
is( scalar(@categories), 1 + $nb_categories, '->all returns all defined categories' );
41
41
42
my $category_2 = $builder->build( { source => 'Category' } );
42
my $category_2 = $builder->build( { source => 'Category' } );
43
@categories = Koha::Template::Plugin::Categories->new->all;
43
@categories = Koha::Template::Plugin::Categories->new->all->as_list;
44
is( scalar(@categories), 2 + $nb_categories, '->all returns all defined categories' );
44
is( scalar(@categories), 2 + $nb_categories, '->all returns all defined categories' );
45
45
46
is( Koha::Template::Plugin::Categories->GetName(
46
is( Koha::Template::Plugin::Categories->GetName(
(-)a/t/db_dependent/Utils/Datatables_Virtualshelves.t (-2 / +1 lines)
Lines 38-44 my $dbh = C4::Context->dbh; Link Here
38
$dbh->do(q|DELETE FROM virtualshelves|);
38
$dbh->do(q|DELETE FROM virtualshelves|);
39
39
40
# Pick a categorycode from the DB
40
# Pick a categorycode from the DB
41
my @categories   = Koha::Patron::Categories->search_with_library_limits;
41
my @categories   = Koha::Patron::Categories->search_with_library_limits->as_list;
42
my $categorycode = $categories[0]->categorycode;
42
my $categorycode = $categories[0]->categorycode;
43
my $branchcode   = "ABC";
43
my $branchcode   = "ABC";
44
my $branch_data = {
44
my $branch_data = {
45
- 

Return to bug 29844