1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package FS::part_export::broadband_sql;
use base qw( FS::part_export::sql_Common );
use strict;
use vars qw( %info );
use Tie::IxHash;
tie my %options, 'Tie::IxHash',
%{__PACKAGE__->sql_options},
# likely to be necessary
'mac_case' => {
label => 'Export MAC address as',
type => 'select',
options => [ qw(uppercase lowercase) ],
},
mac_delimiter => {
label => 'Separate MAC address octets with',
default => '-',
},
;
%info = (
'svc' => 'svc_broadband',
'desc' => 'Real-time export of broadband services to SQL databases ',
'options' => \%options,
'nodomain' => '',
'no_machine' => 1,
'notes' => <<END
Export broadband services to SQL databases.
END
);
# to avoid confusion, let the user just enter "mac_addr" as the column name
sub _schema_map {
my %map = shift->_map('schema');
for (values %map) {
s/^mac_addr$/mac_addr_formatted/;
}
%map;
}
sub _map_arg_callback {
my($self, $field) = @_;
if ( $field eq 'mac_addr_formatted' ) {
return ($self->option('mac_case'), $self->option('mac_delimiter'));
}
return ();
}
1;
|