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

(-)a/C4/Auth.pm (-6 / +17 lines)
Lines 857-863 sub checkauth { Link Here
857
                $session->param('surname'),      $session->param('branch'),
857
                $session->param('surname'),      $session->param('branch'),
858
                $session->param('branchname'),   $session->param('flags'),
858
                $session->param('branchname'),   $session->param('flags'),
859
                $session->param('emailaddress'), $session->param('shibboleth'),
859
                $session->param('emailaddress'), $session->param('shibboleth'),
860
                $session->param('desk_id'),      $session->param('desk_name')
860
                $session->param('desk_id'),      $session->param('desk_name'),
861
                $session->param('register_id')
861
            );
862
            );
862
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
863
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
863
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
864
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
Lines 1079-1085 sub checkauth { Link Here
1079
                    C4::Context->_unset_userenv($sessionID);
1080
                    C4::Context->_unset_userenv($sessionID);
1080
                }
1081
                }
1081
                my ( $borrowernumber, $firstname, $surname, $userflags,
1082
                my ( $borrowernumber, $firstname, $surname, $userflags,
1082
                    $branchcode, $branchname, $emailaddress, $desk_id, $desk_name );
1083
                    $branchcode, $branchname, $emailaddress, $desk_id,
1084
                    $desk_name, $register_id );
1083
1085
1084
                if ( $return == 1 ) {
1086
                if ( $return == 1 ) {
1085
                    my $select = "
1087
                    my $select = "
Lines 1128-1133 sub checkauth { Link Here
1128
                        my $desk = Koha::Desks->find($desk_id);
1130
                        my $desk = Koha::Desks->find($desk_id);
1129
                        $desk_name = $desk ? $desk->desk_name : '';
1131
                        $desk_name = $desk ? $desk->desk_name : '';
1130
                    }
1132
                    }
1133
                    if ( $query->param('register_id') ) {
1134
                        $register_id = $query->param('register_id');
1135
                    }
1131
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1136
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1132
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1137
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1133
1138
Lines 1172-1177 sub checkauth { Link Here
1172
                    $session->param( 'lasttime',     time() );
1177
                    $session->param( 'lasttime',     time() );
1173
                    $session->param( 'interface',    $type);
1178
                    $session->param( 'interface',    $type);
1174
                    $session->param( 'shibboleth',   $shibSuccess );
1179
                    $session->param( 'shibboleth',   $shibSuccess );
1180
                    $session->param( 'register_id',  $register_id );
1175
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1181
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1176
                }
1182
                }
1177
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
1183
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
Lines 1181-1187 sub checkauth { Link Here
1181
                    $session->param('surname'),      $session->param('branch'),
1187
                    $session->param('surname'),      $session->param('branch'),
1182
                    $session->param('branchname'),   $session->param('flags'),
1188
                    $session->param('branchname'),   $session->param('flags'),
1183
                    $session->param('emailaddress'), $session->param('shibboleth'),
1189
                    $session->param('emailaddress'), $session->param('shibboleth'),
1184
                    $session->param('desk_id'),      $session->param('desk_name')
1190
                    $session->param('desk_id'),      $session->param('desk_name'),
1191
                    $session->param('register_id')
1185
                );
1192
                );
1186
1193
1187
            }
1194
            }
Lines 1460-1466 sub check_api_auth { Link Here
1460
                $session->param('surname'),      $session->param('branch'),
1467
                $session->param('surname'),      $session->param('branch'),
1461
                $session->param('branchname'),   $session->param('flags'),
1468
                $session->param('branchname'),   $session->param('flags'),
1462
                $session->param('emailaddress'), $session->param('shibboleth'),
1469
                $session->param('emailaddress'), $session->param('shibboleth'),
1463
                $session->param('desk_id'),      $session->param('desk_name')
1470
                $session->param('desk_id'),      $session->param('desk_name'),
1471
                $session->param('register_id')
1464
            );
1472
            );
1465
1473
1466
            my $ip       = $session->param('ip');
1474
            my $ip       = $session->param('ip');
Lines 1621-1628 sub check_api_auth { Link Here
1621
                $session->param('number'),       $session->param('id'),
1629
                $session->param('number'),       $session->param('id'),
1622
                $session->param('cardnumber'),   $session->param('firstname'),
1630
                $session->param('cardnumber'),   $session->param('firstname'),
1623
                $session->param('surname'),      $session->param('branch'),
1631
                $session->param('surname'),      $session->param('branch'),
1632
                $session->param('branchname'),   $session->param('flags'),
1624
                $session->param('emailaddress'), $session->param('shibboleth'),
1633
                $session->param('emailaddress'), $session->param('shibboleth'),
1625
                $session->param('desk_id'),      $session->param('desk_name')
1634
                $session->param('desk_id'),      $session->param('desk_name'),
1635
                $session->param('register_id')
1626
            );
1636
            );
1627
            return ( "ok", $cookie, $sessionID );
1637
            return ( "ok", $cookie, $sessionID );
1628
        } else {
1638
        } else {
Lines 1711-1717 sub check_cookie_auth { Link Here
1711
            $session->param('surname'),      $session->param('branch'),
1721
            $session->param('surname'),      $session->param('branch'),
1712
            $session->param('branchname'),   $session->param('flags'),
1722
            $session->param('branchname'),   $session->param('flags'),
1713
            $session->param('emailaddress'), $session->param('shibboleth'),
1723
            $session->param('emailaddress'), $session->param('shibboleth'),
1714
            $session->param('desk_id'),      $session->param('desk_name')
1724
            $session->param('desk_id'),      $session->param('desk_name'),
1725
            $session->param('register_id')
1715
        );
1726
        );
1716
1727
1717
        my $ip       = $session->param('ip');
1728
        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 41-59 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user({ Link Here
41
my $sessionID = $query->cookie("CGISESSID");
42
my $sessionID = $query->cookie("CGISESSID");
42
my $session = get_session($sessionID);
43
my $session = get_session($sessionID);
43
44
44
my $branch   = $query->param('branch' );
45
my $branch              = $query->param('branch');
45
my $desk_id = $query->param('desk_id');
46
my $desk_id             = $query->param('desk_id');
46
my $userenv_branch  = C4::Context->userenv->{'branch'}        || '';
47
my $register_id         = $query->param('register_id');
47
my $userenv_desk = C4::Context->userenv->{'desk_id'} || '';
48
my $userenv_branch      = C4::Context->userenv->{'branch'} || '';
49
my $userenv_desk        = C4::Context->userenv->{'desk_id'} || '';
50
my $userenv_register_id = C4::Context->userenv->{'register_id'} || '';
48
my @updated;
51
my @updated;
49
52
50
# $session lddines here are doing the updating
53
# $session lines here are doing the updating
51
if ( $branch and my $library = Koha::Libraries->find($branch) ) {
54
if ( $branch and my $library = Koha::Libraries->find($branch) ) {
52
    if (! $userenv_branch or $userenv_branch ne $branch ) {
55
    if (! $userenv_branch or $userenv_branch ne $branch ) {
53
        my $branchname = $library->branchname;
56
        my $branchname = $library->branchname;
54
        $session->param('branchname', $branchname);         # update sesssion in DB
57
        $session->param('branchname', $branchname);         # update sesssion in DB
55
        $session->param('branch', $branch);                 # update sesssion in DB
58
        $session->param('branch', $branch);                 # update sesssion in DB
56
        $session->flush();
57
        push @updated, {
59
        push @updated, {
58
            updated_branch => 1,
60
            updated_branch => 1,
59
                old_branch => $userenv_branch,
61
                old_branch => $userenv_branch,
Lines 76-81 if ( $branch and my $library = Koha::Libraries->find($branch) ) { Link Here
76
            old_desk => $old_desk_name,
78
            old_desk => $old_desk_name,
77
        };
79
        };
78
    }
80
    }
81
    if ( defined($userenv_register_id)
82
        && ( $userenv_register_id ne $register_id ) )
83
    {
84
        my $register = Koha::Cash::Registers->find($register_id);
85
        $template->param(LoginRegisterID   => $register_id);   # update template for new register
86
        $template->param(LoginRegisterName   => $register ? $register->name : '');   # update template for new register
87
        $session->param( 'register_id', $register_id );
88
        push @updated,
89
          {
90
            updated_register => 1,
91
            new_register     => $register ? $register->name : ''
92
          };
93
    }
94
    $session->flush();
79
} else {
95
} else {
80
    $branch = $userenv_branch;  # fallback value
96
    $branch = $userenv_branch;  # fallback value
81
    $desk_id = $userenv_desk;
97
    $desk_id = $userenv_desk;
Lines 88-98 foreach ($query->param()) { Link Here
88
    $_ or next;                   # disclude blanks
104
    $_ or next;                   # disclude blanks
89
    $_ eq "branch"     and next;  # disclude branch
105
    $_ eq "branch"     and next;  # disclude branch
90
    $_ eq "desk_id"    and next;  # disclude desk_id
106
    $_ eq "desk_id"    and next;  # disclude desk_id
107
    $_ eq "register_id" and next;    # disclude register
91
    $_ eq "oldreferer" and next;  # disclude oldreferer
108
    $_ eq "oldreferer" and next;  # disclude oldreferer
92
    push @recycle_loop, {
109
    push @recycle_loop, {
93
        param => $_,
110
        param => $_,
94
        value => scalar $query->param($_),
111
        value => scalar $query->param($_),
95
    };
112
      };
96
}
113
}
97
114
98
my $referer =  $query->param('oldreferer') || $ENV{HTTP_REFERER};
115
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 / +54 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 91-96 Updated:<ul> Link Here
91
    </ol>
98
    </ol>
92
</fieldset>
99
</fieldset>
93
[% END %]
100
[% END %]
101
102
[% IF Koha.Preference('UseCashRegisters') %]
103
<fieldset class="rows">
104
    <legend>Set cash register</legend>
105
    <ol>
106
        <li>
107
            <label for="register_id">Choose cash register:</label>
108
            <select name="register_id" id="register_id">
109
                [% PROCESS options_for_registers registers => Registers.all() %]
110
            </select>
111
        </li>
112
    </ol>
113
</fieldset>
114
[% END %]
115
94
<fieldset class="action">
116
<fieldset class="action">
95
    <input type="submit" value="Submit" />
117
    <input type="submit" value="Submit" />
96
    <a class="cancel" id="cancel_set_library" href="[% referer or '/cgi-bin/koha/circ/circulation.pl' %]">Cancel</a>
118
    <a class="cancel" id="cancel_set_library" href="[% referer or '/cgi-bin/koha/circ/circulation.pl' %]">Cancel</a>
Lines 119-127 Updated:<ul> Link Here
119
        </div> <!-- /.col-sm-12 -->
141
        </div> <!-- /.col-sm-12 -->
120
    </div> <!-- /.row -->
142
    </div> <!-- /.row -->
121
143
122
123
[% MACRO jsinclude BLOCK %]
144
[% MACRO jsinclude BLOCK %]
124
  [% Asset.js("js/desk_selection.js") | $raw %]
145
  [% Asset.js("js/desk_selection.js") | $raw %]
146
  <script>
147
    $(document).ready(function() {
148
        $("#branch").on("change", function() {
149
            var selectedBranch = $("#branch").children(
150
                    "option:selected").val();
151
152
            $("#register_id").children().each(function() {
153
                // default to no-register
154
                if ($(this).is("#noregister")) {
155
                    $(this).prop("selected", true)
156
                }
157
                // display branch registers
158
                else if ($(this).hasClass(selectedBranch)) {
159
                    $(this).prop("disabled", false);
160
                    $(this).show();
161
                    // default to branch default if there is one
162
                    if ($(this).hasClass("default")) {
163
                        $(this).prop("selected", true)
164
                    }
165
                }
166
                // hide non-branch registers
167
                else
168
                {
169
                    $(this).hide();
170
                    $(this).prop("disabled", true);
171
                }
172
            });
173
        });
174
    });
175
  </script>
125
[% END %]
176
[% END %]
126
177
127
[% INCLUDE 'intranet-bottom.inc' %]
178
[% INCLUDE 'intranet-bottom.inc' %]
128
- 

Return to bug 24786