From 502060d1e71f4ce5735df71821a936adbcea8947 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 8dcee3fc0e..7de5ffce3e 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1131,10 +1131,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.20.1