diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-07-02 14:24:21 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-07-02 14:24:21 -0700 |
commit | 85e677b86fc37c54e6de2b06340351a28f5a5916 (patch) | |
tree | 11148e2c292bd1a43b7cf6c2f5212a6ca8b03e75 /httemplate | |
parent | e5ab051ccdb7637d8dd2f0ed9b4fe9aaaf1d1100 (diff) | |
parent | 92aedddd3684167abb60cd3f1d77bbc156c592e6 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/payment_gateway.html | 4 | ||||
-rw-r--r-- | httemplate/edit/payment_gateway.html | 56 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 63 | ||||
-rw-r--r-- | httemplate/elements/xmenu.css | 2 | ||||
-rw-r--r-- | httemplate/elements/xmenu.top.css | 2 | ||||
-rw-r--r-- | httemplate/misc/download-batch.cgi | 13 | ||||
-rw-r--r-- | httemplate/search/elements/cust_pay_batch_top.html | 35 | ||||
-rwxr-xr-x | httemplate/search/pay_batch.cgi | 20 |
8 files changed, 142 insertions, 53 deletions
diff --git a/httemplate/browse/payment_gateway.html b/httemplate/browse/payment_gateway.html index a06e5cf7c..7a8a668d7 100644 --- a/httemplate/browse/payment_gateway.html +++ b/httemplate/browse/payment_gateway.html @@ -77,9 +77,9 @@ my $options_sub = sub { my $html = '<TABLE CELLSPACING=0 CELLPADDING=0>'; - my %options = $payment_gateway->options; + tie my %options, 'Tie::IxHash', $payment_gateway->options; foreach my $option ( keys %options ) { - $html .= '<TR><TH>'. $option. ':</TH>'. + $html .= '<TR><TH ALIGN="right">'. $option. ':</TH>'. '<TD>'. $options{$option}. '</TD></TR>'; } $html .= '</TABLE>'; diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html index cfb86048c..2840df35b 100644 --- a/httemplate/edit/payment_gateway.html +++ b/httemplate/edit/payment_gateway.html @@ -6,11 +6,12 @@ 'field_callback' => $field_callback, 'labels' => { 'gatewaynum' => 'Gateway', + 'gateway_namespace' => 'Gateway type', 'gateway_module' => 'Gateway', 'gateway_username' => 'Username', 'gateway_password' => 'Password', 'gateway_action' => 'Action', - 'gateway_options' => 'Options: (Name/Value pairs, one element per line)', + 'gateway_options' => 'Options (Name/Value pairs, <BR>one element per line)', 'gateway_callback_url' => 'Callback URL', }, ) @@ -18,18 +19,18 @@ <SCRIPT TYPE="text/javascript"> - var gatewayNamespace = new Array; - -% foreach my $module ( sort { lc($a) cmp lc ($b) } keys %modules ) { - gatewayNamespace.push('<% $modules{$module} %>') -% } - - // document.getElementById('gateway_namespace').value = gatewayNamespace[0]; - function setNamespace(what) { - document.getElementById('gateway_namespace').value = - gatewayNamespace[what.selectedIndex]; +% my $json = JSON->new->canonical; + var modulesForNamespace = <% $json->encode(\%modules_for_namespace) %>; + function changeNamespace(what) { + var ns = what.value; + var select_module = document.getElementById('gateway_module'); + select_module.options.length = 0; + for (var x in modulesForNamespace[ns]) { + var o = document.createElement('option'); + o.value = o.text = modulesForNamespace[ns][x]; + select_module.add(o, null); + } } - </SCRIPT> <%init> @@ -67,6 +68,7 @@ my %modules = ( 'OpenECHO' => 'Business::OnlinePayment', 'PayConnect' => 'Business::OnlinePayment', 'PayflowPro' => 'Business::OnlinePayment', + 'Paymentech' => 'Business::BatchPayment', 'PaymenTech' => 'Business::OnlinePayment', 'PaymentsGateway' => 'Business::OnlinePayment', 'PayPal' => 'Business::OnlinePayment', @@ -88,7 +90,13 @@ my %modules = ( 'VirtualNet' => 'Business::OnlinePayment', 'WesternACH' => 'Business::OnlinePayment', 'WorldPay' => 'Business::OnlinePayment', -); +); + +my %modules_for_namespace; +for (keys %modules) { + $modules_for_namespace{$modules{$_}} ||= []; + push @{ $modules_for_namespace{$modules{$_}} }, $_; +} my @actions = ( 'Normal Authorization', @@ -99,17 +107,23 @@ my @actions = ( my $fields = [ { field => 'gateway_namespace', - type => 'hidden', - curr_value_callback => sub { my($cgi, $object, $fref) = @_; - $modules{$object->gateway_module} - || 'Business::OnlinePayment' - }, + type => 'select', + options => [ qw( + Business::OnlinePayment + Business::BatchPayment + Business::OnlineThirdPartyPayment + ) ], + labels => { + 'Business::OnlinePayment' => 'Direct', + 'Business::BatchPayment' => 'Batch', + 'Business::OnlineThirdPartyPayment' => 'Hosted', + }, + onchange => 'changeNamespace', }, { field => 'gateway_module', type => 'select', options => [ sort { lc($a) cmp lc ($b) } keys %modules ], - onchange => 'setNamespace', }, 'gateway_username', 'gateway_password', @@ -126,6 +140,8 @@ my $fields = [ { field => 'gateway_options', type => 'textarea', + rows => '8', + cols => '40', curr_value_callback => sub { my($cgi, $object, $fref) = @_; join("\r", $object->options ); }, @@ -135,7 +151,7 @@ my $fields = [ my $field_callback = sub { my ($cgi, $object, $field_hashref ) = @_; if ($object->gatewaynum) { - if ( $field_hashref->{field} eq 'gateway_module' ) { + if ( $field_hashref->{field} =~ /gateway_(module|namespace)/ ) { $field_hashref->{type} = 'fixed'; } } diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index d583816e0..5a17d6da1 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -275,10 +275,11 @@ tie my %report_ticketing_statistics, 'Tie::IxHash', ; tie my %report_ticketing, 'Tie::IxHash', - 'Resolved by owner' => [ $fsurl.'rt/Tools/Reports/ResolvedByOwner.html', '' ], - 'Resolved in date range' => [ $fsurl.'rt/Tools/Reports/ResolvedByDates.html', '' ], - 'Created in date range' => [ $fsurl.'rt/Tools/Reports/CreatedByDates.html', '' ], - 'separator' => '', +# fix TimeToResolve extension? or redo in a more modern way? +# 'Resolved by owner' => [ $fsurl.'rt/Tools/Reports/ResolvedByOwner.html', '' ], +# 'Resolved in date range' => [ $fsurl.'rt/Tools/Reports/ResolvedByDates.html', '' ], +# 'Created in date range' => [ $fsurl.'rt/Tools/Reports/CreatedByDates.html', '' ], +# 'separator' => '', 'Statistics' => [ \%report_ticketing_statistics, '' ], 'separator2' => '', 'Advanced ticket reports' => [ $fsurl.'rt/Search/Build.html', 'List tickets by any criteria' ], @@ -390,10 +391,18 @@ tie my %tools_exporting, 'Tie::IxHash', 'Download database dump' => [ $fsurl. 'misc/dump.cgi', '' ], ; +tie my %tools_ticketing_articles, 'Tie::IxHash', + 'Overview' => [ $fsurl.'rt/Articles/index.html', '' ], + 'Search' => [ $fsurl.'rt/Articles/Article/Search.html', '' ], + 'Topics' => [ $fsurl.'rt/Articles/Topics.html', '' ], +; + tie my %tools_ticketing, 'Tie::IxHash', - 'Offline' => [ $fsurl.'rt/Tools/Offline.html', '' ], + 'Articles' => [ \%tools_ticketing_articles, '' ], 'My Day' => [ $fsurl.'rt/Tools/MyDay.html', '' ], - 'My Approvals' => [ $fsurl.'rt/Approvals/', '' ], + 'My Reminders' => [ $fsurl.'rt/Tools/MyReminders.html', '' ], + 'Offline' => [ $fsurl.'rt/Tools/Offline.html', '' ], + 'Approval' => [ $fsurl.'rt/Approvals/', '' ], ; $tools_ticketing{'Cron Tool'} = [ $fsurl.'rt/Developer/CronTool/', '' ] if $conf->exists('rt-crontool'); @@ -549,12 +558,44 @@ if ( $curuser->access_right('Configuration') ) { $config_billing{'Credit reason types'} = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons.' ]; } +#XXX also to be unified +tie my %config_ticketing_groups, 'Tie::IxHash', + 'Select' => [ $fsurl.'rt/Admin/Groups', '' ], + 'Create' => [ $fsurl.'rt/Admin/Groups/Modify.html?Create=1', '' ], +; + +tie my %config_ticketing_queues, 'Tie::IxHash', + 'Select' => [ $fsurl.'rt/Admin/Queues', '' ], + 'Create' => [ $fsurl.'rt/Admin/Queues/Modify.html?Create=1', '' ], +; + +tie my %config_ticketing_customfields, 'Tie::IxHash', + 'Select' => [ $fsurl.'rt/Admin/CustomFields', '' ], + 'Create' => [ $fsurl.'rt/Admin/CustomFields/Modify.html?Create=1', '' ], +; + +tie my %config_ticketing_articles_classes, 'Tie::IxHash', + 'Select' => [ $fsurl.'rt/Admin/Articles/Classes/', '' ], + 'Create' => [ $fsurl.'rt/Admin/Articles/Classes/Modify.html?Create=1', '' ], +; + +tie my %config_ticketing_articles_customfields, 'Tie::IxHash', + 'Select' => [ $fsurl.'rt/Admin/CustomFields/index.html?type=RT%3A%3AClass-RT%3A%3AArticle', '' ], + 'Create' => [ $fsurl.'rt/Admin/CustomFields/Modify.html?Create=1&LookupType=RT%3A%3AClass-RT%3A%3AArticle', '' ], +; + +tie my %config_ticketing_articles, 'Tie::IxHash', + 'Classes' => [ \%config_ticketing_articles_classes, '' ], + 'Custom Fields' => [ \%config_ticketing_articles_customfields, '' ], +; + tie my %config_ticketing, 'Tie::IxHash', - 'Ticketing Users' => [ $fsurl.'rt/Admin/Users', 'View/Edit ticketing users' ], #XXX to be unified - 'Ticketing Groups' => [ $fsurl.'rt/Admin/Groups', 'View/Edit ticketing groups and group membership' ], #XXX to be unified - 'Ticketing Queues' => [ $fsurl.'rt/Admin/Queues', 'View/Edit ticketing queues and queue-specific properties' ], - 'Ticket Custom Fields' => [ $fsurl.'rt/Admin/CustomFields', 'View/Edit ticketing custom fields' ], - 'Ticketing Global' => [ $fsurl.'rt/Admin/Global', 'View/Edit ticketing configuration applicable to all queues' ], + 'Ticketing Users' => [ $fsurl.'rt/Admin/Users', 'Edit ticketing users' ], #XXX to be unified + 'Ticketing Groups' => [ \%config_ticketing_groups, 'View/Edit ticketing groups and group membership' ], #XXX to be unified + 'Ticketing Queues' => [ \%config_ticketing_queues, 'View/Edit ticketing queues and queue-specific properties' ], + 'Ticket Custom Fields' => [ \%config_ticketing_customfields, 'View/Edit ticketing custom fields' ], + 'Ticketing Global' => [ $fsurl.'rt/Admin/Global', 'View/Edit ticketing configuration applicable to all queues' ], #XXX the individual items + 'Ticketing Articles' => [ \%config_ticketing_articles, '' ], #"System Configuraiton"? useless, just makes people report errors about missing Module::Versions::Report #'Ticketing Tools' => [ $fsurl.'rt/Admin/Tools', '' ], ; diff --git a/httemplate/elements/xmenu.css b/httemplate/elements/xmenu.css index 73699b6f9..e6a39f675 100644 --- a/httemplate/elements/xmenu.css +++ b/httemplate/elements/xmenu.css @@ -20,7 +20,7 @@ .webfx-menu { position: absolute; - z-index: 100; + z-index: 9999; visibility: hidden; border: 1px solid #7e0079; -moz-border-radius: 4px; diff --git a/httemplate/elements/xmenu.top.css b/httemplate/elements/xmenu.top.css index ff0d6f684..7a42254e4 100644 --- a/httemplate/elements/xmenu.top.css +++ b/httemplate/elements/xmenu.top.css @@ -20,7 +20,7 @@ .webfx-menu { position: absolute; - z-index: 100; + z-index: 9999; visibility: hidden; border: 1px solid #7e0079; -moz-border-radius: 4px; diff --git a/httemplate/misc/download-batch.cgi b/httemplate/misc/download-batch.cgi index 23deba712..f3a31eb3b 100644 --- a/httemplate/misc/download-batch.cgi +++ b/httemplate/misc/download-batch.cgi @@ -1,4 +1,4 @@ -<% $pay_batch->export_batch($format) %><%init> +<% $pay_batch->export_batch(%opt) %><%init> #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes http_header('Content-Type' => 'text/plain' ); # not necessarily correct... @@ -10,9 +10,14 @@ if ( $cgi->param('batchnum') =~ /^(\d+)$/ ) { die "No batch number (bad URL) \n"; } -my $format; -if ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) { - $format = $1; +my %opt; +if ( $cgi->param('gatewaynum') =~ /^(\d+)$/ ) { + my $gateway = FS::payment_gateway->by_key($1); + die "gatewaynum $1 not found" unless $gateway; + $opt{'gateway'} = $gateway; +} +elsif ( $cgi->param('format') =~ /^([\w\- ]+)$/ ) { + $opt{'format'} = $1; } my $pay_batch = qsearchs('pay_batch', { batchnum => $batchnum } ); diff --git a/httemplate/search/elements/cust_pay_batch_top.html b/httemplate/search/elements/cust_pay_batch_top.html index ce0ee9ed4..005b76182 100644 --- a/httemplate/search/elements/cust_pay_batch_top.html +++ b/httemplate/search/elements/cust_pay_batch_top.html @@ -14,7 +14,8 @@ Download batch in format <SELECT NAME="format"> % foreach ( keys %download_formats ) { <OPTION VALUE="<%$_%>"><% $download_formats{$_} %></OPTION> % } -</SELECT> +</SELECT> +<& .select_gateway &> % } <INPUT TYPE="submit" VALUE="Download"></FORM><BR><BR></TR> % } # end of download @@ -31,7 +32,7 @@ Download batch in format <SELECT NAME="format"> 'name' => 'FileUpload', 'action' => "${p}misc/upload-batch.cgi", 'num_files' => 1, - 'fields' => [ 'batchnum', 'format' ], + 'fields' => [ 'batchnum', 'format', 'gatewaynum' ], 'message' => 'Batch results uploaded.', ) %> Upload results<BR></TR> @@ -45,20 +46,22 @@ Upload results<BR></TR> <BR></TR> % if ( $fixed ) { % if ( $fixed eq 'td_eft1464' ) { # special case -<TR>Format <SELECT NAME="format"> +<TR>Upload in format <SELECT NAME="format"> <OPTION VALUE="td_eftack264">TD EFT Acknowledgement</OPTION> <OPTION VALUE="td_eftret80">TD EFT Returned Items</OPTION> -</SELECT></TR> +</SELECT> </TR> % } % else { <INPUT TYPE="hidden" NAME="format" VALUE="<% $fixed %>"> % } % } % else { -<TR>Format <SELECT NAME="format"> +<TR>Upload in format <SELECT NAME="format"> % foreach ( keys(%upload_formats) ) { <OPTION VALUE="<%$_%>"><% $upload_formats{$_} %></OPTION> % } +</SELECT> +<& .select_gateway &> % } # if $fixed <TR><INPUT TYPE="submit" VALUE="Upload"></TR> </FORM><BR> @@ -82,6 +85,26 @@ Batch is <% $statustext{$status} %><BR> <%$count%> payments batched<BR> <%$money_char%><%$total%> total in batch<BR> +<%def .select_gateway> +% if ( $show_gateways ) { + or from gateway +<& /elements/select-table.html, + empty_label => ' ', + field => 'gatewaynum', + table => 'payment_gateway', + name_col => 'label', + value_col => 'gatewaynum', + order_by => 'ORDER BY gatewaynum', + hashref => { + 'gateway_namespace' => 'Business::BatchPayment', + 'disabled' => '', + } +&> +% } +</%def> +<%shared> +my $show_gateways = FS::payment_gateway->count("gateway_namespace = 'Business::BatchPayment'"); +</%shared> <%init> my %opt = @_; my $pay_batch = $opt{'pay_batch'} or return; @@ -91,7 +114,7 @@ my $payby = $pay_batch->payby; my $status = $pay_batch->status; my $curuser = $FS::CurrentUser::CurrentUser; my $batchnum = $pay_batch->batchnum; - + my $fixed = $conf->config("batch-fixed_format-$payby"); tie my %download_formats, 'Tie::IxHash', ( diff --git a/httemplate/search/pay_batch.cgi b/httemplate/search/pay_batch.cgi index b2a15ef3d..05415f36e 100755 --- a/httemplate/search/pay_batch.cgi +++ b/httemplate/search/pay_batch.cgi @@ -14,7 +14,8 @@ 'Type', 'First Download', 'Last Upload', - 'Item Count', + 'Items', + 'Unresolved', 'Amount', 'Status', ], @@ -46,13 +47,16 @@ } }, sub { - my $st = "SELECT COUNT(*) from cust_pay_batch WHERE batchnum=" . shift->batchnum; - my $sth = dbh->prepare($st) - or die dbh->errstr. "doing $st"; - $sth->execute - or die "Error executing \"$st\": ". $sth->errstr; - $sth->fetchrow_arrayref->[0]; - }, + FS::cust_pay_batch->count( + 'batchnum = '.$_[0]->batchnum + ) + }, + sub { + FS::cust_pay_batch->count( + 'status is null and batchnum = '. + $_[0]->batchnum + ) + }, sub { my $st = "SELECT SUM(amount) from cust_pay_batch WHERE batchnum=" . shift->batchnum; my $sth = dbh->prepare($st) |