strakers / zendesk-drupal-webform

Adds the ability to create Zendesk tickets from Drupal Webforms
https://packagist.org/packages/strakez/zendesk-webform
MIT License
2 stars 4 forks source link

Update ZendeskHandler.php #33

Closed gretel-gutierrez closed 3 years ago

gretel-gutierrez commented 3 years ago
Captura de Pantalla 2020-12-10 a la(s) 0 13 03 Captura de Pantalla 2020-12-10 a la(s) 0 13 46

$submission_field[0] was always null. It is not an array, I changed from $submission_field[0] to $submission_field to get fid of the file

strakers commented 3 years ago

@gretel-gutierrez thanks for pointing this out! Looks like this was an oversight on my part.

The $submission_fields variable type depends on whether the form field is set to accept only 1 (not array) or multiple values (is array). In my case, I almost always allow multiple files for upload, but this is not the case for everyone/every case.

Though, rather than accepting this commit outright, I suggest that a conditional clause needs to be inserted to check the variable type (array or not) prior to loading the file. This way, both use cases can be covered.

strakers commented 3 years ago

Addressed in https://github.com/strakers/zendesk-drupal-webform/pull/38