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

(-)a/t/db_dependent/Circulation/transferbook.t (-9 / +19 lines)
Lines 38-48 subtest 'transfer a non-existant item' => sub { Link Here
38
    my $badbc = $item->barcode;
38
    my $badbc = $item->barcode;
39
    $item->delete;
39
    $item->delete;
40
40
41
    my $trigger = "Manual";
41
    my ( $dotransfer, $messages ) =
42
    my ( $dotransfer, $messages ) =
42
      C4::Circulation::transferbook({
43
      C4::Circulation::transferbook({
43
          from_branch => $item->homebranch,
44
          from_branch => $item->homebranch,
44
          to_branch => $library->{branchcode},
45
          to_branch => $library->{branchcode},
45
          barcode => $badbc
46
          barcode => $badbc,
47
          trigger => $trigger
46
      });
48
      });
47
    is( $dotransfer, 0, "Can't transfer a bad barcode" );
49
    is( $dotransfer, 0, "Can't transfer a bad barcode" );
48
    is_deeply(
50
    is_deeply(
Lines 120-126 subtest 'transfer already at destination' => sub { Link Here
120
    my ($dotransfer, $messages ) = transferbook({
122
    my ($dotransfer, $messages ) = transferbook({
121
        from_branch => $item->homebranch,
123
        from_branch => $item->homebranch,
122
        to_branch => $library->branchcode,
124
        to_branch => $library->branchcode,
123
        barcode => $item->barcode
125
        barcode => $item->barcode,
126
        trigger => "Manual"
124
    });
127
    });
125
    is( $dotransfer, 0, 'Transfer of item failed when destination equals holding branch' );
128
    is( $dotransfer, 0, 'Transfer of item failed when destination equals holding branch' );
126
    is_deeply(
129
    is_deeply(
Lines 142-148 subtest 'transfer already at destination' => sub { Link Here
142
    ($dotransfer, $messages ) = transferbook({
145
    ($dotransfer, $messages ) = transferbook({
143
        from_branch => $item->homebranch,
146
        from_branch => $item->homebranch,
144
        to_branch => $library->branchcode,
147
        to_branch => $library->branchcode,
145
        barcode => $item->barcode
148
        barcode => $item->barcode,
149
        trigger => "Manual"
146
    });
150
    });
147
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
151
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
148
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
152
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
Lines 177-183 subtest 'transfer an issued item' => sub { Link Here
177
    my ($dotransfer, $messages) = transferbook({
181
    my ($dotransfer, $messages) = transferbook({
178
        from_branch => $item->homebranch,
182
        from_branch => $item->homebranch,
179
        to_branch => $library->branchcode,
183
        to_branch => $library->branchcode,
180
        barcode => $item->barcode
184
        barcode => $item->barcode,
185
        trigger => "Manual"
181
    });
186
    });
182
    is( $messages->{WasReturned}, $patron->borrowernumber, 'transferbook should have return a WasReturned flag is the item was issued before the transferbook call');
187
    is( $messages->{WasReturned}, $patron->borrowernumber, 'transferbook should have return a WasReturned flag is the item was issued before the transferbook call');
183
188
Lines 197-203 subtest 'transfer an issued item' => sub { Link Here
197
    ($dotransfer, $messages ) = transferbook({
202
    ($dotransfer, $messages ) = transferbook({
198
        from_branch => $item->homebranch,
203
        from_branch => $item->homebranch,
199
        to_branch => $library->branchcode,
204
        to_branch => $library->branchcode,
200
        barcode => $item->barcode
205
        barcode => $item->barcode,
206
        trigger => "Manual"
201
    });
207
    });
202
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
208
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
203
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
209
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
Lines 236-242 subtest 'ignore_reserves flag' => sub { Link Here
236
    my ($dotransfer, $messages ) = transferbook({
242
    my ($dotransfer, $messages ) = transferbook({
237
        from_branch => $item->homebranch,
243
        from_branch => $item->homebranch,
238
        to_branch => $library->branchcode,
244
        to_branch => $library->branchcode,
239
        barcode => $item->barcode
245
        barcode => $item->barcode,
246
        trigger => "Manual"
240
    });
247
    });
241
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
248
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
242
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
249
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
Lines 247-253 subtest 'ignore_reserves flag' => sub { Link Here
247
        from_branch => $item->homebranch,
254
        from_branch => $item->homebranch,
248
        to_branch => $library->branchcode,
255
        to_branch => $library->branchcode,
249
        barcode => $item->barcode,
256
        barcode => $item->barcode,
250
        ignore_reserves => $ignore_reserves
257
        ignore_reserves => $ignore_reserves,
258
        trigger => "Manual"
251
    });
259
    });
252
    is( $dotransfer, 1, 'Transfer of reserved item succeeded with ignore reserves: false' );
260
    is( $dotransfer, 1, 'Transfer of reserved item succeeded with ignore reserves: false' );
253
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
261
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
Lines 258-264 subtest 'ignore_reserves flag' => sub { Link Here
258
        from_branch => $item->homebranch,
266
        from_branch => $item->homebranch,
259
        to_branch => $library->branchcode,
267
        to_branch => $library->branchcode,
260
        barcode => $item->barcode,
268
        barcode => $item->barcode,
261
        ignore_reserves => $ignore_reserves
269
        ignore_reserves => $ignore_reserves,
270
        trigger => "Manual"
262
    });
271
    });
263
    is( $dotransfer, 0, 'Transfer of reserved item failed with ignore reserves: true' );
272
    is( $dotransfer, 0, 'Transfer of reserved item failed with ignore reserves: true' );
264
    is_deeply(
273
    is_deeply(
Lines 280-285 subtest 'transferbook test from branch' => sub { Link Here
280
        from_branch => $library->branchcode,
289
        from_branch => $library->branchcode,
281
        to_branch => $item->homebranch,
290
        to_branch => $item->homebranch,
282
        barcode   => $item->barcode,
291
        barcode   => $item->barcode,
292
        trigger => "Manual"
283
    });
293
    });
284
    my ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
294
    my ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
285
    is( $from_branch, $library->branchcode, 'The transfer is initiated from the specified branch, not the items home or holdingbranch');
295
    is( $from_branch, $library->branchcode, 'The transfer is initiated from the specified branch, not the items home or holdingbranch');
Lines 288-293 subtest 'transferbook test from branch' => sub { Link Here
288
        from_branch => $item->homebranch,
298
        from_branch => $item->homebranch,
289
        to_branch => $library->branchcode,
299
        to_branch => $library->branchcode,
290
        barcode   => $item->barcode,
300
        barcode   => $item->barcode,
301
        trigger => "Manual"
291
    });
302
    });
292
    ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
303
    ($datesent,$from_branch,$to_branch) = GetTransfers($item->itemnumber);
293
    is( $from_branch, $item->homebranch, 'The transfer is initiated from the specified branch');
304
    is( $from_branch, $item->homebranch, 'The transfer is initiated from the specified branch');
294
- 

Return to bug 24446