Untitled
unknown
sql
a year ago
4.2 kB
5
Indexable
public void clicked() { super(); try { Dialog dialog = new Dialog("@CEL:RenameBOM"); EcoResProductTranslation ecoResProductTranslation; InventTable inventTable; EcoResProduct ecoResProduct; EcoResProduct ecoResProductForUpdate; AMInventSupplierItemTable aMInventSupplierItemTable; select firstonly forupdate ecoResProduct join inventtable where inventtable.Product == ecoResProduct.RecId join aMInventSupplierItemTable where aMInventSupplierItemTable.itemId == inventTable.ItemId && aMInventSupplierItemTable.SupplierItemId == CCsInventSupplierBOMTable.ModelCodeId; select firstonly forupdate ecoResProductTranslation where ecoResProductTranslation.Product == ecoResProduct.RecId; str prodDescription = ecoResProductTranslation.Description; str searchName = ecoResProduct.SearchName; str productName = CCsInventSupplierBOMTable.SupplierItemName; // Create constants for dialog labels const str DlgLabel_ProductName = "@CEL:ProductName"; const str DlgLabel_SearchName = "@CEL:SearchName"; const str DlgLabel_Description = "@CEL:Description"; const str DlgLabel_RenamePrefix = "@CEL:Rename"; // Previous names (grayed-out) DialogField previousProductNameField = dialog.addField(extendedTypeStr(Name), DlgLabel_ProductName); previousProductNameField.enabled(false); previousProductNameField.value(productName); DialogField previousProductSearchNameField = dialog.addField(extendedTypeStr(Name), DlgLabel_SearchName); previousProductSearchNameField.enabled(false); previousProductSearchNameField.value(searchName); DialogField previousProductDescriptionField = dialog.addField(extendedTypeStr(Description), DlgLabel_Description); previousProductDescriptionField.enabled(false); previousProductDescriptionField.value(prodDescription); // New names (editable) DialogField productNameField = dialog.addField(extendedTypeStr(Name), strFmt("%1%2", DlgLabel_RenamePrefix, DlgLabel_ProductName)); DialogField productSearchNameField = dialog.addField(extendedTypeStr(Name), strFmt("%1%2", DlgLabel_RenamePrefix, DlgLabel_SearchName)); DialogField productDescriptionField = dialog.addField(extendedTypeStr(Description), strFmt("%1%2", DlgLabel_RenamePrefix, DlgLabel_Description)); if (dialog.run()) { str newProdName = productNameField.value(); str newSearchName = productSearchNameField.value(); str newDescription = productDescriptionField.value(); ttsbegin; // Update EcoResProductTranslation ecoResProductTranslation.Name = newProdName; ecoResProductTranslation.Description = newDescription; ecoResProductTranslation.update(); // Update CCsInventSupplierBOMTable CCsInventSupplierBOMTable.SupplierItemName = newProdName; CCsInventSupplierBOMTable.ModelCodeDescription = newDescription; CCsInventSupplierBOMTable.update(); // Update EcoResProduct ecoResProduct.SearchName = newSearchName; ecoResProduct.update(); ttscommit; } else { info("@CEL:CanceledWF"); } } catch (Exception::Error) { error("@CEL:RenameError"); } }
Editor is loading...