Skip to content
Snippets Groups Projects
Commit fa1c80d6 authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Merge remote-tracking branch 'origin/2020.2'

parents 4dc3eaa5 6bf09939
No related branches found
No related tags found
No related merge requests found
Showing
with 167 additions and 132 deletions
......@@ -15,7 +15,7 @@
<changeSet dbms="!derby" author="b.ulrich" id="85ba6a61-9318-4118-ac4c-e33730f6581d">
<dropPrimaryKey tableName="DOCUMENTTEMPLATE" constraintName="PK_DOCUMENTTEMPLATE_DOCUMENTTEMPLATEID" dropIndex="true"/>
<dropNotNullConstraint tableName="DOCUMENTTEMPLATE" columnName="DOCUMENTTEMPLATEID"/>
<dropNotNullConstraint tableName="DOCUMENTTEMPLATE" columnName="DOCUMENTTEMPLATEID" columnDataType="VARCHAR(36)"/>
<modifyDataType tableName="DOCUMENTTEMPLATE" columnName="DOCUMENTTEMPLATEID" newDataType="CHAR(36)"/>
<addNotNullConstraint columnName="DOCUMENTTEMPLATEID" tableName="DOCUMENTTEMPLATE" columnDataType="CHAR(36)" validate="true"/>
<addPrimaryKey tableName="DOCUMENTTEMPLATE" constraintName="PK_DOCUMENTTEMPLATE_DOCUMENTTEMPLATEID" columnNames="DOCUMENTTEMPLATEID"/>
......
......@@ -171,11 +171,6 @@
</entityParameter>
<entityConsumer>
<name>AppointmentLinks</name>
<dependency>
<name>dependency</name>
<entityName>AppointmentLink_entity</entityName>
<fieldName>Links</fieldName>
</dependency>
<children>
<entityParameter>
<name>AppointmentId_param</name>
......@@ -187,6 +182,11 @@
<expose v="false" />
</entityParameter>
</children>
<dependency>
<name>dependency</name>
<entityName>AppointmentLink_entity</entityName>
<fieldName>Links</fieldName>
</dependency>
</entityConsumer>
<entityActionField>
<name>deleteSeries</name>
......@@ -254,6 +254,11 @@
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityParameter>
<name>ErrorOnPermissionDenied</name>
<valueProcess>%aditoprj%/entity/Appointment_entity/entityfields/erroronpermissiondenied/valueProcess.js</valueProcess>
<expose v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
import("system.result");
result.string("true");
\ No newline at end of file
......@@ -2,6 +2,10 @@ import("system.vars");
import("system.result");
import("system.calendars");
import("system.text");
import("system.tools");
var owner = text.decodeMS(JSON.parse(vars.get("$param.Entry_param"))["h"])[1].split(":")[1];
result.string(calendars.hasPermission([owner], calendars.VEVENT, "WRITE"));
\ No newline at end of file
var user = tools.getCurrentUser();
var calUser = calendars.getCalendarUser(user["title"]);
var calUserCn = text.decodeMS(calUser)[1].split(":")[1];
result.string(calendars.hasPermission(calUserCn, calendars.VEVENT, "WRITE"));
\ No newline at end of file
......@@ -2,7 +2,13 @@ import("system.vars");
import("system.result");
import("system.calendars");
import("system.text");
import("system.tools");
import("system.logging");
var owner = text.decodeMS(JSON.parse(vars.get("$param.Entry_param"))["h"])[1].split(":")[1];
result.string(calendars.hasPermission([owner], calendars.VEVENT, "WRITE"));
var user = tools.getCurrentUser();
var calUser = calendars.getCalendarUser(user["title"]);
var calUserCn = text.decodeMS(calUser)[1].split(":")[1];
var permitted = calendars.hasPermission(calUserCn, calendars.VEVENT, "WRITE");
result.string(permitted);
import("Calendar_lib");
import("Employee_lib");
import("system.tools");
import("system.db");
......@@ -9,6 +10,7 @@ import("system.datetime");
import("system.eMath");
import("system.util");
import("system.neon");
import("system.text");
var appointmentSelect = newSelect("APPOINTMENT_ID").from("AB_APPOINTMENTLINK");
var appointmentUids;
......@@ -27,14 +29,14 @@ if(vars.exists("$param.Entry_param") && vars.get("$param.Entry_param"))
//@TODO Icon
result.object([
buildEntry(entry, masterEntry)
CalendarUtil.buildEntry(entry, masterEntry)
]);
}
else if(vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW && vars.get("$local.idvalues") != null && vars.get("$local.idvalues") != "")
{
var selectedids = vars.get("$local.idvalues");
result.object([buildEntry(calendars.getEntry(selectedids, null, null), null)]);
result.object([CalendarUtil.buildEntry(calendars.getEntry(selectedids, null, null), null)]);
}
else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param"))
......@@ -42,7 +44,7 @@ else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param"))
var contactid = EmployeeUtils.getCurrentContactId();
appointmentSelect.whereIfSet("AB_APPOINTMENTLINK.OBJECT_ROWID", contactid)
result.object(buildEntriesFromUids(appointmentSelect.table()));
result.object(CalendarUtil.buildEntriesFromUids(appointmentSelect.table()));
}
/**
......@@ -51,78 +53,5 @@ else if(vars.getString("$param.LinkedAppointmentsFromDashlet_param"))
else if(vars.getString("$param.LinkedObjectId_param") != undefined)
{
appointmentSelect.whereIfSet("AB_APPOINTMENTLINK.OBJECT_ROWID", "$param.LinkedObjectId_param")
result.object(buildEntriesFromUids(appointmentSelect.table()));
}
function buildEntriesFromUids(appointmentUids)
{
var entryArray = new Array(appointmentUids.length);
for(var i = 0; i < appointmentUids.length; i++)
entryArray[i] = buildEntry(calendars.getEntry(appointmentUids[i], null, null), null);
return entryArray;
}
function buildEntry(pEntry, pMasterentry)
{
var uid = pEntry[calendars.ID];
var summary = pEntry[calendars.SUMMARY];
var attendees = pEntry[calendars.AFFECTEDUSERS];
var startdate = pEntry[calendars.DTSTART];
var enddate = pEntry[calendars.DTEND];
var links = pEntry[calendars.LINKS];
var description = pEntry[calendars.DESCRIPTION];
if(pEntry[calendars.ORGANIZER2] != undefined)
var organizer = pEntry[calendars.ORGANIZER2]["paramvalue"];
if(pEntry[calendars.USER2] != undefined)
var owner = pEntry[calendars.USER2]["paramvalue"];
var status = pEntry[calendars.STATUS];
var location = pEntry[calendars.LOCATION];
var reminder = pEntry[calendars.REMINDER_DURATION];
var remindercheck = pEntry[calendars.HASREMINDER]
var classification = pEntry[calendars.CLASSIFICATION];
var transparency = pEntry[calendars.TRANSPARENCY];
var categories = pEntry[calendars.CATEGORIES];
var isAllDay = pEntry["X-ADITO-ISALLDAYEVENT"] != null ? pEntry["X-ADITO-ISALLDAYEVENT"] : "FALSE";
var masterBegin = pMasterentry != null ? pMasterentry[calendars.DTSTART] : null
var masterEnd = pMasterentry != null ? pMasterentry[calendars.DTEND] : null
// Recurrence
var recurrenceID = pEntry[calendars.RECURRENCEID];
var rrule = null;
if (pMasterentry != null) { // Entry is a recurrence exception, therefore get rrule from master
rrule = pMasterentry[calendars.RRULE] != null ? pMasterentry[calendars.RRULE][0] : null;
} else {
rrule = pEntry[calendars.RRULE] != null ? pEntry[calendars.RRULE][0] : null;
}
return [
uid,
attendees.length,
startdate,
enddate,
summary,
organizer,
owner,
attendees,
status,
description,
location,
'',
isAllDay,
classification,
transparency,
categories,
reminder,
remindercheck,
rrule,
recurrenceID,
null,
masterBegin,
masterEnd,
null
];
result.object(CalendarUtil.buildEntriesFromUids(appointmentSelect.table()));
}
import("system.logging");
import("Sql_lib");
import("system.neon");
import("system.calendars");
import("system.vars");
if (vars.exists("$param.Entry_param"))
var uid;
if (vars.get("$param.Entry_param") != null)
{
var entry = JSON.parse(vars.getString("$param.Entry_param"));
var reccurenceid = entry[calendars.RECURRENCEID];
if (reccurenceid == undefined)
reccurenceid = null;
calendars.removeEntryByUID(calendars.VEVENT, entry[calendars.USER2]["cn"], entry[calendars.ID], reccurenceid)
uid = entry[calendars.ID];
calendars.removeEntryByUID(calendars.VEVENT, entry[calendars.USER2]["cn"], uid, reccurenceid);
}
else if(vars.get("$field.OWNER"))
{
uid = vars.get("$field.UID");
calendars.removeEntryByUID(calendars.VEVENT, JSON.parse(vars.get("$field.OWNER"))["cn"], uid, vars.get("$field.RECURRENCEID"));
}
/**
* Deletes ApointmentLinks referring to the deleted Appointment.
*/
newWhereIfSet("AB_APPOINTMENTLINK.APPOINTMENT_ID", entry[calendars.ID])
.deleteData();
}
\ No newline at end of file
newWhereIfSet("AB_APPOINTMENTLINK.APPOINTMENT_ID", uid)
.deleteData();
\ No newline at end of file
import("Calendar_lib");
import("system.db");
import("Employee_lib");
import("Sql_lib");
......@@ -5,7 +6,7 @@ import("system.vars");
import("system.result");
var rowCount = "0";
var cond = newSelect("count(APPOINTMENT_ID)")
var cond = newSelect("APPOINTMENT_ID")
.from("AB_APPOINTMENTLINK");
if (vars.exists("$local.idvalues") && vars.get("$local.idvalues"))
......@@ -13,7 +14,7 @@ if (vars.exists("$local.idvalues") && vars.get("$local.idvalues"))
else if (vars.getString("$param.LinkedAppointmentsFromDashlet_param"))
{
cond.whereIfSet("AB_APPOINTMENTLINK.OBJECT_ROWID", EmployeeUtils.getCurrentContactId());
rowCount = cond.cell();
rowCount = CalendarUtil.countEntriesFromUids(cond.table());
}
/**
......@@ -22,7 +23,7 @@ else if (vars.getString("$param.LinkedAppointmentsFromDashlet_param"))
else if (vars.getString("$param.LinkedObjectId_param") != undefined)
{
cond.whereIfSet("AB_APPOINTMENTLINK.OBJECT_ROWID", "$param.LinkedObjectId_param");
rowCount = cond.cell();
rowCount = CalendarUtil.countEntriesFromUids(cond.table());
}
/**
* Will be used, if the user is operating the calendar.
......
......@@ -121,6 +121,13 @@
<iconId>VAADIN:BAN</iconId>
<tooltipProcess>%aditoprj%/entity/BulkMailRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/tooltipProcess.js</tooltipProcess>
</entityActionField>
<entityActionField>
<name>startMarketingWorkflows</name>
<title>Start marketing mailing</title>
<onActionProcess>%aditoprj%/entity/BulkMailRecipient_entity/entityfields/recipientactions/children/startmarketingworkflows/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<iconId>VAADIN:ENVELOPES</iconId>
</entityActionField>
</children>
</entityActionGroup>
<entityField>
......
import("Util_lib");
import("system.entities");
import("Context_lib");
import("system.vars");
import("system.neon");
var rows = vars.get("$sys.selectionRows");
var filter = vars.get("$sys.filter").filter;
var targets = [];
if (Utils.isNullOrEmpty(rows))
{
let loadConfig = entities.createConfigForLoadingRows()
.entity("BulkMailRecipient_entity")
.provider("BulkMailRecipients")
.fields(["CONTACT_ID", "TARGETCONTEXT"])
.addParameter("BulkMailId_param", vars.get("$param.BulkMailId_param"));
if (filter)
loadConfig.filter(JSON.stringify(filter));
rows = entities.getRows(loadConfig);
}
rows = rows.map(function (row)
{
return [row["CONTACT_ID"], row["TARGETCONTEXT"]];
});
neon.openContext("MarketingWorkflowLauncher", "MarketingWorkflowLauncherEdit_view", null, neon.OPERATINGSTATE_VIEW, {
"ObjectIds_param": JSON.stringify(rows),
"ObjectType_param": ContextUtils.getCurrentContextId()
});
\ No newline at end of file
......@@ -5,5 +5,5 @@ import("system.db");
import("system.result");
var commRestrictionCond = ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$mail());
var sql = "case when (" + commRestrictionCond.toString() + ") then 'true' else 'false' end";
result.string(sql);
var sql = SqlBuilder.caseWhen(commRestrictionCond).thenString("true").elseString("false");
result.string(sql.toString());
import("Sql_lib");
import("Contact_lib");
import("system.translate");
import("system.db");
import("Bulkmail_lib");
import("system.result");
import("Keyword_lib");
import("KeywordRegistry_basic");
var commRestrictionCond = ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$mail()).build();
var commRestrictionCond = ContactUtils.getCommRestrictionCondition($KeywordRegistry.communicationMediumCampaign$mail());
var keywordSql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.bulkMailRecipientStatus(), "BULKMAILRECIPIENT.STATUS");
// TODO: is prepared possible?
var sql = "case when (" + SqlUtils.translateStatementWithQuotes(commRestrictionCond)
+ ") then '" + translate.text("Advertising ban")
+ "' else (" + keywordSql + ") end";
result.string(sql);
var sql = SqlBuilder.caseWhen(commRestrictionCond).thenString(translate.text("Advertising ban")).elseValue(keywordSql);
result.string(sql.toString());
import("Sql_lib");
import("Context_lib");
import("system.result");
// TODO: is prepared possible?
result.string("case when PERSON_ID is null then '" + ContextUtils.getContextName("Organisation")
+ "' when CONTACT.ORGANISATION_ID is not null and CONTACT.PERSON_ID is not null then '" + ContextUtils.getContextName("Person")
+ "' else '' end");
\ No newline at end of file
var sql = SqlBuilder.caseWhen("PERSON_ID is null").thenString(ContextUtils.getContextName("Organisation"))
.when(newWhere("CONTACT.ORGANISATION_ID is not null").and("CONTACT.PERSON_ID is not null")).thenString(ContextUtils.getContextName("Person"))
result.string(sql.toString());
\ No newline at end of file
......@@ -177,6 +177,13 @@
<tooltip>Update campaign step</tooltip>
<tooltipProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/setsteptoparticipantselection/tooltipProcess.js</tooltipProcess>
</entityActionField>
<entityActionField>
<name>startMarketingWorkflows</name>
<title>Start marketing mailing</title>
<onActionProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/startmarketingworkflows/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
<iconId>VAADIN:ENVELOPES</iconId>
</entityActionField>
</children>
</entityActionGroup>
<entityField>
......
import("Util_lib");
import("system.entities");
import("Context_lib");
import("system.vars");
import("system.neon");
var rows = vars.get("$sys.selectionRows");
var filter = vars.get("$sys.filter").filter;
var targets = [];
if (Utils.isNullOrEmpty(rows))
{
let loadConfig = entities.createConfigForLoadingRows()
.entity("CampaignParticipant_entity")
.provider("CampaignParticipantsProvider")
.fields(["CONTACT_ID", "CONTACTCONTEXT"])
.addParameter("CampaignId_param", vars.get("$param.CampaignId_param"))
.addParameter("CampaignStepId_param", vars.get("$param.CampaignStepId_param"))
.addParameter("ContactId_param", vars.get("$param.ContactId_param"));
if (filter)
loadConfig.filter(JSON.stringify(filter));
rows = entities.getRows(loadConfig);
}
rows = rows.map(function (row)
{
return [row["CONTACT_ID"], row["CONTACTCONTEXT"]];
});
neon.openContext("MarketingWorkflowLauncher", "MarketingWorkflowLauncherEdit_view", null, neon.OPERATINGSTATE_VIEW, {
"ObjectIds_param": JSON.stringify(rows),
"ObjectType_param": ContextUtils.getCurrentContextId()
});
\ No newline at end of file
......@@ -7,19 +7,11 @@ import("Sql_lib");
var recordState = vars.get("$sys.recordstate");
var condition = newWhere();
if(vars.get("$param.ShowOnlyCurrentUsersCampaigns_param") == 'true')
{
//TODO: use a preparedCondition (.build instead of .translate) when available #1030812 #1034026
result.string(newWhere("CAMPAIGN.EMPLOYEE_CONTACT_ID", EmployeeUtils.getCurrentContactId()).toString());
} else if (recordState != neon.OPERATINGSTATE_NEW && recordState != neon.OPERATINGSTATE_EDIT) {
var condition = new SqlBuilder()
.whereIfSet("STEPDATESTART_TABLEALIAS.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID")
.andIfSet("STEPDATEEND_TABLEALIAS.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID")
;
condition.and("CAMPAIGN.EMPLOYEE_CONTACT_ID", EmployeeUtils.getCurrentContactId());
}
result.string(condition.toString());
} else {
result.string(newWhere().toString());
}
\ No newline at end of file
result.string(condition.toString());
\ No newline at end of file
......@@ -7,10 +7,11 @@ var recordState = vars.get("$sys.recordstate");
var res = "CAMPAIGN";
if (recordState != neon.OPERATINGSTATE_NEW && recordState != neon.OPERATINGSTATE_EDIT) {
var subSelectDateStart = "(select min(DATE_START) as STEPDATESTART_ALIAS, CAMPAIGN_ID from CAMPAIGNSTEP group by CAMPAIGN_ID) as STEPDATESTART_TABLEALIAS";
var subSelectDateEnd = "(select max(DATE_END) as STEPDATEEND_ALIAS, CAMPAIGN_ID from CAMPAIGNSTEP group by CAMPAIGN_ID) as STEPDATEEND_TABLEALIAS";
res += ", " + subSelectDateStart + ", " + subSelectDateEnd;
res += " join (select min(DATE_START) as STEPDATESTART_ALIAS, CAMPAIGN_ID from CAMPAIGNSTEP group by CAMPAIGN_ID) STEPDATESTART_TABLEALIAS"
+ " on STEPDATESTART_TABLEALIAS.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID "
+ " join (select max(DATE_END) as STEPDATEEND_ALIAS, CAMPAIGN_ID from CAMPAIGNSTEP group by CAMPAIGN_ID) STEPDATEEND_TABLEALIAS"
+ " on STEPDATEEND_TABLEALIAS.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID ";
}
result.string(res);
import("Context_lib");
import("Sql_lib");
import("system.vars");
import("system.result");
//!LibFunction
var cond = newWhere(null, newSelect("ACTIVITYLINK.OBJECT_ROWID").from("ACTIVITYLINK")
.join("ACTIVITY", newWhere("ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID")
.and("ACTIVITYLINK.OBJECT_TYPE", ContextUtils.getCurrentContextId()))
.where(vars.get("$local.condition")), SqlBuilder.EXISTS());
var from = "ACTIVITYLINK join ACTIVITY on ACTIVITY.ACTIVITYID = ACTIVITYLINK.ACTIVITY_ID and ACTIVITYLINK.OBJECT_TYPE = 'Campaign'";
result.string("CAMPAIGNID in (select ACTIVITYLINK.OBJECT_ROWID from " + from + " where " + vars.get("$local.condition")+ ")");
\ No newline at end of file
result.string(cond.toString());
\ No newline at end of file
......@@ -178,7 +178,7 @@ function _update()
}
}
cond = newWhereIfSet("CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID = '" + text.decodeMS(uid)[1] + "'");
cond = newWhereIfSet("CLASSIFICATIONTYPE.CLASSIFICATIONTYPEID", text.decodeMS(uid)[1]);
columns.push("SCORETYPE");
values.push(vars.get("$field.CLASSIFICATIONTYPEIDDISPLAYVALUE"));
cond.updateData(true, table, columns, null, values);
......@@ -195,13 +195,13 @@ function _update()
.where("CLASSIFICATIONGROUP.CLASSIFICATIONGROUPID", id)
.cell();
cond = newWhereIfSet("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID = '" + classificationGroupId + "'");
cond = newWhereIfSet("CLASSIFICATIONTYPE.CLASSIFICATIONGROUP_ID", classificationGroupId);
var groupTable = "CLASSIFICATIONGROUP";
var groupColumns = ["SORTING", "TITLE"];
var groupName = rowdata["CLASSIFICATIONGROUP.value"] == classificationGroupId ? rowdata["CLASSIFICATIONGROUP.displayValue"] : rowdata["CLASSIFICATIONGROUP.value"];
var groupValues = [vars.get("$field.SORTING"), groupName];
var groupCond = newWhereIfSet("CLASSIFICATIONGROUP.CLASSIFICATIONGROUPID = '" + classificationGroupId + "'");
var groupCond = newWhereIfSet("CLASSIFICATIONGROUP.CLASSIFICATIONGROUPID", classificationGroupId);
groupCond.updateData(true, groupTable, groupColumns, null, groupValues);
}
}
\ No newline at end of file
import("system.result");
import("Context_lib");
result.string(ContextUtils.getNameSubselectSql("OBJECT_TYPE", "OBJECT_ROWID"))
\ No newline at end of file
result.string(ContextUtils.getNameSubselectSql("COMPETITION.OBJECT_TYPE", "COMPETITION.OBJECT_ROWID"))
\ 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