mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
Compare commits
3 Commits
v0.16.15
...
attachment
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82dc228cfe | ||
|
|
4f30f72d36 | ||
|
|
3f68d11062 |
24
packages/server/newrelic_agent.log
Normal file
24
packages/server/newrelic_agent.log
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.492Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.514Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.791Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4846,"time":"2024-05-15T09:09:09.793Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.758Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.771Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.927Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":4883,"time":"2024-05-15T09:09:27.929Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.318Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.326Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.420Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":5411,"time":"2024-05-15T09:15:10.421Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.324Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.335Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.504Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":8856,"time":"2024-05-15T11:47:03.505Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:36.984Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:36.990Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:37.126Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":12076,"time":"2024-05-15T14:30:37.127Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.393Z","msg":"Unable to find configuration file. If a configuration file is desired (common for non-containerized environments), a base configuration file can be copied from /Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/newrelic.js and renamed to \"newrelic.js\" in the directory from which you will start your application. Attempting to start agent using environment variables."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.405Z","msg":"Using New Relic for Node.js. Agent version: 11.16.0; Node version: v18.18.2."}
|
||||||
|
{"v":0,"level":30,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.536Z","msg":"Using AsyncLocalContextManager"}
|
||||||
|
{"v":0,"level":50,"name":"newrelic","hostname":"Ahmeds-MacBook-Air.local","pid":29079,"time":"2024-05-17T10:24:22.537Z","msg":"New Relic for Node.js was unable to bootstrap itself due to an error:","stack":"Error: New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!\n at createAgent (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:160:11)\n at initialize (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:105:15)\n at Object.<anonymous> (/Users/ahmedbouhuolia/repos/bigcapital/node_modules/.pnpm/newrelic@11.16.0/node_modules/newrelic/index.js:39:3)\n at Module._compile (node:internal/modules/cjs/loader:1256:14)\n at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)\n at Module.load (node:internal/modules/cjs/loader:1119:32)\n at Module._load (node:internal/modules/cjs/loader:960:12)\n at Module.require (node:internal/modules/cjs/loader:1143:19)\n at require (node:internal/modules/cjs/helpers:119:18)\n at Object.newrelic (/Users/ahmedbouhuolia/repos/bigcapital/packages/server/build/index.js:15954:18)","message":"New Relic requires that you name this application!\nSet app_name in your newrelic.js or newrelic.cjs file or set environment variable\nNEW_RELIC_APP_NAME. Not starting!"}
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
"bigcapital": "./bin/bigcapital.js"
|
"bigcapital": "./bin/bigcapital.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aws-sdk/client-s3": "^3.576.0",
|
||||||
"@casl/ability": "^5.4.3",
|
"@casl/ability": "^5.4.3",
|
||||||
"@hapi/boom": "^7.4.3",
|
"@hapi/boom": "^7.4.3",
|
||||||
"@lemonsqueezy/lemonsqueezy.js": "^2.2.0",
|
"@lemonsqueezy/lemonsqueezy.js": "^2.2.0",
|
||||||
|
|||||||
35
packages/server/src/api/controllers/AttachmentsController.ts
Normal file
35
packages/server/src/api/controllers/AttachmentsController.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { Service, Inject } from 'typedi';
|
||||||
|
import { Router, Response } from 'express';
|
||||||
|
import BaseController from '@/api/controllers/BaseController';
|
||||||
|
import { Request } from 'express-validator/src/base';
|
||||||
|
import { AttachmentsApplication } from '@/services/Attachments/AttachmentsApplication';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class AttachmentsController extends BaseController {
|
||||||
|
@Inject()
|
||||||
|
private attachmentsApplication: AttachmentsApplication;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Router constructor.
|
||||||
|
*/
|
||||||
|
router() {
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
router.delete('/:id', this.deleteAttachment.bind(this));
|
||||||
|
router.post('/', this.uploadAttachment.bind(this));
|
||||||
|
|
||||||
|
return router;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async uploadAttachment(req: Request, res: Response, next: Function) {
|
||||||
|
try {
|
||||||
|
await this.attachmentsApplication.upload();
|
||||||
|
|
||||||
|
return res.status(200).send({});
|
||||||
|
} catch (error) {
|
||||||
|
next(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private deleteAttachment(req: Request, res: Response, next: Function) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Inject, Service } from "typedi";
|
||||||
|
import { UploadDocument } from "./UploadDocument";
|
||||||
|
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class AttachmentsApplication {
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
private uploadDocumentService: UploadDocument;
|
||||||
|
|
||||||
|
upload(data: any) {
|
||||||
|
return this.uploadDocumentService.upload(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete(attachmentId: string) {}
|
||||||
|
|
||||||
|
get(attachmentId: string) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
22
packages/server/src/services/Attachments/UploadDocument.ts
Normal file
22
packages/server/src/services/Attachments/UploadDocument.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { Service } from 'typedi';
|
||||||
|
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
|
||||||
|
|
||||||
|
@Service()
|
||||||
|
export class UploadDocument {
|
||||||
|
// setting up s3 client
|
||||||
|
public s3 = new S3Client({
|
||||||
|
region: process.env.AWS_REGION,
|
||||||
|
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
||||||
|
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
||||||
|
});
|
||||||
|
|
||||||
|
async upload(data) {
|
||||||
|
const putObjectCommand = new PutObjectCommand({
|
||||||
|
Bucket: process.env.AWS_BUCKET,
|
||||||
|
Key: data.filename,
|
||||||
|
Body: await data.toBuffer(),
|
||||||
|
ContentType: data.mimetype,
|
||||||
|
});
|
||||||
|
await this.s3.send(putObjectCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { difference, isEmpty } from 'lodash';
|
import { difference } from 'lodash';
|
||||||
import { Service, Inject } from 'typedi';
|
import { Service, Inject } from 'typedi';
|
||||||
import { ServiceError } from '@/exceptions';
|
import { ServiceError } from '@/exceptions';
|
||||||
import {
|
import {
|
||||||
@@ -244,12 +244,16 @@ export class CommandManualJournalValidators {
|
|||||||
/**
|
/**
|
||||||
* Validates the manual journal number require.
|
* Validates the manual journal number require.
|
||||||
* @param {string} journalNumber
|
* @param {string} journalNumber
|
||||||
* @throws {ServiceError(ERRORS.MANUAL_JOURNAL_NO_REQUIRED)}
|
|
||||||
*/
|
*/
|
||||||
public validateJournalNoRequireWhenAutoNotEnabled = (
|
public validateJournalNoRequireWhenAutoNotEnabled = (
|
||||||
|
tenantId: number,
|
||||||
journalNumber: string
|
journalNumber: string
|
||||||
) => {
|
) => {
|
||||||
if (isEmpty(journalNumber)) {
|
// Retrieve the next manual journal number.
|
||||||
|
const autoIncrmenetEnabled =
|
||||||
|
this.autoIncrement.autoIncrementEnabled(tenantId);
|
||||||
|
|
||||||
|
if (!journalNumber || !autoIncrmenetEnabled) {
|
||||||
throw new ServiceError(ERRORS.MANUAL_JOURNAL_NO_REQUIRED);
|
throw new ServiceError(ERRORS.MANUAL_JOURNAL_NO_REQUIRED);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export class CreateManualJournalService {
|
|||||||
|
|
||||||
// Validate manual journal number require when auto-increment not enabled.
|
// Validate manual journal number require when auto-increment not enabled.
|
||||||
this.validator.validateJournalNoRequireWhenAutoNotEnabled(
|
this.validator.validateJournalNoRequireWhenAutoNotEnabled(
|
||||||
|
tenantId,
|
||||||
manualJournalDTO.journalNumber
|
manualJournalDTO.journalNumber
|
||||||
);
|
);
|
||||||
// Validate manual journal uniquiness on the storage.
|
// Validate manual journal uniquiness on the storage.
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ export default class AutoIncrementOrdersService {
|
|||||||
const group = settingsGroup;
|
const group = settingsGroup;
|
||||||
|
|
||||||
// Settings service transaction number and prefix.
|
// Settings service transaction number and prefix.
|
||||||
return settings.get({ group, key: 'auto_increment' }, false);
|
const autoIncrement = settings.get({ group, key: 'auto_increment' }, false);
|
||||||
};
|
|
||||||
|
return parseBoolean(autoIncrement, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the next service transaction number.
|
* Retrieve the next service transaction number.
|
||||||
@@ -25,16 +27,17 @@ export default class AutoIncrementOrdersService {
|
|||||||
* @param {Function} getMaxTransactionNo
|
* @param {Function} getMaxTransactionNo
|
||||||
* @return {Promise<string>}
|
* @return {Promise<string>}
|
||||||
*/
|
*/
|
||||||
getNextTransactionNumber(tenantId: number, group: string): string {
|
getNextTransactionNumber(tenantId: number, settingsGroup: string): string {
|
||||||
const settings = this.tenancy.settings(tenantId);
|
const settings = this.tenancy.settings(tenantId);
|
||||||
|
const group = settingsGroup;
|
||||||
|
|
||||||
// Settings service transaction number and prefix.
|
// Settings service transaction number and prefix.
|
||||||
const autoIncrement = this.autoIncrementEnabled(tenantId, group);
|
const autoIncrement = settings.get({ group, key: 'auto_increment' }, false);
|
||||||
|
|
||||||
const settingNo = settings.get({ group, key: 'next_number' }, '');
|
const settingNo = settings.get({ group, key: 'next_number' }, '');
|
||||||
const settingPrefix = settings.get({ group, key: 'number_prefix' }, '');
|
const settingPrefix = settings.get({ group, key: 'number_prefix' }, '');
|
||||||
|
|
||||||
return autoIncrement ? `${settingPrefix}${settingNo}` : '';
|
return parseBoolean(autoIncrement, false) ? `${settingPrefix}${settingNo}` : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,9 +53,7 @@ export default class AutoIncrementOrdersService {
|
|||||||
const autoIncrement = settings.get({ group, key: 'auto_increment' });
|
const autoIncrement = settings.get({ group, key: 'auto_increment' });
|
||||||
|
|
||||||
// Can't continue if the auto-increment of the service was disabled.
|
// Can't continue if the auto-increment of the service was disabled.
|
||||||
if (!autoIncrement) {
|
if (!autoIncrement) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
settings.set(
|
settings.set(
|
||||||
{ group, key: 'next_number' },
|
{ group, key: 'next_number' },
|
||||||
|
|||||||
@@ -337,9 +337,6 @@ const booleanValues: string[] = [
|
|||||||
].map((value) => normalizeValue(value));
|
].map((value) => normalizeValue(value));
|
||||||
|
|
||||||
export const parseBoolean = <T>(value: any, defaultValue: T): T | boolean => {
|
export const parseBoolean = <T>(value: any, defaultValue: T): T | boolean => {
|
||||||
if (typeof value === 'boolean') {
|
|
||||||
return value; // Retrun early we have nothing to parse.
|
|
||||||
}
|
|
||||||
const normalizedValue = normalizeValue(value);
|
const normalizedValue = normalizeValue(value);
|
||||||
if (isEmpty(value) || booleanValues.indexOf(normalizedValue) === -1) {
|
if (isEmpty(value) || booleanValues.indexOf(normalizedValue) === -1) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { Callout } from '@blueprintjs/core';
|
import { T } from '@/components';
|
||||||
|
|
||||||
import { SubscriptionPlans } from './SubscriptionPlan';
|
import { SubscriptionPlans } from './SubscriptionPlan';
|
||||||
import withPlans from '../../Subscriptions/withPlans';
|
import withPlans from '../../Subscriptions/withPlans';
|
||||||
import { compose } from '@/utils';
|
import { compose } from '@/utils';
|
||||||
|
import { Callout, Intent } from '@blueprintjs/core';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Billing plans.
|
* Billing plans.
|
||||||
@@ -13,11 +15,10 @@ function SubscriptionPlansSectionRoot({ plans }) {
|
|||||||
<Callout
|
<Callout
|
||||||
style={{ marginBottom: '1.5rem' }}
|
style={{ marginBottom: '1.5rem' }}
|
||||||
icon={null}
|
icon={null}
|
||||||
title={'Early Adopter Plan'}
|
title={'Early Adaptors Plan'}
|
||||||
>
|
>
|
||||||
We're looking for 200 early adopters, when you subscribe you'll get the
|
We're looking for 200 early adaptors, when you subscribe you'll get
|
||||||
full features and unlimited users for a year regardless of the
|
the full features and unlimited users for a year regardless of the subscribed plan.
|
||||||
subscribed plan.
|
|
||||||
</Callout>
|
</Callout>
|
||||||
<SubscriptionPlans plans={plans} />
|
<SubscriptionPlans plans={plans} />
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
1065
pnpm-lock.yaml
generated
1065
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user