Bug 5430: Add Control number as option to OPACSearchForTitleIn

Makes {CONTROLNUMBER} available as new placeholder in
system preference OPACSearchForTitleIn.

{CONTROLNUMBER} will be replaced by the number in tag 001.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Katrin Fischer 2010-11-24 11:35:43 -05:00 committed by Chris Cormack
parent e04be3a48c
commit 703156daee
3 changed files with 23 additions and 1 deletions

View File

@ -67,6 +67,7 @@ BEGIN {
&GetISBDView
&GetMarcControlnumber
&GetMarcNotes
&GetMarcSubjects
&GetMarcBiblio
@ -1254,6 +1255,24 @@ sub GetAuthorisedValueDesc {
}
}
=head2 GetMarcControlnumber
$marccontrolnumber = GetMarcControlnumber($record,$marcflavour);
Get the control number / record Identifier from the MARC record and return it.
=cut
sub GetMarcControlnumber {
my ( $record, $marcflavour ) = @_;
my $controlnumber = "";
# Control number or Record identifier are the same field in MARC21 and UNIMARC
# Keep $marcflavour for possible later use
if ($marcflavour eq "MARC21" || $marcflavour eq "UNIMARC") {
$controlnumber = $record->field('001')->data();
}
}
=head2 GetMarcNotes
$marcnotesarray = GetMarcNotes( $record, $marcflavour );

View File

@ -137,7 +137,7 @@ OPAC:
class: code
-
- 'Include a "More Searches" box on the detail pages of items on the OPAC, with the following HTML (leave blank to disable):'
- '<br />Note: The placeholders {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.'
- '<br />Note: The placeholders {CONTROLNUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.'
- pref: OPACSearchForTitleIn
type: textarea
class: code

View File

@ -584,12 +584,15 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref
}
#Search for title in links
my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour);
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
$dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
$dat->{title} =~ s/\/+$//; # remove trailing slash
$dat->{title} =~ s/\s+$//; # remove trailing space
$dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
$isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
$marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
$template->param('OPACSearchForTitleIn' => $search_for_title);
}