summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/select-table.html13
-rw-r--r--httemplate/elements/select-taxproduct.html5
-rw-r--r--httemplate/elements/standardize_locations.js18
-rw-r--r--httemplate/elements/tr-select-tax_status.html24
-rw-r--r--httemplate/elements/tr-select-taxoverride.html4
-rw-r--r--httemplate/elements/tr-td-label.html3
6 files changed, 49 insertions, 18 deletions
diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html
index e73638801..0b04fee6e 100644
--- a/httemplate/elements/select-table.html
+++ b/httemplate/elements/select-table.html
@@ -89,10 +89,12 @@ Example:
<OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
% }
-% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col()
-% || $a->$key() <=> $b->$key()
-% }
-% @records
+% foreach my $record (
+% # we have the order_by parameter for this
+% #sort { $a->$name_col() cmp $b->$name_col()
+% # || $a->$key() <=> $b->$key()
+% # }
+% @records
% )
% {
% my $recvalue = $record->$key();
@@ -174,7 +176,8 @@ if ( $opt{'agent_virt'} ) {
my @records = ();
if ( $opt{'records'} ) {
- @records = @{ $opt{'records'} };
+ @records = sort { $a->get($name_col) cmp $b->get($name_col) }
+ @{ $opt{'records'} };
} else {
@records = qsearch( {
'table' => $opt{'table'},
diff --git a/httemplate/elements/select-taxproduct.html b/httemplate/elements/select-taxproduct.html
index 0f6ef5583..07e554927 100644
--- a/httemplate/elements/select-taxproduct.html
+++ b/httemplate/elements/select-taxproduct.html
@@ -23,6 +23,9 @@ unless ( $description || ! $value ) {
if $part_pkg_taxproduct;
}
-my $onclick = $opt{onclick} || "overlib( OLiframeContent('${p}/browse/part_pkg_taxproduct.cgi?_type=select&id=${name}&taxproductnum='+document.getElementById('${name}').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;";
+my $conf = FS::Conf->new;
+my $vendor = lc($conf->config('enable_taxproducts'));
+my $onclick = $opt{onclick} ||
+ "overlib( OLiframeContent('${p}/browse/part_pkg_taxproduct/$vendor.html?_type=select&id=${name}&taxproductnum='+document.getElementById('${name}').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;";
</%init>
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index 2d1fc7423..817a2e357 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -179,7 +179,7 @@ function confirm_manual_address() {
function post_standardization() {
-% if ( $conf->exists('enable_taxproducts') ) {
+% if ( $need_tax_location ) {
var cf = document.<% $formname %>;
@@ -204,9 +204,8 @@ function post_standardization() {
var state_el = cf.elements[prefix + 'state'];
var state = state_el.options[ state_el.selectedIndex ].value;
- var url = "<% $p %>/misc/choose_tax_location.html" +
- "?data_vendor=cch-zip" +
- ";city=" + cf.elements[prefix + 'city'].value +
+ var url = "<% $p %>/misc/choose_tax_location.html?" +
+ "city=" + cf.elements[prefix + 'city'].value +
";state=" + state +
";zip=" + cf.elements[prefix + 'zip'].value +
";country=" + country +
@@ -252,11 +251,9 @@ function update_geocode() {
prefix = 'bill_';
}
- //alert(what.options[what.selectedIndex].value);
- var argsHash = eval('(' + what.options[what.selectedIndex].value + ')');
- cf.elements[prefix + 'city'].value = argsHash['city'];
- setselect(cf.elements[prefix + 'state'], argsHash['state']);
- cf.elements[prefix + 'zip'].value = argsHash['zip'];
+%# this used to set the city/state/zip to the selected value; I think
+%# that's wrong.
+ var argsHash = JSON.parse(what.value);
cf.elements[prefix + 'geocode'].value = argsHash['geocode'];
<% $post_geocode %>;
@@ -343,4 +340,7 @@ if ( $census_functions ) {
$post_geocode = 'confirm_censustract()';
}
+my $tax_engine = FS::TaxEngine->new;
+my $need_tax_location = $tax_engine->info->{manual_tax_location} ? 1 : 0;
+
</%init>
diff --git a/httemplate/elements/tr-select-tax_status.html b/httemplate/elements/tr-select-tax_status.html
new file mode 100644
index 000000000..9c2de154f
--- /dev/null
+++ b/httemplate/elements/tr-select-tax_status.html
@@ -0,0 +1,24 @@
+% if ( !$vendor ) {
+
+ <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'taxstatusnum' %>" VALUE="">
+
+% } else {
+
+ <& tr-select-table.html,
+ label => 'Customer tax status',
+ table => 'tax_status',
+ name_col => 'description',
+ hashref => { data_vendor => $vendor },
+ order_by => 'order by taxstatus',
+ %opt
+ &>
+
+% }
+
+<%shared>
+my $conf = FS::Conf->new;
+my $vendor = $conf->config('enable_taxproducts');
+</%shared>
+<%init>
+my %opt = @_;
+</%init>
diff --git a/httemplate/elements/tr-select-taxoverride.html b/httemplate/elements/tr-select-taxoverride.html
index e20d37efd..ee3ee4120 100644
--- a/httemplate/elements/tr-select-taxoverride.html
+++ b/httemplate/elements/tr-select-taxoverride.html
@@ -1,4 +1,4 @@
-% if ( $conf->exists('enable_taxproducts') ) {
+% if ( FS::TaxEngine->new->info->{override} ) {
<%include('tr-td-label.html', @_) %>
<TD <% $cell_style %>><% include('select-taxoverride.html', @_) %></TD>
</TR>
@@ -9,8 +9,6 @@
<%init>
-my $conf = new FS::Conf;
-
my %opt = @_;
my $cell_style = $opt{'cell_style'}? 'STYLE="'. $opt{cell_style}. '"' : '';
my $name = $opt{element_name} || $opt{field} || 'tax_override';
diff --git a/httemplate/elements/tr-td-label.html b/httemplate/elements/tr-td-label.html
index 8125541c7..c318722dc 100644
--- a/httemplate/elements/tr-td-label.html
+++ b/httemplate/elements/tr-td-label.html
@@ -15,5 +15,8 @@ $style .= '; '. $opt{'cell_style'}
if $opt{'cell_style'};
my $required = $opt{'required'} ? '<font color="#ff0000">*</font>&nbsp;' : '';
+if ($required) {
+ $style .= ';font-weight: bold';
+}
</%init>