From 3488b4e2ad60c4724b957235b993d03a25c23172 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 5 Sep 2025 14:37:58 +0000 Subject: [PATCH] Bug 32773: (QA follow-up) Corrections Add exec permission to DB update and add comment Use 'is_fast_add' in conditionals, no need to check for 'FA' framework Use already fetched biblio objects to get frameworkcode Make capitlaization consistent --- Koha/Biblio.pm | 2 +- Koha/Schema/Result/BiblioFramework.pm | 2 +- catalogue/detail.pl | 2 +- catalogue/moredetail.pl | 2 +- installer/data/mysql/atomicupdate/bug_32773.pl | 4 ++-- .../optional/marc21_sample_fastadd_framework.yml | 4 ++-- .../optional/unimarc_sample_fastadd_framework.yml | 4 ++-- installer/data/mysql/kohastructure.sql | 2 +- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 10 +++++----- .../prog/en/modules/admin/biblio_framework.tt | 4 ++-- .../prog/en/modules/cataloguing/addbiblio.tt | 6 +++--- .../prog/en/modules/cataloguing/cataloging-home.tt | 4 ++-- 12 files changed, 23 insertions(+), 23 deletions(-) mode change 100644 => 100755 installer/data/mysql/atomicupdate/bug_32773.pl diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index e82e9f087c7..393bf6373eb 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -336,7 +336,7 @@ sub can_be_edited { : 0; my $editcatalogue = - $self->frameworkcode eq 'FA' || $is_fast_add + $is_fast_add ? [ 'fast_cataloging', 'edit_catalogue' ] : 'edit_catalogue'; diff --git a/Koha/Schema/Result/BiblioFramework.pm b/Koha/Schema/Result/BiblioFramework.pm index 60075d8fb9f..86daf5d1104 100644 --- a/Koha/Schema/Result/BiblioFramework.pm +++ b/Koha/Schema/Result/BiblioFramework.pm @@ -48,7 +48,7 @@ the description/name given to the framework default_value: 0 is_nullable: 0 -the ability to be used as a Fast Add framework +the ability to be used as a Fast add framework =cut diff --git a/catalogue/detail.pl b/catalogue/detail.pl index f483caf11b4..8e5639b73e8 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -90,7 +90,7 @@ my $activetab = $query->param('activetab'); my $biblionumber = $query->param('biblionumber'); $biblionumber = HTML::Entities::encode($biblionumber); my $biblio = Koha::Biblios->find($biblionumber); -my $frameworkcode = &GetFrameworkCode($biblionumber); +my $frameworkcode = $biblio->frameworkcode; my $is_fast_add = defined $frameworkcode && $frameworkcode ne '' ? Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 3a5975de5c4..bca643c49de 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -107,7 +107,7 @@ 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 = Koha::BiblioFrameworks->find($fw)->is_fast_add; my $all_items = $biblio->items->search_ordered; diff --git a/installer/data/mysql/atomicupdate/bug_32773.pl b/installer/data/mysql/atomicupdate/bug_32773.pl old mode 100644 new mode 100755 index 20b6d747d27..dc9f81d0d1c --- a/installer/data/mysql/atomicupdate/bug_32773.pl +++ b/installer/data/mysql/atomicupdate/bug_32773.pl @@ -3,7 +3,7 @@ use Koha::Installer::Output qw(say_warning say_failure say_success say_info); return { bug_number => "32773", - description => "Add ability to have more than 1 Fast Add framework", + description => "Add ability to have more than 1 Fast add framework", up => sub { my ($args) = @_; my ( $dbh, $out ) = @$args{qw(dbh out)}; @@ -12,7 +12,7 @@ return { $dbh->do( q{ ALTER TABLE biblio_framework - ADD COLUMN is_fast_add TINYINT(1) NOT NULL DEFAULT 0 + ADD COLUMN is_fast_add TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'the ability to be used as a Fast add framework' AFTER frameworktext; } ); diff --git a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.yml b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.yml index 74d4bb3a683..1672fc6967e 100644 --- a/installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.yml +++ b/installer/data/mysql/en/marcflavour/marc21/optional/marc21_sample_fastadd_framework.yml @@ -23,7 +23,7 @@ # ************************************************************* description: - - "'FA', a 'Fast Add' minimal MARC21 framework suitable for ILL or on-the-fly cataloguing." + - "'FA', a 'Fast add' minimal MARC21 framework suitable for ILL or on-the-fly cataloguing." tables: - biblio_framework: @@ -31,7 +31,7 @@ tables: multiline: [] rows: - frameworkcode: FA - frameworktext: "Fast Add Framework" + frameworktext: "Fast add Framework" sql_statements: - "INSERT IGNORE INTO marc_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, frameworkcode) diff --git a/installer/data/mysql/en/marcflavour/unimarc/optional/unimarc_sample_fastadd_framework.yml b/installer/data/mysql/en/marcflavour/unimarc/optional/unimarc_sample_fastadd_framework.yml index 0653a51e76d..5353a9c0b92 100644 --- a/installer/data/mysql/en/marcflavour/unimarc/optional/unimarc_sample_fastadd_framework.yml +++ b/installer/data/mysql/en/marcflavour/unimarc/optional/unimarc_sample_fastadd_framework.yml @@ -23,7 +23,7 @@ # ************************************************************* description: - - "'FA', a 'Fast Add' minimal UNIMARC framework suitable for ILL or on-the-fly cataloguing." + - "'FA', a 'Fast add' minimal UNIMARC framework suitable for ILL or on-the-fly cataloguing." tables: - biblio_framework: @@ -31,7 +31,7 @@ tables: multiline: [] rows: - frameworkcode: FA - frameworktext: "Fast Add Framework" + frameworktext: "Fast add Framework" sql_statements: - "INSERT IGNORE INTO marc_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, frameworkcode) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 72ef5c5f34a..db2fa83ed00 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1125,7 +1125,7 @@ DROP TABLE IF EXISTS `biblio_framework`; CREATE TABLE `biblio_framework` ( `frameworkcode` varchar(4) NOT NULL DEFAULT '' COMMENT 'the unique code assigned to the framework', `frameworktext` varchar(255) NOT NULL DEFAULT '' COMMENT 'the description/name given to the framework', - `is_fast_add` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'the ability to be used as a Fast Add framework', + `is_fast_add` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'the ability to be used as a Fast add framework', PRIMARY KEY (`frameworkcode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; 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 a1067926c16..352d718c994 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -34,11 +34,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' || is_fast_add 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 ) || ( is_fast_add && CAN_user_editcatalogue_fast_cataloging ) %]
@@ -57,7 +57,7 @@ [% IF !framework.is_fast_add %]
  • [% framework.frameworktext | html %]
  • [% END %] [% END %] [% FOREACH framework IN frameworks %] - [% IF loop.first %]
  • [% END %] + [% IF loop.first %]
  • [% END %] [% IF framework.is_fast_add %]
  • [% framework.frameworktext | html %]
  • [% END %] [% END %] -- 2.39.5