[freeside-commits] freeside/FS/FS cust_bill.pm,1.306,1.307
Erik Levinson
levinse at wavetail.420.am
Sat Jan 22 20:56:12 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv17423/FS/FS
Modified Files:
cust_bill.pm
Log Message:
add possibly finished credit card surcharge, RT11237
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.306
retrieving revision 1.307
diff -u -w -d -r1.306 -r1.307
--- cust_bill.pm 21 Jan 2011 22:17:30 -0000 1.306
+++ cust_bill.pm 23 Jan 2011 04:56:09 -0000 1.307
@@ -286,11 +286,40 @@
#return "Can't change _date!" unless $old->_date eq $new->_date;
return "Can't change _date" unless $old->_date == $new->_date;
return "Can't change charged" unless $old->charged == $new->charged
- || $old->charged == 0;
+ || $old->charged == 0
+ || $new->{'Hash'}{'cc_surcharge_replace_hack'};
'';
}
+
+=item add_cc_surcharge
+
+Giant hack
+
+=cut
+
+sub add_cc_surcharge {
+ my ($self, $pkgnum, $amount) = (shift, shift, shift);
+
+ my $error;
+ my $cust_bill_pkg = new FS::cust_bill_pkg({
+ 'invnum' => $self->invnum,
+ 'pkgnum' => $pkgnum,
+ 'setup' => $amount,
+ });
+ $error = $cust_bill_pkg->insert;
+ return $error if $error;
+
+ $self->{'Hash'}{'cc_surcharge_replace_hack'} = 1;
+ $self->charged($self->charged+$amount);
+ $error = $self->replace;
+ return $error if $error;
+
+ $self->apply_payments_and_credits;
+}
+
+
=item check
Checks all fields to make sure this is a valid invoice. If there is an error,
More information about the freeside-commits
mailing list