[freeside-commits] branch master updated. 172673b3aef143dc426603689d37b65394c4fe1d

Ivan ivan at 420.am
Sat Mar 24 13:16:49 PDT 2012


The branch, master has been updated
       via  172673b3aef143dc426603689d37b65394c4fe1d (commit)
      from  5c4da92af240d4a5d7f39e2478e344693817d5b7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 172673b3aef143dc426603689d37b65394c4fe1d
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Mar 24 13:16:41 2012 -0700

    enhance contacts: contact classes, RT#16819

diff --git a/FS/FS.pm b/FS/FS.pm
index c3a1ac2..830a4a4 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 a36d2dc..67b6823 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 0000000..5fe2b38
--- /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 49d27b4..f0a4a9d 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 0000000..b4164c0
--- /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 0000000..88df24b
--- /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 0000000..2e0965d
--- /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 0000000..3a73cc6
--- /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 c65e990..f096dd8 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, '' ]

-----------------------------------------------------------------------

Summary of changes:
 FS/FS.pm                                           |    2 +
 FS/FS/Schema.pm                                    |   17 ++++++-
 FS/FS/{cust_note_class.pm => contact_class.pm}     |   43 +++++++------------
 FS/MANIFEST                                        |    2 +
 FS/t/{AccessRight.t => contact_class.t}            |    2 +-
 .../{cust_note_class.html => contact_class.html}   |   16 ++++----
 httemplate/edit/contact_class.html                 |    6 +++
 .../{cust_category.html => contact_class.html}     |    2 +-
 httemplate/elements/menu.html                      |    5 ++-
 9 files changed, 54 insertions(+), 41 deletions(-)
 copy FS/FS/{cust_note_class.pm => contact_class.pm} (58%)
 copy FS/t/{AccessRight.t => contact_class.t} (81%)
 copy httemplate/browse/{cust_note_class.html => contact_class.html} (57%)
 create mode 100644 httemplate/edit/contact_class.html
 copy httemplate/edit/process/{cust_category.html => contact_class.html} (80%)




More information about the freeside-commits mailing list