From fe3df111870405619189d268ee97b1993d886024 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 11 Aug 2020 14:24:19 +0100 Subject: [PATCH] Bug 24786: Default to 'branch default' on auth. If no branch is selected (i.e. 'My library') then we should default to 'branch default' if one is defined for the users library at login. Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Katrin Fischer --- C4/Auth.pm | 13 +++++++++---- koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index b366c9cf14..d2d7c0f392 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1141,10 +1141,15 @@ sub checkauth { my $desk = Koha::Desks->find($desk_id); $desk_name = $desk ? $desk->desk_name : ''; } - if ( $query->param('register_id') ) { - $register_id = $query->param('register_id'); - my $register = Koha::Cash::Registers->find($register_id); - $register_name = $register ? $register->name : ''; + if ( C4::Context->preference('UseCashRegisters') ) { + my $register = + $query->param('register_id') + ? Koha::Cash::Registers->find($query->param('register_id')) + : Koha::Cash::Registers->search( + { branch => $branchcode, branch_default => 1 }, + { rows => 1 } )->single; + $register_id = $register->id if ($register); + $register_name = $register->name if ($register); } my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search }; if ( $type ne 'opac' and C4::Context->boolean_preference('AutoLocation') ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt index bf12a512b4..3e3fea0874 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt @@ -101,7 +101,10 @@

[% END %] -- 2.11.0