Bug 18276: Remove GetBiblioFromItemNumber - Course reserves

Values from the items, biblio and biblioitems tables are used in the template,
so we need to pass all of them to the template, but separately.
That way we easily see which field from which table we are displaying.

Test plan:
Create a course reserve and add items.
Correct information must be displayed on the detail page of the course
reserve, on staff and OPAC interface.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-03-15 10:15:30 -03:00
parent b8d188caa9
commit dadfeabc37
5 changed files with 21 additions and 16 deletions

View file

@ -21,7 +21,6 @@ use List::MoreUtils qw(any);
use C4::Context;
use C4::Items qw(GetItem ModItem);
use C4::Biblio qw(GetBiblioFromItemNumber);
use C4::Circulation qw(GetOpenIssue);
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG @FIELDS);
@ -877,8 +876,13 @@ sub GetCourseReserves {
if ($include_items) {
foreach my $cr (@$course_reserves) {
my $item = Koha::Items->find( $cr->{itemnumber} );
my $biblio = $item->biblio;
my $biblioitem = $biblio->biblioitem;
$cr->{'course_item'} = GetCourseItem( ci_id => $cr->{'ci_id'} );
$cr->{'item'} = GetBiblioFromItemNumber( $cr->{'itemnumber'} );
$cr->{'item'} = $item;
$cr->{'biblio'} = $biblio;
$cr->{'biblioitem'} = $biblioitem;
$cr->{'issue'} = GetOpenIssue( $cr->{'itemnumber'} );
}
}

View file

@ -30,6 +30,7 @@ use Koha::Items;
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
use Koha::Items;
use Koha::ItemTypes;
my $cgi = new CGI;
@ -60,8 +61,8 @@ $template->param( ERROR_BARCODE_NOT_FOUND => $barcode . $inumber )
$template->param( course => GetCourse($course_id) );
if ( $action eq 'lookup' ) {
my $course_item = GetCourseItem( itemnumber => $item->{'itemnumber'} );
if ( $action eq 'lookup' and $item ) {
my $course_item = GetCourseItem( itemnumber => $item->itemnumber );
my $course_reserve =
($course_item)
? GetCourseReserve(
@ -73,7 +74,7 @@ if ( $action eq 'lookup' ) {
my $itemtypes = Koha::ItemTypes->search;
$template->param(
item => $item,
title => $title,
biblio => $item->biblio,
course_item => $course_item,
course_reserve => $course_reserve,

View file

@ -9,7 +9,7 @@
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Reserve <i><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]">[% title %]</a></i> for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]">[% course.course_name %]</a></i></div>
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Reserve <i><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></i> for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]">[% course.course_name %]</a></i></div>
<div id="doc" class="yui-t7">
<div id="bd">
@ -23,7 +23,7 @@
<input type="hidden" name="action" value="add" />
<fieldset class="rows">
<legend>Add <i>[% title %]</i> to <i>[% course.course_name %]</i></legend>
<legend>Add <i>[% biblio.title %]</i> to <i>[% course.course_name %]</i></legend>
<ol>
<li>
<span class="label">Barcode:</span>

View file

@ -102,9 +102,9 @@
<tbody>
[% FOREACH cr IN course_reserves %]
<tr>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.item.biblionumber %]">[% cr.item.title %]</a></td>
<td>[% cr.item.author %]</td>
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber %]&amp;biblionumber=[% cr.item.biblionumber %]&amp;bi=[% cr.item.biblioitemnumber %]">[% cr.item.barcode %]</a></td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.biblio.biblionumber %]">[% cr.biblio.title %]</a></td>
<td>[% cr.biblio.author %]</td>
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber %]&amp;biblionumber=[% cr.biblio.biblionumber %]&amp;bi=[% cr.biblioitem.biblioitemnumber %]">[% cr.item.barcode %]</a></td>
<td>[% cr.item.itemcallnumber %]</td>
[% IF item_level_itypes %]
<td>
@ -180,8 +180,8 @@
<td>
[% IF (cr.item.uri) %]
<a href="[% cr.item.uri %]">Item URI</a>
[% ELSIF (cr.item.url) %]
<a href="[% cr.item.url %]">Record URL</a>
[% ELSIF (cr.biblioitem.url) %]
<a href="[% cr.biblioitem.url %]">Record URL</a>
[% END %]
</td>

View file

@ -66,8 +66,8 @@
<tbody>
[% FOREACH cr IN course_reserves %]
<tr>
<td><a href="opac-detail.pl?biblionumber=[% cr.item.biblionumber %]">[% cr.item.title %]</a></td>
<td>[% cr.item.author %]</td>
<td><a href="opac-detail.pl?biblionumber=[% cr.biblio.biblionumber %]">[% cr.biblio.title %]</a></td>
<td>[% cr.biblio.author %]</td>
<td>[% ItemTypes.GetDescription( cr.item.itype ) %]</td>
<td>[% Branches.GetName( cr.item.holdingbranch ) %] <br/> <i>[% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %]</i></td>
<td>[% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %]</td>
@ -83,8 +83,8 @@
</td>
<td>[% IF (cr.item.uri) %]
<a href="[% cr.item.uri %]">Item URI</a>
[% ELSIF (cr.item.url) %]
<a href="[% cr.item.url %]">Record URL</a>
[% ELSIF (cr.biblioitem.url) %]
<a href="[% cr.biblioitem.url %]">Record URL</a>
[% END %]
</td>
</tr>