Skip to content

Commit

Permalink
Merge branch 'release/5.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
nsteenbeek committed Sep 1, 2021
2 parents 17ef467 + 70dd3c1 commit bbb39b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hso/d365-cli",
"version": "5.5.0",
"version": "5.5.1",
"author": "HSO Innovation <[email protected]> (http://www.hso.com)",
"description": "HSO D365 Command Line Interface",
"repository": {
Expand Down
13 changes: 10 additions & 3 deletions src/generator/ControlFormContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ export class ControlFormContext {
return columnsControlsString;
}

private static usedNames: string[];
private async getSectionsString(tab: FormJsonTab, sections: FormJsonSection[]): Promise<string> {
let sectionsControlsString = '';
ControlFormContext.usedNames = [];
for (const section of sections) {
const {Name: sectionName} = section;
if (sectionName) {
Expand Down Expand Up @@ -116,9 +118,14 @@ export class ControlFormContext {
if (xrmControlType) {
const pascalSchemaName = dataFieldName === id ?
ControlFormContext.capitalize(attributeMetadata.SchemaName) : ControlFormContext.capitalize(id);
const methodName = ` static get${pascalSchemaName}Control(formContext: FormContext): ${xrmControlType} {`;
const returnString = `return formContext.getControl('${id}');`;
cellControlsString += `${methodName}\n ${returnString}\n }\n`;
if (!ControlFormContext.usedNames.includes(pascalSchemaName)) {
ControlFormContext.usedNames.push(pascalSchemaName);
const methodName = ` static get${pascalSchemaName}Control(formContext: FormContext): ${xrmControlType} {`;
const returnString = `return formContext.getControl('${id}');`;
cellControlsString += `${methodName}\n ${returnString}\n }\n`;
} else {
await this.log(`Duplicate control name found: '${pascalSchemaName}'`);
}
}
}
}
Expand Down

0 comments on commit bbb39b6

Please sign in to comment.