diff --git a/packages/server/src/api/controllers/Organization.ts b/packages/server/src/api/controllers/Organization.ts
index c746a0484..746e4f5be 100644
--- a/packages/server/src/api/controllers/Organization.ts
+++ b/packages/server/src/api/controllers/Organization.ts
@@ -31,14 +31,14 @@ export default class OrganizationController extends BaseController {
router.post(
'/build',
- this.organizationValidationSchema,
+ this.buildOrganizationValidationSchema,
this.validationResult,
asyncMiddleware(this.build.bind(this)),
this.handleServiceErrors.bind(this)
);
router.put(
'/',
- this.organizationValidationSchema,
+ this.updateOrganizationValidationSchema,
this.validationResult,
this.asyncMiddleware(this.updateOrganization.bind(this)),
this.handleServiceErrors.bind(this)
@@ -55,7 +55,7 @@ export default class OrganizationController extends BaseController {
* Organization setup schema.
* @return {ValidationChain[]}
*/
- private get organizationValidationSchema(): ValidationChain[] {
+ private get commonOrganizationValidationSchema(): ValidationChain[] {
return [
check('name').exists().trim(),
check('industry').optional({ nullable: true }).isString().trim().escape(),
@@ -68,6 +68,29 @@ export default class OrganizationController extends BaseController {
];
}
+ /**
+ * Build organization validation schema.
+ * @returns {ValidationChain[]}
+ */
+ private get buildOrganizationValidationSchema(): ValidationChain[] {
+ return [...this.commonOrganizationValidationSchema];
+ }
+
+ /**
+ * Update organization validation schema.
+ * @returns {ValidationChain[]}
+ */
+ private get updateOrganizationValidationSchema(): ValidationChain[] {
+ return [
+ ...this.commonOrganizationValidationSchema,
+ check('tax_number')
+ .optional({ nullable: true })
+ .isString()
+ .trim()
+ .escape(),
+ ];
+ }
+
/**
* Builds tenant database and migrate database schema.
* @param {Request} req - Express request.
diff --git a/packages/server/src/interfaces/Setup.ts b/packages/server/src/interfaces/Setup.ts
index 2a0562238..4f443bb8c 100644
--- a/packages/server/src/interfaces/Setup.ts
+++ b/packages/server/src/interfaces/Setup.ts
@@ -25,6 +25,7 @@ export interface IOrganizationUpdateDTO {
timezone: string;
fiscalYear: string;
industry: string;
+ taxNumber: string;
}
export interface IOrganizationBuildEventPayload {
diff --git a/packages/server/src/system/migrations/20231012112401_add_tax_number_column_to_tenants_metadata_table.js b/packages/server/src/system/migrations/20231012112401_add_tax_number_column_to_tenants_metadata_table.js
new file mode 100644
index 000000000..ce7de80f0
--- /dev/null
+++ b/packages/server/src/system/migrations/20231012112401_add_tax_number_column_to_tenants_metadata_table.js
@@ -0,0 +1,11 @@
+exports.up = function (knex) {
+ return knex.schema.table('tenants_metadata', (table) => {
+ table.string('tax_number')
+ });
+};
+
+exports.down = function (knex) {
+ return knex.schema.table('tenants_metadata', (table) => {
+ table.dropColumn('tax_number');
+ });
+};
diff --git a/packages/webapp/src/containers/Preferences/General/General.schema.tsx b/packages/webapp/src/containers/Preferences/General/General.schema.tsx
index 249a9c6e9..e118872cd 100644
--- a/packages/webapp/src/containers/Preferences/General/General.schema.tsx
+++ b/packages/webapp/src/containers/Preferences/General/General.schema.tsx
@@ -6,6 +6,9 @@ const Schema = Yup.object().shape({
name: Yup.string()
.required()
.label(intl.get('organization_name_')),
+ tax_number: Yup.string()
+ .nullable()
+ .label(intl.get('organization_tax_number_')),
industry: Yup.string()
.nullable()
.label(intl.get('organization_industry_')),
diff --git a/packages/webapp/src/containers/Preferences/General/GeneralForm.tsx b/packages/webapp/src/containers/Preferences/General/GeneralForm.tsx
index a4eb2e106..d67d0ea65 100644
--- a/packages/webapp/src/containers/Preferences/General/GeneralForm.tsx
+++ b/packages/webapp/src/containers/Preferences/General/GeneralForm.tsx
@@ -59,6 +59,17 @@ export default function PreferencesGeneralForm({ isSubmitting }) {
+ {/* ---------- Organization Tax Number ---------- */}
+ }
+ inline={true}
+ helperText={}
+ fastField={true}
+ >
+
+
+
{/* ---------- Industry ---------- */}