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 858-864 sub checkauth { Link Here
858
                $session->param('branchname'),   $session->param('flags'),
859
                $session->param('branchname'),   $session->param('flags'),
859
                $session->param('emailaddress'), $session->param('shibboleth'),
860
                $session->param('emailaddress'), $session->param('shibboleth'),
860
                $session->param('desk_id'),      $session->param('desk_name'),
861
                $session->param('desk_id'),      $session->param('desk_name'),
861
                $session->param('register_id')
862
                $session->param('register_id'),  $session->param('register_name')
862
            );
863
            );
863
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
864
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
864
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
865
            C4::Context::set_shelves_userenv( 'pub', $session->param('pubshelves') );
Lines 1081-1087 sub checkauth { Link Here
1081
                }
1082
                }
1082
                my ( $borrowernumber, $firstname, $surname, $userflags,
1083
                my ( $borrowernumber, $firstname, $surname, $userflags,
1083
                    $branchcode, $branchname, $emailaddress, $desk_id,
1084
                    $branchcode, $branchname, $emailaddress, $desk_id,
1084
                    $desk_name, $register_id );
1085
                    $desk_name, $register_id, $register_name );
1085
1086
1086
                if ( $return == 1 ) {
1087
                if ( $return == 1 ) {
1087
                    my $select = "
1088
                    my $select = "
Lines 1132-1137 sub checkauth { Link Here
1132
                    }
1133
                    }
1133
                    if ( $query->param('register_id') ) {
1134
                    if ( $query->param('register_id') ) {
1134
                        $register_id = $query->param('register_id');
1135
                        $register_id = $query->param('register_id');
1136
                        my $register = Koha::Cash::Registers->find($register_id);
1137
                        $register_name = $register ? $register->name : '';
1135
                    }
1138
                    }
1136
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1139
                    my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search };
1137
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
1140
                    if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) {
Lines 1178-1183 sub checkauth { Link Here
1178
                    $session->param( 'interface',    $type);
1181
                    $session->param( 'interface',    $type);
1179
                    $session->param( 'shibboleth',   $shibSuccess );
1182
                    $session->param( 'shibboleth',   $shibSuccess );
1180
                    $session->param( 'register_id',  $register_id );
1183
                    $session->param( 'register_id',  $register_id );
1184
                    $session->param( 'register_name',  $register_name );
1181
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1185
                    $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map { $session->param($_) } qw(cardnumber firstname surname branch);
1182
                }
1186
                }
1183
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
1187
                $session->param('cas_ticket', $cas_ticket) if $cas_ticket;
Lines 1188-1194 sub checkauth { Link Here
1188
                    $session->param('branchname'),   $session->param('flags'),
1192
                    $session->param('branchname'),   $session->param('flags'),
1189
                    $session->param('emailaddress'), $session->param('shibboleth'),
1193
                    $session->param('emailaddress'), $session->param('shibboleth'),
1190
                    $session->param('desk_id'),      $session->param('desk_name'),
1194
                    $session->param('desk_id'),      $session->param('desk_name'),
1191
                    $session->param('register_id')
1195
                    $session->param('register_id'),  $session->param('register_name')
1192
                );
1196
                );
1193
1197
1194
            }
1198
            }
Lines 1468-1474 sub check_api_auth { Link Here
1468
                $session->param('branchname'),   $session->param('flags'),
1472
                $session->param('branchname'),   $session->param('flags'),
1469
                $session->param('emailaddress'), $session->param('shibboleth'),
1473
                $session->param('emailaddress'), $session->param('shibboleth'),
1470
                $session->param('desk_id'),      $session->param('desk_name'),
1474
                $session->param('desk_id'),      $session->param('desk_name'),
1471
                $session->param('register_id')
1475
                $session->param('register_id'),  $session->param('register_name')
1472
            );
1476
            );
1473
1477
1474
            my $ip       = $session->param('ip');
1478
            my $ip       = $session->param('ip');
Lines 1632-1638 sub check_api_auth { Link Here
1632
                $session->param('branchname'),   $session->param('flags'),
1636
                $session->param('branchname'),   $session->param('flags'),
1633
                $session->param('emailaddress'), $session->param('shibboleth'),
1637
                $session->param('emailaddress'), $session->param('shibboleth'),
1634
                $session->param('desk_id'),      $session->param('desk_name'),
1638
                $session->param('desk_id'),      $session->param('desk_name'),
1635
                $session->param('register_id')
1639
                $session->param('register_id'),  $session->param('register_name')
1636
            );
1640
            );
1637
            return ( "ok", $cookie, $sessionID );
1641
            return ( "ok", $cookie, $sessionID );
1638
        } else {
1642
        } else {
Lines 1722-1728 sub check_cookie_auth { Link Here
1722
            $session->param('branchname'),   $session->param('flags'),
1726
            $session->param('branchname'),   $session->param('flags'),
1723
            $session->param('emailaddress'), $session->param('shibboleth'),
1727
            $session->param('emailaddress'), $session->param('shibboleth'),
1724
            $session->param('desk_id'),      $session->param('desk_name'),
1728
            $session->param('desk_id'),      $session->param('desk_name'),
1725
            $session->param('register_id')
1729
            $session->param('register_id'),  $session->param('register_name')
1726
        );
1730
        );
1727
1731
1728
        my $ip       = $session->param('ip');
1732
        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 81-94 if ( $branch and my $library = Koha::Libraries->find($branch) ) { Link Here
81
    if ( defined($userenv_register_id)
81
    if ( defined($userenv_register_id)
82
        && ( $userenv_register_id ne $register_id ) )
82
        && ( $userenv_register_id ne $register_id ) )
83
    {
83
    {
84
        my $old_register_name = C4::Context->userenv->{'register_name'} || '';
84
        my $register = Koha::Cash::Registers->find($register_id);
85
        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 );
86
        $session->param( 'register_id', $register_id );
87
        $session->param( 'register_name', $register ? $register->name : '' );
88
        push @updated,
88
        push @updated,
89
          {
89
          {
90
            updated_register => 1,
90
            updated_register => 1,
91
            new_register     => $register ? $register->name : ''
91
            old_register     => $old_register_name
92
          };
92
          };
93
    }
93
    }
94
    $session->flush();
94
    $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