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