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

(-)a/Koha/Object.pm (-2 / +7 lines)
Lines 106-113 sub _new_from_dbic { Link Here
106
    croak( "DBIC result _type " . ref( $self->{_result} ) . " isn't of the _type " . $class->_type() )
106
    croak( "DBIC result _type " . ref( $self->{_result} ) . " isn't of the _type " . $class->_type() )
107
      unless ref( $self->{_result} ) eq "Koha::Schema::Result::" . $class->_type();
107
      unless ref( $self->{_result} ) eq "Koha::Schema::Result::" . $class->_type();
108
108
109
    eval "require Koha::ObjectHooks";
109
    use Koha::ObjectHooks;
110
110
    my $ok = Koha::ObjectHooks->new();
111
    my @plugins = $ok->plugins();
112
    foreach my $plugin (@plugins) {
113
        $plugin->run();
114
    }
115
    
111
    bless( $self, $class );
116
    bless( $self, $class );
112
}
117
}
113
118
(-)a/Koha/ObjectHooks.pm (-6 / +9 lines)
Lines 1-10 Link Here
1
package Koha::ObjectHooks;
1
package Koha::ObjectHooks;
2
use Module::Pluggable search_path => ['Koha::ObjectHooks::Plugin'], 
3
                      require => 1;
2
4
3
use Hook::LexWrap;
5
sub new
4
6
  {
5
wrap 'Koha::Patron::fixup_cardnumber', post =>
7
    my $class = shift;
6
    sub { my ( $self ) = @_;
8
    my $self = bless {}, $class;
7
          $self->cardnumber( sprintf("LB%07d",  $self->cardnumber));
9
    return $self;
8
    };
10
  }
9
11
10
1;
12
1;
13
(-)a/Koha/ObjectHooks/Plugin/FixupCardnumber.pm (-1 / +12 lines)
Line 0 Link Here
0
- 
1
package Koha::ObjectHooks::Plugin::FixupCardnumber;
2
3
use Hook::LexWrap;
4
5
sub run {
6
    wrap 'Koha::Patron::fixup_cardnumber', post =>
7
        sub { my ( $self ) = @_;
8
            $self->cardnumber( sprintf("LB%07d",  $self->cardnumber));
9
    };
10
}
11
12
1;

Return to bug 28655