diff options
author | Mark Wells <mark@freeside.biz> | 2013-09-27 17:19:36 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-09-27 17:19:36 -0700 |
commit | eb3bd392a89b8b666dc512951e78913c05b98810 (patch) | |
tree | 22670bdf99b0a473abb708f6f5c55cbfa2f0c249 /httemplate/misc | |
parent | e3012c0751dad6710ea35b6d074b551bffdad09b (diff) |
invoice configurations, #24723
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/delete-invoice_conf.html | 19 | ||||
-rwxr-xr-x | httemplate/misc/email-invoice.cgi | 2 | ||||
-rwxr-xr-x | httemplate/misc/fax-invoice.cgi | 2 | ||||
-rwxr-xr-x | httemplate/misc/print-invoice.cgi | 2 | ||||
-rw-r--r-- | httemplate/misc/send-invoice.cgi | 5 |
5 files changed, 27 insertions, 3 deletions
diff --git a/httemplate/misc/delete-invoice_conf.html b/httemplate/misc/delete-invoice_conf.html new file mode 100644 index 000000000..6cc6ddc95 --- /dev/null +++ b/httemplate/misc/delete-invoice_conf.html @@ -0,0 +1,19 @@ +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right(['Edit templates', 'Edit global templates']); + +my ($query) = $cgi->keywords; +$query =~ /^(\d+)$/ or die "bad confnum"; +my $invoice_conf = FS::invoice_conf->by_key($1) + or die "couldn't find invoice_conf #$1"; +if ( !$curuser->access_right('Edit global templates') ) { + my $agentnum = FS::invoice_mode->by_key($invoice_conf->modenum)->agentnum; + die "access denied" + unless $curuser->agentnums_href->{$agentnum}; +} + +my $error = $invoice_conf->delete; # may also delete the invoice_mode +my $url = $p.'browse/invoice_conf.html'; +</%init> +<% $cgi->redirect($url) %> diff --git a/httemplate/misc/email-invoice.cgi b/httemplate/misc/email-invoice.cgi index 269722f67..b24e0420f 100755 --- a/httemplate/misc/email-invoice.cgi +++ b/httemplate/misc/email-invoice.cgi @@ -12,7 +12,7 @@ my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; -$cust_bill->email($template); +$cust_bill->email({ 'template' => $template }); my $custnum = $cust_bill->getfield('custnum'); diff --git a/httemplate/misc/fax-invoice.cgi b/httemplate/misc/fax-invoice.cgi index 2591fceb8..f72fc7eaf 100755 --- a/httemplate/misc/fax-invoice.cgi +++ b/httemplate/misc/fax-invoice.cgi @@ -12,7 +12,7 @@ my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; -$cust_bill->fax_invoice($template); +$cust_bill->fax_invoice({ 'template' => $template }); my $custnum = $cust_bill->getfield('custnum'); diff --git a/httemplate/misc/print-invoice.cgi b/httemplate/misc/print-invoice.cgi index aeef68795..5ce6e76df 100755 --- a/httemplate/misc/print-invoice.cgi +++ b/httemplate/misc/print-invoice.cgi @@ -12,7 +12,7 @@ my $invnum = $3; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; -$cust_bill->print($template); +$cust_bill->print({ 'template' => $template}); my $custnum = $cust_bill->getfield('custnum'); diff --git a/httemplate/misc/send-invoice.cgi b/httemplate/misc/send-invoice.cgi index 32dfe276d..08dd0e01c 100644 --- a/httemplate/misc/send-invoice.cgi +++ b/httemplate/misc/send-invoice.cgi @@ -13,6 +13,10 @@ my $invnum = $cgi->param('invnum'); my $template = $cgi->param('template'); my $notice_name = $cgi->param('notice_name') if $cgi->param('notice_name'); my $method = $cgi->param('method'); +my $mode; +if ( $cgi->param('mode') =~ /^(\d+)$/ ) { + $mode = $1; +} $method .= '_invoice' if $method eq 'fax'; #! @@ -21,6 +25,7 @@ die "unknown method $method" unless $method{$method}; my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; +$cust_bill->set('mode' => $mode) if $mode; $cust_bill->$method({ 'template' => $template, 'notice_name' => $notice_name, }); |