diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index b0f4607217..abbf2f035e 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -43,6 +43,7 @@ use Koha::Biblio::Metadatas; use Koha::Biblio::Metadata::Extractor; use Koha::Biblio::ItemGroups; use Koha::Biblioitems; +use Koha::BiblioFrameworks; use Koha::Cache::Memory::Lite; use Koha::Bookings; use Koha::Checkouts; @@ -330,8 +331,13 @@ sub can_be_edited { Koha::Exceptions::MissingParameter->throw( error => "The patron parameter is missing or invalid" ) unless $patron && ref($patron) eq 'Koha::Patron'; + my $is_fast_add = + defined $self->frameworkcode && $self->frameworkcode ne '' + ? Koha::BiblioFrameworks->find( $self->frameworkcode )->is_fast_add + : 0; + my $editcatalogue = - $self->frameworkcode eq 'FA' + $is_fast_add ? [ 'fast_cataloging', 'edit_catalogue' ] : 'edit_catalogue'; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 2a6e1ebb43..4466957b4f 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -46,6 +46,7 @@ use Koha::AuthorisedValues; use Koha::Biblios; use Koha::Biblio::ItemGroup::Items; use Koha::Biblio::ItemGroups; +use Koha::BiblioFrameworks; use Koha::Controller::Catalogue; use Koha::CoverImages; use Koha::DateUtils; @@ -89,11 +90,17 @@ if ( C4::Context->config('enable_plugins') ) { my $activetab = $query->param('activetab'); my $biblionumber = $query->param('biblionumber'); $biblionumber = HTML::Entities::encode($biblionumber); -my $biblio = Koha::Biblios->find($biblionumber); +my $biblio = Koha::Biblios->find($biblionumber); +my $frameworkcode = $biblio->frameworkcode; +my $is_fast_add = + $frameworkcode eq '' + ? 0 + : Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add; $template->param( - biblio => $biblio, - activetab => $activetab, + biblio => $biblio, + activetab => $activetab, + is_fast_add => $is_fast_add, ); unless ($biblio) { diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 220c74c9e4..96a548f23a 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -31,6 +31,7 @@ use C4::Search qw( enabled_staff_search_views z3950_search_args ); use Koha::Acquisition::Booksellers; use Koha::AuthorisedValues; use Koha::Biblios; +use Koha::BiblioFrameworks; use Koha::Controller::Catalogue; use Koha::Items; use Koha::Patrons; @@ -90,7 +91,11 @@ my $record = $biblio ? $biblio->metadata->record : undef; output_and_exit( $query, $cookie, $template, 'unknown_biblio' ) unless $biblio && $record; -my $fw = GetFrameworkCode($biblionumber); +my $fw = $biblio->frameworkcode; +my $is_fast_add = + $fw eq '' + ? 0 + : Koha::BiblioFrameworks->find($fw)->is_fast_add; my $all_items = $biblio->items->search_ordered; my @items; @@ -319,6 +324,7 @@ $template->param( itemnumber => $itemnumber, z3950_search_params => C4::Search::z3950_search_args( GetBiblioData($biblionumber) ), biblio => $biblio, + is_fast_add => $is_fast_add, ); $template->param( ONLY_ONE => 1 ) if ( $itemnumber && $showncount != @items ); $template->{'VARS'}->{'searchid'} = $query->param('searchid'); diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 4e75afe3c8..f91b3060fe 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -515,8 +515,13 @@ $frameworkcode = &GetFrameworkCode($biblionumber) if ( $biblionumber and not( defined $frameworkcode ) and $op ne 'cud-addbiblio' ); $frameworkcode //= ''; +my $fast_cataloging_mode = + $frameworkcode eq '' + ? 0 + : Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add; + my $userflags = - $frameworkcode eq 'FA' + $fast_cataloging_mode ? [ 'fast_cataloging', 'edit_catalogue' ] : 'edit_catalogue'; @@ -563,7 +568,7 @@ if ($biblionumber) { } } -if ( $frameworkcode eq 'FA' ) { +if ($fast_cataloging_mode) { # We need to grab and set some variables in the template for use on the additems screen $template->param( @@ -727,7 +732,7 @@ if ( $op eq "cud-addbiblio" ) { if ( $redirect eq "items" || ( $mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save" ) ) { - if ( $frameworkcode eq 'FA' ) { + if ($fast_cataloging_mode) { print $input->redirect( '/cgi-bin/koha/cataloguing/additem.pl?' . 'biblionumber=' . $biblionumber diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 5c3e200512..07d9971bbd 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -142,13 +142,13 @@ my $item_group = $input->param('item_group'); my $item_group_description = $input->param('item_group_description'); my $display_order = $input->param('item_group_display_order'); -our $frameworkcode = &GetFrameworkCode($biblionumber); +our $frameworkcode = $biblio->frameworkcode; # Defining which userflag is needing according to the framework currently used my $fast_cataloging_mode = - defined $input->param('frameworkcode') - ? $input->param('frameworkcode') eq 'FA' - : $frameworkcode eq 'FA'; + $frameworkcode eq '' + ? 0 + : Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -186,7 +186,7 @@ $restrictededition = 0 if ( $restrictededition != 0 && C4::Context->IsSuperLibra # In case user has fast cataloging permission (and we're in fast cataloging), editing is not restricted $restrictededition = 0 if ( $restrictededition != 0 - && $frameworkcode eq 'FA' + && $fast_cataloging_mode && haspermission( $uid, { 'editcatalogue' => 'fast_cataloging' } ) ); our $tagslib = &GetMarcStructure( 1, $frameworkcode ); @@ -486,7 +486,7 @@ if ( $op eq "cud-additem" ) { undef($current_item); } } - if ( $frameworkcode eq 'FA' && $fa_circborrowernumber ) { + if ( $fast_cataloging_mode && $fa_circborrowernumber ) { print $input->redirect( '/cgi-bin/koha/circ/circulation.pl?' . 'borrowernumber=' . $fa_circborrowernumber @@ -796,7 +796,7 @@ my $subfields = } ); -if ( $frameworkcode eq 'FA' ) { +if ($fast_cataloging_mode) { my ($barcode_field) = grep { $_->{kohafield} eq 'items.barcode' } @$subfields; $barcode_field->{marc_value}->{value} ||= $input->param('barcode'); } @@ -826,7 +826,7 @@ $template->param( ); $template->{'VARS'}->{'searchid'} = $searchid; -if ( $frameworkcode eq 'FA' ) { +if ($fast_cataloging_mode) { # fast cataloguing datas $template->param( diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index f133ac33d7..77a61e0a2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -33,11 +33,11 @@ [% END %] - [% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel ) or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] + [% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || CAN_user_tools_items_batchmod || CAN_user_tools_items_batchdel ) || ( CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %]