From c20dc035dd921b910a13b9c55270f092c6250994 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 4 Oct 2024 11:41:12 -0300 Subject: [PATCH] Bug 38094: (follow-up) edit_catalogue implies fast_cataloguing Signed-off-by: Tomas Cohen Arazi --- Koha/Biblio.pm | 5 ++++- t/db_dependent/Koha/Biblio.t | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 5ef19b48c99..8829a3e63c5 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -263,7 +263,10 @@ sub can_be_edited { Koha::Exceptions::MissingParameter->throw( error => "The patron parameter is missing or invalid" ) unless $patron && ref($patron) eq 'Koha::Patron'; - my $editcatalogue = $self->frameworkcode eq 'FA' ? 'fast_cataloging' : 'edit_catalogue'; + my $editcatalogue = + $self->frameworkcode eq 'FA' + ? [ 'fast_cataloging', 'edit_catalogue' ] + : 'edit_catalogue'; return ( ( $self->metadata->source_allows_editing && $patron->has_permission( { editcatalogue => $editcatalogue } ) ) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 25abfec30f9..f768f8a6f71 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -1744,7 +1744,7 @@ subtest 'opac_summary_html' => sub { subtest 'can_be_edited() tests' => sub { - plan tests => 8; + plan tests => 9; $schema->storage->txn_begin; @@ -1789,6 +1789,7 @@ subtest 'can_be_edited() tests' => sub { ok( !$biblio->can_be_edited($fa_patron), "Fast add permissions are not enough" ); ok( $fa_biblio->can_be_edited($fa_patron), "Fast add user can edit FA records" ); + ok( $fa_biblio->can_be_edited($patron), "edit_catalogue user can edit FA records" ); # Mock the record source doesn't allow direct editing $source_allows_editing = 0; -- 2.46.2