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

(-)a/C4/Items.pm (-34 lines)
Lines 2520-2557 sub ToggleNewStatus { Link Here
2520
    return $report;
2520
    return $report;
2521
}
2521
}
2522
2522
2523
=head2 _after_item_action_hooks
2524
2525
Helper method that takes care of calling all plugin hooks
2526
2527
=cut
2528
2529
sub _after_item_action_hooks {
2530
    my ( $args ) = @_;
2531
2532
    my $item_id = $args->{item_id};
2533
    my $action  = $args->{action};
2534
2535
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
2536
2537
        my @plugins = Koha::Plugins->new->GetPlugins({
2538
            method => 'after_item_action',
2539
        });
2540
2541
        if (@plugins) {
2542
2543
            my $item = Koha::Items->find( $item_id );
2544
2545
            foreach my $plugin ( @plugins ) {
2546
                try {
2547
                    $plugin->after_item_action({ action => $action, item => $item, item_id => $item_id });
2548
                }
2549
                catch {
2550
                    warn "$_";
2551
                };
2552
            }
2553
        }
2554
    }
2555
}
2556
2557
1;
2523
1;
(-)a/Koha/Item.pm (-2 / +33 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use Carp;
22
use Carp;
23
use List::MoreUtils qw(any);
23
use List::MoreUtils qw(any);
24
use Data::Dumper;
24
use Data::Dumper;
25
use Try::Tiny;
25
26
26
use Koha::Database;
27
use Koha::Database;
27
use Koha::DateUtils qw( dt_from_string );
28
use Koha::DateUtils qw( dt_from_string );
Lines 36-41 use Koha::IssuingRules; Link Here
36
use Koha::Item::Transfer::Limits;
37
use Koha::Item::Transfer::Limits;
37
use Koha::Item::Transfers;
38
use Koha::Item::Transfers;
38
use Koha::Patrons;
39
use Koha::Patrons;
40
use Koha::Plugins;
39
use Koha::Libraries;
41
use Koha::Libraries;
40
use Koha::StockRotationItem;
42
use Koha::StockRotationItem;
41
use Koha::StockRotationRotas;
43
use Koha::StockRotationRotas;
Lines 143-149 sub store { Link Here
143
145
144
        logaction( "CATALOGUING", "MODIFY", $self->itemnumber, "item " . Dumper($self->unblessed) )
146
        logaction( "CATALOGUING", "MODIFY", $self->itemnumber, "item " . Dumper($self->unblessed) )
145
          if $log_action && C4::Context->preference("CataloguingLog");
147
          if $log_action && C4::Context->preference("CataloguingLog");
146
147
    }
148
    }
148
149
149
    unless ( $self->dateaccessioned ) {
150
    unless ( $self->dateaccessioned ) {
Lines 592-597 sub to_api_mapping { Link Here
592
593
593
=head2 Internal methods
594
=head2 Internal methods
594
595
596
=head3 _after_item_action_hooks
597
598
Helper method that takes care of calling all plugin hooks
599
600
=cut
601
602
sub _after_item_action_hooks {
603
    my ( $self, $params ) = @_;
604
605
    my $action = $params->{action};
606
607
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
608
609
        my @plugins = Koha::Plugins->new->GetPlugins({
610
            method => 'after_item_action',
611
        });
612
613
        if (@plugins) {
614
615
            foreach my $plugin ( @plugins ) {
616
                try {
617
                    $plugin->after_item_action({ action => $action, item => $self, item_id => $self->itemnumber });
618
                }
619
                catch {
620
                    warn "$_";
621
                };
622
            }
623
        }
624
    }
625
}
626
595
=head3 _type
627
=head3 _type
596
628
597
=cut
629
=cut
598
- 

Return to bug 23463