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

(-)a/C4/Auth.pm (-6 / +17 lines)
Lines 846-852 sub checkauth { Link Here
846
                $session->param('surname'),      $session->param('branch'),
846
                $session->param('surname'),      $session->param('branch'),
847
                $session->param('branchname'),   $session->param('flags'),
847
                $session->param('branchname'),   $session->param('flags'),
848
                $session->param('emailaddress'), $session->param('shibboleth'),
848
                $session->param('emailaddress'), $session->param('shibboleth'),
849
                $session->param('desk_id'),      $session->param('desk_name')
849
                $session->param('desk_id'),      $session->param('desk_name'),
850
                $session->param('register_id')
850
            );
851
            );
851
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
852
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
852
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
853
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
Lines 1066-1072 sub checkauth { Link Here
1066
                    C4::Context->_unset_userenv($sessionID);
1067
                    C4::Context->_unset_userenv($sessionID);
1067
                }
1068
                }
1068
                my ( $borrowernumber, $firstname, $surname, $userflags,
1069
                my ( $borrowernumber, $firstname, $surname, $userflags,
1069
                    $branchcode, $branchname, $emailaddress, $desk_id, $desk_name );
1070
                    $branchcode, $branchname, $emailaddress, $desk_id,
1071
                    $desk_name, $register_id );
1070
1072
1071
                if ( $return == 1 ) {
1073
                if ( $return == 1 ) {
1072
                    my $select = "
1074
                    my $select = "
Lines 1115-1120 sub checkauth { Link Here
1115
                        my $desk = Koha::Desks->find($desk_id);
1117
                        my $desk = Koha::Desks->find($desk_id);
1116
                        $desk_name = $desk ? $desk->desk_name : '';
1118
                        $desk_name = $desk ? $desk->desk_name : '';
1117
                    }
1119
                    }
1120
                    if ( $query->param('register_id') ) {
1121
                        $register_id = $query->param('register_id');
1122
                    }
1118
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1123
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1119
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1124
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1120
1125
Lines 1158-1163 sub checkauth { Link Here
1158
                    $session->param( 'lasttime',     time() );
1163
                    $session->param( 'lasttime',     time() );
1159
                    $session->param( 'interface',    $type);
1164
                    $session->param( 'interface',    $type);
1160
                    $session->param( 'shibboleth',   $shibSuccess );
1165
                    $session->param( 'shibboleth',   $shibSuccess );
1166
                    $session->param( 'register_id',  $register_id );
1161
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1167
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1162
                }
1168
                }
1163
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
1169
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
Lines 1167-1173 sub checkauth { Link Here
1167
                    $session->param('surname'),      $session->param('branch'),
1173
                    $session->param('surname'),      $session->param('branch'),
1168
                    $session->param('branchname'),   $session->param('flags'),
1174
                    $session->param('branchname'),   $session->param('flags'),
1169
                    $session->param('emailaddress'), $session->param('shibboleth'),
1175
                    $session->param('emailaddress'), $session->param('shibboleth'),
1170
                    $session->param('desk_id'),      $session->param('desk_name')
1176
                    $session->param('desk_id'),      $session->param('desk_name'),
1177
                    $session->param('register_id')
1171
                );
1178
                );
1172
1179
1173
            }
1180
            }
Lines 1445-1451 sub check_api_auth { Link Here
1445
                $session->param('surname'),      $session->param('branch'),
1452
                $session->param('surname'),      $session->param('branch'),
1446
                $session->param('branchname'),   $session->param('flags'),
1453
                $session->param('branchname'),   $session->param('flags'),
1447
                $session->param('emailaddress'), $session->param('shibboleth'),
1454
                $session->param('emailaddress'), $session->param('shibboleth'),
1448
                $session->param('desk_id'),      $session->param('desk_name')
1455
                $session->param('desk_id'),      $session->param('desk_name'),
1456
                $session->param('register_id')
1449
            );
1457
            );
1450
1458
1451
            my $ip       = $session->param('ip');
1459
            my $ip       = $session->param('ip');
Lines 1604-1611 sub check_api_auth { Link Here
1604
                $session->param('number'),       $session->param('id'),
1612
                $session->param('number'),       $session->param('id'),
1605
                $session->param('cardnumber'),   $session->param('firstname'),
1613
                $session->param('cardnumber'),   $session->param('firstname'),
1606
                $session->param('surname'),      $session->param('branch'),
1614
                $session->param('surname'),      $session->param('branch'),
1615
                $session->param('branchname'),   $session->param('flags'),
1607
                $session->param('emailaddress'), $session->param('shibboleth'),
1616
                $session->param('emailaddress'), $session->param('shibboleth'),
1608
                $session->param('desk_id'),      $session->param('desk_name')
1617
                $session->param('desk_id'),      $session->param('desk_name'),
1618
                $session->param('register_id')
1609
            );
1619
            );
1610
            return ( "ok", $cookie, $sessionID );
1620
            return ( "ok", $cookie, $sessionID );
1611
        } else {
1621
        } else {
Lines 1694-1700 sub check_cookie_auth { Link Here
1694
            $session->param('surname'),      $session->param('branch'),
1704
            $session->param('surname'),      $session->param('branch'),
1695
            $session->param('branchname'),   $session->param('flags'),
1705
            $session->param('branchname'),   $session->param('flags'),
1696
            $session->param('emailaddress'), $session->param('shibboleth'),
1706
            $session->param('emailaddress'), $session->param('shibboleth'),
1697
            $session->param('desk_id'),      $session->param('desk_name')
1707
            $session->param('desk_id'),      $session->param('desk_name'),
1708
            $session->param('register_id')
1698
        );
1709
        );
1699
1710
1700
        my $ip       = $session->param('ip');
1711
        my $ip       = $session->param('ip');
(-)a/C4/Context.pm (-9 / +12 lines)
Lines 808-814 sub userenv { Link Here
808
                           $userfirstname, $usersurname,
808
                           $userfirstname, $usersurname,
809
                           $userbranch, $branchname, $userflags,
809
                           $userbranch, $branchname, $userflags,
810
                           $emailaddress, $shibboleth
810
                           $emailaddress, $shibboleth
811
                           $desk_id, $desk_name);
811
                           $desk_id, $desk_name,
812
                           $register_id);
812
813
813
Establish a hash of user environment variables.
814
Establish a hash of user environment variables.
814
815
Lines 819-825 set_userenv is called in Auth.pm Link Here
819
#'
820
#'
820
sub set_userenv {
821
sub set_userenv {
821
    shift @_;
822
    shift @_;
822
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name)=
823
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name, $register_id)=
823
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
824
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
824
    @_;
825
    @_;
825
    my $var=$context->{"activeuser"} || '';
826
    my $var=$context->{"activeuser"} || '';
Lines 829-842 sub set_userenv { Link Here
829
        "cardnumber" => $usercnum,
830
        "cardnumber" => $usercnum,
830
        "firstname"  => $userfirstname,
831
        "firstname"  => $userfirstname,
831
        "surname"    => $usersurname,
832
        "surname"    => $usersurname,
833
832
        #possibly a law problem
834
        #possibly a law problem
833
        "branch"     => $userbranch,
835
        "branch"       => $userbranch,
834
        "branchname" => $branchname,
836
        "branchname"   => $branchname,
835
        "desk_id"    => $desk_id,
837
        "flags"        => $userflags,
836
        "desk_name"  => $desk_name,
838
        "emailaddress" => $emailaddress,
837
        "flags"      => $userflags,
839
        "shibboleth"   => $shibboleth,
838
        "emailaddress"     => $emailaddress,
840
        "desk_id"      => $desk_id,
839
        "shibboleth" => $shibboleth,
841
        "desk_name"    => $desk_name,
842
        "register_id"  => $register_id,
840
    };
843
    };
841
    $context->{userenv}->{$var} = $cell;
844
    $context->{userenv}->{$var} = $cell;
842
    return $cell;
845
    return $cell;
(-)a/Koha/Template/Plugin/Registers.pm (+65 lines)
Line 0 Link Here
1
package Koha::Template::Plugin::Registers;
2
3
# Copyright PTFS Europe 2020
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Template::Plugin;
23
use base qw( Template::Plugin );
24
25
use C4::Koha;
26
use C4::Context;
27
use Koha::Cash::Registers;
28
29
sub session_register_id {
30
    my ($self) = @_;
31
32
    return C4::Context->userenv ?
33
        C4::Context->userenv->{'register_id'} :
34
        '';
35
}
36
37
sub session_register_name {
38
    my ($self) = @_;
39
40
    my $register = Koha::Cash::Registers->find($self->session_register_id);
41
    return $register ? $register->name : '';
42
}
43
44
=head2
45
46
    [% SET registers = Registers.all() %]
47
    [% SET registers = Registers.all( { branch => branchcode } );
48
49
Returns a list of all cash registers available that adhere to the passed filters.
50
51
=cut
52
53
sub all {
54
    my ( $self, $params ) = @_;
55
56
    my $registers = Koha::Cash::Registers->search()->unblessed();
57
    for my $register ( @{$registers} ) {
58
        $register->{selected} = ( defined( $self->session_register_id )
59
              && $register->{id} == $self->session_register_id ) ? 1 : 0;
60
    }
61
62
    return $registers;
63
}
64
65
1;
(-)a/circ/set-library.pl (-7 / +24 lines)
Lines 25-30 use C4::Output; Link Here
25
use C4::Auth qw/:DEFAULT get_session/;
25
use C4::Auth qw/:DEFAULT get_session/;
26
use C4::Koha;
26
use C4::Koha;
27
use Koha::BiblioFrameworks;
27
use Koha::BiblioFrameworks;
28
use Koha::Cash::Registers;
28
use Koha::Libraries;
29
use Koha::Libraries;
29
use Koha::Desks;
30
use Koha::Desks;
30
31
Lines 42-60 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user({ Link Here
42
my $sessionID = $query->cookie("CGISESSID");
43
my $sessionID = $query->cookie("CGISESSID");
43
my $session = get_session($sessionID);
44
my $session = get_session($sessionID);
44
45
45
my $branch   = $query->param('branch' );
46
my $branch              = $query->param('branch');
46
my $desk_id = $query->param('desk_id');
47
my $desk_id             = $query->param('desk_id');
47
my $userenv_branch  = C4::Context->userenv->{'branch'}        || '';
48
my $register_id         = $query->param('register_id');
48
my $userenv_desk = C4::Context->userenv->{'desk_id'} || '';
49
my $userenv_branch      = C4::Context->userenv->{'branch'} || '';
50
my $userenv_desk        = C4::Context->userenv->{'desk_id'} || '';
51
my $userenv_register_id = C4::Context->userenv->{'register_id'} || '';
49
my @updated;
52
my @updated;
50
53
51
# $session lddines here are doing the updating
54
# $session lines here are doing the updating
52
if ( $branch and my $library = Koha::Libraries->find($branch) ) {
55
if ( $branch and my $library = Koha::Libraries->find($branch) ) {
53
    if (! $userenv_branch or $userenv_branch ne $branch ) {
56
    if (! $userenv_branch or $userenv_branch ne $branch ) {
54
        my $branchname = $library->branchname;
57
        my $branchname = $library->branchname;
55
        $session->param('branchname', $branchname);         # update sesssion in DB
58
        $session->param('branchname', $branchname);         # update sesssion in DB
56
        $session->param('branch', $branch);                 # update sesssion in DB
59
        $session->param('branch', $branch);                 # update sesssion in DB
57
        $session->flush();
58
        push @updated, {
60
        push @updated, {
59
            updated_branch => 1,
61
            updated_branch => 1,
60
                old_branch => $userenv_branch,
62
                old_branch => $userenv_branch,
Lines 77-82 if ( $branch and my $library = Koha::Libraries->find($branch) ) { Link Here
77
            old_desk => $old_desk_name,
79
            old_desk => $old_desk_name,
78
        };
80
        };
79
    }
81
    }
82
    if ( defined($userenv_register_id)
83
        && ( $userenv_register_id ne $register_id ) )
84
    {
85
        my $register = Koha::Cash::Registers->find($register_id);
86
        $template->param(LoginRegisterID   => $register_id);   # update template for new register
87
        $template->param(LoginRegisterName   => $register ? $register->name : '');   # update template for new register
88
        $session->param( 'register_id', $register_id );
89
        push @updated,
90
          {
91
            updated_register => 1,
92
            new_register     => $register ? $register->name : ''
93
          };
94
    }
95
    $session->flush();
80
} else {
96
} else {
81
    $branch = $userenv_branch;  # fallback value
97
    $branch = $userenv_branch;  # fallback value
82
    $desk_id = $userenv_desk;
98
    $desk_id = $userenv_desk;
Lines 89-99 foreach ($query->param()) { Link Here
89
    $_ or next;                   # disclude blanks
105
    $_ or next;                   # disclude blanks
90
    $_ eq "branch"     and next;  # disclude branch
106
    $_ eq "branch"     and next;  # disclude branch
91
    $_ eq "desk_id"    and next;  # disclude desk_id
107
    $_ eq "desk_id"    and next;  # disclude desk_id
108
    $_ eq "register_id" and next;    # disclude register
92
    $_ eq "oldreferer" and next;  # disclude oldreferer
109
    $_ eq "oldreferer" and next;  # disclude oldreferer
93
    push @recycle_loop, {
110
    push @recycle_loop, {
94
        param => $_,
111
        param => $_,
95
        value => scalar $query->param($_),
112
        value => scalar $query->param($_),
96
    };
113
      };
97
}
114
}
98
115
99
my $referer =  $query->param('oldreferer') || $ENV{HTTP_REFERER};
116
my $referer =  $query->param('oldreferer') || $ENV{HTTP_REFERER};
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (-2 / +25 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Branches %]
2
[% USE Branches %]
3
[% USE Desks %]
3
[% USE Desks %]
4
[% USE Registers %]
4
[% USE Koha %]
5
[% USE Koha %]
5
<nav class="navbar">
6
<nav class="navbar">
6
    <div class="navbar-header">
7
    <div class="navbar-header">
Lines 96-102 Link Here
96
                                    <span class="logged-in-desk-id content_hidden">[% Desks.GetLoggedInDeskId | html %]</span>
97
                                    <span class="logged-in-desk-id content_hidden">[% Desks.GetLoggedInDeskId | html %]</span>
97
                                [% END %]
98
                                [% END %]
98
                            </strong>
99
                            </strong>
99
                         [% END %]
100
                        [% END %]
101
                        [% IF Koha.Preference('UseCashRegisters') && !(Registers.session_register_name == '') %]
102
                            <span class="separator">|</span>
103
                            <strong>
104
                                <span class="logged-in-register-name">[% Registers.session_register_name | html %]</span>
105
                                <span class="logged-in-register-id content_hidden">[% Registers.session_register_id | html %]</span>
106
                            </strong>
107
                        [% END %]
100
                    </span>
108
                    </span>
101
                    <b class="caret"></b>
109
                    <b class="caret"></b>
102
                </a>
110
                </a>
Lines 133-155 Link Here
133
                    [% IF !( Koha.Preference('IndependentBranches') && !CAN_user_superlibrarian && !CAN_user_editcatalogue_edit_catalogue ) %]
141
                    [% IF !( Koha.Preference('IndependentBranches') && !CAN_user_superlibrarian && !CAN_user_editcatalogue_edit_catalogue ) %]
134
                    <li role="separator" class="loggedin-menu-label divider"></li>
142
                    <li role="separator" class="loggedin-menu-label divider"></li>
135
                    <li>
143
                    <li>
136
                        [% IF Koha.Preference('UseCirculationDesks') %]
144
                        [% IF Koha.Preference('UseCirculationDesks') && Koha.Preference('UseCashRegisters') %]
145
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set library, desk and register</a>
146
                        [% ELSIF Koha.Preference('UseCirculationDesks') %]
137
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set library and desk</a>
147
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set library and desk</a>
148
                        [% ELSIF Koha.Preference('UseCashRegisters') %]
149
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set library and cash register</a>
138
                        [% ELSE %]
150
                        [% ELSE %]
139
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set library</a>
151
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set library</a>
140
                        [% END %]
152
                        [% END %]
141
                    </li>
153
                    </li>
154
                    [% ELSIF Koha.Preference('UseCirculationDesks') && Koha.Preference('UseCashRegisters') %]
155
                    <li role="separator" class="loggedin-menu-label divider"></li>
156
                    <li>
157
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set desk and cash register</a>
158
                    </li>
142
                    [% ELSIF Koha.Preference('UseCirculationDesks') %]
159
                    [% ELSIF Koha.Preference('UseCirculationDesks') %]
143
                    <li role="separator" class="loggedin-menu-label divider"></li>
160
                    <li role="separator" class="loggedin-menu-label divider"></li>
144
                    <li>
161
                    <li>
145
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set desk</a>
162
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set desk</a>
146
                    </li>
163
                    </li>
164
                    [% ELSIF Koha.Preference('UseCashRegisters') %]
165
                    <li role="separator" class="loggedin-menu-label divider"></li>
166
                    <li>
167
                        <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set cash register</a>
168
                    </li>
147
                    [% END %]
169
                    [% END %]
148
                    [% IF EnableSearchHistory %]
170
                    [% IF EnableSearchHistory %]
149
                    <li>
171
                    <li>
150
                        <a class="toplinks" href="/cgi-bin/koha/catalogue/search-history.pl">Search history</a>
172
                        <a class="toplinks" href="/cgi-bin/koha/catalogue/search-history.pl">Search history</a>
151
                    </li>
173
                    </li>
152
                    [% END %]
174
                    [% END %]
175
153
                    [% IF loggedinusernumber %]
176
                    [% IF loggedinusernumber %]
154
                        <li class ="toplinks-myaccount">
177
                        <li class ="toplinks-myaccount">
155
                            <a class="toplinks" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loggedinusernumber | html %]">My account</a>
178
                            <a class="toplinks" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loggedinusernumber | html %]">My account</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-1 / +17 lines)
Lines 19-25 Link Here
19
          [% END %]
19
          [% END %]
20
        [% ELSE %]
20
        [% ELSE %]
21
            <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled hidden>[% d.desk_name | html %]</option>
21
            <option class="[% d.branchcode | html %]" value="[% d.desk_id | html %]" disabled hidden>[% d.desk_name | html %]</option>
22
        [% END%]
22
        [% END %]
23
    [% END %]
24
[% END %]
25
26
[% BLOCK options_for_registers %]
27
    <!-- <option hidden disabled selected value> -- select an option -- </option> -->
28
    <option id="noregister" value="">-- None --</option>
29
    [% FOREACH r IN registers %]
30
        [% IF r.branch == branch %]
31
            [% IF r.selected %]
32
                <option class="[% r.branch | html %] [% IF r.branch_default %]default[% END %]" value="[% r.id | html %]" selected="selected">[% r.name | html %]</option>
33
            [% ELSE %]
34
                <option class="[% r.branch | html %] [% IF r.branch_default %]default[% END %]" value="[% r.id | html %]">[% r.name | html %]</option>
35
            [% END%]
36
        [% ELSE %]
37
            <option class="[% r.branch | html %] [% IF r.branch_default %]default[% END %]" value="[% r.id | html %]" disabled hidden>[% r.name | html %]</option>
38
        [% END %]
23
    [% END %]
39
    [% END %]
24
[% END %]
40
[% END %]
25
41
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt (-4 / +55 lines)
Lines 2-7 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Branches %]
3
[% USE Branches %]
4
[% USE Desks %]
4
[% USE Desks %]
5
[% USE Registers %]
5
[% USE Koha %]
6
[% USE Koha %]
6
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
[% INCLUDE 'doc-head-open.inc' %]
Lines 43-52 Link Here
43
<h2>Update succeeded</h2>
44
<h2>Update succeeded</h2>
44
Updated:<ul>
45
Updated:<ul>
45
    [% FOREACH update IN updated %]
46
    [% FOREACH update IN updated %]
46
    [% IF ( update.updated_branch ) %]
47
    [% IF ( update.updated_branch || update.updated_desk ||  update.updated_register ) %]
48
        [% IF ( updated.updated.branch ) %]
47
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.new_branch or "?" | html %]</li>
49
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.new_branch or "?" | html %]</li>
48
    [% ELSIF (update.updated_desk) %]
50
        [% END %]
51
        [% IF ( update.updated_desk ) %]
49
        <li>Desk: [% update.old_desk or "?" | html %] &rArr; [% LoginDeskname or "?" | html %]</li>
52
        <li>Desk: [% update.old_desk or "?" | html %] &rArr; [% LoginDeskname or "?" | html %]</li>
53
        [% END %]
54
        [% IF ( updated.updated_register ) %]
55
        <li>Register: [% updated.new_register | html %]</li>
56
        [% END %]
50
    [% ELSE %]
57
    [% ELSE %]
51
        <li>ERROR - unknown</li>
58
        <li>ERROR - unknown</li>
52
    [% END %]
59
    [% END %]
Lines 75-80 Updated:<ul> Link Here
75
    </ol>
82
    </ol>
76
</fieldset>
83
</fieldset>
77
[% END %]
84
[% END %]
85
78
[% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
86
[% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
79
<fieldset class="rows">
87
<fieldset class="rows">
80
    <legend>Set desk</legend>
88
    <legend>Set desk</legend>
Lines 86-91 Updated:<ul> Link Here
86
    </ol>
94
    </ol>
87
</fieldset>
95
</fieldset>
88
[% END %]
96
[% END %]
97
98
[% IF Koha.Preference('UseCashRegisters') %]
99
<fieldset class="rows">
100
    <legend>Set cash register</legend>
101
    <ol>
102
        <li>
103
            <label for="register_id">Choose cash register:</label>
104
            <select name="register_id" id="register_id">
105
                [% PROCESS options_for_registers registers => Registers.all() %]
106
            </select>
107
        </li>
108
    </ol>
109
</fieldset>
110
[% END %]
111
89
<fieldset class="action">
112
<fieldset class="action">
90
    <input type="submit" value="Submit" />
113
    <input type="submit" value="Submit" />
91
    <a class="cancel" id="cancel_set_library" href="[% referer or '/cgi-bin/koha/circ/circulation.pl' %]">Cancel</a>
114
    <a class="cancel" id="cancel_set_library" href="[% referer or '/cgi-bin/koha/circ/circulation.pl' %]">Cancel</a>
Lines 114-122 Updated:<ul> Link Here
114
        </div> <!-- /.col-sm-12 -->
137
        </div> <!-- /.col-sm-12 -->
115
    </div> <!-- /.row -->
138
    </div> <!-- /.row -->
116
139
117
118
[% MACRO jsinclude BLOCK %]
140
[% MACRO jsinclude BLOCK %]
119
  [% Asset.js("js/desk_selection.js") | $raw %]
141
  [% Asset.js("js/desk_selection.js") | $raw %]
142
  <script>
143
    $(document).ready(function() {
144
        $("#branch").on("change", function() {
145
            var selectedBranch = $("#branch").children(
146
                    "option:selected").val();
147
148
            $("#register_id").children().each(function() {
149
                // default to no-register
150
                if ($(this).is("#noregister")) {
151
                    $(this).prop("selected", true)
152
                }
153
                // display branch registers
154
                else if ($(this).hasClass(selectedBranch)) {
155
                    $(this).prop("disabled", false);
156
                    $(this).show();
157
                    // default to branch default if there is one
158
                    if ($(this).hasClass("default")) {
159
                        $(this).prop("selected", true)
160
                    }
161
                }
162
                // hide non-branch registers
163
                else
164
                {
165
                    $(this).hide();
166
                    $(this).prop("disabled", true);
167
                }
168
            });
169
        });
170
    });
171
  </script>
120
[% END %]
172
[% END %]
121
173
122
[% INCLUDE 'intranet-bottom.inc' %]
174
[% INCLUDE 'intranet-bottom.inc' %]
123
- 

Return to bug 24786