diff options
Diffstat (limited to 'httemplate/edit')
58 files changed, 414 insertions, 205 deletions
diff --git a/httemplate/edit/commission_schedule.html b/httemplate/edit/commission_schedule.html new file mode 100644 index 000000000..c76a3618e --- /dev/null +++ b/httemplate/edit/commission_schedule.html @@ -0,0 +1,53 @@ +<& elements/edit.html, + name_singular => 'schedule', + table => 'commission_schedule', + viewall_dir => 'browse', + fields => [ 'schedulename', + { field => 'reasonnum', + type => 'select-reason', + reason_class => 'R', + }, + { field => 'basis', + type => 'select', + options => [ keys %FS::commission_schedule::basis_options ], + labels => { %FS::commission_schedule::basis_options }, + }, + { type => 'tablebreak-tr-title', value => 'Billing cycles' }, + { field => 'commissionratenum', + type => 'commission_rate', + o2m_table => 'commission_rate', + m2_label => ' ', + m2_error_callback => $m2_error_callback, + colspan => 2, + }, + ], + labels => { 'schedulenum' => '', + 'schedulename' => 'Name', + 'basis' => 'Based on', + 'commissionratenum' => '', + }, +&> +<%init> + +my $m2_error_callback = sub { + my ($cgi, $object) = @_; + + my @rates; + foreach my $k ( grep /^commissionratenum\d+/, $cgi->param ) { + my $num = $cgi->param($k); + my $cycle = $cgi->param($k.'_cycle'); + my $amount = $cgi->param($k.'_amount'); + my $percent = $cgi->param($k.'_percent'); + if ($cycle > 0) { + push @rates, FS::commission_rate->new({ + 'commissionratenum' => $num, + 'cycle' => $cycle, + 'amount' => $amount, + 'percent' => $percent, + }); + } + } + @rates; +}; + +</%init> diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 39cddc021..b314d2d6e 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -203,12 +203,19 @@ if ( $cgi->param('error') ) { my %locations; for my $pre (qw(bill ship)) { my %hash; - foreach ( FS::cust_main->location_fields ) { - $hash{$_} = scalar($cgi->param($pre.'_'.$_)); + foreach my $locfield ( FS::cust_main->location_fields ) { + # don't search on lat/long, string values can cause qsearchs to die + next if grep {$_ eq $locfield} qw(latitude longitude); + $hash{$locfield} = scalar($cgi->param($pre.'_'.$locfield)); } $hash{'custnum'} = $cgi->param('custnum'); $locations{$pre} = qsearchs('cust_location', \%hash) || FS::cust_location->new( \%hash ); + # now set lat/long, for redisplay of entered values + foreach my $locfield ( qw(latitude longitude) ) { + my $locvalue = scalar($cgi->param($pre.'_'.$locfield)); + $locations{$pre}->set($locfield,$locvalue); + } } if ( $same ) { $locations{ship} = $locations{bill}; diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 5d74365e7..116eeebd6 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -12,7 +12,7 @@ <% small_custview($custnum, $conf->config('countrydefault')) %> % } -<FORM NAME="PaymentForm" ACTION="<% popurl(1) %>process/cust_pay.cgi" METHOD=POST onSubmit="document.PaymentForm.submit.disabled=true"> +<FORM NAME="PaymentForm" ACTION="<% popurl(1) %>process/cust_pay.cgi" METHOD=POST onSubmit="document.PaymentForm.submitButton.disabled=true"> <INPUT TYPE="hidden" NAME="link" VALUE="<% $link %>"> <INPUT TYPE="hidden" NAME="linknum" VALUE="<% $linknum %>"> <INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>"> @@ -114,7 +114,7 @@ </TABLE> <BR> -<INPUT TYPE="submit" VALUE="<% mt('Post payment') |h %>"> +<INPUT NAME="submitButton" TYPE="submit" VALUE="<% mt('Post payment') |h %>"> </FORM> diff --git a/httemplate/edit/cust_pay_pending.html b/httemplate/edit/cust_pay_pending.html index 0056bb925..7d480f319 100644 --- a/httemplate/edit/cust_pay_pending.html +++ b/httemplate/edit/cust_pay_pending.html @@ -4,6 +4,10 @@ <CENTER><FONT SIZE="+1"><B>Are you sure you want to delete this pending payment?</B></FONT></CENTER> +% } elsif (( $action eq 'complete' ) and $authorized) { + + <CENTER><FONT SIZE="+1"><B>Payment was authorized but not captured. Contact <% $cust_pay_pending->processor || 'the payment gateway' %> to establish the final disposition of this transaction.</B></FONT></CENTER> + % } elsif ( $action eq 'complete' ) { <CENTER><FONT SIZE="+1"><B>No response was received from <% $cust_pay_pending->processor || 'the payment gateway' %> for this transaction. Check <% $cust_pay_pending->processor || 'the payment gateway' %>'s reporting and determine if this transaction completed successfully.</B></FONT></CENTER> @@ -97,8 +101,6 @@ % } else { -%# if ( $action eq 'complete' ) { - <INPUT TYPE="hidden" NAME="action" VALUE=""> <TR> @@ -106,18 +108,25 @@ <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'insert_cust_pay'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/tick.png" ALT=""-->Yes, transaction completed sucessfully.</BUTTON> </TD> -% if ( $action eq 'complete' ) { +% if ( $action eq 'complete' ) { <TD> </TD> +% if ($authorized) { + <TD ALIGN="center"> + <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'reverse'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was reversed</BUTTON> + </TD> +% } else { <TD ALIGN="center"> <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'decline'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was declined</BUTTON> </TD> +% } <TD> </TD> <TD ALIGN="center"> <BUTTON TYPE="button" onClick="document.pendingform.action.value = 'delete'; document.pendingform.submit();"><!--IMG SRC="<%$p%>images/cross.png" ALT=""-->No, transaction was not received</BUTTON> </TD> - </TR> % } + </TR> + <TR><TD COLSPAN=5></TD></TR> <TR> @@ -156,6 +165,8 @@ my $cust_pay_pending = }) or die 'unknown paypendingnum'; +my $authorized = ($cust_pay_pending->status eq 'authorized') ? 1 : 0; + my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; diff --git a/httemplate/edit/cust_refund.cgi b/httemplate/edit/cust_refund.cgi index bfcbfe725..32da4543e 100755 --- a/httemplate/edit/cust_refund.cgi +++ b/httemplate/edit/cust_refund.cgi @@ -10,7 +10,7 @@ <% small_custview($custnum, $conf->config('countrydefault')) %> % } -<FORM NAME="RefundForm" ACTION="<% $p1 %>process/cust_refund.cgi" METHOD=POST onSubmit="document.RefundForm.submit.disabled=true"> +<FORM NAME="RefundForm" ACTION="<% $p1 %>process/cust_refund.cgi" METHOD=POST onSubmit="document.RefundForm.submitButton.disabled=true"> <INPUT TYPE="hidden" NAME="popup" VALUE="<% $link %>"> <INPUT TYPE="hidden" NAME="refundnum" VALUE=""> <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> @@ -116,7 +116,7 @@ </TABLE> <BR> -<INPUT TYPE="submit" ID="confirm_refund_button" VALUE="<% mt('Post refund') |h %>" DISABLED> +<INPUT TYPE="submit" NAME="submitButton" ID="confirm_refund_button" VALUE="<% mt('Post refund') |h %>" DISABLED> </FORM> diff --git a/httemplate/edit/elements/ApplicationCommon.html b/httemplate/edit/elements/ApplicationCommon.html index acc3368b8..a531eaad4 100644 --- a/httemplate/edit/elements/ApplicationCommon.html +++ b/httemplate/edit/elements/ApplicationCommon.html @@ -3,46 +3,45 @@ Examples: #cust_bill_pay - include('elements/ApplicationCommon.html', - 'form_action' => 'process/cust_bill_pay.cgi', + <& elements/ApplicationCommon.html, + 'form_action' => 'process/cust_bill_pay.cgi, 'src_table' => 'cust_pay', 'src_thing' => 'payment', 'dst_table' => 'cust_bill', 'dst_thing' => 'invoice', - ) + &> #cust_credit_bill - include('elements/ApplicationCommon.html', - 'form_action' => 'process/cust_credit_bill.cgi', + <& elements/ApplicationCommon.html', + 'form_action' => 'process/cust_credit_bill.cgi, 'src_table' => 'cust_credit', 'src_thing' => 'credit', 'dst_table' => 'cust_bill', 'dst_thing' => 'invoice', - ) + &> #cust_pay_refund - include('elements/ApplicationCommon.html', - 'form_action' => 'process/cust_pay_refund.cgi', + <& elements/ApplicationCommon.html', + 'form_action' => 'process/cust_pay_refund.cgi, 'src_table' => 'cust_pay', 'src_thing' => 'payment', 'dst_table' => 'cust_refund', 'dst_thing' => 'refund', - ) + &> #cust_credit_refund - include('elements/ApplicationCommon.html', + <& elements/ApplicationCommon.html, 'form_action' => 'process/cust_credit_refund.cgi', 'src_table' => 'cust_credit', 'src_thing' => 'credit', 'dst_table' => 'cust_refund', 'dst_thing' => 'refund', - ) + &> </%doc> +<& /elements/header-popup.html, "Apply $src_thing$to", '', 'onLoad="myOnLoadFunction();"' &> -<% include('/elements/header-popup.html', "Apply $src_thing$to", '', 'onLoad="myOnLoadFunction();"') %> - -<% include('/elements/error.html') %> +<& /elements/error.html &> <P ID="ErrorMessage"></P> <FORM ACTION="<% $p1. $opt{'form_action'} %>" NAME="ApplicationForm" ID="ApplicationForm" METHOD=POST> @@ -158,6 +157,7 @@ function changed(what) { % } % $desc .= ' (default)'; % } +% $total_owed = sprintf('%.2f', $total_owed + 0.00000001 ); #so 1.005 rounds to 1.01 % if ( $total_owed > 0 ) { <% &{$row_generator}($key, $cbp, $desc, $total_owed, $amount, '') %> % } @@ -212,11 +212,10 @@ Apply to: </TR> </TABLE> </CENTER> -<% include( '/elements/xmlhttp.html', +<& /elements/xmlhttp.html, 'url' => $p.'misc/xmlhttp-calculate_taxes.html', 'subs' => [ 'calculate_taxes' ], - ) - %> +&> <SCRIPT TYPE="text/javascript"> function show_taxes(arg) { @@ -392,8 +391,7 @@ function myOnLoadFunction () { </SCRIPT> -<% include('/elements/footer.html') %> - +<& /elements/footer-popup.html &> <%init> my %opt = @_; @@ -427,6 +425,8 @@ $can_change_credit = 1 my $to = $dst_table eq 'cust_refund' ? ' to Refund' : ''; +$m->comp('/elements/handle_uri_query'); + my($src_pkeyvalue, $amount, $dst_pkeyvalue, $src_amount); if ( $cgi->param('error') ) { $src_pkeyvalue = $cgi->param($src_pkey); diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index bbc9797dc..8dd15dcfb 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -650,7 +650,7 @@ Example: var newrow = <% include(@layer_opt, html_only=>1) |js_string %>; % #until the rest have html/js_only -% if ( $type eq 'selectlayers' || $type =~ /^select-cgp_rule_/ ) { +% if ( ($type eq 'selectlayers') || ($type eq 'selectlayersx') || ($type =~ /^select-cgp_rule_/) ) { var newfunc = <% include(@layer_opt, js_only=>1) |js_string %>; % } else { var newfunc = ''; diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html index bc679e577..816f3428b 100644 --- a/httemplate/edit/elements/part_svc_column.html +++ b/httemplate/edit/elements/part_svc_column.html @@ -132,7 +132,10 @@ my %communigate_fields = ( % } elsif ( $def->{'type'} eq 'select' ) { % % if ( $def->{'select_table'} ) { - <& /elements/select-table.html, +% # set the 'select_svc' flag to enable two-step selection of services +% my $comp = '/elements/select-table.html'; +% $comp = '/elements/select-svc.html' if $def->{'select_svc'}; + <& $comp, 'field' => $name, 'id' => $name.'_select', 'table' => $def->{'select_table'}, @@ -264,8 +267,9 @@ my %communigate_fields = ( <& /elements/progress-init.html, $svcdb, #form name [ # form fields to send - qw(svc svcpart classnum selfservice_access disabled preserve exportnum), - @fields + 'ALL' +# qw(svc svcpart classnum selfservice_access disabled preserve exportnum), +# @fields ], 'process/part_svc.cgi', # target $p.'browse/part_svc.cgi', # redirect landing diff --git a/httemplate/edit/log_email.html b/httemplate/edit/log_email.html index 709a24069..b79aba986 100644 --- a/httemplate/edit/log_email.html +++ b/httemplate/edit/log_email.html @@ -8,10 +8,16 @@ 'labels' => { '' => '(all)', map { $_ => $_ } @contexts }, 'curr_value' => scalar($cgi->param('context')), }, + { 'field' => 'context_height', + 'type' => 'checkbox', + 'postfix' => 'Only match most specific context', + 'value' => 1, + 'curr_value' => scalar($cgi->param('context_height')), + }, { 'field' => 'min_level', 'type' => 'select', - 'options' => [ 0..7 ], - 'labels' => { map {$_ => $FS::Log::LEVELS[$_]} 0..7 }, + 'options' => [ &FS::Log::levelnums ], + 'labels' => { &FS::Log::levelmap }, 'curr_value' => scalar($cgi->param('min_level')), }, 'to_addr', @@ -24,6 +30,7 @@ ], 'labels' => { 'context' => 'Context', + 'context_height' => '', 'min_level' => 'Min. Level', 'to_addr' => 'To', 'msgnum' => 'Message', @@ -44,6 +51,10 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right([ 'View system logs', 'Configuration' ]); my $msgnum = $cgi->param('msgnum'); + +# XXX This attempt to set a default message isn't working, not sure why +# $msgnum gets set correctly, but isn't selected in the popup window...fix later + unless ($msgnum) { my ($msg_template) = qsearch('msg_template',{ msgname => 'System log' }); # doesn't seem worth having a config just for the default selected template diff --git a/httemplate/edit/msgcat.html b/httemplate/edit/msgcat.html index 4e2edd6d8..5ca118ad7 100644 --- a/httemplate/edit/msgcat.html +++ b/httemplate/edit/msgcat.html @@ -3,7 +3,7 @@ table => 'msgcat', fields => [ { field=>'msgcode', type=>'fixed' }, { field=>'locale', type=>'fixed' }, - 'msg', + { field => 'msg', type => 'text', size => 60 }, ], labels => { 'msgnum' => 'String', 'msgcode' => 'Code', diff --git a/httemplate/edit/part_event.html b/httemplate/edit/part_event.html index 47b8c1ac8..c8072e9f9 100644 --- a/httemplate/edit/part_event.html +++ b/httemplate/edit/part_event.html @@ -31,7 +31,7 @@ value => 'Event Conditions', }, { field => 'conditionname', - type => 'selectlayers', + type => 'selectlayersx', options => [ keys %all_conditions ], labels => \%condition_labels, onchange => 'condition_changed(what);', @@ -51,7 +51,7 @@ value => 'Event Action', }, { field => 'action', - type => 'selectlayers', + type => 'selectlayersx', options => [ keys %all_actions ], labels => \%action_labels, onchange => 'action_changed(what);', diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 80a61f813..7fe659f94 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -92,7 +92,7 @@ { type => 'columnstart' }, { field => 'pkg', - type => 'text', + type => 'input-locale-text', size => 40, #32 maxlength => 50, }, @@ -495,42 +495,6 @@ my $recur_show_zero_disabled = 1; my $pkgpart = ''; -my $splice_locale_fields = sub { - my( $fields, $pkey_value_callback, $pkg_value_callback ) = @_; - - my $n = 0; - my @locale_fields = ( - map { - my $pkey_value= $pkey_value_callback ? &$pkey_value_callback($_) : ''; - my $pkg_value = $pkg_value_callback - ? $pkg_value_callback eq 'cgiparam' - ? $cgi->param('pkgpartmsgnum'. $n. '_pkg') - : &$pkg_value_callback($_) - : ''; - ( - { field => 'pkgpartmsgnum'. $n, - type => 'hidden', - value => $pkey_value, - }, - { field => 'pkgpartmsgnum'. $n. '_locale', - type => 'hidden', - value => $_, - }, - { field => 'pkgpartmsgnum'. $n++. '_pkg', - type => 'text', - size => 40, - #maxlength => 50, - value => $pkg_value, - }, - ); - - } - @locales - ); - splice(@$fields, 7, 0, @locale_fields); #XXX 7 is arbitrary above - -}; - my $error_callback = sub { my($cgi, $object, $fields, $opt ) = @_; @@ -579,16 +543,6 @@ my $error_callback = sub { $pkgpart = $object->pkgpart; - &$splice_locale_fields( - $fields, - sub { - my $locale = shift; - my $part_pkg_msgcat = $object->part_pkg_msgcat($locale); - $part_pkg_msgcat ? $part_pkg_msgcat->pkgpartmsgnum : ''; - }, - 'cgiparam' - ); - if ( $cgi->param('error') =~ / is suggested with / ) { #yeah, detection is a shitty kludge, but we don't have exception objects $opt->{form_init} = '<INPUT TYPE="checkbox" NAME="part_pkg_restrict_soft_override" VALUE="Y"> Override suggestion<BR><BR>'; @@ -665,20 +619,6 @@ my $edit_callback = sub { $pkgpart = $object->pkgpart; - &$splice_locale_fields( - $fields, - sub { - my $locale = shift; - my $part_pkg_msgcat = $object->part_pkg_msgcat($locale); - $part_pkg_msgcat ? $part_pkg_msgcat->pkgpartmsgnum : ''; - }, - sub { - my $locale = shift; - my $part_pkg_msgcat = $object->part_pkg_msgcat($locale); - $part_pkg_msgcat ? $part_pkg_msgcat->pkg : ''; - } - ); - }; my $new_callback = sub { @@ -692,8 +632,6 @@ my $new_callback = sub { $options{'suspend_bill'}=1 if $conf->exists('part_pkg-default_suspend_bill'); - &$splice_locale_fields($fields, '', ''); - }; my $clone_callback = sub { @@ -732,17 +670,6 @@ my $clone_callback = sub { foreach keys %part_pkg_currency; } - $recur_disabled = $object->freq ? 0 : 1; - - &$splice_locale_fields( - $fields, - '', - sub { - my $locale = shift; - my $part_pkg_msgcat = $object->part_pkg_msgcat($locale); - $part_pkg_msgcat ? $part_pkg_msgcat->pkg : ''; - } - ); }; my $discount_error_callback = sub { @@ -1061,6 +988,16 @@ my $html_bottom = sub { : '' ). '>'; + } elsif ( $href->{$field}{'type'} =~ /^select-rt-/ ) { + + $html .= include('/elements/'.$href->{$field}{'type'}.'.html', + 'name' => $layer.'__'.$field, + 'curr_value' => $options{$field}, + map { $_ => $href->{$field}{$_} } + grep { $_ !~ /^(name|type|parse)$/ } + keys %{ $href->{$field} } + ); + } elsif ( $href->{$field}{'type'} eq 'select-rate' ) { $html .= include('/elements/select-rate.html', diff --git a/httemplate/edit/part_referral.html b/httemplate/edit/part_referral.html index e9fd79452..04287d632 100755 --- a/httemplate/edit/part_referral.html +++ b/httemplate/edit/part_referral.html @@ -3,11 +3,13 @@ 'table' => 'part_referral', 'fields' => [ 'referral', { field=>'agentnum', type=>'select-agent', }, + 'title', { field=>'disabled', type=>'checkbox', value=>'Y' } , ], 'labels' => { 'refnum' => 'Ad Source', 'referral' => 'Advertising source', 'agentnum' => 'Agent', + 'title' => 'External ID', 'disabled' => 'Disabled', }, 'viewall_dir' => 'browse', diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index a07fc6005..fed21256f 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -36,9 +36,26 @@ } </STYLE> <SCRIPT TYPE="text/javascript"> +// copy all fields from the outer form (svc and its localizations, plus +// preserve, selfservice_access, etc.) into the inner form, creating hidden +// inputs if needed function fixup_submit(layer) { - document.forms[layer].submit.disabled = true; - fixup(document.forms[layer]); + var layer_form = $(document.forms[layer]); + var main_form = $(document.forms['SvcEditMain']); + var data = main_form.serializeArray(); + for (var i = 0; i < data.length; i++) { + var input = layer_form.children('[name=' + data[i].name + ']'); + if (input[0]) { + input.prop('value', data[i].value); + } else { + $( '<input type="hidden">' ) + .attr('name', data[i].name) + .prop('value', data[i].value) + .appendTo(layer_form); + } + } + layer_form[0]['submit'].disabled = true; + //fixup(document.forms[layer]); window[layer+'process'].call(); } @@ -141,19 +158,26 @@ window.onload = function() { </SCRIPT> -<FORM NAME="dummy"> +<FORM NAME="SvcEditMain"> <FONT CLASS="fsinnerbox-title">Service Part #<% $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %></FONT> <TABLE CLASS="fsinnerbox"> -<TR> - <TD ALIGN="right">Service</TD> - <TD><INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"></TD> -<TR> +<& /elements/tr-input-locale-text.html, + 'object' => $part_svc, + 'cgi' => $cgi, + 'field' => 'svc', + 'label' => 'Service', + 'curr_value' => $hashref->{svc}, +&> +%#<TR> +%# <TD ALIGN="right">Service</TD> +%# <TD><INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"></TD> +%#<TR> <& /elements/tr-select-part_svc_class.html, curr_value=>$hashref->{classnum} &> <TR> - <TD ALIGN="right">Self-service access</TD> + <TH ALIGN="right">Self-service access</TD> <TD> <SELECT NAME="selfservice_access"> % tie my %selfservice_access, 'Tie::IxHash', #false laziness w/browse/part_svc @@ -172,12 +196,12 @@ window.onload = function() { <TR> - <TD ALIGN="right">Disable new orders</TD> + <TH ALIGN="right">Disable new orders</TD> <TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>></TD> </TR> <TR> - <TD ALIGN="right">Preserve this service on package cancellation</TD> + <TH ALIGN="right">Preserve this service on package cancellation</TD> <TD><INPUT TYPE="checkbox" NAME="preserve" VALUE="Y"<% $hashref->{'preserve'} eq 'Y' ? ' CHECKED' : '' %>> </TD> </TR> @@ -240,12 +264,12 @@ my $widget = new HTML::Widgets::SelectLayers( #'selected_layer' => $p_svcdb, 'selected_layer' => $hashref->{svcdb} || 'svc_acct', 'options' => \%svcdb, - 'form_name' => 'dummy', + 'form_name' => 'SvcEditMain', #'form_action' => 'process/part_svc.cgi', 'form_action' => 'part_svc.cgi', #self - 'form_elements' => [qw( svc svcpart classnum selfservice_access - disabled preserve - )], +# 'form_elements' => [qw( svc svcpart classnum selfservice_access +# disabled preserve +# )], 'html_between' => $help, 'layer_callback' => sub { include('elements/part_svc_column.html', diff --git a/httemplate/edit/payment_gateway.html b/httemplate/edit/payment_gateway.html index a85ba57af..b44b31513 100644 --- a/httemplate/edit/payment_gateway.html +++ b/httemplate/edit/payment_gateway.html @@ -47,28 +47,36 @@ my %modules = ( 'AuthorizeNet', 'BankOfAmerica', #deprecated? 'Beanstream', + 'Braintree', 'Capstone', + 'CardFortress', 'Cardstream', 'CashCow', 'CyberSource', 'eSec', 'eSelectPlus', 'ElavonVirtualMerchant', + 'eWay', 'Exact', 'FirstDataGlobalGateway', + 'GlobalPayments', 'iAuthorizer', 'Ingotz', 'InternetSecure', - 'IPaymentTPG', + #'IPaymentTPG', 'IPPay', 'Iridium', 'Jettis', 'Jety', 'LinkPoint', + 'Litle', 'MerchantCommerce', 'Network1Financial', + 'NMI', 'OCV', + 'Ogone', 'OpenECHO', + 'PaperlessTrans', 'PayConnect', 'PayflowPro', 'PaymenTech', @@ -84,26 +92,31 @@ my %modules = ( 'Skipjack', 'StGeorge', 'SurePay', + 'SynapseGateway', 'TCLink', 'TransactionCentral', 'TransFirsteLink', + 'USAePay', 'Vanco', 'viaKLIX', 'VirtualNet', + 'vSecureProcessing', 'WesternACH', 'WorldPay', ], 'Business::OnlineThirdPartyPayment' => [ #'eWayShared', support currently broken - #'Interswitchng', - 'PayPal', 'FCMB', + #'Interswitchng', #incomplete? + 'PayPal', ], 'Business::BatchPayment' => [ + 'BillBuddy', + 'CardFortress', 'KeyBank', 'Paymentech', + 'RBC', 'TD_EFT', - 'BillBuddy', ], ); @@ -132,7 +145,7 @@ my $fields = [ { field => 'gateway_module', type => 'select', # does it even make sense to list all modules here? - options => [ sort { lc($a) cmp lc ($b) } + options => [ sort { lc($a) cmp lc($b) } map { @$_ } values %modules ], }, 'gateway_username', diff --git a/httemplate/edit/process/bulk-cust_main_county.html b/httemplate/edit/process/bulk-cust_main_county.html index b7ff40fa7..b5a0258b1 100644 --- a/httemplate/edit/process/bulk-cust_main_county.html +++ b/httemplate/edit/process/bulk-cust_main_county.html @@ -12,7 +12,7 @@ <% include('/elements/header-popup.html', "Taxes ${action}ed") %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> diff --git a/httemplate/edit/process/bulk-cust_svc-pkgnum.html b/httemplate/edit/process/bulk-cust_svc-pkgnum.html index f5cf7dd07..3c273069a 100644 --- a/httemplate/edit/process/bulk-cust_svc-pkgnum.html +++ b/httemplate/edit/process/bulk-cust_svc-pkgnum.html @@ -7,7 +7,7 @@ <% header(emt("Services moved")) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/cgp_rule-simplified.html b/httemplate/edit/process/cgp_rule-simplified.html index 60769d4e6..24515d551 100644 --- a/httemplate/edit/process/cgp_rule-simplified.html +++ b/httemplate/edit/process/cgp_rule-simplified.html @@ -4,7 +4,7 @@ % } else { #success XXX better msg talking about vacation vs. redirect all <% include('/elements/header-popup.html', 'Rule updated') %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> diff --git a/httemplate/edit/process/change-cust_pkg.html b/httemplate/edit/process/change-cust_pkg.html index 308ea8ffd..54cafbf18 100644 --- a/httemplate/edit/process/change-cust_pkg.html +++ b/httemplate/edit/process/change-cust_pkg.html @@ -5,7 +5,7 @@ <% header(emt("Package changed")) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/commission_schedule.html b/httemplate/edit/process/commission_schedule.html new file mode 100644 index 000000000..50e0371da --- /dev/null +++ b/httemplate/edit/process/commission_schedule.html @@ -0,0 +1,36 @@ +<& elements/process.html, + 'table' => 'commission_schedule', + 'viewall_dir' => 'browse', + 'process_o2m' => { + 'table' => 'commission_rate', + 'fields' => [qw( cycle amount percent )], + }, + 'precheck_callback' => $precheck, + 'debug' => 1, +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $precheck = sub { + my $cgi = shift; + $cgi->param('reasonnum') =~ /^(-?\d+)$/ or die "Illegal reasonnum"; + + my ($reasonnum, $error) = $m->comp('/misc/process/elements/reason'); + if (!$reasonnum) { + $error ||= 'Reason required' + } + $cgi->param('reasonnum', $reasonnum) unless $error; + + # remove rate entries with no cycle selected + foreach my $k (grep /^commissionratenum\d+$/, $cgi->param) { + if (! $cgi->param($k.'_cycle') ) { + $cgi->delete($k); + } + } + + $error; +}; + +</%init> diff --git a/httemplate/edit/process/credit-cust_bill_pkg.html b/httemplate/edit/process/credit-cust_bill_pkg.html index 75900bde5..12b68c0f5 100644 --- a/httemplate/edit/process/credit-cust_bill_pkg.html +++ b/httemplate/edit/process/credit-cust_bill_pkg.html @@ -3,7 +3,7 @@ %} else { <& /elements/header-popup.html, 'Credit successful' &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } diff --git a/httemplate/edit/process/cust_credit-pkgnum.html b/httemplate/edit/process/cust_credit-pkgnum.html index 8941cbc73..56f7989a4 100755 --- a/httemplate/edit/process/cust_credit-pkgnum.html +++ b/httemplate/edit/process/cust_credit-pkgnum.html @@ -4,7 +4,7 @@ %} else { <% header(emt('Credit package changed')) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 39c6f1997..5d3028777 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -16,7 +16,7 @@ % <% header(emt('Credit successful')) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> diff --git a/httemplate/edit/process/cust_location-censustract.html b/httemplate/edit/process/cust_location-censustract.html index bc9cd4f31..6edaca3fd 100644 --- a/httemplate/edit/process/cust_location-censustract.html +++ b/httemplate/edit/process/cust_location-censustract.html @@ -5,7 +5,7 @@ <% header("Census tract changed") %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/cust_location.cgi b/httemplate/edit/process/cust_location.cgi index fd1b8740e..3a2388111 100644 --- a/httemplate/edit/process/cust_location.cgi +++ b/httemplate/edit/process/cust_location.cgi @@ -5,7 +5,7 @@ <% header("Location changed") %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index d590fdef0..74f8f2382 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,5 +1,15 @@ % if ( $error ) { % $cgi->param('error', $error); +% # workaround for create_uri_query's mangling of unicode characters, +% # false laziness with FS::Record::ut_coord +% use charnames ':full'; +% for my $pre (qw(bill ship)) { +% foreach (qw( latitude longitude)) { +% my $coord = $cgi->param($pre.'_'.$_); +% $coord =~ s/\N{DEGREE SIGN}\s*$//; +% $cgi->param($pre.'_'.$_, $coord); +% } +% } % my $query = $m->scomp('/elements/create_uri_query', 'secure'=>1); <% $cgi->redirect(popurl(2). "cust_main.cgi?$query" ) %> % @@ -76,8 +86,8 @@ if ( ($cgi->param('same') || '') eq 'Y' ) { # but explicitly avoid setting ship_ fields my $new = new FS::cust_main ( { - map { ( $_, scalar($cgi->param($_)) ) } (fields('cust_main')), - map { ( "ship_$_", '' ) } (FS::cust_main->location_fields) + (map { ( $_, scalar($cgi->param($_)) ) } (fields('cust_main'))), + (map { ( "ship_$_", '' ) } (FS::cust_main->location_fields)) } ); warn Dumper( $new ) if $DEBUG > 1; @@ -188,6 +198,15 @@ if ( $cgi->param('residential_commercial') eq 'Residential' ) { } +# kind of a hack, but some tax data vendors require a status and others +# don't. +my $vendor = $conf->config('tax_data_vendor'); +if ( $vendor eq 'avalara' or $vendor eq 'suretax' ) { + if ( ! $cgi->param('taxstatusnum') ) { + $error ||= 'Tax status required'; + } +} + #perhaps this stuff should go to cust_main.pm if ( $new->custnum eq '' or $duplicate_of ) { diff --git a/httemplate/edit/process/cust_main_attach.cgi b/httemplate/edit/process/cust_main_attach.cgi index 09c18adcb..569500246 100644 --- a/httemplate/edit/process/cust_main_attach.cgi +++ b/httemplate/edit/process/cust_main_attach.cgi @@ -9,7 +9,7 @@ % $act = 'deleted' if($attachnum and $delete); <% header('Attachment ' . $act ) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } diff --git a/httemplate/edit/process/cust_main_county-add.cgi b/httemplate/edit/process/cust_main_county-add.cgi index fc8956b0c..fcc138f49 100755 --- a/httemplate/edit/process/cust_main_county-add.cgi +++ b/httemplate/edit/process/cust_main_county-add.cgi @@ -1,7 +1,7 @@ <% include('/elements/header-popup.html', 'Addition successful' ) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi index a10827621..42e46734a 100755 --- a/httemplate/edit/process/cust_main_county-expand.cgi +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -1,7 +1,7 @@ <% include('/elements/header-popup.html', 'Addition successful' ) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi index 53e616a43..bb52db8f3 100755 --- a/httemplate/edit/process/cust_main_note.cgi +++ b/httemplate/edit/process/cust_main_note.cgi @@ -4,7 +4,7 @@ %} else { <% header('Note ' . ($notenum ? 'updated' : 'added') ) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } diff --git a/httemplate/edit/process/cust_pay-no_auto_apply.cgi b/httemplate/edit/process/cust_pay-no_auto_apply.cgi index ccbd2d7b5..4a5ee841a 100644 --- a/httemplate/edit/process/cust_pay-no_auto_apply.cgi +++ b/httemplate/edit/process/cust_pay-no_auto_apply.cgi @@ -15,7 +15,7 @@ Requires 'Apply payment' acl. <P STYLE="font-weight: bold;"><% emt($message) %></P> <P><% emt('Please wait while the page reloads.') %></P> <SCRIPT TYPE="text/javascript"> -window.top.location.reload(); +topreload(); </SCRIPT> % } diff --git a/httemplate/edit/process/cust_pay-pkgnum.html b/httemplate/edit/process/cust_pay-pkgnum.html index d9a92a1de..cefe970fe 100755 --- a/httemplate/edit/process/cust_pay-pkgnum.html +++ b/httemplate/edit/process/cust_pay-pkgnum.html @@ -4,7 +4,7 @@ %} else { <% header(emt('Payment package changed')) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 56d3f2ff1..15b26f9c6 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -14,7 +14,7 @@ % <% header(emt('Payment entered')) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> @@ -69,6 +69,6 @@ push @rights, 'Post cash payment' if $new->payby eq 'CASH'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right(\@rights); -my $error ||= $new->insert( 'manual' => 1 ); +my $error = $new->insert( 'manual' => 1 ); </%init> diff --git a/httemplate/edit/process/cust_pay_pending.html b/httemplate/edit/process/cust_pay_pending.html index 1bad6cffe..80bd14aaf 100644 --- a/httemplate/edit/process/cust_pay_pending.html +++ b/httemplate/edit/process/cust_pay_pending.html @@ -3,7 +3,7 @@ <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error |h %></FONT> % } else { <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> % } </BODY> @@ -59,6 +59,15 @@ if ( $action eq 'delete' ) { $title = 'Pending payment completed (decline)'; } +} elsif ( $action eq 'reverse' ) { + + $error = $cust_pay_pending->reverse; + if ( $error ) { + $title = 'Error reversing pending payment'; + } else { + $title = 'Pending payment completed (reverse)'; + } + } else { die "unknown action $action"; diff --git a/httemplate/edit/process/cust_pkg_detail.html b/httemplate/edit/process/cust_pkg_detail.html index 132ff63c5..25fabd930 100644 --- a/httemplate/edit/process/cust_pkg_detail.html +++ b/httemplate/edit/process/cust_pkg_detail.html @@ -6,7 +6,7 @@ % } else { <% header($action) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } diff --git a/httemplate/edit/process/cust_pkg_discount.html b/httemplate/edit/process/cust_pkg_discount.html index 143611ef9..963546363 100644 --- a/httemplate/edit/process/cust_pkg_discount.html +++ b/httemplate/edit/process/cust_pkg_discount.html @@ -5,7 +5,7 @@ <% header("Discount applied") %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/cust_pkg_quantity.html b/httemplate/edit/process/cust_pkg_quantity.html index fb2657252..b60595583 100644 --- a/httemplate/edit/process/cust_pkg_quantity.html +++ b/httemplate/edit/process/cust_pkg_quantity.html @@ -5,7 +5,7 @@ <& /elements/header-popup.html, "Quantity changed" &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/cust_pkg_salesnum.html b/httemplate/edit/process/cust_pkg_salesnum.html index aab37416a..c1cb26813 100644 --- a/httemplate/edit/process/cust_pkg_salesnum.html +++ b/httemplate/edit/process/cust_pkg_salesnum.html @@ -5,7 +5,7 @@ <& /elements/header-popup.html, "Sales Person changed" &> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index 8977ced20..d4236bcdf 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -7,7 +7,7 @@ % <% header('Refund entered') %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> diff --git a/httemplate/edit/process/cust_tax_adjustment.html b/httemplate/edit/process/cust_tax_adjustment.html index 204b5b9f7..fe232757f 100644 --- a/httemplate/edit/process/cust_tax_adjustment.html +++ b/httemplate/edit/process/cust_tax_adjustment.html @@ -4,7 +4,7 @@ % } else { <% header("Tax adjustment added") %> <SCRIPT TYPE="text/javascript"> - //window.top.location.reload(); + //topreload(); parent.cClick(); </SCRIPT> </BODY></HTML> diff --git a/httemplate/edit/process/detach-cust_pkg.html b/httemplate/edit/process/detach-cust_pkg.html index 782ffa5e0..34c580560 100644 --- a/httemplate/edit/process/detach-cust_pkg.html +++ b/httemplate/edit/process/detach-cust_pkg.html @@ -5,7 +5,7 @@ <% header(emt("Package detached")) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi index 8369f7114..9d869d547 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -3,7 +3,7 @@ %} elsif ( $recnum ) { #editing <% header('Nameservice record changed') %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> %} else { #adding diff --git a/httemplate/edit/process/elements/ApplicationCommon.html b/httemplate/edit/process/elements/ApplicationCommon.html index c7bdd3ea2..67fa89196 100644 --- a/httemplate/edit/process/elements/ApplicationCommon.html +++ b/httemplate/edit/process/elements/ApplicationCommon.html @@ -21,11 +21,12 @@ Examples: </%doc> %if ( $error ) { % $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). $opt{error_redirect}. '?'. $cgi->query_string ) %> +% my $query = $m->scomp('/elements/create_uri_query'); +<% $cgi->redirect(popurl(2). $opt{error_redirect}. "?$query") %> %} else { <% header("$src_thing application$to sucessful") %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> </HTML> diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index fd12c61d9..76722c960 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -62,6 +62,8 @@ Example: 'fields' => [qw( fieldname fieldname2 )], }, + 'process_locale' => 'fieldname', # update entries in the _msgcat table + 'process_upload' => { 'process' => 'misc/mytable-import.html', # fields to pass to the back end job, besides the @@ -186,7 +188,7 @@ process(); <% include('/elements/header-popup.html', $opt{'popup_reload'} ) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY> @@ -363,12 +365,21 @@ foreach my $value ( @values ) { } - if ( !$error && $opt{'process_o2m'} ) { - - my @process_o2m = ref($opt{'process_o2m'}) eq 'ARRAY' - ? @{ $opt{'process_o2m'} } - : ( $opt{'process_o2m'} ); + my @process_o2m; + if ( $opt{'process_o2m'} ) { + @process_o2m = ref($opt{'process_o2m'}) eq 'ARRAY' + ? @{ $opt{'process_o2m'} } + : ( $opt{'process_o2m'} ); + } + if ( $opt{'process_locale'} ) { + push @process_o2m, + { + 'table' => $table . '_msgcat', + 'fields' => [ 'locale', $opt{'process_locale'} ], + }; + } + if ( !$error ) { foreach my $process_o2m (@process_o2m) { diff --git a/httemplate/edit/process/part_event.html b/httemplate/edit/process/part_event.html index bac69241c..0293af886 100644 --- a/httemplate/edit/process/part_event.html +++ b/httemplate/edit/process/part_event.html @@ -39,8 +39,8 @@ split(/\0/, $value) }; } elsif ( $info->{'type'} eq 'freq' ) { - $value = '0' if !length($value); - $value .= $params->{$cgi_field.'_units'}; + $value = '0' if !length($value) and !$info->{'allow_blank'}; + $value .= $params->{$cgi_field.'_units'} if length($value); } #warn "value of $cgi_field is $value\n"; diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index b8042026a..c4d150ba1 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -9,6 +9,7 @@ 'edit_ext' => 'cgi', 'precheck_callback' => $precheck_callback, 'args_callback' => $args_callback, + 'process_locale' => 'pkg', 'process_m2m' => \@process_m2m, 'process_o2m' => \@process_o2m, ) @@ -310,10 +311,6 @@ foreach my $amount_param ( grep /^usagepricepart(\d+)_amount$/, $cgi->param ) { my @process_o2m = ( { - 'table' => 'part_pkg_msgcat', - 'fields' => [qw( locale pkg )], - }, - { 'table' => 'part_pkg_usageprice', 'fields' => [qw( price currency action target amount )], diff --git a/httemplate/edit/process/prospect_main.html b/httemplate/edit/process/prospect_main.html index 7c8cc276e..b2ae88eba 100644 --- a/httemplate/edit/process/prospect_main.html +++ b/httemplate/edit/process/prospect_main.html @@ -1,5 +1,6 @@ <% include('elements/process.html', 'table' => 'prospect_main', + 'precheck_callback' => $precheck, 'args_callback' => $args_callback, 'agent_virt' => 1, 'process_o2m' => { @@ -11,6 +12,16 @@ %> <%init> +my $precheck = sub { + my $cgi = shift; + my $vendor = FS::Conf->new->config('tax_data_vendor'); + if ( $vendor eq 'avalara' or $vendor eq 'suretax' ) { + if ( ! $cgi->param('taxstatusnum') ) { + return 'Tax status required'; + } + } +}; + my $args_callback = sub { my( $cgi, $object ) = @_; diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index 8ee182141..00d17c8b1 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -1,10 +1,10 @@ % if ( $error ) { % $cgi->param('error', $error ); -<% $cgi->redirect($p.'quick-charge.html?'. $cgi->query_string) %> +<% $cgi->redirect($redirect) %> % } else { <% header(emt($message)) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } @@ -157,4 +157,14 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge } +my $redirect; +if ( $error ) { + $cgi->param('error', $error ); + $redirect = $p.'quick-charge.html?'. $cgi->query_string; +} elsif ( $quotation ) { + $redirect = $fsurl.'view/quotation.html?' . $quotation->quotationnum; +} else { + $redirect = $fsurl.'view/cust_main.cgi?custnum=' . $cust_main->custnum . ';show=last'; +} + </%init> diff --git a/httemplate/edit/process/quotation_convert.html b/httemplate/edit/process/quotation_convert.html index dc00a88d3..26b5294f7 100644 --- a/httemplate/edit/process/quotation_convert.html +++ b/httemplate/edit/process/quotation_convert.html @@ -10,9 +10,12 @@ my $quotation = qsearchs( 'quotation' => { quotationnum => scalar( $cgi->param('quotationnum') ), } ) or die 'unknown quotationnum'; +my $params = {}; +$$params{'onhold'} = $cgi->param('onhold') ? 1 : 0; + my $cust_main = $quotation->cust_main; if ( $cust_main ) { - my $error = $quotation->order; + my $error = $quotation->order(undef,$params); errorpage($error) if $error; #i should be part of the order transaction @@ -20,7 +23,7 @@ if ( $cust_main ) { $quotation->replace; } else { - $cust_main = $quotation->convert_cust_main; + $cust_main = $quotation->convert_cust_main( $params ); errorpage($cust_main) unless ref($cust_main);# eq 'FS::cust_main'; } diff --git a/httemplate/edit/process/quotation_pkg_detail.html b/httemplate/edit/process/quotation_pkg_detail.html index 9e4ac3222..5728832b2 100644 --- a/httemplate/edit/process/quotation_pkg_detail.html +++ b/httemplate/edit/process/quotation_pkg_detail.html @@ -6,7 +6,7 @@ % } else { <% header($action) %> <SCRIPT TYPE="text/javascript"> - window.top.location.reload(); + topreload(); </SCRIPT> </BODY></HTML> % } @@ -26,8 +26,16 @@ my $quotation_pkg = qsearchs({ 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'quotationpkgnum' => $pkgnum }, 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}) +|| qsearchs({ + 'table' => 'quotation_pkg', + 'addl_from' => 'LEFT JOIN quotation USING ( quotationnum )'. + 'LEFT JOIN prospect_main USING ( prospectnum )', + 'hashref' => { 'quotationpkgnum' => $pkgnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, }); + my @orig_details = $quotation_pkg->details(); my $action = 'Quotation details'. diff --git a/httemplate/edit/process/svc_dsl.html b/httemplate/edit/process/svc_dsl.html index 436ca766b..489c86916 100644 --- a/httemplate/edit/process/svc_dsl.html +++ b/httemplate/edit/process/svc_dsl.html @@ -25,7 +25,7 @@ my $precheck_callback = sub { my $psc = $part_svc->part_svc_column('password'); if ( $psc->columnflag eq 'F' ) { # enforce it here and skip password validation - $cgi->param('password', $psc->columnvalue; + $cgi->param('password', $psc->columnvalue); } else { my $newpass = $cgi->param('password'); if ( $old and $newpass ne $old->password ) { diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html index 02362db6a..d14ac56f8 100644 --- a/httemplate/edit/process/tower.html +++ b/httemplate/edit/process/tower.html @@ -4,6 +4,7 @@ process_o2m => { 'table' => 'tower_sector', 'fields' => [qw( sectorname ip_addr height freq_mhz direction width + downtilt v_width margin sector_range )], }, diff --git a/httemplate/edit/prospect_main.html b/httemplate/edit/prospect_main.html index fb6751532..6aefe80d0 100644 --- a/httemplate/edit/prospect_main.html +++ b/httemplate/edit/prospect_main.html @@ -34,8 +34,10 @@ { 'field' => 'contactnum', 'type' => 'contact', 'colspan' => 7, - 'o2m_table' => 'contact', - 'm2_label' => 'Contact', + 'prospectnum' => $prospectnum, + 'm2m_method' => 'prospect_contact', + 'm2m_dstcol' => 'contactnum', + 'm2_label' => 'Contact', 'm2_error_callback' => $m2_error_callback, }, @@ -50,6 +52,7 @@ }, { 'field' => 'taxstatusnum', 'type' => 'select-tax_status', + 'required' => 1, 'empty_label' => ' ', }, ], @@ -68,18 +71,25 @@ my $conf = new FS::Conf; my $prospectnum; if ( $cgi->param('error') ) { - $prospectnum = scalar($cgi->param('prospectnum')); + $cgi->param('prospectnum') =~ /^(\d*)$/ or die 'illegal prospectnum'; + $prospectnum = $1; die "access denied" unless $curuser->access_right(($prospectnum ? 'Edit' : 'New'). ' prospect'); } elsif ( $cgi->keywords ) { #editing + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/ or die 'no prospectnum'; + $prospectnum = $1; + die "access denied" unless $curuser->access_right('Edit prospect'); } else { #new prospect + $prospectnum = ''; + die "access denied" unless $curuser->access_right('New prospect'); diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 14c3f51e6..2bbbe43d8 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -1,4 +1,4 @@ -<& /elements/header-popup.html, mt('One-time charge'), '', +<& /elements/header.html, mt('One-time charge'), '', ( ($quotationnum || $cgi->param('error')) ? '' : 'onload="addRow()"' ), &> @@ -93,6 +93,18 @@ function bill_now_changed (what) { </SCRIPT> +<P> +% if ( $cust_main ) { +<& /elements/small_custview.html, + $cust_main->custnum, + scalar($conf->config('countrydefault')), + 1, #no balance +&> +% } else { +<& /elements/small_prospect_view.html, $prospect_main &> +% } +</P> + <FORM ACTION = "process/quick-charge.cgi" NAME = "QuickChargeForm" ID = "QuickChargeForm" @@ -183,7 +195,10 @@ function bill_now_changed (what) { <& /elements/tr-select-taxclass.html, 'curr_value' => $part_pkg->get('taxclass') &> - <& /elements/tr-select-taxproduct.html, 'label' => emt('Tax product'), 'onclick' => 'parent.taxproductmagic(this);', 'curr_value' => $part_pkg->get('taxproductnum') &> + <& /elements/tr-select-taxproduct.html, + 'label' => emt('Tax product'), + 'curr_value' => $part_pkg->get('taxproductnum') + &> % } % } else { # new one-time charge @@ -307,9 +322,14 @@ function bill_now_changed (what) { <& /elements/tr-select-taxclass.html, 'curr_value' => $cgi->param('taxclass') &> -<& /elements/tr-select-taxproduct.html, 'label' => emt('Tax product'), 'onclick' => 'parent.taxproductmagic(this);', 'curr_value' => $cgi->param('taxproductnum') &> +<& /elements/tr-select-taxproduct.html, + 'label' => emt('Tax product'), + 'curr_value' => $cgi->param('taxproductnum') +&> -<& /elements/tr-select-taxoverride.html, 'onclick' => 'parent.taxoverridemagic(this);', 'curr_value' => $cgi->param('tax_override') &> +<& /elements/tr-select-taxoverride.html, + 'curr_value' => $cgi->param('tax_override') +&> % } # if !$cust_pkg diff --git a/httemplate/edit/quotation_pkg_detail.html b/httemplate/edit/quotation_pkg_detail.html index 036bffdde..9aa50ec38 100644 --- a/httemplate/edit/quotation_pkg_detail.html +++ b/httemplate/edit/quotation_pkg_detail.html @@ -61,6 +61,13 @@ my $quotation_pkg = qsearchs({ 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'quotationpkgnum' => $pkgnum }, 'extra_sql' => ' AND '. $curuser->agentnums_sql, +}) +|| qsearchs({ + 'table' => 'quotation_pkg', + 'addl_from' => 'LEFT JOIN quotation USING ( quotationnum )'. + 'LEFT JOIN prospect_main USING ( prospectnum )', + 'hashref' => { 'quotationpkgnum' => $pkgnum }, + 'extra_sql' => ' AND '. $curuser->agentnums_sql, }); my $part_pkg = $quotation_pkg->part_pkg; diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index ca26c6cf0..7be5eabb7 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -31,7 +31,7 @@ </TR> <% include('/elements/tr-td-label.html', - 'label' => mt('Username'), + 'label' => $part_svc->part_svc_column('username')->columnlabel || mt('Username'), 'required' => $part_svc->part_svc_column('username')->required ) %> % if ( $svcnum && $conf->exists('svc_acct-no_edit_username') ) { <TD BGCOLOR="#eeeeee"><% $svc_acct->username() %></TD> @@ -46,7 +46,7 @@ %if ( $part_svc->part_svc_column('_password')->columnflag ne 'F' ) { % #XXX eventually should require "Edit Password" ACL <% include('/elements/tr-td-label.html', - 'label' => mt('Password'), + 'label' => $part_svc->part_svc_column('_password')->columnlabel || mt('Password'), 'required' => $part_svc->part_svc_column('_password')->required ) %> <TD> <INPUT TYPE="text" ID="clear_password" NAME="clear_password" VALUE="<% $password %>" SIZE=<% $pmax2 %> MAXLENGTH=<% $pmax %>> @@ -68,7 +68,7 @@ % && $part_svc->part_svc_column('sec_phrase')->columnflag ne 'F' ) { <% include('/elements/tr-td-label.html', - 'label' => mt('Security phrase'), + 'label' => $part_svc->part_svc_column('sec_phrase')->columnlabel || mt('Security phrase'), 'required' => $part_svc->part_svc_column('sec_phrase')->required ) %> <TD> <INPUT TYPE="text" NAME="sec_phrase" VALUE="<% $sec_phrase %>" SIZE=32> @@ -106,7 +106,7 @@ % ); <% include('/elements/tr-td-label.html', - 'label' => mt('Domain'), + 'label' => $part_svc->part_svc_column('domsvc')->columnlabel || mt('Domain'), 'required' => $part_svc->part_svc_column('domsvc')->required ) %> <TD> <SELECT NAME="domsvc" SIZE=1> @@ -142,6 +142,7 @@ 'curr_value' => $svc_acct->pbxsvc, 'part_svc' => $part_svc, 'cust_pkg' => $cust_pkg, + 'label' => $part_svc->part_svc_column('pbxsvc')->columnlabel || 'PBX', &> %#pop @@ -153,7 +154,7 @@ % } else { <% include('/elements/tr-td-label.html', - 'label' => mt('Access number'), + 'label' => $part_svc->part_svc_column('popnum')->columnlabel || mt('Access number'), 'required' => $part_svc->part_svc_column('popnum')->required ) %> <TD><% FS::svc_acct_pop::popselector($popnum) %></TD> </TR> @@ -167,6 +168,7 @@ #'part_svc' => $part_svc, #'cust_pkg' => $cust_pkg, 'required' => $part_svc->part_svc_column('sectornum')->required, + 'label' => $part_svc->part_svc_column('sectornum')->columnlabel || mt('Tower sector'), &> %} else { <INPUT TYPE="hidden" NAME="sectornum" VALUE="<% $svc_acct->sectornum %>"> @@ -188,10 +190,10 @@ % if ( length($svc_acct->$xid()) ) { <% include('/elements/tr-td-label.html', - 'label' => uc($xid), + 'label' => $part_svc->part_svc_column($xid)->columnlabel || uc($xid), 'required' => $part_svc->part_svc_column($xid)->required ) %> - <TR> - <TD ALIGN="right"><% uc($xid) %></TD> +%# <TR> +%# <TD ALIGN="right"><% uc($xid) %></TD> <TD BGCOLOR="#eeeeee"><% $svc_acct->$xid() %></TD> <TD> </TD> @@ -202,7 +204,7 @@ % } else { <% include('/elements/tr-td-label.html', - 'label' => uc($xid), + 'label' => $part_svc->part_svc_column($xid)->columnlabel || uc($xid), 'required' => $part_svc->part_svc_column($xid)->required ) %> <TD> <INPUT TYPE="text" NAME="<% $xid %>" SIZE=8 MAXLENGTH=6 VALUE="<% $svc_acct->$xid() %>"> @@ -221,7 +223,7 @@ <% include('/elements/tr-td-label.html', - 'label' => mt('Real Name'), + 'label' => $part_svc->part_svc_column('finger')->columnlabel || mt('Real Name'), 'required' => $part_svc->part_svc_column('finger')->required ) %> <TD> <INPUT TYPE="text" NAME="finger" VALUE="<% $svc_acct->finger %>"> @@ -240,7 +242,7 @@ <% include('/elements/tr-td-label.html', - 'label' => mt('Home directory'), + 'label' => $part_svc->part_svc_column('dir')->columnlabel || mt('Home directory'), 'required' => $part_svc->part_svc_column('dir')->required ) %> <TD><INPUT TYPE="text" NAME="dir" VALUE="<% $svc_acct->dir %>"></TD> </TR> @@ -258,7 +260,7 @@ <% include('/elements/tr-td-label.html', - 'label' => mt('Shell'), + 'label' => $part_svc->part_svc_column('shell')->columnlabel || mt('Shell'), 'required' => $part_svc->part_svc_column('shell')->required ) %> <TD> <SELECT NAME="shell" SIZE=1> @@ -289,7 +291,9 @@ 'object' => $svc_acct, 'ip_field' => 'slipip', 'required' => $part_svc->part_svc_column('routernum')->required, + 'label' => $part_svc->part_svc_column('routernum')->columnlabel, 'ip_addr_required' => $part_svc->part_svc_column('slipip')->required, + 'ip_addr_label' => $part_svc->part_svc_column('slipip')->columnlabel, &> % } else { % # don't expose these to the user--they're only useful in the other case @@ -299,7 +303,7 @@ <INPUT TYPE="hidden" NAME="slipip" VALUE="<% $svc_acct->slipip %>"> % } else { <% include('/elements/tr-td-label.html', - 'label' => mt('IP'), + 'label' => $part_svc->part_svc_column('slipip')->columnlabel || mt('IP'), 'required' => $part_svc->part_svc_column('slipip')->required ) %> <TD><INPUT TYPE="text" NAME="slipip" VALUE="<% $svc_acct->slipip %>"></TD> </TR> @@ -346,7 +350,7 @@ <% include('/elements/tr-td-label.html', - 'label' => mt('RADIUS groups'), + 'label' => $part_svc->part_svc_column('usergroup')->columnlabel || mt('RADIUS groups'), 'required' => $part_svc->part_svc_column('usergroup')->required ) %> % if ( $part_svc_usergroup->columnflag eq 'F' ) { <TD BGCOLOR="#eeeeee"><% join('<BR>', @groupnames) %></TD> diff --git a/httemplate/edit/svc_acct/communigate.html b/httemplate/edit/svc_acct/communigate.html index 370bfb0e7..544d00be3 100644 --- a/httemplate/edit/svc_acct/communigate.html +++ b/httemplate/edit/svc_acct/communigate.html @@ -46,7 +46,7 @@ % if ( $part_svc->part_svc_column('quota')->columnflag eq 'F' ) { <INPUT TYPE="hidden" NAME="quota" VALUE="<% $svc_acct->quota %>"> % } else { -% my $quota_label = $communigate ? 'Mail storage limit' : 'Quota'; +% my $quota_label = $communigate ? 'Mail storage limit' : ($part_svc->part_svc_column('quota')->columnlabel || 'Quota'); <% include('/elements/tr-td-label.html', 'label' => $quota_label, 'required' => $part_svc->part_svc_column('quota')->required ) %> diff --git a/httemplate/edit/tower.html b/httemplate/edit/tower.html index fa3838dcf..377a33e9b 100644 --- a/httemplate/edit/tower.html +++ b/httemplate/edit/tower.html @@ -26,9 +26,9 @@ 'default_ip_addr' => 'Tower IP address', 'latitude' => 'Latitude', 'longitude' => 'Longitude', - 'altitude' => 'Altitude', - 'height' => 'Height', - 'veg_height' => 'Vegetation height', + 'altitude' => 'Altitude (feet)', + 'height' => 'Height (feet)', + 'veg_height' => 'Vegetation height (feet)', 'color' => 'Color', }, &> @@ -38,7 +38,7 @@ my $m2_error_callback = sub { # reconstruct the list my ($cgi, $object) = @_; my @fields = qw( - sectorname ip_addr height freq_mhz direction width sector_range + sectorname ip_addr height freq_mhz direction width tilt v_width margin sector_range ); map { |
