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

(-)a/Koha/Plugins.pm (+3 lines)
Lines 78-83 sub call { Link Here
78
    if (C4::Context->config('enable_plugins')) {
78
    if (C4::Context->config('enable_plugins')) {
79
        my @plugins = $class->new({ enable_plugins => 1 })->GetPlugins({ method => $method });
79
        my @plugins = $class->new({ enable_plugins => 1 })->GetPlugins({ method => $method });
80
        @plugins = grep { $_->can($method) } @plugins;
80
        @plugins = grep { $_->can($method) } @plugins;
81
        # TODO: Remove warn when after_hold_create is removed from the codebase
82
        warn "after_hold_create is deprecated and will be removed soon. Contact the following plugin's authors: " . join( ', ', map {$_->{metadata}->{name}} @plugins)
83
            if $method eq 'after_hold_create' and @plugins;
81
        foreach my $plugin (@plugins) {
84
        foreach my $plugin (@plugins) {
82
            my $response = eval { $plugin->$method(@args) };
85
            my $response = eval { $plugin->$method(@args) };
83
            if ($@) {
86
            if ($@) {
(-)a/t/db_dependent/Koha/Plugins/Holds_hooks.t (-6 / +6 lines)
Lines 72-83 subtest 'after_hold_create() hook tests' => sub { Link Here
72
    my $biblio = $builder->build_sample_biblio();
72
    my $biblio = $builder->build_sample_biblio();
73
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
73
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
74
74
75
    warning_like { AddReserve({
75
    warnings_like { AddReserve({
76
                        branchcode     => $patron->branchcode,
76
                        branchcode     => $patron->branchcode,
77
                        borrowernumber => $patron->borrowernumber,
77
                        borrowernumber => $patron->borrowernumber,
78
                        biblionumber   => $item_1->biblionumber }); }
78
                        biblionumber   => $item_1->biblionumber }); }
79
        qr/after_hold_create called with parameter Koha::Hold/,
79
        [ qr/after_hold_create is deprecated and will be removed soon/,
80
          'AddReserve calls the after_hold_create hook';
80
          qr/after_hold_create called with parameter Koha::Hold/ ],
81
          'AddReserve calls the after_hold_create hook, deprecation warning found';
81
82
82
    $schema->storage->txn_rollback;
83
    $schema->storage->txn_rollback;
83
    Koha::Plugins::Methods->delete;
84
    Koha::Plugins::Methods->delete;
Lines 113-119 subtest 'after_hold_action (placed) hook tests' => sub { Link Here
113
    my $biblio = $builder->build_sample_biblio();
114
    my $biblio = $builder->build_sample_biblio();
114
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
115
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
115
116
116
    warning_like {
117
    warnings_like {
117
        AddReserve(
118
        AddReserve(
118
            {   branchcode     => $patron->branchcode,
119
            {   branchcode     => $patron->branchcode,
119
                borrowernumber => $patron->borrowernumber,
120
                borrowernumber => $patron->borrowernumber,
Lines 121-127 subtest 'after_hold_action (placed) hook tests' => sub { Link Here
121
            }
122
            }
122
        );
123
        );
123
    }
124
    }
124
    qr/after_hold_action called with action: place, ref: Koha::Hold/, 'AddReserve calls the after_hold_action hook';
125
    [ qr/after_hold_create is deprecated and will be removed soon/, qr/after_hold_action called with action: place, ref: Koha::Hold/,  ], 'AddReserve calls the after_hold_action hook';
125
126
126
    $schema->storage->txn_rollback;
127
    $schema->storage->txn_rollback;
127
    Koha::Plugins::Methods->delete;
128
    Koha::Plugins::Methods->delete;
128
- 

Return to bug 30180