my $request = $query->param('request') || '';
my $borrowernumber = $query->param('borrowernumber') || 0;
+my $frombranchcd = $query->param('frombranchcd') || C4::Context->userenv->{'branch'};
my $tobranchcd = $query->param('tobranchcd') || '';
my $ignoreRs = 0;
itemnumber => $itemnumber,
barcode => $barcode,
biblionumber => $biblionumber,
+ frombranchcd => $frombranchcd,
tobranchcd => $tobranchcd,
reqmessage => $reqmessage,
cancelled => $cancelled,
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
<input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" />
+ <input type="hidden" name="frombranchcd" value="[% tobranchcd | html %]" />
<input type="hidden" name="barcode" value="[% barcode | html %]" />
<input type="hidden" name="request" value="KillReserved" />
<input type="submit" value="Cancel" />
[% ELSE %]
<li>Collection: <b>[% AuthorisedValues.GetByCode( 'CCODE', errmsgloo.code ) | html %]</b></li>
[% END %]
+ <li>Originating library: <b>[% Branches.GetName( errmsgloo.fbr ) | html %]</b></li>
<li>Destination library: <b>[% Branches.GetName( errmsgloo.tbr ) | html %]</b></li>
</ol>
</li>
<legend>Transfer</legend>
<ol>
<li>
+ <label for="frombranchcd">Originating library: </label>
+ <select name="frombranchcd" id="frombranchcd">
+ <option value="current_holding">Item's holding branch</option>
+ [% PROCESS options_for_libraries libraries => Branches.all( selected => '', unfiltered => 1) %]
+ </select>
+ </li>
+ <li>
<label for="tobranchcd">Destination library: </label>
<select name="tobranchcd" id="tobranchcd">
[% PROCESS options_for_libraries libraries => Branches.all( selected => tobranchcd, unfiltered => 1) %]
<th class="tf-itemcallnumber">Call number</th>
<th class="tf-itemtype">Item type</th>
<th class="tf-ccode">Collection</th>
+ <th class="tf-origin">Origin</th>
<th class="tf-destination">Destination</th>
</tr>
[% FOREACH trsfitemloo IN trsfitemloop %]
<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-origin">[% Branches.GetName( trsfitemloo.frombrcd ) | html %]</td>
<td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrcd ) | html %]</td>
</tr>
[% END %]
use Modern::Perl;
use utf8;
-use Test::More tests => 49;
+use Test::More tests => 50;
use Test::MockModule;
use Test::Deep qw( cmp_deeply );
is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled');
$itemcheck = Koha::Items->find($item->itemnumber);
is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' );
+
+};
+
+subtest 'transferbook test' => sub {
+ plan tests => 5;
+
+ my $library = $builder->build_object( { class => 'Koha::Libraries' } );
+ my $item = $builder->build_sample_item();
+ ok( $item->holdingbranch ne $library->branchcode && $item->homebranch ne $library->branchcode, "Item is not held or owned by library");
+ C4::Circulation::transferbook({
+ from_branch => $library->branchcode,
+ to_branch => $item->homebranch,
+ barcode => $item->barcode,
+ });
+ my ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
+ is( $from_branch, $library->branchcode, 'The transfer is initiated from the specified branch, not the items home or holdingbranch');
+ is( $to_branch, $item->homebranch, 'The transfer is initiated to the specified branch');
+ C4::Circulation::transferbook({
+ from_branch => $item->homebranch,
+ to_branch => $library->branchcode,
+ barcode => $item->barcode,
+ });
+ ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
+ is( $from_branch, $item->homebranch, 'The transfer is initiated from the specified branch');
+ is( $to_branch, $library->branchcode, 'The transfer is initiated to the specified branch');
+
};
subtest 'CanBookBeIssued | is_overdue' => sub {