[freeside-commits] branch FREESIDE_3_BRANCH updated. 351c9f0e23d1b66d7b62b72afa31e14575722ba0

Mark Wells mark at 420.am
Wed Dec 30 23:01:58 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  351c9f0e23d1b66d7b62b72afa31e14575722ba0 (commit)
       via  6afd5563cebcc4936f044b6cdef428e8f798f583 (commit)
      from  152c54a5c8277fb09429d6ded83535edd0a914f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 351c9f0e23d1b66d7b62b72afa31e14575722ba0
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Dec 30 18:51:09 2015 -0800

    add option for exports to avoid suspending services, #20739

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 4d931b4..c855b1f 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -3059,6 +3059,8 @@ sub tables_hashref {
         'exporttype', 'varchar',     '', $char_d, '', '', 
         'nodomain',      'char', 'NULL',       1, '', '', 
         'default_machine','int', 'NULL',      '', '', '',
+        'no_suspend',    'char', 'NULL',       1, '', '',
+        # could also have 'no_insert', 'no_replace', etc.
       ],
       'primary_key' => 'exportnum',
       'unique'      => [],
diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index bdbecff..803325f 100644
--- a/FS/FS/part_export.pm
+++ b/FS/FS/part_export.pm
@@ -59,6 +59,12 @@ fields are currently supported:
 
 =item nodomain - blank or "Y" : usernames are exported to this service with no domain
 
+=item default_machine - For exports that require a machine to be selected for
+each service (see L<FS::svc_export_machine>), the one to use as the default.
+
+=item no_suspend - Don't export service suspensions. In the future there may
+be "no_*" options for the other service actions.
+
 =back
 
 =head1 METHODS
@@ -334,6 +340,7 @@ sub check {
     || $self->ut_textn('exportname')
     || $self->ut_domainn('machine')
     || $self->ut_alpha('exporttype')
+    || $self->ut_flag('no_suspend')
   ;
 
   if ( $self->machine eq '_SVC_MACHINE' ) {
diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm
index faae79d..dea31ea 100644
--- a/FS/FS/svc_Common.pm
+++ b/FS/FS/svc_Common.pm
@@ -1163,7 +1163,9 @@ Runs the provided export hook (i.e. "suspend", "unsuspend") for this service.
 sub export {
   my( $self, $method ) = ( shift, shift );
 
+  # $method must start with export_, $action must be the part after that
   $method = "export_$method" unless $method =~ /^export_/;
+  my ($action) = $method =~ /^export_(\w+)/;
 
   local $SIG{HUP} = 'IGNORE';
   local $SIG{INT} = 'IGNORE';
@@ -1180,6 +1182,7 @@ sub export {
   unless ( $noexport_hack ) {
     foreach my $part_export ( $self->cust_svc->part_svc->part_export ) {
       next unless $part_export->can($method);
+      next if $part_export->get("no_$action"); # currently only 'no_suspend'
       my $error = $part_export->$method($self, @_);
       if ( $error ) {
         $dbh->rollback if $oldAutoCommit;
diff --git a/httemplate/browse/part_export.cgi b/httemplate/browse/part_export.cgi
index af988d3..bbb723d 100755
--- a/httemplate/browse/part_export.cgi
+++ b/httemplate/browse/part_export.cgi
@@ -38,6 +38,11 @@ function part_export_areyousure(href) {
       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
         <% $part_export->label_html %>
         (<A HREF="<% $p %>edit/part_export.cgi?<% $part_export->exportnum %>">edit</A> | <A HREF="javascript:part_export_areyousure('<% $p %>misc/delete-part_export.cgi?<% $part_export->exportnum %>')">delete</A>)
+%       if ( $part_export->no_suspend ) {
+        <P STYLE="position: absolute">
+        This export will not suspend services.
+        </P>
+%       }
 %       if ( my @actions = $part_export->actions ) {
         <P STYLE="position: absolute">
         Management:
diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi
index 3820931..5411feb 100644
--- a/httemplate/edit/part_export.cgi
+++ b/httemplate/edit/part_export.cgi
@@ -285,6 +285,11 @@ my $widget = new HTML::Widgets::SelectLayers(
       $html .= '</TD></TR>';
     }
 
+    $html .= '<TR><TD ALIGN="right">Do not suspend services</TD>' .
+                '<TD><INPUT TYPE="checkbox" NAME="no_suspend" VALUE="Y"';
+    $html .= ' CHECKED' if $part_export->no_suspend eq 'Y';
+    $html .= '></TD></TR>';
+
     $html .= '</TABLE>';
 
     # false laziness with config_element above

commit 6afd5563cebcc4936f044b6cdef428e8f798f583
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Dec 30 16:20:51 2015 -0800

    minor UI fix for future package change + advance billing, #37870

diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html
index 7c4b270..4c612f5 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -133,7 +133,7 @@
 %     if ( $change_from ) { # future change
 %
           <% pkg_status_row_colspan( $cust_pkg, emt('Waiting for package change'), '', %opt ) %>
-          <% pkg_status_row( $cust_pkg,
+          <% pkg_status_row_if( $cust_pkg,
                              emt('Will be activated on'),
                              'start_date',
                              %opt ) %>
@@ -277,15 +277,17 @@
 %               }
 %           }
 
-%           # suspension actions--always available
-%           if ( $curuser->access_right('Suspend customer package') ) { 
-              ( <% pkg_suspend_link($cust_pkg) %> )
-%           } 
-%           if ( $curuser->access_right('Suspend customer package later') ) { 
-              ( <% pkg_adjourn_link($cust_pkg) %> )
-%           } 
-%           if ( $curuser->access_right('Delay suspension events') ) { 
-              ( <% pkg_delay_link($cust_pkg) %> )
+%           if ( !$change_from ) {
+%             # suspension actions--always available
+%             if ( $curuser->access_right('Suspend customer package') ) { 
+                ( <% pkg_suspend_link($cust_pkg) %> )
+%             } 
+%             if ( $curuser->access_right('Suspend customer package later') ) { 
+                ( <% pkg_adjourn_link($cust_pkg) %> )
+%             } 
+%             if ( $curuser->access_right('Delay suspension events') ) { 
+                ( <% pkg_delay_link($cust_pkg) %> )
+%             }
 %           }
 %
 %           if ( $change_from or $cust_pkg->change_to_pkgnum ) {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Schema.pm                                |    2 ++
 FS/FS/part_export.pm                           |    7 +++++++
 FS/FS/svc_Common.pm                            |    3 +++
 httemplate/browse/part_export.cgi              |    5 +++++
 httemplate/edit/part_export.cgi                |    5 +++++
 httemplate/view/cust_main/packages/status.html |   22 ++++++++++++----------
 6 files changed, 34 insertions(+), 10 deletions(-)




More information about the freeside-commits mailing list