Drush wfx is a brilliant solution to automated export of submitted forms. But at the moment it seems to have no option to restrict listed submissions to those completed.

Is this an undocumented special option in the components or is it not yet implemented?

Comments

danchadwick’s picture

There isn't an undocumented feature. Patches are welcome, or perhaps you could sponsor development of this feature.

jamesbisset’s picture

OK, just stumbling through the code in webform.drush.inc here:

  1. Set a new wfx option 'completion type' with a choice of all, finished or draft
  2. pass the chosen value into $options['range']['completion_type']

Am I missing anything?

danchadwick’s picture

@jamesbisset -- no clue. I've only glanced at the drush integration. You'll have to read the code, implement the feature, and test it thoroughly. Be sure to add the feature to the command's help.

Any interest in helping other export/wfx issues? I can create a meta-issue. These include suppressing the header, exporting using serial numbers (not sure of status -- maybe this is done), and possibly exporting using the various dates (creation, finished, last saved), pending implementation of that. There is also an old request to bundle up the files from file components into a compressed file. Lot's of areas for improvement. :)

jamesbisset’s picture

I'll test and generate a patch over the weekend, but my update seems to be working fine.

danchadwick’s picture

jamesbisset’s picture

StatusFileSize
new1.96 KB

Patch attached. Initial patches to the wfx command should be straightforward because it is merely passing values back to functions in webform.report.inc.

Webform default behaviour is to download all submissions, because allowing drafts is an option in advanced settings. Only when drafts are allowed does it become relevant to select one or the other.

So I've set an error message which prevents download if someone defines completion type without having enabled drafts first.

danchadwick’s picture

a) Thank you for the patch!

b) I understand your idea about the error checking, but I don't think it is necessary. In the UI, we try to not present options that aren't relevant. In truth, it is possible for the webform to have submissions because draft options could have previously been enabled. In the case of a drush command, if they ask for something that is possible, but unlikely, I think we should just honor what they asked for.

c) I will remove the if clause and give it a whirl. No need to resubmit the patch. Thanks for tending to this.

  • DanChadwick committed cb4dd86 on 7.x-4.x
    Issue #2428413 by jamesbisset, DanChadwick: Added drush wfx can't...
  • DanChadwick committed 7705b07 on 8.x-4.x
    Issue #2428413 by jamesbisset, DanChadwick: Added drush wfx can't...
danchadwick’s picture

Status: Active » Fixed
StatusFileSize
new2.65 KB

I added a test to ensure that the option is one of the three valid choices. The way the code is written, an invalid option does not default to "all".

Committed to 7.x-4.x and 8.x.

Thanks for your help!

Status: Fixed » Closed (fixed)

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