[freeside-commits] freeside/FS/FS Schema.pm, 1.167, 1.168 cust_main.pm, 1.463, 1.464
Ivan,,,
ivan at wavetail.420.am
Fri Oct 9 16:59:26 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv18717/FS/FS
Modified Files:
Schema.pm cust_main.pm
Log Message:
change invoice terms for one-time charges (& bill them immediately), RT#5891
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- Schema.pm 5 Oct 2009 00:49:33 -0000 1.167
+++ Schema.pm 9 Oct 2009 23:59:24 -0000 1.168
@@ -390,15 +390,23 @@
'cust_bill' => {
'columns' => [
+ #regular fields
'invnum', 'serial', '', '', '', '',
'custnum', 'int', '', '', '', '',
'_date', @date_type, '', '',
'charged', @money_type, '', '',
+ 'invoice_terms', 'varchar', 'NULL', $char_d, '', '',
+
+ #customer balance info at invoice generation time
'previous_balance', @money_typen, '', '', #eventually not nullable
'billing_balance', @money_typen, '', '', #eventually not nullable
+
+ #deprecated (unused by now, right?)
'printed', 'int', '', '', '', '',
+
+ #specific use cases
'closed', 'char', 'NULL', 1, '', '',
- 'statementnum', 'int', 'NULL', '', '', '',
+ 'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements
],
'primary_key' => 'invnum',
'unique' => [],
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.463
retrieving revision 1.464
diff -u -d -r1.463 -r1.464
--- cust_main.pm 9 Oct 2009 21:37:02 -0000 1.463
+++ cust_main.pm 9 Oct 2009 23:59:24 -0000 1.464
@@ -2475,6 +2475,11 @@
fees since the last billing. Setup charges may be charged. Not all package
plans support this feature (they tend to charge 0).
+=item invoice_terms
+
+Options terms to be printed on this invocice. Otherwise, customer-specific
+terms or the default terms are used.
+
=back
=cut
@@ -2801,6 +2806,7 @@
'charged' => $charged,
'billing_balance' => $balance,
'previous_balance' => $previous_balance,
+ 'invoice_terms' => $options{'invoice_terms'},
} );
$error = $cust_bill->insert;
if ( $error ) {
@@ -7172,6 +7178,10 @@
#will be filled in with the new object
'cust_pkg_ref' => \$cust_pkg,
+
+ #generate an invoice immediately
+ 'bill_now' => 0,
+ 'invoice_terms' => '', #with these terms
}
);
@@ -7188,6 +7198,7 @@
my ( $setuptax, $taxclass ); #internal taxes
my ( $taxproduct, $override ); #vendor (CCH) taxes
my $cust_pkg_ref = '';
+ my ( $bill_now, $invoice_terms ) = ( 0, '' );
if ( ref( $_[0] ) ) {
$amount = $_[0]->{amount};
$quantity = exists($_[0]->{quantity}) ? $_[0]->{quantity} : 1;
@@ -7202,6 +7213,8 @@
$taxproduct = $_[0]->{taxproductnum};
$override = { '' => $_[0]->{tax_override} };
$cust_pkg_ref = exists($_[0]->{cust_pkg_ref}) ? $_[0]->{cust_pkg_ref} : '';
+ $bill_now = exists($_[0]->{bill_now}) ? $_[0]->{bill_now} : '';
+ $invoice_terms = exists($_[0]->{invoice_terms}) ? $_[0]->{invoice_terms} : '';
} else {
$amount = shift;
$quantity = 1;
@@ -7277,8 +7290,18 @@
${$cust_pkg_ref} = $cust_pkg;
}
+ if ( $bill_now ) {
+ my $error = $self->bill( 'invoice_terms' => $invoice_terms,
+ 'pkg_list' => [ $cust_pkg ],
+ );
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ }
+
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
- '';
+ return '';
}
More information about the freeside-commits
mailing list