forked from science-ation/science-ation
Add two new emails: registration complete, registration payment pending
Whipe out all 'from' of info@sfiab.ca (the old default, we dont want others using it!) When sending emails, if 'from' is empty, use the $config['fairmanageremail'] Add a warning on the communication page if the fair manager email has not been set Set the default 'from' for new emails to be the fair manager email NOTE/FIXME: i added the hooks for the two new emails to be sent, but still need to fill in the substitution values as well as the "to" - no time now, will do that tomorrow
This commit is contained in:
parent
d1c626e2b6
commit
ab5180ef9e
@ -232,6 +232,8 @@
|
||||
if($_POST['from']) $from=stripslashes($_POST['from']);
|
||||
if($_POST['body']) $body=stripslashes($_POST['body']);
|
||||
|
||||
if(!$from && $config['fairmanageremail']) $from="Fair Manager <".$config['fairmanageremail'].">";
|
||||
|
||||
echo "<table>";
|
||||
echo "<tr><td>".i18n("Email Name")."</td><td><input type=\"text\" name=\"name\" size=\"60\" value=\"$name\" /></td></tr>\n";
|
||||
echo "<tr><td>".i18n("Email Key")."</td><td>";
|
||||
@ -252,8 +254,10 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$config['fairmanageremail'])
|
||||
echo notice(i18n("Warning: The 'Fair Manager Email' has not been set in SFIAB Configuration / Configuration Variables / Global. Please set it. The 'Fair Manager Email' is the default 'From' address for all emails and without a 'From' address, no emails can be sent!"));
|
||||
|
||||
$q=mysql_query("SELECT * FROM emails ORDER BY name");
|
||||
$q=mysql_query("SELECT * FROM emails ORDER BY type,name");
|
||||
echo "<A href=\"communication.php?action=add\">Add New Email</a>";
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<tr>";
|
||||
|
@ -216,18 +216,22 @@ echo mysql_Error();
|
||||
}
|
||||
if($_POST['action']=="receivedyes")
|
||||
{
|
||||
//actually set it to 'closed'
|
||||
//actually set it to 'complete'
|
||||
mysql_query("UPDATE registrations SET status='complete' WHERE num='".$_POST['registration_number']."'");
|
||||
|
||||
|
||||
|
||||
//FIXME: set the to, subsub and subbod!
|
||||
email_send("register_participants_received",$to,$subsub,$subbod);
|
||||
echo happy(i18n("Registration of form %1 successfully completed",array($registration_number)));
|
||||
|
||||
|
||||
}
|
||||
else if($_POST['action']=="receivedyesnocash")
|
||||
{
|
||||
//actually set it to 'closed'
|
||||
//actually set it to 'paymentpending'
|
||||
mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='".$_POST['registration_number']."'");
|
||||
|
||||
//FIXME: set the to, subsub and subbod!
|
||||
email_send("register_participants_paymentpending",$to,$subsub,$subbod);
|
||||
echo happy(i18n("Registration of form %1 marked as payment pending",array($registration_number)));
|
||||
}
|
||||
|
||||
|
@ -797,6 +797,8 @@ function outputStatus($status)
|
||||
|
||||
function email_send($val,$to,$sub_subject=array(),$sub_body=array())
|
||||
{
|
||||
global $config;
|
||||
|
||||
//if our "to" doesnt look like a valid email, then forget about sending it.
|
||||
if(!eregi('[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})', $to))
|
||||
return;
|
||||
@ -841,12 +843,24 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array())
|
||||
}
|
||||
*/
|
||||
|
||||
if($r->from)
|
||||
$fr=$r->from;
|
||||
else if ($config['fairmanageremail'])
|
||||
$fr=$config['fairmanageremail'];
|
||||
else
|
||||
$fr="";
|
||||
|
||||
mail($to,$subject,$body,"From: $r->from\r\nReply-To: $r->from\r\nReturn-Path: $r->from");
|
||||
//only send the email if we have a from
|
||||
if($fr) {
|
||||
$extraheaders="From: $fr\r\bReply-To: $fr\r\nREturn-Path: $fr";
|
||||
mail($to,$subject,$body,$extraheaders);
|
||||
}
|
||||
else
|
||||
echo error(i18n("CRITICAL ERROR: email '%1' does not have a 'From' and the Fair Manager Email is not configured",array($val),array("email key name")));
|
||||
}
|
||||
else
|
||||
{
|
||||
echo error(i18n("CRITICAL ERROR: email '%1' not found",array($val),array("email address")));
|
||||
echo error(i18n("CRITICAL ERROR: email '%1' not found",array($val),array("email key name")));
|
||||
}
|
||||
}
|
||||
|
||||
|
3
db/db.update.53.sql
Normal file
3
db/db.update.53.sql
Normal file
@ -0,0 +1,3 @@
|
||||
INSERT INTO `emails` (`val`, `name`, `description`, `from`, `subject`, `body`, `type`) VALUES ('register_participants_received', 'Participant Registration - Form Received', 'Sent to the participant when the admin flags their signature form as received', 'james@lightbox.org', 'Registration for [FAIRNAME] Complete', 'Dear [FIRSTNAME],\r\nYour registration for the [FAIRNAME] is now complete.\r\nYour project number is [PROJECTNUMBER]. Please write down your project number and bring it with you to the fair in order to expedite the check-in process.\r\n\r\nSincerely,\r\n [FAIRNAME]', 'system');
|
||||
INSERT INTO `emails` (`val`, `name`, `description`, `from`, `subject`, `body`, `type`) VALUES ('register_participants_paymentpending', 'Participant Registration - Payment Pending', 'Sent to the participant when the admin flags their signature form as received but payment pending', 'james@lightbox.org', 'Registration for [FAIRNAME] Not Complete - Payment Pending', 'Dear [FIRSTNAME],\r\nYour registration for the [FAIRNAME] is not yet complete. We received your registration form however it was missing the required registration fee. Please send the required registration fee in aso soon as possible in order to complete your registration.\r\n\r\nYour project number is [PROJECTNUMBER]. Please write down your project number and bring it with you to the fair in order to expedite the check-in process.\r\n\r\nSincerely,\r\n [FAIRNAME]', 'system');
|
||||
UPDATE `emails` SET `from`='' WHERE `from`='info@sfiab.ca';
|
@ -83,12 +83,15 @@ else
|
||||
//query all of the awards
|
||||
$q=mysql_query("SELECT award_awards.id,
|
||||
award_awards.name,
|
||||
award_awards.criteria
|
||||
award_awards.criteria,
|
||||
award_sponsors.organization
|
||||
FROM
|
||||
award_awards,
|
||||
award_types
|
||||
award_types,
|
||||
award_sponsors
|
||||
WHERE
|
||||
award_types.id=award_awards.award_types_id
|
||||
AND award_sponsors.id=award_awards.award_sponsors_id
|
||||
AND (award_types.type='Special' OR award_types.type='Other')
|
||||
AND award_awards.year='{$config['FAIRYEAR']}'
|
||||
AND award_types.year='{$config['FAIRYEAR']}'
|
||||
@ -101,7 +104,7 @@ else
|
||||
$ch = (in_array($r->id,$spawards)) ? "checked=\"checked\"" : "";
|
||||
echo "<input onclick=\"checkboxclicked(this)\" $ch type=\"checkbox\" name=\"spaward[]\" value=\"{$r->id}\" />";
|
||||
echo "</td><td>";
|
||||
echo "<b>{$r->name}</b>";
|
||||
echo "<b>{$r->name}</b> ($r->organization)";
|
||||
echo "</td></tr>";
|
||||
echo "<tr><td>";
|
||||
echo "{$r->criteria}";
|
||||
@ -110,7 +113,6 @@ else
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
echo "<br />";
|
||||
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Special Award Preferences")."\" />\n";
|
||||
echo "</form>";
|
||||
|
Loading…
Reference in New Issue
Block a user