Bugzilla – Attachment 189696 Details for
Bug 36261
Calculating OpacHiddenItems is too slow in OPAC search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36261: add a new column 'other' to items and deleteditems table
Bug-36261-add-a-new-column-other-to-items-and-dele.patch (text/plain), 7.61 KB, created by
Arthur Suzuki
on 2025-11-19 10:31:55 UTC
(
hide
)
Description:
Bug 36261: add a new column 'other' to items and deleteditems table
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-11-19 10:31:55 UTC
Size:
7.61 KB
patch
obsolete
>From 802ddc9d553219c1887cc69586184cf634c8b4e6 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 10 Oct 2024 10:22:38 +0200 >Subject: [PATCH] Bug 36261: add a new column 'other' to items and deleteditems > table > >Test plan: >- apply patch >- Add a new koha/marc link between 952$z and the "items.other" column. >- Set the syspref OpacHiddenItems to "other: [1]" >- in the default framework change the 952$z and put authorised value "YES_NO". >- modify an item and set the 952$z with value "YES". >- run batchRebuildItemsTable.pl. >- check the item is hidden from Opac. >- if the record only has one item and "OpacHiddenItemHidesRecord" the record should not be visible either. >--- > Koha/Database/Columns.pm | 1 + > Koha/Item.pm | 3 ++- > Koha/Schema/Result/Deleteditem.pm | 10 ++++++++++ > Koha/Schema/Result/Item.pm | 10 ++++++++++ > api/v1/swagger/definitions/item.yaml | 6 ++++++ > installer/data/mysql/atomicupdate/bug_36261.pl | 15 +++++++++++++++ > installer/data/mysql/kohastructure.sql | 2 ++ > 7 files changed, 46 insertions(+), 1 deletion(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_36261.pl > >diff --git a/Koha/Database/Columns.pm b/Koha/Database/Columns.pm >index 284ced531f..00e46e3e09 100644 >--- a/Koha/Database/Columns.pm >+++ b/Koha/Database/Columns.pm >@@ -242,6 +242,7 @@ sub columns { > "new_status" => __("New status"), > "notforloan" => __("Not for loan"), > "onloan" => __("Due date"), >+ "other" => __("Other"), > "permanent_location" => __("Permanent shelving location"), > "price" => __("Price"), > "renewals" => __("Total renewals"), >diff --git a/Koha/Item.pm b/Koha/Item.pm >index d2b92c1956..dc6999b540 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1930,7 +1930,7 @@ sub public_read_list { > 'barcode', 'dateaccessioned', 'itemnotes', > 'onloan', 'uri', 'itype', > 'notforloan', 'damaged', 'itemlost', >- 'withdrawn', 'restricted' >+ 'withdrawn', 'restricted', 'other' > ]; > } > >@@ -1989,6 +1989,7 @@ sub to_api_mapping { > restricted => 'restricted_status', > itemnotes => 'public_notes', > itemnotes_nonpublic => 'internal_notes', >+ other => 'other', > holdingbranch => 'holding_library_id', > permanent_location => 'permanent_location', > onloan => 'checked_out_date', >diff --git a/Koha/Schema/Result/Deleteditem.pm b/Koha/Schema/Result/Deleteditem.pm >index 778432f272..e1b45aa21e 100644 >--- a/Koha/Schema/Result/Deleteditem.pm >+++ b/Koha/Schema/Result/Deleteditem.pm >@@ -385,6 +385,14 @@ inventory number (MARC21 952$i) > > 'new' value, you can put whatever free-text information. This field is intended to be managed by the automatic_item_modification_by_age cronjob. > >+=head2 other >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 32 >+ >+this field can be used to map any marc data and use with OpacHiddenItems calculation >+ > =head2 exclude_from_local_holds_priority > > data_type: 'tinyint' >@@ -514,6 +522,8 @@ __PACKAGE__->add_columns( > { data_type => "varchar", is_nullable => 1, size => 80 }, > "new_status", > { data_type => "varchar", is_nullable => 1, size => 32 }, >+ "other", >+ { data_type => "varchar", is_nullable => 1, size => 32 }, > "exclude_from_local_holds_priority", > { data_type => "tinyint", is_nullable => 1 }, > ); >diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm >index 83b361a140..638a785f31 100644 >--- a/Koha/Schema/Result/Item.pm >+++ b/Koha/Schema/Result/Item.pm >@@ -389,6 +389,14 @@ inventory number (MARC21 952$i) > > 'new' value, you can put whatever free-text information. This field is intended to be managed by the automatic_item_modification_by_age cronjob. > >+=head2 other >+ >+ data_type: 'varchar' >+ is_nullable: 1 >+ size: 32 >+ >+this field can be used to map any marc data and use with OpacHiddenItems calculation >+ > =head2 exclude_from_local_holds_priority > > data_type: 'tinyint' >@@ -528,6 +536,8 @@ __PACKAGE__->add_columns( > { data_type => "varchar", is_nullable => 1, size => 80 }, > "new_status", > { data_type => "varchar", is_nullable => 1, size => 32 }, >+ "other", >+ { data_type => "varchar", is_nullable => 1, size => 32 }, > "exclude_from_local_holds_priority", > { data_type => "tinyint", is_nullable => 1 }, > ); >diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml >index 42dcd36e3e..1c1f109ef5 100644 >--- a/api/v1/swagger/definitions/item.yaml >+++ b/api/v1/swagger/definitions/item.yaml >@@ -251,6 +251,12 @@ properties: > - "null" > description: "'new' value, whatever free-text information." > maxLength: 32 >+ other: >+ type: >+ - string >+ - "null" >+ description: Other >+ maxLength: 32 > exclude_from_local_holds_priority: > type: boolean > description: Exclude this item from local holds priority. >diff --git a/installer/data/mysql/atomicupdate/bug_36261.pl b/installer/data/mysql/atomicupdate/bug_36261.pl >new file mode 100755 >index 0000000000..92501104a9 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_36261.pl >@@ -0,0 +1,15 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "BUG_36261", >+ description => "Add a column to store if item should be hidden from OPAC", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ unless ( column_exists( 'items', 'other' ) ) { >+ $dbh->do(q{ALTER TABLE items ADD IF NOT EXISTS other VARCHAR(32)}); >+ $dbh->do(q{ALTER TABLE deleteditems ADD IF NOT EXISTS other VARCHAR(32)}); >+ say $out "Added column 'items.other'"; >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index d3b36dca87..d7c4572002 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2837,6 +2837,7 @@ CREATE TABLE `deleteditems` ( > `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)', > `stocknumber` varchar(80) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)', > `new_status` varchar(32) DEFAULT NULL COMMENT '''new'' value, you can put whatever free-text information. This field is intended to be managed by the automatic_item_modification_by_age cronjob.', >+ `other` varchar(32) DEFAULT NULL COMMENT 'this field can be used to map any marc data and use with OpacHiddenItems calculation', > `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority', > PRIMARY KEY (`itemnumber`), > KEY `delitembarcodeidx` (`barcode`), >@@ -4224,6 +4225,7 @@ CREATE TABLE `items` ( > `copynumber` varchar(32) DEFAULT NULL COMMENT 'copy number (MARC21 952$t)', > `stocknumber` varchar(80) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)', > `new_status` varchar(32) DEFAULT NULL COMMENT '''new'' value, you can put whatever free-text information. This field is intended to be managed by the automatic_item_modification_by_age cronjob.', >+ `other` varchar(32) DEFAULT NULL COMMENT 'this field can be used to map any marc data and use with OpacHiddenItems calculation', > `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority', > PRIMARY KEY (`itemnumber`), > UNIQUE KEY `itembarcodeidx` (`barcode`), >-- >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 36261
: 189696