blob: 0ff7d26d0f6324d779e383dab6fabaac017f765b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<% include('/elements/header-popup.html', $title ) %>
% if ( $error ) {
<FONT SIZE="+1" COLOR="#ff0000">Error: <% $error |h %></FONT>
% } else {
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>
% }
</BODY>
</HTML>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('Edit customer pending payments');
$cgi->param('action') =~ /^(\w+)$/ or die 'illegal action';
my $action = $1;
$cgi->param('paypendingnum') =~ /^(\d+)$/ or die 'illegal paypendingnum';
my $paypendingnum = $1;
my $cust_pay_pending =
qsearchs({
'select' => 'cust_pay_pending.*',
'table' => 'cust_pay_pending',
'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
'hashref' => { 'paypendingnum' => $paypendingnum },
'extra_sql' => ' AND '. $curuser->agentnums_sql,
})
or die 'unknown paypendingnum';
my $error;
my $title;
if ( $action eq 'delete' ) {
$error = $cust_pay_pending->delete;
if ( $error ) {
$title = 'Error deleting pending payment';
} else {
$title = 'Pending payment deletion sucessful';
}
} elsif ( $action eq 'insert_cust_pay' ) {
$error = $cust_pay_pending->insert_cust_pay;
if ( $error ) {
$title = 'Error completing pending payment';
} else {
$title = 'Pending payment completed';
}
} elsif ( $action eq 'decline' ) {
$error = $cust_pay_pending->decline;
if ( $error ) {
$title = 'Error declining pending payment';
} else {
$title = 'Pending payment completed (decline)';
}
} elsif ( $action eq 'reverse' ) {
$error = $cust_pay_pending->reverse;
if ( $error ) {
$title = 'Error reversing pending payment';
} else {
$title = 'Pending payment completed (reverse)';
}
} else {
die "unknown action $action";
}
</%init>
|