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

(-)a/Koha/Hold.pm (-8 / +14 lines)
Lines 860-865 sub cancel { Link Here
860
860
861
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
861
    my $autofill_next = $params->{autofill} && $self->itemnumber && $self->found && $self->found eq 'W';
862
862
863
    # Store hold data for plugin hook (before transaction)
864
    my $old_hold_data;
865
863
    my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
866
    my $original = C4::Context->preference('HoldsLog') ? $self->unblessed : undef;
864
867
865
    $self->_result->result_source->schema->txn_do(
868
    $self->_result->result_source->schema->txn_do(
Lines 916-928 sub cancel { Link Here
916
919
917
            my $old_me = $self->_move_to_old;
920
            my $old_me = $self->_move_to_old;
918
921
919
            Koha::Plugins->call(
922
            # Store data for plugin hook (to be called after transaction)
920
                'after_hold_action',
923
            $old_hold_data = $old_me->get_from_storage;
921
                {
922
                    action  => 'cancel',
923
                    payload => { hold => $old_me->get_from_storage }
924
                }
925
            );
926
924
927
            # anonymize if required
925
            # anonymize if required
928
            $old_me->anonymize
926
            $old_me->anonymize
Lines 966-971 sub cancel { Link Here
966
        }
964
        }
967
    );
965
    );
968
966
967
    # Call plugin hook AFTER transaction completes
968
    Koha::Plugins->call(
969
        'after_hold_action',
970
        {
971
            action  => 'cancel',
972
            payload => { hold => $old_hold_data }
973
        }
974
    );
975
969
    $self->cleanup_hold_group() unless $params->{skip_hold_group_cleanup};
976
    $self->cleanup_hold_group() unless $params->{skip_hold_group_cleanup};
970
977
971
    if ($autofill_next) {
978
    if ($autofill_next) {
972
- 

Return to bug 41603