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

(-)a/Koha/Acquisition/Booksellers.pm (-15 / +26 lines)
Lines 1-35 Link Here
1
package Koha::Acquisition::Booksellers;
1
package Koha::Acquisition::Booksellers;
2
2
3
use Modern::Perl;
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4
17
5
use Carp;
18
use Modern::Perl;
6
19
7
use Koha::Database;
20
use Koha::Acquisition::Bookseller;
8
21
9
use base qw( Koha::Objects );
22
use base qw( Koha::Objects );
10
23
11
use Koha::Acquisition::Bookseller;
24
=head1 NAME
12
25
13
sub search {
26
Koha::Acquisition::Booksellers Object set class
14
    my ( $self, $params, $attributes ) = @_;
15
27
28
=head1 API
16
29
17
    while ( my ( $field, $value ) = each %$params ) {
30
=head2 Class Methods
18
        if ( $field eq 'name' ) {
19
            # Use "like" if search on name
20
            $params->{name} = { -like => "%$value%" };
21
        }
22
    }
23
31
24
    $attributes->{order_by} ||= { -asc => 'name' };
32
=head3 _type (internal)
25
33
26
    return $self->SUPER::search( $params, $attributes );
34
=cut
27
}
28
35
29
sub _type {
36
sub _type {
30
    return 'Aqbookseller';
37
    return 'Aqbookseller';
31
}
38
}
32
39
40
=head3 object_class (internal)
41
42
=cut
43
33
sub object_class {
44
sub object_class {
34
    return 'Koha::Acquisition::Bookseller';
45
    return 'Koha::Acquisition::Bookseller';
35
}
46
}
(-)a/t/db_dependent/Bookseller.t (-2 / +1 lines)
Lines 129-135 for my $bookseller ( @booksellers ) { Link Here
129
129
130
$sample_supplier1->{id} = $id_supplier1;
130
$sample_supplier1->{id} = $id_supplier1;
131
is( scalar(@booksellers), $count + 2, "Get  Supplier1 and Supplier2" );
131
is( scalar(@booksellers), $count + 2, "Get  Supplier1 and Supplier2" );
132
my @tab = ( $sample_supplier1, $sample_supplier2 );
132
my @tab = ( $sample_supplier2, $sample_supplier1 );
133
is_deeply( \@booksellers, \@tab,
133
is_deeply( \@booksellers, \@tab,
134
    "Returns right fields of Supplier1 and Supplier2" );
134
    "Returns right fields of Supplier1 and Supplier2" );
135
135
136
- 

Return to bug 19130