diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/config/config-process.cgi | 6 | ||||
-rw-r--r-- | httemplate/edit/msg_template/email.html | 2 | ||||
-rw-r--r-- | httemplate/edit/part_export.cgi | 3 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main_county-add.cgi | 71 | ||||
-rw-r--r-- | httemplate/elements/city.html | 4 | ||||
-rw-r--r-- | httemplate/elements/contact.html | 2 | ||||
-rw-r--r-- | httemplate/elements/progress-init.html | 2 | ||||
-rw-r--r-- | httemplate/elements/select-cust-fields.html | 10 | ||||
-rw-r--r-- | httemplate/elements/tr-amount_fee.html | 6 | ||||
-rw-r--r-- | httemplate/elements/tr-select-cust-fields.html | 9 | ||||
-rw-r--r-- | httemplate/elements/tr-select-payment_options.html | 2 | ||||
-rw-r--r-- | httemplate/misc/process/payment.cgi | 25 | ||||
-rw-r--r-- | httemplate/search/contact.html | 18 | ||||
-rwxr-xr-x | httemplate/search/cust_main.html | 1 | ||||
-rw-r--r-- | httemplate/search/elements/cust_main_phones.html | 28 | ||||
-rw-r--r-- | httemplate/search/elements/options_cust_contacts.html | 17 | ||||
-rwxr-xr-x | httemplate/search/report_cust_main.html | 1 | ||||
-rw-r--r-- | httemplate/view/cust_main/contacts_new.html | 4 | ||||
-rw-r--r-- | httemplate/view/svc_export/run_script.cgi | 10 |
19 files changed, 151 insertions, 70 deletions
diff --git a/httemplate/config/config-process.cgi b/httemplate/config/config-process.cgi index d84edce00..6af7d2322 100644 --- a/httemplate/config/config-process.cgi +++ b/httemplate/config/config-process.cgi @@ -155,7 +155,9 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { } } elsif ( $type eq 'checkbox' ) { if ( defined $cgi->param($i->key.$n) ) { - push @touch, $i->key; + my $error = &{$i->validate}('', $n) if $i->validate; + push @error, $error if $error; + push @touch, $i->key if !$error; } else { push @delete, $i->key; } @@ -167,7 +169,7 @@ foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) { if ( scalar(@{[ $cgi->param($i->key.$n) ]}) && $cgi->param($i->key.$n) ne '' ) { my $error = &{$i->validate}([ $cgi->param($i->key.$n) ], $n) if $i->validate; push @error, $error if $error; - $conf->set($i->key, join("\n", @{[ $cgi->param($i->key.$n) ]} ), $agentnum); + $conf->set($i->key, join("\n", @{[ $cgi->param($i->key.$n) ]} ), $agentnum) if !$error; } else { $conf->delete($i->key, $agentnum); } diff --git a/httemplate/edit/msg_template/email.html b/httemplate/edit/msg_template/email.html index 53f538b11..a400bc804 100644 --- a/httemplate/edit/msg_template/email.html +++ b/httemplate/edit/msg_template/email.html @@ -297,6 +297,7 @@ my %substitutions = ( 'cust_pay' => [ '$paynum' => 'Payment#', '$paid' => 'Amount', + '$processing_fee' => 'Processing fee', '$payby' => 'Payment method', '$date' => 'Payment date', '$payinfo' => 'Card/account# (masked)', @@ -372,6 +373,7 @@ Substitutions: ' Enclose substitutions and other Perl expressions in braces: <BR>{ $name } = ExampleCo (Smith, John) <BR>{ time2str("%D", time) } = '.time2str("%D", time).' +<BR>{ "processing fee of $processing_fee" if $processing_fee; } = Will display text if there is a processing fee </P>'; $sidebar .= include('/elements/template_image-dialog.html', 'callback' => 'insertHtml' diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index f8a46c7fd..30e4218e2 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -296,7 +296,7 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= '<TR><TD ALIGN="left" COLSPAN=2>' . include('/elements/progress-init.html', $part_export->exporttype, - [ $script.'_exportnum', $script.'_script' ], + [ $script.'_exportnum' ], rooturl().'view/svc_export/run_script.cgi', { 'error_url' => rooturl().$exports->{$layer}{scripts}{$script}->{error_url}."exportnum=".$part_export->{Hash}->{exportnum}, @@ -307,7 +307,6 @@ my $widget = new HTML::Widgets::SelectLayers( $script, ) . '<INPUT TYPE="hidden" NAME="'.$script.'_exportnum" VALUE="'.$part_export->{Hash}->{exportnum}.'"> - <INPUT TYPE="hidden" NAME="'.$script.'_script" VALUE="'.$script.'"> <A HREF="#" onClick="'.$script.'process();">'.$exports->{$layer}{scripts}{$script}->{html_label}.'</A></TD></TR>'; } diff --git a/httemplate/edit/process/cust_main_county-add.cgi b/httemplate/edit/process/cust_main_county-add.cgi index fcc138f49..fcd6be48f 100755 --- a/httemplate/edit/process/cust_main_county-add.cgi +++ b/httemplate/edit/process/cust_main_county-add.cgi @@ -27,26 +27,59 @@ my @expansion = split /[\n\r]{1,2}/, $cgi->param('expansion'); $1; } @expansion; -foreach ( @expansion ) { - my(%hash)=$cust_main_county->hash; - my($new)=new FS::cust_main_county \%hash; - $new->setfield('taxnum',''); - $new->setfield('taxclass', ''); - if ( $cgi->param('what') eq 'state' ) { #?? - $new->setfield('state',$_); - $new->setfield('county', ''); - $new->setfield('city', ''); - } elsif ( $cgi->param('what') eq 'county' ) { - $new->setfield('county',$_); - $new->setfield('city', ''); - } elsif ( $cgi->param('what') eq 'city' ) { - #uppercase cities in the US to try and agree with USPS validation - $new->setfield('city', $new->country eq 'US' ? uc($_) : $_ ); - } else { #??? - die 'unknown what '. $cgi->param('what'); +my $what = $cgi->param('what'); +foreach my $new_tax_area ( @expansion ) { + + # Clone specific tax columns from original tax row + # + # UI Note: Preserving original behavior, of cloning + # tax amounts into new tax record, against better + # judgement. If the new city/county/state has a + # different tax value than the one being populated + # (rather likely?) now the user must remember to + # revisit each newly created tax row, and correct + # the possibly incorrect tax values that were populated. + # Values would be easier to identify and correct if + # they were initially populated with 0% tax rates + # District Note: The 'district' column is NOT cloned + # to the new tax row. Manually entered taxes + # are not be divided into road maintenance districts + # like Washington state sales taxes + my $new = FS::cust_main_county->new({ + map { $_ => $cust_main_county->getfield($_) } + qw/ + charge_prediscount + exempt_amount + exempt_amount_currency + recurtax + setuptax + tax + taxname + / + }); + + # Clone additional location columns, based on the $what value + my %clone_cols_for = ( + state => [qw/country /], + county => [qw/country state/], + city => [qw/country state county/], + ); + + die "unknown what: $what" + unless grep { $_ eq $what } keys %clone_cols_for; + + $new->setfield( $_ => $cust_main_county->getfield($_) ) + for @{ $clone_cols_for{ $cgi->param('what') } }; + + # In the US, store cities upper case for USPS validation + $new_tax_area = uc($new_tax_area) + if $what eq 'city' + && $new->country eq 'US'; + + $new->setfield( $what, $new_tax_area ); + if ( my $error = $new->insert ) { + die $error; } - my $error = $new->insert; - die $error if $error; } </%init> diff --git a/httemplate/elements/city.html b/httemplate/elements/city.html index 3c5e91782..f710d04db 100644 --- a/httemplate/elements/city.html +++ b/httemplate/elements/city.html @@ -131,6 +131,10 @@ function <% $pre %>county_changed(what, callback) {} <% $select_style %> > +% if ( $opt{city} ) { + <OPTION VALUE="<% $opt{city} %>" SELECTED><% $opt{city} %></OPTION> +% } + % unless ( $opt{'disable_empty'} ) { <OPTION VALUE="" <% $opt{city} eq '' ? 'SELECTED' : '' %>><% $opt{empty_label} %></OPTION> % } diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index 599f6629d..308b846bc 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -180,7 +180,7 @@ unless ($opt{'for_prospect'}) { } my $first = 0; -foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) { +foreach my $phone_type ( FS::phone_type->get_phone_types() ) { next if $phone_type->typename =~ /^(Home|Fax)$/; my $f = 'phonetypenum'.$phone_type->phonetypenum; $label{$f} = $phone_type->typename. ' phone'; diff --git a/httemplate/elements/progress-init.html b/httemplate/elements/progress-init.html index 2a62c5e99..de3c6b761 100644 --- a/httemplate/elements/progress-init.html +++ b/httemplate/elements/progress-init.html @@ -126,6 +126,8 @@ function <%$key%>process () { } } + Hash.push('key', '<%$key%>'); + // jsrsPOST = true; // jsrsExecute( '<% $action %>', <%$key%>myCallback, 'start_job', Hash ); diff --git a/httemplate/elements/select-cust-fields.html b/httemplate/elements/select-cust-fields.html index 5e3063877..833f7c1af 100644 --- a/httemplate/elements/select-cust-fields.html +++ b/httemplate/elements/select-cust-fields.html @@ -1,8 +1,14 @@ <%init> my( $cust_fields, %opt ) = @_; - use FS::ConfDefaults; - $opt{'avail_fields'} ||= [ FS::ConfDefaults->cust_fields_avail() ]; + my @fields = FS::ConfDefaults->cust_fields_avail(); + my $contact_phone_list; + foreach my $phone_type ( FS::phone_type->get_phone_types() ) { + $contact_phone_list .= " | Contact ".$phone_type->typename." phone(s)"; + } + @fields = map {s/ \| Contact phone\(s\)/$contact_phone_list/g; $_; } @fields; + + $opt{'avail_fields'} ||= [ @fields ]; tie my %hash, 'Tie::IxHash', @{ $opt{'avail_fields'} }; </%init> diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html index 94795de37..40f55e7a3 100644 --- a/httemplate/elements/tr-amount_fee.html +++ b/httemplate/elements/tr-amount_fee.html @@ -5,7 +5,7 @@ <% $money_char %><INPUT NAME = "amount" ID = "amount" TYPE = "text" - VALUE = "<% $amount %>" + VALUE = "0.00" SIZE = 8 STYLE = "text-align:right;" % if ( $fee || $surcharge_percentage || $surcharge_flatfee || $processing_fee) { @@ -44,7 +44,7 @@ <TD> <TABLE><TR> <TD BGCOLOR="#ffffff"> - <INPUT TYPE="checkbox" NAME="processing_fee" ID="processing_fee" VALUE="<% $processing_fee %>" onclick="<% $opt{prefix} %>process_fee_changed()"> + <INPUT TYPE="checkbox" NAME="processing_fee" ID="processing_fee" VALUE="<% $processing_fee %>" onclick="<% $opt{prefix} %>process_fee_changed()" checked> </TD> <TD ID="ajax_processingfee_cell" BGCOLOR="#dddddd" STYLE="border:1px solid blue"> <FONT SIZE="+1">A processing fee of <% $processing_fee %> is being applied to this transaction.</FONT> @@ -140,6 +140,8 @@ if ( $amount ) { $amount += $surcharge; + $amount += $processing_fee; ## needed if processing fee is checked on default. + $amount = sprintf("%.2f", $amount); } diff --git a/httemplate/elements/tr-select-cust-fields.html b/httemplate/elements/tr-select-cust-fields.html index dd8513316..cbac20280 100644 --- a/httemplate/elements/tr-select-cust-fields.html +++ b/httemplate/elements/tr-select-cust-fields.html @@ -6,6 +6,13 @@ my( $cust_fields, %opt ) = @_; -$opt{'avail_fields'} ||= [ FS::ConfDefaults->cust_fields_avail() ]; +my @fields = FS::ConfDefaults->cust_fields_avail(); +my $contact_phone_list; +foreach my $phone_type ( FS::phone_type->get_phone_types() ) { + $contact_phone_list .= " | Contact ".$phone_type->typename." phone(s)"; +} +@fields = map {s/ \| Contact phone\(s\)/$contact_phone_list/g; $_; } @fields; + +$opt{'avail_fields'} ||= [ @fields ]; </%init> diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html index c5b84e756..27df9622e 100644 --- a/httemplate/elements/tr-select-payment_options.html +++ b/httemplate/elements/tr-select-payment_options.html @@ -60,7 +60,7 @@ Example: $('#payment_option_row').<% $payment_option_row %>(); $('#payment_amount_row').<% $payment_amount_row %>(); - $('#ajax_processingfee_cell').hide(); + $('#ajax_processingfee_cell').show(); if($('#payment_amount_row').is(':visible')) { var surcharge; diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 56bcfd872..5b18367f7 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -186,15 +186,22 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { %saveopt = map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}}; } - my $error = $cust_main->save_cust_payby( - 'saved_cust_payby' => \$cust_payby, - 'payment_payby' => $payby, - 'auto' => scalar($cgi->param('auto')), - 'weight' => scalar($cgi->param('weight')), - 'payinfo' => $payinfo, - 'payname' => $payname, - %saveopt - ); + my $error; + { + local $@; + eval { + $error = $cust_main->save_cust_payby( + 'saved_cust_payby' => \$cust_payby, + 'payment_payby' => $payby, + 'auto' => scalar($cgi->param('auto')), + 'weight' => scalar($cgi->param('weight')), + 'payinfo' => $payinfo, + 'payname' => $payname, + %saveopt + ); + }; + $error ||= $@; + } errorpage("error saving info, payment not processed: $error") if $error; diff --git a/httemplate/search/contact.html b/httemplate/search/contact.html index 24cb237c3..5def389cc 100644 --- a/httemplate/search/contact.html +++ b/httemplate/search/contact.html @@ -38,7 +38,6 @@ my $classnum_null = grep{ $_ eq 0 } $cgi->param('classnum'); # Catch destination values from dest multi-checkbox, default to message # irrelevant to prospect contacts my @dest = grep{ /^(message|invoice)$/ } $cgi->param('dest'); -@dest = ('message') unless @dest; # Cache the contact_class table my %classname = @@ -125,7 +124,7 @@ if (@classnum || $classnum_null) { if (@dest && $link eq 'cust_main') { my @stm; push @stm, "cust_contact.${_}_dest IS NOT NULL" for @dest; - $extra_sql .= "\nAND (".join(' OR ',@stm).') '; + $extra_sql .= "\nAND (".join(' AND ',@stm).') '; } if ($DEBUG) { @@ -141,20 +140,23 @@ if ($DEBUG) { # Prepare to display phone numbers # adds 3 additional queries per table record :-( -my %phonetype = (qw/1 Work 2 Home 3 Mobile 4 Fax/); -my %phoneid = (qw/Work 1 Home 2 Mobile 3 Fax 4/); my $get_phone_sub = sub { my $type = shift; return sub { my $rec = shift; my @p = qsearch('contact_phone', { contactnum => $rec->contact_contactnum, - phonetypenum => $phoneid{$type} + phonetypenum => $type, }); - @p ? (join ', ',map{$_->phonenum} @p) : undef; + @p ? (join ', ',map{$_->phonenum_pretty} @p) : undef; }; }; +my @phones; +foreach my $phone_type ( FS::phone_type->get_phone_types() ) { + push @phones, { label => $phone_type->typename.' Phone', field => $get_phone_sub->($phone_type->phonetypenum), }; +} + # Cache contact types my %classname = map {$_->classnum => $_->classname} @@ -166,9 +168,7 @@ my @report = ( { label => 'Last', field => 'contact_last' }, { label => 'Title', field => 'contact_title' }, { label => 'E-Mail', field => 'contact_email_emailaddress' }, - { label => 'Work Phone', field => $get_phone_sub->('Work') }, - { label => 'Mobile Phone', field => $get_phone_sub->('Mobile') }, - { label => 'Home Phone', field => $get_phone_sub->('Home') }, + @phones, { label => 'Type', field => sub { my $rec = shift; diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 83ca7217d..46e35da7f 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -51,6 +51,7 @@ my %search_hash = (); my @scalars = qw ( agentnum salesnum status address city county state zip country location_history + daytime night mobile fax invoice_terms no_censustract with_geocode with_email tax no_tax POST no_POST custbatch usernum diff --git a/httemplate/search/elements/cust_main_phones.html b/httemplate/search/elements/cust_main_phones.html new file mode 100644 index 000000000..366d0983b --- /dev/null +++ b/httemplate/search/elements/cust_main_phones.html @@ -0,0 +1,28 @@ +<TR> + <TH VALIGN="top" ALIGN="right"><% mt('Phones') |h %></TD> + <TD COLSPAN=6> + <TABLE CELLSPACING=0 CELLPADDING=0> + <TR> +% foreach my $phone (qw(daytime night mobile fax)) { + <TD> + <INPUT TYPE="text" + NAME="<% $phone %>" + VALUE="" + SIZE=18 + > + <BR><FONT SIZE=-1 COLOR="#333333"><% mt($phone_label{$phone}) |h %></FONT> + </TD> + <TD> </TD> +% } + </TR> + </TABLE> + </TD> +</TR> +<%init> +my %phone_label = ( + daytime => 'Day Phone', + night => 'Night Phone', + mobile => 'Mobile Phone', + fax => 'Fax Number', +); +</%init>
\ No newline at end of file diff --git a/httemplate/search/elements/options_cust_contacts.html b/httemplate/search/elements/options_cust_contacts.html index cfbf834b0..372bc6755 100644 --- a/httemplate/search/elements/options_cust_contacts.html +++ b/httemplate/search/elements/options_cust_contacts.html @@ -12,21 +12,12 @@ <TH ALIGN="right" VALIGN="center"><% mt('Email') |h %></TH> <TD><INPUT TYPE="text" NAME="<%$field_prefix%>email" SIZE=54></TD> </TR> - - <TR> - <TH ALIGN="right" VALIGN="center"><% mt('Home Phone') |h %></TH> - <TD><INPUT TYPE="text" NAME="<%$field_prefix%>homephone" SIZE=54></TD> - </TR> - - <TR> - <TH ALIGN="right" VALIGN="center"><% mt('Work Phone') |h %></TH> - <TD><INPUT TYPE="text" NAME="<%$field_prefix%>workphone" SIZE=54></TD> - </TR> - +% foreach my $phone_type ( FS::phone_type->get_phone_types() ) { <TR> - <TH ALIGN="right" VALIGN="center"><% mt('Mobile Phone') |h %></TH> - <TD><INPUT TYPE="text" NAME="<%$field_prefix%>mobilephone" SIZE=54></TD> + <TH ALIGN="right" VALIGN="center"><% $phone_type->typename. ' Phone' |h %></TH> + <TD><INPUT TYPE="text" NAME="<% $field_prefix %>phonetypenum<% $phone_type->phonetypenum %>" SIZE=54></TD> </TR> +% } <%init> diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index da2f1a4e9..3dd92af2e 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -165,6 +165,7 @@ <FONT CLASS="fsinnerbox-title"><% emt('Location search options') %></FONT> <TABLE CLASS="fsinnerbox"> <& elements/options_cust_location.html &> + <& elements/cust_main_phones.html &> </TABLE> <BR> diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html index 9252b2197..0fdcc5371 100644 --- a/httemplate/view/cust_main/contacts_new.html +++ b/httemplate/view/cust_main/contacts_new.html @@ -13,7 +13,7 @@ <%$th%>Send messages</TH> <%$th%>Self-service</TH> % foreach my $phone_type (@phone_type) { - <%$th%><% $phone_type->typename |h %></TH> + <%$th%><% $phone_type->typename |h %> phone</TH> % } <%$th%>Comment</TH> </TR> @@ -80,7 +80,7 @@ %} <%once> -my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'}); +my @phone_type = FS::phone_type->get_phone_types(); </%once> <%init> diff --git a/httemplate/view/svc_export/run_script.cgi b/httemplate/view/svc_export/run_script.cgi index ba58bbdd7..f0524991b 100644 --- a/httemplate/view/svc_export/run_script.cgi +++ b/httemplate/view/svc_export/run_script.cgi @@ -14,17 +14,13 @@ my %param = (); } } -my $exportnum; -my $method; -for (grep /^*_script$/, keys %param) { - $exportnum = $param{$param{$_}.'_exportnum'}; - $method = $param{$param{$_}.'_script'}; -} +my $run_script = $param{'key'}; +my $exportnum = $param{$run_script.'_exportnum'}; my $part_export = qsearchs('part_export', { 'exportnum'=> $exportnum, } ) or die "unknown exportnum $exportnum"; -my $class = 'FS::part_export::'.$part_export->{Hash}->{exporttype}.'::'.$method; +my $class = 'FS::part_export::'.$part_export->{Hash}->{exporttype}.'::'.$run_script; my $server = new FS::UI::Web::JSRPC $class, $cgi; |