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

documentation

parent 3926774d
No related branches found
No related tags found
No related merge requests found
......@@ -4,8 +4,19 @@ import("system.vars");
////when available: this should be outsourced within the Address_entity
//till then: keep entity specific Code here
/**
* Methods used by the AddressEntity.
* Do not create an instance of this!
*
* @class
*/
function AddressEntityValidation(){}
/**
* check if the field, this function is called in is a mandatory field of the country
*
* @return {Boolean}
*/
AddressEntityValidation.isMandatoryField = function()
{
var fieldName = vars.get("$this.name").replace(/^\$?field\./, "");
......@@ -17,6 +28,11 @@ AddressEntityValidation.isMandatoryField = function()
return isMandatory;
};
/**
* return the shorthand for an field name
*
* @return {String} ADDRESS: A, CITY: C, STATE: S, ZIP: Z
*/
AddressEntityValidation.mapFieldToShorthand = function(fieldName)
{
var fieldCode;
......
......@@ -117,6 +117,8 @@ AttributeUtil.setAttribute = function ()
* easier. You probaly won't need this for anything else.
*
* @param {String} pAttrId the id of the attribute
*
* @class
*/
function AttributeHandler (pAttrId) //TODO: find out if this class is necessary, maybe there is a more elegant solution, this could also be static
{
......@@ -124,6 +126,9 @@ function AttributeHandler (pAttrId) //TODO: find out if this class is necessar
this._attributeType = null;
}
/**
* Returns a new AttributeHandler for the given Attribute
*/
AttributeHandler.begin = function (pAttrId)
{
return new AttributeHandler(pAttrId);
......@@ -168,6 +173,13 @@ AttributeHandler.prototype.getAttributeContentType = function ()
return AttributeTypes.getContentType(this.getAttributeType());
}
/**
* Sets the value to the AttributeField and also return s the value again.
*
* @param pValue the value
*
* @return {Any} the value
*/
AttributeHandler.prototype.setAttributeValue = function (pValue)
{
var field = "$field." + this.getAttributeField();
......
......@@ -236,7 +236,7 @@ ItemUtils.prototype.roundPrice = function(price) {
* @param {String} productId req UID of root product (selected product)
* @param {String} assignedTo opt UID of parent item
* @param {String} currency opt currency for price list to use
* @param {String} relationId opt contactid for price list to use (custom price list)
* @param {String} contactId opt contactid for price list to use (custom price list)
* @param {String[][]} additionalProductInfo additional product info, which has to be copied from the product. (e.g. INFO field is only used by offer)
* has to be in the form: [["DESTINATION-DB-FIELD", "PRODUCT-DB-FIELD"], ...]
*
......@@ -244,7 +244,7 @@ ItemUtils.prototype.roundPrice = function(price) {
*
* @abstract
*/
ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, currency, relationId, additionalProductInfo) {
ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, currency, contactId, additionalProductInfo) {
if (additionalProductInfo == undefined) { additionalProductInfo = [] }
var insertedItemIds = [];
......@@ -256,8 +256,8 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c
assignedTo = "";
if (currency == undefined)
currency = "";
if (relationId == undefined)
relationId = "";
if (contactId == undefined)
contactId = "";
var rootProdId = productId;
if (rootProdId != "") {
......@@ -269,7 +269,7 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c
columns = columns.concat(additionalProductInfo.map(function(item) {return item[0]}));
var colTypes = db.getColumnTypes(table, columns);
// partsList[rootProdId] = root node
__itemInsertStatement(partsList[rootProdId], assignedTo, currency, relationId);
__itemInsertStatement(partsList[rootProdId], assignedTo, currency, contactId);
if (statements.length > 0)
db.inserts(statements);
......@@ -278,7 +278,7 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c
return insertedItemIds;
//recursive function for building item insert statements
function __itemInsertStatement(partsListObj, assignedTo, currency, relationId) {
function __itemInsertStatement(partsListObj, assignedTo, currency, contactId) {
for (var i = 0; i < partsListObj.ids.length; i++) {
var newid = util.getNewUUID();
self._appendNode(newid, assignedTo);
......@@ -290,7 +290,7 @@ ItemUtils.prototype.insertPartsList = function(columns, productId, assignedTo, c
var prodid = partsList[p2pid].sourceid;
var ProductDetails = ProductUtils.getProductDetails(
prodid,
{ currency: currency, quantity: P2pObject.quantity, relationId: relationId },
{ currency: currency, quantity: P2pObject.quantity, relationId: contactId },
additionalProductInfo.map(function(item) {return item[1]}));
var price = "";
......
......@@ -315,27 +315,45 @@ function OfferItemUtils(pOfferId) {
OfferItemUtils.prototype.constructor = OfferItemUtils;
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.getNetAndVat = function(offeritemIdsToDel) {
return ItemUtils.prototype.getNetAndVat.apply(this, [offeritemIdsToDel]);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.initItemTree = function() {
ItemUtils.prototype.initItemTree.apply(this);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.getItemSum = function(pQuantity, pPrice, pDiscount, pOptional) {
return ItemUtils.prototype.getItemSum.apply(this, [pQuantity, pPrice, pDiscount, pOptional]);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.getItemVAT = function(pQuantity, pPrice, pDiscount, pVAT, pOptional) {
return ItemUtils.prototype.getItemVAT.apply(this, [pQuantity, pPrice, pDiscount, pVAT, pOptional]);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.roundPrice = function(pPrice) {
return ItemUtils.prototype.roundPrice.apply(this, [pPrice]);
}
OfferItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCurrency, pRelationId) {
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCurrency, pContactId) {
this.initItemTree();
var cols = ["OFFERITEMID"
......@@ -352,27 +370,39 @@ OfferItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCu
, "ITEMPOSITION"
, "ITEMSORT"];
return ItemUtils.prototype.insertPartsList.apply(this, [cols, pProductId, pAssignedTo, pCurrency, pRelationId, [["INFO", "INFO"]]]);
return ItemUtils.prototype.insertPartsList.apply(this, [cols, pProductId, pAssignedTo, pCurrency, pContactId, [["INFO", "INFO"]]]);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.deletePartsList = function(pItemId) {
this.initItemTree();
return ItemUtils.prototype.deletePartsList.apply(this, [pItemId]);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.getNextItemSort = function(pIds) {
this.initItemTree();
return ItemUtils.prototype.getNextItemSort.apply(this, [pIds]);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.getNextItemPosition = function(pAssignedTo, pTree, pIds) {
this.initItemTree();
return ItemUtils.prototype.getNextItemPosition.apply(this, [pAssignedTo, pTree, pIds]);
}
/**
* For documentation, see class ItemUtils.
*/
OfferItemUtils.prototype.reOrgItems = function() {
this.initItemTree();
......
......@@ -170,27 +170,45 @@ function OrderItemUtils(pOrderId) {
OrderItemUtils.prototype.constructor = OrderItemUtils;
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.getNetAndVat = function(orderitemIdsToDel) {
return ItemUtils.prototype.getNetAndVat.apply(this, [orderitemIdsToDel]);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.initItemTree = function() {
ItemUtils.prototype.initItemTree.apply(this);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.getItemSum = function(pQuantity, pPrice, pDiscount, pOptional) {
return ItemUtils.prototype.getItemSum.apply(this, [pQuantity, pPrice, pDiscount, pOptional]);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.getItemVAT = function(pQuantity, pPrice, pDiscount, pVAT, pOptional) {
return ItemUtils.prototype.getItemVAT.apply(this, [pQuantity, pPrice, pDiscount, pVAT, pOptional]);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.roundPrice = function(pPrice) {
return ItemUtils.prototype.roundPrice.apply(this, [pPrice]);
}
OrderItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCurrency, pRelationId) {
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCurrency, pContactId) {
this.initItemTree();
var cols = ["SALESORDERITEMID"
......@@ -207,27 +225,39 @@ OrderItemUtils.prototype.insertPartsList = function(pProductId, pAssignedTo, pCu
, "ITEMPOSITION"
, "ITEMSORT"];
return ItemUtils.prototype.insertPartsList.apply(this, [cols, pProductId, pAssignedTo, pCurrency, pRelationId]);
return ItemUtils.prototype.insertPartsList.apply(this, [cols, pProductId, pAssignedTo, pCurrency, pContactId]);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.deletePartsList = function(pItemId) {
this.initItemTree();
return ItemUtils.prototype.deletePartsList.apply(this, [pItemId]);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.getNextItemSort = function(pIds) {
this.initItemTree();
return ItemUtils.prototype.getNextItemSort.apply(this, [pIds]);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.getNextItemPosition = function(pAssignedTo, pTree, pIds) {
this.initItemTree();
return ItemUtils.prototype.getNextItemPosition.apply(this, [pAssignedTo, pTree, pIds]);
}
/**
* For documentation, see class ItemUtils.
*/
OrderItemUtils.prototype.reOrgItems = function() {
this.initItemTree();
......
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