[freeside-commits] branch FREESIDE_3_BRANCH updated. 9931f703daa44a56da2382fd823271eff138959a

Carl J. Adams-Collier cjac at 420.am
Mon Oct 6 18:02:52 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  9931f703daa44a56da2382fd823271eff138959a (commit)
      from  5405c718b31852df721eb8fd804d3836970f8494 (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 9931f703daa44a56da2382fd823271eff138959a
Author: C.J. Adams-Collier <cjac at colliertech.org>
Date:   Thu Sep 25 13:15:18 2014 -0700

    FS RT #30362 - added configuration option to disable package modification in selfservice
    checking for this value before displaying change link or accepting form submission data

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 9bc88d7..97a6f4d 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1613,6 +1613,7 @@ sub list_pkgs {
     or return { 'error' => "unknown custnum $custnum" };
 
   my $conf = new FS::Conf;
+  my $immutable = $conf->exists('selfservice_immutable-package');
   
 # the duplication below is necessary:
 # 1. to maintain the current buggy behaviour wrt the cust_pkg and part_pkg
@@ -1625,6 +1626,7 @@ sub list_pkgs {
 	    'custnum'  => $custnum,
 	    'cust_pkg' => [ map {
                           { $_->hash,
+			    immutable => $immutable,
                             part_pkg => [ map $_->hashref, $_->part_pkg ],
                             part_svc =>
                               [ map $_->hashref, $_->available_part_svc ],
@@ -1657,6 +1659,7 @@ sub list_pkgs {
                           my $primary_cust_svc = $_->primary_cust_svc;
                           +{ $_->hash,
                             $_->part_pkg->hash,
+			    immutable   => $immutable,
                             pkg_label   => $_->pkg_locale,
                             status      => $_->status,
                             statuscolor => $_->statuscolor,
@@ -2349,6 +2352,10 @@ sub change_pkg {
   my($context, $session, $custnum) = _custoragent_session_custnum($p);
   return { 'error' => $session } if $context eq 'error';
 
+  my $conf = new FS::Conf;
+  my $immutable = $conf->exists('selfservice_immutable-package');
+  return { 'error' => "Package modification disabled" } if $immutable;
+
   my $search = { 'custnum' => $custnum };
   $search->{'agentnum'} = $session->{'agentnum'} if $context eq 'agent';
   my $cust_main = qsearchs('cust_main', $search )
@@ -2370,7 +2377,6 @@ sub change_pkg {
                                    \@newpkg,
                                  );
 
-  my $conf = new FS::Conf;
   if ( $conf->exists('signup_server-realtime') ) {
 
     my $bill_error = _do_bop_realtime( $cust_main, $status, 'no_credit'=>1 );
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4c02797..b4cd7d8 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2753,6 +2753,15 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'selfservice_immutable-package',
+    'section'     => 'self-service',
+    'description' => 'Disable package changes in self-service interface.',
+    'type'        => 'checkbox',
+    'per_agent'   => 1,
+  },
+
+
+  {
     'key'         => 'selfservice_process-pkgpart',
     'section'     => 'billing',
     'description' => 'Package to add to each manual credit card and ACH payment entered by the customer themselves in the self-service interface.  Enabling this option may be in violation of your merchant agreement(s), so please check it(/them) carefully before enabling this option.',
diff --git a/fs_selfservice/FS-SelfService/cgi/provision_list.html b/fs_selfservice/FS-SelfService/cgi/provision_list.html
index 24d6ff4..b558337 100644
--- a/fs_selfservice/FS-SelfService/cgi/provision_list.html
+++ b/fs_selfservice/FS-SelfService/cgi/provision_list.html
@@ -13,8 +13,8 @@ foreach my $pkg (
   my $susp = $pkg->{'susp'} || '';
   my @pkg_actions = ();
   if ( ! $susp ) {
-    push @pkg_actions, [ 'customer_change_pkg' => 'change' ];
-    push @pkg_actions, [ 'process_suspend_pkg' => 'suspend' ] 
+    push @pkg_actions, [ 'customer_change_pkg' => 'change' ] unless $pkg->{'immutable'};
+    push @pkg_actions, [ 'process_suspend_pkg' => 'suspend' ]
       if $self_suspend_reason;
   }
 

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

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm                          |    8 +++++++-
 FS/FS/Conf.pm                                         |    9 +++++++++
 fs_selfservice/FS-SelfService/cgi/provision_list.html |    4 ++--
 3 files changed, 18 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list