Skip to content
Snippets Groups Projects
Commit 0064af02 authored by dsg03695's avatar dsg03695
Browse files

Ticket #1066033: profile information were collected from the systemalias with...

Ticket #1066033: profile information were collected from the systemalias with the tools functionalities. Correct person will now receive the
notification if he/she was assigned.
parent aa30a97f
No related branches found
No related tags found
No related merge requests found
import("system.tools");
import("system.text"); import("system.text");
import("system.datetime"); import("system.datetime");
import("system.notification"); import("system.notification");
...@@ -423,18 +424,19 @@ DistrictUtils.assignOrganisationToDistrict = function (pOrganisationId, pUserLog ...@@ -423,18 +424,19 @@ DistrictUtils.assignOrganisationToDistrict = function (pOrganisationId, pUserLog
* @return <none> <p> * @return <none> <p>
*/ */
DistrictUtils.notificateNewDistrictContact = function(pDistrictContactId){ DistrictUtils.notificateNewDistrictContact = function(pDistrictContactId){
logging.log(pDistrictContactId);
message = translate.text("Assignment to a new district/company!"); message = translate.text("Assignment to a new district/company!");
//[0]: DISTRICT_ID, [1]: ADVISER_CONTACT_ID, [2]: CONTACT_ID //[0]: DISTRICT_ID, [1]: ADVISER_CONTACT_ID, [2]: CONTACT_ID
var arrayDistrictContact = DistrictUtils.getDataFromDistrictContact(pDistrictContactId); var arrayDistrictContact = DistrictUtils.getDataFromDistrictContact(pDistrictContactId);
logging.log(arrayDistrictContact.length);
//get corresponding profile information of the systemalias
var user = tools.getUserByAttribute(tools.CONTACTID, arrayDistrictContact[1], tools.PROFILE_DEFAULT);
var userName = user[tools.NAME];
var districtName = DistrictUtils.getDistrictName(arrayDistrictContact[0]); var districtName = DistrictUtils.getDistrictName(arrayDistrictContact[0]);
logging.log(districtName);
var organisationName = ContactUtils.getFullTitleByContactId(arrayDistrictContact[2]); var organisationName = ContactUtils.getFullTitleByContactId(arrayDistrictContact[2]);
logging.log(arrayDistrictContact + districtName + organisationName);
// Benachrichtigung am Ende der Zuordnungen // Benachrichtigung am Ende der Zuordnungen
description = translate.withArguments("You were assigned as new district contact to district %0 and organisation %1.", description = translate.withArguments("You were assigned as new district contact to district %0 and organisation %1.",
[districtName, organisationName]) [districtName, organisationName])
notification.addNotification(util.getNewUUID(), text.encodeMS(["Organisation", arrayDistrictContact[2]]), null, null, "DistrictAssigned", notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [user, arrayDistrictContact[1]], message, description); notification.addNotification(util.getNewUUID(), text.encodeMS(["Organisation", arrayDistrictContact[2]]), null, null, "DistrictAssigned", notification.PRIO_NORMAL, 2, notification.STATE_UNSEEN, [userName], message, description);
} }
\ No newline at end of file
import("system.logging");
import("District_lib"); import("District_lib");
import("Loghistory_lib"); import("Loghistory_lib");
import("system.vars"); import("system.vars");
...@@ -25,6 +24,5 @@ if (sqlAction != 'X') ...@@ -25,6 +24,5 @@ if (sqlAction != 'X')
//} //}
if(sqlAction == 'I' && tableName == 'DISTRICTCONTACT'){ if(sqlAction == 'I' && tableName == 'DISTRICTCONTACT'){
logging.log("audit");
DistrictUtils.notificateNewDistrictContact(id); DistrictUtils.notificateNewDistrictContact(id);
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment