0

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?

0

For whatever reason querying the database give the correct data and yet the FillPdf sevice uses the older one, we moved the routine to the point where the results are showed, where its activated with a button. This option works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.