fixing issue with mail subject localization

parent a0066eaa
...@@ -379,6 +379,7 @@ module.exports = { ...@@ -379,6 +379,7 @@ module.exports = {
// As it can be resolved through two possibilities, better to use promises! // As it can be resolved through two possibilities, better to use promises!
// //
var getStudent = new Promise(function(resolve, reject) { var getStudent = new Promise(function(resolve, reject) {
if (!params.id_stu && params.license) { if (!params.id_stu && params.license) {
// get student, license attribute will be completed // get student, license attribute will be completed
License.getStudent(params.license, function(err, s) { License.getStudent(params.license, function(err, s) {
...@@ -462,16 +463,18 @@ module.exports = { ...@@ -462,16 +463,18 @@ module.exports = {
* @param {response} {} * @param {response} {}
*/ */
unlink_supervisor: function (req, res) { unlink_supervisor: function (req, res) {
var params = req.allParams();
StuSup.findOne({ StuSup.findOne({
student: req.param('id_stu'), student: params.id_stu,
supervisor: req.param('id_sup') supervisor: params.id_sup
}) })
.populate('supervisor') .populate('supervisor')
.then((stuSup) => { .then((stuSup) => {
if (!stuSup) if (!stuSup)
throw new Error("student and supervisor are not linked"); throw new Error("student and supervisor are not linked");
return [stuSup, Student.findOne(req.params.id_stu).populate('license')]; return [stuSup, Student.findOne(params.id_stu).populate('license')];
}) })
.spread((stuSup, student) => { .spread((stuSup, student) => {
...@@ -502,7 +505,7 @@ module.exports = { ...@@ -502,7 +505,7 @@ module.exports = {
var subject = sails.__({ var subject = sails.__({
phrase: 'notification_from_pictogram', phrase: 'notification_from_pictogram',
locale: params.lang || 'es-es' locale: supervisor.lang || 'es-es'
}); });
console.log("-->" + message); console.log("-->" + message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment