summaryrefslogtreecommitdiff
path: root/httemplate/edit/process
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-xhttemplate/edit/process/cust_credit-pkgnum.html35
-rwxr-xr-xhttemplate/edit/process/cust_pay-pkgnum.html35
2 files changed, 70 insertions, 0 deletions
diff --git a/httemplate/edit/process/cust_credit-pkgnum.html b/httemplate/edit/process/cust_credit-pkgnum.html
new file mode 100755
index 000000000..8941cbc73
--- /dev/null
+++ b/httemplate/edit/process/cust_credit-pkgnum.html
@@ -0,0 +1,35 @@
+%if ($error) {
+% $cgi->param('error', $error);
+<% $cgi->redirect(popurl(2). 'cust_credit-pkgnum.html?'. $cgi->query_string ) %>
+%} else {
+<% header(emt('Credit package changed')) %>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+
+ </BODY></HTML>
+%}
+<%init>
+
+my $conf = FS::Conf->new;
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); #own ACL?
+
+$cgi->param('crednum') =~ /^(\d+)$/
+ or die "Illegal crednum: ". $cgi->param('crednum');
+my $crednum = $1;
+
+my $cust_credit = qsearchs({
+ 'select' => 'cust_credit.*',
+ 'table' => 'cust_credit',
+ 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
+ 'hashref' => { crednum => scalar($cgi->param('crednum')), },
+ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+})
+ or die 'unknown credit';
+
+$cust_credit->pkgnum( $cgi->param('pkgnum') );
+my $error = $cust_credit->replace;
+
+</%init>
diff --git a/httemplate/edit/process/cust_pay-pkgnum.html b/httemplate/edit/process/cust_pay-pkgnum.html
new file mode 100755
index 000000000..d9a92a1de
--- /dev/null
+++ b/httemplate/edit/process/cust_pay-pkgnum.html
@@ -0,0 +1,35 @@
+%if ($error) {
+% $cgi->param('error', $error);
+<% $cgi->redirect(popurl(2). 'cust_pay-pkgnum.html?'. $cgi->query_string ) %>
+%} else {
+<% header(emt('Payment package changed')) %>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+
+ </BODY></HTML>
+%}
+<%init>
+
+my $conf = FS::Conf->new;
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); #own ACL?
+
+$cgi->param('paynum') =~ /^(\d+)$/
+ or die "Illegal paynum: ". $cgi->param('paynum');
+my $paynum = $1;
+
+my $cust_pay = qsearchs({
+ 'select' => 'cust_pay.*',
+ 'table' => 'cust_pay',
+ 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
+ 'hashref' => { paynum => scalar($cgi->param('paynum')), },
+ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+})
+ or die 'unknown payment';
+
+$cust_pay->pkgnum( $cgi->param('pkgnum') );
+my $error = $cust_pay->replace;
+
+</%init>