summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-04-11 21:42:52 +0000
committerivan <ivan>2009-04-11 21:42:52 +0000
commit8a79ead8b600494b214d7492dab043d5dfc96587 (patch)
tree7026a438043201c6e8a0ab736dbd0465afe82fd0 /FS
parentb4cb5e5d2d4faca16911e1992fbda8fa1528ed4e (diff)
migrate send_email, suspend_if_balance and credit events, RT#3905
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_event/Action/writeoff.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/FS/FS/part_event/Action/writeoff.pm b/FS/FS/part_event/Action/writeoff.pm
new file mode 100644
index 000000000..fdea897fa
--- /dev/null
+++ b/FS/FS/part_event/Action/writeoff.pm
@@ -0,0 +1,33 @@
+package FS::part_event::Action::writeoff;
+
+use strict;
+use base qw( FS::part_event::Action );
+
+sub description { 'Write off bad debt with a credit entry.'; }
+
+sub option_fields {
+ (
+ #'charge' => { label=>'Amount', type=>'money', }, # size=>7, },
+ 'reasonnum' => { 'label' => 'Reason',
+ 'type' => 'select-reason',
+ 'reason_class' => 'R',
+ },
+ );
+}
+
+sub default_weight { 65; }
+
+sub do_action {
+ my( $self, $cust_object ) = @_;
+
+ my $cust_main = $self->cust_main($cust_object);
+
+ my $error = $cust_main->credit( $cust_main->balance,
+ $self->option('reasonnum'),
+ );
+ die $error if $error;
+
+ '';
+}
+
+1;