I just noticed that my webform's number type fields didn't appear in the Content of the PDF document section.
I created a little patch so that I can use these fields. Please review and extend the base code with it.

CommentFileSizeAuthor
webform2pdf_number_type_fix.patch527 bytesmezitlab

Comments

mr.york’s picture

Status: Needs review » Fixed

Commited. Thank you.

Status: Fixed » Closed (fixed)

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

sdsheridan’s picture

I think you want to make the solution a bit more robust than this, as this solution ignores the number-formatting options chosen when the component is configured. The inclusion in function _webform2pdf_list_template_vars per the patch is fine, but in function _webform2pdf_get_template_vars, a more robust solution would be a separate case, as follows:

        case 'number':
          if ( !empty($submission->data[$component['cid']]['value'][0]) ) {
            $tokens['%' . $component['form_key']] = number_format($submission->data[$component['cid']]['value'][0],
                    $component['extra']['integer'] ? 0 : ( is_numeric($component['extra']['decimals']) ? (int) $component['extra']['decimals'] : 0 ),
                    $component['extra']['point'],
                    $component['extra']['separator']);
          }
          else {
            $tokens['%' . $component['form_key']] = '';
          }
        break;

Shawn

sdsheridan’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs work
mr.york’s picture

Status: Needs work » Fixed

Little bit choesed your code, and commited.

Status: Fixed » Closed (fixed)

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