[freeside-commits] branch FREESIDE_3_BRANCH updated. 9e552ab0b3cffa9fd345320d77f9f8751766a5a6
Christopher Burger
burgerc at freeside.biz
Sat May 4 10:08:25 PDT 2019
The branch, FREESIDE_3_BRANCH has been updated
via 9e552ab0b3cffa9fd345320d77f9f8751766a5a6 (commit)
from 8625448a29bb6c05a4142b8261341c171fb30fb1 (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 9e552ab0b3cffa9fd345320d77f9f8751766a5a6
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 783c1d006..5e54ea1d7 100644
--- a/FS/FS/part_export/saisei.pm
+++ b/FS/FS/part_export/saisei.pm
@@ -878,6 +878,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