|
Lines 711-717
subtest do_checkin => sub {
Link Here
|
| 711 |
}; |
711 |
}; |
| 712 |
|
712 |
|
| 713 |
subtest 'cancel_waiting_holds_with_cancellation_requests at checkin' => sub { |
713 |
subtest 'cancel_waiting_holds_with_cancellation_requests at checkin' => sub { |
| 714 |
plan tests => 5; |
714 |
plan tests => 6; |
| 715 |
|
715 |
|
| 716 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
716 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 717 |
my $patron1 = $builder->build_object( |
717 |
my $patron1 = $builder->build_object( |
|
Lines 758-763
subtest 'cancel_waiting_holds_with_cancellation_requests at checkin' => sub {
Link Here
|
| 758 |
'Hold has a cancellation request' |
758 |
'Hold has a cancellation request' |
| 759 |
); |
759 |
); |
| 760 |
|
760 |
|
|
|
761 |
#Create a HOLD_CANCELLATION notice |
| 762 |
my $template = Koha::Notice::Template->new( |
| 763 |
{ |
| 764 |
module => 'reserves', |
| 765 |
code => 'HOLD_CANCELLATION', |
| 766 |
branchcode => '', |
| 767 |
message_transport_type => 'email', |
| 768 |
title => 'Hold Cancellation', |
| 769 |
content => 'Your hold has been cancelled.', |
| 770 |
is_html => 0, |
| 771 |
} |
| 772 |
)->store; |
| 773 |
|
| 761 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
774 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
| 762 |
my $transaction = C4::SIP::ILS::Transaction::Checkin->new(); |
775 |
my $transaction = C4::SIP::ILS::Transaction::Checkin->new(); |
| 763 |
|
776 |
|
|
Lines 766-782
subtest 'cancel_waiting_holds_with_cancellation_requests at checkin' => sub {
Link Here
|
| 766 |
|
779 |
|
| 767 |
# Check if the hold still exists |
780 |
# Check if the hold still exists |
| 768 |
$hold_obj = Koha::Holds->find($hold); |
781 |
$hold_obj = Koha::Holds->find($hold); |
| 769 |
ok( !defined( $hold_obj ), 'Hold has been cancelled and deleted' ); |
782 |
ok( !defined($hold_obj), 'Hold has been cancelled and deleted' ); |
| 770 |
|
783 |
|
| 771 |
my $old_hold = Koha::Old::Holds->find($hold); |
784 |
my $old_hold = Koha::Old::Holds->find($hold); |
| 772 |
ok( $old_hold, 'Hold was moved to old reserves'); |
785 |
ok( $old_hold, 'Hold was moved to old reserves' ); |
| 773 |
# QUESTION: Should the cancellation reason be set to "Cancelled by SIP"? |
786 |
is( $old_hold->cancellation_reason, "Cancelled by SIP", 'Cancellation reason set to Cancelled by SIP' ); |
| 774 |
is( $old_hold->cancellation_reason, undef, 'No cancellation reason was set' ); |
787 |
|
| 775 |
|
788 |
#Check that the cancellation request is deleted |
| 776 |
# FIXME: What should happen to the cancellation request? |
789 |
my $existing_cancellation_requests = Koha::Hold::CancellationRequests->search( { hold_id => $hold } ); |
| 777 |
# Check that the cancellation request is deleted |
790 |
is( $existing_cancellation_requests->count, 0, 'Cancellation request is deleted after processing' ); |
| 778 |
# my $existing_cancellation_requests = Koha::Hold::CancellationRequests->search( { hold_id => $hold } ); |
|
|
| 779 |
# is( $existing_cancellation_requests->count, 0, 'Cancellation request is deleted after processing' ); |
| 780 |
|
791 |
|
| 781 |
# Verify the item's hold count |
792 |
# Verify the item's hold count |
| 782 |
is( $item->holds->count, 0, 'No holds remain on the item after cancellation' ); |
793 |
is( $item->holds->count, 0, 'No holds remain on the item after cancellation' ); |
| 783 |
- |
|
|