Bugzilla – Attachment 192070 Details for
Bug 32773
Have the ability to have more than 1 Fast Add framework
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32773: Add fast cataloging support for multiple frameworks
Bug-32773-Add-fast-cataloging-support-for-multiple.patch (text/plain), 17.24 KB, created by
Brendan Lawlor
on 2026-01-26 21:58:32 UTC
(
hide
)
Description:
Bug 32773: Add fast cataloging support for multiple frameworks
Filename:
MIME Type:
Creator:
Brendan Lawlor
Created:
2026-01-26 21:58:32 UTC
Size:
17.24 KB
patch
obsolete
>From b53c63f5a105a124ae24ebefd460f17364da5871 Mon Sep 17 00:00:00 2001 >From: Brendan Lawlor <blawlor@clamsnet.org> >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. >The Biblio.pm subroutine can_be_edited now checks if the framework is_fast_add. > >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 record 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 >12. Set some biblio frameworks as Fast Add frameworks >13. Login as a user with fast_cataloging permissions only >14. Create and edit different types of Fast Add records >15. Add items and edit items >16. Confirm that you can only edit bibs and items > for bibs where the framework is set as a Fast add framework > and the item is from your home library. >17. Log in as a superlibrarian >18. Confirm you can still create and edit records with the Default > and other frameworks >19. Change a record's framework from a Fast add to Default >20. Login as the user with only fast_cataloging confirm that you can > no longer edit that record or its items > >Sponsored-by: CLAMS >Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> >--- > Koha/Biblio.pm | 8 +++++++- > catalogue/detail.pl | 13 ++++++++++--- > catalogue/moredetail.pl | 8 +++++++- > cataloguing/addbiblio.pl | 11 ++++++++--- > cataloguing/additem.pl | 16 ++++++++-------- > .../prog/en/includes/cat-toolbar.inc | 10 +++++----- > .../tables/items/catalogue_detail.inc | 4 ++-- > .../prog/en/modules/catalogue/moredetail.tt | 2 +- > .../prog/en/modules/cataloguing/addbiblio.tt | 6 +++--- > 9 files changed, 51 insertions(+), 27 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 67ea254c63..f935e5b261 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -42,6 +42,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; >@@ -329,8 +330,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 05a2d14140..3139ddfa18 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -47,6 +47,7 @@ use Koha::AuthorisedValues; > use Koha::Biblios; > use Koha::Biblio::ItemGroup::Items; > use Koha::Biblio::ItemGroups; >+use Koha::BiblioFrameworks; > use Koha::CoverImages; > use Koha::DateUtils; > use Koha::Database::DataInconsistency; >@@ -91,11 +92,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 cdd6c09be0..38ae2d0582 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -32,6 +32,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::Items; > use Koha::Patrons; > >@@ -106,7 +107,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; >@@ -335,6 +340,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 a8e2720b5c..8b795bf438 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -510,8 +510,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'; > >@@ -558,7 +563,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( >@@ -722,7 +727,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 daf247f812..b18c252081 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 @@ > </div> > [% 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 ) %] > <div class="btn-group"> > <button class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</button> > <ul class="dropdown-menu"> >- [% IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >+ [% IF CAN_user_editcatalogue_edit_catalogue || ( CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %] > [% IF biblio.can_be_edited(logged_in_user) %] > <li><a class="dropdown-item" id="editbiblio" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber | html %]">Edit record</a></li> > [% ELSE %] >@@ -57,7 +57,7 @@ > </li> > [% END %] > >- [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >+ [% IF CAN_user_editcatalogue_edit_items || ( CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %] > <li><a class="dropdown-item" id="manageitems" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber | html %]">Manage items</a></li> > [% END %] > >@@ -126,7 +126,7 @@ > <li><a class="dropdown-item" href="#" id="z3950copy">Replace record via Z39.50/SRU</a></li> > [% END %] > >- [% IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >+ [% IF CAN_user_editcatalogue_edit_catalogue || ( CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %] > [% IF ( count ) %] > <li > data-bs-toggle="tooltip" >@@ -157,7 +157,7 @@ > [% END %] > [% END %] > >- [% IF CAN_user_editcatalogue_delete_all_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >+ [% IF CAN_user_editcatalogue_delete_all_items || ( CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %] > [% IF ( count ) %] > <li> > <form action="/cgi-bin/koha/cataloguing/additem.pl" method="post"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index 9ffce4036b..ce7426926f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -43,7 +43,7 @@ > [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="usedin">Used in</th><th></th>[% END %] > [% IF Koha.Preference('UseCourseReserves') %]<th id="[% tab | html %]_course_reserves" data-colname="course_reserves">Course reserves</th>[% END %] > [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="spinelabel" class="no-sort">Spine label</th>[% END %] >- [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="actions" class="no-sort no-export"> </th>[% END %] >+ [% IF ( CAN_user_editcatalogue_edit_items || CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %]<th id="[% tab | html %]_actions" data-colname="actions" class="no-sort no-export"> </th>[% END %] > </tr> > </thead> > </table> >@@ -851,7 +851,7 @@ > } > }, > [% END %] >- [% IF CAN_user_editcatalogue_edit_items %] >+ [% IF CAN_user_editcatalogue_edit_items || CAN_user_editcatalogue_fast_cataloging && is_fast_add %] > { > data: function( row, type, val, meta ) { > let nodes = ''; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index f9313d0dd2..32fd14991a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -166,7 +166,7 @@ > <h4> > Item information > [% UNLESS ( ITEM_DAT.nomod ) %] >- [% IF ( CAN_user_editcatalogue_edit_items ) %] >+ [% IF ( CAN_user_editcatalogue_edit_items || CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %] > <a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% ITEM_DAT.biblionumber | uri %]&itemnumber=[% ITEM_DAT.itemnumber | uri %]" > ><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit item</a > > >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 7ef9a206c2..07d62754e4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -906,7 +906,7 @@ > [% END %] > > <div id="toolbar" class="btn-toolbar sticky"> >- [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >+ [% IF CAN_user_editcatalogue_edit_items || ( CAN_user_editcatalogue_fast_cataloging && is_fast_add ) %] > [% IF (circborrowernumber) %][%# fast cataloging must lead to items %] > <!-- Action is under fast cataloging - Save button redirecting to items --> > <div class="btn-group"><a href="#" id="saveanditems" class="btn btn-primary"><i class="fa fa-save"></i> Save</a></div> >@@ -961,7 +961,7 @@ > [% ELSE %] > <i class="fa fa-fw"> </i> > [% END %] >- [% !framework ? 'Default' : framework.frameworktext | html %] >+ [% ( !framework ? 'Default' : framework.frameworktext ) | html %] > </a> > </li> > [% END %] >@@ -973,7 +973,7 @@ > [% END %] > [% END %] > [% IF CAN_user_editcatalogue_fast_cataloging %] >- <li><h6 class="dropdown-header">Change Fast Add framework</h6></li> >+ <li><h6 class="dropdown-header">Change Fast add framework</h6></li> > [% FOREACH framework IN frameworks %] > [% IF framework.is_fast_add %][% INCLUDE framework_link %][% END %] > [% END %] >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32773
:
173401
|
173417
|
173878
|
173879
|
173880
|
173881
|
173882
|
173883
|
173954
|
173955
|
173956
|
173957
|
173958
|
173959
|
173960
|
173961
|
174028
|
174029
|
174030
|
174031
|
174032
|
174033
|
174034
|
174035
|
176927
|
176928
|
176929
|
176930
|
176931
|
176932
|
176933
|
176934
|
176935
|
177860
|
177861
|
177862
|
177863
|
177864
|
177865
|
177866
|
177867
|
186210
|
186211
|
186212
|
186213
|
186214
|
186215
|
186216
|
186217
|
186218
|
186219
|
186220
|
186221
|
186222
|
186223
|
186224
|
186225
|
186226
|
186227
|
187051
|
187052
|
187053
|
187054
|
187055
|
187056
|
187057
|
187058
|
187059
|
192066
|
192067
|
192068
|
192069
| 192070 |
192071
|
192072
|
192073
|
192120