[freeside-commits] freeside/FS/FS AccessRight.pm, 1.18.2.1, 1.18.2.2 Schema.pm, 1.44.2.7, 1.44.2.8 cust_main.pm, 1.271.2.15, 1.271.2.16 cust_pkg.pm, 1.73.2.4, 1.73.2.5

Jeff Finucane,420,, jeff at wavetail.420.am
Tue Jun 26 08:36:50 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv2363/FS/FS

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	AccessRight.pm Schema.pm cust_main.pm cust_pkg.pm 
Log Message:
suspend later just like expire (#1487)

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.44.2.7
retrieving revision 1.44.2.8
diff -u -d -r1.44.2.7 -r1.44.2.8
--- Schema.pm	15 Jun 2007 00:58:18 -0000	1.44.2.7
+++ Schema.pm	26 Jun 2007 15:36:47 -0000	1.44.2.8
@@ -650,6 +650,7 @@
         'bill',      @date_type, '', '', 
         'last_bill', @date_type, '', '', 
         'susp',      @date_type, '', '', 
+        'adjourn',   @date_type, '', '', 
         'cancel',    @date_type, '', '', 
         'expire',    @date_type, '', '', 
         'manual_flag', 'char', 'NULL', 1, '', '', 

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.271.2.15
retrieving revision 1.271.2.16
diff -u -d -r1.271.2.15 -r1.271.2.16
--- cust_main.pm	21 Jun 2007 04:02:40 -0000	1.271.2.15
+++ cust_main.pm	26 Jun 2007 15:36:48 -0000	1.271.2.16
@@ -4732,7 +4732,7 @@
     my %svc_acct = ();
     foreach my $field ( @fields ) {
 
-      if ( $field =~ /^cust_pkg\.(pkgpart|setup|bill|susp|expire|cancel)$/ ) {
+      if ( $field =~ /^cust_pkg\.(pkgpart|setup|bill|susp|adjourn|expire|cancel)$/ ) {
 
         #$cust_pkg{$1} = str2time( shift @$columns );
         if ( $1 eq 'pkgpart' ) {

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.73.2.4
retrieving revision 1.73.2.5
diff -u -d -r1.73.2.4 -r1.73.2.5
--- cust_pkg.pm	21 Jun 2007 04:02:40 -0000	1.73.2.4
+++ cust_pkg.pm	26 Jun 2007 15:36:48 -0000	1.73.2.5
@@ -111,6 +111,8 @@
 
 =item last_bill - last bill date
 
+=item adjourn - date
+
 =item susp - date
 
 =item expire - date
@@ -124,7 +126,7 @@
 
 =back
 
-Note: setup, bill, susp, expire and cancel are specified as UNIX timestamps;
+Note: setup, bill, adjourn, susp, expire and cancel are specified as UNIX timestamps;
 see L<perlfunc/"time">.  Also see L<Time::Local> and L<Date::Parse> for
 conversion functions.
 
@@ -264,7 +266,7 @@
 Replaces the OLD_RECORD with this one in the database.  If there is an error,
 returns the error, otherwise returns false.
 
-Currently, custnum, setup, bill, susp, expire, and cancel may be changed.
+Currently, custnum, setup, bill, adjourn, susp, expire, and cancel may be changed.
 
 Changing pkgpart may have disasterous effects.  See the order subroutine.
 
@@ -310,13 +312,15 @@
   local $FS::UID::AutoCommit = 0;
   my $dbh = dbh;
 
-  if ($options{'reason'} && $new->expire && $old->expire ne $new->expire) {
-    my $error = $new->insert_reason( 'reason' => $options{'reason'},
-                                     'date'      => $new->expire,
-		                    );
-    if ( $error ) {
-      dbh->rollback if $oldAutoCommit;
-      return "Error inserting cust_pkg_reason: $error";
+  foreach my $method ( qw(adjourn expire) ) {  # How many reasons?
+    if ($options{'reason'} && $new->$method && $old->$method ne $new->$method) {
+      my $error = $new->insert_reason( 'reason' => $options{'reason'},
+                                       'date'      => $new->$method,
+                                     );
+      if ( $error ) {
+        dbh->rollback if $oldAutoCommit;
+        return "Error inserting cust_pkg_reason: $error";
+      }
     }
   }
 
@@ -377,6 +381,8 @@
     || $self->ut_numbern('bill')
     || $self->ut_numbern('susp')
     || $self->ut_numbern('cancel')
+    || $self->ut_numbern('adjourn')
+    || $self->ut_numbern('expire')
   ;
   return $error if $error;
 
@@ -601,7 +607,8 @@
 =item unsuspend [ OPTION => VALUE ... ]
 
 Unsuspends all services (see L<FS::cust_svc> and L<FS::part_svc>) in this
-package, then unsuspends the package itself (clears the susp field).
+package, then unsuspends the package itself (clears the susp field and the
+adjourn field if it is in the past).
 
 Available options are: I<adjust_next_bill>.
 
@@ -666,6 +673,7 @@
       && $inactive > 0 && ( $hash{'bill'} || $hash{'setup'} );
 
     $hash{'susp'} = '';
+    $hash{'adjourn'} = '' if $hash{'adjourn'} < time;
     my $new = new FS::cust_pkg ( \%hash );
     $error = $new->replace( $self, options => { $self->options } );
     if ( $error ) {

Index: AccessRight.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/AccessRight.pm,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -d -r1.18.2.1 -r1.18.2.2
--- AccessRight.pm	23 Apr 2007 14:34:09 -0000	1.18.2.1
+++ AccessRight.pm	26 Jun 2007 15:36:47 -0000	1.18.2.2
@@ -106,6 +106,7 @@
   'Edit customer package dates',
   'Customize customer package',
   'Suspend customer package',
+  'Suspend customer package later',
   'Unsuspend customer package',
   'Cancel customer package immediately',
   'Cancel customer package later',



More information about the freeside-commits mailing list