Skip to content
Snippets Groups Projects
Commit 42432f21 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

dummy address-lib

parent 3a2529fd
No related branches found
No related tags found
No related merge requests found
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet author="j.goderbauer" id="b8adb18b-ecc9-439b-a0bd-df86e63a413f">
<changeSet author="j.goderbauer" id="b77db18b-ecc9-439b-a0bd-df86e63a413f">
<insert tableName="ADDRESS">
<column name="ADDRESSID" value="97d37aea-d7f8-4436-bb31-875439f5f7f1"/>
<column name="USER_NEW" value="Raphael"/>
......@@ -8,11 +8,11 @@
<column name="RELATION_ID" value="bdb6e38a-b227-455b-ae48-f8febd622e03"/>
<column name="ADDR_TYPE" valueNumeric="1"/>
<column name="ADDRESS" value="Lille &#216;vregaten"/>
<column name="ADDRESS" value="Musterstraße"/>
<column name="BUILDINGNO" value="9"/>
<column name="ZIP" value="5018"/>
<column name="CITY" value="Bergen"/>
<column name="COUNTRY" value="NO"/>
<column name="COUNTRY" value="DE"/>
</insert>
<rollback>
......
......@@ -19,6 +19,7 @@
<column name="ORG_ID" value="b219b58a-f120-42d8-9a64-0b176501eac7"/>
<column name="LANGUAGE" value="de-DE"/>
<column name="STATUS" valueNumeric="1"/>
<column name="ADDRESS_ID" value="14d03432-985b-4efe-a634-da71ae482907"/>
</insert>
<insert tableName="COMM">
<column name="DATE_NEW" valueDate="2018-07-02T00:00:00"/>
......
......@@ -25,6 +25,7 @@
<include file="struct/create_salesorderitem.xml"/>
<include file="struct/create_countryinfo.xml"/>
<include file="struct/create_timetracking.xml"/>
<include file="data/example_address/1535612802325_addresses.xml"/>
<include file="data/example_org/ORG_privat.xml"/>
<include file="data/example_org/ORG_gfk.xml"/>
<include file="data/example_org/ORG_mnf.xml"/>
......
<?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.1.7" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.1.7">
<name>Address_lib</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/Address_lib/process.js</process>
</process>
import("system.logging");
import("Relation_lib");
import("Sql_lib");
import("system.db");
/**
* Methods for adresses.
* Todo: evtl. übernahme / anpassung der Adresslib aus altem Basic. 1030856
*
* Do not create an instance of this!
*
* @class
*/
function AddressUtils() {}
/**
* Returns the formatted standard address for the relation.
*
* TODO: Dummy method! Übernahme der Adresslib aus altem Basic
*
* @return {String}
*/
AddressUtils.getAddress = function(pRelationId) {
var address = db.array(db.ROW, SqlCondition.begin().andPrepare("RELATION.RELATIONID", pRelationId).buildSelect('select RELATIONID, ADDRESS, BUILDINGNO, ZIP, CITY, "NAME", FIRSTNAME, LASTNAME, TITLE from' + RelationUtils.getFullRelationFromString(), "1=0"));
// TODO: currently there are some relations without standard address. Use Hardcoded one.
if (!address[1]) {
var dummyAddress = db.array(db.ROW, SqlCondition.begin().andPrepare("ADDRESS.ADDRESSID", '97d37aea-d7f8-4436-bb31-875439f5f7f1').buildSelect('select ADDRESS, BUILDINGNO, ZIP, CITY from ADDRESS', "1=0"));
address[1] = dummyAddress[0];
address[2] = dummyAddress[1];
address[3] = dummyAddress[2];
address[4] = dummyAddress[3];
}
var type = RelationUtils.getRelationTypeByRelation(pRelationId);
var resultAddr = "";
// 1 if organisation <br>
// 2 if privat person <br>
// 3 if person of an organisation <br>*/
switch (type)
{
case 1:
resultAddr = address[5] + "\n" + address[1] + " " + address[2] + "\n" + address[3] + " " + address[4];
break;
case 2:
resultAddr = address[8] + " " + address[6] + " " + address[7] + "\n" + address[1] + " " + address[2] + "\n" + address[3] + " " + address[4];
break;
case 3:
resultAddr = address[5] + "\n" + address[6] + " " + address[7] + "\n" + address[1] + " " + address[2] + "\n" + address[3] + " " + address[4];
break;
}
return resultAddr;
}
/**
* Returns a letter salutation.
*
* TODO: Dummy method! Übernahme der Adresslib aus altem Basic
*
* @return {String}
*/
AddressUtils.getLetterSalutation = function() {
return "Sehr geehrte Damen und Herren";
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import("Keyword_lib");
import("Product_lib");
import("Report_lib");
import("OfferOrder_lib");
import("Address_lib");
/**
* Methods used by Offer.
......@@ -183,9 +184,11 @@ OfferUtils.openOfferReport = function(pOfferID)
params["Gesamt"] = translate.text("Gesamt", language);
params["Summe"] = translate.text("Summe", language);
params["zzglUMST"] = translate.text("zzgl. Summe UmSt", language);
params["OFFERAddr"] = rptdata[0][0];
// TODO: OFFER.ADDRESS
params["OFFERAddr"] = AddressUtils.getAddress(relid).toString() + ","; //rptdata[0][0];
// TODO: AddrObject implementieren
params["OFFERPers"] = ""; //addrobj.formatAddress("{ls},");
params["OFFERPers"] = AddressUtils.getLetterSalutation().toString(); //addrobj.formatAddress("{ls},");
// TODO: payment / delivery-Terms implement (if needed)
params["OFFERPay"] = ""//getKeyName(rptdata[0][3] , "PAYMENTTERMS", "KEYNAME1", language);
......
......@@ -169,13 +169,13 @@ RelationUtils.getNameByPersOrgWithRelationId = function(pRelationId)
*/
RelationUtils.getFullRelationFromString = function()
{
return "RELATION join ORG on ORG.ORGID = RELATION.ORG_ID"
return " RELATION join ORG on ORG.ORGID = RELATION.ORG_ID"
+ " left join PERS on PERS.PERSID = RELATION.PERS_ID"
+ " left join ADDRESS on ADDRESS.ADDRESSID = RELATION.ADDRESS_ID";
}
/**
* returns the from string for the relation joined with org, pers, address
* returns the select string for the relation joined with org, pers, address
*
* @param {String} pIdField field used as id
*
......@@ -186,7 +186,9 @@ RelationUtils.getFullRelationSelectString = function(pIdField)
if(pIdField == undefined)
pIdField = "RELATIONID";
return pIdField + ","
+ concat( [ concat(["SALUTATION", "TITLE", "FIRSTNAME", "LASTNAME"]) , "ORGNAME"], " - " ) + " as anzeige, "
+ "CUSTOMERCODE, ORGNAME, ZIP, CITY, TITLE, FIRSTNAME, LASTNAME, RELTITLE";
var maskingUtils = new SqlMaskingUtils();
return " " + pIdField + ","
+ maskingUtils.concat( [ maskingUtils.concat(["SALUTATION", "TITLE", "FIRSTNAME", "LASTNAME"]) , "NAME"], " - " ) + " as anzeige, "
+ "CUSTOMERCODE, NAME, ZIP, CITY, TITLE, FIRSTNAME, LASTNAME ";
}
\ 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