[freeside-commits] freeside/httemplate/misc choose_tax_location.html, NONE, 1.1 change_pkg.cgi, 1.11, 1.12 order_pkg.html, 1.16, 1.17 xmlhttp-cust_main-address_standardize.html, 1.5, 1.6
Jeff Finucane,420,,
jeff at wavetail.420.am
Mon Oct 11 12:00:35 PDT 2010
Update of /home/cvs/cvsroot/freeside/httemplate/misc
In directory wavetail.420.am:/tmp/cvs-serv21347/httemplate/misc
Modified Files:
change_pkg.cgi order_pkg.html
xmlhttp-cust_main-address_standardize.html
Added Files:
choose_tax_location.html
Log Message:
external taxes support package locations RT10093
Index: change_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/change_pkg.cgi,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -d -r1.11 -r1.12
--- change_pkg.cgi 28 Mar 2009 22:59:36 -0000 1.11
+++ change_pkg.cgi 11 Oct 2010 19:00:33 -0000 1.12
@@ -2,7 +2,7 @@
<% include('/elements/error.html') %>
-<FORM ACTION="<% $p %>edit/process/change-cust_pkg.html" METHOD=POST>
+<FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/change-cust_pkg.html" METHOD=POST>
<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
<% ntable('#cccccc') %>
@@ -31,8 +31,16 @@
</TABLE>
+<% include( '/elements/standardize_locations.html',
+ 'form' => "OrderPkgForm",
+ 'onlyship' => 1,
+ 'no_company' => 1,
+ 'callback' => 'document.OrderPkgForm.submit();',
+ )
+%>
+
<BR>
-<INPUT TYPE="submit" VALUE="Change package">
+<INPUT NAME="submitButton" TYPE="button" VALUE="Change package" onClick="this.disabled=true; standardize_locations();">
</FORM>
</BODY>
Index: xmlhttp-cust_main-address_standardize.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/xmlhttp-cust_main-address_standardize.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- xmlhttp-cust_main-address_standardize.html 22 Mar 2009 02:47:36 -0000 1.5
+++ xmlhttp-cust_main-address_standardize.html 11 Oct 2010 19:00:33 -0000 1.6
@@ -28,6 +28,7 @@
} );
foreach my $pre ( '', 'ship_' ) {
+ next unless ($pre || !$arg{onlyship});
my($zip5, $zip4) = split('-',$arg{$pre.'zip'});
--- NEW FILE: choose_tax_location.html ---
<FORM NAME="choosegeocodeform">
<CENTER><BR><B>Choose tax location</B><BR><BR>
<P>the geocode is:<% $header %></P>
<P STYLE="<% $style %>"><% $header %></P>
<SELECT NAME='geocodes' ID='geocodes' STYLE="<% $style %>">
% foreach my $location (@cust_tax_location) {
% my %value = ( zip => $zip5,
% map { $_ => $location->$_ }
% qw ( city state geocode )
% );
% map { $value{$_} = $location{$_} } qw ( city state )
% if $location{country} eq 'CA';
%
% my $value = encode_entities(objToJson({ %value })
% );
% my $content = '';
% $content .= $location->$_. ' ' x ( $max{$_} - length($location->$_) )
% foreach qw( city county state );
% $content .= $location->cityflag eq 'I' ? 'Y' : 'N' ;
% my $selected = '' ;
% if ($geocode && $location->geocode eq $geocode) {
% $selected = 'SELECTED';
% }
<OPTION VALUE="<% $value %>" STYLE="<% $style %>" <% $selected %>><% $content %>
% }
</SELECT><BR><BR>
<TABLE><TR>
<TD> <BUTTON TYPE="button" onClick="set_geocode(document.getElementById('geocodes'));"><IMG SRC="<%$p%>images/tick.png" ALT=""> Set location </BUTTON></TD>
<TD><BUTTON TYPE="button" onClick="document.<% $formname %>.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission </BUTTON></TD>
</TR>
</TABLE>
</CENTER>
</FORM>
<%init>
my $conf = new FS::Conf;
my %location = ();
($location{data_vendor}) = $cgi->param('data_vendor') =~ /^([-\w]+)$/;
($location{city}) = $cgi->param('city') =~ /^([\w ]+)$/;
($location{state}) = $cgi->param('state') =~ /^(\w+)$/;
($location{zip}) = $cgi->param('zip') =~ /^([-\w ]+)$/;
($location{country}) = $cgi->param('country') =~ /^([\w ]+)$/;
my($geocode) = $cgi->param('geocode') =~ /^([\w]+)$/;
my($formname) = $cgi->param('formname') =~ /^([\w]*)$/;
$formname ||= 'CustomerForm';
my($zip5, $zip4) = split('-', $location{zip});
#only support US & CA
my $hashref = { 'data_vendor' => $location{data_vendor} };
$hashref->{zip} = $location{country} eq 'CA' ? substr($zip5,0,1) : $zip5,
my @keys = keys(%$hashref);
my @cust_tax_location = ();
until ( @cust_tax_location ) {
@cust_tax_location = qsearch({ table => 'cust_tax_location',
hashref => $hashref,
order_by => 'LIMIT 50',
});
last unless scalar(@keys);
delete $hashref->{ shift @keys };
}
my %max = ( city => 4, county => 6, state => 5);
foreach my $location (@cust_tax_location) {
foreach ( qw( city county state ) ) {
my $length = length($location->$_);
$max{$_} = ($length > $max{$_}) ? $length : $max{$_};
}
}
foreach ( qw( city county state ) ) {
$max{$_} = $location{$_} if $location{$_} > $max{$_};
$max{$_}++;
}
my $header = ' ';
$header .= $_. ' ' x ( $max{lc($_)} - length($_) )
foreach qw( City County State );
$header .= "In city?";
my $style = "font-family:monospace;";
</%init>
Index: order_pkg.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/order_pkg.html,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -w -d -r1.16 -r1.17
--- order_pkg.html 19 Aug 2010 20:21:04 -0000 1.16
+++ order_pkg.html 11 Oct 2010 19:00:33 -0000 1.17
@@ -9,14 +9,14 @@
function enable_order_pkg () {
if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) {
- document.OrderPkgForm.submit.disabled = false;
+ document.OrderPkgForm.submitButton.disabled = false;
if ( document.OrderPkgForm.pkgpart.options[document.OrderPkgForm.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) {
document.OrderPkgForm.discountnum.disabled = false;
} else {
document.OrderPkgForm.discountnum.disabled = true;
}
} else {
- document.OrderPkgForm.submit.disabled = true;
+ document.OrderPkgForm.submitButton.disabled = true;
document.OrderPkgForm.discountnum.disabled = true;
}
}
@@ -101,8 +101,16 @@
</TABLE>
+<% include( '/elements/standardize_locations.html',
+ 'form' => "OrderPkgForm",
+ 'onlyship' => 1,
+ 'no_company' => 1,
+ 'callback' => 'document.OrderPkgForm.submit();',
+ )
+%>
+
<BR>
-<INPUT NAME="submit" TYPE="submit" VALUE="Order Package" <% $pkgpart ? '' : 'DISABLED' %>>
+<INPUT NAME="submitButton" TYPE="button" VALUE="Order Package" onClick = "this.disabled=true; standardize_locations();" <% $pkgpart ? '' : 'DISABLED' %>>
</FORM>
</BODY>
More information about the freeside-commits
mailing list