1 package FS::part_event::Action::removetag;
4 use base qw( FS::part_event::Action );
5 use FS::Record qw( qsearch );
7 sub description { 'Remove 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 # Get hashref of tags applied to selected customer record
34 my %cust_tag = map { $_->tagnum => $_ } qsearch({
36 hashref => { custnum => $object->custnum, },
39 # Remove tags chosen for this billing event from the customer record
40 foreach my $tagnum ( split(/\,/, $self->option('tagnum') ) ) {
41 if ( exists $cust_tag{$tagnum} ) {
42 my $error = $cust_tag{$tagnum}->delete;