summaryrefslogtreecommitdiff
path: root/FS/bin
diff options
context:
space:
mode:
Diffstat (limited to 'FS/bin')
-rwxr-xr-xFS/bin/freeside-daily2
-rwxr-xr-xFS/bin/freeside-monthly2
-rw-r--r--FS/bin/freeside-prepaidd15
-rw-r--r--FS/bin/freeside-queued2
-rw-r--r--FS/bin/freeside-radgroup8
-rwxr-xr-xFS/bin/freeside-selfservice-xmlrpcd2
-rwxr-xr-xFS/bin/freeside-upgrade27
-rwxr-xr-xFS/bin/freeside-wipe-cvv87
8 files changed, 134 insertions, 11 deletions
diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily
index e16cc5c..6a542c7 100755
--- a/FS/bin/freeside-daily
+++ b/FS/bin/freeside-daily
@@ -99,7 +99,7 @@ the bill and collect methods of a cust_main object. See L<FS::cust_main>.
with today's date, irregardless of the pretend date used to pre-generate
the invoices.
- -p: Only process customers with the specified payby (I<CARD>, I<DCRD>, I<CHEK>, I<DCHK>, I<BILL>, I<COMP>, I<LECB>)
+ -p: Only process customers with the specified payby (CARD, DCRD, CHEK, DCHK, BILL, COMP, LECB)
-a: Only process customers with the specified agentnum. Multiple agentnums can be specified, separated with commas.
diff --git a/FS/bin/freeside-monthly b/FS/bin/freeside-monthly
index a81e3e9..0d6ea14 100755
--- a/FS/bin/freeside-monthly
+++ b/FS/bin/freeside-monthly
@@ -64,7 +64,7 @@ the bill and collect methods of a cust_main object. See L<FS::cust_main>.
"pretend date" 15 days from whatever was specified by the -d switch
(or now, if no -d switch was given).
- -p: Only process customers with the specified payby (I<CARD>, I<DCRD>, I<CHEK>, I<DCHK>, I<BILL>, I<COMP>, I<LECB>)
+ -p: Only process customers with the specified payby (CARD, DCRD, CHEK, DCHK, BILL, COMP, LECB)
-a: Only process customers with the specified agentnum
diff --git a/FS/bin/freeside-prepaidd b/FS/bin/freeside-prepaidd
index 86bfe87..05b068b 100644
--- a/FS/bin/freeside-prepaidd
+++ b/FS/bin/freeside-prepaidd
@@ -41,21 +41,30 @@ while (1) {
my $work_cust_pkg = $cust_pkg;
my $cust_main = $cust_pkg->cust_main;
+
+ #insurance: somehow winding up here without things properly applied...
+ my $a_error = $cust_main->apply_payments_and_credits;
+ if ( $a_error ) {
+ warn "Error applying payments&credits, customer #". $cust_main->custnum;
+ next;
+ }
+
if ( $cust_main->total_unapplied_payments > 0
- or $cust_main->total_credited > 0
+ || $cust_main->total_unapplied_credits > 0
)
{
+
#this needs a flag to say only do the prepaid packages...
# and only try em if the renewal price matches.. but this will do for now
my $b_error = $cust_main->bill;
if ( $b_error ) {
warn "Error billing customer #". $cust_main->custnum;
- next;
+ next;
}
$b_error = $cust_main->apply_payments_and_credits;
if ( $b_error ) {
warn "Error applying payments&credits, customer #". $cust_main->custnum;
- next;
+ next;
}
$work_cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $work_cust_pkg->pkgnum } );
diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued
index c9b0edb..756b699 100644
--- a/FS/bin/freeside-queued
+++ b/FS/bin/freeside-queued
@@ -186,7 +186,7 @@ while (1) {
dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile');
#auto-use classes...
- if ( $ljob->job =~ /(FS::(part_export|cust_main)::\w+)::/
+ if ( $ljob->job =~ /(FS::(part_export|cust_main|cust_pkg)::\w+)::/
|| $ljob->job =~ /(FS::\w+)::/
)
{
diff --git a/FS/bin/freeside-radgroup b/FS/bin/freeside-radgroup
index ed85626..3326329 100644
--- a/FS/bin/freeside-radgroup
+++ b/FS/bin/freeside-radgroup
@@ -52,13 +52,13 @@ freeside-radgroup - Command line utility to manipulate radius groups
=head1 DESCRIPTION
- B<user> is a freeside user as added with freeside-adduser.
+B<user> is a freeside user as added with freeside-adduser.
- B<command> is the action to take. Available actions are: I<add>
+B<command> is the action to take. Available actions are: I<add>
- B<groupname> is the group to add (or remove, etc.)
+B<groupname> is the group to add (or remove, etc.)
- B<svcpart> specifies which accounts will be updated.
+B<svcpart> specifies which accounts will be updated.
=head1 EXAMPLES
diff --git a/FS/bin/freeside-selfservice-xmlrpcd b/FS/bin/freeside-selfservice-xmlrpcd
index fa745ec..e50d516 100755
--- a/FS/bin/freeside-selfservice-xmlrpcd
+++ b/FS/bin/freeside-selfservice-xmlrpcd
@@ -63,6 +63,8 @@ logfile("$FREESIDE_LOG/selfservice-xmlrpcd.log");
daemonize2();
+FS::ClientAPI::Signup::clear_cache();
+
my $conf = new FS::Conf;
die "not running; selfservice-xmlrpc conf option is off\n"
diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade
index 4a6fac2..aca545b 100755
--- a/FS/bin/freeside-upgrade
+++ b/FS/bin/freeside-upgrade
@@ -11,7 +11,7 @@ use FS::Schema qw( dbdef dbdef_dist reload_dbdef );
use FS::Misc::prune qw(prune_applications);
use FS::Conf;
use FS::Record qw(qsearch);
-use FS::Upgrade qw(upgrade upgrade_sqlradius);
+use FS::Upgrade qw(upgrade_schema upgrade_config upgrade upgrade_sqlradius);
my $start = time;
@@ -71,6 +71,21 @@ if ( dbdef->table('cgp_rule_condition') &&
}
+# RT required field flag
+# for consistency with RT schema: mysql is in CamelCase,
+# pg is in lowercase, and they use different data types.
+my ($t, $creq, $cdis) =
+ map { driver_name =~ /^mysql/i ? $_ : lc($_) }
+ ('CustomFields','Required','Disabled');
+
+if ( dbdef->table($t) &&
+ ! dbdef->table($t)->column($creq) ) {
+ push @bugfix,
+ "ALTER TABLE $t ADD COLUMN $creq ".
+ dbdef->table($t)->column($cdis)->type .
+ ' NOT NULL DEFAULT 0';
+}
+
if ( $DRY_RUN ) {
print
join(";\n", @bugfix ). ";\n";
@@ -82,6 +97,8 @@ if ( $DRY_RUN ) {
or die "Error: ". $dbh->errstr. "\n executing: $statement";
}
+ upgrade_schema();
+
dbdef_create($dbh, $dbdef_file);
delete $FS::Schema::dbdef_cache{$dbdef_file}; #force an actual reload
reload_dbdef($dbdef_file);
@@ -197,6 +214,14 @@ $dbh = adminsuidsetup($user);
warn "Re-initialization with updated schema completed in ". (time-$start). " seconds\n"; # if $DEBUG;
$start = time;
+upgrade_config()
+ unless $DRY_RUN || $opt_s;
+
+$dbh->commit or die $dbh->errstr;
+
+warn "Config updates completed in ". (time-$start). " seconds\n"; # if $DEBUG;
+$start = time;
+
upgrade()
unless $DRY_RUN || $opt_s;
diff --git a/FS/bin/freeside-wipe-cvv b/FS/bin/freeside-wipe-cvv
new file mode 100755
index 0000000..70f0df9
--- /dev/null
+++ b/FS/bin/freeside-wipe-cvv
@@ -0,0 +1,87 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Getopt::Std;
+use FS::UID qw(adminsuidsetup dbh);
+use FS::Record qw(qsearch qsearchs);
+use Time::Local 'timelocal';
+use Date::Format 'time2str';
+
+my %opt;
+getopts('vnd:', \%opt);
+
+my $user = shift or die &usage;
+adminsuidsetup $user;
+$FS::UID::AutoCommit = 0;
+$FS::Record::nowarn_identical = 1;
+
+my $extra_sql = FS::cust_main->cancel_sql;
+$extra_sql = "WHERE $extra_sql
+AND cust_main.payby IN('CARD','DCRD','CHEK','DCHK')
+";
+
+if($opt{'d'}) {
+ $opt{'d'} =~ /^(\d+)$/ or die &usage;
+ my $time = timelocal(0,0,0,(localtime(time-(86400*$1)))[3..5]);
+ print "Excluding customers canceled after ".time2str("%D",$time)."\n"
+ if $opt{'v'};
+ $extra_sql .= ' AND 0 = (' . FS::cust_main->select_count_pkgs_sql .
+ " AND cust_pkg.cancel > $time)";
+}
+
+foreach my $cust_main ( qsearch({
+ 'table' => 'cust_main',
+ 'hashref' => {},
+ 'extra_sql' => $extra_sql
+ }) ) {
+ if($opt{'v'}) {
+ print $cust_main->name, "\n";
+ }
+ if($opt{'n'}) {
+ $cust_main->payinfo('');
+ $cust_main->paydate('');
+ $cust_main->payby('BILL');
+# can't have a CARD or CHEK without a valid payinfo
+ }
+ $cust_main->paycvv('');
+ my $error = $cust_main->replace;
+ if($error) {
+ dbh->rollback;
+ die "$error (changes reverted)\n";
+ }
+}
+dbh->commit;
+
+sub usage {
+ "Usage:\n\n freeside-wipe-cvv [ -v ] [ -n ] [ -d days ] user\n"
+}
+
+=head1 NAME
+
+freeside-wipe-cvv - Wipe sensitive payment information from customer records.
+
+=head1 SYNOPSIS
+
+ freeside-wipe-cvv [ -v ] [ -n ] [ -d days ] user
+
+=head1 DESCRIPTION
+
+freeside-wipe-cvv deletes the CVV numbers (and, optionally, credit
+card or bank account numbers) of customers who have no non-canceled
+packages. Normally CVV numbers are deleted as soon as a payment is
+processed; if the customer is canceled before a payment is processed,
+this may not happen and the CVV will remain indefinitely, violating
+good security practice and (possibly) your merchant agreement.
+Running freeside-wipe-cvv will remove this data.
+
+-v: Be verbose.
+
+-n: Remove card and account numbers in addition to CVV numbers. This
+will also set the customer's payment method to 'BILL'.
+
+-d days: Only remove CVV/card numbers from customers who have been
+inactive for at least that many days. Optional; will default to
+all canceled customers.
+
+=cut
+