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

(-)a/C4/Auth.pm (-6 / +10 lines)
Lines 38-43 use Koha::Checkouts; Link Here
38
use Koha::DateUtils qw(dt_from_string);
38
use Koha::DateUtils qw(dt_from_string);
39
use Koha::Library::Groups;
39
use Koha::Library::Groups;
40
use Koha::Libraries;
40
use Koha::Libraries;
41
use Koha::Cash::Registers;
41
use Koha::Desks;
42
use Koha::Desks;
42
use Koha::Patrons;
43
use Koha::Patrons;
43
use Koha::Patron::Consents;
44
use Koha::Patron::Consents;
Lines 847-853 sub checkauth { Link Here
847
                $session->param('branchname'),   $session->param('flags'),
848
                $session->param('branchname'),   $session->param('flags'),
848
                $session->param('emailaddress'), $session->param('shibboleth'),
849
                $session->param('emailaddress'), $session->param('shibboleth'),
849
                $session->param('desk_id'),      $session->param('desk_name'),
850
                $session->param('desk_id'),      $session->param('desk_name'),
850
                $session->param('register_id')
851
                $session->param('register_id'),  $session->param('register_name')
851
            );
852
            );
852
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
853
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
853
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
854
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
Lines 1068-1074 sub checkauth { Link Here
1068
                }
1069
                }
1069
                my ( $borrowernumber, $firstname, $surname, $userflags,
1070
                my ( $borrowernumber, $firstname, $surname, $userflags,
1070
                    $branchcode, $branchname, $emailaddress, $desk_id,
1071
                    $branchcode, $branchname, $emailaddress, $desk_id,
1071
                    $desk_name, $register_id );
1072
                    $desk_name, $register_id, $register_name );
1072
1073
1073
                if ( $return == 1 ) {
1074
                if ( $return == 1 ) {
1074
                    my $select = "
1075
                    my $select = "
Lines 1119-1124 sub checkauth { Link Here
1119
                    }
1120
                    }
1120
                    if ( $query->param('register_id') ) {
1121
                    if ( $query->param('register_id') ) {
1121
                        $register_id = $query->param('register_id');
1122
                        $register_id = $query->param('register_id');
1123
                        my $register = Koha::Cash::Registers->find($register_id);
1124
                        $register_name = $register ? $register->name : '';
1122
                    }
1125
                    }
1123
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1126
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1124
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1127
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
Lines 1164-1169 sub checkauth { Link Here
1164
                    $session->param( 'interface',    $type);
1167
                    $session->param( 'interface',    $type);
1165
                    $session->param( 'shibboleth',   $shibSuccess );
1168
                    $session->param( 'shibboleth',   $shibSuccess );
1166
                    $session->param( 'register_id',  $register_id );
1169
                    $session->param( 'register_id',  $register_id );
1170
                    $session->param( 'register_name',  $register_name );
1167
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1171
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1168
                }
1172
                }
1169
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
1173
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
Lines 1174-1180 sub checkauth { Link Here
1174
                    $session->param('branchname'),   $session->param('flags'),
1178
                    $session->param('branchname'),   $session->param('flags'),
1175
                    $session->param('emailaddress'), $session->param('shibboleth'),
1179
                    $session->param('emailaddress'), $session->param('shibboleth'),
1176
                    $session->param('desk_id'),      $session->param('desk_name'),
1180
                    $session->param('desk_id'),      $session->param('desk_name'),
1177
                    $session->param('register_id')
1181
                    $session->param('register_id'),  $session->param('register_name')
1178
                );
1182
                );
1179
1183
1180
            }
1184
            }
Lines 1453-1459 sub check_api_auth { Link Here
1453
                $session->param('branchname'),   $session->param('flags'),
1457
                $session->param('branchname'),   $session->param('flags'),
1454
                $session->param('emailaddress'), $session->param('shibboleth'),
1458
                $session->param('emailaddress'), $session->param('shibboleth'),
1455
                $session->param('desk_id'),      $session->param('desk_name'),
1459
                $session->param('desk_id'),      $session->param('desk_name'),
1456
                $session->param('register_id')
1460
                $session->param('register_id'),  $session->param('register_name')
1457
            );
1461
            );
1458
1462
1459
            my $ip       = $session->param('ip');
1463
            my $ip       = $session->param('ip');
Lines 1615-1621 sub check_api_auth { Link Here
1615
                $session->param('branchname'),   $session->param('flags'),
1619
                $session->param('branchname'),   $session->param('flags'),
1616
                $session->param('emailaddress'), $session->param('shibboleth'),
1620
                $session->param('emailaddress'), $session->param('shibboleth'),
1617
                $session->param('desk_id'),      $session->param('desk_name'),
1621
                $session->param('desk_id'),      $session->param('desk_name'),
1618
                $session->param('register_id')
1622
                $session->param('register_id'),  $session->param('register_name')
1619
            );
1623
            );
1620
            return ( "ok", $cookie, $sessionID );
1624
            return ( "ok", $cookie, $sessionID );
1621
        } else {
1625
        } else {
Lines 1705-1711 sub check_cookie_auth { Link Here
1705
            $session->param('branchname'),   $session->param('flags'),
1709
            $session->param('branchname'),   $session->param('flags'),
1706
            $session->param('emailaddress'), $session->param('shibboleth'),
1710
            $session->param('emailaddress'), $session->param('shibboleth'),
1707
            $session->param('desk_id'),      $session->param('desk_name'),
1711
            $session->param('desk_id'),      $session->param('desk_name'),
1708
            $session->param('register_id')
1712
            $session->param('register_id'),  $session->param('register_name')
1709
        );
1713
        );
1710
1714
1711
        my $ip       = $session->param('ip');
1715
        my $ip       = $session->param('ip');
(-)a/C4/Context.pm (-10 / +11 lines)
Lines 809-815 sub userenv { Link Here
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
                           $register_id, $register_name);
813
813
814
Establish a hash of user environment variables.
814
Establish a hash of user environment variables.
815
815
Lines 820-826 set_userenv is called in Auth.pm Link Here
820
#'
820
#'
821
sub set_userenv {
821
sub set_userenv {
822
    shift @_;
822
    shift @_;
823
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name, $register_id)=
823
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth, $desk_id, $desk_name, $register_id, $register_name)=
824
    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
825
    @_;
825
    @_;
826
    my $var=$context->{"activeuser"} || '';
826
    my $var=$context->{"activeuser"} || '';
Lines 832-845 sub set_userenv { Link Here
832
        "surname"    => $usersurname,
832
        "surname"    => $usersurname,
833
833
834
        #possibly a law problem
834
        #possibly a law problem
835
        "branch"       => $userbranch,
835
        "branch"        => $userbranch,
836
        "branchname"   => $branchname,
836
        "branchname"    => $branchname,
837
        "flags"        => $userflags,
837
        "flags"         => $userflags,
838
        "emailaddress" => $emailaddress,
838
        "emailaddress"  => $emailaddress,
839
        "shibboleth"   => $shibboleth,
839
        "shibboleth"    => $shibboleth,
840
        "desk_id"      => $desk_id,
840
        "desk_id"       => $desk_id,
841
        "desk_name"    => $desk_name,
841
        "desk_name"     => $desk_name,
842
        "register_id"  => $register_id,
842
        "register_id"   => $register_id,
843
        "register_name" => $register_name
843
    };
844
    };
844
    $context->{userenv}->{$var} = $cell;
845
    $context->{userenv}->{$var} = $cell;
845
    return $cell;
846
    return $cell;
(-)a/Koha/Template/Plugin/Registers.pm (-2 / +3 lines)
Lines 37-44 sub session_register_id { Link Here
37
sub session_register_name {
37
sub session_register_name {
38
    my ($self) = @_;
38
    my ($self) = @_;
39
39
40
    my $register = Koha::Cash::Registers->find($self->session_register_id);
40
    return C4::Context->userenv
41
    return $register ? $register->name : '';
41
      ? C4::Context->userenv->{'register_name'}
42
      : '';
42
}
43
}
43
44
44
=head2
45
=head2
(-)a/circ/set-library.pl (-3 / +3 lines)
Lines 82-95 if ( $branch and my $library = Koha::Libraries->find($branch) ) { Link Here
82
    if ( defined($userenv_register_id)
82
    if ( defined($userenv_register_id)
83
        && ( $userenv_register_id ne $register_id ) )
83
        && ( $userenv_register_id ne $register_id ) )
84
    {
84
    {
85
        my $old_register_name = C4::Context->userenv->{'register_name'} || '';
85
        my $register = Koha::Cash::Registers->find($register_id);
86
        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 );
87
        $session->param( 'register_id', $register_id );
88
        $session->param( 'register_name', $register ? $register->name : '' );
89
        push @updated,
89
        push @updated,
90
          {
90
          {
91
            updated_register => 1,
91
            updated_register => 1,
92
            new_register     => $register ? $register->name : ''
92
            old_register     => $old_register_name
93
          };
93
          };
94
    }
94
    }
95
    $session->flush();
95
    $session->flush();
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt (-3 / +2 lines)
Lines 45-58 Link Here
45
Updated:<ul>
45
Updated:<ul>
46
    [% FOREACH update IN updated %]
46
    [% FOREACH update IN updated %]
47
    [% IF ( update.updated_branch || update.updated_desk ||  update.updated_register ) %]
47
    [% IF ( update.updated_branch || update.updated_desk ||  update.updated_register ) %]
48
        [% IF ( updated.updated.branch ) %]
48
        [% IF ( updated.updated_branch ) %]
49
        <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>
50
        [% END %]
50
        [% END %]
51
        [% IF ( update.updated_desk ) %]
51
        [% IF ( update.updated_desk ) %]
52
        <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 %]
53
        [% END %]
54
        [% IF ( updated.updated_register ) %]
54
        [% IF ( updated.updated_register ) %]
55
        <li>Register: [% updated.new_register | html %]</li>
55
        <li>Register: [% updated.old_register or "?" | html %] &rArr; [% Registers.session_register_name or "?" | html %]</li>
56
        [% END %]
56
        [% END %]
57
    [% ELSE %]
57
    [% ELSE %]
58
        <li>ERROR - unknown</li>
58
        <li>ERROR - unknown</li>
59
- 

Return to bug 24786