From 8aec868a6f2f7f9e435bc865cfc0c6199f9c3107 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 21 Jun 2021 16:06:34 +0200 Subject: [PATCH] Bug 28608: Creating a biblio record must not lead to item creation when framework has no items field Some framework for biblio records have no items field (952 in MARC21, 995 in UNIMARC). Records can not have items for example a serial article. In this case creating a record should not lead to item creation. This patch adds a condition next to items edition permission to have only one save button when framework has no items field. 1) Create a biblio framework without items field (952 in MARC21, 995 in UNIMARC) 2) Create a biblio record with this framework 3) Click on "Save" => Without patch you see items creation page (with no inputs in form) => With patch you see record details page --- cataloguing/addbiblio.pl | 5 +++-- .../intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 7eba09f55d..1d6a4de046 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -51,7 +51,7 @@ if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { MARC::File::XML->default_record_format('UNIMARC'); } -our($tagslib,$authorised_values_sth,$is_a_modif,$usedTagsLib,$mandatory_z3950); +our($tagslib,$authorised_values_sth,$is_a_modif,$usedTagsLib,$mandatory_z3950,$itemtag,$itemsubfield); =head1 FUNCTIONS @@ -500,7 +500,6 @@ sub build_tabs { my @tab_data; # all tags to display my $max_num_tab=-1; - my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" ); foreach my $used ( @$usedTagsLib ){ push @tab_data,$used->{tagfield} if not $seen{$used->{tagfield}}; @@ -772,6 +771,7 @@ $template->param( $tagslib = &GetMarcStructure( 1, $frameworkcode ); $usedTagsLib = &GetUsedMarcStructure( $frameworkcode ); $mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode); +( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" ); # -- Global my $record = -1; @@ -981,6 +981,7 @@ if ( $record ne '-1' ) { $template->param( popup => $mode, frameworkcode => $frameworkcode, + framework_has_items => $tagslib->{$itemtag} ? 1 : 0, itemtype => $frameworkcode, borrowernumber => $loggedinuser, tab => scalar $input->param('tab') 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 00c6767d1a..d7e228dcf3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -785,7 +785,7 @@ function PopupMARCFieldDoc(field) { [% 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' and CAN_user_editcatalogue_fast_cataloging ) ) and framework_has_items %] [% IF (circborrowernumber) %][%# fast cataloging must lead to items %] -- 2.30.2