[freeside-commits] freeside/FS/FS Conf.pm, 1.397.2.22, 1.397.2.23 Mason.pm, 1.55.2.2, 1.55.2.3 Schema.pm, 1.239.2.17, 1.239.2.18 cust_main.pm, 1.568.2.5, 1.568.2.6 cust_main_note.pm, 1.5, 1.5.4.1 cust_note_class.pm, NONE, 1.1.2.2
Erik Levinson
levinse at wavetail.420.am
Wed Jan 26 21:10:11 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv22046/FS/FS
Modified Files:
Tag: FREESIDE_2_1_BRANCH
Conf.pm Mason.pm Schema.pm cust_main.pm cust_main_note.pm
Added Files:
Tag: FREESIDE_2_1_BRANCH
cust_note_class.pm
Log Message:
note classes backport to 2.1 branch, RT9995
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.397.2.22
retrieving revision 1.397.2.23
diff -u -w -d -r1.397.2.22 -r1.397.2.23
--- Conf.pm 20 Jan 2011 09:55:14 -0000 1.397.2.22
+++ Conf.pm 27 Jan 2011 05:10:08 -0000 1.397.2.23
@@ -4236,6 +4236,18 @@
'select_enum' => [ 'Classic', 'Recurring' ],
},
+ {
+ 'key' => 'note-classes',
+ 'section' => 'UI',
+ 'description' => 'Use customer note classes',
+ 'type' => 'select',
+ 'select_hash' => [
+ 0 => 'Disabled',
+ 1 => 'Enabled',
+ 2 => 'Enabled, with tabs',
+ ],
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
Index: cust_main_note.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main_note.pm,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -w -d -r1.5 -r1.5.4.1
--- cust_main_note.pm 4 Apr 2010 23:27:35 -0000 1.5
+++ cust_main_note.pm 27 Jan 2011 05:10:09 -0000 1.5.4.1
@@ -4,6 +4,7 @@
use base qw( FS::otaker_Mixin FS::Record );
use Carp;
use FS::Record qw( qsearch qsearchs );
+use FS::cust_note_class;
=head1 NAME
@@ -38,6 +39,8 @@
=item custnum
+=item classnum
+
=item _date
=item usernum
@@ -106,6 +109,7 @@
my $error =
$self->ut_numbern('notenum')
|| $self->ut_number('custnum')
+ || $self->ut_foreign_keyn('classnum', 'cust_note_class', 'classnum')
|| $self->ut_numbern('_date')
|| $self->ut_textn('otaker')
|| $self->ut_anything('comments')
@@ -115,6 +119,36 @@
$self->SUPER::check;
}
+=item cust_note_class
+
+Returns the customer note class, as an FS::cust_note_class object, or the empty
+string if there is no note class.
+
+=cut
+
+sub cust_note_class {
+ my $self = shift;
+ if ( $self->classnum ) {
+ qsearchs('cust_note_class', { 'classnum' => $self->classnum } );
+ } else {
+ return '';
+ }
+}
+
+=item classname
+
+Returns the customer note class name, or the empty string if there is no
+customer note class.
+
+=cut
+
+sub classname {
+ my $self = shift;
+ my $cust_note_class = $self->cust_note_class;
+ $cust_note_class ? $cust_note_class->classname : '';
+}
+
+
#false laziness w/otaker_Mixin & cust_attachment
sub otaker {
my $self = shift;
Index: Mason.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Mason.pm,v
retrieving revision 1.55.2.2
retrieving revision 1.55.2.3
diff -u -w -d -r1.55.2.2 -r1.55.2.3
--- Mason.pm 8 Nov 2010 21:54:49 -0000 1.55.2.2
+++ Mason.pm 27 Jan 2011 05:10:08 -0000 1.55.2.3
@@ -258,6 +258,7 @@
use FS::acct_snarf;
use FS::part_pkg_discount;
use FS::svc_cert;
+ use FS::cust_note_class;
# Sammath Naur
if ( $FS::Mason::addl_handler_use ) {
--- NEW FILE: cust_note_class.pm ---
package FS::cust_note_class;
use strict;
use base qw( FS::class_Common );
use FS::cust_main_note;
=head1 NAME
FS::cust_note_class - Object methods for cust_note_class records
=head1 SYNOPSIS
use FS::cust_note_class;
$record = new FS::cust_note_class \%hash;
$record = new FS::cust_note_class { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
=head1 DESCRIPTION
An FS::cust_note_class object represents a customer note class. Every customer
note (see L<FS::cust_main_note) has, optionally, a note class. This class
inherits from FS::class_Common. The following fields are currently supported:
=over 4
=item classnum
primary key
=item classname
classname
=item disabled
disabled
=back
=head1 METHODS
=over 4
=item new HASHREF
Creates a new customer note class. To add the note class 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 { 'cust_note_class'; }
sub _target_table { 'cust_main_note'; }
=item insert
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
=cut
=item delete
Delete this record from the database.
=cut
=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
=item check
Checks all fields to make sure this is a valid note class. If there is
an error, returns the error, otherwise returns false. Called by the insert
and replace methods.
=cut
=back
=head1 BUGS
=head1 SEE ALSO
L<FS::cust_main_note>, L<FS::Record>, schema.html from the base documentation.
=cut
1;
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.568.2.5
retrieving revision 1.568.2.6
diff -u -w -d -r1.568.2.5 -r1.568.2.6
--- cust_main.pm 20 Jan 2011 23:05:58 -0000 1.568.2.5
+++ cust_main.pm 27 Jan 2011 05:10:08 -0000 1.568.2.6
@@ -2211,12 +2211,13 @@
=cut
sub notes {
- my $self = shift;
- #order by?
+ my($self,$orderby_classnum) = (shift,shift);
+ my $orderby = "_DATE DESC";
+ $orderby = "CLASSNUM ASC, $orderby" if $orderby_classnum;
qsearch( 'cust_main_note',
{ 'custnum' => $self->custnum },
'',
- 'ORDER BY _DATE DESC'
+ "ORDER BY $orderby",
);
}
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.239.2.17
retrieving revision 1.239.2.18
diff -u -w -d -r1.239.2.17 -r1.239.2.18
--- Schema.pm 22 Jan 2011 20:03:51 -0000 1.239.2.17
+++ Schema.pm 27 Jan 2011 05:10:08 -0000 1.239.2.18
@@ -930,6 +930,7 @@
'columns' => [
'notenum', 'serial', '', '', '', '',
'custnum', 'int', '', '', '', '',
+ 'classnum', 'int', 'NULL', '', '', '',
'_date', @date_type, '', '',
'otaker', 'varchar', 'NULL', 32, '', '',
'usernum', 'int', 'NULL', '', '', '',
@@ -940,6 +941,17 @@
'index' => [ [ 'custnum' ], [ '_date' ], [ 'usernum' ], ],
},
+ 'cust_note_class' => {
+ 'columns' => [
+ 'classnum', 'serial', '', '', '', '',
+ 'classname', 'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'classnum',
+ 'unique' => [],
+ 'index' => [ ['disabled'] ],
+ },
+
'cust_category' => {
'columns' => [
'categorynum', 'serial', '', '', '', '',
More information about the freeside-commits
mailing list