diff options
author | ivan <ivan> | 2004-01-09 22:11:54 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-01-09 22:11:54 +0000 |
commit | f3212b82d6d54500bbe31c02c8ffa456f018a067 (patch) | |
tree | 71af32913a105b30f105a0eeb2bab4caa668ff38 /httemplate | |
parent | e68e85f88922d6678a9c6fc1a7624065e38b7361 (diff) |
add deletecredits config value to enable deletion of credits
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/misc/delete-cust_credit.cgi | 16 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 11 |
2 files changed, 26 insertions, 1 deletions
diff --git a/httemplate/misc/delete-cust_credit.cgi b/httemplate/misc/delete-cust_credit.cgi new file mode 100755 index 000000000..30de04d27 --- /dev/null +++ b/httemplate/misc/delete-cust_credit.cgi @@ -0,0 +1,16 @@ +<% + +#untaint crednum +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal crednum"; +my $crednum = $1; + +my $cust_credit = qsearchs('cust_credit',{'crednum'=>$crednum}); +my $custnum = $cust_credit->custnum; + +my $error = $cust_credit->delete; +eidiot($error) if $error; + +print $cgi->redirect($p. "view/cust_main.cgi?". $custnum); + +%> diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index fb015671f..8123b2f82 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -554,6 +554,11 @@ function cust_pay_unapply_areyousure(href) { == true) window.location.href = href; } +function cust_credit_areyousure(href) { + if (confirm("Are you sure you want to delete this credit?") + == true) + window.location.href = href; +} </SCRIPT> END @@ -628,9 +633,13 @@ if ( $conf->config('payby-default') ne 'HIDE' ) { $cust_credit->reason, time2str("%D", $cust_credit_bill->_date), ); + my $delete = + $cust_credit->closed !~ /^Y/i && $conf->exists('deletecredits') + ? qq! (<A HREF="javascript:cust_credit_areyousure('${p}misc/delete-cust_credit.cgi?!. $cust_credit->crednum. qq!')">delete</A>)! + : ''; push @history, "$date\tCredit #$crednum: $reason<BR>". - "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; + "(applied to invoice #$invnum on $app_date)$delete\t\t\t$amount\t"; } } |