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

(-)a/C4/Auth.pm (-1 / +2 lines)
Lines 1160-1166 sub checkauth { Link Here
1160
                    my $ip = $ENV{'REMOTE_ADDR'};
1160
                    my $ip = $ENV{'REMOTE_ADDR'};
1161
1161
1162
                    # if they specify at login, use that
1162
                    # if they specify at login, use that
1163
                    if ( $query->param('branch') ) {
1163
                    my $patron = Koha::Patrons->find({userid => $userid});
1164
                    if ( $query->param('branch')  && ( haspermission($userid, {  'loggedinlibrary'=> 1 }) || $patron->is_superlibrarian ) ) {
1164
                        $branchcode = $query->param('branch');
1165
                        $branchcode = $query->param('branch');
1165
                        my $library = Koha::Libraries->find($branchcode);
1166
                        my $library = Koha::Libraries->find($branchcode);
1166
                        $branchname = $library? $library->branchname: '';
1167
                        $branchname = $library? $library->branchname: '';
(-)a/circ/set-library.pl (-2 / +2 lines)
Lines 49-56 my $userenv_register_id = C4::Context->userenv->{'register_id'} || ''; Link Here
49
my @updated;
49
my @updated;
50
50
51
# $session lines here are doing the updating
51
# $session lines here are doing the updating
52
if ( $branch and my $library = Koha::Libraries->find($branch) ) {
52
if ( $branch and my $library = Koha::Libraries->find($branch) and ( $flags->{loggedinlibrary} == 1 or $flags->{superlibrarian} == 1 ) ) {
53
    if (! $userenv_branch or $userenv_branch ne $branch ) {
53
    if ( !$userenv_branch or $userenv_branch ne $branch  )  {
54
        my $branchname = $library->branchname;
54
        my $branchname = $library->branchname;
55
        $session->param('branchname', $branchname);         # update sesssion in DB
55
        $session->param('branchname', $branchname);         # update sesssion in DB
56
        $session->param('branch', $branch);                 # update sesssion in DB
56
        $session->param('branch', $branch);                 # update sesssion in DB
(-)a/installer/data/mysql/atomicupdate/bug_30624_add_userflag.pl (+20 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30624",
5
    description => "Add loggedinlibrary permission",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        $dbh->do(q{
10
            INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES (29, 'loggedinlibrary', 'Allow staff to change logged in library', 0)
11
        });
12
13
        my $IndependentBranches = C4::Context->preference('IndependentBranches');
14
        unless ( $IndependentBranches ) {
15
            $dbh->do(q{
16
                UPDATE borrowers SET flags = flags + (1<<29) WHERE flags & 4;
17
           });
18
        }
19
    },
20
};
(-)a/installer/data/mysql/mandatory/userflags.sql (-1 / +2 lines)
Lines 25-29 INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES Link Here
25
(25, 'cash_management', 'Cash management', 0),
25
(25, 'cash_management', 'Cash management', 0),
26
(26, 'problem_reports', 'Manage problem reports', 0),
26
(26, 'problem_reports', 'Manage problem reports', 0),
27
(27, 'recalls', 'Recalls', 0),
27
(27, 'recalls', 'Recalls', 0),
28
(28, 'erm', 'Manage electronic resources', 0)
28
(28, 'erm', 'Manage electronic resources', 0),
29
(29, 'loggedinlibrary', 'Change logged in library', 0)
29
;
30
;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc (-2 / +5 lines)
Lines 2-8 Link Here
2
[% USE Branches %]
2
[% USE Branches %]
3
<div id="navmenu">
3
<div id="navmenu">
4
    <div id="navmenulist">
4
    <div id="navmenulist">
5
6
        <h5>Circulation</h5>
5
        <h5>Circulation</h5>
7
        <ul>
6
        <ul>
8
            <li>
7
            <li>
Lines 14-20 Link Here
14
            <li>
13
            <li>
15
                <a href="/cgi-bin/koha/circ/renew.pl">Renew</a>
14
                <a href="/cgi-bin/koha/circ/renew.pl">Renew</a>
16
            </li>
15
            </li>
17
            [% UNLESS IndependentBranches %]
16
            [% IF ( CAN_user_superlibrarian || CAN_user_loggedinlibrary ) %]
18
            <li>
17
            <li>
19
                [% IF Koha.Preference('UseCirculationDesks') %]
18
                [% IF Koha.Preference('UseCirculationDesks') %]
20
                <a href="/cgi-bin/koha/circ/set-library.pl">Set library and desk</a>
19
                <a href="/cgi-bin/koha/circ/set-library.pl">Set library and desk</a>
Lines 22-27 Link Here
22
                <a href="/cgi-bin/koha/circ/set-library.pl">Set library</a>
21
                <a href="/cgi-bin/koha/circ/set-library.pl">Set library</a>
23
                [% END %]
22
                [% END %]
24
            </li>
23
            </li>
24
            [% ELSIF Koha.Preference('UseCirculationDesks') %]
25
            <li>
26
                <a href="/cgi-bin/koha/circ/set-library.pl">Set desk</a>
27
            </li>
25
            [% END %]
28
            [% END %]
26
            [% IF ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging ) %]
29
            [% IF ( fast_cataloging && CAN_user_editcatalogue_fast_cataloging ) %]
27
            <li>
30
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (-1 / +1 lines)
Lines 157-163 Link Here
157
                        </li>
157
                        </li>
158
                    [% END %]
158
                    [% END %]
159
159
160
                    [% IF !( Koha.Preference('IndependentBranches') && !CAN_user_superlibrarian && !CAN_user_editcatalogue_edit_catalogue ) %]
160
                    [% IF ( CAN_user_superlibrarian || CAN_user_loggedinlibrary ) %]
161
                    <li role="separator" class="loggedin-menu-label divider"></li>
161
                    <li role="separator" class="loggedin-menu-label divider"></li>
162
                    <li>
162
                    <li>
163
                        [% IF Koha.Preference('UseCirculationDesks') && Koha.Preference('UseCashRegisters') %]
163
                        [% IF Koha.Preference('UseCirculationDesks') && Koha.Preference('UseCashRegisters') %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc (+3 lines)
Lines 81-86 Link Here
81
    [%- CASE 'erm' -%]
81
    [%- CASE 'erm' -%]
82
        <span class="main_permission erm_permission">Manage the electronic resources module</span>
82
        <span class="main_permission erm_permission">Manage the electronic resources module</span>
83
        <span class="permissioncode">([% name | html %])</span>
83
        <span class="permissioncode">([% name | html %])</span>
84
    [%- CASE 'loggedinlibrary' -%]
85
        <span class="main_permission loggedinlibrary_permission">Allow staff to change logged in library</span>
86
        <span class="permissioncode">([% name | html %])</span>
84
    [%- END -%]
87
    [%- END -%]
85
[%- END -%]
88
[%- END -%]
86
89
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt (-1 / +5 lines)
Lines 44-50 Link Here
44
                    <li>
44
                    <li>
45
                        <a class="circ-button" href="/cgi-bin/koha/circ/renew.pl"><i class="fa fa-retweet"></i> Renew</a>
45
                        <a class="circ-button" href="/cgi-bin/koha/circ/renew.pl"><i class="fa fa-retweet"></i> Renew</a>
46
                    </li>
46
                    </li>
47
                    [% UNLESS IndependentBranches %]
47
                    [% IF ( CAN_user_superlibrarian || CAN_user_loggedinlibrary ) %]
48
                        <li>
48
                        <li>
49
                            [% IF Koha.Preference('UseCirculationDesks') %]
49
                            [% IF Koha.Preference('UseCirculationDesks') %]
50
                            <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set library and desk</a>
50
                            <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set library and desk</a>
Lines 52-57 Link Here
52
                            <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set library</a>
52
                            <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set library</a>
53
                            [% END %]
53
                            [% END %]
54
                        </li>
54
                        </li>
55
                    [% ELSIF Koha.Preference('UseCirculationDesks') %]
56
                        <li>
57
                            <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set desk</a>
58
                        </li>
55
                    [% END %]
59
                    [% END %]
56
                    [% IF ( fast_cataloging ) %]
60
                    [% IF ( fast_cataloging ) %]
57
                        [% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
61
                        [% IF ( CAN_user_editcatalogue_fast_cataloging ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt (-2 / +1 lines)
Lines 84-90 Updated:<ul> Link Here
84
[% ELSE %]
84
[% ELSE %]
85
85
86
<form method="post" action="set-library.pl">
86
<form method="post" action="set-library.pl">
87
[% IF !( Koha.Preference('IndependentBranches') && !CAN_user_superlibrarian && !CAN_user_editcatalogue_edit_catalogue ) %]
87
[% IF ( CAN_user_superlibrarian || CAN_user_loggedinlibrary ) %]
88
<fieldset class="rows">
88
<fieldset class="rows">
89
    <legend>Set library</legend>
89
    <legend>Set library</legend>
90
    <ol>
90
    <ol>
91
- 

Return to bug 30624