summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-10-29 18:38:09 +0000
committerivan <ivan>2009-10-29 18:38:09 +0000
commitfcc3ddbd03b97b88bf04f6984d7fd3c443fb14b5 (patch)
tree3982ce563d7b0fa726ae033aadf92748350b2123 /FS
parent9d77a21db3642ca66d9a0e545b804b7e6b4090ee (diff)
customer classification, RT#6376
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_main.pm47
-rw-r--r--FS/MANIFEST4
-rw-r--r--FS/t/category_Common.t5
-rw-r--r--FS/t/class_Common.t5
4 files changed, 61 insertions, 0 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 2c2984fa1..fdcd80178 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -2307,6 +2307,53 @@ sub agent {
qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
}
+=item cust_class
+
+Returns the customer class, as an FS::cust_class object, or the empty string
+if there is no customer class.
+
+=cut
+
+sub cust_class {
+ my $self = shift;
+ if ( $self->classnum ) {
+ qsearchs('cust_class', { 'classnum' => $self->classnum } );
+ } else {
+ return '';
+ }
+}
+
+=item categoryname
+
+Returns the customer category name, or the empty string if there is no customer
+category.
+
+=cut
+
+sub categoryname {
+ my $self = shift;
+ my $cust_class = $self->cust_class;
+ $cust_class
+ ? $cust_class->categoryname
+ : '';
+}
+
+=item classname
+
+Returns the customer class name, or the empty string if there is no customer
+class.
+
+=cut
+
+sub classname {
+ my $self = shift;
+ my $cust_class = $self->cust_class;
+ $cust_class
+ ? $cust_class->classname
+ : '';
+}
+
+
=item bill_and_collect
Cancels and suspends any packages due, generates bills, applies payments and
diff --git a/FS/MANIFEST b/FS/MANIFEST
index d4e80e694..b84ba525b 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -457,3 +457,7 @@ FS/cust_class.pm
t/cust_class.t
FS/cust_category.pm
t/cust_category.t
+FS/class_Common.pm
+t/class_Common.t
+FS/category_Common.pm
+t/category_Common.t
diff --git a/FS/t/category_Common.t b/FS/t/category_Common.t
new file mode 100644
index 000000000..b8bd9e230
--- /dev/null
+++ b/FS/t/category_Common.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n" }
+END {print "not ok 1\n" unless $loaded;}
+use FS::category_Common;
+$loaded=1;
+print "ok 1\n";
diff --git a/FS/t/class_Common.t b/FS/t/class_Common.t
new file mode 100644
index 000000000..9ac809b0b
--- /dev/null
+++ b/FS/t/class_Common.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n" }
+END {print "not ok 1\n" unless $loaded;}
+use FS::class_Common;
+$loaded=1;
+print "ok 1\n";