Skip to content
Snippets Groups Projects
Commit 4643057d authored by Johannes Hörmann's avatar Johannes Hörmann Committed by Sophia Leierseder
Browse files

Offer preset address with default address

parent c87e5709
No related branches found
No related tags found
No related merge requests found
......@@ -359,9 +359,12 @@
<title>Choose address</title>
<consumer>PossibleAddresses</consumer>
<stateProcess>%aditoprj%/entity/Offer_entity/entityfields/chosenaddress/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/Offer_entity/entityfields/chosenaddress/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/chosenaddress/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js</onValueChange>
<onValueChangeTypes>
<element>MASK</element>
<element>PROCESS</element>
</onValueChangeTypes>
</entityField>
<entityConsumer>
......
import("system.vars");
import("PostalAddress_lib");
import("system.result");
result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$this.value")))
\ No newline at end of file
import("Contact_lib");
import("system.result");
import("system.neon");
import("system.vars");
if ((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && !vars.get("$field.ADDRESS"))
{
var defaultAddressId = ContactUtils.getDefaultAddressId(vars.get("$field.CONTACT_ID"));
if (defaultAddressId)
result.string(defaultAddressId);
}
\ No newline at end of file
......@@ -332,6 +332,17 @@ ContactUtils.getFullContactString = function()
+ " left join ADDRESS on ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID";
}
/**
* get the addressid of the default address
*
* @return {String} the ID or "" if no default address exists
*/
ContactUtils.getDefaultAddressId = function(pContactId)
{
return db.cell(SqlCondition.begin().andPrepare("CONTACT.CONTACTID", pContactId)
.buildSql("select ADDRESS_ID from CONTACT", "1=2"));
}
/**
* object for handling of a single contact
* provides static- and instance-functions
......
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