summaryrefslogtreecommitdiff
path: root/FS/FS/part_event/Condition
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS/part_event/Condition')
-rw-r--r--FS/FS/part_event/Condition/agent.pm37
-rw-r--r--FS/FS/part_event/Condition/agent_type.pm40
-rw-r--r--FS/FS/part_event/Condition/balance.pm48
-rw-r--r--FS/FS/part_event/Condition/balance_age.pm52
-rw-r--r--FS/FS/part_event/Condition/balance_credit_limit.pm32
-rw-r--r--FS/FS/part_event/Condition/balance_under.pm42
-rw-r--r--FS/FS/part_event/Condition/cust_bill_age.pm46
-rw-r--r--FS/FS/part_event/Condition/cust_bill_has_noauto.pm33
-rw-r--r--FS/FS/part_event/Condition/cust_bill_has_service.pm56
-rw-r--r--FS/FS/part_event/Condition/cust_bill_hasnt_noauto.pm33
-rw-r--r--FS/FS/part_event/Condition/cust_bill_owed.pm54
-rw-r--r--FS/FS/part_event/Condition/cust_bill_owed_under.pm49
-rw-r--r--FS/FS/part_event/Condition/cust_bill_past_due.pm41
-rw-r--r--FS/FS/part_event/Condition/cust_pay_batch_declined.pm51
-rw-r--r--FS/FS/part_event/Condition/cust_payments.pm43
-rw-r--r--FS/FS/part_event/Condition/cust_payments_pkg.pm68
-rw-r--r--FS/FS/part_event/Condition/cust_status.pm40
-rw-r--r--FS/FS/part_event/Condition/dundate.pm26
-rw-r--r--FS/FS/part_event/Condition/every.pm67
-rw-r--r--FS/FS/part_event/Condition/has_pkg_class.pm40
-rw-r--r--FS/FS/part_event/Condition/has_pkgpart.pm41
-rw-r--r--FS/FS/part_event/Condition/has_referral_custnum.pm50
-rw-r--r--FS/FS/part_event/Condition/hasnt_pkgpart.pm40
-rw-r--r--FS/FS/part_event/Condition/once.pm55
-rw-r--r--FS/FS/part_event/Condition/once_every.pm46
-rw-r--r--FS/FS/part_event/Condition/once_percust.pm67
-rw-r--r--FS/FS/part_event/Condition/once_perinv.pm57
-rw-r--r--FS/FS/part_event/Condition/payby.pm44
-rw-r--r--FS/FS/part_event/Condition/pkg_age.pm66
-rw-r--r--FS/FS/part_event/Condition/pkg_class.pm38
-rw-r--r--FS/FS/part_event/Condition/pkg_freq.pm36
-rw-r--r--FS/FS/part_event/Condition/pkg_next_bill_within.pm51
-rw-r--r--FS/FS/part_event/Condition/pkg_notchange.pm31
-rw-r--r--FS/FS/part_event/Condition/pkg_pkgpart.pm39
-rw-r--r--FS/FS/part_event/Condition/pkg_recurring.pm28
-rw-r--r--FS/FS/part_event/Condition/pkg_status.pm44
-rw-r--r--FS/FS/part_event/Condition/pkg_unless_pkgpart.pm39
37 files changed, 0 insertions, 1670 deletions
diff --git a/FS/FS/part_event/Condition/agent.pm b/FS/FS/part_event/Condition/agent.pm
deleted file mode 100644
index da428c1..0000000
--- a/FS/FS/part_event/Condition/agent.pm
+++ /dev/null
@@ -1,37 +0,0 @@
-package FS::part_event::Condition::agent;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-# see the FS::part_event::Condition manpage for full documentation on each
-# of the required and optional methods.
-
-sub description {
- 'Agent';
-}
-
-sub option_fields {
- (
- 'agentnum' => { label=>'Agent', type=>'select-agent', },
- );
-}
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $agentnum = $self->option('agentnum');
-
- $cust_main->agentnum == $agentnum;
-
-}
-
-#sub condition_sql {
-# my( $self, $table ) = @_;
-#
-# 'true';
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/agent_type.pm b/FS/FS/part_event/Condition/agent_type.pm
deleted file mode 100644
index 54c8932..0000000
--- a/FS/FS/part_event/Condition/agent_type.pm
+++ /dev/null
@@ -1,40 +0,0 @@
-package FS::part_event::Condition::agent_type;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-# see the FS::part_event::Condition manpage for full documentation on each
-# of the required and optional methods.
-
-sub description {
- 'Agent Type';
-}
-
-sub option_fields {
- (
- 'typenum' => { label => 'Agent Type',
- type => 'select-agent_type',
- disable_empty => 1,
- },
- );
-}
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $typenum = $self->option('typenum');
-
- $cust_main->agent->typenum == $typenum;
-
-}
-
-#sub condition_sql {
-# my( $self, $table ) = @_;
-#
-# 'true';
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/balance.pm b/FS/FS/part_event/Condition/balance.pm
deleted file mode 100644
index 3b8854a..0000000
--- a/FS/FS/part_event/Condition/balance.pm
+++ /dev/null
@@ -1,48 +0,0 @@
-package FS::part_event::Condition::balance;
-
-use strict;
-use FS::cust_main;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer balance'; }
-
-sub implicit_flag { 20; }
-
-sub remove_warning {
- 'Are you sure you want to remove this condition? Doing so will allow this event to run even if the customer has no outstanding balance. Perhaps you want to reset "Balance over" to 0 instead of removing the condition entirely?'; #better error msg?
-}
-
-sub option_fields {
- (
- 'balance' => { 'label' => 'Balance over',
- 'type' => 'money',
- 'value' => '0.00', #default
- },
- );
-}
-
-sub condition {
- my($self, $object) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $over = $self->option('balance');
- $over = 0 unless length($over);
-
- $cust_main->balance > $over;
-}
-
-sub condition_sql {
- my( $class, $table ) = @_;
-
- my $over = $class->condition_sql_option('balance');
-
- my $balance_sql = FS::cust_main->balance_sql;
-
- "$balance_sql > CAST( $over AS DECIMAL(10,2) )";
-
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/balance_age.pm b/FS/FS/part_event/Condition/balance_age.pm
deleted file mode 100644
index 8480659..0000000
--- a/FS/FS/part_event/Condition/balance_age.pm
+++ /dev/null
@@ -1,52 +0,0 @@
-package FS::part_event::Condition::balance_age;
-
-use strict;
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer balance age'; }
-
-sub option_fields {
- (
- 'balance' => { 'label' => 'Balance over',
- 'type' => 'money',
- 'value' => '0.00', #default
- },
- 'age' => { 'label' => 'Age',
- 'type' => 'freq',
- },
- );
-}
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $over = $self->option('balance');
- $over = 0 unless length($over);
-
- my $age = $self->option_age_from('age', $opt{'time'} );
-
- $cust_main->balance_date($age) > $over;
-}
-
-sub condition_sql {
- my( $class, $table, %opt ) = @_;
-
- my $over = $class->condition_sql_option('balance');
- my $age = $class->condition_sql_option_age_from('age', $opt{'time'});
-
- my $balance_sql = FS::cust_main->balance_date_sql( $age );
-
- "$balance_sql > CAST( $over AS DECIMAL(10,2) )";
-}
-
-sub order_sql {
- shift->condition_sql_option_age('age');
-}
-
-sub order_sql_weight {
- 10;
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/balance_credit_limit.pm b/FS/FS/part_event/Condition/balance_credit_limit.pm
deleted file mode 100644
index 1bc2aa1..0000000
--- a/FS/FS/part_event/Condition/balance_credit_limit.pm
+++ /dev/null
@@ -1,32 +0,0 @@
-package FS::part_event::Condition::balance_credit_limit;
-
-use strict;
-use FS::cust_main;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer is over credit limit'; }
-
-sub condition {
- my($self, $object) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $over = $cust_main->credit_limit;
- return 0 if !length($over); # if credit limit is null, no limit
-
- $cust_main->balance > $over;
-}
-
-sub condition_sql {
- my( $class, $table ) = @_;
-
- my $balance_sql = FS::cust_main->balance_sql;
-
- "(cust_main.credit_limit IS NULL OR
- $balance_sql - cust_main.credit_limit > 0 )";
-
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/balance_under.pm b/FS/FS/part_event/Condition/balance_under.pm
deleted file mode 100644
index 2002c70..0000000
--- a/FS/FS/part_event/Condition/balance_under.pm
+++ /dev/null
@@ -1,42 +0,0 @@
-package FS::part_event::Condition::balance_under;
-
-use strict;
-use FS::cust_main;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer balance (under)'; }
-
-sub option_fields {
- (
- 'balance' => { 'label' => 'Balance under (or equal to)',
- 'type' => 'money',
- 'value' => '0.00', #default
- },
- );
-}
-
-sub condition {
- my($self, $object) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $under = $self->option('balance');
- $under = 0 unless length($under);
-
- $cust_main->balance <= $under;
-}
-
-sub condition_sql {
- my( $class, $table ) = @_;
-
- my $under = $class->condition_sql_option('balance');
-
- my $balance_sql = FS::cust_main->balance_sql;
-
- "$balance_sql <= CAST( $under AS DECIMAL(10,2) )";
-
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/cust_bill_age.pm b/FS/FS/part_event/Condition/cust_bill_age.pm
deleted file mode 100644
index 2295e02..0000000
--- a/FS/FS/part_event/Condition/cust_bill_age.pm
+++ /dev/null
@@ -1,46 +0,0 @@
-package FS::part_event::Condition::cust_bill_age;
-
-use strict;
-use base qw( FS::part_event::Condition );
-
-sub description { 'Invoice age'; }
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 0,
- };
-}
-
-sub option_fields {
- (
- 'age' => { label=>'Age', type=>'freq', },
- );
-}
-
-sub condition {
- my( $self, $cust_bill, %opt ) = @_;
-
- my $age = $self->option_age_from('age', $opt{'time'} );
-
- ( $cust_bill->_date - 60 ) <= $age;
-
-}
-
-sub condition_sql {
- my( $class, $table, %opt ) = @_;
-
- my $age = $class->condition_sql_option_age_from('age', $opt{'time'} );
-
- "( cust_bill._date - 60 ) <= $age";
-}
-
-sub order_sql {
- shift->condition_sql_option_age('age');
-}
-
-sub order_sql_weight {
- 0;
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_bill_has_noauto.pm b/FS/FS/part_event/Condition/cust_bill_has_noauto.pm
deleted file mode 100644
index 6cb94c0..0000000
--- a/FS/FS/part_event/Condition/cust_bill_has_noauto.pm
+++ /dev/null
@@ -1,33 +0,0 @@
-package FS::part_event::Condition::cust_bill_has_noauto;
-
-use strict;
-use FS::cust_bill;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- 'Invoice ineligible for automatic collection';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 0,
- };
-}
-
-sub condition {
- #my($self, $cust_bill, %opt) = @_;
- my($self, $cust_bill) = @_;
-
- $cust_bill->no_auto;
-}
-
-#sub condition_sql {
-# my( $class, $table ) = @_;
-#
-# my $sql = qq| |;
-# return $sql;
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_bill_has_service.pm b/FS/FS/part_event/Condition/cust_bill_has_service.pm
deleted file mode 100644
index d85af26..0000000
--- a/FS/FS/part_event/Condition/cust_bill_has_service.pm
+++ /dev/null
@@ -1,56 +0,0 @@
-package FS::part_event::Condition::cust_bill_has_service;
-
-use strict;
-use FS::cust_bill;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- 'Invoice is billing for a certain service type';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 0,
- };
-}
-
-# could not find component for path '/elements/tr-select-part_svc.html'
-# sub disabled { 1; }
-
-sub option_fields {
- (
- 'has_service' => { 'label' => 'Has service',
- 'type' => 'select-part_svc',
- },
- );
-}
-
-sub condition {
- #my($self, $cust_bill, %opt) = @_;
- my($self, $cust_bill) = @_;
-
- my $servicenum = $self->option('has_service');
- grep { $servicenum == $_->svcpart }
- map { $_->cust_pkg->cust_svc }
- $cust_bill->cust_bill_pkg ;
-}
-
-sub condition_sql {
- my( $class, $table, %opt ) = @_;
-
- my $integer = $opt{'driver_name'} =~ /^mysql/ ? 'UNSIGNED INTEGER' : 'INTEGER';
-
- my $servicenum = $class->condition_sql_option('has_service');
- my $sql = qq| 0 < ( SELECT COUNT(cs.svcpart)
- FROM cust_bill_pkg cbp, cust_svc cs
- WHERE cbp.invnum = cust_bill.invnum
- AND cs.pkgnum = cbp.pkgnum
- AND cs.svcpart = CAST( $servicenum AS $integer )
- )
- |;
- return $sql;
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_bill_hasnt_noauto.pm b/FS/FS/part_event/Condition/cust_bill_hasnt_noauto.pm
deleted file mode 100644
index 78a6d51..0000000
--- a/FS/FS/part_event/Condition/cust_bill_hasnt_noauto.pm
+++ /dev/null
@@ -1,33 +0,0 @@
-package FS::part_event::Condition::cust_bill_hasnt_noauto;
-
-use strict;
-use FS::cust_bill;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- 'Invoice eligible for automatic collection';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 0,
- };
-}
-
-sub condition {
- #my($self, $cust_bill, %opt) = @_;
- my($self, $cust_bill) = @_;
-
- ! $cust_bill->no_auto;
-}
-
-#sub condition_sql {
-# my( $class, $table ) = @_;
-#
-# my $sql = qq| |;
-# return $sql;
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_bill_owed.pm b/FS/FS/part_event/Condition/cust_bill_owed.pm
deleted file mode 100644
index d8c77c7..0000000
--- a/FS/FS/part_event/Condition/cust_bill_owed.pm
+++ /dev/null
@@ -1,54 +0,0 @@
-package FS::part_event::Condition::cust_bill_owed;
-
-use strict;
-use FS::cust_bill;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- 'Amount owed on specific invoice';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 0,
- };
-}
-
-sub implicit_flag { 30; }
-
-sub remove_warning {
- 'Are you sure you want to remove this condition? Doing so will allow this event to run even for invoices which have no outstanding balance. Perhaps you want to reset "Amount owed over" to 0 instead of removing the condition entirely?'; #better error msg?
-}
-
-sub option_fields {
- (
- 'owed' => { 'label' => 'Amount owed over',
- 'type' => 'money',
- 'value' => '0.00', #default
- },
- );
-}
-
-sub condition {
- #my($self, $cust_bill, %opt) = @_;
- my($self, $cust_bill) = @_;
-
- my $over = $self->option('owed');
- $over = 0 unless length($over);
-
- $cust_bill->owed > $over;
-}
-
-sub condition_sql {
- my( $class, $table ) = @_;
-
- my $over = $class->condition_sql_option('owed');
-
- my $owed_sql = FS::cust_bill->owed_sql;
-
- "$owed_sql > CAST( $over AS DECIMAL(10,2) )";
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_bill_owed_under.pm b/FS/FS/part_event/Condition/cust_bill_owed_under.pm
deleted file mode 100644
index 4eb6439..0000000
--- a/FS/FS/part_event/Condition/cust_bill_owed_under.pm
+++ /dev/null
@@ -1,49 +0,0 @@
-package FS::part_event::Condition::cust_bill_owed_under;
-
-use strict;
-use FS::cust_bill;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- 'Amount owed on specific invoice (under)';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 0,
- };
-}
-
-sub option_fields {
- (
- 'owed' => { 'label' => 'Amount owed under (or equal to)',
- 'type' => 'money',
- 'value' => '0.00', #default
- },
- );
-}
-
-sub condition {
- #my($self, $cust_bill, %opt) = @_;
- my($self, $cust_bill) = @_;
-
- my $under = $self->option('owed');
- $under = 0 unless length($under);
-
- $cust_bill->owed <= $under;
-
-}
-
-sub condition_sql {
- my( $class, $table ) = @_;
-
- my $under = $class->condition_sql_option('owed');
-
- my $owed_sql = FS::cust_bill->owed_sql;
-
- "$owed_sql <= CAST( $under AS DECIMAL(10,2) )";
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_bill_past_due.pm b/FS/FS/part_event/Condition/cust_bill_past_due.pm
deleted file mode 100644
index a889a00..0000000
--- a/FS/FS/part_event/Condition/cust_bill_past_due.pm
+++ /dev/null
@@ -1,41 +0,0 @@
-package FS::part_event::Condition::cust_bill_past_due;
-
-use strict;
-use FS::cust_bill;
-use Time::Local 'timelocal';
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- 'Invoice due date has passed';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 0,
- };
-}
-
-sub condition {
- my($self, $cust_bill, %opt) = @_;
-
- # If the invoice date is 1/1 at noon and the terms are Net 15,
- # the due_date will be 1/16 at noon. Past due events will not
- # trigger until after the start of 1/17.
- my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($opt{'time'}))[0..5];
- my $start_of_today = timelocal(0,0,0,$mday,$mon,$year)+1;
- ($cust_bill->due_date || $cust_bill->_date) < $start_of_today;
-}
-
-sub condition_sql {
- return 'true' if $FS::UID::driver_name ne 'Pg';
- my( $class, $table, %opt ) = @_;
- my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($opt{'time'}))[0..5];
- my $start_of_today = timelocal(0,0,0,$mday,$mon,$year)+1;
-
- FS::cust_bill->due_date_sql . " < $start_of_today";
-
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_pay_batch_declined.pm b/FS/FS/part_event/Condition/cust_pay_batch_declined.pm
deleted file mode 100644
index b3a8d70..0000000
--- a/FS/FS/part_event/Condition/cust_pay_batch_declined.pm
+++ /dev/null
@@ -1,51 +0,0 @@
-package FS::part_event::Condition::cust_pay_batch_declined;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- 'Batch payment declined';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 0,
- 'cust_pay_batch' => 1,
- };
-}
-
-#sub option_fields {
-# (
-# 'field' => 'description',
-#
-# 'another_field' => { 'label'=>'Amount', 'type'=>'money', },
-#
-# 'third_field' => { 'label' => 'Types',
-# 'type' => 'checkbox-multiple',
-# 'options' => [ 'h', 's' ],
-# 'option_labels' => { 'h' => 'Happy',
-# 's' => 'Sad',
-# },
-# );
-#}
-
-sub condition {
- my($self, $cust_pay_batch, %opt) = @_;
-
- #my $cust_main = $self->cust_main($object);
- #my $value_of_field = $self->option('field');
- #my $time = $opt{'time'}; #use this instead of time or $^T
-
- $cust_pay_batch->status =~ /Declined/i;
-
-}
-
-#sub condition_sql {
-# my( $class, $table ) = @_;
-# #...
-# 'true';
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/cust_payments.pm b/FS/FS/part_event/Condition/cust_payments.pm
deleted file mode 100644
index 477ecdb..0000000
--- a/FS/FS/part_event/Condition/cust_payments.pm
+++ /dev/null
@@ -1,43 +0,0 @@
-package FS::part_event::Condition::cust_payments;
-
-use strict;
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer total payments (amount)'; }
-
-sub option_fields {
- (
- 'over' => { 'label' => 'Customer total payments at least',
- 'type' => 'money',
- 'value' => '0.00', #default
- },
- );
-}
-
-sub condition {
- my($self, $object) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $over = $self->option('over');
- $over = 0 unless length($over);
-
- $cust_main->total_paid >= $over;
-
-}
-
-#XXX add for efficiency. could use cust_main::total_paid_sql
-#use FS::cust_main;
-#sub condition_sql {
-# my( $class, $table ) = @_;
-#
-# my $over = $class->condition_sql_option('balance');
-#
-# my $balance_sql = FS::cust_main->balance_sql;
-#
-# "$balance_sql > $over";
-#
-#}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/cust_payments_pkg.pm b/FS/FS/part_event/Condition/cust_payments_pkg.pm
deleted file mode 100644
index d6c493b..0000000
--- a/FS/FS/part_event/Condition/cust_payments_pkg.pm
+++ /dev/null
@@ -1,68 +0,0 @@
-package FS::part_event::Condition::cust_payments_pkg;
-
-use strict;
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer total payments (multiplier of package)'; }
-
-sub eventtable_hashref {
- { 'cust_pkg' => 1 };
-}
-
-sub option_fields {
- (
- 'over_times' => { 'label' => 'Customer total payments as least',
- 'type' => 'text',
- 'value' => '1', #default
- },
- 'what' => { 'label' => 'Times',
- 'type' => 'select',
- #also add some way to specify in the package def, no?
- 'options' => [ qw( base_recur_permonth ) ],
- 'labels' => { 'base_recur_permonth' => 'Base monthly fee', },
- },
- );
-}
-
-sub condition {
- my($self, $cust_pkg) = @_;
-
- my $cust_main = $self->cust_main($cust_pkg);
-
- my $part_pkg = $cust_pkg->part_pkg;
-
- my $over_times = $self->option('over_times');
- $over_times = 0 unless length($over_times);
-
- my $what = $self->option('what');
-
- #false laziness w/Condition/cust_payments_pkg.pm
- if ( $what eq 'base_recur_permonth' ) { #huh. yuck.
- if ( $part_pkg->freq !~ /^\d+$/ ) {
- die 'WARNING: Not crediting customer '. $cust_main->referral_custnum.
- ' for package '. $cust_pkg->pkgnum.
- ' ( customer '. $cust_pkg->custnum. ')'.
- ' - Referral credits not (yet) available for '.
- ' packages with '. $part_pkg->freq_pretty. ' frequency';
- }
- }
-
- $cust_main->total_paid >= $over_times * $part_pkg->$what($cust_pkg);
-
-}
-
-#XXX add for efficiency. could use cust_main::total_paid_sql
-#use FS::cust_main;
-#sub condition_sql {
-# my( $class, $table ) = @_;
-#
-# my $over = $class->condition_sql_option('balance');
-#
-# my $balance_sql = FS::cust_main->balance_sql;
-#
-# "$balance_sql > $over";
-#
-#}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/cust_status.pm b/FS/FS/part_event/Condition/cust_status.pm
deleted file mode 100644
index 066ee48..0000000
--- a/FS/FS/part_event/Condition/cust_status.pm
+++ /dev/null
@@ -1,40 +0,0 @@
-package FS::part_event::Condition::cust_status;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-use FS::Record qw( qsearch );
-
-sub description {
- 'Customer Status';
-}
-
-#something like this
-sub option_fields {
- (
- 'status' => { 'label' => 'Customer Status',
- 'type' => 'select-cust_main-status',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $object) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- #XXX test
- my $hashref = $self->option('status') || {};
- $hashref->{ $cust_main->status };
-}
-
-sub condition_sql {
- my( $self, $table ) = @_;
-
- '('.FS::cust_main->cust_status_sql . ') IN '.
- $self->condition_sql_option_option('status');
-}
-
-
-1;
diff --git a/FS/FS/part_event/Condition/dundate.pm b/FS/FS/part_event/Condition/dundate.pm
deleted file mode 100644
index ee2a95f..0000000
--- a/FS/FS/part_event/Condition/dundate.pm
+++ /dev/null
@@ -1,26 +0,0 @@
-package FS::part_event::Condition::dundate;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- "Skip until customer dun date is reached";
-}
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- $cust_main->dundate <= $opt{time};
-
-}
-
-#sub condition_sql {
-# my( $self, $table ) = @_;
-#
-# 'true';
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/every.pm b/FS/FS/part_event/Condition/every.pm
deleted file mode 100644
index 1910674..0000000
--- a/FS/FS/part_event/Condition/every.pm
+++ /dev/null
@@ -1,67 +0,0 @@
-package FS::part_event::Condition::every;
-
-use strict;
-use FS::UID qw( dbh );
-use FS::Record qw( qsearch );
-use FS::cust_event;
-
-use base qw( FS::part_event::Condition );
-
-sub description { "Don't retry failures more often than specified interval"; }
-
-sub option_fields {
- (
- 'retry_delay' => { label=>'Retry after', type=>'freq', value=>'1d', },
- 'max_tries' => { label=>'Maximum # of attempts', type=>'text', size=>3, },
- );
-}
-
-my %after = (
- 'h' => 3600,
- 'd' => 86400,
- 'w' => 604800,
- 'm' => 2592000, #well, 30 days... presumably people would mostly use d or w
- '' => 2592000,
- 'y' => 31536000, #well, 365 days...
-);
-
-my $sql =
- "SELECT COUNT(*) FROM cust_event WHERE eventpart = ? AND tablenum = ?";
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $obj_pkey = $object->primary_key;
- my $tablenum = $object->$obj_pkey();
-
- if ( $self->option('max_tries') =~ /^\s*(\d+)\s*$/ ) {
- my $max_tries = $1;
- my $sth = dbh->prepare($sql)
- or die dbh->errstr. " preparing: $sql";
- $sth->execute($self->eventpart, $tablenum)
- or die $sth->errstr. " executing: $sql";
- my $tries = $sth->fetchrow_arrayref->[0];
- return 0 if $tries >= $max_tries;
- }
-
- my $time = $opt{'time'};
- my $retry_delay = $self->option('retry_delay');
- $retry_delay =~ /^(\d+)([hdwmy]?)$/
- or die "unparsable retry_delay: $retry_delay";
- my $date_after = $time - $1 * $after{$2};
-
- my $sth = dbh->prepare("$sql AND _date > ?") # AND status = 'failed' "
- or die dbh->errstr. " preparing: $sql";
- $sth->execute($self->eventpart, $tablenum, $date_after)
- or die $sth->errstr. " executing: $sql";
- ! $sth->fetchrow_arrayref->[0];
-
-}
-
-#sub condition_sql {
-# my( $self, $table ) = @_;
-#
-# 'true';
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/has_pkg_class.pm b/FS/FS/part_event/Condition/has_pkg_class.pm
deleted file mode 100644
index 59a3675..0000000
--- a/FS/FS/part_event/Condition/has_pkg_class.pm
+++ /dev/null
@@ -1,40 +0,0 @@
-package FS::part_event::Condition::has_pkg_class;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-use FS::Record qw( qsearch );
-use FS::pkg_class;
-
-sub description {
- 'Customer has uncancelled package with class';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 1,
- 'cust_bill' => 1,
- 'cust_pkg' => 1,
- };
-}
-
-#something like this
-sub option_fields {
- (
- 'pkgclass' => { 'label' => 'Package Class',
- 'type' => 'select-pkg_class',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $object ) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- #XXX test
- my $hashref = $self->option('pkgclass') || {};
- grep $hashref->{ $_->part_pkg->classnum }, $cust_main->ncancelled_pkgs;
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/has_pkgpart.pm b/FS/FS/part_event/Condition/has_pkgpart.pm
deleted file mode 100644
index c54b7e2..0000000
--- a/FS/FS/part_event/Condition/has_pkgpart.pm
+++ /dev/null
@@ -1,41 +0,0 @@
-package FS::part_event::Condition::has_pkgpart;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer has uncancelled package of specified definitions'; }
-
-sub eventtable_hashref {
- { 'cust_main' => 1,
- 'cust_bill' => 1,
- 'cust_pkg' => 1,
- };
-}
-
-sub option_fields {
- (
- 'if_pkgpart' => { 'label' => 'Only packages: ',
- 'type' => 'select-part_pkg',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $object) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- #XXX test
- my $if_pkgpart = $self->option('if_pkgpart') || {};
- grep $if_pkgpart->{ $_->pkgpart }, $cust_main->ncancelled_pkgs;
-
-}
-
-#XXX
-#sub condition_sql {
-#
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/has_referral_custnum.pm b/FS/FS/part_event/Condition/has_referral_custnum.pm
deleted file mode 100644
index 70c9c7f..0000000
--- a/FS/FS/part_event/Condition/has_referral_custnum.pm
+++ /dev/null
@@ -1,50 +0,0 @@
-package FS::part_event::Condition::has_referral_custnum;
-
-use strict;
-use FS::cust_main;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer has a referring customer'; }
-
-sub option_fields {
- (
- 'active' => { 'label' => 'Referring customer is active',
- 'type' => 'checkbox',
- 'value' => 'Y',
- },
- );
-}
-
-sub condition {
- my($self, $object) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- if ( $self->option('active') ) {
-
- return 0 unless $cust_main->referral_custnum;
-
- #check for no cust_main for referral_custnum? (deleted?)
-
- $cust_main->referral_custnum_cust_main->status eq 'active';
-
- } else {
-
- $cust_main->referral_custnum; # ? 1 : 0;
-
- }
-
-}
-
-sub condition_sql {
- my( $class, $table ) = @_;
-
- my $sql = FS::cust_main->active_sql;
- $sql =~ s/cust_main.custnum/cust_main.referral_custnum/;
- $sql = 'cust_main.referral_custnum IS NOT NULL AND ('.
- $class->condition_sql_option('active') . ' IS NULL OR '.$sql.')';
- return $sql;
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/hasnt_pkgpart.pm b/FS/FS/part_event/Condition/hasnt_pkgpart.pm
deleted file mode 100644
index 421d023..0000000
--- a/FS/FS/part_event/Condition/hasnt_pkgpart.pm
+++ /dev/null
@@ -1,40 +0,0 @@
-package FS::part_event::Condition::hasnt_pkgpart;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Customer does not have uncancelled package of specified definitions'; }
-
-sub eventtable_hashref {
- { 'cust_main' => 1,
- 'cust_bill' => 1,
- 'cust_pkg' => 1,
- };
-}
-
-sub option_fields {
- (
- 'unless_pkgpart' => { 'label' => 'Packages: ',
- 'type' => 'select-part_pkg',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $object ) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- #XXX test
- my $unless_pkgpart = $self->option('unless_pkgpart') || {};
- ! grep $unless_pkgpart->{ $_->pkgpart }, $cust_main->ncancelled_pkgs;
-}
-
-#XXX
-#sub condition_sql {
-#
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/once.pm b/FS/FS/part_event/Condition/once.pm
deleted file mode 100644
index d004814..0000000
--- a/FS/FS/part_event/Condition/once.pm
+++ /dev/null
@@ -1,55 +0,0 @@
-package FS::part_event::Condition::once;
-
-use strict;
-use FS::Record qw( qsearch );
-use FS::part_event;
-use FS::cust_event;
-
-use base qw( FS::part_event::Condition );
-
-sub description { "Don't run this event again after it has completed successfully"; }
-
-sub implicit_flag { 10; }
-
-sub remove_warning {
- 'Are you sure you want to remove this condition? Doing so will allow this event to run every time the other conditions are satisfied, even if it has already run sucessfully.'; #better error msg?
-}
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $obj_pkey = $object->primary_key;
- my $tablenum = $object->$obj_pkey();
-
- my @existing = qsearch( {
- 'table' => 'cust_event',
- 'hashref' => {
- 'eventpart' => $self->eventpart,
- 'tablenum' => $tablenum,
- 'status' => { op=>'!=', value=>'failed' },
- },
- 'extra_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/
- ? " AND eventnum != $1 "
- : ''
- ),
- } );
-
- ! scalar(@existing);
-
-}
-
-sub condition_sql {
- my( $self, $table ) = @_;
-
- my %tablenum = %{ FS::part_event->eventtable_pkey_sql };
-
- "0 = ( SELECT COUNT(*) FROM cust_event
- WHERE cust_event.eventpart = part_event.eventpart
- AND cust_event.tablenum = $tablenum{$table}
- AND status != 'failed'
- )
- ";
-
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/once_every.pm b/FS/FS/part_event/Condition/once_every.pm
deleted file mode 100644
index 2921b3a..0000000
--- a/FS/FS/part_event/Condition/once_every.pm
+++ /dev/null
@@ -1,46 +0,0 @@
-package FS::part_event::Condition::once_every;
-
-use strict;
-use FS::Record qw( qsearch );
-use FS::part_event;
-use FS::cust_event;
-
-use base qw( FS::part_event::Condition );
-
-sub description { "Don't run this event more than once in the specified interval"; }
-
-# Runs the event at most "once every X".
-
-sub option_fields {
- (
- 'run_delay' => { label=>'Interval', type=>'freq', value=>'1m', },
- );
-}
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $obj_pkey = $object->primary_key;
- my $tablenum = $object->$obj_pkey();
-
- my $max_date = $self->option_age_from('run_delay',$opt{'time'});
-
- my @existing = qsearch( {
- 'table' => 'cust_event',
- 'hashref' => {
- 'eventpart' => $self->eventpart,
- 'tablenum' => $tablenum,
- 'status' => { op=>'!=', value=>'failed' },
- '_date' => { op=>'>=', value=>$max_date },
- },
- 'extra_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/
- ? " AND eventnum != $1 "
- : ''
- ),
- } );
-
- ! scalar(@existing);
-
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/once_percust.pm b/FS/FS/part_event/Condition/once_percust.pm
deleted file mode 100644
index b8a8fbf..0000000
--- a/FS/FS/part_event/Condition/once_percust.pm
+++ /dev/null
@@ -1,67 +0,0 @@
-package FS::part_event::Condition::once_percust;
-
-use strict;
-use FS::Record qw( qsearch );
-use FS::part_event;
-use FS::cust_event;
-
-use base qw( FS::part_event::Condition );
-
-sub description { "Don't run more than once per customer"; }
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 1,
- 'cust_pkg' => 1,
- };
-}
-
-sub condition {
- my($self, $object, %opt) = @_;
-
- my $obj_pkey = $object->primary_key;
- my $obj_table = $object->table;
- my $custnum = $object->custnum;
-
- my @where = (
- "tablenum IN ( SELECT $obj_pkey FROM $obj_table WHERE custnum = $custnum )"
- );
- if ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/ ) {
- push @where, " eventnum != $1 ";
- }
- my $extra_sql = ' AND '. join(' AND ', @where);
-
- my @existing = qsearch( {
- 'table' => 'cust_event',
- 'hashref' => {
- 'eventpart' => $self->eventpart,
- #'tablenum' => $tablenum,
- 'status' => { op=>'!=', value=>'failed' },
- },
- 'extra_sql' => $extra_sql,
- } );
-
- ! scalar(@existing);
-
-}
-
-#XXX test?
-sub condition_sql {
- my( $self, $table ) = @_;
-
- my %pkey = %{ FS::part_event->eventtable_pkey };
-
- my $pkey = $pkey{$table};
-
- "0 = ( SELECT COUNT(*) FROM cust_event
- WHERE cust_event.eventpart = part_event.eventpart
- AND cust_event.tablenum IN (
- SELECT $pkey FROM $table AS once_percust
- WHERE once_percust.custnum = cust_main.custnum )
- AND status != 'failed'
- )
- ";
-
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/once_perinv.pm b/FS/FS/part_event/Condition/once_perinv.pm
deleted file mode 100644
index f85a056..0000000
--- a/FS/FS/part_event/Condition/once_perinv.pm
+++ /dev/null
@@ -1,57 +0,0 @@
-package FS::part_event::Condition::once_perinv;
-
-use strict;
-use FS::Record qw( qsearch );
-use FS::part_event;
-use FS::cust_event;
-
-use base qw( FS::part_event::Condition );
-
-sub description { "Run only once for each time the package has been billed"; }
-
-# Run the event, at most, a number of times equal to the number of
-# distinct invoices that contain line items from this package.
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-sub condition {
- my($self, $cust_pkg, %opt) = @_;
-
- my %invnum;
- $invnum{$_->invnum} = 1
- foreach ( qsearch('cust_bill_pkg', { 'pkgnum' => $cust_pkg->pkgnum }) );
- my @events = qsearch( {
- 'table' => 'cust_event',
- 'hashref' => { 'eventpart' => $self->eventpart,
- 'status' => { op=>'!=', value=>'failed' },
- 'tablenum' => $cust_pkg->pkgnum,
- },
- 'extra_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/
- ? " AND eventnum != $1 " : '' ),
- } );
- scalar(@events) < scalar(keys %invnum);
-}
-
-sub condition_sql {
- my( $self, $table ) = @_;
-
- "(
- ( SELECT COUNT(distinct(invnum))
- FROM cust_bill_pkg
- WHERE cust_bill_pkg.pkgnum = cust_pkg.pkgnum )
- >
- ( SELECT COUNT(*)
- FROM cust_event
- WHERE cust_event.eventpart = part_event.eventpart
- AND cust_event.tablenum = cust_pkg.pkgnum
- AND status != 'failed' )
- )"
-
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/payby.pm b/FS/FS/part_event/Condition/payby.pm
deleted file mode 100644
index 16bf480..0000000
--- a/FS/FS/part_event/Condition/payby.pm
+++ /dev/null
@@ -1,44 +0,0 @@
-package FS::part_event::Condition::payby;
-
-use strict;
-use Tie::IxHash;
-use FS::payby;
-
-use base qw( FS::part_event::Condition );
-
-sub description {
- #'customer payment types: ';
- 'Customer payment type';
-}
-
-#something like this
-tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname;
-sub option_fields {
- (
- 'payby' => {
- label => 'Customer payment type',
- #type => 'select-multiple',
- type => 'checkbox-multiple',
- options => [ keys %payby ],
- option_labels => \%payby,
- },
- );
-}
-
-sub condition {
- my( $self, $object ) = @_;
-
- my $cust_main = $self->cust_main($object);
-
- my $hashref = $self->option('payby') || {};
- $hashref->{ $cust_main->payby };
-
-}
-
-sub condition_sql {
- my( $self, $table ) = @_;
-
- 'cust_main.payby IN '. $self->condition_sql_option_option('payby');
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/pkg_age.pm b/FS/FS/part_event/Condition/pkg_age.pm
deleted file mode 100644
index 4a85387..0000000
--- a/FS/FS/part_event/Condition/pkg_age.pm
+++ /dev/null
@@ -1,66 +0,0 @@
-package FS::part_event::Condition::pkg_age;
-
-use strict;
-use base qw( FS::part_event::Condition );
-use FS::Record qw( qsearch );
-
-sub description {
- 'Package Age';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-#something like this
-sub option_fields {
- (
- 'age' => { 'label' => 'Package date age',
- 'type' => 'freq',
- },
- 'field' => { 'label' => 'Compare date',
- 'type' => 'select',
- 'options' =>
- [qw( setup last_bill bill adjourn susp expire cancel )],
- 'labels' => {
- 'setup' => 'Setup date',
- 'last_bill' => 'Last bill date',
- 'bill' => 'Next bill date',
- 'adjourn' => 'Adjournment date',
- 'susp' => 'Suspension date',
- 'expire' => 'Expiration date',
- 'cancel' => 'Cancellation date',
- },
- },
- );
-}
-
-sub condition {
- my( $self, $cust_pkg, %opt ) = @_;
-
- my $age = $self->option_age_from('age', $opt{'time'} );
-
- my $pkg_date = $cust_pkg->get( $self->option('field') );
-
- $pkg_date && $pkg_date <= $age;
-
-}
-
-sub condition_sql {
- my( $class, $table, %opt ) = @_;
- my $age = $class->condition_sql_option_age_from('age', $opt{'time'});
- my $field = $class->condition_sql_option('field');
-#amazingly, this is actually faster
- my $sql = '( CASE';
- foreach( qw(setup last_bill bill adjourn susp expire cancel) ) {
- $sql .= " WHEN $field = '$_' THEN (cust_pkg.$_ IS NOT NULL AND cust_pkg.$_ <= $age)";
- }
- $sql .= ' END )';
- return $sql;
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/pkg_class.pm b/FS/FS/part_event/Condition/pkg_class.pm
deleted file mode 100644
index 8c9031c..0000000
--- a/FS/FS/part_event/Condition/pkg_class.pm
+++ /dev/null
@@ -1,38 +0,0 @@
-package FS::part_event::Condition::pkg_class;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-use FS::Record qw( qsearch );
-use FS::pkg_class;
-
-sub description {
- 'Package Class';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-#something like this
-sub option_fields {
- (
- 'pkgclass' => { 'label' => 'Package Class',
- 'type' => 'select-pkg_class',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $cust_pkg ) = @_;
-
- #XXX test
- my $hashref = $self->option('pkgclass') || {};
- $hashref->{ $cust_pkg->part_pkg->classnum };
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/pkg_freq.pm b/FS/FS/part_event/Condition/pkg_freq.pm
deleted file mode 100644
index 1fb8484..0000000
--- a/FS/FS/part_event/Condition/pkg_freq.pm
+++ /dev/null
@@ -1,36 +0,0 @@
-package FS::part_event::Condition::pkg_freq;
-
-use strict;
-use FS::Misc;
-use FS::cust_pkg;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Package billing frequency'; }
-
-sub option_fields {
- my $freqs = FS::Misc::pkg_freqs();
- (
- 'freq' => { 'label' => 'Frequency',
- 'type' => 'select',
- 'labels' => $freqs,
- 'options' => [ keys(%$freqs) ],
- },
- );
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-sub condition {
- my($self, $cust_pkg) = @_;
-
- $cust_pkg->part_pkg->freq eq $self->option('freq')
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/pkg_next_bill_within.pm b/FS/FS/part_event/Condition/pkg_next_bill_within.pm
deleted file mode 100644
index 90c4c6a..0000000
--- a/FS/FS/part_event/Condition/pkg_next_bill_within.pm
+++ /dev/null
@@ -1,51 +0,0 @@
-package FS::part_event::Condition::pkg_next_bill_within;
-
-use strict;
-use base qw( FS::part_event::Condition );
-use FS::Record qw( qsearch );
-
-sub description {
- 'Next bill date within upcoming interval';
-}
-
-# Run the event when the next bill date is within X days.
-# To clarify, that's within X days _after_ the current date,
-# not before.
-# Combine this with a "once_every" condition so that the event
-# won't repeat every day until the bill date.
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-sub option_fields {
- (
- 'within' => { 'label' => 'Bill date within',
- 'type' => 'freq',
- },
- # possibly "field" to allow date fields besides 'bill'?
- );
-}
-
-sub condition {
- my( $self, $cust_pkg, %opt ) = @_;
-
- my $pkg_date = $cust_pkg->get('bill') or return 0;
- $pkg_date = $self->option_age_from('within', $pkg_date );
-
- $opt{'time'} >= $pkg_date;
-
-}
-
-#XXX write me for efficiency
-sub condition_sql {
- my ($self, $table, %opt) = @_;
- $opt{'time'}.' >= '.
- $self->condition_sql_option_age_from('within', 'cust_pkg.bill')
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/pkg_notchange.pm b/FS/FS/part_event/Condition/pkg_notchange.pm
deleted file mode 100644
index 4c103c2..0000000
--- a/FS/FS/part_event/Condition/pkg_notchange.pm
+++ /dev/null
@@ -1,31 +0,0 @@
-package FS::part_event::Condition::pkg_notchange;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-use FS::Record qw( qsearch );
-
-sub description {
- 'Package is a new order, not a change';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-sub condition {
- my( $self, $cust_pkg ) = @_;
-
- ! $cust_pkg->change_date;
-
-}
-
-sub condition_sql {
- '( cust_pkg.change_date IS NULL OR cust_pkg.change_date = 0 )';
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/pkg_pkgpart.pm b/FS/FS/part_event/Condition/pkg_pkgpart.pm
deleted file mode 100644
index 6adef8e..0000000
--- a/FS/FS/part_event/Condition/pkg_pkgpart.pm
+++ /dev/null
@@ -1,39 +0,0 @@
-package FS::part_event::Condition::pkg_pkgpart;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Package definitions'; }
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-sub option_fields {
- (
- 'if_pkgpart' => { 'label' => 'Only packages: ',
- 'type' => 'select-part_pkg',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $cust_pkg) = @_;
-
- #XXX test
- my $if_pkgpart = $self->option('if_pkgpart') || {};
- $if_pkgpart->{ $cust_pkg->pkgpart };
-
-}
-
-#XXX
-#sub condition_sql {
-#
-#}
-
-1;
diff --git a/FS/FS/part_event/Condition/pkg_recurring.pm b/FS/FS/part_event/Condition/pkg_recurring.pm
deleted file mode 100644
index 1a08869..0000000
--- a/FS/FS/part_event/Condition/pkg_recurring.pm
+++ /dev/null
@@ -1,28 +0,0 @@
-package FS::part_event::Condition::pkg_recurring;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Package is recurring'; }
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-sub condition {
- my( $self, $cust_pkg ) = @_;
-
- $cust_pkg->part_pkg->freq !~ /^0+\D?$/; #just in case, probably just != '0'
-
-}
-
-sub condition_sql {
- FS::cust_pkg->recurring_sql()
-}
-
-1;
-
diff --git a/FS/FS/part_event/Condition/pkg_status.pm b/FS/FS/part_event/Condition/pkg_status.pm
deleted file mode 100644
index 3fb374e..0000000
--- a/FS/FS/part_event/Condition/pkg_status.pm
+++ /dev/null
@@ -1,44 +0,0 @@
-package FS::part_event::Condition::pkg_status;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-use FS::Record qw( qsearch );
-
-sub description {
- 'Package Status';
-}
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-#something like this
-sub option_fields {
- (
- 'status' => { 'label' => 'Package Status',
- 'type' => 'select-cust_pkg-status',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $cust_pkg ) = @_;
-
- #XXX test
- my $hashref = $self->option('status') || {};
- $hashref->{ $cust_pkg->status };
-}
-
-sub condition_sql {
- my( $self, $table ) = @_;
-
- '('.FS::cust_pkg->status_sql . ') IN '.
- $self->condition_sql_option_option('status');
-}
-
-1;
diff --git a/FS/FS/part_event/Condition/pkg_unless_pkgpart.pm b/FS/FS/part_event/Condition/pkg_unless_pkgpart.pm
deleted file mode 100644
index 47fa8c3..0000000
--- a/FS/FS/part_event/Condition/pkg_unless_pkgpart.pm
+++ /dev/null
@@ -1,39 +0,0 @@
-package FS::part_event::Condition::pkg_unless_pkgpart;
-
-use strict;
-
-use base qw( FS::part_event::Condition );
-
-sub description { 'Except package definitions'; }
-
-sub eventtable_hashref {
- { 'cust_main' => 0,
- 'cust_bill' => 0,
- 'cust_pkg' => 1,
- };
-}
-
-sub option_fields {
- (
- 'unless_pkgpart' => { 'label' => 'Except packages: ',
- 'type' => 'select-part_pkg',
- 'multiple' => 1,
- },
- );
-}
-
-sub condition {
- my( $self, $cust_pkg) = @_;
-
- #XXX test
- my $unless_pkgpart = $self->option('unless_pkgpart') || {};
- ! $unless_pkgpart->{ $cust_pkg->pkgpart };
-
-}
-
-#XXX
-#sub condition_sql {
-#
-#}
-
-1;