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

(-)a/C4/Items.pm (-34 lines)
Lines 2526-2563 sub ToggleNewStatus { Link Here
2526
    return $report;
2526
    return $report;
2527
}
2527
}
2528
2528
2529
=head2 _after_item_action_hooks
2530
2531
Helper method that takes care of calling all plugin hooks
2532
2533
=cut
2534
2535
sub _after_item_action_hooks {
2536
    my ( $args ) = @_;
2537
2538
    my $item_id = $args->{item_id};
2539
    my $action  = $args->{action};
2540
2541
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
2542
2543
        my @plugins = Koha::Plugins->new->GetPlugins({
2544
            method => 'after_item_action',
2545
        });
2546
2547
        if (@plugins) {
2548
2549
            my $item = Koha::Items->find( $item_id );
2550
2551
            foreach my $plugin ( @plugins ) {
2552
                try {
2553
                    $plugin->after_item_action({ action => $action, item => $item, item_id => $item_id });
2554
                }
2555
                catch {
2556
                    warn "$_";
2557
                };
2558
            }
2559
        }
2560
    }
2561
}
2562
2563
1;
2529
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 38-43 use Koha::CirculationRules; Link Here
38
use Koha::Item::Transfer::Limits;
39
use Koha::Item::Transfer::Limits;
39
use Koha::Item::Transfers;
40
use Koha::Item::Transfers;
40
use Koha::Patrons;
41
use Koha::Patrons;
42
use Koha::Plugins;
41
use Koha::Libraries;
43
use Koha::Libraries;
42
use Koha::StockRotationItem;
44
use Koha::StockRotationItem;
43
use Koha::StockRotationRotas;
45
use Koha::StockRotationRotas;
Lines 145-151 sub store { Link Here
145
147
146
        logaction( "CATALOGUING", "MODIFY", $self->itemnumber, "item " . Dumper($self->unblessed) )
148
        logaction( "CATALOGUING", "MODIFY", $self->itemnumber, "item " . Dumper($self->unblessed) )
147
          if $log_action && C4::Context->preference("CataloguingLog");
149
          if $log_action && C4::Context->preference("CataloguingLog");
148
149
    }
150
    }
150
151
151
    unless ( $self->dateaccessioned ) {
152
    unless ( $self->dateaccessioned ) {
Lines 655-660 sub to_api_mapping { Link Here
655
656
656
=head2 Internal methods
657
=head2 Internal methods
657
658
659
=head3 _after_item_action_hooks
660
661
Helper method that takes care of calling all plugin hooks
662
663
=cut
664
665
sub _after_item_action_hooks {
666
    my ( $self, $params ) = @_;
667
668
    my $action = $params->{action};
669
670
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
671
672
        my @plugins = Koha::Plugins->new->GetPlugins({
673
            method => 'after_item_action',
674
        });
675
676
        if (@plugins) {
677
678
            foreach my $plugin ( @plugins ) {
679
                try {
680
                    $plugin->after_item_action({ action => $action, item => $self, item_id => $self->itemnumber });
681
                }
682
                catch {
683
                    warn "$_";
684
                };
685
            }
686
        }
687
    }
688
}
689
658
=head3 _type
690
=head3 _type
659
691
660
=cut
692
=cut
661
- 

Return to bug 23463