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

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 457-463 sub get_template_and_user { Link Here
457
457
458
    my $minPasswordLength = C4::Context->preference('minPasswordLength');
458
    my $minPasswordLength = C4::Context->preference('minPasswordLength');
459
    $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3;
459
    $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3;
460
    my $singleLibraryMode = Koha::Libraries->singleLibraryMode;
460
    my $singleLibraryMode = Koha::Libraries->single_library_mode;
461
    $template->param(
461
    $template->param(
462
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
462
        EnhancedMessagingPreferences                                       => C4::Context->preference('EnhancedMessagingPreferences'),
463
        GoogleJackets                                                      => C4::Context->preference("GoogleJackets"),
463
        GoogleJackets                                                      => C4::Context->preference("GoogleJackets"),
(-)a/C4/XSLT.pm (-1 / +1 lines)
Lines 107-113 sub get_xslt_sysprefs { Link Here
107
107
108
    # singleBranchMode was a system preference, but no longer is
108
    # singleBranchMode was a system preference, but no longer is
109
    # we can retain it here for compatibility
109
    # we can retain it here for compatibility
110
    my $singleBranchMode = Koha::Libraries->singleLibraryMode;
110
    my $singleBranchMode = Koha::Libraries->single_library_mode;
111
    $sysxml .= "<syspref name=\"singleBranchMode\">$singleBranchMode</syspref>\n";
111
    $sysxml .= "<syspref name=\"singleBranchMode\">$singleBranchMode</syspref>\n";
112
112
113
    $sysxml .= "</sysprefs>\n";
113
    $sysxml .= "</sysprefs>\n";
(-)a/Koha/Libraries.pm (-3 / +3 lines)
Lines 64-80 sub search_filtered { Link Here
64
    return $self->SUPER::search( $params, $attributes );
64
    return $self->SUPER::search( $params, $attributes );
65
}
65
}
66
66
67
=head3 singleLibraryMode
67
=head3 single_library_mode
68
68
69
    Aka singleBranchMode.
69
    Aka singleBranchMode.
70
70
71
    my $boolean = Koha::Libraries->singleLibaryMode;
71
    my $boolean = Koha::Libraries->single_library_mode;
72
72
73
    Returns 1 if there is only one library marked public.
73
    Returns 1 if there is only one library marked public.
74
74
75
=cut
75
=cut
76
76
77
sub singleLibraryMode { # formerly called singleBranchMode
77
sub single_library_mode { # formerly called singleBranchMode
78
    my $self = shift;
78
    my $self = shift;
79
    if( $self->search({ public => 1 })->count == 1 ) { # Historically we test number==1 instead of number<2
79
    if( $self->search({ public => 1 })->count == 1 ) { # Historically we test number==1 instead of number<2
80
        return 1;
80
        return 1;
(-)a/opac/opac-reserve.pl (-1 / +1 lines)
Lines 226-232 if ( $query->param('place_reserve') ) { Link Here
226
226
227
        my $canreserve = 0;
227
        my $canreserve = 0;
228
228
229
        my $singleBranchMode = Koha::Libraries->singleLibraryMode;
229
        my $singleBranchMode = Koha::Libraries->single_library_mode;
230
        if ( $singleBranchMode || ! C4::Context->preference("OPACAllowUserToChooseBranch") )
230
        if ( $singleBranchMode || ! C4::Context->preference("OPACAllowUserToChooseBranch") )
231
        {    # single branch mode or disabled user choosing
231
        {    # single branch mode or disabled user choosing
232
            $branch = $patron->branchcode;
232
            $branch = $patron->branchcode;
(-)a/t/db_dependent/Koha/Libraries.t (-5 / +4 lines)
Lines 366-381 subtest 'outgoing_transfers' => sub { Link Here
366
    $schema->storage->txn_rollback;
366
    $schema->storage->txn_rollback;
367
};
367
};
368
368
369
subtest 'singleLibrarymode aka singleBranchMode' => sub {
369
subtest 'single_library_mode aka singleBranchMode' => sub {
370
    plan tests => 3;
370
    plan tests => 3;
371
    $schema->storage->txn_begin;
371
    $schema->storage->txn_begin;
372
372
373
    Koha::Libraries->new->update({ public => 0 });
373
    Koha::Libraries->new->update({ public => 0 });
374
    is( Koha::Libraries->singleLibraryMode, 0, 'No public libraries' );
374
    is( Koha::Libraries->single_library_mode, 0, 'No public libraries' );
375
    my $library1 = $builder->build_object({ class => 'Koha::Libraries', value => { public => 1 } });
375
    my $library1 = $builder->build_object({ class => 'Koha::Libraries', value => { public => 1 } });
376
    is( Koha::Libraries->singleLibraryMode, 1, 'One public library' );
376
    is( Koha::Libraries->single_library_mode, 1, 'One public library' );
377
    my $library2 = $builder->build_object({ class => 'Koha::Libraries', value => { public => 1 } });
377
    my $library2 = $builder->build_object({ class => 'Koha::Libraries', value => { public => 1 } });
378
    is( Koha::Libraries->singleLibraryMode, 0, 'Two public libraries' );
378
    is( Koha::Libraries->single_library_mode, 0, 'Two public libraries' );
379
379
380
    $schema->storage->txn_rollback;
380
    $schema->storage->txn_rollback;
381
};
381
};
382
- 

Return to bug 31784