freeside/FS/FS cust_pkg.pm,1.52,1.53

ivan ivan at pouncequick.420.am
Wed Jan 19 13:25:46 PST 2005


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory pouncequick:/tmp/cvs-serv1952

Modified Files:
	cust_pkg.pm 
Log Message:
credit for unused portion at cancellation, patch from pbowen

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- cust_pkg.pm	19 Jan 2005 00:57:11 -0000	1.52
+++ cust_pkg.pm	19 Jan 2005 21:25:43 -0000	1.53
@@ -376,6 +376,16 @@
     }
   }
 
+  # Add a credit for remaining service
+  my $remaining_value= $self->calc_remain();
+  if ($remaining_value > 0) {
+    my $error = $self->credit($remaining_value, 'Credit for service remaining');
+    if ($error) {
+      $dbh->rollback if $oldAutoCommit;
+      return "Error crediting customer for service remaining: $error";
+    }                                                                          
+  }                                                                            
+
   unless ( $self->getfield('cancel') ) {
     my %hash = $self->hash;
     $hash{'cancel'} = time;
@@ -590,6 +600,30 @@
 sub calc_recur {
   my $self = shift;
   $self->part_pkg->calc_recur($self, @_);
+}
+
+=item calc_remain
+
+Calls the I<calc_remain> of the FS::part_pkg object associated with this
+billing item.
+
+=cut
+
+sub calc_recur {
+  my $self = shift;
+  $self->part_pkg->calc_remain($self, @_);
+}
+
+=item calc_cancel
+
+Calls the I<calc_cancel> of the FS::part_pkg object associated with this
+billing item.
+
+=cut
+
+sub calc_cancel {
+  my $self = shift;
+  $self->part_pkg->calc_cancel($self, @_);
 }
 
 =item cust_svc [ SVCPART ]




More information about the freeside-commits mailing list