From ade306224dbc1cb5ec8af4d1cc6b838315465a97 Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 22 Nov 2010 01:30:09 +0000 Subject: [PATCH] pkg_cancel event action, RT#10141 --- FS/FS/part_event/Action/cancel.pm | 2 +- FS/FS/part_event/Action/pkg_cancel.pm | 32 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 FS/FS/part_event/Action/pkg_cancel.pm diff --git a/FS/FS/part_event/Action/cancel.pm b/FS/FS/part_event/Action/cancel.pm index b9d6d2996..b93682b54 100644 --- a/FS/FS/part_event/Action/cancel.pm +++ b/FS/FS/part_event/Action/cancel.pm @@ -3,7 +3,7 @@ package FS::part_event::Action::cancel; use strict; use base qw( FS::part_event::Action ); -sub description { 'Cancel'; } +sub description { 'Cancel all of this customer\'s packages'; } sub option_fields { ( diff --git a/FS/FS/part_event/Action/pkg_cancel.pm b/FS/FS/part_event/Action/pkg_cancel.pm new file mode 100644 index 000000000..2bfd35cad --- /dev/null +++ b/FS/FS/part_event/Action/pkg_cancel.pm @@ -0,0 +1,32 @@ +package FS::part_event::Action::pkg_cancel; + +use strict; +use base qw( FS::part_event::Action ); + +sub description { 'Cancel this package'; } + +sub eventtable_hashref { + { 'cust_pkg' => 1 }; +} + +sub option_fields { + ( + 'reasonnum' => { 'label' => 'Reason', + 'type' => 'select-reason', + 'reason_class' => 'C', + }, + ); +} + +sub default_weight { 20; } + +sub do_action { + my( $self, $cust_pkg, $cust_event ) = @_; + + my $error = $cust_pkg->cancel( 'reason' => $self->option('reasonnum') ); + die $error if $error; + + ''; +} + +1; -- 2.20.1