From fe7cf775248b40c5d42864036f79ec0403284f13 Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Fri, 1 Nov 2024 15:17:52 +0000 Subject: [PATCH] Bug 32773: Add fast cataloging support for multiple frameworks This set of patches adds a new is_fast_add column to biblio_framework. In Admin > MARC bibliographic frameworks admin users can add or edit frameworks to be used as Fast Add frameworks. Users with only fast_cataloging permission will be able to add records using those frameworks in the Fast Cataloging module. Test plan: Apply patches, restart_all and updatedatabase 1. Go to Admin > MARC Bibliographic frameworks 2. Edit/create a new framework and check the 'Use as Fast Add Framework' box 3. Also edit a framework and uncheck the 'Use as Fast Add Framework' box 4. Notice a 'Fast Add' badge is displayed in the table 5. Create a staff user with only fast_cataloging permissions 6. Log in as that user and go to Cataloging > Fast Cataloging 7. Confirm you can add a Fast Add record and items 8. Use the 'Settings' drop down to Change Fast Add framework 9. Confirm you see the frameworks that you set as Fast Add earlier 10. Confirm you can add the reocord and items 11. Log in as a superlibrarian and confirm that you can add records and items using standard frameworks and frameworks set as fast add Sponsored-by: CLAMS --- cataloguing/addbiblio.pl | 8 +++++--- cataloguing/additem.pl | 13 +++++++------ .../prog/en/modules/cataloguing/addbiblio.tt | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 985bede9a8..fe34488e2c 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -503,6 +503,7 @@ my $breedingid = $input->param('breedingid'); my $z3950 = $input->param('z3950'); my $mode = $input->param('mode') // q{}; my $frameworkcode = $input->param('frameworkcode'); +my $is_fast_add = Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add; my $redirect = $input->param('redirect'); my $searchid = $input->param('searchid') // ""; my $dbh = C4::Context->dbh; @@ -520,7 +521,7 @@ $frameworkcode = &GetFrameworkCode($biblionumber) if ( $biblionumber and not( defined $frameworkcode) and $op ne 'cud-addbiblio' ); my $userflags = - $frameworkcode eq 'FA' + $frameworkcode eq 'FA' || $is_fast_add ? [ 'fast_cataloging', 'edit_catalogue' ] : 'edit_catalogue'; @@ -567,7 +568,7 @@ if ($biblionumber) { } } -if ($frameworkcode eq 'FA'){ +if ($frameworkcode eq 'FA' || $is_fast_add){ # We need to grab and set some variables in the template for use on the additems screen $template->param( 'circborrowernumber' => $fa_circborrowernumber, @@ -721,7 +722,7 @@ if ( $op eq "cud-addbiblio" ) { ( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); } if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ - if ($frameworkcode eq 'FA'){ + if ($frameworkcode eq 'FA' || $is_fast_add){ print $input->redirect( '/cgi-bin/koha/cataloguing/additem.pl?' .'biblionumber='.$biblionumber @@ -861,6 +862,7 @@ if ( $record ne '-1' ) { $template->param( popup => $mode, frameworkcode => $frameworkcode, + is_fast_add => $is_fast_add, itemtype => $frameworkcode, borrowernumber => $loggedinuser, tab => scalar $input->param('tab') diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 3d361ec1e6..6a746c150a 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -142,15 +142,16 @@ my $item_group_description = $input->param('item_group_description'); my $display_order = $input->param('item_group_display_order'); our $frameworkcode = &GetFrameworkCode($biblionumber); +my $is_fast_add = Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add; # Defining which userflag is needing according to the framework currently used my $userflags; if ( defined $input->param('frameworkcode') ) { - $userflags = ( $input->param('frameworkcode') eq 'FA' ) ? "fast_cataloging" : "edit_items"; + $userflags = ( $input->param('frameworkcode') eq 'FA' || $is_fast_add ) ? "fast_cataloging" : "edit_items"; } if ( not defined $userflags ) { - $userflags = ( $frameworkcode eq 'FA' ) ? "fast_cataloging" : "edit_items"; + $userflags = ( $frameworkcode eq 'FA' || $is_fast_add ) ? "fast_cataloging" : "edit_items"; } my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -188,7 +189,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' + && ($frameworkcode eq 'FA' || $is_fast_add) && haspermission( $uid, { 'editcatalogue' => 'fast_cataloging' } ) ); our $tagslib = &GetMarcStructure( 1, $frameworkcode ); @@ -488,7 +489,7 @@ if ( $op eq "cud-additem" ) { undef($current_item); } } - if ( $frameworkcode eq 'FA' && $fa_circborrowernumber ) { + if ( ($frameworkcode eq 'FA' || $is_fast_add) && $fa_circborrowernumber ) { print $input->redirect( '/cgi-bin/koha/circ/circulation.pl?' . 'borrowernumber=' . $fa_circborrowernumber @@ -781,7 +782,7 @@ my $subfields = } ); -if ( $frameworkcode eq 'FA' ) { +if ( $frameworkcode eq 'FA' || $is_fast_add ) { my ($barcode_field) = grep { $_->{kohafield} eq 'items.barcode' } @$subfields; $barcode_field->{marc_value}->{value} ||= $input->param('barcode'); } @@ -811,7 +812,7 @@ $template->param( ); $template->{'VARS'}->{'searchid'} = $searchid; -if ( $frameworkcode eq 'FA' ) { +if ( $frameworkcode eq 'FA' || $is_fast_add ) { # fast cataloguing datas $template->param( diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 991a53c007..507fc5857c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -912,7 +912,7 @@ $(document).ready(function(){ [% END %]
- [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] + [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' || is_fast_add and CAN_user_editcatalogue_fast_cataloging ) %] [% IF (circborrowernumber) %][%# fast cataloging must lead to items %] -- 2.39.5