[freeside-commits]
freeside/FS/FS pkg_class.pm, NONE, 1.1 Schema.pm,
1.9, 1.10 part_pkg.pm, 1.44, 1.45 cust_tax_exempt_pkg.pm, 1.1, 1.2
Ivan,,,
ivan at wavetail.420.am
Thu Jan 26 07:27:12 PST 2006
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv31728/FS/FS
Modified Files:
Schema.pm part_pkg.pm cust_tax_exempt_pkg.pm
Added Files:
pkg_class.pm
Log Message:
whew, FINALLY can fix monthly exemption columns to work correctly. also make them agent-specific. also fix package exemption columns, they were bunk too, sheesh. start adding package classes for package class tax reporting.
Index: cust_tax_exempt_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_tax_exempt_pkg.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_tax_exempt_pkg.pm 25 Jan 2006 12:34:28 -0000 1.1
+++ cust_tax_exempt_pkg.pm 26 Jan 2006 15:27:10 -0000 1.2
@@ -3,10 +3,11 @@
use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch qsearchs );
+use FS::cust_main_Mixin;
use FS::cust_bill_pkg;
use FS::cust_main_county;
- at ISA = qw(FS::Record);
+ at ISA = qw( FS::cust_main_Mixin FS::Record );
=head1 NAME
Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- part_pkg.pm 7 Oct 2005 02:25:40 -0000 1.44
+++ part_pkg.pm 26 Jan 2006 15:27:10 -0000 1.45
@@ -438,6 +438,13 @@
;
return $error if $error;
+ if ( $self->classnum !~ /^$/ ) {
+ my $error = $self->ut_foreign_key('classnum', 'pkg_class', 'classnum');
+ return $error if $error;
+ } else {
+ $self->classnum('');
+ }
+
return 'Unknown plan '. $self->plan
unless exists($plans{$self->plan});
--- NEW FILE: pkg_class.pm ---
package FS::pkg_class;
use strict;
use vars qw( @ISA );
use FS::Record qw( qsearch );
use FS::part_pkg;
@ISA = qw( FS::Record );
=head1 NAME
FS::pkg_class - Object methods for pkg_class records
=head1 SYNOPSIS
use FS::pkg_class;
$record = new FS::pkg_class \%hash;
$record = new FS::pkg_class { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
=head1 DESCRIPTION
An FS::pkg_class object represents an package class. Every package definition
(see L<FS::part_pkg>) has, optionally, a package class. FS::pkg_class inherits
from FS::Record. The following fields are currently supported:
=over 4
=item classnum - primary key (assigned automatically for new package classes)
=item classname - Text name of this package class
=back
=head1 METHODS
=over 4
=item new HASHREF
Creates a new package class. To add the package class to the database, see
L<"insert">.
=cut
sub table { 'pkg_class'; }
=item insert
Adds this package class to the database. If there is an error, returns the
error, otherwise returns false.
=item delete
Deletes this package class from the database. Only package classes with no
associated package definitions can be deleted. If there is an error, returns
the error, otherwise returns false.
=cut
sub delete {
my $self = shift;
return "Can't delete an pkg_class with part_pkg records!"
if qsearch( 'part_pkg', { 'classnum' => $self->classnum } );
$self->SUPER::delete;
}
=item replace OLD_RECORD
Replaces 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 package class. If there is an
error, returns the error, otherwise returns false. Called by the insert and
replace methods.
=cut
sub check {
my $self = shift;
$self->ut_numbern('classnum')
or $self->ut_text('classname')
or $self->SUPER::check;
}
=back
=head1 BUGS
=head1 SEE ALSO
L<FS::Record>, L<FS::part_pkg>, schema.html from the base documentation.
=cut
1;
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Schema.pm 25 Jan 2006 12:34:28 -0000 1.9
+++ Schema.pm 26 Jan 2006 15:27:10 -0000 1.10
@@ -625,6 +625,7 @@
'plandata', 'text', 'NULL', '',
'disabled', 'char', 'NULL', 1,
'taxclass', 'varchar', 'NULL', $char_d,
+ 'classnum', 'int', 'NULL', '',
],
'primary_key' => 'pkgpart',
'unique' => [],
@@ -1277,6 +1278,16 @@
'index' => [ [ 'disabled' ] ],
},
+ 'pkg_class' => {
+ 'columns' => [
+ 'classnum', 'serial', '', '',
+ 'classname', 'varchar', '', $char_d,
+ ],
+ 'primary_key' => 'classnum',
+ 'unique' => [],
+ 'index' => [],
+ },
+
};
}
More information about the freeside-commits
mailing list