summaryrefslogtreecommitdiff
path: root/FS/FS/part_export/broadband_sql.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-02-27 19:23:28 -0800
committerMark Wells <mark@freeside.biz>2012-02-27 19:23:28 -0800
commit2bfe8d56f1dbf342cb5fac8187953cdb08b9d4cd (patch)
treea223ad39dc92d51d97ec7845ee7410d6e15e05a7 /FS/FS/part_export/broadband_sql.pm
parentd64984bbfe839fbe71830862a6841380425f3dbe (diff)
broadband_sql export, #15924
Diffstat (limited to 'FS/FS/part_export/broadband_sql.pm')
-rw-r--r--FS/FS/part_export/broadband_sql.pm49
1 files changed, 49 insertions, 0 deletions
diff --git a/FS/FS/part_export/broadband_sql.pm b/FS/FS/part_export/broadband_sql.pm
new file mode 100644
index 0000000..697d3cd
--- /dev/null
+++ b/FS/FS/part_export/broadband_sql.pm
@@ -0,0 +1,49 @@
+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' => '',
+ 'notes' => <<END
+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;
+