=head1 DESCRIPTION
An FS::cust_credit_bill object represents application of a credit (see
-L<FS::cust_credit>) to an invoice (see L<FS::cust_bill>). FS::cust_credit
+L<FS::cust_credit>) to an invoice (see L<FS::cust_bill>). FS::cust_credit_bill
inherits from FS::Record. The following fields are currently supported:
=over 4
Adds this cust_credit_bill to the database ("Posts" all or part of a credit).
If there is an error, returns the error, otherwise returns false.
-sub insert {
- my $self = shift;
- my $error = $self->SUPER::insert(@_);
- return $error if $error;
-
- if ( $conf->exists('invoice_send_receipts') ) {
- my $send_error = $self->cust_bill->send;
- warn "Error sending receipt: $send_error\n" if $send_error;
- }
-
- '';
-}
-
=item delete
Currently unimplemented.
=cut
sub delete {
- return "Can't unapply credit!"
+ my $self = shift;
+ return "Can't delete application for closed credit"
+ if $self->cust_credit->closed =~ /^Y/i;
+ $self->SUPER::delete(@_);
}
=item replace OLD_RECORD