eliminate some false laziness in FS::Misc::send_email vs. msg_template/email.pm send_...
[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 Export broadband services to SQL databases.
30 END
31 );
32
33 # to avoid confusion, let the user just enter "mac_addr" as the column name
34 sub _schema_map {
35   my %map = shift->_map('schema');
36   for (values %map) {
37     s/^mac_addr$/mac_addr_formatted/;
38   }
39   %map;
40 }
41
42 sub _map_arg_callback {
43   my($self, $field) = @_;
44   if ( $field eq 'mac_addr_formatted' ) {
45     return ($self->option('mac_case'), $self->option('mac_delimiter'));
46   }
47   return ();
48 }
49
50 1;
51