This commit was generated by cvs2svn to compensate for changes in r8593,
[freeside.git] / httemplate / elements / tr-select-cust_location.html
index 5b023f1..ab043ee 100644 (file)
@@ -21,7 +21,7 @@ Example:
     var locationnum = what.options[what.selectedIndex].value;
     if ( locationnum == -1 ) {
 
-%     for (@location_fields) { 
+%     for (@location_fields, 'city_select') { 
         what.form.<%$_%>.disabled = false;
         what.form.<%$_%>.style.backgroundColor = '#ffffff';
 %     } 
@@ -42,16 +42,16 @@ Example:
     } else {
 
       if ( locationnum == 0 ) {
-        what.form.address1.value = <% $cust_main->address1 |js_string %>;
-        what.form.address2.value = <% $cust_main->address2 |js_string %>;
-        what.form.city.value = <% $cust_main->city |js_string %>;
-        what.form.zip.value = <% $cust_main->zip |js_string %>;
+        what.form.address1.value = <% $cust_main->get($prefix.'address1') |js_string %>;
+        what.form.address2.value = <% $cust_main->get($prefix.'address2') |js_string %>;
+        what.form.city.value = <% $cust_main->get($prefix.'city') |js_string %>;
+        what.form.zip.value = <% $cust_main->get($prefix.'zip') |js_string %>;
 
-        changeSelect(what.form.country, <% $cust_main->country | js_string %> );
+        changeSelect(what.form.country, <% $cust_main->get($prefix.'country') | js_string %> );
 
         country_changed( what.form.country,
-                         fix_state_factory( <% $cust_main->state | js_string %>,
-                                            <% $cust_main->county | js_string %>
+                         fix_state_factory( <% $cust_main->get($prefix.'state') | js_string %>,
+                                            <% $cust_main->get($prefix.'county') | js_string %>
                                           )
                        );
 
@@ -60,7 +60,7 @@ Example:
       } 
 
 %#sleep/wait until dropdowns are updated?
-%     for (@location_fields) { 
+%     for (@location_fields, 'city_select') { 
         what.form.<%$_%>.disabled = true;
         what.form.<%$_%>.style.backgroundColor = '#dddddd';
 %     } 
@@ -85,6 +85,7 @@ Example:
       } else {
         county_el.selectedIndex = 0;
       }
+      county_changed(county_el);
     }
     return fix_county;
   }
@@ -158,6 +159,8 @@ my %opt = @_;
 my $cgi       = $opt{'cgi'};
 my $cust_main = $opt{'cust_main'};
 
+my $prefix = length($cust_main->ship_last) ? 'ship_' : '';
+
 $cgi->param('locationnum') =~ /^(\-?\d*)$/ or die "illegal locationnum";
 my $locationnum = $1;
 my $cust_location;
@@ -169,7 +172,7 @@ if ( $locationnum && $locationnum != -1 ) {
   if ( $locationnum == -1 ) {
     $cust_location->$_( $cgi->param($_) ) foreach @location_fields;
   } else {
-    $cust_location->$_( $cust_main->$_() ) foreach @location_fields;
+    $cust_location->$_( $cust_main->get($prefix.$_) ) foreach @location_fields;
   }
 }