The latest commits have broken geo_field cck fields; data is not loaded into the node edit form correctly, and when new data is entered NULL is saved in its place.

** Data isn't loaded into the node edit form correctly because the geo_field_WIDGET_process() functions are looking for lat, lon, and wkt values in the $element array; these values are no longer present (maybe because they have to be specifically requested by declaring 'gis type' and 'gis input'?)

** Data isn't saved correctly because the wrong variable is checked for emptiness during save:

diff -r 8ba88d1640d6 modules/geo_field/geo_field.module
--- a/modules/geo_field/geo_field.module	Thu Jun 11 12:31:52 2009 -0500
+++ b/modules/geo_field/geo_field.module	Fri Jun 12 09:15:58 2009 -0500
@@ -183,7 +183,7 @@
 
         // Convert the wkt to binary data before the insert. This allows the
         // input to pass through the binary query substitutions.
-        if(!geo_content_is_empty($item, $field)) {
+        if(!geo_content_is_empty($items[$k], $field)) {
           $items[$k]['geo'] = db_result(db_query("SELECT GeomFromText('%s', 4326)", $items[$k]['wkt']));
         }
       }

Comments

swill’s picture

subscribing so it shows in my issues...

quickcel’s picture

I'm having the same problem - every time I try to enter in data for the lat/long fields nothing gets stored in the database

swill’s picture

This fix no longer seems to work...

becw’s picture

That specific bit of code has been fixed; however the issue itself still exists.

swill’s picture

The info is now storing again (with the newest dev version of Geo).

ebranda’s picture

I'm still having the same problem (reported by quickcel) with the latest dev version (June 26, 2009 - 12:17). Also, I'm using MySQL, and querying the value in the GEOMETRY column that is created by the Geo Field module returns NULL.

gagarine’s picture

Same problem.

allie micka’s picture

Status: Active » Fixed

I'm fairly certain this is all working now. If not, please provide some specifics on how you've created the field and how it's behaving. Thanks!

gagarine’s picture

Ok, if i use long/lat widget include in geo that's seem to work. But with geocode nothing is stored. Certainly it's only a geocode bug so I don't reopen this issue...

The bug in geocode project #486010: PHP error in geocode_widget.module.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

EDDYL’s picture

Status: Closed (fixed) » Active

Re-opening the issue.
on the 14th august 2010 there is still a problem when saving data (NULL is stored in DB).

EDDYL’s picture

Version: » 6.x-1.0-alpha5

I have the same problem with alpha5 version.
I tried to install dev version but cannot do anything : Fatal error call to undefined function geo_load()...

adamus_maximus’s picture

more info, may be helpful to those trying to replicate bug:

I experience this problem intermittantly on my site, and I think I've found what conditions cause the bug.

On my site, I have a node type that contains an address field, a geo field that gets calculated from that address field, and a bunch of other fields. When a user registers on our site, they are required to fill in certain fields of this content type. If they fill out the fields correctly, all works fine, and the geo is populated. If validation fails (because they didn't fill in a required field, or entered an invalid value somewhere) then drupal informs the user, the user fixes the problem, and is able to submit. But in this case, the geofield contains "NULL".

hope it helps.

adamus_maximus’s picture

Issue tags: +geocode, +null, +registration, +#after_build

Fixed! (sort of)

My issue is probably not the same issue as the original poster was experiencing.

My previous comment about it being about the validation failing was incorrect.
To repeat this bug:
- install and enable the content profile user registration module
- add an address field to a content profile node. (or any other compatable field should probably work too)
- add a geo field, geocoded value from another field, select that address field. I use the geocode google handler.
- on the "content profile" tab, select "Use on Registration"
- Logout of the site.
- Create a new account.
- the user registration module should present that address field for you to fill in. Fill it in and hit submit (or whatever the button says)

The address field will be populated, but the geo field will still be NULL.
In my opinion, this is a bug in the content profile -> user registation submodule.
Check out my post and patch regarding that:
http://drupal.org/node/826126#comment-3553282

However, that patch may have side effects.
The lowest-impact patch is a minor change to geo:

--- /sites/all/modules/geocode/modules/geocode_widget/geocode_widget.module
+++ /sites/all/modules/geocode/modules/geocode_widget/geocode_widget.module
@@ -52,8 +52,7 @@
  * step.
  */
 function geocode_widget_form_alter(&$form, $form_state, $form_id) {
-  if (  ($form['#id'] == 'node-form')
-      ||($form['#id'] == 'user-register')) {
+  if ($form['#id'] == 'node-form') {
     $form['#after_build'][] = 'geocode_widget_set_form_value';
   }
 }
adamus_maximus’s picture

whoops, I got that patch backwards.
This is what I meant:

--- /sites/all/modules/geocode/modules/geocode_widget/geocode_widget.module
+++ /sites/all/modules/geocode/modules/geocode_widget/geocode_widget.module
@@ -52,7 +52,8 @@
  * step.
  */
 function geocode_widget_form_alter(&$form, $form_state, $form_id) {
-  if ($form['#id'] == 'node-form') {
+  if (  ($form['#id'] == 'node-form')
+      ||($form['#id'] == 'user-register')) {
     $form['#after_build'][] = 'geocode_widget_set_form_value';
   }
 }

avpaderno’s picture

Issue summary: View changes
Status: Active » Closed (outdated)
Issue tags: -geocode, -null, -registration, -#after_build

I am closing this issue, since Drupal 6 releases aren't supported anymore.