1 package FS::part_event::Action::addtag;
4 use base qw( FS::part_event::Action );
5 use FS::Record qw( qsearch );
7 sub description { 'Add customer tag'; }
9 sub eventtable_hashref {
14 'cust_pay_batch' => 1,
15 'cust_statement' => 1,
21 'tagnum' => { 'label' => 'Customer tag',
22 'type' => 'select-cust_tag',
28 sub default_weight { 21; }
31 my( $self, $object, $tagnum ) = @_;
33 my %exists = map { $_->tagnum => $_->tagnum }
36 hashref => { custnum => $object->custnum, },
39 my @tags = split(/\,/, $self->option('tagnum'));
40 foreach my $tagnum ( split(/\,/, $self->option('tagnum') ) ) {
41 if ( !$exists{$tagnum} ) {
42 my $cust_tag = new FS::cust_tag { 'tagnum' => $tagnum,
43 'custnum' => $object->custnum, };
44 my $error = $cust_tag->insert;