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-146 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
133
131
        transferbook({
134
        transferbook({
132
            from_branch => C4::Context->userenv->{'branch'},
135
            from_branch => $frombranchcd,
133
            to_branch => $tobranchcd,
136
            to_branch => $tobranchcd,
134
            barcode => $barcode,
137
            barcode => $barcode,
135
            ignore_reserves => $ignoreRs,
138
            ignore_reserves => $ignoreRs,
136
            trigger => 'Manual'
139
            trigger => 'Manual'
137
        });
140
        });
138
    my $item = Koha::Items->find({ barcode => $barcode });
139
    $found = $messages->{'ResFound'};
141
    $found = $messages->{'ResFound'};
140
    if ($transferred) {
142
    if ($transferred) {
141
        my %item;
143
        my %item;
142
        my $biblio = $item->biblio;
144
        my $biblio = $item->biblio;
143
        my $frbranchcd =  C4::Context->userenv->{'branch'};
144
        $item{'biblionumber'}          = $item->biblionumber;
145
        $item{'biblionumber'}          = $item->biblionumber;
145
        $item{'itemnumber'}            = $item->itemnumber;
146
        $item{'itemnumber'}            = $item->itemnumber;
146
        $item{'title'}                 = $biblio->title;
147
        $item{'title'}                 = $biblio->title;
Lines 152-158 if ($barcode) { Link Here
152
        $item{'location'}              = $av->count ? $av->next->lib : '';
153
        $item{'location'}              = $av->count ? $av->next->lib : '';
153
        $item{counter}  = 0;
154
        $item{counter}  = 0;
154
        $item{barcode}  = $barcode;
155
        $item{barcode}  = $barcode;
155
        $item{frombrcd} = $frbranchcd;
156
        $item{frombrcd} = $frombranchcd;
156
        $item{tobrcd}   = $tobranchcd;
157
        $item{tobrcd}   = $tobranchcd;
157
        push( @trsfitemloop, \%item );
158
        push( @trsfitemloop, \%item );
158
    }
159
    }
Lines 243-248 $template->param( Link Here
243
    itemnumber              => $itemnumber,
244
    itemnumber              => $itemnumber,
244
    barcode                 => $barcode,
245
    barcode                 => $barcode,
245
    biblionumber            => $biblionumber,
246
    biblionumber            => $biblionumber,
247
    frombranchcd            => $frombranchcd,
246
    tobranchcd              => $tobranchcd,
248
    tobranchcd              => $tobranchcd,
247
    reqmessage              => $reqmessage,
249
    reqmessage              => $reqmessage,
248
    cancelled               => $cancelled,
250
    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 3018-3023 subtest 'Cancel transfers on lost items' => sub { Link Here
3018
    is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled');
3018
    is( $tobranch, undef, 'The transfer on the lost item has been deleted as the LostItemCancelOutstandingTransfer is enabled');
3019
    $itemcheck = Koha::Items->find($item->itemnumber);
3019
    $itemcheck = Koha::Items->find($item->itemnumber);
3020
    is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' );
3020
    is( $itemcheck->holdingbranch, $library_1->{branchcode}, 'Lost item with cancelled hold has holding branch equallying the transfers source branch' );
3021
3022
};
3023
3024
subtest 'transferbook test' => sub {
3025
    plan tests => 5;
3026
3027
    my $library = $builder->build_object( { class => 'Koha::Libraries' } );
3028
    my $item = $builder->build_sample_item();
3029
    ok( $item->holdingbranch ne $library->branchcode && $item->homebranch ne $library->branchcode, "Item is not held or owned by library");
3030
    C4::Circulation::transferbook({
3031
        from_branch => $library->branchcode,
3032
        to_branch => $item->homebranch,
3033
        barcode   => $item->barcode,
3034
    });
3035
    my ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
3036
    is( $from_branch, $library->branchcode, 'The transfer is initiated from the specified branch, not the items home or holdingbranch');
3037
    is( $to_branch, $item->homebranch, 'The transfer is initiated to the specified branch');
3038
    C4::Circulation::transferbook({
3039
        from_branch => $item->homebranch,
3040
        to_branch => $library->branchcode,
3041
        barcode   => $item->barcode,
3042
    });
3043
    ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
3044
    is( $from_branch, $item->homebranch, 'The transfer is initiated from the specified branch');
3045
    is( $to_branch, $library->branchcode, 'The transfer is initiated to the specified branch');
3046
3021
};
3047
};
3022
3048
3023
subtest 'CanBookBeIssued | is_overdue' => sub {
3049
subtest 'CanBookBeIssued | is_overdue' => sub {
3024
- 

Return to bug 23695