summaryrefslogtreecommitdiff
path: root/FS/bin/freeside-pull-dsl
diff options
context:
space:
mode:
authorlevinse <levinse>2010-11-29 22:11:01 +0000
committerlevinse <levinse>2010-11-29 22:11:01 +0000
commit4e1e6d1a69d6c1f08c24859f7ed70b4489b691bf (patch)
tree25e6366f83cc1fa3989d8812e3e8204cf148bce8 /FS/bin/freeside-pull-dsl
parent136200fb9ff797ea0ca44c00b5070129f35f47ce (diff)
svc_dsl, ikano, on-going implementation, initial commit of freeside-pull-dsl, RT7111
Diffstat (limited to 'FS/bin/freeside-pull-dsl')
-rwxr-xr-xFS/bin/freeside-pull-dsl71
1 files changed, 71 insertions, 0 deletions
diff --git a/FS/bin/freeside-pull-dsl b/FS/bin/freeside-pull-dsl
new file mode 100755
index 000000000..d0aa921cc
--- /dev/null
+++ b/FS/bin/freeside-pull-dsl
@@ -0,0 +1,71 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Getopt::Std;
+use FS::UID qw(adminsuidsetup);
+use FS::Conf;
+use FS::Record qw(qsearch qsearchs dbh);
+use FS::svc_dsl;
+use FS::part_export;
+use Data::Dumper;
+
+&untaint_argv; #what it sounds like (eww)
+use vars qw(%opt);
+
+my $user = shift or die &usage;
+adminsuidsetup $user;
+
+my @monitored = qsearch('svc_dsl', { 'monitored' => 'Y' } );
+foreach my $svc_dsl ( @monitored ) {
+ my @exports = $svc_dsl->part_svc->part_export_dsl_pull;
+ my $svcnum = $svc_dsl->svcnum;
+ warn "either zero or more than one DSL-pulling export attached to svcnum "
+ . "$svcnum, skipping" if ( scalar(@exports) != 1 );
+ my $export = $exports[0];
+ my $error = $export->dsl_pull($svc_dsl); # this will commit to db by default
+ warn "Error pulling DSL svcnum $svcnum: $error" unless $error eq '';
+}
+
+###
+# subroutines
+###
+
+sub untaint_argv {
+ foreach $_ ( $[ .. $#ARGV ) { #untaint @ARGV
+ #$ARGV[$_] =~ /^([\w\-\/]*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
+ # Date::Parse
+ $ARGV[$_] =~ /^(.*)$/ || die "Illegal arguement \"$ARGV[$_]\"";
+ $ARGV[$_]=$1;
+ }
+}
+
+sub usage {
+ die "Usage:\n\n freeside-pull-dsl \n";
+}
+
+###
+# documentation
+###
+
+=head1 NAME
+
+freeside-pull-dsl - Pull DSL order data from telcos/vendors for all monitored DSL orders to update
+
+=head1 SYNOPSIS
+
+ freeside-pull-dsl user
+
+=head1 DESCRIPTION
+
+user - name of an internal Freeside user
+
+This is still a work in progress - in future may add limiting by exportnum or svcpart or other such stuff.
+
+=head1 BUGS
+
+=head1 SEE ALSO
+
+L<FS::cust_main>, config.html from the base documentation
+
+=cut
+