Bug 25868: Fix transfers page to show effective itemtype

In transfers page /cgi-bin/koha/circ/branchtransfers.pl :
Itemtype is always from biblioitems.itemtype, regardless of system preference item-level_itypes.

Patch also changes template to use the object Koha::Item.

Patch also fixes a small typo : closed <form> tag.

Test plan :
1) Test with both values of system preference 'item-level_itypes'
2) Go to Circulation > Transfert
3) Enter a barcode
4) Enter another barcode
5) Check you see in table all datas and that 'Item type' is correct

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit e441cb35fb)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 797af67544)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
This commit is contained in:
Fridolin Somers 2020-06-24 17:05:30 +02:00 committed by Aleisha Amohia
parent b4e9d551dc
commit be39690df9
2 changed files with 28 additions and 44 deletions

View File

@ -131,50 +131,30 @@ if ($barcode) {
my $item = Koha::Items->find({ barcode => $barcode });
$found = $messages->{'ResFound'};
if ($transferred) {
my %item;
my $biblio = $item->biblio;
my %trsfitem;
my $frbranchcd = C4::Context->userenv->{'branch'};
$item{'biblionumber'} = $item->biblionumber;
$item{'itemnumber'} = $item->itemnumber;
$item{'title'} = $biblio->title;
$item{'author'} = $biblio->author;
$item{'itemtype'} = $biblio->biblioitem->itemtype;
$item{'ccode'} = $item->ccode;
$item{'itemcallnumber'} = $item->itemcallnumber;
my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $item->location });
$item{'location'} = $av->count ? $av->next->lib : '';
$item{counter} = 0;
$item{barcode} = $barcode;
$item{frombrcd} = $frbranchcd;
$item{tobrcd} = $tobranchcd;
push( @trsfitemloop, \%item );
$trsfitem{item} = $item;
$trsfitem{counter} = 0;
$trsfitem{frombrcd} = $frbranchcd;
$trsfitem{tobrcd} = $tobranchcd;
push( @trsfitemloop, \%trsfitem );
}
}
foreach ( $query->param ) {
(next) unless (/bc-(\d*)/);
my $counter = $1;
my %item;
my %trsfitem;
my $bc = $query->param("bc-$counter");
my $frbcd = $query->param("fb-$counter");
my $tobcd = $query->param("tb-$counter");
$counter++;
$item{counter} = $counter;
$item{barcode} = $bc;
$item{frombrcd} = $frbcd;
$item{tobrcd} = $tobcd;
$trsfitem{counter} = $counter;
$trsfitem{frombrcd} = $frbcd;
$trsfitem{tobrcd} = $tobcd;
my $item = Koha::Items->find({ barcode => $bc });
my $biblio = $item->biblio;
$item{'biblionumber'} = $item->biblionumber;
$item{'itemnumber'} = $item->itemnumber;
$item{'title'} = $biblio->title;
$item{'author'} = $biblio->author;
$item{'itemtype'} = $biblio->biblioitem->itemtype;
$item{'ccode'} = $item->ccode;
$item{'itemcallnumber'} = $item->itemcallnumber;
my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $item->location });
$item{'location'} = $av->count ? $av->next->lib : '';
push( @trsfitemloop, \%item );
$trsfitem{item} = $item;
push( @trsfitemloop, \%trsfitem );
}
my $itemnumber;

View File

@ -40,7 +40,7 @@
<td>
<form method="post" name="mainform" id="mainform" action="branchtransfers.pl">
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.item.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
@ -65,7 +65,7 @@
<td>
<form method="post" name="mainform" id="mainform" action="branchtransfers.pl">
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.item.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
@ -82,11 +82,11 @@
<tr>
<th>Ignore and return to transfers: </th>
<td>
<form method="post" name="mainform" id="mainform" action="branchtransfers.pl" />
<form method="post" name="mainform" id="mainform" action="branchtransfers.pl">
<input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" />
<input type="hidden" name="barcode" />
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.item.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
@ -164,7 +164,7 @@
</fieldset>
<input type="hidden" name="tobranchcd" value="[% tobrancd | html %]" />
[% FOREACH trsfitemloo IN trsfitemloop %]
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.barcode | html %]" />
<input type="hidden" name="bc-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.item.barcode | html %]" />
<input type="hidden" name="fb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.frombrcd | html %]" />
<input type="hidden" name="tb-[% trsfitemloo.counter | html %]" value="[% trsfitemloo.tobrcd | html %]" />
[% END %]
@ -186,13 +186,17 @@
</tr>
[% FOREACH trsfitemloo IN trsfitemloop %]
<tr>
<td class="tf-title"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% trsfitemloo.biblionumber | uri %]">[% trsfitemloo.title | html %]</a></td>
<td class="tf-author">[% trsfitemloo.author | html %]</td>
<td class="tf-barcode"><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% trsfitemloo.biblionumber | uri %]&amp;itemnumber=[% trsfitemloo.itemnumber | uri %]#item[% trsfitemloo.itemnumber | uri %]">[% trsfitemloo.barcode | html %]</a></td>
<td class="tf-location"><span class="shelvingloc">[% trsfitemloo.location | html %]</span></td>
<td class="tf-itemcallnumber">[% trsfitemloo.itemcallnumber | html %]</td>
<td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.itemtype ) | html %]</td>
<td class="tf-ccode">[% AuthorisedValues.GetByCode( 'CCODE', trsfitemloo.ccode ) | html %]</td>
<td class="tf-title">
[% INCLUDE 'biblio-default-view.inc' biblionumber = trsfitemloo.item.biblionumber %]
[% INCLUDE 'biblio-title.inc' biblio=trsfitemloo.item.biblio %]
</a>
</td>
<td class="tf-author">[% trsfitemloo.item.biblio.author | html %]</td>
<td class="tf-barcode"><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% trsfitemloo.item.biblionumber | uri %]&amp;itemnumber=[% trsfitemloo.item.itemnumber | uri %]#item[% trsfitemloo.item.itemnumber | uri %]">[% trsfitemloo.item.barcode | html %]</a></td>
<td class="tf-location"><span class="shelvingloc">[% AuthorisedValues.GetByCode( 'LOC', trsfitemloo.item.location ) | html %]</span></td>
<td class="tf-itemcallnumber">[% trsfitemloo.item.itemcallnumber | html %]</td>
<td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.item.effective_itemtype ) | html %]</td>
<td class="tf-ccode">[% AuthorisedValues.GetByCode( 'CCODE', trsfitemloo.item.ccode ) | html %]</td>
<td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrcd ) | html %]</td>
</tr>
[% END %]