+ my ($nas_export) = $part_svc->part_export('broadband_nas');
+ #can we assume there's only one of these per part_svc?
+ if ( $nas_export ) {
+ my $nas;
+ if ( $svc_x->svcnum ) {
+ $nas = qsearchs('nas', { 'svcnum' => $svc_x->svcnum });
+ }
+ $nas ||= $nas_export->default_nas;
+ $svc_x->set($_, $nas->$_) foreach fields('nas');
+
+ # duplicates the fields in httemplate/edit/nas.html (mostly)
+ push @$fields,
+ { type => 'tablebreak-tr-title',
+ #value => 'Attached NAS',
+ value => $nas_export->exportname,
+ colspan => 2,
+ },
+ { field=>'nasnum', type=>'hidden', },
+ { field=>'shortname', size=>16, maxlength=>32 },
+ { field=>'secret', size=>40, maxlength=>60, required=>1 },
+ { field=>'type', type=>'select',
+ options=>[qw( cisco computone livingston max40xx multitech netserver
+ pathras patton portslave tc usrhiper other )],
+ },
+ { field=>'ports', size=>5 },
+ { field=>'server', size=>40, maxlength=>64 },
+ { field=>'community', size=>40, maxlength=>50 },
+ ;
+
+ $opt->{'labels'}{'shortname'} = 'Short name';
+ $opt->{'labels'}{'secret'} = 'Shared secret';
+ $opt->{'labels'}{'type'} = 'Type';
+ $opt->{'labels'}{'ports'} = 'Ports';
+ $opt->{'labels'}{'server'} = 'Server';
+ $opt->{'labels'}{'community'} = 'Community';
+ }
+};
+
+my $field_callback = sub {
+ my ($cgi, $object, $fieldref) = @_;