summaryrefslogtreecommitdiff
path: root/httemplate/misc/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc/process')
-rw-r--r--httemplate/misc/process/batch-cust_pay.cgi34
-rw-r--r--httemplate/misc/process/cust_main-import_charges.cgi3
-rw-r--r--httemplate/misc/process/cust_main_note-import.cgi41
-rw-r--r--httemplate/misc/process/cust_pay-import.cgi2
-rw-r--r--httemplate/misc/process/cust_pkg-import.html10
-rwxr-xr-xhttemplate/misc/process/delete-customer.cgi2
-rw-r--r--httemplate/misc/process/email-customers.html2
-rw-r--r--httemplate/misc/process/payment.cgi26
8 files changed, 81 insertions, 39 deletions
diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi
index 058a2251a..e51b9e6d7 100644
--- a/httemplate/misc/process/batch-cust_pay.cgi
+++ b/httemplate/misc/process/batch-cust_pay.cgi
@@ -10,13 +10,33 @@
% #my $row = 0;
% #while ( exists($param->{"custnum$row"}) ) {
% for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
+% my $custnum = $param->{"custnum$row"};
+% my $cust_main;
+% if ( $custnum =~ /^(\d+)$/ and $1 <= 2147483647 ) {
+% $cust_main = qsearchs({
+% 'table' => 'cust_main',
+% 'hashref' => { 'custnum' => $1 },
+% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+% });
+% }
+% if ( !$cust_main ) { # not found, try agent_custid
+% $cust_main = qsearchs({
+% 'table' => 'cust_main',
+% 'hashref' => { 'agent_custid' => $custnum },
+% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+% });
+% }
+% $custnum = $cust_main->custnum if $cust_main;
+% # if !$cust_main, then this will throw an error on batch_insert
+%
% push @cust_pay, new FS::cust_pay {
-% 'custnum' => $param->{"custnum$row"},
-% 'paid' => $param->{"paid$row"},
-% 'payby' => 'BILL',
-% 'payinfo' => $param->{"payinfo$row"},
-% 'paybatch' => $paybatch,
-% }
+% 'custnum' => $custnum,
+% 'paid' => $param->{"paid$row"},
+% 'payby' => 'BILL',
+% 'payinfo' => $param->{"payinfo$row"},
+% 'discount_term' => $param->{"discount_term$row"},
+% 'paybatch' => $paybatch,
+% }
% if $param->{"custnum$row"}
% || $param->{"paid$row"}
% || $param->{"payinfo$row"};
@@ -42,6 +62,6 @@
% } else {
%
%
-<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %>
+<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %>
% }
diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi
index 3ca68944a..bda3e3b70 100644
--- a/httemplate/misc/process/cust_main-import_charges.cgi
+++ b/httemplate/misc/process/cust_main-import_charges.cgi
@@ -16,7 +16,8 @@ my $fh = $cgi->upload('csvfile');
my $error = defined($fh)
? FS::cust_main::batch_charge( {
filehandle => $fh,
- 'fields' => [qw( custnum amount pkg )],
+ 'agentnum' => scalar($cgi->param('agentnum')),
+ 'format' => scalar($cgi->param('format')),
} )
: 'No file';
diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi
index 6aa8b1d37..6625e0029 100644
--- a/httemplate/misc/process/cust_main_note-import.cgi
+++ b/httemplate/misc/process/cust_main_note-import.cgi
@@ -26,6 +26,7 @@ The following items <% $op eq 'Preview' ? 'would be' : 'were' %> imported. (See
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Import');
+$FS::cust_main::import=1; # the customer records are already in the database
my $date = time;
my $otaker = $FS::CurrentUser::CurrentUser->username;
my $csv = new Text::CSV_XS;
@@ -38,25 +39,27 @@ my @inserted = ();
my @uninserted = ();
for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
if ( $param->{"custnum$row"} ) {
-# my $cust_main_note = new FS::cust_main_note {
-# 'custnum' => $param->{"custnum$row"},
-# '_date' => $date,
-# 'otaker' => $otaker,
-# 'comments' => $param->{"note$row"},
-# };
-# my $error = '';
-# $error = $cust_main_note->insert unless ($op eq "Preview");
- my $cust_main = qsearchs('cust_main',
- { 'custnum' => $param->{"custnum$row"} }
- );
- my $error;
- if ($cust_main) {
- $cust_main->comments
- ? $cust_main->comments($cust_main->comments. " ". $param->{"note$row"})
- : $cust_main->comments($param->{"note$row"});
- $error = $cust_main->replace;
- }else{
- $error = "Can't find customer " . $param->{"custnum$row"};
+ my $error = '';
+ if ( $param->{use_comments} ) { # why? notes are sexier
+ my $cust_main = qsearchs('cust_main',
+ { 'custnum' => $param->{"custnum$row"} }
+ );
+ if ($cust_main) {
+ $cust_main->comments
+ ? $cust_main->comments($cust_main->comments. " ". $param->{"note$row"})
+ : $cust_main->comments($param->{"note$row"});
+ $error = $cust_main->replace;
+ }else{
+ $error = "Can't find customer " . $param->{"custnum$row"};
+ }
+ } else {
+ my $cust_main_note = new FS::cust_main_note {
+ 'custnum' => $param->{"custnum$row"},
+ '_date' => $date,
+ 'otaker' => $otaker,
+ 'comments' => $param->{"note$row"},
+ };
+ $error = $cust_main_note->insert unless ($op eq "Preview");
}
my $result = { 'custnum' => $param->{"custnum$row"},
'last' => $param->{"last$row"},
diff --git a/httemplate/misc/process/cust_pay-import.cgi b/httemplate/misc/process/cust_pay-import.cgi
index d4ff226ec..92b6e5a36 100644
--- a/httemplate/misc/process/cust_pay-import.cgi
+++ b/httemplate/misc/process/cust_pay-import.cgi
@@ -1,4 +1,4 @@
-<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %>
+<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %>
<%init>
my $fh = $cgi->upload('csvfile');
diff --git a/httemplate/misc/process/cust_pkg-import.html b/httemplate/misc/process/cust_pkg-import.html
new file mode 100644
index 000000000..1021817e4
--- /dev/null
+++ b/httemplate/misc/process/cust_pkg-import.html
@@ -0,0 +1,10 @@
+<% $server->process %>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Import');
+
+my $server =
+ new FS::UI::Web::JSRPC 'FS::cust_pkg::Import::process_batch_import', $cgi;
+
+</%init>
diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi
index d509a5e0e..12011311a 100755
--- a/httemplate/misc/process/delete-customer.cgi
+++ b/httemplate/misc/process/delete-customer.cgi
@@ -28,6 +28,6 @@ if ( $cgi->param('new_custnum') ) {
my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } )
or die "Customer not found: $custnum";
-my $error = $cust_main->delete($new_custnum);
+my $error = $cust_main->delete('new_custnum' => $new_custnum);
</%init>
diff --git a/httemplate/misc/process/email-customers.html b/httemplate/misc/process/email-customers.html
index c54bc6dca..de2bb926b 100644
--- a/httemplate/misc/process/email-customers.html
+++ b/httemplate/misc/process/email-customers.html
@@ -4,6 +4,6 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices');
-my $server = new FS::UI::Web::JSRPC 'FS::cust_main::process_email_search_result', $cgi;
+my $server = new FS::UI::Web::JSRPC 'FS::cust_main_Mixin::process_email_search_result', $cgi;
</%init>
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index 665001ea9..c1c9071f9 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -119,19 +119,26 @@ if ( $payby eq 'CHEK' ) {
die "unknown payby $payby";
}
+$cgi->param('discount_term') =~ /^\d*$/
+ or errorpage("illegal discount_term");
+my $discount_term = $1;
+
my $error = '';
my $paynum = '';
if ( $cgi->param('batch') ) {
- $error = $cust_main->batch_card(
- 'payby' => $payby,
- 'amount' => $amount,
- 'payinfo' => $payinfo,
- 'paydate' => "$year-$month-01",
- 'payname' => $payname,
- map { $_ => $cgi->param($_) }
- @{$payby2fields{$payby}}
- );
+ $error = 'Prepayment discounts not supported with batched payments'
+ if $discount_term;
+
+ $error ||= $cust_main->batch_card(
+ 'payby' => $payby,
+ 'amount' => $amount,
+ 'payinfo' => $payinfo,
+ 'paydate' => "$year-$month-01",
+ 'payname' => $payname,
+ map { $_ => $cgi->param($_) }
+ @{$payby2fields{$payby}}
+ );
errorpage($error) if $error;
} else {
@@ -146,6 +153,7 @@ if ( $cgi->param('batch') ) {
'payunique' => $payunique,
'paycvv' => $paycvv,
'paynum_ref' => \$paynum,
+ 'discount_term' => $discount_term,
map { $_ => $cgi->param($_) } @{$payby2fields{$payby}}
);
errorpage($error) if $error;