From 45ea78a25d4461e546b7a9eac6e9a714281aabdd Mon Sep 17 00:00:00 2001 From: "j.goderbauer" <j.goderbauer@adito.de> Date: Tue, 29 Oct 2019 13:54:14 +0100 Subject: [PATCH] fix #1042973: ignore private organisations for standard address check --- process/Organisation_lib/process.js | 24 ++++++++++++++++++++++++ process/StandardObject_lib/process.js | 3 +++ 2 files changed, 27 insertions(+) diff --git a/process/Organisation_lib/process.js b/process/Organisation_lib/process.js index d173872ccf0..a5500b24646 100644 --- a/process/Organisation_lib/process.js +++ b/process/Organisation_lib/process.js @@ -20,6 +20,30 @@ import("KeywordRegistry_basic"); */ function OrgUtils() {} +/** + * checks if a organisationid is the id of the dummy organisation "private" + * + * @param {String} pOrganisationId the id that shall be checked + * + * @return {boolean} true if passed organisationid is organisationid of the dummy organisation "private" + */ +OrgUtils.isPrivateOrganisationId = function(pOrganisationId) +{ + //TODO: use this function everywhere instead of manual checks + return pOrganisationId.trim() == OrgUtils.getPrivateOrganisationId(); +} + +/** + * returns the image for a organisation + * + * @return {String} hard coded organisationid of the dummy organisation "private" + */ +OrgUtils.getPrivateOrganisationId = function() +{ + //TODO: use this function everywhere instead of hardcoded organisationids "0" + return "0"; +} + /** * returns the image for a organisation * diff --git a/process/StandardObject_lib/process.js b/process/StandardObject_lib/process.js index 772d1e21ee1..5e8a368ff6f 100644 --- a/process/StandardObject_lib/process.js +++ b/process/StandardObject_lib/process.js @@ -1,3 +1,4 @@ +import("Organisation_lib"); import("system.db"); import("Keyword_lib"); import("KeywordRegistry_basic"); @@ -227,6 +228,8 @@ StandardObject.prototype._setContactStandardAddress = function (pAddressID, pCon * @return Standard address of the organisation or null. */ StandardObject.prototype._getCompanyStandardAddress = function (pOrganisationID) { + if (OrgUtils.isPrivateOrganisationId(pOrganisationID)) + return null; var addressIdResult = db.cell("select ADDRESS_ID from CONTACT" + " where ORGANISATION_ID = '" + pOrganisationID + "'" + " and ADDRESS_ID is not null and PERSON_ID is null"); -- GitLab