Created a function in respond to hook_webform_submission_update
to generate a FillPdf.
function my_module_webform_submission_update($node, $submission) { if ($submission->nid == 43) { $uuid = ($submission->data['975'][0]); $sid = ($submission->sid); $f = "./sites/default/files/docs/mdx_lh_" . $uuid . "_" . $sid . ".pdf"; if (file_exists($f)) unlink($f); $wf = array(array("nid" => 43, "sid" => $sid)); fillpdf_merge_pdf(326,NULL,$wf); } }
When the event is triggered, after pressing the save button, the FillPdf uses the old data.
Going over the webform a second time without changing anything, just clicking the save button, the FillPdf uses the correct data.
I thought the hook_webform_submission_presave
was to change data (if needed) but it seems the event hook_webform_submission_update
is triggered before data is actually saved.
Is there a way to force data save before calling fillpdf_merge_pdf
, or is there another event to use?