summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--[-rwxr-xr-x]bin/3add0
-rw-r--r--[-rwxr-xr-x]bin/3commit0
-rw-r--r--bin/dump_tokens14
-rwxr-xr-xbin/fetch_pages80
-rwxr-xr-xbin/freeside-debian-releases.sh52
-rwxr-xr-xbin/xmlrpc-contact_passwd29
-rwxr-xr-xbin/xmlrpc-edit_contact29
-rwxr-xr-xbin/xmlrpc-list_contacts28
8 files changed, 232 insertions, 0 deletions
diff --git a/bin/3add b/bin/3add
index 8bc034d9c..8bc034d9c 100755..100644
--- a/bin/3add
+++ b/bin/3add
diff --git a/bin/3commit b/bin/3commit
index 37b500063..37b500063 100755..100644
--- a/bin/3commit
+++ b/bin/3commit
diff --git a/bin/dump_tokens b/bin/dump_tokens
new file mode 100644
index 000000000..70c449bf9
--- /dev/null
+++ b/bin/dump_tokens
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+use FS::UID qw(adminsuidsetup);
+use FS::Record qw(qsearch);
+use FS::cust_main;
+
+adminsuidsetup shift or die 'usage: dump_tokens username';
+
+foreach my $cust_main ( qsearch({ table => 'cust_main',
+ extra_sql => "WHERE payby IN ('CARD','DCRD')",
+ })
+) {
+ print $cust_main->custnum. ','. $cust_main->payinfo. "\n";
+}
diff --git a/bin/fetch_pages b/bin/fetch_pages
new file mode 100755
index 000000000..5aeca56b3
--- /dev/null
+++ b/bin/fetch_pages
@@ -0,0 +1,80 @@
+#!/usr/bin/perl
+
+use strict;
+use WWW::Mechanize;
+use Getopt::Std;
+use File::chdir;
+use URI;
+use File::Slurp qw(write_file);
+
+my %opt;
+getopts('d:h:u:p:', \%opt);
+die usage() unless ($opt{d} and $opt{u} and $opt{p});
+my $host = $opt{h} || 'http://localhost/freeside';
+
+my $mech = WWW::Mechanize->new( autocheck => 0 );
+$mech->get("$host/index.html");
+$mech->submit_form(
+ with_fields => {
+ credential_0 => $opt{u},
+ credential_1 => $opt{p}
+ }
+);
+
+my @tests = <>;
+
+mkdir($opt{d}) unless -d $opt{d};
+push @CWD, $opt{d};
+
+while (my $path = shift @tests) {
+ if ($path =~ /^#(.*)/) {
+ print "$1 - skipped\n";
+ next;
+ }
+ my $uri = URI->new("$host/$path");
+ print $uri->path;
+ my $response = $mech->get($uri);
+ print " - " . $response->code . "\n";
+ if ($response->is_success) {
+ local $CWD;
+ my @dirs = $uri->path_segments;
+ my $file = pop @dirs;
+ foreach my $dir (@dirs) {
+ mkdir $dir unless -d $dir;
+ push @CWD, $dir;
+ }
+ write_file($file, {binmode => ':utf8'}, $response->decoded_content);
+ }
+}
+
+sub usage {
+ "Usage: fetch_pages -d directory -u username -p password [ -h hostname ]\n\n";
+}
+
+=head1 NAME
+
+fetch_pages - a testing tool for UI changes
+
+=head1 USAGE
+
+fetch_pages -d before_change -u myuser -p mypass list_of_tests
+git checkout newbranch
+make install; apache2ctl restart
+fetch_pages -d after_change -u myuser -p mypass list_of_tests
+diff -ur before_change/ after_change/ |diffstat
+
+=head1 ARGUMENTS
+
+-d: the directory to put the files in. Required.
+
+-u: the username to use with the Freeside web interface. Required.
+
+-p: the password. Required.
+
+-h: the URL prefix for the Freeside server. Defaults to
+"http://localhost/freeside".
+
+The list of tests can be in a file specified after all arguments, or passed
+to stdin.
+
+=cut
diff --git a/bin/freeside-debian-releases.sh b/bin/freeside-debian-releases.sh
new file mode 100755
index 000000000..82465266f
--- /dev/null
+++ b/bin/freeside-debian-releases.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+DISTRO="$1"
+FS_VERSION="$2"
+FS_REPO="$3"
+
+if [[ $# -ne 3 ]]
+ then
+ echo "We need 3 arguments"
+ exit;
+fi
+
+DATE=`date +"%Y%m%d"`
+DIR="/home/autobuild/packages/staging/freeside$FS_VERSION/$FS_REPO"
+TARGET="/home/jeremyd/public_html/freeside$FS_VERSION-$DISTRO-$FS_REPO"
+
+if [ ! -d "$DIR" -a -d $TARGET ]; then
+
+echo "Staging or Target directories do not exist"
+
+fi
+
+GIT_VERSION=`grep '^$VERSION' $DIR/freeside/FS/FS.pm | cut -d\' -f2`
+
+# Clean configuration file
+rm -fr $DIR/freeside/debian/freeside-ng-selfservice.conffiles
+
+# Pull any changes
+cd $DIR/freeside
+STATUS=`git pull`
+
+#Assign the proper config files for freeside-ng-selfservice
+if [ $DISTRO = "wheezy" ]; then
+ ln -s $DIR/freeside/debian/freeside-ng-selfservice.deb7 $DIR/freeside/debian/freeside-ng-selfservice.conffiles
+else
+ ln -s $DIR/freeside/debian/freeside-ng-selfservice.deb8 $DIR/freeside/debian/freeside-ng-selfservice.conffiles
+fi
+
+# Add the build information to changelog
+
+dch -b --newversion $GIT_VERSION~$DATE "Auto-Build"
+
+# Using pbuilder and pdebuild in chroot instead of building directly : dpkg-buildpackage -b -rfakeroot -uc -us
+
+pdebuild --pbuilderroot sudo --debbuildopts "-b -rfakeroot -uc -us" --buildresult $TARGET --architecture all -- --distribution $DISTRO --basetgz /var/cache/pbuilder/$DISTRO.tgz
+
+#--buildresult gets the file where it needs to be, may need to clean up DIR
+
+cd $DIR; rm -f freeside_*
+cd $TARGET; rm -f *.gz
+
+$TARGET/APT
diff --git a/bin/xmlrpc-contact_passwd b/bin/xmlrpc-contact_passwd
new file mode 100755
index 000000000..1a89d4260
--- /dev/null
+++ b/bin/xmlrpc-contact_passwd
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use Frontier::Client;
+use Data::Dumper;
+
+my( $email, $current_pw, $new_pw ) = @ARGV;
+
+my $uri = new URI 'http://localhost:8080/';
+
+my $server = new Frontier::Client ( 'url' => $uri );
+
+my $login_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.login',
+ 'email' => $email,
+ 'password' => $current_pw,
+);
+die $login_result->{'error'}."\n" if $login_result->{'error'};
+
+my $passwd_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.contact_passwd',
+ 'session_id' => $login_result->{'session_id'},
+ 'new_password' => $new_pw,
+);
+die $passwd_result->{'error'}."\n" if $passwd_result->{'error'};
+
+warn "Password changed.\n";
+
+1;
diff --git a/bin/xmlrpc-edit_contact b/bin/xmlrpc-edit_contact
new file mode 100755
index 000000000..574284bbc
--- /dev/null
+++ b/bin/xmlrpc-edit_contact
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use Frontier::Client;
+use Data::Dumper;
+
+my( $email, $password, $new_email ) = @ARGV;
+
+my $uri = new URI 'http://localhost:8080/';
+
+my $server = new Frontier::Client ( 'url' => $uri );
+
+my $login_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.login',
+ 'email' => $email,
+ 'password' => $password,
+);
+die $login_result->{'error'}."\n" if $login_result->{'error'};
+
+my $passwd_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.edit_contact',
+ 'session_id' => $login_result->{'session_id'},
+ 'emailaddress' => $new_email,
+);
+die $passwd_result->{'error'}."\n" if $passwd_result->{'error'};
+
+warn "Email changed.\n";
+
+1;
diff --git a/bin/xmlrpc-list_contacts b/bin/xmlrpc-list_contacts
new file mode 100755
index 000000000..ffe2a31ad
--- /dev/null
+++ b/bin/xmlrpc-list_contacts
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use strict;
+use Frontier::Client;
+use Data::Dumper;
+
+my( $email, $password ) = @ARGV;
+
+my $uri = new URI 'http://localhost:8080/';
+
+my $server = new Frontier::Client ( 'url' => $uri );
+
+my $login_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.login',
+ 'email' => $email,
+ 'password' => $password,
+);
+die $login_result->{'error'}."\n" if $login_result->{'error'};
+
+my $list_result = $server->call(
+ 'FS.ClientAPI_XMLRPC.list_contacts',
+ 'session_id' => $login_result->{'session_id'},
+);
+die $list_result->{'error'}."\n" if $list_result->{'error'};
+
+print Dumper($list_result);
+
+1;