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

(-)a/Koha/Patron.pm (-1 / +1 lines)
Lines 1371-1377 Return true if the patron is a superlibrarian. Link Here
1371
1371
1372
sub is_superlibrarian {
1372
sub is_superlibrarian {
1373
    my ($self) = @_;
1373
    my ($self) = @_;
1374
    return $self->has_permission( { superlibrarian => 1 } );
1374
    return $self->has_permission( { superlibrarian => 1 } ) ? 1 : 0;
1375
}
1375
}
1376
1376
1377
=head3 is_adult
1377
=head3 is_adult
(-)a/t/db_dependent/Koha/Patron.t (-4 / +6 lines)
Lines 214-220 subtest 'login_attempts tests' => sub { Link Here
214
214
215
subtest 'is_superlibrarian() tests' => sub {
215
subtest 'is_superlibrarian() tests' => sub {
216
216
217
    plan tests => 2;
217
    plan tests => 3;
218
218
219
    $schema->storage->txn_begin;
219
    $schema->storage->txn_begin;
220
220
Lines 228-237 subtest 'is_superlibrarian() tests' => sub { Link Here
228
        }
228
        }
229
    );
229
    );
230
230
231
    ok( !$patron->is_superlibrarian, 'Patron is not a superlibrarian and the method returns the correct value' );
231
    is( $patron->is_superlibrarian, 0, 'Patron is not a superlibrarian and the method returns the correct value' );
232
232
233
    $patron->flags(1)->store->discard_changes;
233
    $patron->flags(1)->store->discard_changes;
234
    ok( $patron->is_superlibrarian, 'Patron is a superlibrarian and the method returns the correct value' );
234
    is( $patron->is_superlibrarian, 1, 'Patron is a superlibrarian and the method returns the correct value' );
235
236
    $patron->flags(0)->store->discard_changes;
237
    is( $patron->is_superlibrarian, 0, 'Patron is not a superlibrarian and the method returns the correct value' );
235
238
236
    $schema->storage->txn_rollback;
239
    $schema->storage->txn_rollback;
237
};
240
};
238
- 

Return to bug 23634