For example I add:
-loc 1
-loc 2
-loc 3
in my node and save.

Then when I edit it I see them in this order:
-loc 3
-loc 2
-loc 1

It seems to me that they are saved wrong in the location_instance table. Any help?

Thanks.

Comments

dakku’s picture

yup, I have the same issue. Any ideas to fix it?

slip’s picture

StatusFileSize
new1.62 KB

[EDIT: my patch didn't quite work after a bit more testing.]

I'm no location expert and I threw this patch together really quickly so no guarantees... but it works for me so far.

With the patch, whenever the location module reads from location_instance it sorts by lid so the lowest lid, or the one you entered in first is shown first. Seems to make sense but just a quick fix.

slip’s picture

Status: Active » Needs work
StatusFileSize
new3.32 KB

OK, here's attempt number two and it needs some review... Again, I'm not a location expert, just a man with a deadline and just sharing my code.

This one modifies the db and adds a column to location_instance called weight, so you'll have to run update in /admin/build/modules. The weight is set on save. I've tested the mysql update code, not the install code.

yesct’s picture

seems related to #346300: Nodes with multiple locations , locations appear to "switch"
but I dont know if it is exactly a duplicate.

yesct’s picture

agileware’s picture

This patch #338745: Multiple locations on a single map fixes this problem in drupal 6 as it was necessary to fix it for the functionality that the patch provides.

That patch implements the $cow (copy on write) functionality that was partly in the module already but left unused. So it gives the admin the option to copy on write or not, instead of how it currently work, which is to always copy on write. It also makes it so that the location_load_location function orders by lid when it selects.

To explain the issue, copy on write means that whenever you update a nodes locations it makes a copy of the location and saves it as a new location, then deletes the old location. So you end up with a new location with a new lid. This means that even when you select locations ordered by lid they are out of order.

Seeing as this is an issue of its own now I could split that part of the code from that patch and put it here if you like. I can make a 5 and 6 version.

agileware’s picture

StatusFileSize
new2.65 KB

Here is my solution to this problem, which has been split out from my other patch referenced in #6.
It builds on the 'copy on write' functionality that is already in the module.

This is for 6.x-3.x-dev (2009-Apr-18).

agileware’s picture

Status: Needs work » Needs review
StatusFileSize
new2.66 KB

Here is a D5 version of the patch in #7

It is for 5.x-3.x-dev (2009-Apr-18).

agileware’s picture

The patch for D6 in #7 will also apply to 6.x-3.1-rc1
and the patch for D5 in #8 will also apply to 5.x-3.1-rc1

yesct’s picture

Status: Needs review » Postponed (maintainer needs more info)

Please check to see if the problem is in the newest official release, lots of changes have been made recently. Maybe a re-roll is necessary. Seems like a lot of work has been done here, and that if the problem still exists, and the patch can be re-rolled, we can probably get this reviewed and committed (we have a lot of support from the maintainers lately! Yeah!). Thanks.

harry slaughter’s picture

Me Too! thought i was going nuts.

patch #7 seems to work. with d6

following....

cossme’s picture

StatusFileSize
new1022 bytes

i have attached a small patch for location.module - for me it fixes the problem of reordering, switching and displaying locations in the wrong order (in edit and display mode).

i simply adjusted the location_load_locations() function so it greps the locations from the database ordered by lid.

if it is in the wrong place: sorry, but i thought it could be helpful and did not find a better place.

the patch was applied to version 6.x-3.1 of the location module

cheers,
cossme

rooby’s picture

Version: 5.x-3.0 » 6.x-3.x-dev
Status: Postponed (maintainer needs more info) » Needs review

@cossme,

This is the right issue for your patch.
However, your patch has the same changes as the patch Agileware already submitted in #7, which I think still applies, just with a little bit of an offset.
The difference being that Agileware's patch also addresses another cause of the problem with the copy on write part.
So at this stage the patch to review is still #7, which looks good. I will test it out soon.

Thanks for the patch though. Also, it is very helpful to create patches with diff's -u & -p options - See http://drupal.org/patch/create

guillaumeduveau’s picture

Sub

podarok’s picture

Status: Needs review » Active
Issue tags: -location multiple locations

bot recall

podarok’s picture

Status: Active » Needs review

bot

podarok’s picture

Status: Needs review » Fixed

#7 commited pushed to 6.x-3.x
Thanks!

Status: Fixed » Closed (fixed)

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