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

(-)a/Koha/Objects.pm (-4 / +9 lines)
Lines 105-111 sub search { Link Here
105
105
106
    }
106
    }
107
    else {
107
    else {
108
        my $class = ref( $self );
108
        my $class = ref($self) ? ref($self) : $self;
109
        my $rs = $self->_resultset()->search($params);
109
        my $rs = $self->_resultset()->search($params);
110
110
111
        return $class->new_from_dbic($rs);
111
        return $class->new_from_dbic($rs);
Lines 202-211 Returns the internal resultset or creates it if undefined Link Here
202
sub _resultset {
202
sub _resultset {
203
    my ($self) = @_;
203
    my ($self) = @_;
204
204
205
    $self->{_resultset} ||=
205
    if ( ref($self) ) {
206
      Koha::Database->new()->schema()->resultset( $self->type() );
206
        $self->{_resultset} ||=
207
          Koha::Database->new()->schema()->resultset( $self->type() );
207
208
208
    $self->{_resultset};
209
        return $self->{_resultset};
210
    }
211
    else {
212
        return Koha::Database->new()->schema()->resultset( $self->type() );
213
    }
209
}
214
}
210
215
211
=head3 type
216
=head3 type
(-)a/t/db_dependent/Borrowers.t (-4 / +3 lines)
Lines 66-78 my $b3 = Koha::Borrower->new( Link Here
66
);
66
);
67
$b3->store();
67
$b3->store();
68
68
69
my $b1_new = Koha::Borrowers->new()->find( $b1->borrowernumber() );
69
my $b1_new = Koha::Borrowers->find( $b1->borrowernumber() );
70
is( $b1->surname(), $b1_new->surname(), "Found matching borrower" );
70
is( $b1->surname(), $b1_new->surname(), "Found matching borrower" );
71
71
72
my @borrowers = Koha::Borrowers->new()->search( { branchcode => $branchcode } );
72
my @borrowers = Koha::Borrowers->search( { branchcode => $branchcode } );
73
is( @borrowers, 3, "Found 3 borrowers with Search" );
73
is( @borrowers, 3, "Found 3 borrowers with Search" );
74
74
75
my $borrowers = Koha::Borrowers->new()->search( { branchcode => $branchcode } );
75
my $borrowers = Koha::Borrowers->search( { branchcode => $branchcode } );
76
is( $borrowers->count( { branchcode => $branchcode } ), 3, "Counted 3 borrowers with Count" );
76
is( $borrowers->count( { branchcode => $branchcode } ), 3, "Counted 3 borrowers with Count" );
77
77
78
my $b = $borrowers->next();
78
my $b = $borrowers->next();
79
- 

Return to bug 13019