The query in the function _uc_addresses_db_check_address that checks if there is already a label with the same name does not query by uid. Thus, if any user has an address with the same label, then the error is output that says the label is already used. I believe this query should be limited by uid.

Comments

freixas’s picture

Assigned: Unassigned » freixas

Well, that was sloppy of me. :-(

I changed the code from

  // Now check to make sure the address_name is not already in use
  // Unless its for the address we are trying to update

  if ($address->address_name) {
    $result =
      db_query("SELECT aid FROM {uc_addresses} WHERE "
	       ."address_name = '%s'",
	       $address->address_name);

to

  // Now check to make sure the address_name is not already in use
  // Unless its for the address we are trying to update

  if ($address->address_name) {
    $result =
      db_query("SELECT aid FROM {uc_addresses} WHERE "
	       ."uid = %d AND "
	       ."address_name = '%s'",
	       $address->uid,
	       $address->address_name);

I'll check this in as soon as I have time to test it. Thanks for catching this!

freixas’s picture

Status: Active » Fixed

I finally had time to test the fix. It seems to work.

So where is the fixed code? It's checked in to the DRUPAL--5 branch. I continue to be a bit confused about how the Drupal CVS tags and branches work, and I'll wait a day to see if a 5.x-2.x-dev release is automatically generated.

Status: Fixed » Closed (fixed)

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