Problem/Motivation

While hacking away at this module I noticed the validate element callback does a bunch of work that seems like it has no effect. Most prominent is the entity_metadata_wrapper() is setting values that are never saved.

Proposed resolution

Save the order, or delete the code that sets the reference.

Remaining tasks

User interface changes

API changes

Original report by @joelpittet

CommentFileSizeAuthor
#2 the_element_validate-2419499-2.patch865 bytesjoelpittet

Comments

joelpittet’s picture

Issue summary: View changes
joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new865 bytes

I factored out the $langcode to make that easier to read as well, mostly because I don't think that hunk of code doesn't do a whole lot and needs documentation on what it's doing.

joelpittet’s picture

Title: The element validate callback is not saving the order profile field reference after setting it » Element validate is not saving the order's customer profile field after setting it
joelpittet’s picture

+++ b/commerce_addressbook.module
@@ -451,8 +451,13 @@ function commerce_addressbook_saved_addresses_validate($element, &$form_state, $
       $order_wrapper->{$field_name} = NULL;
     }
+
+    // Save the changed customer profile to the order.
+    $order_wrapper->save();

This is the key to this patch. We are setting values and never saving them.

mglaman’s picture

Status: Needs review » Fixed

Committed - wrapper's don't do magic saving for us, so the logic and work there has been dead in water for some time.

  • mglaman committed 7d44fab on 7.x-2.x authored by joelpittet
    Issue #2419499 by joelpittet: Element validate is not saving the order's...

Status: Fixed » Closed (fixed)

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