From: ivan Date: Wed, 3 Jul 2002 03:47:40 +0000 (+0000) Subject: one-time charges with tax classes X-Git-Tag: freeside_1_4_0_beta1~13 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=2c9b97801b3981efaf6c65118e3cc1a0368e649c;ds=sidebyside one-time charges with tax classes --- diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 9ed3f2cab..6edb6ae8f 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1734,7 +1734,7 @@ sub credit { $cust_credit->insert; } -=item charge AMOUNT PKG COMMENT +=item charge AMOUNT [ PKG [ COMMENT [ TAXCLASS ] ] ] Creates a one-time charge for this customer. If there is an error, returns the error, otherwise returns false. @@ -1742,7 +1742,10 @@ the error, otherwise returns false. =cut sub charge { - my ( $self, $amount, $pkg, $comment ) = @_; + my ( $self, $amount ) = @_; + my $pkg = @_ ? shift : 'One-time charge'; + my $comment = @_ ? shift : '$'. sprintf("%.2f",$amount); + my $taxclass = @_ ? shift : ''; local $SIG{HUP} = 'IGNORE'; local $SIG{INT} = 'IGNORE'; @@ -1756,12 +1759,13 @@ sub charge { my $dbh = dbh; my $part_pkg = new FS::part_pkg ( { - 'pkg' => $pkg || 'One-time charge', - 'comment' => $comment || '$'. sprintf("%.2f",$amount), + 'pkg' => $pkg, + 'comment' => $comment, 'setup' => $amount, 'freq' => 0, 'recur' => '0', 'disabled' => 'Y', + 'taxclass' => $taxclass, } ); my $error = $part_pkg->insert; diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 19545bd12..08d5dc906 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -89,6 +89,7 @@ print '>'; print ''; my $conf = new FS::Conf; +#false laziness w/ view/cust_main.cgi quick order if ( $conf->exists('enable_taxclasses') ) { print 'Tax class!. qq!Description:!. qq! Amount:!. - qq! 
!; + qq! !; + +#false laziness w/ edit/part_pkg.cgi +if ( $conf->exists('enable_taxclasses') ) { + print ''; +} else { + print ''; +} + +print qq!
!; print <