View | Details | Raw Unified | Return to bug 23695
Collapse All | Expand All

(-)a/circ/branchtransfers.pl (-4 / +6 lines)
Lines 80-85 my $setwaiting; Link Here
80
80
81
my $request        = $query->param('request')        || '';
81
my $request        = $query->param('request')        || '';
82
my $borrowernumber = $query->param('borrowernumber') ||  0;
82
my $borrowernumber = $query->param('borrowernumber') ||  0;
83
my $frombranchcd   = $query->param('frombranchcd')   || C4::Context->userenv->{'branch'};
83
my $tobranchcd     = $query->param('tobranchcd')     || '';
84
my $tobranchcd     = $query->param('tobranchcd')     || '';
84
85
85
my $ignoreRs = 0;
86
my $ignoreRs = 0;
Lines 126-144 defined $barcode and $barcode =~ s/^\s*|\s*$//g; # FIXME: barcodeInputFilter Link Here
126
# warn "barcode : $barcode";
127
# warn "barcode : $barcode";
127
if ($barcode) {
128
if ($barcode) {
128
129
130
    my $item = Koha::Items->find({ barcode => $barcode });
131
    $frombranchcd = $item->holdingbranch if $frombranchcd eq "current_holding";
129
    ( $transferred, $messages ) =
132
    ( $transferred, $messages ) =
130
        transferbook({
133
        transferbook({
131
            from_branch => C4::Context->userenv->{'branch'},
134
            from_branch => $frombranchcd,
132
            to_branch => $tobranchcd,
135
            to_branch => $tobranchcd,
133
            barcode => $barcode,
136
            barcode => $barcode,
134
            ignore_reserves => $ignoreRs
137
            ignore_reserves => $ignoreRs
135
        });
138
        });
136
    my $item = Koha::Items->find({ barcode => $barcode });
137
    $found = $messages->{'ResFound'};
139
    $found = $messages->{'ResFound'};
138
    if ($transferred) {
140
    if ($transferred) {
139
        my %item;
141
        my %item;
140
        my $biblio = $item->biblio;
142
        my $biblio = $item->biblio;
141
        my $frbranchcd =  C4::Context->userenv->{'branch'};
142
        $item{'biblionumber'}          = $item->biblionumber;
143
        $item{'biblionumber'}          = $item->biblionumber;
143
        $item{'itemnumber'}            = $item->itemnumber;
144
        $item{'itemnumber'}            = $item->itemnumber;
144
        $item{'title'}                 = $biblio->title;
145
        $item{'title'}                 = $biblio->title;
Lines 150-156 if ($barcode) { Link Here
150
        $item{'location'}              = $av->count ? $av->next->lib : '';
151
        $item{'location'}              = $av->count ? $av->next->lib : '';
151
        $item{counter}  = 0;
152
        $item{counter}  = 0;
152
        $item{barcode}  = $barcode;
153
        $item{barcode}  = $barcode;
153
        $item{frombrcd} = $frbranchcd;
154
        $item{frombrcd} = $frombranchcd;
154
        $item{tobrcd}   = $tobranchcd;
155
        $item{tobrcd}   = $tobranchcd;
155
        push( @trsfitemloop, \%item );
156
        push( @trsfitemloop, \%item );
156
    }
157
    }
Lines 240-245 $template->param( Link Here
240
    itemnumber              => $itemnumber,
241
    itemnumber              => $itemnumber,
241
    barcode                 => $barcode,
242
    barcode                 => $barcode,
242
    biblionumber            => $biblionumber,
243
    biblionumber            => $biblionumber,
244
    frombranchcd            => $frombranchcd,
243
    tobranchcd              => $tobranchcd,
245
    tobranchcd              => $tobranchcd,
244
    reqmessage              => $reqmessage,
246
    reqmessage              => $reqmessage,
245
    cancelled               => $cancelled,
247
    cancelled               => $cancelled,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt (+11 lines)
Lines 71-76 Link Here
71
                            <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
71
                            <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
72
                            <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
72
                            <input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
73
                            <input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" />
73
                            <input type="hidden" name="tobranchcd" value="[% tobranchcd | html %]" />
74
                            <input type="hidden" name="frombranchcd" value="[% tobranchcd | html %]" />
74
                            <input type="hidden" name="barcode" value="[% barcode | html %]" />
75
                            <input type="hidden" name="barcode" value="[% barcode | html %]" />
75
                            <input type="hidden" name="request" value="KillReserved" />
76
                            <input type="hidden" name="request" value="KillReserved" />
76
                            <input type="submit" value="Cancel" />
77
                            <input type="submit" value="Cancel" />
Lines 127-132 Link Here
127
                                          [% ELSE %]
128
                                          [% ELSE %]
128
                                              <li>Collection code: <b>[% AuthorisedValues.GetByCode( 'CCODE', errmsgloo.code ) | html %]</b></li>
129
                                              <li>Collection code: <b>[% AuthorisedValues.GetByCode( 'CCODE', errmsgloo.code ) | html %]</b></li>
129
                                          [% END %]
130
                                          [% END %]
131
                                          <li>Originating library: <b>[% Branches.GetName( errmsgloo.fbr ) | html %]</b></li>
130
                                          <li>Destination library: <b>[% Branches.GetName( errmsgloo.tbr ) | html %]</b></li>
132
                                          <li>Destination library: <b>[% Branches.GetName( errmsgloo.tbr ) | html %]</b></li>
131
                                      </ol>
133
                                      </ol>
132
                                  </li>
134
                                  </li>
Lines 150-155 Link Here
150
            <legend>Transfer</legend>
152
            <legend>Transfer</legend>
151
            <ol>
153
            <ol>
152
			<li>
154
			<li>
155
                <label for="frombranchcd">Originating library: </label>
156
                    <select name="frombranchcd" id="frombranchcd">
157
                        <option value="current_holding">Item's holding branch</option>
158
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => '', unfiltered => 1) %]
159
                    </select>
160
            </li>
161
			<li>
153
                <label for="tobranchcd">Destination library: </label>
162
                <label for="tobranchcd">Destination library: </label>
154
                    <select name="tobranchcd" id="tobranchcd">
163
                    <select name="tobranchcd" id="tobranchcd">
155
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => tobranchcd, unfiltered => 1) %]
164
                        [% PROCESS options_for_libraries libraries => Branches.all( selected => tobranchcd, unfiltered => 1) %]
Lines 181-186 Link Here
181
                <th class="tf-itemcallnumber">Call number</th>
190
                <th class="tf-itemcallnumber">Call number</th>
182
                <th class="tf-itemtype">Item type</th>
191
                <th class="tf-itemtype">Item type</th>
183
                <th class="tf-ccode">Collection code</th>
192
                <th class="tf-ccode">Collection code</th>
193
                <th class="tf-origin">Origin</th>
184
                <th class="tf-destination">Destination</th>
194
                <th class="tf-destination">Destination</th>
185
            </tr>
195
            </tr>
186
            [% FOREACH trsfitemloo IN trsfitemloop %]
196
            [% FOREACH trsfitemloo IN trsfitemloop %]
Lines 192-197 Link Here
192
                    <td class="tf-itemcallnumber">[% trsfitemloo.itemcallnumber | html %]</td>
202
                    <td class="tf-itemcallnumber">[% trsfitemloo.itemcallnumber | html %]</td>
193
                    <td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.itemtype ) | html %]</td>
203
                    <td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.itemtype ) | html %]</td>
194
                    <td class="tf-ccode">[% AuthorisedValues.GetByCode( 'CCODE', trsfitemloo.ccode ) | html %]</td>
204
                    <td class="tf-ccode">[% AuthorisedValues.GetByCode( 'CCODE', trsfitemloo.ccode ) | html %]</td>
205
                    <td class="tf-origin">[% Branches.GetName( trsfitemloo.frombrcd ) | html %]</td>
195
                    <td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrcd ) | html %]</td>
206
                    <td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrcd ) | html %]</td>
196
                </tr>
207
                </tr>
197
            [% END %]
208
            [% END %]
(-)a/t/db_dependent/Circulation.t (-2 / +27 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 46;
21
use Test::More tests => 47;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Deep qw( cmp_deeply );
23
use Test::Deep qw( cmp_deeply );
24
24
Lines 3015-3020 subtest 'Cancel transfers on lost items' => sub { Link Here
3015
    is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled');
3015
    is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled');
3016
    $itemcheck = Koha::Items->find($item->itemnumber);
3016
    $itemcheck = Koha::Items->find($item->itemnumber);
3017
    is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' );
3017
    is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' );
3018
3019
};
3020
3021
subtest 'transferbook test' => sub {
3022
    plan tests => 5;
3023
3024
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
3025
    my $item = $builder->build_sample_item();
3026
    ok( $item->holdingbranch ne $library->branchcode && $item->homebranch ne $library->branchcode, "Item is not held or owned by library");
3027
    C4::Circulation::transferbook({
3028
        from_branch => $library->branchcode,
3029
        to_branch => $item->homebranch,
3030
        barcode   => $item->barcode,
3031
    });
3032
    my ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
3033
    is( $from_branch, $library->branchcode, 'The transfer is initiated from the specified branch, not the items home or holdingbranch');
3034
    is( $to_branch, $item->homebranch, 'The transfer is initiated to the specified branch');
3035
    C4::Circulation::transferbook({
3036
        from_branch => $item->homebranch,
3037
        to_branch => $library->branchcode,
3038
        barcode   => $item->barcode,
3039
    });
3040
    ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
3041
    is( $from_branch, $item->homebranch, 'The transfer is initiated from the specified branch');
3042
    is( $to_branch, $library->branchcode, 'The transfer is initiated to the specified branch');
3043
3018
};
3044
};
3019
3045
3020
subtest 'CanBookBeIssued | is_overdue' => sub {
3046
subtest 'CanBookBeIssued | is_overdue' => sub {
3021
- 

Return to bug 23695