summaryrefslogtreecommitdiff
path: root/httemplate/misc
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc')
-rw-r--r--httemplate/misc/delete-invoice_conf.html19
-rwxr-xr-xhttemplate/misc/email-invoice.cgi2
-rwxr-xr-xhttemplate/misc/fax-invoice.cgi2
-rwxr-xr-xhttemplate/misc/print-invoice.cgi2
-rw-r--r--httemplate/misc/send-invoice.cgi5
-rw-r--r--httemplate/misc/xmlhttp-cust_main-duplicates.html4
6 files changed, 30 insertions, 4 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,
});
diff --git a/httemplate/misc/xmlhttp-cust_main-duplicates.html b/httemplate/misc/xmlhttp-cust_main-duplicates.html
index 7ee00af66..7cd463371 100644
--- a/httemplate/misc/xmlhttp-cust_main-duplicates.html
+++ b/httemplate/misc/xmlhttp-cust_main-duplicates.html
@@ -50,7 +50,9 @@ my $conf = new FS::Conf;
my $sub = $cgi->param('sub');
my $hashref = decode_json($cgi->param('arg'));
-my @cust_main = qsearch('cust_main', $hashref);
+my $search = FS::cust_main->search($hashref);
+#warn Dumper($search);
+my @cust_main = qsearch( $search );
my $set_to_customer = <<EOF;
var custnum_array = document.getElementsByName('dup_custnum');