Bugzilla – Attachment 107821 Details for
Bug 8676
Show vendor name in source of acquisition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8676: Display vendor's name when cataloguing items
Bug-8676-Display-vendors-name-when-cataloguing-ite.patch (text/plain), 3.11 KB, created by
Jonathan Druart
on 2020-08-05 09:40:57 UTC
(
hide
)
Description:
Bug 8676: Display vendor's name when cataloguing items
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-05 09:40:57 UTC
Size:
3.11 KB
patch
obsolete
>From 02cd3a96c085fade58aa6ad40f072ff73d386fd5 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 5 Aug 2020 11:36:34 +0200 >Subject: [PATCH] Bug 8676: Display vendor's name when cataloguing items > >If items.booksellerid is mapped to a MARC field (952$e, Source of >acquisition) then we could display a dropdown list with the list of >vendors when items are edited. > >*However* we could have a weird display if it does not match the vendor >from which the items have been effectively ordered within Koha. >You could then see "Vendor X" in the cataloguing items view (additem.pl), but "Vendor >Y" on the item list (moredetail.pl) >Is this patch relevant? > >Test plan: >Order and receive an item >Edit the item and note the new dropdown list for "Source of acquisition" >Note that the items table has replaced the value with the name of the >vendor's name as well >--- > C4/Biblio.pm | 5 +++++ > cataloguing/additem.pl | 20 +++++++++++++++++++- > 2 files changed, 24 insertions(+), 1 deletion(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index f62798db08..a80ccc4fe7 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -98,6 +98,7 @@ use C4::Debug; > > use Koha::Caches; > use Koha::Authority::Types; >+use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Currencies; > use Koha::Biblio::Metadatas; > use Koha::Holds; >@@ -1363,6 +1364,10 @@ descriptions rather than normal ones when they exist. > sub GetAuthorisedValueDesc { > my ( $tag, $subfield, $value, $framework, $tagslib, $category, $opac ) = @_; > >+ if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.booksellerid' ) { >+ my $vendor = Koha::Acquisition::Booksellers->find($value); >+ return $vendor ? $vendor->name : $value; >+ } > if ( !$category ) { > > return $value unless defined $tagslib->{$tag}->{$subfield}->{'authorised_value'}; >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 001d9d8c15..49c5359d1b 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -333,7 +333,25 @@ sub generate_subfield_form { > id => $subfield_data{id}, > value => $value, > }; >- } else { >+ } >+ elsif ($value && $subfieldlib->{kohafield} eq 'items.booksellerid' ) { >+ # It's linked with items.booksellerid (expected for "Source of acquisition") >+ my $vendors = Koha::Acquisition::Booksellers->search; >+ my @authorised_values; >+ my %authorised_lib; >+ while ( my $vendor = $vendors->next ) { >+ push @authorised_values, $vendor->id; >+ $authorised_lib{$vendor->id} = $vendor->name; >+ } >+ $subfield_data{marc_value} = { >+ type => 'select', >+ id => "tag_".$tag."_subfield_".$subfieldtag."_".$index_subfield, >+ values => \@authorised_values, >+ labels => \%authorised_lib, >+ default => $value, >+ }; >+ } >+ else { > # it's a standard field > $subfield_data{marc_value} = { > type => 'text', >-- >2.20.1
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 8676
:
12105
|
107821
|
108636
|
109219