Bugzilla – Attachment 154487 Details for
Bug 34266
Item type should not default to biblio itemtype if it's not a valid itemtype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34266: Default to biblioitems.itemtype only if it's a valid itemtype
Bug-34266-Default-to-biblioitemsitemtype-only-if-i.patch (text/plain), 2.62 KB, created by
Biblibre Sandboxes
on 2023-08-17 07:55:39 UTC
(
hide
)
Description:
Bug 34266: Default to biblioitems.itemtype only if it's a valid itemtype
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2023-08-17 07:55:39 UTC
Size:
2.62 KB
patch
obsolete
>From 3b14d1ae66969a35ebc5bf0679fa9a7d82266f43 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 13 Jul 2023 09:22:44 +0200 >Subject: [PATCH] Bug 34266: Default to biblioitems.itemtype only if it's a > valid itemtype > >biblioitems.itemtype can contain values that are not itemtypes (for >instance if the MARC field mapped to it uses another authorised value >category) >This patch checks that before using it as a default value for the >'itemtypes' item subfield. > >Test plan: >0. Do not apply the patch yet >1. Change your MARC framework so that the field linked to > biblioitems.itemtype uses an authorised value category different from > 'itemtypes' >2. Make sure that you have an item subfield linked to the authorised > value 'itemtypes' in your MARC framework >3. Create a biblio with an itemtype (using a value that is NOT an item > type, but a value from the authorised value category you selected in > step 1) >4. Create a new item for this biblio. Notice that the biblio itemtype is > automatically selected for the 'itemtypes' subfield >5. Apply the patch >6. Create a new item for the same biblio. Now the 'itemtypes' subfield > should be empty. >7. Revert the change at step 1 so that your biblioitems.itemtype MARC > field uses the 'itemtypes' AV category >8. Modify your biblio to use a valid item type. >9. Create a new item. The biblio itemtype should be used as a default > value > >Signed-off-by: joubu <xxx@example.org> >--- > Koha/UI/Form/Builder/Item.pm | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > >diff --git a/Koha/UI/Form/Builder/Item.pm b/Koha/UI/Form/Builder/Item.pm >index 3a478ee05e0..2ab9fb3bb50 100644 >--- a/Koha/UI/Form/Builder/Item.pm >+++ b/Koha/UI/Form/Builder/Item.pm >@@ -16,6 +16,7 @@ package Koha::UI::Form::Builder::Item; > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+use List::Util qw( any ); > use MARC::Record; > use C4::Context; > use C4::Biblio qw( GetFrameworkCode GetMarcStructure IsMarcStructureInternal ); >@@ -224,7 +225,12 @@ sub generate_subfield_form { > my $itype_sth = $dbh->prepare( > "SELECT itemtype FROM biblioitems WHERE biblionumber = ?"); > $itype_sth->execute($biblionumber); >- ($value) = $itype_sth->fetchrow_array; >+ my ($biblio_itemtype) = $itype_sth->fetchrow_array; >+ >+ # Use biblioitems.itemtype as a default value only if it's a valid itemtype >+ if ( any { $_ eq $biblio_itemtype } @authorised_values ) { >+ $value = $biblio_itemtype; >+ } > } > > #---- class_sources >-- >2.30.2
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 34266
:
153389
|
153390
|
153393
|
154485
|
154486
|
154487
|
154488
|
154489
|
154490
|
154491
|
154492
|
154630
|
154631
|
155072
|
155073