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

(-)a/C4/Auth.pm (-6 / +17 lines)
Lines 867-873 sub checkauth { Link Here
867
                $session->param('surname'),      $session->param('branch'),
867
                $session->param('surname'),      $session->param('branch'),
868
                $session->param('branchname'),   $session->param('flags'),
868
                $session->param('branchname'),   $session->param('flags'),
869
                $session->param('emailaddress'), $session->param('shibboleth'),
869
                $session->param('emailaddress'), $session->param('shibboleth'),
870
                $session->param('desk_id'),      $session->param('desk_name')
870
                $session->param('desk_id'),      $session->param('desk_name'),
871
                $session->param('register_id')
871
            );
872
            );
872
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
873
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
873
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
874
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
Lines 1089-1095 sub checkauth { Link Here
1089
                    C4::Context->_unset_userenv($sessionID);
1090
                    C4::Context->_unset_userenv($sessionID);
1090
                }
1091
                }
1091
                my ( $borrowernumber, $firstname, $surname, $userflags,
1092
                my ( $borrowernumber, $firstname, $surname, $userflags,
1092
                    $branchcode, $branchname, $emailaddress, $desk_id, $desk_name );
1093
                    $branchcode, $branchname, $emailaddress, $desk_id,
1094
                    $desk_name, $register_id );
1093
1095
1094
                if ( $return == 1 ) {
1096
                if ( $return == 1 ) {
1095
                    my $select = "
1097
                    my $select = "
Lines 1138-1143 sub checkauth { Link Here
1138
                        my $desk = Koha::Desks->find($desk_id);
1140
                        my $desk = Koha::Desks->find($desk_id);
1139
                        $desk_name = $desk ? $desk->desk_name : '';
1141
                        $desk_name = $desk ? $desk->desk_name : '';
1140
                    }
1142
                    }
1143
                    if ( $query->param('register_id') ) {
1144
                        $register_id = $query->param('register_id');
1145
                    }
1141
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1146
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1142
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1147
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1143
1148
Lines 1182-1187 sub checkauth { Link Here
1182
                    $session->param( 'lasttime',     time() );
1187
                    $session->param( 'lasttime',     time() );
1183
                    $session->param( 'interface',    $type);
1188
                    $session->param( 'interface',    $type);
1184
                    $session->param( 'shibboleth',   $shibSuccess );
1189
                    $session->param( 'shibboleth',   $shibSuccess );
1190
                    $session->param( 'register_id',  $register_id );
1185
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1191
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1186
                }
1192
                }
1187
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
1193
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
Lines 1191-1197 sub checkauth { Link Here
1191
                    $session->param('surname'),      $session->param('branch'),
1197
                    $session->param('surname'),      $session->param('branch'),
1192
                    $session->param('branchname'),   $session->param('flags'),
1198
                    $session->param('branchname'),   $session->param('flags'),
1193
                    $session->param('emailaddress'), $session->param('shibboleth'),
1199
                    $session->param('emailaddress'), $session->param('shibboleth'),
1194
                    $session->param('desk_id'),      $session->param('desk_name')
1200
                    $session->param('desk_id'),      $session->param('desk_name'),
1201
                    $session->param('register_id')
1195
                );
1202
                );
1196
1203
1197
            }
1204
            }
Lines 1470-1476 sub check_api_auth { Link Here
1470
                $session->param('surname'),      $session->param('branch'),
1477
                $session->param('surname'),      $session->param('branch'),
1471
                $session->param('branchname'),   $session->param('flags'),
1478
                $session->param('branchname'),   $session->param('flags'),
1472
                $session->param('emailaddress'), $session->param('shibboleth'),
1479
                $session->param('emailaddress'), $session->param('shibboleth'),
1473
                $session->param('desk_id'),      $session->param('desk_name')
1480
                $session->param('desk_id'),      $session->param('desk_name'),
1481
                $session->param('register_id')
1474
            );
1482
            );
1475
1483
1476
            my $ip       = $session->param('ip');
1484
            my $ip       = $session->param('ip');
Lines 1631-1638 sub check_api_auth { Link Here
1631
                $session->param('number'),       $session->param('id'),
1639
                $session->param('number'),       $session->param('id'),
1632
                $session->param('cardnumber'),   $session->param('firstname'),
1640
                $session->param('cardnumber'),   $session->param('firstname'),
1633
                $session->param('surname'),      $session->param('branch'),
1641
                $session->param('surname'),      $session->param('branch'),
1642
                $session->param('branchname'),   $session->param('flags'),
1634
                $session->param('emailaddress'), $session->param('shibboleth'),
1643
                $session->param('emailaddress'), $session->param('shibboleth'),
1635
                $session->param('desk_id'),      $session->param('desk_name')
1644
                $session->param('desk_id'),      $session->param('desk_name'),
1645
                $session->param('register_id')
1636
            );
1646
            );
1637
            return ( "ok", $cookie, $sessionID );
1647
            return ( "ok", $cookie, $sessionID );
1638
        } else {
1648
        } else {
Lines 1721-1727 sub check_cookie_auth { Link Here
1721
            $session->param('surname'),      $session->param('branch'),
1731
            $session->param('surname'),      $session->param('branch'),
1722
            $session->param('branchname'),   $session->param('flags'),
1732
            $session->param('branchname'),   $session->param('flags'),
1723
            $session->param('emailaddress'), $session->param('shibboleth'),
1733
            $session->param('emailaddress'), $session->param('shibboleth'),
1724
            $session->param('desk_id'),      $session->param('desk_name')
1734
            $session->param('desk_id'),      $session->param('desk_name'),
1735
            $session->param('register_id')
1725
        );
1736
        );
1726
1737
1727
        my $ip       = $session->param('ip');
1738
        my $ip       = $session->param('ip');
(-)a/C4/Context.pm (-9 / +12 lines)
Lines 805-811 sub userenv { Link Here
805
                           $userfirstname, $usersurname,
805
                           $userfirstname, $usersurname,
806
                           $userbranch, $branchname, $userflags,
806
                           $userbranch, $branchname, $userflags,
807
                           $emailaddress, $shibboleth
807
                           $emailaddress, $shibboleth
808
                           $desk_id, $desk_name);
808
                           $desk_id, $desk_name,
809
                           $register_id);
809
810
810
Establish a hash of user environment variables.
811
Establish a hash of user environment variables.
811
812
Lines 816-822 set_userenv is called in Auth.pm Link Here
816
#'
817
#'
817
sub set_userenv {
818
sub set_userenv {
818
    shift @_;
819
    shift @_;
819
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name)=
820
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name, $register_id)=
820
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
821
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
821
    @_;
822
    @_;
822
    my $var=$context->{"activeuser"} || '';
823
    my $var=$context->{"activeuser"} || '';
Lines 826-839 sub set_userenv { Link Here
826
        "cardnumber" => $usercnum,
827
        "cardnumber" => $usercnum,
827
        "firstname"  => $userfirstname,
828
        "firstname"  => $userfirstname,
828
        "surname"    => $usersurname,
829
        "surname"    => $usersurname,
830
829
        #possibly a law problem
831
        #possibly a law problem
830
        "branch"     => $userbranch,
832
        "branch"       => $userbranch,
831
        "branchname" => $branchname,
833
        "branchname"   => $branchname,
832
        "desk_id"    => $desk_id,
834
        "flags"        => $userflags,
833
        "desk_name"  => $desk_name,
835
        "emailaddress" => $emailaddress,
834
        "flags"      => $userflags,
836
        "shibboleth"   => $shibboleth,
835
        "emailaddress"     => $emailaddress,
837
        "desk_id"      => $desk_id,
836
        "shibboleth" => $shibboleth,
838
        "desk_name"    => $desk_name,
839
        "register_id"  => $register_id,
837
    };
840
    };
838
    $context->{userenv}->{$var} = $cell;
841
    $context->{userenv}->{$var} = $cell;
839
    return $cell;
842
    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