[freeside-commits] freeside/FS/FS cust_main.pm, 1.362, 1.363 part_pkg.pm, 1.76, 1.77
Jeff Finucane,420,,
jeff at wavetail.420.am
Thu Aug 28 14:32:23 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv22114/FS/FS
Modified Files:
cust_main.pm part_pkg.pm
Log Message:
taxproduct selection for one time charges
Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- part_pkg.pm 28 Aug 2008 07:38:39 -0000 1.76
+++ part_pkg.pm 28 Aug 2008 21:32:20 -0000 1.77
@@ -144,6 +144,10 @@
In conjunction with I<cust_pkg>, if I<custnum_ref> is set to a scalar reference,
the scalar will be updated with the custnum value from the cust_pkg record.
+If I<tax_overrides> is set to a hashref with usage classes as keys and comma
+separated tax class numbers as values, appropriate FS::part_pkg_taxoverride
+records will be inserted.
+
If I<options> is set to a hashref of options, appropriate FS::part_pkg_option
records will be inserted.
@@ -191,6 +195,22 @@
}
}
+ warn " inserting part_pkg_taxoverride records" if $DEBUG;
+ my %overrides = %{ $options{'tax_overrides'} || {} };
+ foreach my $usage_class ( keys %overrides ) {
+ my @overrides = (grep "$_", split (',', $overrides{$usage_class}) );
+ my $error = $self->process_m2m (
+ 'link_table' => 'part_pkg_taxoverride',
+ 'target_table' => 'tax_class',
+ 'hashref' => { 'usage_class' => $usage_class },
+ 'params' => \@overrides,
+ );
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ }
+
warn " inserting pkg_svc records" if $DEBUG;
my $pkg_svc = $options{'pkg_svc'} || {};
foreach my $part_svc ( qsearch('part_svc', {} ) ) {
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.362
retrieving revision 1.363
diff -u -d -r1.362 -r1.363
--- cust_main.pm 28 Aug 2008 07:38:38 -0000 1.362
+++ cust_main.pm 28 Aug 2008 21:32:20 -0000 1.363
@@ -4892,6 +4892,7 @@
sub charge {
my $self = shift;
my ( $amount, $quantity, $pkg, $comment, $taxclass, $additional, $classnum );
+ my ( $taxproduct, $override );
if ( ref( $_[0] ) ) {
$amount = $_[0]->{amount};
$quantity = exists($_[0]->{quantity}) ? $_[0]->{quantity} : 1;
@@ -4901,6 +4902,8 @@
$taxclass = exists($_[0]->{taxclass}) ? $_[0]->{taxclass} : '';
$classnum = exists($_[0]->{classnum}) ? $_[0]->{classnum} : '';
$additional = $_[0]->{additional};
+ $taxproduct = $_[0]->{taxproductnum};
+ $override = { '' => $_[0]->{tax_override} };
}else{
$amount = shift;
$quantity = 1;
@@ -4922,13 +4925,14 @@
my $dbh = dbh;
my $part_pkg = new FS::part_pkg ( {
- 'pkg' => $pkg,
- 'comment' => $comment,
- 'plan' => 'flat',
- 'freq' => 0,
- 'disabled' => 'Y',
- 'classnum' => $classnum ? $classnum : '',
- 'taxclass' => $taxclass,
+ 'pkg' => $pkg,
+ 'comment' => $comment,
+ 'plan' => 'flat',
+ 'freq' => 0,
+ 'disabled' => 'Y',
+ 'classnum' => $classnum ? $classnum : '',
+ 'taxclass' => $taxclass,
+ 'taxproductnum' => $taxproduct,
} );
my %options = ( ( map { ("additional_info$_" => $additional->[$_] ) }
@@ -4938,7 +4942,9 @@
'setup_fee' => $amount,
);
- my $error = $part_pkg->insert( options => \%options );
+ my $error = $part_pkg->insert( options => \%options,
+ tax_overrides => $override,
+ );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
More information about the freeside-commits
mailing list