Lines 917-923
subtest 'pickup_locations() tests' => sub {
Link Here
|
917 |
|
917 |
|
918 |
subtest 'edit() tests' => sub { |
918 |
subtest 'edit() tests' => sub { |
919 |
|
919 |
|
920 |
plan tests => 39; |
920 |
plan tests => 47; |
921 |
|
921 |
|
922 |
$schema->storage->txn_begin; |
922 |
$schema->storage->txn_begin; |
923 |
|
923 |
|
Lines 968-977
subtest 'edit() tests' => sub {
Link Here
|
968 |
{ |
968 |
{ |
969 |
class => "Koha::Holds", |
969 |
class => "Koha::Holds", |
970 |
value => { |
970 |
value => { |
971 |
biblionumber => $biblio->biblionumber, |
971 |
biblionumber => $biblio->biblionumber, |
972 |
branchcode => $library_3->branchcode, |
972 |
branchcode => $library_3->branchcode, |
973 |
itemnumber => undef, |
973 |
itemnumber => undef, |
974 |
priority => 1, |
974 |
priority => 1, |
|
|
975 |
reservedate => '2022-01-01', |
976 |
expirationdate => '2022-03-01' |
975 |
} |
977 |
} |
976 |
} |
978 |
} |
977 |
); |
979 |
); |
Lines 1026-1042
subtest 'edit() tests' => sub {
Link Here
|
1026 |
$biblio_hold->discard_changes; |
1028 |
$biblio_hold->discard_changes; |
1027 |
is( $biblio_hold->branchcode, $library_2->id, 'Pickup location changed correctly' ); |
1029 |
is( $biblio_hold->branchcode, $library_2->id, 'Pickup location changed correctly' ); |
1028 |
|
1030 |
|
|
|
1031 |
$biblio_hold_data = { |
1032 |
hold_date => '2022-01-02', |
1033 |
expiration_date => '2022-03-02' |
1034 |
}; |
1035 |
|
1036 |
$t->patch_ok( "//$userid:$password@/api/v1/holds/" . $biblio_hold->id => json => $biblio_hold_data ) |
1037 |
->status_is(200); |
1038 |
|
1039 |
$biblio_hold->discard_changes; |
1040 |
is( $biblio_hold->reservedate, '2022-01-02', 'Hold date changed correctly' ); |
1041 |
is( $biblio_hold->expirationdate, '2022-03-02', 'Expiration date changed correctly' ); |
1042 |
|
1043 |
|
1029 |
# Test item-level holds |
1044 |
# Test item-level holds |
1030 |
my $item_hold = $builder->build_object( |
1045 |
my $item_hold = $builder->build_object( |
1031 |
{ |
1046 |
{ |
1032 |
class => "Koha::Holds", |
1047 |
class => "Koha::Holds", |
1033 |
value => { |
1048 |
value => { |
1034 |
biblionumber => $biblio->biblionumber, |
1049 |
biblionumber => $biblio->biblionumber, |
1035 |
branchcode => $library_3->branchcode, |
1050 |
branchcode => $library_3->branchcode, |
1036 |
itemnumber => $item->itemnumber, |
1051 |
itemnumber => $item->itemnumber, |
1037 |
priority => 1, |
1052 |
priority => 1, |
1038 |
suspend => 0, |
1053 |
suspend => 0, |
1039 |
suspend_until => undef, |
1054 |
suspend_until => undef, |
|
|
1055 |
reservedate => '2022-01-01', |
1056 |
expirationdate => '2022-03-01' |
1040 |
} |
1057 |
} |
1041 |
} |
1058 |
} |
1042 |
); |
1059 |
); |
Lines 1091-1096
subtest 'edit() tests' => sub {
Link Here
|
1091 |
is( $item_hold->suspend, 0, 'Location change should not activate suspended status' ); |
1108 |
is( $item_hold->suspend, 0, 'Location change should not activate suspended status' ); |
1092 |
is( $item_hold->suspend_until, undef, 'Location change should keep suspended_until be undef' ); |
1109 |
is( $item_hold->suspend_until, undef, 'Location change should keep suspended_until be undef' ); |
1093 |
|
1110 |
|
|
|
1111 |
$item_hold_data = { |
1112 |
hold_date => '2022-01-02', |
1113 |
expiration_date => '2022-03-02' |
1114 |
}; |
1115 |
|
1116 |
$t->patch_ok( "//$userid:$password@/api/v1/holds/" . $item_hold->id => json => $item_hold_data )->status_is(200); |
1117 |
|
1118 |
$item_hold->discard_changes; |
1119 |
is( $item_hold->reservedate, '2022-01-02', 'Hold date changed correctly' ); |
1120 |
is( $item_hold->expirationdate, '2022-03-02', 'Expiration date changed correctly' ); |
1121 |
|
1094 |
$schema->storage->txn_rollback; |
1122 |
$schema->storage->txn_rollback; |
1095 |
|
1123 |
|
1096 |
}; |
1124 |
}; |
1097 |
- |
|
|