@@ -, +, @@ $ git grep 'Koha::AuthorisedValues\->search' ->search_with_library_limits in all the places that require it in the $ kshell k$ prove t/db_dependent/Koha/Charges/Sales.t \ t/db_dependent/Ill* values keeps working --- Koha/Charges/Sales.pm | 9 ++++---- Koha/Illrequest.pm | 27 +++++++++++++++--------- Koha/Template/Plugin/AuthorisedValues.pm | 6 +++--- acqui/ajax-getauthvaluedropbox.pl | 6 +++--- tools/batchMod.pl | 8 ++++++- 5 files changed, 35 insertions(+), 21 deletions(-) --- a/Koha/Charges/Sales.pm +++ a/Koha/Charges/Sales.pm @@ -105,11 +105,12 @@ sub _get_valid_payments { my $self = shift; $self->{valid_payments} //= { - map { $_ => 1 } Koha::AuthorisedValues->search( + map { $_ => 1 } Koha::AuthorisedValues->search_with_library_limits( { - category => 'PAYMENT_TYPE', - branchcode => $self->{cash_register}->branch - } + category => 'PAYMENT_TYPE' + }, + {}, + $self->{cash_register}->branch # filter by cash_register branch )->get_column('authorised_value') }; --- a/Koha/Illrequest.pm +++ a/Koha/Illrequest.pm @@ -136,11 +136,14 @@ sub statusalias { # We can't know which result is the right one if there are multiple # ILLSTATUS authorised values with the same authorised_value column value # so we just use the first - return Koha::AuthorisedValues->search({ - branchcode => $self->branchcode, - category => 'ILLSTATUS', - authorised_value => $self->SUPER::status_alias - })->next; + return Koha::AuthorisedValues->search( + { + category => 'ILLSTATUS', + authorised_value => $self->SUPER::status_alias + }, + {}, + $self->branchcode + )->next; } =head3 illrequestattributes @@ -231,11 +234,15 @@ sub status_alias { # We can't know which result is the right one if there are multiple # ILLSTATUS authorised values with the same authorised_value column value # so we just use the first - my $alias = Koha::AuthorisedValues->search({ - branchcode => $self->branchcode, - category => 'ILLSTATUS', - authorised_value => $self->SUPER::status_alias - })->next; + my $alias = Koha::AuthorisedValues->search( + { + category => 'ILLSTATUS', + authorised_value => $self->SUPER::status_alias + }, + {}, + $self->branchcode + )->next; + if ($alias) { return $alias->authorised_value; } else { --- a/Koha/Template/Plugin/AuthorisedValues.pm +++ a/Koha/Template/Plugin/AuthorisedValues.pm @@ -42,14 +42,14 @@ sub Get { sub GetAuthValueDropbox { my ( $self, $category ) = @_; my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; - return Koha::AuthorisedValues->search( + return Koha::AuthorisedValues->search_with_library_limits( { - branchcode => $branch_limit, category => $category, }, { order_by => [ 'category', 'lib', 'lib_opac' ], - } + }, + $branch_limit ); } --- a/acqui/ajax-getauthvaluedropbox.pl +++ a/acqui/ajax-getauthvaluedropbox.pl @@ -69,14 +69,14 @@ my $default = $input->param('default'); $default = C4::Charset::NormalizeString($default); my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; -my $avs = Koha::AuthorisedValues->search( +my $avs = Koha::AuthorisedValues->search_with_library_limits( { - branchcode => $branch_limit, category => $category, }, { order_by => [ 'category', 'lib', 'lib_opac' ], - } + }, + $branch_limit ); my $html = qq|