diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-03-24 13:16:41 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-03-24 13:16:41 -0700 |
commit | 172673b3aef143dc426603689d37b65394c4fe1d (patch) | |
tree | 7d7af6c967411dbb4ccabfe6746b487a71eb6224 /FS | |
parent | 5c4da92af240d4a5d7f39e2478e344693817d5b7 (diff) |
enhance contacts: contact classes, RT#16819
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS.pm | 2 | ||||
-rw-r--r-- | FS/FS/Schema.pm | 17 | ||||
-rw-r--r-- | FS/FS/contact_class.pm | 94 | ||||
-rw-r--r-- | FS/MANIFEST | 2 | ||||
-rw-r--r-- | FS/t/contact_class.t | 5 |
5 files changed, 117 insertions, 3 deletions
@@ -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"; |