Active
Project:
Get Locations
Version:
7.x-1.17
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Nov 2015 at 17:39 UTC
Updated:
12 Feb 2018 at 21:18 UTC
Jump to comment: Most recent
Comments
Comment #2
webservant316 commentedactually this bug occurs on both the original and the new content type. namely creating a node with the getlocation field empty and then edit later to add an address causes the error.
Help!
Comment #3
webservant316 commentedalso...
1. the location entry seems ok inspite of the error.
2. the error goes away after a second edit.
so the error is easily reproduce in my config by add a content with a blank location field. then edit the content populating the location and you will get the error. edit a second time and the error goes away.
Comment #4
webservant316 commentedmy guess on the error after looking at the code... seems like getlocations is expecting a valid location id on the edit of the node in this case, but since the getlocation field for my content type is not required, editing the node should allow for either a new getlocation or again no getlocation.
Comment #5
hutch commentedNotifications are not errors, they can be switched off anytime by going to admin/config/development/logging
Comment #6
hutch commentedIf it is not required it will skip it on insert. If the lat/lon are set it will attempt a save.
I cannot replicate what you are seeing at all, but I'm testing on dev.
Comment #7
webservant316 commentedLet me know how I can help. Sorry for the mis-label. Yes I plan to turn notifications off as soon as I go production. It did seem like a variable in the code was not assigned as expected.
If you want a variable dump at that point in the code let me know what you want and I'll post back.
Comment #8
hutch commentedAs I said earlier, I cannot replicate this with current dev or with 7.x-1.17, I have tried on two different sites, I have tried setting the lat/lon but nothing else, still no notification. Getlocations_fields works as intended.
Comment #9
webservant316 commentedhere is the block of code that causes the notification
So why is this condition even true in my use case? Is it related to my feeds install? Do you have feeds enabled? And why does line 2168 complain?
ALSO in my configuration I am using Display Suites to display the location field information on one part of the page without the map and then using the map field to display the map on another part of the page. Maybe that is a factor.
Comment #10
hutch commented$locations[$key]['glid']is not set for some reason, this may be due to the Feeds module, if you are not actively importing data using Feeds you should disable it, no need to uninstall. The Feeds module works well but can be picky about setup, especially field mapping.If you want to find out what is causing the notice try looking in
$loc, the dd() or dpm() function should help.Comment #11
webservant316 commentedI disabled feeds and still have the same problem. Seems like the conditional logic is looking for a particular case that only applies to feeds, but we should be in there. The call to getlocations_fields_load_locations($criteria['nid'], 'nid') does not appear to be successful for some reason. My guess is that since we just populating the getlocation field it is not available through this function yet.
Here is $locations, $criterion, and $loc at line 2168 of getlocations_fields.module when editing an existing node that had an empty getlocations field, but now attempting to populate. Actually the edit succeeds in populating the field, but not without the error notice. Editing the node with a populated getlocations field produces no error.
$locations
(
[0] => Array
(
[address] => 138 West....
[name] => 138 W....
[street] => 138 W....
[additional] =>
[city] => B....
[province] => C....
[postal_code] => 16....
[country] => U...
[phone] =>
[mobile] =>
[fax] =>
[latitude] => 4....
[longitude] => -7...
[marker] =>
[sv_enable] => 0
[sv_showfirst] => 0
[mapzoom] => 6
[map_maptype] => Map
[sv_heading] => 0
[sv_zoom] => 1
[sv_pitch] => 0
[active] => 1
[settings] => Array
(
[use_address] => 2
[input_address_width] => 60
[autocomplete_bias] => 1
[restrict_by_country] => 1
[search_country] => US
[use_geolocation_button] => 0
[geocoder_enable] => 0
[use_clear_button] => 1
[input_name_width] => 60
[input_name_required] => 0
[input_name_weight] => 0
[input_street_width] => 60
[input_street_required] => 0
[input_street_weight] => 0
[input_additional_width] => 60
[input_additional_required] => 0
[input_additional_weight] => 0
[input_city_width] => 60
[input_city_required] => 0
[input_city_weight] => 0
[input_province_width] => 60
[input_province_required] => 0
[input_province_weight] => 0
[input_postal_code_width] => 60
[input_postal_code_required] => 0
[input_postal_code_weight] => 0
[input_phone_width] => 60
[input_phone_required] => 0
[input_phone_weight] => 0
[input_mobile_width] => 60
[input_mobile_required] => 4
[input_mobile_weight] => 0
[input_fax_width] => 60
[input_fax_required] => 4
[input_fax_weight] => 0
[input_latitude_width] => 10
[input_latitude_weight] => 0
[input_longitude_width] => 10
[input_longitude_weight] => 0
[input_map_weight] => 0
[input_geobutton_weight] => 0
[input_geolocation_button_weight] => 0
[input_clear_button_weight] => 0
[input_country_width] => 60
[input_country_required] => 4
[input_country_weight] => 0
[city_autocomplete] => 1
[province_autocomplete] => 1
[country] => US
[use_country_dropdown] => 2
[per_item_marker] => 0
[input_marker_weight] => 0
[street_num_pos] => 1
[latlon_warning] => 0
[map_settings_allow] => 0
[streetview_settings_allow] => 0
[input_map_show] => 1
[mapwidth] => 360px
[mapheight] => 200px
[latlong] => 4...
[use_smart_ip_latlon] => 0
[input_map_marker] => green
[zoom] => 6
[controltype] => small
[zoomcontrolposition] => rb
[pancontrol] => 0
[pancontrolposition] =>
[mtc] => none
[mapcontrolposition] =>
[maptype] => Map
[baselayers] => Array
(
[Map] => 1
[Satellite] => 0
[Hybrid] => 0
[Physical] => 0
[OSM] => 0
[OSMBW] => 0
[OSMDE] => 0
[OCM] => 0
[OCMT] => 0
[OCML] => 0
[OCMO] => 0
[Stamen] => 0
[StamenBG] => 0
[StamenHY] => 0
[StamenLI] => 0
[StamenLA] => 0
[StamenLT] => 0
[Watercolor] => 0
[ESRI] => 0
[DeLorme] => 0
[WorldTopoMap] => 0
[WorldImagery] => 0
[WorldTerrain] => 0
[WorldShadedRelief] => 0
[WorldPhysical] => 0
[OceanBasemap] => 0
[NatGeoWorldMap] => 0
[WorldGrayCanvas] => 0
)
[scale] => 0
[scalecontrolposition] =>
[overview] => 0
[overview_opened] => 0
[scrollwheel] => 0
[draggable] => 1
[nokeyboard] => 0
[nodoubleclickzoom] => 0
[map_backgroundcolor] =>
[minzoom_map] => -1
[maxzoom_map] => -1
[map_marker] => green
[node_map_marker] => green
[user_map_marker] => green
[vocabulary_map_marker] => green
[comment_map_marker] => green
[input_smart_ip_button_weight] => 0
[use_smart_ip_button] => 0
[only_continents] =>
[only_countries] =>
[sv_heading] => 0
[sv_zoom] => 1
[sv_pitch] => 0
[sv_enable] => 0
[sv_showfirst] => 0
[show_maplinks] => 0
[fullscreen] => 0
[fullscreen_controlposition] =>
[show_bubble_on_one_marker] => 0
[polygons_enable] => 0
[polygons_strokecolor] => #FF0000
[polygons_strokeopacity] => 0.8
[polygons_strokeweight] => 3
[polygons_fillcolor] => #FF0000
[polygons_fillopacity] => 0.35
[polygons_coords] =>
[polygons_clickable] => 0
[polygons_message] =>
[rectangles_enable] => 0
[rectangles_strokecolor] => #FF0000
[rectangles_strokeopacity] => 0.8
[rectangles_strokeweight] => 3
[rectangles_fillcolor] => #FF0000
[rectangles_fillopacity] => 0.35
[rectangles_coords] =>
[rectangles_clickable] => 0
[rectangles_message] =>
[rectangles_apply] => 0
[rectangles_dist] => 0
[circles_enable] => 0
[circles_strokecolor] => #FF0000
[circles_strokeopacity] => 0.8
[circles_strokeweight] => 3
[circles_fillcolor] => #FF0000
[circles_fillopacity] => 0.35
[circles_coords] =>
[circles_clickable] => 0
[circles_message] =>
[circles_radius] => 0
[circles_apply] => 0
[polylines_enable] => 0
[polylines_strokecolor] => #FF0000
[polylines_strokeopacity] => 0.8
[polylines_strokeweight] => 3
[polylines_coords] =>
[polylines_clickable] => 0
[polylines_message] =>
[search_places] => 0
[search_places_size] => 40
[search_places_position] => outside_above
[search_places_label] => Google Places Search
[search_places_placeholder] =>
[search_places_dd] => 0
[search_places_list] => 0
[kml_group] => Array
(
[kml_url] =>
[kml_url_click] => 1
[kml_url_infowindow] => 0
[kml_url_viewport] => 1
[kml_url_button] => 0
[kml_url_button_label] => Kml Layer
[kml_url_button_state] => 0
)
[jquery_colorpicker_enabled] => 0
[geojson_enable] => 0
[geojson_data] =>
[geojson_options] =>
[svcontrolposition] =>
[sv_addresscontrol] => 1
[sv_addresscontrolposition] =>
[sv_pancontrol] => 1
[sv_pancontrolposition] =>
[sv_zoomcontrol] => default
[sv_zoomcontrolposition] =>
[sv_linkscontrol] => 1
[sv_imagedatecontrol] => 0
[sv_scrollwheel] => 1
[sv_clicktogo] => 1
[highlight_enable] => 1
[highlight_strokecolor] => #FF0000
[highlight_strokeopacity] => 0.8
[highlight_strokeweight] => 3
[highlight_fillcolor] => #FF0000
[highlight_fillopacity] => 0.35
[highlight_radius] => 10
[getdirections_link] => 0
[gps_button] => 0
[gps_button_label] => Show current position
[gps_marker] => green
[gps_marker_title] => Current position
[gps_bubble] => 0
[gps_geocode] => 0
[gps_center] => 0
[show_search_distance] => 0
[views_search_marker_enable] => 0
[views_search_marker] => drupal
[views_search_marker_toggle] => 0
[views_search_marker_toggle_active] => 0
[views_search_radshape_enable] => 0
[views_search_radshape_strokecolor] => #FF0000
[views_search_radshape_strokeopacity] => 0.8
[views_search_radshape_strokeweight] => 3
[views_search_radshape_fillcolor] => #FF0000
[views_search_radshape_fillopacity] => 0.35
[views_search_radshape_toggle] => 0
[views_search_radshape_toggle_active] => 0
[views_search_center] => 0
[gps_type] => 0
[gps_zoom] => -1
[what3words_collect] => 0
)
[data] => Array
(
[data] => Array
(
[phone] =>
[mobile] =>
[fax] =>
[sv_heading] => 0
[sv_zoom] => 1
[sv_pitch] => 0
[mapzoom] => 12
[map_maptype] => Map
[map_settings_allow] => 0
[sv_enable] => 0
[sv_showfirst] => 0
[sv_addresscontrol] => 1
[sv_addresscontrolposition] =>
[sv_pancontrol] => 1
[sv_pancontrolposition] =>
[sv_zoomcontrol] => default
[sv_zoomcontrolposition] =>
[sv_linkscontrol] => 1
[sv_imagedatecontrol] => 0
[sv_scrollwheel] => 1
[sv_clicktogo] => 1
[streetview_settings_allow] => 0
)
)
)
)
$criterion
(
[field_name] => field_location
[vid] => 1541
[nid] => 1541
)
$loc
(
)
Comment #12
hutch commentedOK, next you need to dig into the db,
is there an entry for nid 1541 in the node table? Is the status field greater than 0?
is there an entry for nid 1541 in the getlocations_fields_entities table? Note the glid.
Check the getlocations_fields for the glid found above.
getlocations_fields_load_locations() appears to be returning nothing so you need to find out why, see if you can grab the contents of
$rowscirca line 2449.Comment #13
webservant316 commented1. Created a new node with empty getlocations field. Nid = 1544 observed in database with status = 1. No entry for nid = 1544 in the getlocations_fields_entities_table.
2. Edited the node to populate getlocations field with the following variable values exported at runtime. I noticed while studying the result that getlocations_fields_load_locations() was called twice for the same save edit node committ, the first time with $key=nid and the second with $key=vid.
Circa line 2449 variables processed first ==========================
$key = nid
$id = 1544
$rows =
(
[dbh] => DatabaseConnection_mysql Object
(
[needsCleanup:protected] =>
[target:protected] => default
[key:protected] => default
[logger:protected] =>
[transactionLayers:protected] => Array
(
[drupal_transaction] => drupal_transaction
)
[driverClasses:protected] => Array
(
[SelectQuery] => SelectQuery
[DatabaseSchema] => DatabaseSchema_mysql
[DatabaseTransaction] => DatabaseTransaction
[UpdateQuery] => UpdateQuery
)
[statementClass:protected] => DatabaseStatementBase
[transactionSupport:protected] => 1
[transactionalDDLSupport:protected] =>
[temporaryNameIndex:protected] => 0
[connectionOptions:protected] => Array
(
[database] => admin_drupal_d7
[username] => admin_mysql2
[password] => AwRp-lqsym-awrp-316
[host] => localhost
[port] => 3306
[driver] => mysql
[prefix] => Array
(
[default] =>
)
)
[schema:protected] => DatabaseSchema_mysql Object
(
[connection:protected] => DatabaseConnection_mysql Object
*RECURSION*
[placeholder:protected] => 0
[defaultSchema:protected] => public
[uniqueIdentifier:protected] => 564cdb054af315.58104720
)
[prefixes:protected] => Array
(
[default] =>
)
[prefixSearch:protected] => Array
(
[0] => {
[1] => }
)
[prefixReplace:protected] => Array
(
[0] =>
[1] =>
)
)
[queryString] => SELECT f.glid AS glid, f.name AS name, f.street AS street, f.additional AS additional, f.city AS city, f.province AS province, f.postal_code AS postal_code, f.country AS country, f.address AS address, f.latitude AS latitude, f.longitude AS longitude, f.marker AS marker, f.data AS data, e.nid AS nid, e.vid AS vid, e.uid AS uid, e.tid AS tid, e.cid AS cid, e.field_name AS field_name
FROM
getlocations_fields f
INNER JOIN getlocations_fields_entities e ON f.glid=e.glid
INNER JOIN node n ON n.nid = e.nid
WHERE (e.nid = :db_condition_placeholder_0) AND (n.status > :db_condition_placeholder_1) AND (e.nid = :db_condition_placeholder_2)
)
Circa line 2168 variables processed next ==========================
$criteria =
(
[field_name] => field_location
[vid] => 1544
[nid] => 1544
)
$loc =
(
)
Circa line 2449 variables processed AGAIN on the same edit save click ================
$key = vid
$id = 1544
$rows =
(
[dbh] => DatabaseConnection_mysql Object
(
[needsCleanup:protected] =>
[target:protected] => default
[key:protected] => default
[logger:protected] =>
[transactionLayers:protected] => Array
(
)
[driverClasses:protected] => Array
(
[SelectQuery] => SelectQuery
[DatabaseSchema] => DatabaseSchema_mysql
[MergeQuery] => MergeQuery
[InsertQuery] => InsertQuery_mysql
[UpdateQuery] => UpdateQuery
)
[statementClass:protected] => DatabaseStatementBase
[transactionSupport:protected] => 1
[transactionalDDLSupport:protected] =>
[temporaryNameIndex:protected] => 0
[connectionOptions:protected] => Array
(
[database] => admin_drupal_d7
[username] => admin_mysql2
[password] => AwRp-lqsym-awrp-316
[host] => localhost
[port] => 3306
[driver] => mysql
[prefix] => Array
(
[default] =>
)
)
[schema:protected] => DatabaseSchema_mysql Object
(
[connection:protected] => DatabaseConnection_mysql Object
*RECURSION*
[placeholder:protected] => 0
[defaultSchema:protected] => public
[uniqueIdentifier:protected] => 564cdb05bcd6b3.86417190
)
[prefixes:protected] => Array
(
[default] =>
)
[prefixSearch:protected] => Array
(
[0] => {
[1] => }
)
[prefixReplace:protected] => Array
(
[0] =>
[1] =>
)
)
[queryString] => SELECT f.glid AS glid, f.name AS name, f.street AS street, f.additional AS additional, f.city AS city, f.province AS province, f.postal_code AS postal_code, f.country AS country, f.address AS address, f.latitude AS latitude, f.longitude AS longitude, f.marker AS marker, f.data AS data, e.nid AS nid, e.vid AS vid, e.uid AS uid, e.tid AS tid, e.cid AS cid, e.field_name AS field_name
FROM
getlocations_fields f
INNER JOIN getlocations_fields_entities e ON f.glid=e.glid
INNER JOIN node_revision n ON n.vid = e.vid
INNER JOIN field_config c ON e.field_name = c.field_name
WHERE (e.vid = :db_condition_placeholder_0) AND (n.status > :db_condition_placeholder_1) AND (e.field_name = :db_condition_placeholder_2) AND (e.vid = :db_condition_placeholder_3)
)
3. After the save edit commit an entry for nid = 1544 in the getlocations_fields_entities_table was observed.
Comment #14
hutch commentedI'm no nearer to seeing why you are seeing this notification or why your instance is passing through the code circa line 2168.
Comment #15
webservant316 commentedI think the answer can be found in explaining the purpose of these lines of code circa 2168 and why my use case finds this condition to be true when I am not doing a feeds import, but a node edit.
This condition is true in my use case during the process of editing a node that has an empty getlocations field, but perhaps before the newly populated getlocations field is written to the database.
Brainstorm ideas....
1) maybe my module set is messing with the expectations of this condition and module weights need to be considered.
2) maybe the condition is not complete enough to handle some exotic combination that I apparently have
3) Is the purpose of the getlocations_fields_save_locations() function to write a new or updated location to the database? Then how can you use getlocations_fields_load_locations() within the function to read the location to the database when a new location is not yet in the database?
Comment #16
hutch commentedI can't answer 1) or 2)
The answer to 3) part 1 is that the purpose of function getlocations_fields_save_locations() is indeed to save new or updated location data to the database and part 2, you may notice the comment "// eek", the reaon I put that there was to remind myself of why I added this hacky piece of code, it is there to prevent a fullblown WSOD when someone attempts to import using Feeds when the import settings bear no relation to the actual requirements and then blame Getlocations for the predicament they have put themselves in ;-)
Comment #17
webservant316 commentedhmmm, just gotta figure out why my use case is finding this condition to be true when it should not.
Comment #18
jocimarcan commentedWeservant316, could you please explain what the problem was? I am facing the same issue.
At the begining my field was not being saved, now it is saved but with this notice.
I am using two fields (From and To fields). "From" field is provided by Getlocation and "To" is provided by Location&AddressField modules. It was not possible to use two independent Getlocation fields (different labels) in the same content type - one field modify the value from the other once saved. So I used two different modules, one for each field: The combination Location&AddressField by itself do not offer the proper accuracy needed by "From" field.
As I am using this turn around, I also get the javascript error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors."
Comment #19
hutch commentedIf two instances of Getlocations are sharing the same machine name then the behaviour you are seeing would occur, they are both using the same tables.
The Getlocations documentation makes it clear that running Getlocations and Location module at the same time will not work.
You can have two instances of getlocations in a content type:
Create a new content type named "From and To Addresses"
description "Contains two instances of getlocations"
edit any other options and hit "Save and add fields" button
Add new field:
Label: From Location
Machine name: field_from_location (automatically generated)
Field type: select "getlocations_fields" from the dropdown
Widget: Geocoder
Save, this takes you to the Field settings page,
just accept the defaults for now so hit "Save field settings" and "Save settings"
You should now be back on the Manage fields page, repeat the above for
Label: To Location
Machine name: field_to_location (automatically generated)
Done, go to your menu and add content > "From and To Addresses"
You will see two instances of Getlocations, they will save correctly provided you created them correctly.
Comment #20
webservant316 commentedThis problem is not presently an issue for me. I am using Get Locations 7.x-1.17 and feeds is disabled.
Comment #21
jocimarcan commentedThank you hutch for your reply!
1) At first glance it seems to work, but try to delete the fields using the provided checkbox and filling up the fields again: In this case, the notice appears and the fields are saved with the same value.
Maybe a workaround should be hide the "delete" checkbox from user - it is more user friendly. The regeocoding seems to work, even if the user does not delete the location, just editing it. But I am not sure about the consequences of this action.
Moreover,
2)My use case is a Carpooling. I am trying to edit "getlocations_list_nearby" views, adding a second proximity filter: One proximity filter for "From" field and another for "To" field. A node represents a user trip. The views should return nearby nodes ("From" proximity filter) from users who is going to the same place ("To" proximity filter). Even if I set origin fields correctly, it does not work. Both proximity filters retrieve the same longitude and latitude values, which can be noticed in the SQL view query.
I would appreciate your insights about that.
Comment #22
frosty29 commentedI got the same error warning after every new save of a geolocation.
I have modifed getlocations_fields.module like this to fix:
Lines 2164 on:
Comment #23
lukasss commentedI also get it when I edit a previously created node without an address
Notice: Undefined offset: 0 in function getlocations_fields_save_locations() (line 2155 in file .../getlocations_fields/getlocations_fields.module)