Hi there,

Sometimes I wish I could temporary disable recipients rather than deleting them from the /webform/emails section. I know it’s possible to uncheck recipients in the result section.

Moreover cloning recipients settings including Mail Header details, From Address, From Name and the E-Mail Template customization would be great.

Comments

danchadwick’s picture

Title: Ability to clone and disable Webform recipients/ E-Mail Template. » Ability to disable Webform recipients/ E-Mail Template.
Issue summary: View changes

I understand the desire to disable, but webform already offers cloning for e-mail and components. Look to the right of the e-mail list.

Editing the title accordingly.

sumitmadan’s picture

Version: 7.x-4.8 » 7.x-4.x-dev
Status: Active » Needs review
StatusFileSize
new3.54 KB

Submitting a patch for this feature.

Also I would love to be the co-maintainer of the module. :)

danchadwick’s picture

Status: Needs review » Needs work

Thank for the patch!!

I think the best name for this would be status, to mirror users and nodes. The default would be 1, reversing the sense of disabled in the patch.

Also, I think this needs to be exposed in the list of emails as checkboxes, in the same way that required is for components. Otherwise it would be difficult to set these and to know which are active. I see end user confusion otherwise.

sumitmadan’s picture

Assigned: Unassigned » sumitmadan
sumitmadan’s picture

Assigned: sumitmadan » Unassigned
Status: Needs work » Needs review
StatusFileSize
new7.02 KB
danchadwick’s picture

I didn't try the patch, but I read it.

  1. +++ b/includes/webform.emails.inc
    @@ -156,6 +168,19 @@ function webform_emails_form_submit($form, &$form_state) {
    +    db_update('webform_emails')->fields(array(
    +      'status' => $status['status']
    +    ))
    +    ->condition('eid', $eid)
    +    ->execute();
    +  }
    

    Needs a condition on nid too. eid's are specific to a particular node. Each node can have an eid of 1.

  2. +++ b/includes/webform.emails.inc
    @@ -280,6 +305,14 @@ function webform_email_edit_form($form, $form_state, $node, $email = array(), $c
    +    '#default_value' => ($email['status'] === 0) ? $email['status'] : TRUE,
    

    What is the purpose of this ternary expression? Seems like this should just be $email['status']

  3. +++ b/includes/webform.emails.inc
    @@ -627,6 +663,7 @@ function webform_email_load($eid, $nid) {
    +      'status' => '',
    

    Should be 1, lest the email not be initially enabled.

  4. +++ b/webform.install
    @@ -491,6 +491,14 @@ function webform_schema() {
    +        'description' => 'Status of mail for current recipients.',
    ...
    +        'default' => 0,
    

    Description could be better. Maybe "Whether this email is enabled."
    Default should be 1.

  5. +++ b/webform.install
    @@ -2260,3 +2268,27 @@ function webform_update_7429() {
    +  if (!db_field_exists('webform_emails', 'status')) {
    +    $spec = array(
    +      'description' => 'Status of mail for current recipients.',
    +      'type' => 'int',
    +      'size' => 'small',
    +      'not null' => TRUE,
    +      'default' => 0,
    +    );
    +    db_add_field('webform_emails', 'status', $spec);
    +
    +    // Set status of existing recipients to 1.
    +    db_update('webform_emails')->fields(array(
    +      'status' => 1,
    +    ))
    +    ->execute();
    +  }
    

    Use the new description and default. Then you won't need the db_update().

danchadwick’s picture

Status: Needs review » Needs work
sumitmadan’s picture

Assigned: Unassigned » sumitmadan
sumitmadan’s picture

Status: Needs work » Needs review
StatusFileSize
new6.87 KB

Thanks. I have updated the code. :)

sumitmadan’s picture

Assigned: sumitmadan » Unassigned
danchadwick’s picture

Assigned: Unassigned » danchadwick
Status: Needs review » Needs work

I will (eventually) work on this. There were a few minor issues with #9, but more importantly, I don't love the UI. We already have an interface where you select e-mail to be RE-sent with a checkbox in column 1. The Save button only applies to this column and the add button only applies to the last row.

I may move the Save button to the checkbox column and put the add button in-line after the radio buttons. I'm not sure that webform has existing in-line markup for this though.

I'm also not totally happy that this feature has so much UI, but I don't see a good way around it.

sumitmadan’s picture

Well, I have followed the same UI as on components add form. But I'll be happy to see improved UI and then it can be implemented on components form too.

Just a thought.

danchadwick’s picture

Title: Ability to disable Webform recipients/ E-Mail Template. » Ability to disable Webform email recipients
Status: Needs work » Fixed
StatusFileSize
new9.55 KB
new8.08 KB

@sumitmadan -- thank you for all your work on this issue.

Changes I made:

  1. Changed style of "Add" row in e-mails to match that for components (inherit background color).
  2. Moved the status field to the first column.
  3. Changed the user-facing name of this field to "Send" (column header) or "Enable sending" (form).
  4. Styled the checkbox in the column to match other webform tables (centered).
  5. Moved the "Add" button into the last row of the table.
  6. Added a status checkbox to the new "Add" row, and pass this to the e-mail definition form.
  7. Tweaked the description for the status field.
  8. Adjusted the "Resend e-mails" form to also have a "Send" column heading (previously blank).
  9. Set the default for Resend e-mails to the status of the e-mail.
  10. Tweaked the hook_update_N comment, which is presented to the user, and the success message too.
  11. Fixed a minor bug where the update used size small (rather than tiny) and omitted unsigned.

Committed to 7.x-4.x.

  • DanChadwick committed d403cd2 on 7.x-4.x
    Issue #2485371 by sumitmadan, DanChadwick: Added ability to disable...
danchadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Category: Feature request » Task
Status: Fixed » Patch (to be ported)
fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Category: Task » Feature request
Status: Patch (to be ported) » Fixed

Ported #13, committed and pushed to 8.x-4.x. Thanks!

  • fenstrat committed b2c9016 on 8.x-4.x
    Issue #2485371 by sumitmadan, DanChadwick: Added ability to disable...

Status: Fixed » Closed (fixed)

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