summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authormark <mark>2010-11-22 01:30:09 +0000
committermark <mark>2010-11-22 01:30:09 +0000
commitade306224dbc1cb5ec8af4d1cc6b838315465a97 (patch)
tree4ccf84b2d9278e99413a429a6848d9978780b04e /FS
parentf1dbc8663ccc99a1ee592d498a3eb976124fb1ad (diff)
pkg_cancel event action, RT#10141
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_event/Action/cancel.pm2
-rw-r--r--FS/FS/part_event/Action/pkg_cancel.pm32
2 files changed, 33 insertions, 1 deletions
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;