In short, if running PostgreSQL (I have no idea if this would fail on the other database) adding an address fails on the following query:


db_query("INSERT INTO {uc_addresses} (aid, uid, first_name, last_name, "
           ."phone, company, street1, street2, city, zone, postal_code, country, "
           ."address_name, "
           ."created, modified) VALUES (%d, %d, "
           ."'%s', '%s', '%s', "  
           ."'%s', '%s', '%s', "  
           ."'%s', %d, '%s', %d, "
           ."'%s', "  
           ."%d, %d)",
           0,
           $address->uid,
           $address->first_name,
           $address->last_name,
           $address->phone,  
           $address->company,
           $address->street1,
           $address->street2,
           $address->city,
           $address->zone,
           $address->postal_code,
           ((is_NULL($address->country) || $address->country == 0) ?
            variable_get('uc_store_country', 840) :
            $address->country),   
           $address->address_name,
           time(), 
           time());

Changing to:


 db_query("INSERT INTO {uc_addresses} (uid, first_name, last_name, "
           ."phone, company, street1, street2, city, zone, postal_code, country, "
           ."address_name, "
           ."created, modified) VALUES (%d, "
           ."'%s', '%s', '%s', "
           ."'%s', '%s', '%s', "
           ."'%s', %d, '%s', %d, "
           ."'%s', "
           ."%d, %d)",
           $address->uid,
           $address->first_name,
           $address->last_name, 
           $address->phone,
           $address->company,
           $address->street1,
           $address->street2,
           $address->city,   
           $address->zone,   
           $address->postal_code,
           ((is_NULL($address->country) || $address->country == 0) ?
            variable_get('uc_store_country', 840) :
            $address->country),
           $address->address_name,
           time(),
           time());

Makes it work. I have tested adding and editing. Let me know if you have any problems with it. I am happy to help with postgresql specific issues.

Comments

grub3’s picture

Status: Active » Needs review

I am just discovering your fix.
Have a look at my patch here: http://drupal.org/node/931998
It also corrects a %d issue.

Setting status to "Needs review", but this is a duplicate of http://drupal.org/node/931998.

grub3’s picture

Status: Needs review » Reviewed & tested by the community

Sorry, the correct status is "Tested by the community" as we had the same patch.

megachriz’s picture

Status: Reviewed & tested by the community » Closed (duplicate)