4f526c805d057a386b616f154677e57eb4ca48b2
[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   'no_machine' => 1,
28   'notes'    => <<END
29 END
30 );
31
32 # to avoid confusion, let the user just enter "mac_addr" as the column name
33 sub _schema_map {
34   my %map = shift->_map('schema');
35   for (values %map) {
36     s/^mac_addr$/mac_addr_formatted/;
37   }
38   %map;
39 }
40
41 sub _map_arg_callback {
42   my($self, $field) = @_;
43   if ( $field eq 'mac_addr_formatted' ) {
44     return ($self->option('mac_case'), $self->option('mac_delimiter'));
45   }
46   return ();
47 }
48
49 1;
50