[Koha-devel] Where we should add this function ?
Ernesto Silva - Webmaster
silva at ort.edu.uy
Mon Jan 17 06:29:08 CET 2005
Paul,
Here goes the function mentioned by Andrés. I'm not sure in which
module should be included.
I'm using this function in the opac-ISBDdetail.pl and it's called for
every displayed value so it may slow down the execution, specially if
the $tagslib variable is not global and must be calculated in every call.
I think this function can become part of some module (Biblio.pm?) but,
as I said, be carefull with the $tagslib variable.
I´m attaching the full patch for opac-ISBDdetail.pl.
The file "intranet/cgi-bin/ISBDdetail.pl" should be modified too, I
haven't done this yet because I don't want to re-insert the function
there too (and our librarians doesn't complain yet ;)
Anyway, here it is.
#*****************************************************************************
# global variable in the opac-ISBDdetail.pl
my $tagslib = &MARCgettagslib($dbh,1,$itemtype);
#-----------------------------------------------------------------------------
sub get_authorised_value_desc ($$$$$) {
my($tag, $subfield, $value, $framework, $dbh) = @_;
#---- branch
if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq
"branches" ) {
return getbranchname($value);
}
#---- itemtypes
if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq
"itemtypes" ) {
return ItemType($value);
}
#---- "true" authorized value
my $category = $tagslib->{$tag}->{$subfield}->{'authorised_value'};
if ($category ne "") {
my $sth = $dbh->prepare("select lib from authorised_values where
category = ? and authorised_value = ?");
$sth->execute($category, $value);
my $data = $sth->fetchrow_hashref;
return $data->{'lib'};
} else {
return $value; # if nothing is found return the original value
}
}
#*****************************************************************************
Andrés Tarallo wrote:
> Our Librarians discovered that: when you're in the OPAC Search, when you
> enter in the ISBD detail (at least in the OPAC) those fields that have
> authorized values aren't displayed propoerly. To clarify this: When you
> display a certain field that has an authorized valued you get the key,
> not the value.
>
> We developed a function that "notices" that a field has authorized
> values and returns the proper value or does nothing. We want to to
> contribute back this function to the project, In which module should we
> add this function?
>
> Thanks
>
> Andres
>
> PD: We'll be on leave till Janury 17th.
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/koha-devel
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch
URL: </pipermail/koha-devel/attachments/20050117/d858f382/attachment-0001.asc>
More information about the Koha-devel
mailing list