mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat(sales): currency code associated from invoice customer.
feat(purchases): currency code associated from vendor customer.
This commit is contained in:
@@ -103,7 +103,7 @@ export default class ExchangeRatesController extends BaseController {
|
||||
const { tenantId } = req;
|
||||
const filter = {
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
pageSize: 12,
|
||||
filterRoles: [],
|
||||
columnSortBy: 'created_at',
|
||||
sortOrder: 'asc',
|
||||
|
||||
@@ -48,7 +48,7 @@ export default class BillsController extends BaseController {
|
||||
);
|
||||
router.post(
|
||||
'/:id', [
|
||||
...this.billValidationSchema,
|
||||
...this.billEditValidationSchema,
|
||||
...this.specificBillValidationSchema,
|
||||
],
|
||||
this.validationResult,
|
||||
@@ -106,7 +106,6 @@ export default class BillsController extends BaseController {
|
||||
|
||||
check('entries').isArray({ min: 1 }),
|
||||
|
||||
check('entries.*.id').optional().isNumeric().toInt(),
|
||||
check('entries.*.index').exists().isNumeric().toInt(),
|
||||
check('entries.*.item_id').exists().isNumeric().toInt(),
|
||||
check('entries.*.rate').exists().isNumeric().toFloat(),
|
||||
@@ -121,7 +120,7 @@ export default class BillsController extends BaseController {
|
||||
*/
|
||||
get billEditValidationSchema() {
|
||||
return [
|
||||
check('bill_number').exists().trim().escape(),
|
||||
check('bill_number').optional().trim().escape(),
|
||||
check('reference_no').optional().trim().escape(),
|
||||
check('bill_date').exists().isISO8601(),
|
||||
check('due_date').optional().isISO8601(),
|
||||
|
||||
@@ -407,6 +407,11 @@ export default class BillsPayments extends BaseController {
|
||||
errors: [{ type: 'BILLS_NOT_FOUND', code: 1000 }],
|
||||
});
|
||||
}
|
||||
if (error.errorType === 'PAYMENT_NUMBER_SHOULD_NOT_MODIFY') {
|
||||
return res.status(400).send({
|
||||
errors: [{ type: 'PAYMENT_NUMBER_SHOULD_NOT_MODIFY', code: 1100 }],
|
||||
});
|
||||
}
|
||||
}
|
||||
next(error);
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ export default class PaymentReceivesController extends BaseController {
|
||||
*/
|
||||
get paymentReceiveSchema(): ValidationChain[] {
|
||||
return [
|
||||
check('customer_id').exists().isNumeric().toInt(),
|
||||
check('payment_date').exists(),
|
||||
check('reference_no').optional(),
|
||||
check('deposit_account_id').exists().isNumeric().toInt(),
|
||||
@@ -132,7 +133,6 @@ export default class PaymentReceivesController extends BaseController {
|
||||
*/
|
||||
get newPaymentReceiveValidation() {
|
||||
return [
|
||||
check('customer_id').exists().isNumeric().toInt(),
|
||||
...this.paymentReceiveSchema,
|
||||
];
|
||||
}
|
||||
@@ -449,6 +449,11 @@ export default class PaymentReceivesController extends BaseController {
|
||||
errors: [{ type: 'PAYMENT_RECEIVE_NO_IS_REQUIRED', code: 1100 }],
|
||||
});
|
||||
}
|
||||
if (error.errorType === 'PAYMENT_CUSTOMER_SHOULD_NOT_UPDATE') {
|
||||
return res.boom.badRequest(null, {
|
||||
errors: [{ type: 'PAYMENT_CUSTOMER_SHOULD_NOT_UPDATE', code: 1200 }],
|
||||
});
|
||||
}
|
||||
}
|
||||
next(error);
|
||||
}
|
||||
|
||||
@@ -301,6 +301,7 @@ export default class SaleInvoicesController extends BaseController {
|
||||
filterMeta,
|
||||
pagination,
|
||||
} = await this.saleInvoiceService.salesInvoicesList(tenantId, filter);
|
||||
|
||||
return res.status(200).send({
|
||||
sales_invoices: salesInvoices,
|
||||
pagination: this.transfromToResponse(pagination),
|
||||
|
||||
Reference in New Issue
Block a user