Skip to content
Snippets Groups Projects
Commit 7f5bd637 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon: Committed by Sebastian Listl
Browse files

Ticket #1080137: changed VisitplanEntry from jdito to db recordcontainer....

Ticket #1080137: changed VisitplanEntry from jdito to db recordcontainer. Currently Parent not working need to be discussed.
parent 871fcaa9
No related branches found
No related tags found
No related merge requests found
Showing
with 275 additions and 135 deletions
import("system.result");
import("system.db");
result.object({"VISITPLANENTRY.ENTRYDATE": db.ASCENDING});
\ No newline at end of file
import("system.result");
import("Keyword_lib");
import("KeywordRegistry_basic");
var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.visitPlanEntryStatus(), "VISITPLANENTRY.STATUS");
result.string(sql);
import("system.result");
import("Keyword_lib");
import("KeywordRegistry_basic");
var sql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.visitPlanEntryStatusAppointment(), "visitplanentry.STATUS_APPOINTMENT");
result.string(sql);
\ No newline at end of file
import("Person_lib");
import("Keyword_lib");
import("Contact_lib");
import("Employee_lib");
import("KeywordRegistry_basic");
import("system.calendars");
import("system.datetime");
import("system.translate");
import("system.logging");
import("system.vars");
import("system.db");
import("system.result");
import("Sql_lib");
var items = [];
var group = [];
var entryData = "";
var entrySQL = newSelect("ENTRYDATE, VISITPLANENTRYID, BEGIN_TIME, END_TIME, ORGANISATION_CONTACT_ID, VISITPLANENTRY.CONTACT_ID, STATUS, VISITPLANEMPLOYEEWEEK_ID"
+", APPOINTMENT_ID, STATUS_APPOINTMENT, VISITRECOMMENDATION_ID")
.from("VISITPLANENTRY");
if (vars.exists("$local.idvalues") && vars.get("$local.idvalues"))
{
entrySQL.where("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$local.idvalues"));
}
else if(vars.exists("$param.Entries_param") && vars.get("$param.Entries_param"))
{
entrySQL.where("VISITPLANENTRY.VISITPLANEMPLOYEEWEEK_ID", vars.get("$param.Entries_param"));
}
else if(vars.exists("$param.EntriesofCurrentWeek_param") && vars.get("$param.EntriesofCurrentWeek_param") == "true")
{
var currentWeek = datetime.toLocaleDate(vars.get("$sys.date"), "w");
var currentYear = datetime.toLocaleDate(vars.get("$sys.date"), "yyyy");
var currentUser = EmployeeUtils.getCurrentContactId();
entrySQL.join("VISITPLANEMPLOYEEWEEK", "VISITPLANENTRY.VISITPLANEMPLOYEEWEEK_ID = VISITPLANEMPLOYEEWEEK.VISITPLANEMPLOYEEWEEKID")
.where("VISITPLANEMPLOYEEWEEK.VISITPLAN_WEEK", currentWeek)
.and("VISITPLANEMPLOYEEWEEK.VISITPLAN_YEAR", currentYear)
.and("VISITPLANEMPLOYEEWEEK.CONTACT_ID", currentUser);
}
entrySQL.orderBy("ENTRYDATE, BEGIN_TIME");
entryData = entrySQL.table();
if(entryData.length > 0)
{
for(var i = 0; i < entryData.length; i++)
{
var entryDateRaw, visitPlanEntryId, beginTime, endTime, organisationContactId, contactId, status, visitplanEmployeeWeekId, appointmentid, statusAppointment, visitrecommendation_id;
[entryDateRaw, visitPlanEntryId, beginTime, endTime, organisationContactId, contactId, status, visitplanEmployeeWeekId, appointmentid, statusAppointment, visitrecommendation_id] = entryData[i]
var contactname = ContactUtils.getTitleByContactId(contactId);
var orgname = OrganisationUtils.getNameByContactId(organisationContactId);
var parentName = translate.text(datetime.toLocaleDate(entryDateRaw, "EEEE"));
entryDate = datetime.toLocaleDate(entryDateRaw, "dd.MM.yyyy");
var statusDisplay = KeywordUtils.getViewValue($KeywordRegistry.visitPlanEntryStatus(), status)
var statusAppointmentDisplay = KeywordUtils.getViewValue($KeywordRegistry.visitPlanEntryStatusAppointment(), statusAppointment)
var alias = SqlUtils.getSystemAlias();
items.push([visitPlanEntryId, false, parentName + "#" + entryDate, "", beginTime
, endTime, organisationContactId, orgname, contactId, contactname, entryDateRaw, status, visitplanEmployeeWeekId, appointmentid
, statusDisplay, statusAppointment, statusAppointmentDisplay, visitrecommendation_id]);
if(!vars.get("$local.idvalues"))
{
if(group.indexOf(parentName + "#" + entryDate) == -1)
{
items.push([parentName + "#" + entryDate, true, "", parentName + " " + entryDate, "", "", "", "", "", "", "", "", "", "", "", "", "", ""]);
group.push(parentName + "#" + entryDate);
}
}
}
}
result.object(items);
\ No newline at end of file
import("Sql_lib");
import("system.datetime");
import("system.translate");
import("system.vars");
import("system.db");
import("system.result");
var group = [];
var entryData = "";
var count = 0;
var entrySQL = newSelect("ENTRYDATE").from("VISITPLANENTRY");
if(vars.exists("$param.Entries_param") && vars.get("$param.Entries_param"))
{
entrySQL = newSelect("ENTRYDATE")
.from("VISITPLANENTRY")
.where("VISITPLANENTRY.VISITPLANEMPLOYEEWEEK_ID", vars.get("$param.Entries_param"));
}
if (vars.exists("$local.idvalues") && vars.get("$local.idvalues"))
{
entrySQL.andIfSet("VISITPLANENTRY.VISITPLANENTRYID", vars.get("$local.idvalues"));
}
entrySQL.orderBy("VISITPLANENTRY.ENTRYDATE, VISITPLANENTRY.BEGIN_TIME");
entryData = entrySQL.table();
count += entryData.length;
if(entryData.length > 0)
{
for(var i = 0; i < entryData.length; i++)
{
var parentName = translate.text(datetime.toLocaleDate(entryData[i][0], "EEEE"));
if(!vars.exists("$local.idvalues") || !vars.get("$local.idvalues"))
{
if(group.indexOf(parentName) == -1)
group.push(parentName);
}
}
}
count += group.length;
result.string(count);
......@@ -9307,6 +9307,10 @@ Bitte Datumseingabe prüfen</value>
<key>Open route</key>
<value>Route öffnen</value>
</entry>
<entry>
<key>Open Route of the day</key>
<value>Tagesroute öffnen</value>
</entry>
<entry>
<key>External Work</key>
<value>Aussendienst</value>
......
<?xml version="1.0" encoding="UTF-8"?>
<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1">
<name>VisitPlanEntry</name>
<title>Visitplan Entry</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<mainView>VisitPlanEntryMain_view</mainView>
<filterView>VisitPlanEntryFilter_view</filterView>
<editView>VisitPlanEntryEdit_view</editView>
<previewView>VisitPlanEntryPreview_view</previewView>
<entity>VisitPlanEntry_entity</entity>
<references>
<neonViewReference>
......@@ -14,5 +17,17 @@
<name>9f5ad319-7c06-4161-bbec-581ac86b0a0d</name>
<view>VisitPlanEntryEdit_view</view>
</neonViewReference>
<neonViewReference>
<name>b43d2860-129f-4119-b304-8c8990ff7670</name>
<view>VisitPlanEntryMain_view</view>
</neonViewReference>
<neonViewReference>
<name>47875f73-e1a7-49ba-b356-ff960e63e909</name>
<view>VisitPlanEntryPreview_view</view>
</neonViewReference>
<neonViewReference>
<name>40fdc514-ae39-4c73-971b-0725abb89095</name>
<view>VisitPlanEntryNotice_view</view>
</neonViewReference>
</references>
</neonContext>
......@@ -2,7 +2,7 @@
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
<name>VisitPlanEntryFilter_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<filterable v="false" />
<filterable v="true" />
<dashletConfigurations>
<neonDashletConfiguration>
<name>currentWeek</name>
......@@ -39,6 +39,9 @@
<parentField>PARENT_ID</parentField>
<entityField>#ENTITY</entityField>
<favoriteActionGroup1>entityActionGroup</favoriteActionGroup1>
<defaultGroupFields>
<element>ENTRYDATE</element>
</defaultGroupFields>
<columns>
<neonTreeTableColumn>
<name>d728f2d9-c223-47fd-9372-6f49203f68fd</name>
......
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
<name>VisitPlanEntryMain_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<masterSlaveLayout>
<name>layout</name>
<master>1fc1601c-3616-456f-a2f1-952069aeb040</master>
</masterSlaveLayout>
</layout>
<children>
<neonViewReference>
<name>1fc1601c-3616-456f-a2f1-952069aeb040</name>
<entityField>#ENTITY</entityField>
<view>VisitPlanEntryPreview_view</view>
</neonViewReference>
<neonViewReference>
<name>cfed1f51-be83-42ba-8139-61047732fd34</name>
<entityField>#ENTITY</entityField>
<view>VisitPlanEntryNotice_view</view>
</neonViewReference>
<neonViewReference>
<name>2452553a-fa07-4f77-8a2f-815d7fa03a86</name>
<entityField>Activities</entityField>
<view>ActivityFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>0670493a-00f0-4fbb-bc08-bf145f8fece5</name>
<entityField>Documents</entityField>
<view>DocumentFilter_view</view>
</neonViewReference>
</children>
</neonView>
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
<name>VisitPlanEntryNotice_view</name>
<title>Preparation</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<genericViewTemplate>
<name>Notice</name>
<showDrawer v="true" />
<drawerCaption>Notice</drawerCaption>
<fixedDrawer v="true" />
<hideEmptyFields v="false" />
<fields>
<entityFieldLink>
<name>20cc4c04-2a33-4978-9366-a21d6ca75abd</name>
<entityField>PREPARATION</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.8" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.8">
<name>VisitPlanEntryPreview_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<headerFooterLayout>
<name>layout</name>
<header>Header</header>
</headerFooterLayout>
</layout>
<children>
<cardViewTemplate>
<name>Header</name>
<iconField>icon</iconField>
<titleField>PARENTNAME</titleField>
</cardViewTemplate>
<genericViewTemplate>
<name>Info</name>
<fields>
<entityFieldLink>
<name>dd25d1e4-b986-4e28-8a7f-dc603276252a</name>
<entityField>ORGANISATION_CONTACT_ID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>e8950f3a-edbc-4e30-8c01-aa546195317d</name>
<entityField>CONTACT_ID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>535ebb8b-20d5-43c0-84dd-c4494e6edad9</name>
<entityField>ENTRYDATE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>64f6ef56-d78f-424a-ab06-0540699bb728</name>
<entityField>STATUS</entityField>
</entityFieldLink>
<entityFieldLink>
<name>9ab4666a-19eb-4682-9aad-d780da243aae</name>
<entityField>BEGIN_TIME</entityField>
</entityFieldLink>
<entityFieldLink>
<name>f725bfe9-a7e2-47d6-9139-6e81ee7ac25a</name>
<entityField>END_TIME</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
</neonView>
......@@ -173,6 +173,8 @@ ContextUtils.getContextConsumer = function(pContextId)
return "SupportTickets";
case ContextUtils.getContextName("Activity"):
return "Activities";
case ContextUtils.getContextName("VisitPlanEntry"):
return "VisitPlanEntries";
default:
throw new Error(translate.withArguments("No consumer found for context '%0'", [pContextId]));
}
......@@ -302,20 +304,21 @@ ContextUtils.getContexts = function(pBlacklist, pInvertBlacklist)
else
{
whitelist = new Set()
.add("Organisation")
.add("Person")
.add("PrivatePerson")
.add("Activity")
.add("Salesproject")
.add("Contract")
.add("Offer")
.add("Order")
.add("Product")
.add("Task")
.add("Campaign")
.add("CampaignStep")
.add("SupportTicket")
.add("Leadimport");
.add("Organisation")
.add("Person")
.add("PrivatePerson")
.add("Activity")
.add("Salesproject")
.add("Contract")
.add("Offer")
.add("Order")
.add("Product")
.add("Task")
.add("Campaign")
.add("CampaignStep")
.add("SupportTicket")
.add("Leadimport")
.add("VisitPlanEntry");
if (pBlacklist)
pBlacklist.forEach(whitelist["delete"], whitelist);
......
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
<name>VisitPlanning_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/VisitPlanning_lib/process.js</process>
<restrictedRoles />
<alias>Data_alias</alias>
<variants>
<element>LIBRARY</element>
</variants>
</process>
import("Sql_lib");
import("Employee_lib");
import("system.datetime");
import("system.db");
import("system.text");
import("system.neon");
import("system.vars");
/**
* Methods used for VisitPlannung
* Do not create an instance of this!
*
* @class
*/
function VisitPlanningUtils() {}
/**
* Used by the OpenRoute and OpenDayRoute actions in VisitplanEntry_entity.<br>
*
*
* @param {String} [pIsDayRoute] Opens the route only for one address, otherwise all of selected week and it's date
*
* @return {void} {content: base64-encoded CSV;
* filename: filename}
*
*/
VisitPlanningUtils.openRoute = function (pIsDayRoute)
{
var visitAddresses = [];
var addressIdStart;
var address;
var user = EmployeeUtils.getCurrentContactId();
//start homeaddress
addressIdStart = newSelect("ADDRESSID")
.from("ADDRESS")
.where("ADDRESS.ADDR_TYPE", "HOMEADDR")
.and("ADDRESS.CONTACT_ID", user)
.cell();
if(!addressIdStart)
{
//start orgaddress
var orgID = newSelect("ORGANISATION_ID")
.from("CONTACT")
.where("CONTACT.CONTACTID", user)
.cell();
addressIdStart = newSelect("ADDRESS_ID")
.from("CONTACT")
.where("CONTACT.ORGANISATION_ID", orgID)
.and("CONTACT.PERSON_ID is null")
.cell();
}
var addressStart = "";
if(addressIdStart)
{
addressStart = newSelect("ADDRESS, BUILDINGNO, ZIP, CITY, COUNTRY")
.from("ADDRESS")
.where("ADDRESS.ADDRESSID", addressIdStart)
.arrayRow();
visitAddresses.push(addressStart.join("+"));
}
//address to visit
var selectionRowData = vars.get("$sys.selectionRows");
var isGroup = selectionRowData[0].ISGROUP; //not Bool
var entrydate = selectionRowData[0]["ENTRYDATE"]
var entryid = vars.get("$param.Entries_param");
var cond = newWhere("VISITPLANENTRY.VISITPLANEMPLOYEEWEEK_ID", entryid).and("VISITPLANENTRY.ENTRYDATE", entrydate)
if(!pIsDayRoute)
{
cond = cond.and("VISITPLANENTRY.VISITPLANENTRYID", selectionRowData[0]["VISITPLANENTRYID"]);
}
var childAddresses = newSelect("ADDRESS, BUILDINGNO, ZIP, CITY, COUNTRY")
.from("ADDRESS")
.leftJoin("VISITPLANENTRY", "ADDRESS.ADDRESSID = (select ADDRESS_ID from CONTACT where CONTACT.CONTACTID \n\
= VISITPLANENTRY.ORGANISATION_CONTACT_ID)")
.where(cond)
.and("VISITPLANENTRY.ENTRYDATE", entrydate)
.table();
for(let i = 0; i < childAddresses.length; i++)
{
visitAddresses.push(childAddresses[i].join("+"));
}
visitAddresses.push(addressStart.join("+"));
address = "https://www.google.com/maps/dir/" + visitAddresses.join("/");
neon.openUrl(address, true);
};
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