u
This commit is contained in:
@@ -24,7 +24,7 @@ Ensures a number sequence row exists for a company and type, inferring the compa
|
|||||||
|
|
||||||
*Source: `src/store/numbers/list.js`*
|
*Source: `src/store/numbers/list.js`*
|
||||||
|
|
||||||
Lists the number sequences of the user's selected company. Ensures that default sequences ('sku', 'entity', 'delivery', 'adjustment', 'shipment', 'quote', 'order') exist.
|
Lists the number sequences of the user's selected company. Ensures that default sequences ('sku', 'entity', 'delivery', 'adjustment', 'shipment', 'quote', 'order', 'return', 'retoure') exist.
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,13 @@ export async function ensureNumberType(runner, companyId, type) {
|
|||||||
let res = await runner.query(getSql, { companyId, type });
|
let res = await runner.query(getSql, { companyId, type });
|
||||||
let row = res.rows[0];
|
let row = res.rows[0];
|
||||||
|
|
||||||
// If already exists and is configured (has prefix or padding > 0, or not order/quote), return row
|
// If already exists and is configured (has prefix or padding > 0, or not order/quote/return/retoure), return row
|
||||||
if (row && (row.prefix || row.padding > 0 || (type !== 'order' && type !== 'quote'))) {
|
if (
|
||||||
|
row &&
|
||||||
|
(row.prefix ||
|
||||||
|
row.padding > 0 ||
|
||||||
|
(type !== 'order' && type !== 'quote' && type !== 'return' && type !== 'retoure'))
|
||||||
|
) {
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ const DEFAULT_TYPES = [
|
|||||||
'shipment',
|
'shipment',
|
||||||
'quote',
|
'quote',
|
||||||
'order',
|
'order',
|
||||||
|
'return',
|
||||||
|
'retoure',
|
||||||
];
|
];
|
||||||
|
|
||||||
function shape(row) {
|
function shape(row) {
|
||||||
@@ -36,7 +38,7 @@ export default function list(provider) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists the number sequences of the user's selected company.
|
* Lists the number sequences of the user's selected company.
|
||||||
* Ensures that default sequences ('sku', 'entity', 'delivery', 'adjustment', 'shipment', 'quote', 'order') exist.
|
* Ensures that default sequences ('sku', 'entity', 'delivery', 'adjustment', 'shipment', 'quote', 'order', 'return', 'retoure') exist.
|
||||||
*
|
*
|
||||||
* @param {number} googleAuthId - The id of the Google auth user.
|
* @param {number} googleAuthId - The id of the Google auth user.
|
||||||
* @param {object} [tx] - Optional transaction to run within.
|
* @param {object} [tx] - Optional transaction to run within.
|
||||||
|
|||||||
Reference in New Issue
Block a user