[freeside-commits] branch 13763 updated. ee3fd4e95bdc52f15b0603a32363778f72d164ef

Mark Wells mark at 420.am
Sat Oct 27 14:24:15 PDT 2012


The branch, 13763 has been updated
       via  ee3fd4e95bdc52f15b0603a32363778f72d164ef (commit)
       via  236e788e21048c35ec95aaadcf1ab06875a3c658 (commit)
      from  33beebf4cb42eba3e1dd868ad5e0af102de961da (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ee3fd4e95bdc52f15b0603a32363778f72d164ef
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Oct 11 13:35:26 2012 -0700

    finish merge cleanup

diff --git a/FS/FS/cust_main/Location.pm b/FS/FS/cust_main/Location.pm
index 8e30bb6..ba3513b 100644
--- a/FS/FS/cust_main/Location.pm
+++ b/FS/FS/cust_main/Location.pm
@@ -18,7 +18,8 @@ BEGIN {
     no strict 'refs';
     @location_fields = 
       qw( address1 address2 city county state zip country district
-        latitude longitude coord_auto censustract censusyear geocode );
+        latitude longitude coord_auto censustract censusyear geocode
+        addr_clean );
 
     foreach my $f (@location_fields) {
       *{"FS::cust_main::Location::$f"} = sub {
diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js
index b64f6bd..3a8da23 100644
--- a/httemplate/edit/cust_main/bottomfixup.js
+++ b/httemplate/edit/cust_main/bottomfixup.js
@@ -5,7 +5,12 @@ my $conf = new FS::Conf;
 my $company_latitude  = $conf->config('company_latitude');
 my $company_longitude = $conf->config('company_longitude');
 
-my @fixups = ('copy_payby_fields', 'standardize_locations');
+my @fixups = (
+    'copy_if_same',
+    'copy_payby_fields',
+    'standardize_locations',
+    'confirm_censustract'
+    );
 
 push @fixups, 'confirm_censustract';
 
@@ -46,6 +51,29 @@ function do_submit() {
   document.CustomerForm.submit();
 }
 
+%# if "same as billing" is checked, ensure that the invisible ship location
+%# fields are set to the values of the visible fields.
+function copy_if_same() {
+  var cf = document.CustomerForm;
+  if ( cf.same.checked ) {
+    var inputs = new Array(
+        'address1', 'address2', 'location_type', 'location_number', 'zip',
+        'latitude', 'longitude', 'coord_auto', 'geocode',
+        // these are selects, not inputs, but per the spec this still works
+        'city', 'county', 'state', 'country'
+    );
+    for ( var i = 0; i < inputs.length; i++ ) {
+      if ( cf['bill_' + inputs[i]] != undefined ) {
+        // because some of these fields don't always exist
+        cf['ship_' + inputs[i]].value = cf['bill_' + inputs[i]].value;
+      }
+    }
+    cf['ship_addr_clean'].checked = cf['bill_addr_clean'].checked;
+  }
+  // this can't really fail
+  submit_continue();
+}
+
 function copy_payby_fields() {
   var layervars = new Array(
     'payauto', 'billday',
diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html
index 4df218b..b91f964 100644
--- a/httemplate/elements/location.html
+++ b/httemplate/elements/location.html
@@ -139,7 +139,7 @@ Example:
         >
 
 %    #XXX i don't work so well when the dropdown is changed :/  i probably need to be triggered by "default service address"
-%    $alt_err =~ s/(ship_)?address2/'<B>'.encode_entities($object->get($1.'address2')).'<\/B>'/e;
+%    $alt_err =~ s/(.*)?address2/'<B>'.encode_entities($object->get($1.'address2')).'<\/B>'/e;
      <% $alt_err %>
 
     </TD>
@@ -243,7 +243,6 @@ Example:
 <INPUT TYPE="hidden" NAME="old_<%$pre.$_%>" ID="old_<%$pre.$_%>" VALUE="<% $object->get($_) |h%>">
 % }
 %# Placeholders
-<INPUT TYPE="hidden" NAME="<%$pre%>cachenum" VALUE="">
 <INPUT TYPE="hidden" NAME="<%$pre%>addr_clean" VALUE="">
 <%init>
 
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index f6564a5..f24eebb 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -17,7 +17,7 @@ function form_address_info() {
     'country':  cf.elements['<% $main_prefix %>country'].value,
 % }
 % if ( $withcensus ) {
-    'ship_censustract': cf.elements['enter_censustract'].value,
+    'ship_censustract': cf.elements['<% $ship_prefix %>enter_censustract'].value,
 % }
     'ship_address1': cf.elements['<% $ship_prefix %>address1'].value,
     'ship_address2': cf.elements['<% $ship_prefix %>address2'].value,
@@ -86,9 +86,9 @@ function standardize_locations() {
     address_standardize(JSON.stringify(address_info), confirm_standardize);
   }
   else {
-    cf.elements['ship_addr_clean'].value = 'Y';
+    cf.elements['<% $ship_prefix %>addr_clean'].value = 'Y';
 %   if ( !$onlyship ) {
-    cf.elements['addr_clean'].value = 'Y';
+    cf.elements['<% $main_prefix %>addr_clean'].value = 'Y';
 %   }
     post_standardization();
   }
@@ -193,8 +193,8 @@ function confirm_manual_address() {
 %# not much to do in this case, just confirm the censustract
 % if ( $withcensus ) {
   var cf = document.<% $formname %>;
-  cf.elements['<% $main_prefix %>censustract'].value =
-  cf.elements['<% $main_prefix %>enter_censustract'].value;
+  cf.elements['<% $ship_prefix %>censustract'].value =
+  cf.elements['<% $ship_prefix %>enter_censustract'].value;
 % }
   post_standardization();
 }
@@ -292,6 +292,7 @@ my $withcensus = 1;
 
 my $formname =  $opt{form} || 'CustomerForm';
 my $onlyship =  $opt{onlyship} || '';
+# this whole "onlyship" thing is kind of backward...
 my $main_prefix =  $opt{main_prefix} || '';
 my $ship_prefix =  $opt{ship_prefix} || ($onlyship ? '' : 'ship_');
 my $taxpre = $main_prefix;

commit 236e788e21048c35ec95aaadcf1ab06875a3c658
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Oct 11 10:57:27 2012 -0700

    merge cleanup

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 2c9af0a..85f68e2 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1010,7 +1010,6 @@ sub tables_hashref {
         'latitude', 'decimal', 'NULL', '10,7', '', '', 
         'longitude','decimal', 'NULL', '10,7', '', '', 
         'coord_auto',  'char', 'NULL',  1, '', '',
-        'addr_clean',  'char', 'NULL',  1, '', '',
         'daytime',  'varchar', 'NULL', 20, '', '', 
         'night',    'varchar', 'NULL', 20, '', '', 
         'fax',      'varchar', 'NULL', 12, '', '', 
@@ -1029,7 +1028,6 @@ sub tables_hashref {
         'ship_latitude', 'decimal', 'NULL', '10,7', '', '', 
         'ship_longitude','decimal', 'NULL', '10,7', '', '', 
         'ship_coord_auto',  'char', 'NULL',  1, '', '',
-        'ship_addr_clean',  'char', 'NULL',  1, '', '',
         'ship_daytime',  'varchar', 'NULL', 20, '', '', 
         'ship_night',    'varchar', 'NULL', 20, '', '', 
         'ship_fax',      'varchar', 'NULL', 12, '', '', 
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 321349e..9e39b30 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1792,20 +1792,6 @@ sub check {
     || $self->ut_snumbern('spouse_birthdate')
     || $self->ut_snumbern('anniversary_date')
     || $self->ut_textn('company')
-<<<<<<< HEAD
-=======
-    || $self->ut_text('address1')
-    || $self->ut_textn('address2')
-    || $self->ut_text('city')
-    || $self->ut_textn('county')
-    || $self->ut_textn('state')
-    || $self->ut_country('country')
-    || $self->ut_coordn('latitude')
-    || $self->ut_coordn('longitude')
-    || $self->ut_enum('coord_auto', [ '', 'Y' ])
-    || $self->ut_enum('addr_clean', [ '', 'Y' ])
-    || $self->ut_numbern('censusyear')
->>>>>>> 13763
     || $self->ut_anything('comments')
     || $self->ut_numbern('referral_custnum')
     || $self->ut_textn('stateid')
@@ -1876,72 +1862,7 @@ sub check {
   
   }
 
-<<<<<<< HEAD
   #ship_ fields are gone
-=======
-  if ( $self->has_ship_address
-       && scalar ( grep { $self->getfield($_) ne $self->getfield("ship_$_") }
-                        $self->addr_fields )
-     )
-  {
-    my $error =
-      $self->ut_name('ship_last')
-      || $self->ut_name('ship_first')
-      || $self->ut_textn('ship_company')
-      || $self->ut_text('ship_address1')
-      || $self->ut_textn('ship_address2')
-      || $self->ut_text('ship_city')
-      || $self->ut_textn('ship_county')
-      || $self->ut_textn('ship_state')
-      || $self->ut_country('ship_country')
-      || $self->ut_coordn('ship_latitude')
-      || $self->ut_coordn('ship_longitude')
-      || $self->ut_enum('ship_coord_auto', [ '', 'Y' ] )
-    ;
-    return $error if $error;
-
-    #false laziness with above
-    unless ( qsearchs('cust_main_county', {
-      'country' => $self->ship_country,
-      'state'   => '',
-     } ) ) {
-      return "Unknown ship_state/ship_county/ship_country: ".
-        $self->ship_state. "/". $self->ship_county. "/". $self->ship_country
-        unless qsearch('cust_main_county',{
-          'state'   => $self->ship_state,
-          'county'  => $self->ship_county,
-          'country' => $self->ship_country,
-        } );
-    }
-    #eofalse
-
-    $error =
-         $self->ut_phonen('ship_daytime', $self->ship_country)
-      || $self->ut_phonen('ship_night',   $self->ship_country)
-      || $self->ut_phonen('ship_fax',     $self->ship_country)
-      || $self->ut_phonen('ship_mobile',  $self->ship_country)
-    ;
-    return $error if $error;
-
-    unless ( $ignore_illegal_zip ) {
-      $error = $self->ut_zip('ship_zip', $self->ship_country);
-      return $error if $error;
-    }
-    return "Unit # is required."
-      if $self->ship_address2 =~ /^\s*$/
-      && $conf->exists('cust_main-require_address2');
-
-  } else { # ship_ info eq billing info, so don't store dup info in database
-
-    $self->setfield("ship_$_", '')
-      foreach $self->addr_fields;
-
-    return "Unit # is required."
-      if $self->address2 =~ /^\s*$/
-      && $conf->exists('cust_main-require_address2');
-
-  }
->>>>>>> 13763
 
   #$self->payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP|PREPAY|CASH|WEST|MCRD)$/
   #  or return "Illegal payby: ". $self->payby;
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index f744884..8c4eb83 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -315,9 +315,6 @@ if ( $cgi->param('error') ) {
   $stateid = '';
   $payinfo = '';
 
-  $cust_main->coord_auto('Y');
-  $cust_main->ship_coord_auto('Y');
-
   if ( $cgi->param('qualnum') =~ /^(\d+)$/ ) {
     my $qualnum = $1;
     my $qual = qsearchs('qual', { 'qualnum' => $qualnum } )
@@ -357,12 +354,18 @@ if ( $cgi->param('error') ) {
     my $statedefault = $conf->config('statedefault') || 'CA';
     $cust_main->set('bill_location', 
       FS::cust_location->new(
-        { country => $countrydefault, state => $statedefault }
+        { country => $countrydefault,
+          state => $statedefault,
+          coord_auto => 'Y'
+        }
       )
     );
     $cust_main->set('ship_location',
       FS::cust_location->new(
-        { country => $countrydefault, state => $statedefault }
+        { country => $countrydefault,
+          state => $statedefault,
+          coord_auto => 'Y'
+        }
       )
     );
   }

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Schema.pm                              |    2 -
 FS/FS/cust_main.pm                           |   79 --------------------------
 FS/FS/cust_main/Location.pm                  |    3 +-
 httemplate/edit/cust_main.cgi                |   13 +++--
 httemplate/edit/cust_main/bottomfixup.js     |   30 +++++++++-
 httemplate/elements/location.html            |    3 +-
 httemplate/elements/standardize_locations.js |   11 ++--
 7 files changed, 46 insertions(+), 95 deletions(-)




More information about the freeside-commits mailing list