View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
05558Bug reportsSurvey participants (Tokens)public2011-11-15 15:15
Reportertpartner Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.00a2 
Target Version2.00a2Fixed in Version2.00a2 
Summary05558: New feature - Prevent sending of confirmation emails
Description

The current method of preventing confirmation emails from being sent (deleting all content in form fields) is not intuitive.

The attached patch adds a setting to the Survey properties --> General settings --> Tokens tab to allow the prevention of confirmation emails (see image_1).

If "Send confirmation emails?" is set to "No", no mails will be sent and a warning is displayed in the Survey properties --> Email templates --> Confirmation tab (see image_2).

TagsNo tags attached.
Attached Files
no_confirmation_mail_feature.patch (11,336 bytes)   
Index: application/controllers/admin/database.php
===================================================================
--- application/controllers/admin/database.php	(revision 11315)
+++ application/controllers/admin/database.php	(working copy)
@@ -1031,6 +1031,7 @@
             'showprogress'=> $this->input->post('showprogress'),
             'listpublic'=> $this->input->post('public'),
             'htmlemail'=> $this->input->post('htmlemail'),
+            'sendconfirmation'=> $this->input->post('sendconfirmation'),
             'tokenanswerspersistence'=> $this->input->post('tokenanswerspersistence'),
             'alloweditaftercompletion'=> $this->input->post('alloweditaftercompletion'),
             'usecaptcha'=> $this->input->post('usecaptcha'),
Index: application/controllers/admin/emailtemplates.php
===================================================================
--- application/controllers/admin/emailtemplates.php	(revision 11315)
+++ application/controllers/admin/emailtemplates.php	(working copy)
@@ -164,7 +164,12 @@
             $sHTMLOutput .="</ul></div>"
 
             ."<div id='tab-{$grouplang}-confirmation'>";
-            $sHTMLOutput .= "<ul><li><label for='email_confirm_subj_{$grouplang}'>".$clang->gT("Confirmation email subject:")."</label>\n"
+            $sHTMLOutput .= "<ul>";
+            if($surveyinfo['sendconfirmation'] == 'N')
+			{
+			    $sHTMLOutput .= "<li><span class='warningtext'>".$clang->gT("No confirmation emails will be sent. To send emails see Survey properties.")."</span></li>\n";
+			}
+            $sHTMLOutput .= "<li><label for='email_confirm_subj_{$grouplang}'>".$clang->gT("Confirmation email subject:")."</label>\n"
             . "<input type='text' size='80' name='email_confirm_subj_".$esrow['surveyls_language']."' id='email_confirm_subj_{$grouplang}' value=\"{$esrow['surveyls_email_confirm_subj']}\" />\n"
             . "<input type='hidden' name='email_confirm_subj_default_".$esrow['surveyls_language']."' id='email_confirm_subj_default_{$grouplang}' value='{$aDefaultTexts['confirmation_subject']}' />\n"
             . "<input type='button' value='".$clang->gT("Use default")."' onclick='javascript: fillin(\"email_confirm_subj_{$grouplang}\",\"email_confirm_subj_default_{$grouplang}\")' />\n"
Index: application/controllers/admin/survey.php
===================================================================
--- application/controllers/admin/survey.php	(revision 11315)
+++ application/controllers/admin/survey.php	(working copy)
@@ -1380,6 +1380,7 @@
             $esrow['usecookie']                = 'N';
             $esrow['usecaptcha']               = 'D';
             $esrow['htmlemail']                = 'Y';
+            $esrow['sendconfirmation']         = 'Y';
             $esrow['emailnotificationto']      = '';
             $esrow['anonymized']               = 'N';
             $esrow['datestamp']                = 'N';
@@ -1771,6 +1772,7 @@
             'printanswers'=>$this->input->post('printanswers'),
             'listpublic'=>$this->input->post('public'),
             'htmlemail'=>$this->input->post('htmlemail'),
+            'sendconfirmation'=>$this->input->post('sendconfirmation'),
             'tokenanswerspersistence'=>$this->input->post('tokenanswerspersistence'),
             'alloweditaftercompletion'=>$this->input->post('alloweditaftercompletion'),
             'usecaptcha'=>$this->input->post('usecaptcha'),
Index: application/helpers/frontend_helper.php
===================================================================
--- application/helpers/frontend_helper.php	(revision 11315)
+++ application/helpers/frontend_helper.php	(working copy)
@@ -1257,7 +1257,7 @@
                 }
 
                 //Only send confirmation email if there is a valid email address
-                if (validate_email($cnfrow['email']))
+                if (validate_email($cnfrow['email']) && $thissurvey['sendconfirmation'] == "Y")
                 {
                     SendEmailMessage($message, $subject, $to, $from, $sitename,$ishtml);
                 }
Index: application/helpers/update/upgrade-mssql_helper.php
===================================================================
--- application/helpers/update/upgrade-mssql_helper.php	(revision 11315)
+++ application/helpers/update/upgrade-mssql_helper.php	(working copy)
@@ -155,6 +155,7 @@
         }
 
         modify_database("","ALTER TABLE [prefix_surveys] ADD [htmlemail] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush();
+        modify_database("","ALTER TABLE [prefix_surveys] ADD [sendconfirmation] CHAR(1) DEFAULT 'Y'"); echo $modifyoutput; flush();ob_flush();
         modify_database("","ALTER TABLE [prefix_surveys] ADD [usecaptcha] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush();
         modify_database("","ALTER TABLE [prefix_surveys] ADD [tokenanswerspersistence] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush();
         modify_database("","ALTER TABLE [prefix_users] ADD [htmleditormode] CHAR(7) DEFAULT 'default'"); echo $modifyoutput; flush();ob_flush();
Index: application/helpers/update/upgrade-mssqlnative_helper.php
===================================================================
--- application/helpers/update/upgrade-mssqlnative_helper.php	(revision 11315)
+++ application/helpers/update/upgrade-mssqlnative_helper.php	(working copy)
@@ -155,6 +155,7 @@
         }
 
         modify_database("","ALTER TABLE [prefix_surveys] ADD [htmlemail] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush();
+        modify_database("","ALTER TABLE [prefix_surveys] ADD [sendconfirmation] CHAR(1) DEFAULT 'Y'"); echo $modifyoutput; flush();ob_flush();
         modify_database("","ALTER TABLE [prefix_surveys] ADD [usecaptcha] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush();
         modify_database("","ALTER TABLE [prefix_surveys] ADD [tokenanswerspersistence] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush();
         modify_database("","ALTER TABLE [prefix_users] ADD [htmleditormode] CHAR(7) DEFAULT 'default'"); echo $modifyoutput; flush();ob_flush();
Index: application/helpers/update/upgrade-mysql_helper.php
===================================================================
--- application/helpers/update/upgrade-mysql_helper.php	(revision 11315)
+++ application/helpers/update/upgrade-mysql_helper.php	(working copy)
@@ -161,6 +161,7 @@
 
 
         modify_database("","ALTER TABLE `prefix_surveys` ADD `htmlemail` CHAR(1) default 'N'"); echo $modifyoutput; flush();@ob_flush();
+        modify_database("","ALTER TABLE `prefix_surveys` ADD `sendconfirmation` CHAR(1) default 'Y'"); echo $modifyoutput; flush();@ob_flush();
         modify_database("","ALTER TABLE `prefix_surveys` ADD `tokenanswerspersistence` CHAR(1) default 'N'"); echo $modifyoutput; flush();@ob_flush();
         modify_database("","ALTER TABLE `prefix_surveys` ADD `usecaptcha` CHAR(1) default 'N'"); echo $modifyoutput; flush();@ob_flush();
         modify_database("","ALTER TABLE `prefix_users` ADD `htmleditormode` CHAR(7) default 'default'"); echo $modifyoutput; flush();@ob_flush();
Index: application/views/admin/survey/subview/tabTokens_view.php
===================================================================
--- application/views/admin/survey/subview/tabTokens_view.php	(revision 11315)
+++ application/views/admin/survey/subview/tabTokens_view.php	(working copy)
@@ -100,7 +100,23 @@
             </select>
         </li>
 
+        <li>
+            <label for='sendconfirmation'><?php echo $clang->gT("Send confirmation emails?"); ?></label>
+            <select name='sendconfirmation' id='sendconfirmation'>
+                <option value='Y'
+                <?php if ($esrow['sendconfirmation'] == "Y") { ?>
+                    selected='selected'
+                <?php } ?>
+                ><?php echo $clang->gT("Yes"); ?></option>
+                <option value='N'
+                <?php if ($esrow['sendconfirmation'] == "N") { ?>
+                selected='selected'
+                <?php } ?>
+                ><?php echo $clang->gT("No"); ?></option>
+            </select>
+        </li>
 
+
          <li><label for='tokenlength'><?php echo $clang->gT("Set token length to:"); ?></label>
          <input type='text' value="<?php echo $esrow['tokenlength']; ?>" name='tokenlength' id='tokenlength' size='12' maxlength='2' onkeypress="return goodchars(event,'0123456789')" />
          </li>
Index: installer/sql/create-mssql.sql
===================================================================
--- installer/sql/create-mssql.sql	(revision 11315)
+++ installer/sql/create-mssql.sql	(working copy)
@@ -293,6 +293,7 @@
   [publicstatistics] char(1) default 'N',
   [publicgraphs] char(1) default 'N',
   [htmlemail] char(1) default 'N',
+  [sendconfirmation] char(1) default 'Y',
   [tokenanswerspersistence] char(1) default 'N',
   [assessments] char(1) default 'N',
   [usecaptcha] char(1) default 'N',
Index: installer/sql/create-mssqlnative.sql
===================================================================
--- installer/sql/create-mssqlnative.sql	(revision 11315)
+++ installer/sql/create-mssqlnative.sql	(working copy)
@@ -302,6 +302,7 @@
   [publicstatistics] char(1) default 'N',
   [publicgraphs] char(1) default 'N',
   [htmlemail] char(1) default 'N',
+  [sendconfirmation] char(1) default 'Y',
   [tokenanswerspersistence] char(1) default 'N',
   [assessments] char(1) default 'N',
   [usecaptcha] char(1) default 'N',
Index: installer/sql/create-mysql.sql
===================================================================
--- installer/sql/create-mysql.sql	(revision 11315)
+++ installer/sql/create-mysql.sql	(working copy)
@@ -276,6 +276,7 @@
   `publicgraphs` char(1) default 'N',
   `listpublic` char(1) default 'N',
   `htmlemail` char(1) default 'N',
+  `sendconfirmation` char(1) default 'Y',
   `tokenanswerspersistence` char(1) default 'N',
   `assessments` char(1) default 'N', 
   `usecaptcha` char(1) default 'N',
Index: installer/sql/create-postgre.sql
===================================================================
--- installer/sql/create-postgre.sql	(revision 11315)
+++ installer/sql/create-postgre.sql	(working copy)
@@ -291,6 +291,7 @@
     publicstatistics character(1) DEFAULT 'N'::bpchar,
     publicgraphs character(1) DEFAULT 'N'::bpchar,
     htmlemail character(1) DEFAULT 'N'::bpchar,
+    sendconfirmation character(1) DEFAULT 'Y'::bpchar,
     tokenanswerspersistence character(1) DEFAULT 'N'::bpchar,
     assessments character(1) DEFAULT 'N'::bpchar,
     usecaptcha character(1) DEFAULT 'N'::bpchar,
Index: styles/admin/default/adminstyle.css
===================================================================
--- styles/admin/default/adminstyle.css	(revision 11315)
+++ styles/admin/default/adminstyle.css	(working copy)
@@ -1054,6 +1054,14 @@
     color: #121A28;
 }
 
+.form30newtabs li .warningtext,
+.form30 li .warningtext {
+	display: block;
+    margin: 3px 0 10px 30.5%;
+    font-weight: bold;
+    color: #EE0000;
+}
+
 .form30 table {
     width: auto;
     float: left;
image_1.PNG (25,232 bytes)   
image_1.PNG (25,232 bytes)   
image_2.PNG (37,181 bytes)   
image_2.PNG (37,181 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)11320
I will donate to the project if issue is resolvedNo
BrowserFF & IE
Database type & versionMySQL 5.1.41
Server OS (if known)Win
Webserver software & version (if known)Apache/2.2.14
PHP Version5.3.1

Users monitoring this issue

There are no users monitoring this issue.

Activities

tpartner

tpartner

2011-11-03 22:38

partner   ~16589

Carsten, when you have a moment, could you please review this patch?

Thanks.

c_schmitz

c_schmitz

2011-11-03 23:08

administrator   ~16591

Thank you, thank you, thank you ;). I have noticed the same issue alot of times but always forgot about it.
The patch looks fine. Maybe one improvement would be to check on upgrade if the confirmation is empty and deactivate the confirmation email setting. And remove the code that checks if the confirmation is empty.

tpartner

tpartner

2011-11-04 13:26

partner   ~16595

Thanks Carsten.

I can have a crack at that but may need a little help.

Where do you suggest I put the check for confirmation template content?

Do I need to do anything with the DB version (so CheckForDBUpgrades() is called) or is that automatic.

c_schmitz

c_schmitz

2011-11-08 14:46

administrator   ~16624

I would not raise the dbversion for that. Put the check in the update process where you add the field anyway.

tpartner

tpartner

2011-11-09 22:59

partner   ~16643

Carsten, I have commited the patch with your suggested upgrade check in upgrade-all_helper.php. Could you please have a look before I close this bug?

Thanks.

c_schmitz

c_schmitz

2011-11-15 15:15

administrator   ~16671

Looks great. Thank you!

Issue History

Date Modified Username Field Change
2011-11-03 22:33 tpartner New Issue
2011-11-03 22:33 tpartner File Added: no_confirmation_mail_feature.patch
2011-11-03 22:35 tpartner File Added: image_1.PNG
2011-11-03 22:36 tpartner File Added: image_2.PNG
2011-11-03 22:38 tpartner Assigned To => c_schmitz
2011-11-03 22:38 tpartner Status new => assigned
2011-11-03 22:38 tpartner Note Added: 16589
2011-11-03 23:04 c_schmitz Assigned To c_schmitz => tpartner
2011-11-03 23:08 c_schmitz Note Added: 16591
2011-11-04 13:26 tpartner Note Added: 16595
2011-11-04 13:26 tpartner Assigned To tpartner =>
2011-11-04 13:26 tpartner Assigned To => c_schmitz
2011-11-08 14:46 c_schmitz Note Added: 16624
2011-11-08 14:47 c_schmitz Assigned To c_schmitz => tpartner
2011-11-09 22:59 tpartner Note Added: 16643
2011-11-09 22:59 tpartner Assigned To tpartner => c_schmitz
2011-11-15 15:15 c_schmitz Note Added: 16671
2011-11-15 15:15 c_schmitz Status assigned => closed
2011-11-15 15:15 c_schmitz Resolution open => fixed
2011-11-15 15:15 c_schmitz Fixed in Version => 2.00a2
2016-12-08 10:39 c_schmitz Category Tokens => Survey participants (Tokens)