'columns' => [
'custnum', 'serial', '', '', '', '',
'agentnum', 'int', '', '', '', '',
+ 'salesnum', 'int', 'NULL', '', '', '',
'agent_custid', 'varchar', 'NULL', $char_d, '', '',
'classnum', 'int', 'NULL', '', '', '',
'custbatch', 'varchar', 'NULL', $char_d, '', '',
'invnum', 'int', 'NULL', '', '', '',
'manual', 'char', 'NULL', 1, '', '',
'discount_term','int', 'NULL', '', '', '',
+ 'failure_status','varchar','NULL', 16, '', '',
],
'primary_key' => 'paypendingnum',
'unique' => [ [ 'payunique' ] ],
'amount', @money_type, '', '',
'currency', 'char', 'NULL', 3, '', '',
'status', 'varchar', 'NULL', $char_d, '', '',
+ 'failure_status','varchar', 'NULL', 16, '', '',
'error_message', 'varchar', 'NULL', $char_d, '', '',
],
'primary_key' => 'paybatchnum',
'locationnum', 'int', 'NULL', '', '', '',
'otaker', 'varchar', 'NULL', 32, '', '',
'usernum', 'int', 'NULL', '', '', '',
+ 'salesnum', 'int', 'NULL', '', '', '',
'order_date', @date_type, '', '',
'start_date', @date_type, '', '',
'setup', @date_type, '', '',
'index' => [ [ 'groupnum' ] ],
},
- 'access_groupsales' => {
- 'columns' => [
- 'groupsalesnum', 'serial', '', '', '', '',
- 'groupnum', 'int', '', '', '', '',
- 'salesnum', 'int', '', '', '', '',
- ],
- 'primary_key' => 'groupsalesnum',
- 'unique' => [ [ 'groupnum', 'salesnum' ] ],
- 'index' => [ [ 'groupnum' ] ],
- },
-
'access_right' => {
'columns' => [
'rightnum', 'serial', '', '', '', '',
(exists($options{'paytype'}) && $options{'paytype'})
? uc($options{'paytype'})
: uc($self->getfield('paytype')) || 'PERSONAL CHECKING';
- $content{account_name} = $self->getfield('first'). ' '.
- $self->getfield('last');
+
+ if ( $content{account_type} =~ /BUSINESS/i && $self->company ) {
+ $content{account_name} = $self->company;
+ } else {
+ $content{account_name} = $self->getfield('first'). ' '.
+ $self->getfield('last');
+ }
$content{customer_org} = $self->company ? 'B' : 'I';
$content{state_id} = exists($options{'stateid'})
} else {
- my $perror = $payment_gateway->gateway_module. " error: ".
- $transaction->error_message;
+ my $perror = $transaction->error_message;
+ #$payment_gateway->gateway_module. " error: ".
+ # removed for conciseness
my $jobnum = $cust_pay_pending->jobnum;
if ( $jobnum ) {
}
$cust_pay_pending->status('done');
- $cust_pay_pending->statustext("declined: $perror");
+ $cust_pay_pending->statustext($perror);
+ #'declined:': no, that's failure_status
+ if ( $transaction->can('failure_status') ) {
+ $cust_pay_pending->failure_status( $transaction->failure_status );
+ }
my $cpp_done_err = $cust_pay_pending->replace;
if ( $cpp_done_err ) {
my $e = "WARNING: $options{method} declined but pending payment not ".
#!/usr/bin/perl
use strict;
- use vars qw( $opt_r $opt_o $opt_v $opt_t );
-use vars qw( $opt_r $opt_p $opt_o $opt_v );
++use vars qw( $opt_r $opt_p $opt_o $opt_v $opt_t );
use Getopt::Std;
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearch qsearchs);
use FS::part_pkg;
use FS::part_pkg_option;
- getopts('ro:v:t:');
-getopts('rp:o:v:');
++getopts('rp:o:v:t:');
my $user = shift or &usage;
adminsuidsetup $user;
- foreach my $part_pkg ( qsearch('part_pkg', {}) ) {
+ my %plan;
+ %plan = ( 'plan' => $opt_p ) if $opt_p;
+
+ foreach my $part_pkg ( qsearch('part_pkg',\%plan) ) {
next if ! $part_pkg->freq && $opt_r;
- my %hash = (
- 'pkgpart' => $part_pkg->pkgpart,
- 'optionname' => $opt_o,
- );
-
- my $part_pkg_option = qsearchs('part_pkg_option', \%hash);
-
- if ( $part_pkg_option ) {
- next if $part_pkg_option->optionvalue eq $opt_v;
- $part_pkg_option->optionvalue($opt_v);
- my $error = $part_pkg_option->replace;
- die $error if $error;
- } else {
- $part_pkg_option = new FS::part_pkg_option { %hash, 'optionvalue'=>$opt_v };
- my $error = $part_pkg_option->insert;
- die $error if $error;
+ if ( $opt_o ) {
+
+ my %hash = (
+ 'pkgpart' => $part_pkg->pkgpart,
+ 'optionname' => $opt_o,
+ );
+
+ my $part_pkg_option = qsearchs('part_pkg_option', \%hash);
+
+ if ( $part_pkg_option ) {
+ next if $part_pkg_option->optionvalue eq $opt_v;
+ $part_pkg_option->optionvalue($opt_v);
+ my $error = $part_pkg_option->replace;
+ die $error if $error;
+ } else {
+ $part_pkg_option = new FS::part_pkg_option { %hash,
+ 'optionvalue'=>$opt_v,
+ };
+ my $error = $part_pkg_option->insert;
+ die $error if $error;
+ }
+
+ }
+
+ if ( $opt_t ) {
+
+ $part_pkg->taxclass($opt_t);
+ my $error = $part_pkg->replace;
+
}
}
sub usage {
- die "usage: part_pkg-bulk_change [ -r ] -o option_name -v option_value employee_username\n";
+ die "usage: part_pkg-bulk_change [ -r ] [ -o option_name -v option_value ] [ -t new_taxclass ] employee_username\n";
}
=head1 NAME
=head1 SYNOPSIS
- part_pkg-bulk_change [ -r ] -o option_name -v option_value employee_username
+ part_pkg-bulk_change [ -r ] [ -o option_name -v option_value ] [ -t new_taxclass ] employee_username
=head1 DESCRIPTION
Command-line tool to change a set of package definitions.
+Search options:
+
-r: recurring package definitions only
+Change options:
+
-o: part_pkg_option optionname
-v: part_pkg_option optionvalue
+-t: new taxclass
+
employee_username
=head1 BUGS