[freeside-commits] branch FREESIDE_4_BRANCH updated. a17567f9953e53da23a42a70e4cb981b1c7cf6f5

Christopher Burger burgerc at freeside.biz
Sat May 4 06:57:59 PDT 2019


The branch, FREESIDE_4_BRANCH has been updated
       via  a17567f9953e53da23a42a70e4cb981b1c7cf6f5 (commit)
      from  635874f1ea13ab971d2f8b95bfd0ca25eed0aaef (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 a17567f9953e53da23a42a70e4cb981b1c7cf6f5
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri May 3 13:11:37 2019 -0400

    RT# 83259 - adding/editing tower sector will no check for required fields prior to exporting if able to export

diff --git a/FS/FS/part_export/saisei.pm b/FS/FS/part_export/saisei.pm
index 92b18e431..8376c7e2e 100644
--- a/FS/FS/part_export/saisei.pm
+++ b/FS/FS/part_export/saisei.pm
@@ -890,6 +890,27 @@ sub require_tower_and_sector {
   1;
 }
 
+=head2 tower_sector_required_fields
+
+required fields needed for tower and sector export.
+
+=cut
+
+sub tower_sector_required_fields {
+  my $fields = {
+    'tower' => {
+      'up_rate_limit'   => '1',
+      'down_rate_limit' => '1',
+    },
+    'sector' => {
+      'up_rate_limit'   => '1',
+      'down_rate_limit' => '1',
+      'ip_addr'         => '1',
+    },
+  };
+  return $fields;
+}
+
 sub required_fields {
   my @fields = ('svc_broadband__ip_addr_required', 'svc_broadband__speed_up_required', 'svc_broadband__speed_down_required', 'svc_broadband__sectornum_required');
   return @fields;
diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html
index ba7309c99..3bf6cdb2a 100644
--- a/httemplate/edit/process/tower.html
+++ b/httemplate/edit/process/tower.html
@@ -8,4 +8,35 @@
                        sector_range up_rate_limit down_rate_limit
                      )],
                    },
+    'precheck_callback' => sub {
+      my ($cgi) = @_;
+      my @required_tower_fields;
+      my @required_sector_fields;
+
+      foreach my $part_svc_broadband_export ( FS::tower_sector->part_export_svc_broadband ) {
+        if ($part_svc_broadband_export and $part_svc_broadband_export->can('tower_sector_required_fields')) {
+          my $required_fields = $part_svc_broadband_export->tower_sector_required_fields;
+          foreach (keys %$required_fields) {
+            my $fields = $required_fields->{$_};
+            push @required_tower_fields, keys(%$fields) if $_ eq "tower";
+            push @required_sector_fields, keys(%$fields) if $_ eq "sector";
+          }
+        }
+      }
+
+      foreach (@required_tower_fields){
+        return "The tower $_ field is required" unless $cgi->param($_);
+      }
+
+      foreach (@required_sector_fields){
+        foreach my $k ($cgi->param) {
+          if ($k =~ /^sectornum\d+$/) {
+           if ( $cgi->param($k.'_sectorname') ) {
+             return "The sector(".$cgi->param($k.'_sectorname').") $_ field is required" unless $cgi->param($k.'_'.$_);
+           }
+          }
+        }
+      }
+      '';
+    },
 &>

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

Summary of changes:
 FS/FS/part_export/saisei.pm        | 21 +++++++++++++++++++++
 httemplate/edit/process/tower.html | 31 +++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)




More information about the freeside-commits mailing list