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.
Comment | File | Size | Author |
---|---|---|---|
#1 | faq-detailed-question-null-1252142.patch | 874 bytes | seanburlington |
Comments
Comment #1
seanburlington CreditAttribution: seanburlington commentedAttached 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)
Comment #2
stella CreditAttribution: stella commentedPatch 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!
Comment #3.0
(not verified) CreditAttribution: commentedfixing markup for issue links