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

(-)a/C4/Items.pm (-34 lines)
Lines 2523-2560 sub ToggleNewStatus { Link Here
2523
    return $report;
2523
    return $report;
2524
}
2524
}
2525
2525
2526
=head2 _after_item_action_hooks
2527
2528
Helper method that takes care of calling all plugin hooks
2529
2530
=cut
2531
2532
sub _after_item_action_hooks {
2533
    my ( $args ) = @_;
2534
2535
    my $item_id = $args->{item_id};
2536
    my $action  = $args->{action};
2537
2538
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
2539
2540
        my @plugins = Koha::Plugins->new->GetPlugins({
2541
            method => 'after_item_action',
2542
        });
2543
2544
        if (@plugins) {
2545
2546
            my $item = Koha::Items->find( $item_id );
2547
2548
            foreach my $plugin ( @plugins ) {
2549
                try {
2550
                    $plugin->after_item_action({ action => $action, item => $item, item_id => $item_id });
2551
                }
2552
                catch {
2553
                    warn "$_";
2554
                };
2555
            }
2556
        }
2557
    }
2558
}
2559
2560
1;
2526
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::IssuingRules; 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 648-653 sub to_api_mapping { Link Here
648
649
649
=head2 Internal methods
650
=head2 Internal methods
650
651
652
=head3 _after_item_action_hooks
653
654
Helper method that takes care of calling all plugin hooks
655
656
=cut
657
658
sub _after_item_action_hooks {
659
    my ( $self, $params ) = @_;
660
661
    my $action = $params->{action};
662
663
    if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) {
664
665
        my @plugins = Koha::Plugins->new->GetPlugins({
666
            method => 'after_item_action',
667
        });
668
669
        if (@plugins) {
670
671
            foreach my $plugin ( @plugins ) {
672
                try {
673
                    $plugin->after_item_action({ action => $action, item => $self, item_id => $self->itemnumber });
674
                }
675
                catch {
676
                    warn "$_";
677
                };
678
            }
679
        }
680
    }
681
}
682
651
=head3 _type
683
=head3 _type
652
684
653
=cut
685
=cut
654
- 

Return to bug 23463