possibly related to #1002984: Notice: Undefined property: stdClass::$detailed_question in faq_form() (line 231

Originally reported at #1058750: Failing to import for node_export

The detailed_question field is marked in the schema API as NOT NULL

The faq_load function does not add this parameter if the value would be empty

The faq_form function sets the parameter to "" if it does not exist

and faq_save requires the field to be present (by virtue of the NOT NULL constraint)

All this works out OK if you use the form to create the node that you save - but you can't load a node do $stuff to it, then save it again.

If you do you get an error

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'detailed_question' cannot be null: INSERT INTO {faq_questions} (nid, vid, question, detailed_question) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); 

Removing the null constraint seems the safest change to fix this and works for me - I'll cook up a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

seanburlington’s picture

Status: Active » Needs review
FileSize
874 bytes

Attached is a patch which changes the schema API and allows null detailed_questions

This means that a node can be loaded as presently resulting in no detailed_question property can still be saved without having to use the form

This hasn't yet be fully tested (I will need to rebuild my site to test it properly)

stella’s picture

Status: Needs review » Fixed

Patch committed with a couple of minor changes (removed $ret and changed update number to be 7000 as it's the first D7 update function).

Thanks!

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

fixing markup for issue links