Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
10c0dae0
authored
Feb 21, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fixed issue #951
parent
a1506b4d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
sails/src/api/controllers/SupervisorController.js
sails/src/api/controllers/SupervisorController.js
View file @
10c0dae0
...
@@ -260,7 +260,8 @@ module.exports = {
...
@@ -260,7 +260,8 @@ module.exports = {
*/
*/
create
:
function
(
req
,
res
)
{
create
:
function
(
req
,
res
)
{
var
params
=
req
.
params
.
all
();
var
params
=
req
.
params
.
all
();
var
supervisor
;
// Send email confirmation
// Send email confirmation
function
sendConfirmationMail
(
cb
)
{
function
sendConfirmationMail
(
cb
)
{
...
@@ -316,6 +317,8 @@ module.exports = {
...
@@ -316,6 +317,8 @@ module.exports = {
if
(
!
sup
)
if
(
!
sup
)
return
res
.
serverError
(
"Supervisor created but returned null"
);
return
res
.
serverError
(
"Supervisor created but returned null"
);
supervisor
=
sup
;
if
(
params
.
role
===
'therapist_office'
||
params
.
role
===
'tutor_office'
)
{
if
(
params
.
role
===
'therapist_office'
||
params
.
role
===
'tutor_office'
)
{
sendConfirmationMail
((
err
)
=>
{
sendConfirmationMail
((
err
)
=>
{
if
(
err
)
throw
err
;
if
(
err
)
throw
err
;
...
@@ -327,16 +330,17 @@ module.exports = {
...
@@ -327,16 +330,17 @@ module.exports = {
.
then
((
off
)
=>
{
.
then
((
off
)
=>
{
// link supervisor with office
// link supervisor with office
console
.
log
(
"supervisor: \n"
+
JSON
.
stringify
(
sup
ervisor
));
console
.
log
(
"supervisor: \n"
+
JSON
.
stringify
(
sup
));
sup
.
id_off
=
off
.
id
;
sup
.
id_off
=
off
.
id
;
delete
sup
.
password
;
delete
sup
.
password
;
sup
.
save
();
sup
.
save
();
console
.
log
(
"supervisor: \n"
+
JSON
.
stringify
(
sup
ervisor
));
console
.
log
(
"supervisor: \n"
+
JSON
.
stringify
(
sup
));
// set supervisor as admin in the office
// set supervisor as admin in the office
off
.
admin
=
sup
ervisor
.
id
;
off
.
admin
=
sup
.
id
;
off
.
save
();
off
.
save
();
supervisor
=
sup
;
sendConfirmationMail
((
err
)
=>
{
sendConfirmationMail
((
err
)
=>
{
if
(
err
)
throw
err
;
if
(
err
)
throw
err
;
return
res
.
ok
();
return
res
.
ok
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment