summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS.pm2
-rw-r--r--FS/FS/Schema.pm17
-rw-r--r--FS/FS/contact_class.pm94
-rw-r--r--FS/MANIFEST2
-rw-r--r--FS/t/contact_class.t5
-rw-r--r--httemplate/browse/contact_class.html34
-rw-r--r--httemplate/edit/contact_class.html6
-rw-r--r--httemplate/edit/process/contact_class.html11
-rw-r--r--httemplate/elements/menu.html5
9 files changed, 172 insertions, 4 deletions
diff --git a/FS/FS.pm b/FS/FS.pm
index c3a1ac2f6..830a4a450 100644
--- a/FS/FS.pm
+++ b/FS/FS.pm
@@ -294,6 +294,8 @@ L<FS::reason> - Reason class
L<FS::cust_pkg_reason> - Package reason class
+L<FS::contact_class> - Contact class class
+
L<FS::contact> - Contact class
L<FS::contact_phone> - Contact phone class
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index a36d2dcdb..67b682360 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -938,7 +938,7 @@ sub tables_hashref {
],
},
- 'cust_recon' => { # what purpose does this serve?
+ 'cust_recon' => { # (some sort of not-well understood thing for OnPac)
'columns' => [
'reconid', 'serial', '', '', '', '',
'recondate', @date_type, '', '',
@@ -964,7 +964,17 @@ sub tables_hashref {
'index' => [],
},
- #eventually for cust_main too
+ 'contact_class' => {
+ 'columns' => [
+ 'classnum', 'serial', '', '', '', '',
+ 'classname', 'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'classnum',
+ 'unique' => [],
+ 'index' => [ ['disabled'] ],
+ },
+
'contact' => {
'columns' => [
'contactnum', 'serial', '', '', '', '',
@@ -1586,7 +1596,8 @@ sub tables_hashref {
'percent', 'decimal', '', '7,4', '', '',
'months', 'decimal', 'NULL', '7,4', '', '',
'disabled', 'char', 'NULL', 1, '', '',
- 'setup', 'char', 'NULL', 1, '', '',
+ 'setup', 'char', 'NULL', 1, '', '',
+ #'linked', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'discountnum',
'unique' => [],
diff --git a/FS/FS/contact_class.pm b/FS/FS/contact_class.pm
new file mode 100644
index 000000000..5fe2b38ed
--- /dev/null
+++ b/FS/FS/contact_class.pm
@@ -0,0 +1,94 @@
+package FS::contact_class;
+use base qw( FS::class_Common );
+
+use strict;
+use FS::Record qw( qsearch qsearchs );
+
+=head1 NAME
+
+FS::contact_class - Object methods for contact_class records
+
+=head1 SYNOPSIS
+
+ use FS::contact_class;
+
+ $record = new FS::contact_class \%hash;
+ $record = new FS::contact_class { 'column' => 'value' };
+
+ $error = $record->insert;
+
+ $error = $new_record->replace($old_record);
+
+ $error = $record->delete;
+
+ $error = $record->check;
+
+=head1 DESCRIPTION
+
+An FS::contact_class object represents a contact class. FS::contact_class
+inherits from FS::class_Common. The following fields are currently supported:
+
+=over 4
+
+=item classnum
+
+primary key
+
+=item classname
+
+Class name
+
+=item disabled
+
+Disabled flag
+
+=back
+
+=head1 METHODS
+
+=over 4
+
+=item new HASHREF
+
+Creates a new example. To add the example to the database, see L<"insert">.
+
+Note that this stores the hash reference, not a distinct copy of the hash it
+points to. You can ask the object for a copy with the I<hash> method.
+
+=cut
+
+sub table { 'contact_class'; }
+
+=item insert
+
+Adds this record to the database. If there is an error, returns the error,
+otherwise returns false.
+
+=item delete
+
+Delete this record from the database.
+
+=item replace OLD_RECORD
+
+Replaces the OLD_RECORD with this one in the database. If there is an error,
+returns the error, otherwise returns false.
+=item check
+
+Checks all fields to make sure this is a valid class. If there is
+an error, returns the error, otherwise returns false. Called by the insert
+and replace methods.
+
+=back
+
+=head1 BUGS
+
+The author forgot to customize this manpage.
+
+=head1 SEE ALSO
+
+L<FS::Record>, schema.html from the base documentation.
+
+=cut
+
+1;
+
diff --git a/FS/MANIFEST b/FS/MANIFEST
index 49d27b437..f0a4a9d6b 100644
--- a/FS/MANIFEST
+++ b/FS/MANIFEST
@@ -630,3 +630,5 @@ FS/tower_sector.pm
t/tower_sector.t
FS/h_svc_cert.pm
t/h_svc_cert.t
+FS/contact_class.pm
+t/contact_class.t
diff --git a/FS/t/contact_class.t b/FS/t/contact_class.t
new file mode 100644
index 000000000..b4164c04a
--- /dev/null
+++ b/FS/t/contact_class.t
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n" }
+END {print "not ok 1\n" unless $loaded;}
+use FS::contact_class;
+$loaded=1;
+print "ok 1\n";
diff --git a/httemplate/browse/contact_class.html b/httemplate/browse/contact_class.html
new file mode 100644
index 000000000..88df24b40
--- /dev/null
+++ b/httemplate/browse/contact_class.html
@@ -0,0 +1,34 @@
+<% include( 'elements/browse.html',
+ 'title' => 'Contact classes',
+ 'html_init' => $html_init,
+ 'name' => 'contact classes',
+ 'disableable' => 1,
+ 'disabled_statuspos' => 1,
+ 'query' => { 'table' => 'contact_class',
+ 'hashref' => {},
+ 'order_by' => 'ORDER BY classnum',
+ },
+ 'count_query' => $count_query,
+ 'header' => $header,
+ 'fields' => $fields,
+ 'links' => $links,
+ )
+%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init =
+ 'Contact classes define types for contacts.<BR><BR>'.
+ qq!<A HREF="${p}edit/contact_class.html"><I>Add a contact class</I></A><BR><BR>!;
+
+my $count_query = 'SELECT COUNT(*) FROM contact_class';
+
+my $link = [ $p.'edit/contact_class.html?', 'classnum' ];
+
+my $header = [ '#', 'Class' ];
+my $fields = [ 'classnum', 'classname' ];
+my $links = [ $link, $link ];
+
+</%init>
diff --git a/httemplate/edit/contact_class.html b/httemplate/edit/contact_class.html
new file mode 100644
index 000000000..2e0965dab
--- /dev/null
+++ b/httemplate/edit/contact_class.html
@@ -0,0 +1,6 @@
+<% include( 'elements/class_Common.html',
+ 'name' => 'Contact Class',
+ 'table' => 'contact_class',
+ 'nocat' => 1,
+ )
+%>
diff --git a/httemplate/edit/process/contact_class.html b/httemplate/edit/process/contact_class.html
new file mode 100644
index 000000000..3a73cc6e1
--- /dev/null
+++ b/httemplate/edit/process/contact_class.html
@@ -0,0 +1,11 @@
+<% include( 'elements/process.html',
+ 'table' => 'contact_class',
+ 'viewall_dir' => 'browse',
+ )
+%>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index c65e990ae..f096dd889 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -491,9 +491,11 @@ tie my %config_cust, 'Tie::IxHash',
'Customer tags' => [ $fsurl.'browse/part_tag.html', '' ],
'Customer classes' => [ $fsurl.'browse/cust_class.html', 'Customer classes define groups of customers for reporting.' ],
'Customer categories' => [ $fsurl.'browse/cust_category.html', 'Customer categories define groups of customer classes.' ],
+ 'separator' => '', #its a separator!
+ 'Contact classes' => [ $fsurl.'browse/contact_class.html', 'Contact classes define types for contacts.' ],
;
-$config_cust{'Customer note classes'} = [ $fsurl.'browse/cust_note_class.html', 'Customer note classes define groups of notes for reporting.' ]
+$config_cust{'Note classes'} = [ $fsurl.'browse/cust_note_class.html', 'Note classes define groups of customer notes for reporting.' ]
if ($conf->exists('note-classes') && $conf->config('note-classes') > 0);
tie my %config_agent, 'Tie::IxHash',
@@ -576,6 +578,7 @@ if ( $curuser->access_right('Configuration' ) ) {
'Resellers' => [ \%config_agent, '' ],
'separator2' => '', #its a separator!
'Customers' => [ \%config_cust, '' ],
+ #or this? 'Customers and Contacts' => [ \%config_cust, '' ],
);
}
$config_menu{'Packages'} = [ \%config_pkg, '' ]