[freeside-commits] freeside/FS/FS AccessRight.pm, 1.9, 1.10 Conf.pm, 1.159, 1.160 cust_main_note.pm, NONE, 1.1 cust_main.pm, 1.243, 1.244 Schema.pm, 1.29, 1.30

Jeff Finucane,420,, jeff at wavetail.420.am
Tue Oct 3 15:44:29 PDT 2006


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv13462/FS/FS

Modified Files:
	AccessRight.pm Conf.pm cust_main.pm Schema.pm 
Added Files:
	cust_main_note.pm 
Log Message:
Enhanced customer notes

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- Schema.pm	15 Sep 2006 05:10:36 -0000	1.29
+++ Schema.pm	3 Oct 2006 22:44:27 -0000	1.30
@@ -473,6 +473,19 @@
       'index' => [ ['custnum'], ],
     },
 
+    'cust_main_note' => {
+      'columns' => [
+        'notenum',  'serial',  '',     '', '', '', 
+        'custnum',  'int',  '',     '', '', '', 
+        '_date',    @date_type, '', '', 
+        'otaker',   'varchar', '',    32, '', '', 
+        'comments', 'text', 'NULL', '', '', '', 
+      ],
+      'primary_key' => 'notenum',
+      'unique' => [],
+      'index' => [ [ 'custnum' ], [ '_date' ], ],
+    },
+
     'cust_main_county' => { #county+state+country are checked off the
                             #cust_main_county for validation and to provide
                             # a tax rate.

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- Conf.pm	1 Sep 2006 01:51:45 -0000	1.159
+++ Conf.pm	3 Oct 2006 22:44:26 -0000	1.160
@@ -1744,6 +1744,27 @@
   },
 
   {
+    'key'         => 'cust_main-use_comments',
+    'section'     => 'UI',
+    'description' => 'Display free form comments on the customer edit screen.  Useful as a scratch pad.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'cust_main-use_notes',
+    'section'     => 'UI',
+    'description' => 'Display link to add timestamped and user identified customr notes.  Useful in tracking who did what.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'cust_main_note-display_times',
+    'section'     => 'UI',
+    'description' => 'Display full timestamps (not just dates) for customer notes.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cust_main-ticket_statuses',
     'section'     => 'UI',
     'description' => 'Show tickets with these statuses on the customer view page.',

--- NEW FILE: cust_main_note.pm ---
package FS::cust_main_note;

use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );

@ISA = qw(FS::Record);

=head1 NAME

FS::cust_main_note - Object methods for cust_main_note records

=head1 SYNOPSIS

  use FS::cust_main_note;

  $record = new FS::cust_main_note \%hash;
  $record = new FS::cust_main_note { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::cust_main_note object represents a note attachted to a customer.
FS::cust_main_note inherits from FS::Record.  The following fields are
currently supported:

=over 4

=item notenum - primary key

=item custnum - 

=item _date - 

=item otaker - 

=item comments - 


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new customer note.  To add the note 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

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'cust_main_note'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=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.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid example.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('notenum')
    || $self->ut_number('custnum')
    || $self->ut_numbern('_date')
    || $self->ut_text('otaker')
    || $self->ut_anything('comments')
  ;
  return $error if $error;

  $self->SUPER::check;
}

=back

=head1 BUGS

Lurking in the cracks.

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;


Index: AccessRight.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/AccessRight.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- AccessRight.pm	15 Sep 2006 19:15:34 -0000	1.9
+++ AccessRight.pm	3 Oct 2006 22:44:26 -0000	1.10
@@ -92,6 +92,7 @@
   'Cancel customer',
   'Complimentary customer', #aka users-allow_comp 
   'Delete customer', #aka. deletecustomers #Enable customer deletions. Be very careful! Deleting a customer will remove all traces that this customer ever existed! It should probably only be used when auditing a legacy database. Normally, you cancel all of a customers' packages if they cancel service.
+  'Add customer note',
 
 ###
 # customer package rights

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -d -r1.243 -r1.244
--- cust_main.pm	26 Aug 2006 23:15:12 -0000	1.243
+++ cust_main.pm	3 Oct 2006 22:44:26 -0000	1.244
@@ -1732,6 +1732,22 @@
   };
 }
 
+=item notes
+
+Returns all notes (see L<FS::cust_main_note>) for this customer.
+
+=cut
+
+sub notes {
+  my $self = shift;
+  #order by?
+  qsearch( 'cust_main_note',
+           { 'custnum' => $self->custnum },
+	   '',
+	   'ORDER BY _DATE DESC'
+	 );
+}
+
 =item agent
 
 Returns the agent (see L<FS::agent>) for this customer.



More information about the freeside-commits mailing list