summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/edit/agent_payment_gateway.html1
-rw-r--r--httemplate/edit/payment_gateway.html141
-rw-r--r--httemplate/edit/process/payment_gateway.html1
-rw-r--r--httemplate/elements/select-tiered.html2
-rwxr-xr-xhttemplate/misc/cancel-unaudited.cgi37
-rw-r--r--httemplate/misc/delete-note.html11
-rw-r--r--httemplate/search/cust_svc.html24
-rwxr-xr-xhttemplate/view/cust_main/notes.html6
-rw-r--r--httemplate/view/elements/svc_Common.html36
-rw-r--r--httemplate/view/svc_Common.html2
10 files changed, 161 insertions, 100 deletions
diff --git a/httemplate/edit/agent_payment_gateway.html b/httemplate/edit/agent_payment_gateway.html
index 4a7cedf79..41a9f3e95 100644
--- a/httemplate/edit/agent_payment_gateway.html
+++ b/httemplate/edit/agent_payment_gateway.html
@@ -34,6 +34,7 @@ for <SELECT NAME="cardtype" MULTIPLE>
% "Switch",
% "Solo",
% 'ACH',
+% 'PayPal',
%) {
<OPTION VALUE="<% $cardtype %>"><% $cardtype || '(Default fallback)' %>
diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html
index a469beb7f..7cfab71d8 100644
--- a/httemplate/edit/payment_gateway.html
+++ b/httemplate/edit/payment_gateway.html
@@ -13,15 +13,16 @@
'gateway_action' => 'Action',
'gateway_options' => 'Options (Name/Value pairs, <BR>one element per line)',
'gateway_callback_url' => 'Callback URL',
+ 'gateway_cancel_url' => 'Cancel URL',
},
)
%>
<SCRIPT TYPE="text/javascript">
- var modulesForNamespace = <% encode_json(\%modules_for_namespace, {canonical=>1}) %>;
- function changeNamespace(what) {
- var ns = what.value;
+ var modulesForNamespace = <% $json->encode(\%modules) %>;
+ function changeNamespace() {
+ var ns = document.getElementById('gateway_namespace').value;
var select_module = document.getElementById('gateway_module');
select_module.options.length = 0;
for (var x in modulesForNamespace[ns]) {
@@ -30,6 +31,7 @@
select_module.add(o, null);
}
}
+ window.onload = changeNamespace;
</SCRIPT>
<%init>
@@ -37,69 +39,71 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my %modules = (
- '2CheckOut' => 'Business::OnlinePayment',
- 'AuthorizeNet' => 'Business::OnlinePayment',
- 'BankOfAmerica' => 'Business::OnlinePayment', #deprecated?
- 'Beanstream' => 'Business::OnlinePayment',
- 'Capstone' => 'Business::OnlinePayment',
- 'Cardstream' => 'Business::OnlinePayment',
- 'CashCow' => 'Business::OnlinePayment',
- 'CyberSource' => 'Business::OnlinePayment',
- 'eSec' => 'Business::OnlinePayment',
- 'eSelectPlus' => 'Business::OnlinePayment',
- 'eWayShared' => 'Business::OnlineThirdPartyPayment',
- 'ElavonVirtualMerchant' => 'Business::OnlinePayment',
- 'Exact' => 'Business::OnlinePayment',
- 'iAuthorizer' => 'Business::OnlinePayment',
- 'Ingotz' => 'Business::OnlinePayment',
- 'InternetSecure' => 'Business::OnlinePayment',
- 'Interswitchng' => 'Business::OnlineThirdPartyPayment',
- 'IPaymentTPG' => 'Business::OnlinePayment',
- 'IPPay' => 'Business::OnlinePayment',
- 'Iridium' => 'Business::OnlinePayment',
- 'Jettis' => 'Business::OnlinePayment',
- 'Jety' => 'Business::OnlinePayment',
- 'LinkPoint' => 'Business::OnlinePayment',
- 'MerchantCommerce' => 'Business::OnlinePayment',
- 'Network1Financial' => 'Business::OnlinePayment',
- 'OCV' => 'Business::OnlinePayment',
- 'OpenECHO' => 'Business::OnlinePayment',
- 'PayConnect' => 'Business::OnlinePayment',
- 'PayflowPro' => 'Business::OnlinePayment',
- 'PaymenTech' => 'Business::OnlinePayment',
- 'PaymentsGateway' => 'Business::OnlinePayment',
- 'PayPal' => 'Business::OnlinePayment',
- #'PaySystems' => 'Business::OnlinePayment',
- 'PlugnPay' => 'Business::OnlinePayment',
- 'PPIPayMover' => 'Business::OnlinePayment',
- 'Protx' => 'Business::OnlinePayment', #now SagePay
- 'PXPost' => 'Business::OnlinePayment',
- 'SagePay' => 'Business::OnlinePayment',
- 'SecureHostingUPG' => 'Business::OnlinePayment',
- 'Skipjack' => 'Business::OnlinePayment',
- 'StGeorge' => 'Business::OnlinePayment',
- 'SurePay' => 'Business::OnlinePayment',
- 'TCLink' => 'Business::OnlinePayment',
- 'TransactionCentral' => 'Business::OnlinePayment',
- 'TransFirsteLink' => 'Business::OnlinePayment',
- 'Vanco' => 'Business::OnlinePayment',
- 'viaKLIX' => 'Business::OnlinePayment',
- 'VirtualNet' => 'Business::OnlinePayment',
- 'WesternACH' => 'Business::OnlinePayment',
- 'WorldPay' => 'Business::OnlinePayment',
-
- 'KeyBank' => 'Business::BatchPayment',
- 'Paymentech' => 'Business::BatchPayment',
- 'TD_EFT' => 'Business::BatchPayment',
+my $json = JSON::XS->new;
+$json->canonical(1);
+my %modules = (
+ 'Business::OnlinePayment' => [
+ '2CheckOut',
+ 'AuthorizeNet',
+ 'BankOfAmerica', #deprecated?
+ 'Beanstream',
+ 'Capstone',
+ 'Cardstream',
+ 'CashCow',
+ 'CyberSource',
+ 'eSec',
+ 'eSelectPlus',
+ 'ElavonVirtualMerchant',
+ 'Exact',
+ 'iAuthorizer',
+ 'Ingotz',
+ 'InternetSecure',
+ 'IPaymentTPG',
+ 'IPPay',
+ 'Iridium',
+ 'Jettis',
+ 'Jety',
+ 'LinkPoint',
+ 'MerchantCommerce',
+ 'Network1Financial',
+ 'OCV',
+ 'OpenECHO',
+ 'PayConnect',
+ 'PayflowPro',
+ 'PaymenTech',
+ 'PaymentsGateway',
+ 'PayPal',
+ #'PaySystems',
+ 'PlugnPay',
+ 'PPIPayMover',
+ 'Protx', #now SagePay
+ 'PXPost',
+ 'SagePay',
+ 'SecureHostingUPG',
+ 'Skipjack',
+ 'StGeorge',
+ 'SurePay',
+ 'TCLink',
+ 'TransactionCentral',
+ 'TransFirsteLink',
+ 'Vanco',
+ 'viaKLIX',
+ 'VirtualNet',
+ 'WesternACH',
+ 'WorldPay',
+ ],
+ 'Business::OnlineThirdPartyPayment' => [
+ 'eWayShared',
+ 'Interswitchng',
+ 'PayPal',
+ ],
+ 'Business::BatchPayment' => [
+ 'KeyBank',
+ 'Paymentech',
+ 'TD_EFT',
+ ],
);
-my %modules_for_namespace;
-for (keys %modules) {
- $modules_for_namespace{$modules{$_}} ||= [];
- push @{ $modules_for_namespace{$modules{$_}} }, $_;
-}
-
my @actions = (
'Normal Authorization',
'Authorization Only',
@@ -125,7 +129,9 @@ my $fields = [
{
field => 'gateway_module',
type => 'select',
- options => [ sort { lc($a) cmp lc ($b) } keys %modules ],
+ # does it even make sense to list all modules here?
+ options => [ sort { lc($a) cmp lc ($b) }
+ map { @$_ } values %modules ],
},
'gateway_username',
'gateway_password',
@@ -140,6 +146,11 @@ my $fields = [
size => 40,
},
{
+ field => 'gateway_cancel_url',
+ type => 'text',
+ size => 40,
+ },
+ {
field => 'gateway_options',
type => 'textarea',
rows => '12',
diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html
index 812c988c5..157449e89 100644
--- a/httemplate/edit/process/payment_gateway.html
+++ b/httemplate/edit/process/payment_gateway.html
@@ -15,6 +15,7 @@ my $args_callback = sub {
my @options = split(/\r?\n/, $cgi->param('gateway_options') );
pop @options
if scalar(@options) % 2 && $options[-1] =~ /^\s*$/;
+ @options = ( {} ) if !@options;
(@options)
};
diff --git a/httemplate/elements/select-tiered.html b/httemplate/elements/select-tiered.html
index 3ff5471ae..48469dc04 100644
--- a/httemplate/elements/select-tiered.html
+++ b/httemplate/elements/select-tiered.html
@@ -174,6 +174,8 @@ for( $i = 0; $i < @$tiers; $i++ ) {
$children_of{$key}->{''} = $tier->{empty_label};
}
}
+ # ensure that there's always at least one empty label
+ $children_of{''}->{''} = $tier->{empty_label};
}
$tier->{by_key} = \%children_of;
}
diff --git a/httemplate/misc/cancel-unaudited.cgi b/httemplate/misc/cancel-unaudited.cgi
index 4919c6632..4b3084f00 100755
--- a/httemplate/misc/cancel-unaudited.cgi
+++ b/httemplate/misc/cancel-unaudited.cgi
@@ -15,19 +15,32 @@ my($query) = $cgi->keywords;
$query =~ /^(\d+)$/;
my $svcnum = $1;
-#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
-#die "Unknown svcnum!" unless $svc_acct;
-
+my $error = '';
my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum});
-die "Unknown svcnum!" unless $cust_svc;
-my $cust_pkg = $cust_svc->cust_pkg;
-if ( $cust_pkg ) {
- errorpage( 'This account has already been audited. Cancel the '.
- qq!<A HREF="${p}view/cust_main.cgi?!. $cust_pkg->custnum.
- '#cust_pkg'. $cust_pkg->pkgnum. '">'.
- 'package</A> instead.');
-}
+if ( $cust_svc ) {
+ my $cust_pkg = $cust_svc->cust_pkg;
+ if ( $cust_pkg ) {
+ errorpage( 'This account has already been audited. Cancel the '.
+ qq!<A HREF="${p}view/cust_main.cgi?!. $cust_pkg->custnum.
+ '#cust_pkg'. $cust_pkg->pkgnum. '">'.
+ 'package</A> instead.'); #'
+ }
-my $error = $cust_svc->cancel;
+ $error = $cust_svc->cancel;
+} else {
+ # the rare obscure case: svc_x without cust_svc
+ my $svc_x;
+ foreach my $svcdb (FS::part_svc->svc_tables) {
+ $svc_x = qsearchs($svcdb, { 'svcnum' => $svcnum });
+ last if $svc_x;
+ }
+ if ( $svc_x ) {
+ $error = $svc_x->return_inventory
+ || $svc_x->FS::Record::delete;
+ } else {
+ # the svcnum really doesn't exist
+ $error = "svcnum $svcnum not found";
+ }
+}
</%init>
diff --git a/httemplate/misc/delete-note.html b/httemplate/misc/delete-note.html
new file mode 100644
index 000000000..436326ff1
--- /dev/null
+++ b/httemplate/misc/delete-note.html
@@ -0,0 +1,11 @@
+<%init>
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Edit customer note');
+
+my ($notenum) = $cgi->keywords;
+$notenum =~ /^\d+$/ or die "bad notenum '$notenum'";
+my $note = FS::cust_main_note->by_key($notenum)
+ or die "notenum '$notenum' not found";
+$note->delete;
+</%init>
+<% $cgi->redirect($p.'view/cust_main.cgi?'.$note->custnum) %>
diff --git a/httemplate/search/cust_svc.html b/httemplate/search/cust_svc.html
index e2a83b7de..b245d3114 100644
--- a/httemplate/search/cust_svc.html
+++ b/httemplate/search/cust_svc.html
@@ -96,6 +96,7 @@ if ( length( $cgi->param('search_svc') ) ) {
my $extra_sql = ' WHERE '. join(' AND ', @extra_sql );
$sql_query = {
+ 'select' => 'svcnum',
'table' => 'cust_svc',
'addl_from' => $addl_from,
'hashref' => {},
@@ -105,8 +106,8 @@ if ( length( $cgi->param('search_svc') ) ) {
}
$sql_query->{'select'} = join(', ',
- 'cust_svc.*',
- 'part_svc.*',
+ $sql_query->{'select'},
+ #'part_svc.*',
'cust_main.custnum',
FS::UI::Web::cust_sql_fields(),
);
@@ -117,14 +118,17 @@ my $count_query = "SELECT COUNT(*) FROM cust_svc ". $sql_query->{addl_from}.
my $link = sub {
my $cust_svc = shift;
- my $url = svc_url(
- 'm' => $m,
- 'action' => 'view',
- #'part_svc' => $cust_svc->part_svc,
- 'svcdb' => $cust_svc->svcdb, #we have it from the joined search
- #'svc' => $cust_svc, #redundant
- 'query' => '',
- );
+ my $url;
+ if ( $cust_svc->svcpart ) {
+ $url = svc_url(
+ 'm' => $m,
+ 'action' => 'view',
+ 'svcdb' => $cust_svc->svcdb, #we have it from the joined search
+ 'query' => '',
+ );
+ } else { # bizarre unlinked service case
+ $url = $p.'view/svc_Common.html?svcdb='.$cust_svc->svcdb.';svcnum=';
+ }
[ $url, 'svcnum' ];
};
diff --git a/httemplate/view/cust_main/notes.html b/httemplate/view/cust_main/notes.html
index 1e9f464db..2de68ff46 100755
--- a/httemplate/view/cust_main/notes.html
+++ b/httemplate/view/cust_main/notes.html
@@ -63,7 +63,11 @@
%
% my $edit = '';
% if ($curuser->access_right('Edit customer note') ) {
-% $edit = qq! <A HREF="javascript:void(0);" $clickjs>(!.emt('edit').')</A>';
+% my $delete_url = $fsurl.'misc/delete-note.html?'.$notenum;
+% $edit = qq! <A HREF="javascript:void(0);" $clickjs>(!.emt('edit').')</A>'.
+% qq! <A HREF="$delete_url" !.
+% qq! onclick="return confirm('Delete this note?')">!.
+% '('.emt('delete').')</A>';
% }
%
% if ( $last_classnum != $note->classnum && !$skipheader ) {
diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html
index d735195fe..997ac142a 100644
--- a/httemplate/view/elements/svc_Common.html
+++ b/httemplate/view/elements/svc_Common.html
@@ -51,8 +51,10 @@ function areyousure(href) {
% }
<% mt('Service #') |h %><B><% $svcnum %></B>
-% my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?';
+% if ( $custnum ) {
+% my $url = $opt{'edit_url'} || $p. 'edit/'. $opt{'table'}. '.cgi?';
<& /view/elements/svc_edit_link.html, 'svc' => $svc_x, 'edit_url' => $url &>
+% }
<BR>
<% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
@@ -127,7 +129,9 @@ function areyousure(href) {
% }
+% if ( $cust_svc ) {
<& /elements/table-tickets.html, object => $cust_svc &>
+% }
<% joblisting({'svcnum'=>$svcnum}, 1) %>
@@ -150,7 +154,7 @@ my $fields = $opt{'fields'}
my $svcnum;
if ( $cgi->param('svcnum') ) {
- $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparsable svcnum";
+ $cgi->param('svcnum') =~ /^(\d+)$/ or die "unparseable svcnum";
$svcnum = $1;
} else {
my($query) = $cgi->keywords;
@@ -170,19 +174,29 @@ my $svc_x = qsearchs({
}) or die "Unknown svcnum $svcnum in ". $opt{'table'}. " table\n";
my $cust_svc = $svc_x->cust_svc;
-my($label, $value, $svcdb) = $cust_svc->label;
+my ($label, $value, $svcdb, $part_svc );
+my $labels = $opt{labels}; #not -> here
-my $part_svc = $cust_svc->part_svc;
+if ( $cust_svc ) {
+ ($label, $value, $svcdb) = $cust_svc->label;
-#false laziness w/edit/svc_Common.html
-#override default labels with service-definition labels if applicable
-my $labels = $opt{labels}; #not -> here
-foreach my $field ( keys %$labels ) {
- my $col = $part_svc->part_svc_column($field);
- $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\s*$/;
+ $part_svc = $cust_svc->part_svc;
+
+ #false laziness w/edit/svc_Common.html
+ #override default labels with service-definition labels if applicable
+ foreach my $field ( keys %$labels ) {
+ my $col = $part_svc->part_svc_column($field);
+ $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\s*$/;
+ }
+} else {
+ $label = "Unlinked $table";
+ $value = $svc_x->label;
+ $svcdb = $table;
+ # just to satisfy callbacks
+ $part_svc = FS::part_svc->new({ svcpart => 0, svcdb => $table });
}
-my $pkgnum = $cust_svc->pkgnum;
+my $pkgnum = $cust_svc->pkgnum if $cust_svc;
my($cust_pkg, $custnum);
if ($pkgnum) {
diff --git a/httemplate/view/svc_Common.html b/httemplate/view/svc_Common.html
index 7b46dc9c9..7e300b049 100644
--- a/httemplate/view/svc_Common.html
+++ b/httemplate/view/svc_Common.html
@@ -7,7 +7,7 @@
# false laziness w/edit/svc_Common.html
-$cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparsable svcdb";
+$cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparseable svcdb";
my $table = $1;
require "FS/$table.pm";