From b1d445f94514a29e5d4753839798b0291d89aee3 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 9 Aug 2010 01:03:49 +0000 Subject: package web import from CSV/XLS, RT#9529 --- FS/bin/freeside-queued | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin') diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued index c9b0edb10..756b699d4 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+)::/ ) { -- cgit v1.2.1 From d9c554c746466a20bbbbc2eb69fc737cfe598316 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 16 Aug 2010 20:12:45 +0000 Subject: fix upgrade with ancient cust_bill_pkg_detail.classnum but new DBIx::DBSchema, RT#9640 --- FS/bin/freeside-upgrade | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'FS/bin') diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index 4a6fac293..e22afa26c 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 upgrade_sqlradius); my $start = time; @@ -82,6 +82,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); -- cgit v1.2.1 From 798c63aa6265165ea56c3a7543e3e477e6dc12d4 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 24 Aug 2010 03:06:52 +0000 Subject: script to remove payment info from canceled customers, RT#9652 --- FS/bin/freeside-wipe-cvv | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 FS/bin/freeside-wipe-cvv (limited to 'FS/bin') diff --git a/FS/bin/freeside-wipe-cvv b/FS/bin/freeside-wipe-cvv new file mode 100755 index 000000000..611e841ae --- /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('deleted'); + $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 + -- cgit v1.2.1 From ca44d2a9e3faeb47ad8a9419dd535a2d1ba53a30 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Aug 2010 20:09:51 +0000 Subject: insurance against prepaid double-billing, RT#9689 --- FS/bin/freeside-prepaidd | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'FS/bin') diff --git a/FS/bin/freeside-prepaidd b/FS/bin/freeside-prepaidd index 86bfe8794..2d64221de 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_credited > 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 } ); -- cgit v1.2.1 From 7d1b8dab48a9396cf0a066545750f69598f66bc8 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Aug 2010 20:14:25 +0000 Subject: insurance against prepaid double-billing, RT#9689 --- FS/bin/freeside-prepaidd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin') diff --git a/FS/bin/freeside-prepaidd b/FS/bin/freeside-prepaidd index 2d64221de..05b068b02 100644 --- a/FS/bin/freeside-prepaidd +++ b/FS/bin/freeside-prepaidd @@ -50,7 +50,7 @@ while (1) { } if ( $cust_main->total_unapplied_payments > 0 - || $cust_main->total_credited > 0 + || $cust_main->total_unapplied_credits > 0 ) { -- cgit v1.2.1 From 52339a89155fd6cb5734188119214e2b9c4a0f9b Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Aug 2010 22:04:41 +0000 Subject: blank payinfo instead of "deleted" --- FS/bin/freeside-wipe-cvv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin') diff --git a/FS/bin/freeside-wipe-cvv b/FS/bin/freeside-wipe-cvv index 611e841ae..70f0df98f 100755 --- a/FS/bin/freeside-wipe-cvv +++ b/FS/bin/freeside-wipe-cvv @@ -38,7 +38,7 @@ foreach my $cust_main ( qsearch({ print $cust_main->name, "\n"; } if($opt{'n'}) { - $cust_main->payinfo('deleted'); + $cust_main->payinfo(''); $cust_main->paydate(''); $cust_main->payby('BILL'); # can't have a CARD or CHEK without a valid payinfo -- cgit v1.2.1 From 01618f9ed8c0f96d9d17b355cc9db2e54b004397 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 25 Aug 2010 09:42:04 +0000 Subject: clear signup_info cache when starting xmlrpcd, RT#9380 --- FS/bin/freeside-selfservice-xmlrpcd | 2 ++ 1 file changed, 2 insertions(+) (limited to 'FS/bin') diff --git a/FS/bin/freeside-selfservice-xmlrpcd b/FS/bin/freeside-selfservice-xmlrpcd index fa745ecf2..e50d51605 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" -- cgit v1.2.1 From 3fbf293ee485c7b9245d1fadeb69c9b06ec075ed Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 19 Sep 2010 05:55:09 +0000 Subject: fix a series of unfortunate upgrades which resulted in too much payment receiptery, RT#9723 --- FS/bin/freeside-upgrade | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'FS/bin') diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index e22afa26c..d3723a188 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_schema upgrade upgrade_sqlradius); +use FS::Upgrade qw(upgrade_schema upgrade_config upgrade upgrade_sqlradius); my $start = time; @@ -199,6 +199,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; -- cgit v1.2.1 From 97803d56c88dc4760140d912a76cb2730fcbf713 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 2 Oct 2010 20:54:27 +0000 Subject: mandatory custom field flag, RT#9260 --- FS/bin/freeside-upgrade | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'FS/bin') diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index d3723a188..aca545b84 100755 --- a/FS/bin/freeside-upgrade +++ b/FS/bin/freeside-upgrade @@ -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"; -- cgit v1.2.1 From 708b7bd0a10a5bf6be81ce21d946e05e046a00ed Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 13 Oct 2010 23:14:04 +0000 Subject: fix bad POD in manpages, especially freeside-daily -p --- FS/bin/freeside-daily | 2 +- FS/bin/freeside-monthly | 2 +- FS/bin/freeside-radgroup | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'FS/bin') diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily index e16cc5c9c..6a542c7cd 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. with today's date, irregardless of the pretend date used to pre-generate the invoices. - -p: Only process customers with the specified payby (I, I, I, I, I, I, I) + -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 a81e3e9ed..0d6ea14a2 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. "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, I, I, I, I, I, I) + -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-radgroup b/FS/bin/freeside-radgroup index ed85626d2..332632942 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 is a freeside user as added with freeside-adduser. +B is a freeside user as added with freeside-adduser. - B is the action to take. Available actions are: I +B is the action to take. Available actions are: I - B is the group to add (or remove, etc.) +B is the group to add (or remove, etc.) - B specifies which accounts will be updated. +B specifies which accounts will be updated. =head1 EXAMPLES -- cgit v1.2.1