From aca6493b31f24af5804512496337e1b61b2059d7 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. --- 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 64b3f27e6c..23dc208bca 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1118,10 +1118,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 5d6e208208..6db00bac43 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.20.1