From 761c909a53d435b1747419ac4616ae5cbd7a3565 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 19 Mar 2018 14:14:39 +0100 Subject: [PATCH] Bug 20310: Redirect article record without items for article requests Content-Type: text/plain; charset=utf-8 If an article record has been catalogued separately, has no items and contains a reference to its host via MARC21 field 773 (host item entry), this patch makes an article request redirect to the host record while copying title, author and page info (from 773$g). This is accomplished by using the new Koha::Biblio->host_record method. Note: Subfield 773$g may contain additional information on volume and issue number etc. It will be very hard or perhaps impossible to parse $g and copy these details into the corresponding fields of the article request form for all possible variations used in libraries. A similar remark can be made for selecting the correct item (when item level is used). We could try this on a future report, but will probably need at least a preference to define the expected format. Test plan: [1] Enable article requests. Add rules for an ART and a SER itemtype. [2] Create a SER host biblio record. [3] Create an ART biblio record, no items. Include a 773w pointing to the SER record with '(MARCorgcode)[recno]' (keep the parentheses, remove the square brackets when inserting the biblionumber). Include text in 773$g too. [4] Place an article request on the ART record. Verify that it redirects you to the SER record while copying title, author, page info. Signed-off-by: Marcel de Rooy Signed-off-by: Hugo Agud --- .../opac-tmpl/bootstrap/en/modules/opac-request-article.tt | 12 ++++++------ opac/opac-request-article.pl | 10 +++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt index b5c0de07b3..6301184494 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt @@ -36,20 +36,20 @@
  • [% IF mandatory_fields.search('title') %] - + [% ELSE %] - + [% END %]
  • [% IF mandatory_fields.search('author') %] - + [% ELSE %] - + [% END %]
  • @@ -86,10 +86,10 @@
  • [% IF mandatory_fields.search('pages') %] - + [% ELSE %] - + [% END %]
  • diff --git a/opac/opac-request-article.pl b/opac/opac-request-article.pl index 30947363f6..88fe11345a 100755 --- a/opac/opac-request-article.pl +++ b/opac/opac-request-article.pl @@ -40,6 +40,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $action = $cgi->param('action') || q{}; my $biblionumber = $cgi->param('biblionumber'); +my $biblio = Koha::Biblios->find($biblionumber); if ( $action eq 'create' ) { my $branchcode = $cgi->param('branchcode'); @@ -73,9 +74,16 @@ if ( $action eq 'create' ) { print $cgi->redirect("/cgi-bin/koha/opac-user.pl#opac-user-article-requests"); exit; +} elsif ( !$action ) { + # Should we redirect? + # Conditions: no items, host item entry (MARC21 773) + my ( $host, $pageinfo ) = $biblio->host_record({ no_items => 1 }); + if( $host ) { + $template->param( pageinfo => $pageinfo, title => $biblio->title, author => $biblio->author ); + $biblio = $host; + } } -my $biblio = Koha::Biblios->find($biblionumber); my $patron = Koha::Patrons->find($borrowernumber); $template->param( -- 2.11.0