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 77-82 Link Here
77
             prevcheckout_block_checkout="0"
77
             prevcheckout_block_checkout="0"
78
             overdues_block_checkout="1"
78
             overdues_block_checkout="1"
79
             show_outstanding_amount="1"
79
             show_outstanding_amount="1"
80
             show_checkin_message="0"
80
             format_due_date="0"
81
             format_due_date="0"
81
             inhouse_item_types=""
82
             inhouse_item_types=""
82
             inhouse_patron_categories=""
83
             inhouse_patron_categories=""
(-)a/t/db_dependent/SIP/Transaction.t (-2 / +55 lines)
Lines 347-353 subtest "Placing holds via SIP check CanItemBeReserved" => sub { Link Here
347
};
347
};
348
348
349
subtest do_checkin => sub {
349
subtest do_checkin => sub {
350
    plan tests => 13;
350
    plan tests => 14;
351
351
352
    my $mockILS  = Test::MockObject->new;
352
    my $mockILS  = Test::MockObject->new;
353
    my $server   = { ils => $mockILS };
353
    my $server   = { ils => $mockILS };
Lines 463-468 subtest do_checkin => sub { Link Here
463
        is( Koha::Checkouts->search( { itemnumber => $item->itemnumber } )->count, 0, );
463
        is( Koha::Checkouts->search( { itemnumber => $item->itemnumber } )->count, 0, );
464
    };
464
    };
465
465
466
    subtest 'Checkin message' => sub {
467
        plan tests => 3;
468
        my $mockILS = Test::MockObject->new;
469
        my $server = { ils => $mockILS };
470
        my $library = $builder->build_object({ class => 'Koha::Libraries' });
471
        my $patron = $builder->build_object({ class => 'Koha::Patrons' });
472
        my $homebranch = $builder->build(
473
            {
474
                source => 'Branch',
475
                value  => {
476
                    branchcode => 'HMBR',
477
                    branchname => 'Homebranch'
478
                }
479
            }
480
        );
481
482
        my $institution = {
483
            id             => $library->id,
484
            implementation => "ILS",
485
            policy         => {
486
                checkin  => "true",
487
                renewal  => "true",
488
                checkout => "true",
489
                timeout  => 100,
490
                retries  => 5,
491
            }
492
        };
493
        my $ils = C4::SIP::ILS->new($institution);
494
        my $item = $builder->build_sample_item(
495
            {
496
                library => $library->branchcode,
497
                homebranch => $homebranch->{'branchcode'},
498
                location => 'My Location',
499
                permanent_location => 'My Permanent Location',
500
            }
501
        );
502
        my $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account});
503
        $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} );
504
        is( $circ->{screen_msg}, '', "Checkin message is not displayed when show_checkin_message is disabled" );
505
506
        $server->{account}->{show_checkin_message} = 1;
507
508
        $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account});
509
        $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} );
510
        is( $circ->{screen_msg}, 'Item checked-in: Homebranch - My Location.', "Checkin message when show_checkin_message is enabled and UseLocationAsAQInSIP is disabled" );
511
512
        t::lib::Mocks::mock_preference( 'UseLocationAsAQInSIP', '1' );
513
514
        $circ = $ils->checkout($patron->cardnumber, $item->barcode, undef, undef, $server->{account});
515
        $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp, undef, $library->branchcode, undef, undef, $server->{account} );
516
        is( $circ->{screen_msg}, 'Item checked-in: My Permanent Location - My Location.', "Checkin message when both show_checkin_message and UseLocationAsAQInSIP are enabled" );
517
518
    };
519
466
    subtest 'Checkin with fines' => sub {
520
    subtest 'Checkin with fines' => sub {
467
        plan tests => 2;
521
        plan tests => 2;
468
522
469
- 

Return to bug 25814