X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=8b326a56fab6436f90dbfc46a087946a0ce7457d;hb=1aa750eba2b9b73b4f09f28b9acd748ee3669bd4;hp=1a2ecaf1d75a797b77932cd64e7ccfbc06f4ef57;hpb=ff600bea7c4f34854be39bc4a6b56f20c1605c4d;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 1a2ecaf1d..8b326a56f 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -91,6 +91,8 @@ L and L for conversion functions. =item printed - how many times this invoice has been printed automatically (see L). +=item closed - books closed flag, empty or `Y' + =back =head1 METHODS @@ -120,7 +122,9 @@ no record you ever posted this invoice (which is bad, no?) =cut sub delete { - return "Can't remove invoice!" + my $self = shift; + return "Can't delete closed invoice" if $self->closed =~ /^Y/i; + $self->SUPER::delete(@_); } =item replace OLD_RECORD @@ -160,6 +164,7 @@ sub check { || $self->ut_numbern('_date') || $self->ut_money('charged') || $self->ut_numbern('printed') + || $self->ut_enum('closed', [ '', 'Y' ]) ; return $error if $error; @@ -297,6 +302,8 @@ sub owed { $balance -= $_->amount foreach ( $self->cust_bill_pay ); $balance -= $_->amount foreach ( $self->cust_credited ); $balance = sprintf( "%.2f", $balance); + $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp + $balance; } =item print_text [TIME]; @@ -493,7 +500,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.13 2001-12-17 23:59:56 ivan Exp $ +$Id: cust_bill.pm,v 1.15 2002-01-28 06:57:23 ivan Exp $ =head1 BUGS