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

(-)a/C4/SIP/ILS.pm (-1 / +16 lines)
Lines 262-267 sub checkin { Link Here
262
        delete $item->{borrowernumber};
262
        delete $item->{borrowernumber};
263
        delete $item->{due_date};
263
        delete $item->{due_date};
264
        $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
264
        $patron->{items} = [ grep { $_ ne $item_id } @{ $patron->{items} } ];
265
266
        my $message = '';
267
        if ($account->{show_checkin_message}) {
268
            my $permanent_location;
269
            if (C4::Context->preference("UseLocationAsAQInSIP")) {
270
                $permanent_location = $item->{'permanent_location'};
271
            } else {
272
                $permanent_location = Koha::Libraries->find($item->{permanent_location})->branchname;
273
            }
274
            $message .= "Item checked-in: " . $permanent_location . " - " . $item->{location} . ".";
275
        }
276
265
        # Check for overdue fines to display
277
        # Check for overdue fines to display
266
        if ($account->{show_outstanding_amount}) {
278
        if ($account->{show_outstanding_amount}) {
267
            my $kohaitem = Koha::Items->find( { barcode => $item_id } );
279
            my $kohaitem = Koha::Items->find( { barcode => $item_id } );
Lines 275-284 sub checkin { Link Here
275
                    },
287
                    },
276
                );
288
                );
277
                if ($charges) {
289
                if ($charges) {
278
                    $circ->screen_msg("You owe " . Koha::Number::Price->new( $charges->total_outstanding )->format({ with_symbol => 1}) . " for this item.");
290
                    $message .= "You owe " . Koha::Number::Price->new( $charges->total_outstanding )->format({ with_symbol => 1}) . " for this item.";
279
                }
291
                }
280
            }
292
            }
281
        }
293
        }
294
        if ($message) {
295
            $circ->screen_msg($message);
296
        }
282
    } else {
297
    } else {
283
        # Checkin failed: Wrongbranch or withdrawn?
298
        # Checkin failed: Wrongbranch or withdrawn?
284
        # Bug 10748 with pref BlockReturnOfLostItems adds another case to come
299
        # Bug 10748 with pref BlockReturnOfLostItems adds another case to come
(-)a/etc/SIPconfig.xml (+1 lines)
Lines 75-80 Link Here
75
             prevcheckout_block_checkout="0"
75
             prevcheckout_block_checkout="0"
76
             overdues_block_checkout="1"
76
             overdues_block_checkout="1"
77
             show_outstanding_amount="1"
77
             show_outstanding_amount="1"
78
             show_checkin_message="0"
78
             format_due_date="0"
79
             format_due_date="0"
79
             inhouse_item_types=""
80
             inhouse_item_types=""
80
             inhouse_patron_categories=""
81
             inhouse_patron_categories=""
(-)a/t/db_dependent/SIP/Transaction.t (-2 / +55 lines)
Lines 334-340 subtest "Placing holds via SIP check CanItemBeReserved" => sub { Link Here
334
};
334
};
335
335
336
subtest do_checkin => sub {
336
subtest do_checkin => sub {
337
    plan tests => 13;
337
    plan tests => 14;
338
338
339
    my $mockILS = Test::MockObject->new;
339
    my $mockILS = Test::MockObject->new;
340
    my $server = { ils => $mockILS };
340
    my $server = { ils => $mockILS };
Lines 440-445 subtest do_checkin => sub { Link Here
440
        is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, );
440
        is( Koha::Checkouts->search({itemnumber => $item->itemnumber})->count, 0, );
441
    };
441
    };
442
442
443
    subtest 'Checkin message' => sub {
444
        plan tests => 3;
445
        my $mockILS = Test::MockObject->new;
446
        my $server = { ils => $mockILS };
447
        my $library = $builder->build_object({ class => 'Koha::Libraries' });
448
        my $patron = $builder->build_object({ class => 'Koha::Patrons' });
449
        my $homebranch = $builder->build(
450
            {
451
                source => 'Branch',
452
                value  => {
453
                    branchcode => 'HMBR',
454
                    branchname => 'Homebranch'
455
                }
456
            }
457
        );
458
459
        my $institution = {
460
            id             => $library->id,
461
            implementation => "ILS",
462
            policy         => {
463
                checkin  => "true",
464
                renewal  => "true",
465
                checkout => "true",
466
                timeout  => 100,
467
                retries  => 5,
468
            }
469
        };
470
        my $ils = C4::SIP::ILS->new($institution);
471
        my $item = $builder->build_sample_item(
472
            {
473
                library => $library->branchcode,
474
                homebranch => $homebranch->{'branchcode'},
475
                location => 'My Location',
476
                permanent_location => 'My Permanent Location',
477
            }
478
        );
479
        my $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account});
480
        $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} );
481
        is( $circ->{screen_msg}, '', "Checkin message is not displayed when show_checkin_message is disabled" );
482
483
        $server->{account}->{show_checkin_message} = 1;
484
485
        $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account});
486
        $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} );
487
        is( $circ->{screen_msg}, 'Item checked-in: Homebranch - My Location.', "Checkin message when show_checkin_message is enabled and UseLocationAsAQInSIP is disabled" );
488
489
        t::lib::Mocks::mock_preference( 'UseLocationAsAQInSIP', '1' );
490
491
        $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account});
492
        $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} );
493
        is( $circ->{screen_msg}, 'Item checked-in: My Permanent Location - My Location.', "Checkin message when both show_checkin_message and UseLocationAsAQInSIP are enabled" );
494
495
    };
496
443
    subtest 'Checkin with fines' => sub {
497
    subtest 'Checkin with fines' => sub {
444
        plan tests => 2;
498
        plan tests => 2;
445
499
446
- 

Return to bug 25814