diff options
Diffstat (limited to 'FS/FS/part_event/Action')
37 files changed, 0 insertions, 1259 deletions
diff --git a/FS/FS/part_event/Action/Mixin/credit_pkg.pm b/FS/FS/part_event/Action/Mixin/credit_pkg.pm deleted file mode 100644 index aeda92f..0000000 --- a/FS/FS/part_event/Action/Mixin/credit_pkg.pm +++ /dev/null @@ -1,63 +0,0 @@ -package FS::part_event::Action::Mixin::credit_pkg; - -use strict; - -sub eventtable_hashref { - { 'cust_pkg' => 1 }; -} - -sub option_fields { - ( - 'reasonnum' => { 'label' => 'Credit reason', - 'type' => 'select-reason', - 'reason_class' => 'R', - }, - 'percent' => { 'label' => 'Percent', - 'type' => 'input-percentage', - 'default' => '100', - }, - 'what' => { 'label' => 'Of', - 'type' => 'select', - #add additional ways to specify in the package def - 'options' => [ qw( base_recur_permonth unit_setup recur_cost_permonth setup_cost ) ], - 'labels' => { 'base_recur_permonth' => 'Base monthly fee', - 'unit_setup' => 'Setup fee', - 'recur_cost_permonth' => 'Monthly cost', - 'setup_cost' => 'Setup cost', - }, - }, - ); - -} - -#my %no_cust_pkg = ( 'setup_cost' => 1 ); - -sub _calc_credit { - my( $self, $cust_pkg ) = @_; - - my $cust_main = $self->cust_main($cust_pkg); - - my $part_pkg = $cust_pkg->part_pkg; - - my $what = $self->option('what'); - - #false laziness w/Condition/cust_payments_pkg.pm - if ( $what =~ /_permonth$/ ) { #huh. yuck. - if ( $part_pkg->freq !~ /^\d+$/ ) { - die 'WARNING: Not crediting for package '. $cust_pkg->pkgnum. - ' ( customer '. $cust_pkg->custnum. ')'. - ' - credits not (yet) available for '. - ' packages with '. $part_pkg->freq_pretty. ' frequency'; - } - } - - my $percent = $self->option('percent'); - - #my @arg = $no_cust_pkg{$what} ? () : ($cust_pkg); - my @arg = ($what eq 'setup_cost') ? () : ($cust_pkg); - - sprintf('%.2f', $part_pkg->$what(@arg) * $percent / 100 ); - -} - -1; diff --git a/FS/FS/part_event/Action/addpost.pm b/FS/FS/part_event/Action/addpost.pm deleted file mode 100644 index f92e72e..0000000 --- a/FS/FS/part_event/Action/addpost.pm +++ /dev/null @@ -1,20 +0,0 @@ -package FS::part_event::Action::addpost; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Add postal invoicing'; } - -sub default_weight { 20; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - $cust_main->invoicing_list_addpost(); - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/apply.pm b/FS/FS/part_event/Action/apply.pm deleted file mode 100644 index 823d1e0..0000000 --- a/FS/FS/part_event/Action/apply.pm +++ /dev/null @@ -1,24 +0,0 @@ -package FS::part_event::Action::apply; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - 'Apply unapplied payments and credits'; -} - -sub deprecated { 1; } - -sub default_weight { 70; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - $cust_main->apply_payments_and_credits; - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/bill.pm b/FS/FS/part_event/Action/bill.pm deleted file mode 100644 index b96614d..0000000 --- a/FS/FS/part_event/Action/bill.pm +++ /dev/null @@ -1,26 +0,0 @@ -package FS::part_event::Action::bill; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - #'Generate invoices (normally only used with a <i>Late Fee</i> event)'; - 'Generate invoices (normally only used with a Late Fee event)'; -} - -sub deprecated { 1; } - -sub default_weight { 60; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - my $error = $cust_main->bill; - die $error if $error; - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/cancel.pm b/FS/FS/part_event/Action/cancel.pm deleted file mode 100644 index b93682b..0000000 --- a/FS/FS/part_event/Action/cancel.pm +++ /dev/null @@ -1,30 +0,0 @@ -package FS::part_event::Action::cancel; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Cancel all of this customer\'s packages'; } - -sub option_fields { - ( - 'reasonnum' => { 'label' => 'Reason', - 'type' => 'select-reason', - 'reason_class' => 'C', - }, - ); -} - -sub default_weight { 20; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - my $error = $cust_main->cancel( 'reason' => $self->option('reasonnum') ); - die $error if $error; - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/collect.pm b/FS/FS/part_event/Action/collect.pm deleted file mode 100644 index 9881440..0000000 --- a/FS/FS/part_event/Action/collect.pm +++ /dev/null @@ -1,26 +0,0 @@ -package FS::part_event::Action::collect; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - #'Collect on invoices (normally only used with a <i>Late Fee</i> and <i>Generate Invoice</i> events)'; - 'Collect on invoices (normally only used with a Late Fee and Generate Invoice events)'; -} - -sub deprecated { 1; } - -sub default_weight { 80; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - my $error = $cust_main->collect; - die $error if $error; - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_batch.pm b/FS/FS/part_event/Action/cust_bill_batch.pm deleted file mode 100644 index 50c306a..0000000 --- a/FS/FS/part_event/Action/cust_bill_batch.pm +++ /dev/null @@ -1,25 +0,0 @@ -package FS::part_event::Action::cust_bill_batch; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Add card or check to a pending batch'; } - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub default_weight { 40; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->batch_card; # ( %options ); #XXX options?? -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_comp.pm b/FS/FS/part_event/Action/cust_bill_comp.pm deleted file mode 100644 index 76fd274..0000000 --- a/FS/FS/part_event/Action/cust_bill_comp.pm +++ /dev/null @@ -1,28 +0,0 @@ -package FS::part_event::Action::cust_bill_comp; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Pay invoice with a complimentary "payment"'; } - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub default_weight { 30; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - my $error = $cust_bill->comp; - die $error if $error; - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_email.pm b/FS/FS/part_event/Action/cust_bill_email.pm deleted file mode 100644 index a5cd861..0000000 --- a/FS/FS/part_event/Action/cust_bill_email.pm +++ /dev/null @@ -1,23 +0,0 @@ -package FS::part_event::Action::cust_bill_email; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Send invoice (email only)'; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub default_weight { 51; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->email; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_fee_percent.pm b/FS/FS/part_event/Action/cust_bill_fee_percent.pm deleted file mode 100644 index 48daf15..0000000 --- a/FS/FS/part_event/Action/cust_bill_fee_percent.pm +++ /dev/null @@ -1,28 +0,0 @@ -package FS::part_event::Action::cust_bill_fee_percent; - -use strict; -use base qw( FS::part_event::Action::fee ); -use Tie::IxHash; - -sub description { 'Late fee (percentage of invoice)'; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - my $class = shift; - - my $t = tie my %option_fields, 'Tie::IxHash', $class->SUPER::option_fields(); - $t->Shift; #assumes charge is first - $t->Unshift( 'percent' => { label=>'Percent', size=>2, } ); - - %option_fields; -} - -sub _calc_fee { - my( $self, $cust_bill ) = @_; - sprintf('%.2f', $cust_bill->owed * $self->option('percent') / 100 ); -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_realtime_card.pm b/FS/FS/part_event/Action/cust_bill_realtime_card.pm deleted file mode 100644 index c1fdba9..0000000 --- a/FS/FS/part_event/Action/cust_bill_realtime_card.pm +++ /dev/null @@ -1,28 +0,0 @@ -package FS::part_event::Action::cust_bill_realtime_card; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - #'Run card with a <a href="http://420.am/business-onlinepayment/">Business::OnlinePayment</a> realtime gateway'; - 'Run card with a Business::OnlinePayment realtime gateway'; -} - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub default_weight { 30; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->realtime_card; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_realtime_check.pm b/FS/FS/part_event/Action/cust_bill_realtime_check.pm deleted file mode 100644 index 11b13a9..0000000 --- a/FS/FS/part_event/Action/cust_bill_realtime_check.pm +++ /dev/null @@ -1,28 +0,0 @@ -package FS::part_event::Action::cust_bill_realtime_check; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - #'Run check with a <a href="http://420.am/business-onlinepayment/">Business::OnlinePayment</a> realtime gateway'; - 'Run check with a Business::OnlinePayment realtime gateway'; -} - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub default_weight { 30; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->realtime_ach; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_realtime_lec.pm b/FS/FS/part_event/Action/cust_bill_realtime_lec.pm deleted file mode 100644 index cd03ddc..0000000 --- a/FS/FS/part_event/Action/cust_bill_realtime_lec.pm +++ /dev/null @@ -1,28 +0,0 @@ -package FS::part_event::Action::cust_bill_realtime_lec; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - #'Run phone bill ("LEC") billing with a <a href="http://420.am/business-onlinepayment/">Business::OnlinePayment</a> realtime gateway'; - 'Run phone bill ("LEC") billing with a Business::OnlinePayment realtime gateway'; -} - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub default_weight { 30; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->realtime_lec; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_send.pm b/FS/FS/part_event/Action/cust_bill_send.pm deleted file mode 100644 index 587a7c6..0000000 --- a/FS/FS/part_event/Action/cust_bill_send.pm +++ /dev/null @@ -1,20 +0,0 @@ -package FS::part_event::Action::cust_bill_send; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Send invoice (email/print/fax)'; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub default_weight { 50; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - $cust_bill->send; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_send_agent.pm b/FS/FS/part_event/Action/cust_bill_send_agent.pm deleted file mode 100644 index 670a32c..0000000 --- a/FS/FS/part_event/Action/cust_bill_send_agent.pm +++ /dev/null @@ -1,42 +0,0 @@ -package FS::part_event::Action::cust_bill_send_agent; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - 'Send invoice (email/print/fax) with alternate template, for specific agents'; -} - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - ( - 'agentnum' => { label => 'Only for agent(s)', - type => 'select-agent', - multiple => 1 - }, - 'agent_templatename' => { label => 'Template', - type => 'select-invoice_template', - }, - 'agent_invoice_from' => 'Invoice email From: address', - ); -} - -sub default_weight { 50; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->send( - $self->option('agent_templatename'), - [ split(/\s*,\s*/, $self->option('agentnum') ) ], - $self->option('agent_invoice_from'), - ); -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_send_alternate.pm b/FS/FS/part_event/Action/cust_bill_send_alternate.pm deleted file mode 100644 index cfd9264..0000000 --- a/FS/FS/part_event/Action/cust_bill_send_alternate.pm +++ /dev/null @@ -1,31 +0,0 @@ -package FS::part_event::Action::cust_bill_send_alternate; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Send invoice (email/print/fax) with alternate template'; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - ( - 'templatename' => { label => 'Template', - type => 'select-invoice_template', - }, - ); -} - -sub default_weight { 50; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->send( $self->option('templatename') ); -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm b/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm deleted file mode 100644 index bf47268..0000000 --- a/FS/FS/part_event/Action/cust_bill_send_csv_ftp.pm +++ /dev/null @@ -1,50 +0,0 @@ -package FS::part_event::Action::cust_bill_send_csv_ftp; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Upload CSV invoice data to an FTP server'; } - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - ( - 'ftpformat' => { label => 'Format', - type =>'select', - options => ['default', 'billco'], - option_labels => { 'default' => 'Default', - 'billco' => 'Billco', - }, - }, - 'ftpserver' => 'FTP server', - 'ftpusername' => 'FTP username', - 'ftppassword' => 'FTP password', - 'ftpdir' => 'FTP directory', - ); -} - -sub default_weight { 50; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->send_csv( - 'protocol' => 'ftp', - 'server' => $self->option('ftpserver'), - 'username' => $self->option('ftpusername'), - 'password' => $self->option('ftppassword'), - 'dir' => $self->option('ftpdir'), - 'format' => $self->option('ftpformat'), - ); - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_send_if_newest.pm b/FS/FS/part_event/Action/cust_bill_send_if_newest.pm deleted file mode 100644 index 083da8b..0000000 --- a/FS/FS/part_event/Action/cust_bill_send_if_newest.pm +++ /dev/null @@ -1,38 +0,0 @@ -package FS::part_event::Action::cust_bill_send_if_newest; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { - 'Send invoice (email/print/fax) with alternate template, if it is still the newest invoice (useful for late notices - set to 31 days or later)'; -} - -# XXX is this handled better by something against customers?? -#sub deprecated { -# 1; -#} - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - ( - 'if_newest_templatename' => { label => 'Template', - type => 'select-invoice_template', - }, - ); -} - -sub default_weight { 50; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->send( $self->option('templatename') ); -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_send_reminder.pm b/FS/FS/part_event/Action/cust_bill_send_reminder.pm deleted file mode 100644 index 2ba8136..0000000 --- a/FS/FS/part_event/Action/cust_bill_send_reminder.pm +++ /dev/null @@ -1,31 +0,0 @@ -package FS::part_event::Action::cust_bill_send_reminder; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Send invoice (email/print/fax) reminder'; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - ( - 'notice_name' => 'Reminder name', - #'notes' => { 'label' => 'Reminder notes' }, - #include standard notes? no/prepend/append - ); -} - -sub default_weight { 50; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - #my $cust_main = $cust_bill->cust_main; - - $cust_bill->send({ 'notice_name' => $self->option('notice_name') }); -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_spool_csv.pm b/FS/FS/part_event/Action/cust_bill_spool_csv.pm deleted file mode 100644 index 43d2300..0000000 --- a/FS/FS/part_event/Action/cust_bill_spool_csv.pm +++ /dev/null @@ -1,59 +0,0 @@ -package FS::part_event::Action::cust_bill_spool_csv; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Spool CSV invoice data'; } - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - ( - 'spoolformat' => { label => 'Format', - type => 'select', - options => ['default', 'billco'], - option_labels => { 'default' => 'Default', - 'billco' => 'Billco', - }, - }, - 'spooldest' => { label => 'For destination', - type => 'select', - options => [ '', qw( POST EMAIL FAX ) ], - option_labels => { '' => '(all)', - 'POST' => 'Postal Mail', - 'EMAIL' => 'Email', - 'FAX' => 'Fax', - }, - }, - 'spoolbalanceover' => { label => - 'If balance (this invoice and previous) over', - type => 'money', - }, - 'spoolagent_spools' => { label => 'Individual per-agent spools', - type => 'checkbox', - value => '1', - }, - ); -} - -sub default_weight { 50; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - $cust_bill->spool_csv( - 'format' => $self->option('spoolformat'), - 'dest' => $self->option('spooldest'), - 'balanceover' => $self->option('spoolbalanceover'), - 'agent_spools' => $self->option('spoolagent_spools'), - ); -} - -1; diff --git a/FS/FS/part_event/Action/cust_bill_suspend_if_balance.pm b/FS/FS/part_event/Action/cust_bill_suspend_if_balance.pm deleted file mode 100644 index 13188ab..0000000 --- a/FS/FS/part_event/Action/cust_bill_suspend_if_balance.pm +++ /dev/null @@ -1,42 +0,0 @@ -package FS::part_event::Action::cust_bill_suspend_if_balance; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Suspend if balance (this invoice and previous) over'; } - -sub deprecated { 1; } - -sub eventtable_hashref { - { 'cust_bill' => 1 }; -} - -sub option_fields { - ( - 'balanceover' => { label=>'Balance over', type=>'money', }, # size=>7 }, - 'reasonnum' => { 'label' => 'Reason', - 'type' => 'select-reason', - 'reason_class' => 'S', - }, - ); -} - -sub default_weight { 10; } - -sub do_action { - my( $self, $cust_bill ) = @_; - - #my $cust_main = $self->cust_main($cust_bill); - my $cust_main = $cust_bill->cust_main; - - my @err = $cust_bill->cust_suspend_if_balance_over( - $self->option('balanceover'), - 'reason' => $self->option('reasonnum'), - ); - - die join(' / ', @err) if scalar(@err); - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/cust_statement.pm b/FS/FS/part_event/Action/cust_statement.pm deleted file mode 100644 index 2d9e877..0000000 --- a/FS/FS/part_event/Action/cust_statement.pm +++ /dev/null @@ -1,39 +0,0 @@ -package FS::part_event::Action::cust_statement; - -use strict; - -use base qw( FS::part_event::Action ); - -use FS::cust_statement; - -sub description { - 'Group invoices into an informational statement.'; -} - -sub eventtable_hashref { - { 'cust_main' => 1, - 'cust_pkg' => 1, - }; -} - -sub default_weight { - 90; -} - -sub do_action { - my( $self, $cust_main ) = @_; - - #my( $self, $object ) = @_; - #my $cust_main = $self->cust_main($object); - - my $cust_statement = new FS::cust_statement { - 'custnum' => $cust_main->custnum - }; - my $error = $cust_statement->insert; - die $error if $error; - - ''; - -} - -1; diff --git a/FS/FS/part_event/Action/cust_statement_send.pm b/FS/FS/part_event/Action/cust_statement_send.pm deleted file mode 100644 index 74cc48c..0000000 --- a/FS/FS/part_event/Action/cust_statement_send.pm +++ /dev/null @@ -1,26 +0,0 @@ -package FS::part_event::Action::cust_statement_send; - -use strict; - -use base qw( FS::part_event::Action ); - -sub description { - 'Send statement (email/print/fax)'; -} - -sub eventtable_hashref { - { 'cust_statement' => 1, }; -} - -sub default_weight { - 95; -} - -sub do_action { - my( $self, $cust_statement ) = @_; - - $cust_statement->send( 'statement' ); #XXX configure - -} - -1; diff --git a/FS/FS/part_event/Action/fee.pm b/FS/FS/part_event/Action/fee.pm deleted file mode 100644 index 68288d0..0000000 --- a/FS/FS/part_event/Action/fee.pm +++ /dev/null @@ -1,58 +0,0 @@ -package FS::part_event::Action::fee; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Late fee (flat)'; } - -sub event_stage { 'pre-bill'; } - -sub option_fields { - ( - 'charge' => { label=>'Amount', type=>'money', }, # size=>7, }, - 'reason' => 'Reason (invoice line item)', - 'classnum' => { label=>'Package class' => type=>'select-pkg_class', }, - 'taxclass' => { label=>'Tax class', type=>'select-taxclass', }, - 'setuptax' => { label=>'Late fee is tax exempt', - type=>'checkbox', value=>'Y' }, - 'nextbill' => { label=>'Hold late fee until next invoice', - type=>'checkbox', value=>'Y' }, - ); -} - -sub default_weight { 10; } - -sub _calc_fee { - #my( $self, $cust_object ) = @_; - my $self = shift; - $self->option('charge'); -} - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - my $conf = new FS::Conf; - - my %charge = ( - 'amount' => $self->_calc_fee($cust_object), - 'pkg' => $self->option('reason'), - 'taxclass' => $self->option('taxclass'), - 'classnum' => ( $self->option('classnum') - || scalar($conf->config('finance_pkgclass')) ), - 'setuptax' => $self->option('setuptax'), - ); - - #unless its more than N months away? - $charge{'start_date'} = $cust_main->next_bill_date - if $self->option('nextbill'); - - my $error = $cust_main->charge( \%charge ); - - die $error if $error; - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/notice.pm b/FS/FS/part_event/Action/notice.pm deleted file mode 100644 index 8e22c68..0000000 --- a/FS/FS/part_event/Action/notice.pm +++ /dev/null @@ -1,47 +0,0 @@ -package FS::part_event::Action::notice; - -use strict; -use base qw( FS::part_event::Action ); -use FS::Record qw( qsearchs ); -use FS::msg_template; - -sub description { 'Email a notice to the customer\'s billing address'; } - -#sub eventtable_hashref { -# { 'cust_main' => 1, -# 'cust_bill' => 1, -# 'cust_pkg' => 1, -# }; -#} - -sub option_fields { - ( - 'msgnum' => { 'label' => 'Template', - 'type' => 'select-table', - 'table' => 'msg_template', - 'name_col' => 'msgname', - 'disable_empty' => 1, - }, - ); -} - -sub default_weight { 55; } #? - -sub do_action { - my( $self, $object ) = @_; - - my $cust_main = $self->cust_main($object); - - my $msgnum = $self->option('msgnum'); - - my $msg_template = qsearchs('msg_template', { 'msgnum' => $msgnum } ) - or die "Template $msgnum not found"; - - $msg_template->send( - 'cust_main' => $cust_main, - 'object' => $object, - ); - -} - -1; diff --git a/FS/FS/part_event/Action/notice_to.pm b/FS/FS/part_event/Action/notice_to.pm deleted file mode 100644 index 194aeb8..0000000 --- a/FS/FS/part_event/Action/notice_to.pm +++ /dev/null @@ -1,55 +0,0 @@ -package FS::part_event::Action::notice_to; - -use strict; -use base qw( FS::part_event::Action ); -use FS::Record qw( qsearchs ); -use FS::msg_template; - -sub description { 'Email a notice to a specific address'; } - -#sub eventtable_hashref { -# { 'cust_main' => 1, -# 'cust_bill' => 1, -# 'cust_pkg' => 1, -# }; -#} - -sub option_fields { - ( - 'to' => { 'label' => 'Destination', - 'type' => 'text', - 'size' => 30, - }, - 'msgnum' => { 'label' => 'Template', - 'type' => 'select-table', - 'table' => 'msg_template', - 'name_col' => 'msgname', - 'disable_empty' => 1, - }, - ); -} - -sub default_weight { 56; } #? - -sub do_action { - my( $self, $object ) = @_; - - my $cust_main = $self->cust_main($object); - - my $msgnum = $self->option('msgnum'); - - my $msg_template = qsearchs('msg_template', { 'msgnum' => $msgnum } ) - or die "Template $msgnum not found"; - - my $to = $self->option('to') - or die "Can't send notice without a destination address"; - - $msg_template->send( - 'to' => $to, - 'cust_main' => $cust_main, - 'object' => $object, - ); - -} - -1; diff --git a/FS/FS/part_event/Action/pkg_agent_credit.pm b/FS/FS/part_event/Action/pkg_agent_credit.pm deleted file mode 100644 index 4bcee98..0000000 --- a/FS/FS/part_event/Action/pkg_agent_credit.pm +++ /dev/null @@ -1,39 +0,0 @@ -package FS::part_event::Action::pkg_agent_credit; - -use strict; -use base qw( FS::part_event::Action::pkg_referral_credit ); - -sub description { 'Credit the agent a specific amount'; } - -#a little false laziness w/pkg_referral_credit -sub do_action { - my( $self, $cust_pkg, $cust_event ) = @_; - - my $cust_main = $self->cust_main($cust_pkg); - - my $agent = $cust_main->agent; - return "No customer record for agent ". $agent->agent - unless $agent->agent_custnum; - - my $agent_cust_main = $agent->agent_cust_main; - #? or return "No customer record for agent ". $agent->agent; - - my $amount = $self->_calc_credit($cust_pkg); - return '' unless $amount > 0; - - my $reasonnum = $self->option('reasonnum'); - - my $error = $agent_cust_main->credit( - $amount, - \$reasonnum, - 'eventnum' => $cust_event->eventnum, - 'addlinfo' => 'for customer #'. $cust_main->display_custnum. - ': '.$cust_main->name, - ); - die "Error crediting customer ". $agent_cust_main->custnum. - " for agent commission: $error" - if $error; - -} - -1; diff --git a/FS/FS/part_event/Action/pkg_agent_credit_pkg.pm b/FS/FS/part_event/Action/pkg_agent_credit_pkg.pm deleted file mode 100644 index b3e1181..0000000 --- a/FS/FS/part_event/Action/pkg_agent_credit_pkg.pm +++ /dev/null @@ -1,9 +0,0 @@ -package FS::part_event::Action::pkg_agent_credit_pkg; - -use strict; -use base qw( FS::part_event::Action::Mixin::credit_pkg - FS::part_event::Action::pkg_agent_credit ); - -sub description { 'Credit the agent an amount based on the referred package'; } - -1; diff --git a/FS/FS/part_event/Action/pkg_cancel.pm b/FS/FS/part_event/Action/pkg_cancel.pm deleted file mode 100644 index 2bfd35c..0000000 --- a/FS/FS/part_event/Action/pkg_cancel.pm +++ /dev/null @@ -1,32 +0,0 @@ -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; diff --git a/FS/FS/part_event/Action/pkg_employee_credit.pm b/FS/FS/part_event/Action/pkg_employee_credit.pm deleted file mode 100644 index 64dd8b2..0000000 --- a/FS/FS/part_event/Action/pkg_employee_credit.pm +++ /dev/null @@ -1,39 +0,0 @@ -package FS::part_event::Action::pkg_employee_credit; - -use strict; -use base qw( FS::part_event::Action::pkg_referral_credit ); - -sub description { 'Credit the ordering employee a specific amount'; } - -#a little false laziness w/pkg_referral_credit -sub do_action { - my( $self, $cust_pkg, $cust_event ) = @_; - - my $cust_main = $self->cust_main($cust_pkg); - - my $employee = $cust_pkg->access_user; - return "No customer record for employee ". $employee->username - unless $employee->user_custnum; - - my $employee_cust_main = $employee->user_cust_main; - #? or return "No customer record for employee ". $employee->username; - - my $amount = $self->_calc_credit($cust_pkg); - return '' unless $amount > 0; - - my $reasonnum = $self->option('reasonnum'); - - my $error = $employee_cust_main->credit( - $amount, - \$reasonnum, - 'eventnum' => $cust_event->eventnum, - 'addlinfo' => 'for customer #'. $cust_main->display_custnum. - ': '.$cust_main->name, - ); - die "Error crediting customer ". $employee_cust_main->custnum. - " for employee commission: $error" - if $error; - -} - -1; diff --git a/FS/FS/part_event/Action/pkg_employee_credit_pkg.pm b/FS/FS/part_event/Action/pkg_employee_credit_pkg.pm deleted file mode 100644 index e3b867f..0000000 --- a/FS/FS/part_event/Action/pkg_employee_credit_pkg.pm +++ /dev/null @@ -1,9 +0,0 @@ -package FS::part_event::Action::pkg_employee_credit_pkg; - -use strict; -use base qw( FS::part_event::Action::Mixin::credit_pkg - FS::part_event::Action::pkg_employee_credit ); - -sub description { 'Credit the ordering employee an amount based on the referred package'; } - -1; diff --git a/FS/FS/part_event/Action/pkg_referral_credit.pm b/FS/FS/part_event/Action/pkg_referral_credit.pm deleted file mode 100644 index e7c92d6..0000000 --- a/FS/FS/part_event/Action/pkg_referral_credit.pm +++ /dev/null @@ -1,62 +0,0 @@ -package FS::part_event::Action::pkg_referral_credit; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Credit the referring customer a specific amount'; } - -sub eventtable_hashref { - { 'cust_pkg' => 1 }; -} - -sub option_fields { - ( - 'reasonnum' => { 'label' => 'Credit reason', - 'type' => 'select-reason', - 'reason_class' => 'R', - }, - 'amount' => { 'label' => 'Credit amount', - 'type' => 'money', - }, - ); - -} - -sub do_action { - my( $self, $cust_pkg, $cust_event ) = @_; - - my $cust_main = $self->cust_main($cust_pkg); - -# my $part_pkg = $cust_pkg->part_pkg; - - return 'No referring customer' unless $cust_main->referral_custnum; - - my $referring_cust_main = $cust_main->referring_cust_main; - return 'Referring customer is cancelled' - if $referring_cust_main->status eq 'cancelled'; - - my $amount = $self->_calc_credit($cust_pkg); - return '' unless $amount > 0; - - my $reasonnum = $self->option('reasonnum'); - - my $error = $referring_cust_main->credit( - $amount, - \$reasonnum, - 'eventnum' => $cust_event->eventnum, - 'addlinfo' => 'for customer #'. $cust_main->display_custnum. - ': '.$cust_main->name, - ); - die "Error crediting customer ". $cust_main->referral_custnum. - " for referral: $error" - if $error; - -} - -sub _calc_credit { - my( $self, $cust_pkg ) = @_; - - $self->option('amount'); -} - -1; diff --git a/FS/FS/part_event/Action/pkg_referral_credit_pkg.pm b/FS/FS/part_event/Action/pkg_referral_credit_pkg.pm deleted file mode 100644 index 667c4ce..0000000 --- a/FS/FS/part_event/Action/pkg_referral_credit_pkg.pm +++ /dev/null @@ -1,9 +0,0 @@ -package FS::part_event::Action::pkg_referral_credit_pkg; - -use strict; -use base qw( FS::part_event::Action::Mixin::credit_pkg - FS::part_event::Action::pkg_referral_credit ); - -sub description { 'Credit the referring customer an amount based on the referred package'; } - -1; diff --git a/FS/FS/part_event/Action/suspend.pm b/FS/FS/part_event/Action/suspend.pm deleted file mode 100644 index c77728e..0000000 --- a/FS/FS/part_event/Action/suspend.pm +++ /dev/null @@ -1,32 +0,0 @@ -package FS::part_event::Action::suspend; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Suspend'; } - -sub option_fields { - ( - 'reasonnum' => { 'label' => 'Reason', - 'type' => 'select-reason', - 'reason_class' => 'S', - }, - ); -} - -sub default_weight { 10; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - my @err = $cust_main->suspend( 'reason' => $self->option('reasonnum') ); - - die join(' / ', @err) if scalar(@err); - - ''; - -} - -1; diff --git a/FS/FS/part_event/Action/suspend_if_pkgpart.pm b/FS/FS/part_event/Action/suspend_if_pkgpart.pm deleted file mode 100644 index 6f2007c..0000000 --- a/FS/FS/part_event/Action/suspend_if_pkgpart.pm +++ /dev/null @@ -1,40 +0,0 @@ -package FS::part_event::Action::suspend_if_pkgpart; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Suspend packages'; } - -#i should be deprecated in favor of using the if_pkgpart condition - -sub option_fields { - ( - 'if_pkgpart' => { 'label' => 'Suspend packages:', - 'type' => 'select-part_pkg', - 'multiple' => 1, - }, - 'reasonnum' => { 'label' => 'Reason', - 'type' => 'select-reason', - 'reason_class' => 'S', - }, - ); -} - -sub default_weight { 10; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - my @err = $cust_main->suspend_if_pkgpart( { - 'pkgparts' => [ split(/\s*,\s*/, $self->option('if_pkgpart') ) ], - 'reason' => $self->option('reasonnum'), - } ); - - die join(' / ', @err) if scalar(@err); - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/suspend_unless_pkgpart.pm b/FS/FS/part_event/Action/suspend_unless_pkgpart.pm deleted file mode 100644 index efc7a2d..0000000 --- a/FS/FS/part_event/Action/suspend_unless_pkgpart.pm +++ /dev/null @@ -1,40 +0,0 @@ -package FS::part_event::Action::suspend_unless_pkgpart; - -use strict; -use base qw( FS::part_event::Action ); - -sub description { 'Suspend packages except'; } - -#i should be deprecated in favor of using the unless_pkgpart condition - -sub option_fields { - ( - 'unless_pkgpart' => { 'label' => 'Suspend packages except:', - 'type' => 'select-part_pkg', - 'multiple' => 1, - }, - 'reasonnum' => { 'label' => 'Reason', - 'type' => 'select-reason', - 'reason_class' => 'S', - }, - ); -} - -sub default_weight { 10; } - -sub do_action { - my( $self, $cust_object ) = @_; - - my $cust_main = $self->cust_main($cust_object); - - my @err = $cust_main->suspend_unless_pkgpart( { - 'pkgparts' => [ split(/\s*,\s*/, $self->option('unless_pkgpart') ) ], - 'reason' => $self->option('reasonnum'), - } ); - - die join(' / ', @err) if scalar(@err); - - ''; -} - -1; diff --git a/FS/FS/part_event/Action/writeoff.pm b/FS/FS/part_event/Action/writeoff.pm deleted file mode 100644 index 8529d29..0000000 --- a/FS/FS/part_event/Action/writeoff.pm +++ /dev/null @@ -1,33 +0,0 @@ -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 $reasonnum = $self->option('reasonnum'); - - my $error = $cust_main->credit( $cust_main->balance, \$reasonnum ); - die $error if $error; - - ''; -} - -1; |