Bugzilla – Attachment 166276 Details for
Bug 36182
Add vendor column to holdings table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36182: Show vendor name if acquisition_source is a vendor_id
Bug-36182-Show-vendor-name-if-acquisitionsource-is.patch (text/plain), 2.60 KB, created by
Pedro Amorim
on 2024-05-07 12:50:11 UTC
(
hide
)
Description:
Bug 36182: Show vendor name if acquisition_source is a vendor_id
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-05-07 12:50:11 UTC
Size:
2.60 KB
patch
obsolete
>From 8dc23f90869595d5c99e0cc2f562d8ae3653bc4c Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Tue, 7 May 2024 12:45:24 +0000 >Subject: [PATCH] Bug 36182: Show vendor name if acquisition_source is a > vendor_id > >This will make it so if acquisition_source is of an existing vendor_id, it'll show the vendor name instead of the id. >If it's not of an existing vendor_id, show the raw value instead. > >I'm not 100% happy with this patch as it adds an edge case to Item::strings_map but I believe the only alternative >is to make 952$e Source of acquisition an AV field in the default framework. >Not only that, but this would have to be an AV field of type 'vendors' that'd have to allow to pick from existing vendors (similar to current 'branches'). >The above is a ton more work than initial suggestions would imply. >Happy to be proven wrong (in fact, hoping I am). > >This is compatible with main Koha only, not backportable to 23.11 >--- > Koha/Item.pm | 12 ++++++++++++ > .../html_helpers/tables/items/catalogue_detail.inc | 2 +- > 2 files changed, 13 insertions(+), 1 deletion(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 91c15b22d5..88fab74068 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -2507,6 +2507,18 @@ sub strings_map { > ( $type eq 'av' ? ( category => $code ) : () ), > }; > } >+ >+ if ( $col eq 'booksellerid' ) { >+ my $booksellerid = $self->booksellerid; >+ if ($booksellerid) { >+ my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid ); >+ >+ $strings->{$col} = { >+ str => $bookseller->name, >+ type => 'acquisition_source' >+ } if $bookseller; >+ } >+ } > } > > return $strings; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index 74abd4779f..eee0a80b3f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -613,7 +613,7 @@ > searchable: true, > orderable: true, > render: function (data, type, row, meta) { >- return escape_str(row.acquisition_source); >+ return escape_str(row._strings.acquisition_source ? row._strings.acquisition_source.str : row.acquisition_source); > } > }, > { >-- >2.39.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 36182
:
162515
|
162519
|
165265
|
165485
|
166276
|
166277
|
174399
|
174400