diff --git a/app/config/core.php b/app/config/core.php index 1750a7d51..76b5a25fa 100644 --- a/app/config/core.php +++ b/app/config/core.php @@ -319,7 +319,7 @@ /** * iPeer database version */ - Configure::write('DATABASE_VERSION', 7); + Configure::write('DATABASE_VERSION', 8); $CWL['LoginURL'] = 'https://www.auth.cwl.ubc.ca/auth/login'; @@ -342,7 +342,7 @@ $CWL['applicationID'] = ''; $CWL['applicationPassword'] = ''; - define('IPEER_VERSION', '3.1.4'); + define('IPEER_VERSION', '3.1.5'); /** diff --git a/app/config/sql/delta_8.sql b/app/config/sql/delta_8.sql new file mode 100644 index 000000000..d61a7f453 --- /dev/null +++ b/app/config/sql/delta_8.sql @@ -0,0 +1,6 @@ +INSERT INTO `email_templates` (`name`, `description`, `subject`, `content`, `availability`, `creator_id`, `created`, `updater_id`, `updated`) VALUES +('Evaluation Reminder Template', 'evaluation reminder template', 'iPeer Evaluation Reminder', 'Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You', 1, 1, NOW(), NULL, NULL); + +UPDATE `email_schedules` SET `content` = (SELECT id FROM `email_templates` WHERE `subject`="iPeer Evaluation Reminder" AND `content`="Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You") WHERE `subject` like '%iPeer Evaluation Reminder%' and `sent`=0; + +UPDATE `sys_parameters` SET `parameter_value` = '8' WHERE `parameter_code` = 'database.version'; \ No newline at end of file diff --git a/app/config/sql/ipeer.sql b/app/config/sql/ipeer.sql index cfa113d88..95d512ed9 100644 --- a/app/config/sql/ipeer.sql +++ b/app/config/sql/ipeer.sql @@ -745,7 +745,8 @@ CREATE TABLE IF NOT EXISTS `email_templates` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `email_templates` (`id`, `name`, `description`, `subject`, `content`, `availability`, `creator_id`, `created`, `updater_id`, `updated`) VALUES -(1, 'Submission Confirmation', 'template for submission confirmation', 'iPeer: Evaluation Submission Confirmation', 'Hi {{{FIRSTNAME}}}, \nYour evaluation has been submitted successfully. Thank you for your feedback!\n\n iPeer',1, 1, NOW(), NULL, NULL); +(1, 'Submission Confirmation', 'template for submission confirmation', 'iPeer: Evaluation Submission Confirmation', 'Hi {{{FIRSTNAME}}}, \nYour evaluation has been submitted successfully. Thank you for your feedback!\n\n iPeer',1, 1, NOW(), NULL, NULL), +(2, 'Evaluation Reminder Template', 'evaluation reminder template', 'iPeer Evaluation Reminder', 'Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You', 1, 1, NOW(), NULL, NULL); -- -------------------------------------------------------- @@ -1497,8 +1498,8 @@ INSERT INTO `sys_parameters` (`parameter_code`, `parameter_value`, `parameter_ty ('system.super_admin', 'root', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), ('system.admin_email', 'Please enter the iPeer administrator\\''s email address.', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), ('display.date_format', 'D, M j, Y g:i a', 'S', 'date format preference', 'A', 0, NOW(), NULL, NOW()), -('system.version', '3.1.3', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), -('database.version', '7', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()), +('system.version', '3.1.5', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), +('database.version', '8', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()), ('email.port', '25', 'S', 'port number for email smtp option', 'A', '0', NOW(), NULL , NOW()), ('email.host', 'localhost', 'S', 'host address for email smtp option', 'A', '0', NOW(), NULL , NOW()), ('email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()), diff --git a/app/config/sql/ipeer_samples_data.sql b/app/config/sql/ipeer_samples_data.sql index 784ab4b2d..6d0996c0a 100644 --- a/app/config/sql/ipeer_samples_data.sql +++ b/app/config/sql/ipeer_samples_data.sql @@ -833,7 +833,8 @@ INSERT INTO `email_templates` (`id`, `name`, `description`, `subject`, `content` (1, 'Submission Confirmation', 'template for submission confirmation', 'iPeer: Evaluation Submission Confirmation', 'Hi {{{FIRSTNAME}}}, \nYour evaluation has been submitted successfully. Thank you for your feedback!\n\n iPeer',1, 1, NOW(), NULL, NULL), (2, 'Email template example', 'This is an email template example', 'Email Template', 'Hello, {{{USERNAME}}}',1, 1, NOW(), NULL, NULL), (3, 'Email template example2', 'email template ex2', 'Email Template2', 'Hello, {{{FIRSTNAME}}}',1, 2, NOW(), NULL, NULL), -(4, 'Email template example3', 'email temp example3', 'Email Template3', 'Hello,',1, 3, NOW(), NULL, NULL); +(4, 'Email template example3', 'email temp example3', 'Email Template3', 'Hello,',1, 3, NOW(), NULL, NULL), +(5, 'Evaluation Reminder Template', 'evaluation reminder template', 'iPeer Evaluation Reminder', 'Hello {{{FIRSTNAME}}},\n\nA evaluation for {{{COURSENAME}}} is made available to you in iPeer, which has yet to be completed.\n\nName: {{{EVENTTITLE}}}\nDue Date: {{{DUEDATE}}}\nClose Date: {{{CLOSEDATE}}}\n\nThank You', 1, 1, NOW(), NULL, NULL); -- -------------------------------------------------------- @@ -2027,8 +2028,8 @@ INSERT INTO `sys_parameters` (`parameter_code`, `parameter_value`, `parameter_ty ('system.super_admin', 'root', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), ('system.admin_email', 'Please enter the iPeer administrator\\''s email address.', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), ('display.date_format', 'D, M j, Y g:i a', 'S', 'date format preference', 'A', 0, NOW(), NULL, NOW()), -('system.version', '3.1.4', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), -('database.version', '7', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()), +('system.version', '3.1.5', 'S', NULL, 'A', 0, NOW(), NULL, NOW()), +('database.version', '8', 'I', 'database version', 'A', 0, NOW(), NULL, NOW()), ('email.port', '25', 'S', 'port number for email smtp option', 'A', '0', NOW(), NULL , NOW()), ('email.host', 'localhost', 'S', 'host address for email smtp option', 'A', '0', NOW(), NULL , NOW()), ('email.username', '', 'S', 'username for email smtp option', 'A', '0', NOW(), NULL , NOW()), diff --git a/app/libs/upgrade_scripts/upgrade_314.php b/app/libs/upgrade_scripts/upgrade_314.php index 10d98c0b5..155212ecb 100644 --- a/app/libs/upgrade_scripts/upgrade_314.php +++ b/app/libs/upgrade_scripts/upgrade_314.php @@ -1,7 +1,7 @@ + * @copyright 2012 All rights reserved. + * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt} + * @version Release: 3.1 + */ + class Upgrade315 extends UpgradeBase +{ + /** + * __construct + * + * @access public + * @return void + */ + public function __construct() + { + $this->fromVersions = array(null, '3.1.4'); + $this->toVersion = '3.1.5'; + $this->dbVersion = Configure::read('DATABASE_VERSION'); + } + + /** + * + * @access public + * @return void + */ + public function isUpgradable() + { + return parent::isUpgradable(); + } + + /** + * up + * + * @access public + * @return boolean + */ + public function up() + { + $sysparameter = ClassRegistry::init('SysParameter'); + $dbv = $sysparameter->get('database.version'); + + $ret = $this->patchDb($dbv, $this->dbVersion); + if ($ret) { + $this->errors[] = sprintf(__('Database patching failed: %s', true), $ret); + return false; + } + $sysparameter->reload(); + + return true; + } +} \ No newline at end of file diff --git a/app/tests/cases/models/email_template.test.php b/app/tests/cases/models/email_template.test.php index e7f2a22b9..6984765bd 100644 --- a/app/tests/cases/models/email_template.test.php +++ b/app/tests/cases/models/email_template.test.php @@ -39,23 +39,26 @@ function testGetPermittedEmailTemplate() { //Test on valid input w/ find all $templates = $this->EmailTemplate->getPermittedEmailTemplate('1', 'all'); - $this->assertEqual(count($templates), 4); + $this->assertEqual(count($templates), 5); $this->assertEqual($templates[0]['EmailTemplate']['id'], 2); $this->assertEqual($templates[1]['EmailTemplate']['id'], 3); $this->assertEqual($templates[2]['EmailTemplate']['id'], 4); - $this->assertEqual($templates[3]['EmailTemplate']['id'], 1); + $this->assertEqual($templates[3]['EmailTemplate']['id'], 5); + $this->assertEqual($templates[4]['EmailTemplate']['id'], 1); $this->assertEqual($templates[0]['EmailTemplate']['name'], 'Email template example'); $this->assertEqual($templates[1]['EmailTemplate']['name'], 'Email template example2'); $this->assertEqual($templates[2]['EmailTemplate']['name'], 'Email template example3'); - $this->assertEqual($templates[3]['EmailTemplate']['name'], 'Submission Confirmation'); + $this->assertEqual($templates[3]['EmailTemplate']['name'], 'Evaluation Reminder Template'); + $this->assertEqual($templates[4]['EmailTemplate']['name'], 'Submission Confirmation'); //Test on valid input w/ find list $templates = $this->EmailTemplate->getPermittedEmailTemplate('1', 'list'); $this->assertEqual($templates, array( - '1' => 'Submission Confirmation', '2' => 'Email template example', '3' => 'Email template example2', - '4' => 'Email template example3') + '4' => 'Email template example3', + '5' => 'Evaluation Reminder Template', + '1' => 'Submission Confirmation') ); //Test on null input diff --git a/app/vendors/shells/send_emails.php b/app/vendors/shells/send_emails.php index fb77a6950..cd39e6ff4 100644 --- a/app/vendors/shells/send_emails.php +++ b/app/vendors/shells/send_emails.php @@ -108,8 +108,11 @@ function main() $tables[$table['table_name']][$table['field_name']] = '/'.$match[0].'/'; } } - // email content after merging common data - $content = preg_replace($patterns, $replacements, $e['content']); + // email content after merging common data, common data is non-user + // specific data such as course name and such. User specific data + // is merged in each individual email in the following loop using + // doMerge. + $contentWithCommonData = preg_replace($patterns, $replacements, $e['content']); $emailList = $this->User->getEmails(explode(';', $filter_email_list)); foreach ($emailList as $to_id => $to) { @@ -121,7 +124,7 @@ function main() $subject = $e['subject']; if (!empty($tables)) { // merge data not in common data - $content = $this->doMerge($content, EmailMerge::MERGE_START, EmailMerge::MERGE_END, $tables, $to_id); + $content = $this->doMerge($contentWithCommonData, EmailMerge::MERGE_START, EmailMerge::MERGE_END, $tables, $to_id); } if ($this->sendEmail($content, $subject, $from, $to)) { $successCount++; diff --git a/readme.md b/readme.md index 3247d8fc1..b7dcdcdd2 100644 --- a/readme.md +++ b/readme.md @@ -70,6 +70,24 @@ Runing the tests: cake/console/cake -app app testsuite app group system It is better not to touch the mouse or keyboard during the tests. +iPeer 3.1.5 +--------------------------- +This is a maintenance release. +* Fixed emails templates filling in wrong names. +* Fixed bug where empty ipeer evaluation reminder emails were sent +* Added system.version parameter to delta7 +* Updated vagrant and puppet modules +* Fixed missing formLoaded parameter in event editing +* Fixed the failed test and update version in sample data +* Moved delta 5 into delta 4 and remove sql mode in 6 +* Fixed some bugs && temporarily removed show student events +* Fixed releasing comments for student view of evaluation results +* Added commands to refresh the cache directory into the upgrade script +* Implemented some validations to event edit +* Fixed super admins unable to view all instructors and faculty admins +* Created upgrade script to version 3.1.4 +* Fixed events add/edit event forms + iPeer 3.1.4 --------------------------- This is a maintenance release. diff --git a/version.txt b/version.txt index 0aec50e6e..3ad0595ad 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.1.4 +3.1.5