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

(-)a/Koha/Library.pm (+14 lines)
Lines 24-29 use C4::Context; Link Here
24
24
25
use Koha::Caches;
25
use Koha::Caches;
26
use Koha::Database;
26
use Koha::Database;
27
use Koha::Desks;
27
use Koha::StockRotationStages;
28
use Koha::StockRotationStages;
28
use Koha::SMTP::Servers;
29
use Koha::SMTP::Servers;
29
30
Lines 269-274 sub cash_registers { Link Here
269
    return Koha::Cash::Registers->_new_from_dbic( $rs );
270
    return Koha::Cash::Registers->_new_from_dbic( $rs );
270
}
271
}
271
272
273
=head3 desks
274
275
    my $desks = $library->desks;
276
277
Returns Koha::Desks associated with this library.
278
279
=cut
280
281
sub desks {
282
    my ($self) = @_;
283
    return Koha::Desks->_new_from_dbic( scalar $self->_result->desks );
284
}
285
272
=head3 get_hold_libraries
286
=head3 get_hold_libraries
273
287
274
Return all libraries (including self) that belong to the same hold groups
288
Return all libraries (including self) that belong to the same hold groups
(-)a/t/db_dependent/Koha/Library.t (-2 / +25 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 2;
22
use Test::More tests => 3;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::AdditionalContents;
25
use Koha::AdditionalContents;
Lines 161-163 subtest 'opac_info tests' => sub { Link Here
161
161
162
    $schema->storage->txn_rollback;
162
    $schema->storage->txn_rollback;
163
};
163
};
164
- 
164
165
subtest 'desks() tests' => sub {
166
167
    plan tests => 5;
168
169
    $schema->storage->txn_begin;
170
171
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
172
173
    my $rs = $library->desks;
174
    is( ref($rs), 'Koha::Desks' );
175
    is( $rs->count, 0, 'No desks' );
176
177
    my $desk_1 = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } );
178
    my $desk_2 = $builder->build_object( { class => 'Koha::Desks', value => { branchcode => $library->id } } );
179
180
    $rs = $library->desks;
181
182
    is( $rs->count,    2 );
183
    is( $rs->next->id, $desk_1->id );
184
    is( $rs->next->id, $desk_2->id );
185
186
    $schema->storage->txn_rollback;
187
};

Return to bug 36480