Bugzilla – Attachment 96486 Details for
Bug 9156
System preference itemcallnumber not pulling more than 2 subfields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9156: itemcallnumber not pulling more than 2 subfields
Bug-9156-itemcallnumber-not-pulling-more-than-2-su.patch (text/plain), 2.82 KB, created by
ByWater Sandboxes
on 2019-12-19 14:33:25 UTC
(
hide
)
Description:
Bug 9156: itemcallnumber not pulling more than 2 subfields
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2019-12-19 14:33:25 UTC
Size:
2.82 KB
patch
obsolete
>From 0cdaa7748992869a344949442ae0f49f9f2aa03c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 19 Nov 2019 14:56:05 +0000 >Subject: [PATCH] Bug 9156: itemcallnumber not pulling more than 2 subfields > >When the itemcallnumber system preference is defined, the item add form >pulls data from the specified tag and subfield(s) to pre-populate the >call number field. This update makes it possible to build the >prepopulated callnumber from more than just the first two subfields. > >To test, apply the patch and update the itemcallnumber system preference >so that it includes more than two subfields. For instance, "092abef" > > - Edit a bibliographic record and populate the specified subfields. > e.g. subfield a -> "One", b-> "Two", e-> "Three", f-> "Four". > - Save the record and go to the add/edit items screen. > - The call number field should contain a string which contains each of > the subfields you populated, concatenated with spaces: "One Two Three > Four." > - Test with other numbers of subfields. > - Test with an empty itemcallnumber preference. > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > cataloguing/additem.pl | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 2c371def28..38fb34bc3c 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -154,17 +154,23 @@ sub generate_subfield_form { > > my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); > if (!$value && $subfieldlib->{kohafield} eq 'items.itemcallnumber' && $pref_itemcallnumber) { >- my $CNtag = substr($pref_itemcallnumber, 0, 3); >- my $CNsubfield = substr($pref_itemcallnumber, 3, 1); >- my $CNsubfield2 = substr($pref_itemcallnumber, 4, 1); >+ my $CNtag = substr( $pref_itemcallnumber, 0, 3 ); # 3-digit tag number >+ my $CNsubfields = substr( $pref_itemcallnumber, 3 ); # Any and all subfields >+ my @subfields = ( $CNsubfields =~ m/./g ); # Split into single-character elements > my $temp2 = $temp->field($CNtag); >+ > if ($temp2) { >- $value = join ' ', $temp2->subfield($CNsubfield) || q{}, $temp2->subfield($CNsubfield2) || q{}; >+ my @selectedsubfields; >+ foreach my $subfieldcode( @subfields ){ >+ push @selectedsubfields, $temp2->subfield( $subfieldcode ); >+ } >+ $value = join( ' ', @selectedsubfields ); >+ > #remove any trailing space incase one subfield is used > $value =~ s/^\s+|\s+$//g; > } > } >- >+ > if ($frameworkcode eq 'FA' && $subfieldlib->{kohafield} eq 'items.barcode' && !$value){ > my $input = new CGI; > $value = $input->param('barcode'); >-- >2.11.0
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 9156
:
13711
|
13712
|
95580
|
96486
|
96499
|
96764
|
96766
|
96767
|
96792
|
97190
|
97191
|
97192