Bug 38010: Respect AcqViewBaskets syspref

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-10-17 07:47:00 +00:00 committed by Katrin Fischer
parent 3d45bc8c70
commit 86bb920254
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
3 changed files with 18 additions and 5 deletions

View File

@ -18,9 +18,10 @@ package Koha::REST::V1::Acquisitions::Baskets;
use Modern::Perl;
use Mojo::Base 'Mojolicious::Controller';
use Try::Tiny qw( catch try );
use C4::Acquisition qw( CanUserManageBasket );
=head1 NAME
Koha::REST::V1::Acquisitions::Baskets
@ -65,13 +66,25 @@ Return a list of baskets
=cut
sub list {
my $c = shift->openapi->valid_input or return;
my $c = shift->openapi->valid_input or return;
my $patron = $c->stash('koha.user');
return try {
my $baskets_rs = Koha::Acquisition::Baskets->new;
my $baskets = $c->objects->search($baskets_rs);
my $userflags = C4::Auth::getuserflags( $patron->flags, $patron->userid );
my @user_baskets;
foreach my $basket (@$baskets) {
my $success = CanUserManageBasket( $patron->unblessed, $basket, $userflags );
push @user_baskets, $basket if $success;
}
return $c->render(
status => 200,
openapi => $c->objects->search( Koha::Acquisition::Baskets->new ),
openapi => \@user_baskets
);
} catch {
$c->unhandled_exception($_);

View File

@ -34,8 +34,7 @@
const userPermissions = [% To.json(user_permissions) | $raw %];
const currencies = [% To.json(currencies) | $raw %];
const gstValues = [% To.json(gst_values) | $raw %];
const edifact = [% To.json(edifact) | $raw %]
const viewBaskets = [% To.json(viewbaskets) | $raw %]
const edifact = [% To.json(edifact) | $raw %];
</script>
[% Asset.js("js/vue/dist/acquisitions.js") | $raw %]
[% INCLUDE 'select2.inc' %]

View File

@ -95,6 +95,7 @@ export default {
fetchConfig().then(() => {
this.loaded();
this.userPermissions = userPermissions;
this.config.settings.edifact = edifact;
this.vendorStore.currencies = currencies;
this.vendorStore.gstValues = gstValues.map(gv => {
return {