Hello,

I'm trying to add a Serial Field to the Customer Profile in Commerce. When I do this and try to add a new customer, I get this error upon submit:

Error
The website encountered an unexpected error. Please try again later.

I tried adding it to another content type and got the same error when trying to add new content. No new nodes are created.

Thank you.

Comments

justmelat’s picture

Same issue, using drupal 7.12 and an old commerce-download module.

Steps
downloaded and enabled serial module, added new field to my content type: main_sku, added content, save, received error below.

Notice: Undefined property: stdClass::$nid in serial_field_insert() (line 83 of /home/lfwebz/public_html/gsh/sites/all/modules/serial/serial.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'nid' cannot be null: INSERT INTO {serial_digital_product_field_main_sku} (nid) VALUES (:db_insert_placeholder_0); Array ( [:db_insert_placeholder_0] => ) in _serial_generate_value() (line 155 of /home/lfwebz/public_html/gsh/sites/all/modules/serial/serial.inc).

indigoxela’s picture

Very alike here: "PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'nid' in 'field list': INSERT INTO... serial.inc "

The problem seems to be in serial.inc in line 153:

  // Create a temporary record for this node and retrieve the serial value.
  $sid = db_insert($table)
    ->fields(array(
      'nid' => $nid,
    ))
    ->execute();

I changed
'nid' => $nid,
to
'sid' => $nid,
and it worked again.

The module worked fine before. The table column's name is sid and not nid.

EDIT: but the field has the wrong value - it is no real serial field anymore but only has the node id

EDIT2: I mentioned that it was working fine before. There were some updates which might be influencing:

  • entity
  • auto_entitylabel
  • entityreference_prepopulate

The field is used to create the title of nodes with an id (tickets).

indigoxela’s picture

After updating to dev version serial field works fine again.
Whatever the problem is doesn't seem to happen with serial-7.x-1.x-dev

MustangGB’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)