the above is code that i have wriiten in inventtable method
/// <summary>
/// Determines whether data is valid and ready to be written.
/// </summary>
/// <param name="_skipProductVariantUnitConversionValidation">
/// Boolean parameter to determine whether the product variant unit conversion validation must be skipped or not.
/// </param>
/// <returns>
/// Returns true if data is valid; otherwise, false.
/// </returns>
public boolean validateWrite(boolean _skipProductVariantUnitConversionValidation = false)
{
MCRInventTable mcrInventTableLocal;
boolean ret;
RefRecId alternativeProductRecId;
TextBuffer txt = new TextBuffer();
txt.setText(this.ItemId);
txt.regularExpressions(true);
// <GEERU>
#ISOCountryRegionCodes
// </GEERU>
ret = super();
ret = ret && this.checkProjCategoryId();
ret = ret && this.checkInventDimCombination();
// <GEERU>
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoRU]))
{
if (this.isModelGroupSetup())
{
ret = ret && this.modelGroup().inventModelTypeSecCur_RU().validateWriteInventTable(this);
}
if(this.MarkupCode_RU && ! this.isMarkupCodeEnabled_RU() )
{
ret = checkFailed(strFmt("@GLS114518",
enum2str(ItemType::Service)));
}
if (this.AlcoholProductionTypeId_RU)
{
if (! this.AlcoholStrength_RU)
{
ret = checkFailed(strFmt("@GLS103654", "@SYS4002922"));
}
if (! this.AlcoholManufacturerId_RU)
{
ret = checkFailed(strFmt("@GLS103654", "@SYS4002911"));
}
}
if (this.AlcoholStrength_RU < 0 ||
this.AlcoholStrength_RU > 100)
{
ret = checkFailed(strFmt("@GLS106085", "@SYS4002922"));
}
}
// </GEERU>
if (this.isModelGroupSetup())
{
ret = ret && this.modelGroup().inventModelType().validateWriteInventTable(this);
}
// <GBR>
if (BrazilParameters::isEnabled())
{
if(this.isFormDataSource() && this.ItemType == ItemType::Service &&!this.TaxServiceCode_BR)
{
ret = checkFailed (strFmt("@SYS26332", fieldPName(InventTable, TaxServiceCode_BR)));
}
ret = ret && this.checkICMSOnService_BR();
}
// </GBR>
alternativeProductRecId = InventTable::itemProduct(this.AltItemId);
if (alternativeProductRecId)
{
ret = EcoResProductVariantDimValue::newProductVariantDim_InventColorId().checkExist(alternativeProductRecId, this.AltInventColorId) && ret;
ret = EcoResProductVariantDimValue::newProductVariantDim_InventStyleId().checkExist(alternativeProductRecId, this.AltInventStyleId) && ret;
ret = EcoResProductVariantDimValue::newProductVariantDim_InventSizeId().checkExist(alternativeProductRecId, this.AltInventSizeId) && ret;
ret = EcoResProductVariantDimValue::newProductVariantDim_ConfigId().checkExist(alternativeProductRecId, this.AltConfigId) && ret;
}
else
{
if ( this.AltInventColorId
|| this.AltInventStyleId
|| this.AltInventSizeId
|| this.AltConfigId)
{
ret = checkFailed("@SYS308707");
}
}
ret = EcoResProductVariantDimValue::newProductVariantDim_InventColorId().checkExist(this.Product, this.StandardInventColorId) && ret;
ret = EcoResProductVariantDimValue::newProductVariantDim_InventStyleId().checkExist(this.Product, this.StandardInventStyleId) && ret;
ret = EcoResProductVariantDimValue::newProductVariantDim_InventSizeId().checkExist(this.Product, this.StandardInventSizeId) && ret;
ret = EcoResProductVariantDimValue::newProductVariantDim_ConfigId().checkExist(this.Product, this.StandardConfigId) && ret;
// If an item's gross volume or weight is zero, warn the user. The user
// should still be allowed to save the record.
mcrInventTableLocal = this.mcrInventTable();
if (MCRPackingBoxLogic::isPackingBoxLogicEnabled() &&
mcrInventTableLocal.IsPackingBoxable &&
(this.grossVolume() == 0 || this.grossWeight() == 0))
{
warning("@MCR24036");
}
if (ret)
{
ret = this.pdsValidateBestBeforeDays();
if (ret && #PmfEnabled)
{
ret = this.pmfInventProductType().validatePmfProductType();
}
if (ret
&& (this.PmfProductType == PmfProductType::Formula
|| this.PmfProductType == PmfProductType::MainItem)
&& this.PmfYieldPct <= 0)
{
ret = checkFailed(strFmt("@PRO214",fieldLabelValue(tableNum(InventTable), fieldNum(InventTable, PmfYieldPct), "")));
}
if (ret
&& this.PmfProductType == PmfProductType::MainItem
&& this.orig().PmfProductType == PmfProductType::MainItem)
{
ret = this.checkPlanningItemCost();
}
}
if (ret && this.PmfProductType != this.orig().PmfProductType
&& ReqItemTable::pmfExistItemCoverage(this.ItemId))
{
info("@PRO2628");
}
//
//notify the user for the correct quality setup if this
//is a potency item with value registered in quality order
//
this.pdsQualOrdWarning();
// Display a warning if two vendor approval methods are enabled for a single released product.
if (ret
&& this.orig().PdsVendorCheckItem != this.PdsVendorCheckItem
&& this.PdsVendorCheckItem != PdsVendorCheckItem::NoCheck
&& WHSInventEnabled::exist(this.ItemId)
&& WHSParameters::find().EnableVendFilters == NoYes::Yes)
{
warning("@WAX5492");
}
if (this.isFormDataSource()
&& this.dataSource().formRun().args().name() == formStr(EcoResProductDetailsExtended))
{
_skipProductVariantUnitConversionValidation = true;
}
if (ret
&& !_skipProductVariantUnitConversionValidation
&& this.isProductVariantUnitConversionEnabled())
{
ret = this.validateProductVariantUnitConversion();
}
// ret = super();
//04/12
txt.setText(this.ItemId);
txt.regularExpressions(true);
if (txt.find("^[A-Z 0-9]+$"))
{
ret = true;//info("string contains only numbers");
}
else
{
this.ItemId="";
throw error(" Contain the Special Character");
}
return ret;
}