use Koha::Caches;
use Koha::Authority::Types;
use Koha::Acquisition::Booksellers;
use Koha::Acquisition::Currencies;
use Koha::Biblio::Metadatas;
use Koha::Holds;
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'};
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
type => 'text',
-