Patch reworked for master using Template::Toolkit.
To+
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
sub GetISBDView {
my ( $biblionumber, $template ) = @_;
my $record = GetMarcBiblio($biblionumber);
+ return undef unless defined $record;
my $itemtype = &GetFrameworkCode($biblionumber);
my ( $holdingbrtagf, $holdingbrtagsubf ) = &GetMarcFromKohaField( "items.holdingbranch", $itemtype );
my $tagslib = &GetMarcStructure( 1, $itemtype );
my $authid = $query->param('authid');
-
-
# Using default authtypecode, so all fields are seen
my $authtypecode = '';
$tagslib = &GetTagsLabels(1,$authtypecode);
-my $record;
+# Build list of authtypes for showing them
+my $authtypes = getauthtypes;
+my @authtypesloop;
+
+foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$authtypes) {
+ my %row =(value => $thisauthtype,
+ selected => $thisauthtype eq $authtypecode,
+ authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
+ );
+ push @authtypesloop, \%row;
+}
+
+my $record=GetAuthority($authid);
+
+if (not defined $record) {
+ # authid invalid
+ $template->param ( errauthid => $authid,
+ unknownauthid => 1,
+ authtypesloop => \@authtypesloop );
+ output_html_with_http_headers $query, $cookie, $template->output;
+ exit;
+}
+
if (C4::Context->preference("AuthDisplayHierarchy")){
my $trees=BuildUnimarcHierarchies($authid);
my @trees = split /;/,$trees ;
'displayhierarchy' =>C4::Context->preference("AuthDisplayHierarchy"),
'loophierarchies' =>\@loophierarchies,
);
-} else {
- $record=GetAuthority($authid);
}
+
my $count = CountUsage($authid);
# find the marc field/subfield used in biblio by this authority
}
chop $biblio_fields;
-
-# fill arrays
-my @loop_data =();
-my $tag;
-# loop through each tab 0 through 9
-# for (my $tabloop = 0; $tabloop<=10;$tabloop++) {
-# loop through each tag
- build_tabs ($template, $record, $dbh,"",$query);
-
-my $authtypes = getauthtypes;
-my @authtypesloop;
-foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$authtypes) {
- my %row =(value => $thisauthtype,
- selected => $thisauthtype eq $authtypecode,
- authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
- );
- push @authtypesloop, \%row;
-}
+build_tabs ($template, $record, $dbh,"",$query);
$template->param(authid => $authid,
count => $count,
}
);
+my $res = GetISBDView($biblionumber, "intranet");
+if ( not defined $res ) {
+ # biblionumber invalid -> report and exit
+ $template->param( unknownbiblionumber => 1,
+ biblionumber => $biblionumber
+ );
+ output_html_with_http_headers $query, $cookie, $template->output;
+ exit;
+}
+
if($query->cookie("holdfor")){
my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
$template->param(
);
}
-# my @blocs = split /\@/,$ISBD;
-# my @fields = $record->fields();
-my $res = GetISBDView($biblionumber, "intranet");
-
# count of item linked with biblio
my $itemcount = GetItemsCount($biblionumber);
$template->param( count => $itemcount);
$template->param (
ISBD => $res,
biblionumber => $biblionumber,
- isbdview => 1,
- z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
- C4::Search::enabled_staff_search_views,
+ isbdview => 1,
+ z3950_search_params => C4::Search::z3950_search_args(GetBiblioData($biblionumber)),
+ C4::Search::enabled_staff_search_views
);
output_html_with_http_headers $query, $cookie, $template->output;
; # if set to 1, then don't insert links, it's just to show the biblio
my $subscriptionid = $query->param('subscriptionid');
-my $tagslib = &GetMarcStructure(1,$frameworkcode);
-
-my $record = GetMarcBiblio($biblionumber);
-my $biblio = GetBiblioData($biblionumber);
# open template
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
}
);
+my $record = GetMarcBiblio($biblionumber);
+
+if ( not defined $record ) {
+ # biblionumber invalid -> report and exit
+ $template->param( unknownbiblionumber => 1,
+ biblionumber => $biblionumber
+ );
+ output_html_with_http_headers $query, $cookie, $template->output;
+ exit;
+}
+
+my $tagslib = &GetMarcStructure(1,$frameworkcode);
+my $biblio = GetBiblioData($biblionumber);
+
if($query->cookie("holdfor")){
my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
$template->param(
}
);
+my $biblionumber = $query->param('biblionumber');
+my $record = GetMarcBiblio($biblionumber);
+
+if ( not defined $record ) {
+ # biblionumber invalid -> report and exit
+ $template->param( unknownbiblionumber => 1,
+ biblionumber => $biblionumber );
+ output_html_with_http_headers $query, $cookie, $template->output;
+ exit;
+}
+
if($query->cookie("holdfor")){
my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
$template->param(
);
}
-my $biblionumber = $query->param('biblionumber');
-my $fw = GetFrameworkCode($biblionumber);
-
+my $fw = GetFrameworkCode($biblionumber);
my $showallitems = $query->param('showallitems');
-
-## get notes and subjects from MARC record
-my $marcflavour = C4::Context->preference("marcflavour");
-my $record = GetMarcBiblio($biblionumber);
+my $marcflavour = C4::Context->preference("marcflavour");
# XSLT processing of some stuff
if (C4::Context->preference("XSLTDetailsDisplay") ) {
normalized_isbn => $isbn,
);
-unless (defined($record)) {
- print $query->redirect("/cgi-bin/koha/errors/404.pl");
- exit;
-}
-
my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
my $marcisbnsarray = GetMarcISBN( $record, $marcflavour );
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
$query->param('popup')
; # if set to 1, then don't insert links, it's just to show the biblio
-my $tagslib = GetMarcStructure(1,$frameworkcode);
-my $record = GetMarcBiblio($biblionumber);
-my $biblio = GetBiblioData($biblionumber);
# open template
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
}
);
+my $record = GetMarcBiblio($biblionumber);
+if ( not defined $record ) {
+ # biblionumber invalid -> report and exit
+ $template->param( unknownbiblionumber => 1,
+ biblionumber => $biblionumber
+ );
+ output_html_with_http_headers $query, $cookie, $template->output;
+ exit;
+}
+
+my $tagslib = GetMarcStructure(1,$frameworkcode);
+my $biblio = GetBiblioData($biblionumber);
+
if($query->cookie("holdfor")){
my $holdfor_patron = GetMember('borrowernumber' => $query->cookie("holdfor"));
$template->param(
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Authorities › Details for Authority #[% authid %] ([% authtypetext %])</title>
+<title>Koha › Authorities ›
+ [% IF ( unknownauthid ) %]
+ Unknown authority record
+ [% ELSE %]
+ Details for Authority #[% authid %] ([% authtypetext %])
+ [% END %]
+</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'authorities-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> › Details for Authority #[% authid %] ([% authtypetext %]) </div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a> ›
+ [% IF ( unknownauthid ) %]
+ Unknown authority record
+ [% ELSE %]
+ Details for Authority #[% authid %] ([% authtypetext %])
+ [% END %]
+</div>
<div id="doc" class="yui-t7">
</div>
[% END %]
+
+[% IF ( unknownauthid ) %]
+ <div class="dialog message">The authority record you requested does not exist ([% errauthid %]).</div>
+[% ELSE %]
<h1>Authority #[% authid %] ([% authtypetext %])</h1>
<div id="action">
</div>
</div>
</div>
+[% END %]
</div>
[% INCLUDE 'intranet-bottom.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Catalog › ISBD Details for [% title %]</title>
+<title>Koha › Catalog ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ ISBD Details for [% title %]
+ [% END %]
+</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › ISBD Details for <i>[% biblionumber %]</i></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ ISBD Details for <i>[% biblionumber %]</i>
+ [% END %]
+</div>
<div id="doc3" class="yui-t2">
-
+
+[% IF ( unknownbiblionumber ) %]
+ <div class="dialog message">The record you requested does not exist ([% biblionumber %]).</div>
+[% ELSE %]
<div id="bd">
- <div id="yui-main">
+ <div id="yui-main">
<div class="yui-b">
-[% INCLUDE 'cat-toolbar.inc' %]
+ [% INCLUDE 'cat-toolbar.inc' %]
- <div id="catalogue_ISBDdetail">
- [% ISBD %]
+ <div id="catalogue_ISBDdetail">
+ [% ISBD %]
+ </div>
</div>
-
-
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'biblio-view-menu.inc' %]
-</div>
+ </div>
+ <div class="yui-b">
+ [% INCLUDE 'biblio-view-menu.inc' %]
+ </div>
+ </div>
+[% END %]
</div>
[% INCLUDE 'intranet-bottom.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Catalog › MARC Details for [% bibliotitle %]</title>
+<title>Koha › Catalog ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ MARC Details for [% bibliotitle %]
+ [% END %]
+</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
//<![CDATA[
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › MARC Details for <i>[% bibliotitle |html %]</i></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ MARC Details for <i>[% bibliotitle |html %]</i>
+ [% END %]
+</div>
<div id="doc3" class="yui-t2">
+[% IF ( unknownbiblionumber ) %]
+ <div class="dialog message">The record you requested does not exist ([% biblionumber %]).</div>
+[% ELSE %]
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div class="yui-b">
[% INCLUDE 'biblio-view-menu.inc' %]
</div>
+[% END %]
</div>
[% INCLUDE 'intranet-bottom.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Catalog › Details for [% title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</title>
+<title>Koha › Catalog ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ Details for [% title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]
+ [% END %]
+</title>
[% INCLUDE 'doc-head-close.inc' %]<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> › Details for <i>[% title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</i></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ Details for <i>[% title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</i>
+ [% END %]
+</div>
<div id="doc3" class="yui-t2">
-
+
+[% IF ( unknownbiblionumber ) %]
+ <div class="dialog message">The record you requested does not exist ([% biblionumber %]).</div>
+[% ELSE %]
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<div class="yui-b">
[% INCLUDE 'biblio-view-menu.inc' %]
</div>
+[% END %]
</div>
[% INCLUDE 'intranet-bottom.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
- <title>Koha › Catalog › Labeled MARC Details for [% bibliotitle %]</title>
+<title>Koha › Catalog ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ Labeled MARC Details for [% bibliotitle %]
+ [% END %]
+</title>
[% INCLUDE 'doc-head-close.inc' %]
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
- › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
- › MARC Details for <i>[% bibliotitle %]</i>
+ › <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> ›
+ [% IF ( unknownbiblionumber ) %]
+ Unknown record
+ [% ELSE %]
+ MARC Details for <i>[% bibliotitle %]</i>
+ [% END %]
</div>
<div id="doc3" class="yui-t2">
+
+ [% IF ( unknownbiblionumber ) %]
+ <div class="dialog message">The record you requested does not exist ([% biblionumber %]).</div>
+ [% ELSE %]
+
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'biblio-view-menu.inc' %]
</div>
+ [% END %]
</div>
[% INCLUDE 'intranet-bottom.inc' %]