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

(-)a/t/db_dependent/Circulation/OfflineCirculation.t (-10 / +52 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::NoWarnings;
20
use Test::NoWarnings;
21
use Test::More tests => 3;
21
use Test::More tests => 4;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
24
Lines 85-102 subtest "Bug 34529: Offline circulation should be able to accept userid as well Link Here
85
        }
85
        }
86
    );
86
    );
87
87
88
    my ( $message, $checkout ) = ProcessOfflineIssue(
89
        {
90
            cardnumber => $borrower1->{cardnumber},
91
            barcode    => $item1->barcode
92
        }
93
    );
94
88
    is(
95
    is(
89
        ProcessOfflineIssue(
96
        $message, "Success.",
90
            {
91
                cardnumber => $borrower1->{cardnumber},
92
                barcode    => $item1->barcode
93
            }
94
        ),
95
        "Success.",
96
        "ProcessOfflineIssue succeeds with cardnumber"
97
        "ProcessOfflineIssue succeeds with cardnumber"
97
    );
98
    );
99
100
    ( $message, $checkout ) = ProcessOfflineIssue( { cardnumber => $borrower1->{userid}, barcode => $item2->barcode } );
98
    is(
101
    is(
99
        ProcessOfflineIssue( { cardnumber => $borrower1->{userid}, barcode => $item2->barcode } ),
102
        $message,
100
        "Success.",
103
        "Success.",
101
        "ProcessOfflineIssue succeeds with user id"
104
        "ProcessOfflineIssue succeeds with user id"
102
    );
105
    );
Lines 192-200 subtest "Bug 30114 - Koha offline circulation will always cancel the next hold w Link Here
192
195
193
    my $op = GetOfflineOperation( $offline_rs->next->id );
196
    my $op = GetOfflineOperation( $offline_rs->next->id );
194
197
195
    my $ret = ProcessOfflineOperation($op);
198
    my ($ret) = ProcessOfflineOperation($op);
196
199
197
    is( Koha::Holds->search( { biblionumber => $biblionumber } )->count, 2, "Still found two holds for the record" );
200
    is( Koha::Holds->search( { biblionumber => $biblionumber } )->count, 2, "Still found two holds for the record" );
198
};
201
};
199
202
203
subtest "Bug 32934: ProcessOfflineIssue returns checkout object for SIP no block due date" => sub {
204
    plan tests => 4;
205
206
    $branch     = $builder->build( { source => 'Branch' } )->{branchcode};
207
    $manager_id = $builder->build( { source => 'Borrower' } )->{borrowernumber};
208
209
    my $borrower = $builder->build(
210
        {
211
            source => 'Borrower',
212
            value  => { branchcode => $branch }
213
        }
214
    );
215
216
    my $biblio = $builder->build_sample_biblio;
217
    my $item   = $builder->build_sample_item(
218
        {
219
            biblionumber => $biblio->id,
220
            library      => $branch,
221
        }
222
    );
223
224
    my $due_date = dt_from_string->add( days => 7 )->ymd;
225
226
    # Test ProcessOfflineIssue returns both message and checkout object
227
    my ( $message, $checkout ) = ProcessOfflineIssue(
228
        {
229
            cardnumber => $borrower->{cardnumber},
230
            barcode    => $item->barcode,
231
            due_date   => $due_date,
232
            timestamp  => dt_from_string
233
        }
234
    );
235
236
    is( $message, "Success.", "ProcessOfflineIssue returns success message" );
237
    isa_ok( $checkout, 'Koha::Checkout', "ProcessOfflineIssue returns checkout object" );
238
    is( $checkout->borrowernumber,                  $borrower->{borrowernumber}, "Checkout has correct borrower" );
239
    is( dt_from_string( $checkout->date_due )->ymd, $due_date, "Checkout respects specified due_date" );
240
};
241
200
$schema->storage->txn_rollback;
242
$schema->storage->txn_rollback;
(-)a/t/db_dependent/SIP/Transaction.t (-2 / +20 lines)
Lines 983-989 subtest do_checkout_with_patron_blocked => sub { Link Here
983
};
983
};
984
984
985
subtest do_checkout_with_noblock => sub {
985
subtest do_checkout_with_noblock => sub {
986
    plan tests => 1;
986
    plan tests => 3;
987
987
988
    my $mockILS = Test::MockObject->new;
988
    my $mockILS = Test::MockObject->new;
989
    my $server  = { ils => $mockILS };
989
    my $server  = { ils => $mockILS };
Lines 1033-1038 subtest do_checkout_with_noblock => sub { Link Here
1033
        $patron->checkouts->count,
1033
        $patron->checkouts->count,
1034
        1, 'No Block checkout was performed for debarred patron'
1034
        1, 'No Block checkout was performed for debarred patron'
1035
    );
1035
    );
1036
1037
    # Test Bug 32934: SIP checkout with no_block_due_date should honor the specified due date
1038
    $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
1039
    my $sip_item_2  = C4::SIP::ILS::Item->new( $item->barcode );
1040
    my $transaction = C4::SIP::ILS::Transaction::Checkout->new();
1041
1042
    $transaction->patron($sip_patron);
1043
    $transaction->item($sip_item_2);
1044
1045
    # Set no_block_due_date to test the fix (YYYYMMDDZZZZHHMMSS)
1046
    my $expected_due_date = '20250115    000000';
1047
    my $checkout_result   = $transaction->do_checkout( undef, $expected_due_date );
1048
1049
    my $checkout_obj = $patron->checkouts->find( { itemnumber => $item->itemnumber } );
1050
    isnt( $checkout_obj, undef, 'Checkout object exists after no block checkout' );
1051
    like(
1052
        dt_from_string( $checkout_obj->date_due )->ymd(''), qr/^20250115/,
1053
        'No block due date is honored in SIP checkout'
1054
    );
1036
};
1055
};
1037
1056
1038
subtest do_checkout_with_holds => sub {
1057
subtest do_checkout_with_holds => sub {
1039
- 

Return to bug 32934