[freeside-commits] branch master updated. 8c8872f684ccfa43dae290877c2cf8aed8828a9f

Jonathan Prykop jonathan at 420.am
Mon Jan 11 11:37:50 PST 2016


The branch, master has been updated
       via  8c8872f684ccfa43dae290877c2cf8aed8828a9f (commit)
      from  cd73f00695cd1d118133669f09585c1b3d4322f6 (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 8c8872f684ccfa43dae290877c2cf8aed8828a9f
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Jan 11 13:37:01 2016 -0600

    RT#39115: View SNMP info on svc_broadband service [fix to default value handling]

diff --git a/httemplate/edit/elements/part_export/broadband_snmp.html b/httemplate/edit/elements/part_export/broadband_snmp.html
index b4d57ed..63b61e2 100644
--- a/httemplate/edit/elements/part_export/broadband_snmp.html
+++ b/httemplate/edit/elements/part_export/broadband_snmp.html
@@ -11,7 +11,7 @@
 <& /elements/tr-input-text.html,
   label   => 'Community',
   field   => 'community',
-  curr_value  => $part_export->option('community') || $opt{'export_info'}->{'options'}->{'community'}->{'default'},
+  curr_value  => $curr_value->{'community'},
 &>
 <& /elements/tr-checkbox.html,
   label   => 'Send IP address changes to new address',
@@ -88,6 +88,10 @@ function receive_mib(obj, rownum) {
 <%init>
 my %opt = @_;
 my $part_export = $opt{part_export} || FS::part_export->new;
+my $curr_value = {};
+$curr_value->{'community'} = ($opt{'part_export'} && $opt{'part_export'}->exportnum)
+                           ? $part_export->option('community') 
+                           : $opt{'export_info'}->{'options'}->{'community'}->{'default'};
 
 my @actions = split("\n", $part_export->option('action'));
 my @oids    = split("\n", $part_export->option('oid'));
diff --git a/httemplate/edit/elements/part_export/broadband_snmp_get.html b/httemplate/edit/elements/part_export/broadband_snmp_get.html
index 8b8717c..faf179a 100644
--- a/httemplate/edit/elements/part_export/broadband_snmp_get.html
+++ b/httemplate/edit/elements/part_export/broadband_snmp_get.html
@@ -7,17 +7,17 @@ Quite a bit of false laziness with edit/elements/part_export/broadband_snmp.html
   label   => 'SNMP version',
   field   => 'snmp_version',
   options => [ '1', '2c' ],
-  curr_value => $part_export->option('version') 
+  curr_value => $curr_value->{'snmp_version'} 
 &>
 <& /elements/tr-input-text.html,
   label   => 'Community',
   field   => 'snmp_community',
-  curr_value  => $part_export->option('community') || $opt{'export_info'}->{'options'}->{'snmp_community'}->{'default'},
+  curr_value  => $curr_value->{'snmp_community'},
 &>
 <& /elements/tr-input-text.html,
   label   => 'Timeout (seconds)',
   field   => 'snmp_timeout',
-  curr_value  => $part_export->option('timeout') || $opt{'export_info'}->{'options'}->{'snmp_timeout'}->{'default'},
+  curr_value  => $curr_value->{'snmp_timeout'},
 &>
 </TABLE>
 <script type="text/javascript">
@@ -65,6 +65,13 @@ my %opt = @_;
 
 my $part_export = $opt{part_export} || FS::part_export->new;
 
+my $curr_value = {};
+foreach my $field ( qw(snmp_version snmp_community snmp_timeout) ) {
+  $curr_value->{$field} = ($opt{'part_export'} && $opt{'part_export'}->exportnum)
+                          ? $part_export->option($field) 
+                          : $opt{'export_info'}->{'options'}->{$field}->{'default'};
+}
+
 my @oids    = split("\n", $part_export->option('snmp_oid'));
 
 my @data;

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

Summary of changes:
 httemplate/edit/elements/part_export/broadband_snmp.html  |    6 +++++-
 .../edit/elements/part_export/broadband_snmp_get.html     |   13 ++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list