PMCORE-4087

This commit is contained in:
Luciana Nuñez
2022-12-08 10:36:44 -04:00
parent ba46102738
commit 0d08c371fe
6 changed files with 52 additions and 7 deletions

View File

@@ -146,7 +146,7 @@ export default {
let that = this;
this.data.userSelected = this.userSelected;
this.data.reasonAssign = this.reasonAssign;
this.notifyUser = this.notifyUser;
this.data.notifyUser = this.notifyUser;
api.cases.assignCase(this.data).then((response) => {
if (response.statusText == "OK" || response.status === 200) {
that.$refs["modal-assign-case"].hide();

View File

@@ -150,7 +150,7 @@ export default {
let that = this;
this.data.userSelected = this.userSelected;
this.data.reasonReassign = this.reasonReassign;
this.notifyUser = this.notifyUser;
this.data.notifyUser = this.notifyUser;
if (!this.data.FLAG){
api.cases.reassingCase(this.data).then((response) => {
if (response.statusText == "OK" || response.status === 200) {

View File

@@ -2533,6 +2533,12 @@ msgstr "Assign group to"
msgid "Assign Manager To Department"
msgstr "Assign Manager To Department"
# TRANSLATION
# LABEL/ID_ASSIGN_NOTIFICATION
#: LABEL/ID_ASSIGN_NOTIFICATION
msgid "You were assigned to case #{0}."
msgstr "You were assigned to case #{0}."
# TRANSLATION
# LABEL/ID_ASSIGN_ROLE
#: LABEL/ID_ASSIGN_ROLE

View File

@@ -57226,6 +57226,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_ASSIGN_GROUP_TASK','en','Assign Group Task','2015-02-20') ,
( 'LABEL','ID_ASSIGN_GROUP_TO','en','Assign group to','2014-01-15') ,
( 'LABEL','ID_ASSIGN_MANAGER_TO_DEPARTAMENT','en','Assign Manager To Department','2014-10-21') ,
( 'LABEL','ID_ASSIGN_NOTIFICATION','en','You were assigned to case #{0}.','2022-12-08') ,
( 'LABEL','ID_ASSIGN_ROLE','en','Assign user','2014-01-15') ,
( 'LABEL','ID_ASSIGN_RULES','en','Error: There is a problem with the next tasks of this process. One of them has manual assignment. Manual assignment shouldn''t be used with sub-processes','2015-02-24') ,
( 'LABEL','ID_ASSIGN_SCREEN','en','Assign Screen','2014-01-15') ,

View File

@@ -962,10 +962,7 @@ class Cases
/** Add the note */
if (!empty($reason)) {
$noteContent = $reason;
// Define the Case for register a case note
$cases = new BmCases();
$response = $cases->addNote($appUid, $usrUid, $noteContent, $sendMail);
$this->sendMail($appUid, $usrUid, $reason, $sendMail, $userTarget);
}
// Log
@@ -4059,6 +4056,47 @@ class Cases
return $result;
}
/**
* Send mail to notify and Add a case note
*
* @param string $appUid
* @param string $userUid
* @param string $note
* @param bool $sendMail
* @param string $toUser
*
*/
public function sendMail($appUid, $userUid, $note, $sendMail = false, $toUser = '')
{
$appNumber = ModelApplication::getCaseNumber($appUid);
// Register the note
$attributes = [
"APP_UID" => $appUid,
"APP_NUMBER" => $appNumber,
"USR_UID" => $userUid,
"NOTE_DATE" => date("Y-m-d H:i:s"),
"NOTE_CONTENT" => $note,
"NOTE_TYPE" => "USER",
"NOTE_AVAILABILITY" => "PUBLIC",
"NOTE_RECIPIENTS" => ""
];
$newNote = Notes::create($attributes);
// Send the email
if ($sendMail) {
// Get the FK
$noteId = $newNote->NOTE_ID;
$note = G::LoadTranslation('ID_ASSIGN_NOTIFICATION', [$appNumber]) . '<br />' . G::LoadTranslation('ID_REASON') . ': ' . stripslashes($note);
// Send the notification
$appNote = new AppNotes();
$appNote->sendNoteNotification($appUid, $userUid, $note, $toUser, '', 0, $noteId);
}
}
/**
* Upload file related to the case notes
*

View File

@@ -1086,7 +1086,7 @@ class Cases extends Api
/** Add the note */
if (!empty($reason)) {
$currentUserUid = $this->getUserId();
$cases->addNote($appUid, $currentUserUid, $reason, $sendMail);
$cases->sendMail($appUid, $currentUserUid, $reason, $sendMail, $usrUid);
}
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());