Something went wrong on our end
-
Johannes Hörmann authoredJohannes Hörmann authored
onValidation.js 1.09 KiB
import("Product_lib");
import("system.translate");
import("system.result");
import("Date_lib");
import("system.vars");
var messages = "";
var startDate = vars.get("$field.VALID_FROM");
var endDate = vars.get("$field.VALID_TO");
if (!DateUtils.validateBeginnBeforeEnd(startDate, endDate))
messages += DateUtils.getValidationFailString();
var priceList = {
priceList: vars.get("$field.PRICELIST"),
priceListId: vars.get("$field.PRODUCTPRICEID"),
fromQuantity: vars.get("$field.FROMQUANTITY"),
buySell: vars.get("$field.BUYSELL"),
vat: vars.get("$field.VAT"),
currency: vars.get("$field.CURRENCY"),
validFrom: vars.get("$field.VALID_FROM"),
validTo: vars.get("$field.VALID_TO")
};
var identicalPriceList = ProductUtils.checkForIndenticalPriceLists(vars.get("$field.PRODUCT_ID"), priceList);
if(identicalPriceList != null)
{
if (messages)
messages += "\n";
messages += translate.text("Identical price list found!");
}
if (messages)
result.string(messages)