@mj-biz-apps/orders-core-entities-server 5.43.0 → 5.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccountingBridge.d.ts +26 -0
- package/dist/AccountingBridge.d.ts.map +1 -1
- package/dist/AccountingBridge.js +24 -0
- package/dist/AccountingBridge.js.map +1 -1
- package/dist/CapturePaymentOperation.js +2 -2
- package/dist/CapturePaymentOperation.js.map +1 -1
- package/dist/CheckoutAccountStep.d.ts +2 -0
- package/dist/CheckoutAccountStep.d.ts.map +1 -1
- package/dist/CheckoutAccountStep.js +11 -0
- package/dist/CheckoutAccountStep.js.map +1 -1
- package/dist/ExplainProductGLAccountsOperation.d.ts +43 -0
- package/dist/ExplainProductGLAccountsOperation.d.ts.map +1 -0
- package/dist/ExplainProductGLAccountsOperation.js +176 -0
- package/dist/ExplainProductGLAccountsOperation.js.map +1 -0
- package/dist/GLAccountResolver.d.ts +56 -7
- package/dist/GLAccountResolver.d.ts.map +1 -1
- package/dist/GLAccountResolver.js +92 -46
- package/dist/GLAccountResolver.js.map +1 -1
- package/dist/JournalEntryCustomer.d.ts +25 -0
- package/dist/JournalEntryCustomer.d.ts.map +1 -0
- package/dist/JournalEntryCustomer.js +26 -0
- package/dist/JournalEntryCustomer.js.map +1 -0
- package/dist/OrderEntityServer.d.ts +2 -0
- package/dist/OrderEntityServer.d.ts.map +1 -1
- package/dist/OrderEntityServer.js +35 -16
- package/dist/OrderEntityServer.js.map +1 -1
- package/dist/OrderJournalEntryFactory.d.ts.map +1 -1
- package/dist/OrderJournalEntryFactory.js +7 -4
- package/dist/OrderJournalEntryFactory.js.map +1 -1
- package/dist/OrderReview.d.ts +9 -0
- package/dist/OrderReview.d.ts.map +1 -1
- package/dist/OrderReview.js +59 -1
- package/dist/OrderReview.js.map +1 -1
- package/dist/OrdersSettings.d.ts +11 -0
- package/dist/OrdersSettings.d.ts.map +1 -1
- package/dist/OrdersSettings.js +13 -0
- package/dist/OrdersSettings.js.map +1 -1
- package/dist/PaymentAllocationFactory.d.ts +6 -0
- package/dist/PaymentAllocationFactory.d.ts.map +1 -1
- package/dist/PaymentAllocationFactory.js +3 -1
- package/dist/PaymentAllocationFactory.js.map +1 -1
- package/dist/PaymentHeaderEntityServer.d.ts +12 -1
- package/dist/PaymentHeaderEntityServer.d.ts.map +1 -1
- package/dist/PaymentHeaderEntityServer.js +86 -7
- package/dist/PaymentHeaderEntityServer.js.map +1 -1
- package/dist/PaymentIntentService.d.ts.map +1 -1
- package/dist/PaymentIntentService.js +2 -1
- package/dist/PaymentIntentService.js.map +1 -1
- package/dist/PaymentLineEntityServer.d.ts +2 -1
- package/dist/PaymentLineEntityServer.d.ts.map +1 -1
- package/dist/PaymentLineEntityServer.js +13 -9
- package/dist/PaymentLineEntityServer.js.map +1 -1
- package/dist/PaymentReviewNotices.d.ts +58 -0
- package/dist/PaymentReviewNotices.d.ts.map +1 -0
- package/dist/PaymentReviewNotices.js +105 -0
- package/dist/PaymentReviewNotices.js.map +1 -0
- package/dist/PollExternalPaymentsOperation.d.ts +37 -4
- package/dist/PollExternalPaymentsOperation.d.ts.map +1 -1
- package/dist/PollExternalPaymentsOperation.js +197 -27
- package/dist/PollExternalPaymentsOperation.js.map +1 -1
- package/dist/PreviewPriceOperation.d.ts +9 -0
- package/dist/PreviewPriceOperation.d.ts.map +1 -1
- package/dist/PreviewPriceOperation.js +4 -0
- package/dist/PreviewPriceOperation.js.map +1 -1
- package/dist/ProgressSupersede.d.ts +18 -22
- package/dist/ProgressSupersede.d.ts.map +1 -1
- package/dist/ProgressSupersede.js +13 -34
- package/dist/ProgressSupersede.js.map +1 -1
- package/dist/RecordProgressOperation.d.ts +21 -28
- package/dist/RecordProgressOperation.d.ts.map +1 -1
- package/dist/RecordProgressOperation.js +60 -78
- package/dist/RecordProgressOperation.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExplainProductGLAccountsOperation.js","sourceRoot":"","sources":["../src/ExplainProductGLAccountsOperation.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAyC,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EACH,gBAAgB,EAChB,YAAY,EACZ,uCAAuC,IAAI,2CAA2C,EACtF,SAAS,GAKZ,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAyD,MAAM,wBAAwB,CAAC;AACxG,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEjI,MAAM,cAAc,GAAG,6BAA6B,CAAC;AACrD,MAAM,cAAc,GAAG,eAAe,CAAC;AAEvC,+FAA+F;AAC/F,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IAC/C,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,yBAAyB;IACjC,OAAO,CAAC,kBAAkB;CAC7B,CAAC;AAEF,MAAM,WAAW,GAAsB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAE9D,yGAAyG;AACzG,MAAM,UAAU,cAAc,CAAC,KAAkC;IAC7D,IAAI,CAAC,KAAK,EAAE,MAAM;QAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACnB,M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AC,sBAAsB,EAAE,iCAAiC,CAAC;GAC5D,iCAAiC,CAyF7C;;AAED,0FAA0F;AAC1F,MAAM,UAAU,qCAAqC;IACjD,sBAAsB;AAC1B,CAAC"}
|
|
@@ -172,6 +172,40 @@ export interface LinkedAccountHit {
|
|
|
172
172
|
RequiredDimensions?: RequiredDimension[];
|
|
173
173
|
/** The account as a person reads it (code and name); the id when the account is not cached. */
|
|
174
174
|
AccountLabel?: string;
|
|
175
|
+
/** The account's code and name, separately, for a screen that lays them out apart. */
|
|
176
|
+
AccountCode?: string;
|
|
177
|
+
AccountName?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* A level of the walk, most specific first. `ParentCategory` is any ancestor of the product's
|
|
181
|
+
* category; `LegalEntity` appears only for a Division, Department or Branch, whose company default
|
|
182
|
+
* is looked for on its own record and then on its legal entity's.
|
|
183
|
+
*/
|
|
184
|
+
export type GLWalkLevel = 'Product' | 'Category' | 'ParentCategory' | 'ProductType' | 'Company' | 'LegalEntity';
|
|
185
|
+
/** One lookup the walk made, and what it found. */
|
|
186
|
+
export interface GLWalkStep {
|
|
187
|
+
Level: GLWalkLevel;
|
|
188
|
+
/** The record whose links were looked up. */
|
|
189
|
+
RecordID: string;
|
|
190
|
+
/** The link in force at this level for the role, or null when there is none. */
|
|
191
|
+
Hit: LinkedAccountHit | null;
|
|
192
|
+
/** True for the step booking stops on: the first one with a link. */
|
|
193
|
+
Won: boolean;
|
|
194
|
+
}
|
|
195
|
+
/** What {@link GLAccountResolver.Explain} answers for one role. */
|
|
196
|
+
export interface GLRoleExplanation {
|
|
197
|
+
Role: GLRole;
|
|
198
|
+
/**
|
|
199
|
+
* Every level of the walk, in the order booking tries them. Booking stops at the winner; the
|
|
200
|
+
* steps after it are still looked up so a reader can see what a more specific link overrides.
|
|
201
|
+
*/
|
|
202
|
+
Steps: GLWalkStep[];
|
|
203
|
+
/** The account booking would use; null when it would refuse. */
|
|
204
|
+
GLAccountID: string | null;
|
|
205
|
+
/** Why booking would refuse, or null when the role resolves. */
|
|
206
|
+
Failure: Exclude<GLAccountResolutionFailure, 'MissingDimensions'> | null;
|
|
207
|
+
/** Booking's own refusal, word for word, or null when the role resolves. */
|
|
208
|
+
Message: string | null;
|
|
175
209
|
}
|
|
176
210
|
/** One successful resolution, as {@link GLAccountResolver.TakeResolved} hands it back. */
|
|
177
211
|
export interface ResolvedAccountRequirement {
|
|
@@ -270,15 +304,32 @@ export declare class GLAccountResolver {
|
|
|
270
304
|
*/
|
|
271
305
|
productID: string | null, productCategoryID: string | null, expectedCompanyID: string, asOf: Date, productTypeID?: string | null): Promise<string>;
|
|
272
306
|
/**
|
|
273
|
-
* The
|
|
274
|
-
*
|
|
307
|
+
* The same walk as {@link Resolve}, reported step by step instead of booked (golive#439).
|
|
308
|
+
*
|
|
309
|
+
* Both run {@link walk}, so the account this names as the winner is the one `Resolve` returns for
|
|
310
|
+
* the same arguments, and a refusal carries `Resolve`'s message. Nothing is recorded for the
|
|
311
|
+
* dimension check: an explanation books nothing. Every level is looked up, including those after
|
|
312
|
+
* the winner, so the reader sees what each more specific link overrides.
|
|
313
|
+
*
|
|
314
|
+
* @throws only what the legal-entity lookup throws for a Division whose setup is incomplete
|
|
315
|
+
*/
|
|
316
|
+
Explain(role: GLRole, productID: string | null, productCategoryID: string | null, expectedCompanyID: string, asOf: Date, productTypeID?: string | null): Promise<GLRoleExplanation>;
|
|
317
|
+
/**
|
|
318
|
+
* The walk itself — the one copy {@link Resolve} and {@link Explain} share.
|
|
319
|
+
*
|
|
320
|
+
* Lazy: each level is looked up only when the caller asks for the next step, so `Resolve`, which
|
|
321
|
+
* stops at the first link, makes exactly the lookups it always made. Every lookup is scoped to
|
|
322
|
+
* `books`, the legal entity's accounts.
|
|
275
323
|
*/
|
|
276
|
-
private
|
|
324
|
+
private walk;
|
|
325
|
+
/** The refusal when nothing in the walk links an account for the role. */
|
|
326
|
+
private notLinkedError;
|
|
277
327
|
/**
|
|
278
328
|
* Plan D6 — hard block. Accounting takes no CompanyID; the account IS the company, so an account
|
|
279
|
-
* outside the line company's legal entity would post to the wrong books.
|
|
329
|
+
* outside the line company's legal entity would post to the wrong books. Null when the account
|
|
330
|
+
* is on the right books.
|
|
280
331
|
*/
|
|
281
|
-
private
|
|
332
|
+
private otherBooksError;
|
|
282
333
|
/**
|
|
283
334
|
* Resolve a link for an ARBITRARY record, with no walk (D71).
|
|
284
335
|
*
|
|
@@ -291,8 +342,6 @@ export declare class GLAccountResolver {
|
|
|
291
342
|
* mis-resolved one books to the wrong legal entity with nothing downstream to catch it.
|
|
292
343
|
*/
|
|
293
344
|
ResolveForRecord(role: GLRole, entityID: string, recordID: string, expectedCompanyID: string, asOf: Date): Promise<string | null>;
|
|
294
|
-
/** Category, then each ancestor, nearest first. */
|
|
295
|
-
private resolveUpCategoryTree;
|
|
296
345
|
/** Category tree from OrdersEngine — pointer-chasing after this. */
|
|
297
346
|
private ensureCategoriesLoaded;
|
|
298
347
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLAccountResolver.d.ts","sourceRoot":"","sources":["../src/GLAccountResolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAInE,iFAAiF;AACjF,eAAO,MAAM,OAAO;;;;;;IAMhB,6FAA6F;;IAE7F;;;;OAIG;;IAEH;;;;;;;;;;;OAWG;;IAEH;;;;;;;;;;;;;;;;;;OAkBG;;IAEH;;;;;;;;;;;;OAYG;;CAEG,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE5D,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAA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,IAAI,EAAE,IAAI,GACX,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUzB,oEAAoE;YACtD,sBAAsB;CAQvC"}
|
|
@@ -246,49 +246,109 @@ export class GLAccountResolver {
|
|
|
246
246
|
productID, productCategoryID, expectedCompanyID, asOf, productTypeID) {
|
|
247
247
|
// The accounts must be the legal entity's: a Division books on its parent's books.
|
|
248
248
|
const books = this._legalEntityFor(expectedCompanyID);
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
(
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (!hit) {
|
|
256
|
-
const where = UUIDsEqual(books, expectedCompanyID)
|
|
257
|
-
? `company ${expectedCompanyID}`
|
|
258
|
-
: `company ${expectedCompanyID} or its legal entity ${books}`;
|
|
259
|
-
throw new GLAccountResolutionError(role, productID, 'NotLinked', productID
|
|
260
|
-
? `No GL account is linked for role '${role}'. Checked the product, its category ` +
|
|
261
|
-
`tree, its product type, and the company default for ${where}. ` +
|
|
262
|
-
`Link an account for this role (product, category, product type, or company) before booking.`
|
|
263
|
-
: `No GL account is linked for role '${role}' at the company level for ${where}. ` +
|
|
264
|
-
`This role is resolved company-wide (there is no product involved), so link an ` +
|
|
265
|
-
`account to the company before booking.`);
|
|
249
|
+
let hit = null;
|
|
250
|
+
for await (const step of this.walk(role, productID, productCategoryID, expectedCompanyID, books, asOf, productTypeID)) {
|
|
251
|
+
if (step.Hit) {
|
|
252
|
+
hit = step.Hit;
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
266
255
|
}
|
|
267
|
-
|
|
256
|
+
if (!hit)
|
|
257
|
+
throw this.notLinkedError(role, productID, expectedCompanyID, books);
|
|
258
|
+
const refusal = this.otherBooksError(hit, role, productID, expectedCompanyID, books);
|
|
259
|
+
if (refusal)
|
|
260
|
+
throw refusal;
|
|
268
261
|
this.record(role, hit);
|
|
269
262
|
return hit.GLAccountID;
|
|
270
263
|
}
|
|
271
264
|
/**
|
|
272
|
-
* The
|
|
273
|
-
*
|
|
265
|
+
* The same walk as {@link Resolve}, reported step by step instead of booked (golive#439).
|
|
266
|
+
*
|
|
267
|
+
* Both run {@link walk}, so the account this names as the winner is the one `Resolve` returns for
|
|
268
|
+
* the same arguments, and a refusal carries `Resolve`'s message. Nothing is recorded for the
|
|
269
|
+
* dimension check: an explanation books nothing. Every level is looked up, including those after
|
|
270
|
+
* the winner, so the reader sees what each more specific link overrides.
|
|
271
|
+
*
|
|
272
|
+
* @throws only what the legal-entity lookup throws for a Division whose setup is incomplete
|
|
274
273
|
*/
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
274
|
+
async Explain(role, productID, productCategoryID, expectedCompanyID, asOf, productTypeID) {
|
|
275
|
+
const books = this._legalEntityFor(expectedCompanyID);
|
|
276
|
+
const steps = [];
|
|
277
|
+
let winner = null;
|
|
278
|
+
for await (const step of this.walk(role, productID, productCategoryID, expectedCompanyID, books, asOf, productTypeID)) {
|
|
279
|
+
const won = !winner && !!step.Hit;
|
|
280
|
+
if (won)
|
|
281
|
+
winner = step.Hit;
|
|
282
|
+
steps.push({ ...step, Won: won });
|
|
283
|
+
}
|
|
284
|
+
const refusal = winner
|
|
285
|
+
? this.otherBooksError(winner, role, productID, expectedCompanyID, books)
|
|
286
|
+
: this.notLinkedError(role, productID, expectedCompanyID, books);
|
|
287
|
+
if (refusal) {
|
|
288
|
+
return { Role: role, Steps: steps, GLAccountID: null, Failure: refusal.Failure, Message: refusal.message };
|
|
289
|
+
}
|
|
290
|
+
return { Role: role, Steps: steps, GLAccountID: winner.GLAccountID, Failure: null, Message: null };
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* The walk itself — the one copy {@link Resolve} and {@link Explain} share.
|
|
294
|
+
*
|
|
295
|
+
* Lazy: each level is looked up only when the caller asks for the next step, so `Resolve`, which
|
|
296
|
+
* stops at the first link, makes exactly the lookups it always made. Every lookup is scoped to
|
|
297
|
+
* `books`, the legal entity's accounts.
|
|
298
|
+
*/
|
|
299
|
+
async *walk(role, productID, productCategoryID, companyID, books, asOf, productTypeID) {
|
|
300
|
+
const look = (level, entityID, recordID) => ({
|
|
301
|
+
Level: level,
|
|
302
|
+
RecordID: recordID,
|
|
303
|
+
Hit: this._resolveLink(entityID, recordID, role, asOf, books),
|
|
304
|
+
});
|
|
305
|
+
if (productID)
|
|
306
|
+
yield look('Product', this._entityIDs.Product, productID);
|
|
307
|
+
// Category, then each ancestor, nearest first.
|
|
308
|
+
if (productCategoryID) {
|
|
309
|
+
await this.ensureCategoriesLoaded();
|
|
310
|
+
const seen = new Set();
|
|
311
|
+
let current = productCategoryID;
|
|
312
|
+
let level = 'Category';
|
|
313
|
+
while (current && !seen.has(current)) {
|
|
314
|
+
seen.add(current); // cycle guard — the DB CHECK blocks self-parenting, not longer loops
|
|
315
|
+
yield look(level, this._entityIDs.ProductCategory, current);
|
|
316
|
+
level = 'ParentCategory';
|
|
317
|
+
current = this._categoryParent.get(current) ?? null;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (productTypeID)
|
|
321
|
+
yield look('ProductType', this._entityIDs.ProductType, productTypeID);
|
|
322
|
+
// The company default: the line company's own record, then, for a Division, its legal entity's.
|
|
323
|
+
yield look('Company', this._entityIDs.Company, companyID);
|
|
324
|
+
if (!UUIDsEqual(books, companyID))
|
|
325
|
+
yield look('LegalEntity', this._entityIDs.Company, books);
|
|
326
|
+
}
|
|
327
|
+
/** The refusal when nothing in the walk links an account for the role. */
|
|
328
|
+
notLinkedError(role, productID, expectedCompanyID, books) {
|
|
329
|
+
const where = UUIDsEqual(books, expectedCompanyID)
|
|
330
|
+
? `company ${expectedCompanyID}`
|
|
331
|
+
: `company ${expectedCompanyID} or its legal entity ${books}`;
|
|
332
|
+
return new GLAccountResolutionError(role, productID, 'NotLinked', productID
|
|
333
|
+
? `No GL account is linked for role '${role}'. Checked the product, its category ` +
|
|
334
|
+
`tree, its product type, and the company default for ${where}. ` +
|
|
335
|
+
`Link an account for this role (product, category, product type, or company) before booking.`
|
|
336
|
+
: `No GL account is linked for role '${role}' at the company level for ${where}. ` +
|
|
337
|
+
`This role is resolved company-wide (there is no product involved), so link an ` +
|
|
338
|
+
`account to the company before booking.`);
|
|
280
339
|
}
|
|
281
340
|
/**
|
|
282
341
|
* Plan D6 — hard block. Accounting takes no CompanyID; the account IS the company, so an account
|
|
283
|
-
* outside the line company's legal entity would post to the wrong books.
|
|
342
|
+
* outside the line company's legal entity would post to the wrong books. Null when the account
|
|
343
|
+
* is on the right books.
|
|
284
344
|
*/
|
|
285
|
-
|
|
345
|
+
otherBooksError(hit, role, productID, expectedCompanyID, books) {
|
|
286
346
|
if (UUIDsEqual(hit.CompanyID, books))
|
|
287
|
-
return;
|
|
347
|
+
return null;
|
|
288
348
|
const target = UUIDsEqual(books, expectedCompanyID)
|
|
289
349
|
? `company ${expectedCompanyID}`
|
|
290
350
|
: `company ${expectedCompanyID}, whose legal entity is ${books}`;
|
|
291
|
-
|
|
351
|
+
return new GLAccountResolutionError(role, productID, 'CrossCompany', `GL account ${hit.GLAccountID} resolved for role '${role}' belongs to company ` +
|
|
292
352
|
`${hit.CompanyID}, but this books to ${target}. ` +
|
|
293
353
|
`Cross-company account mapping is refused — the journal entry would book revenue ` +
|
|
294
354
|
`to the wrong legal entity.`);
|
|
@@ -309,26 +369,12 @@ export class GLAccountResolver {
|
|
|
309
369
|
const hit = this._resolveLink(entityID, recordID, role, asOf, books);
|
|
310
370
|
if (!hit)
|
|
311
371
|
return null;
|
|
312
|
-
this.
|
|
372
|
+
const refusal = this.otherBooksError(hit, role, recordID, expectedCompanyID, books);
|
|
373
|
+
if (refusal)
|
|
374
|
+
throw refusal;
|
|
313
375
|
this.record(role, hit);
|
|
314
376
|
return hit.GLAccountID;
|
|
315
377
|
}
|
|
316
|
-
/** Category, then each ancestor, nearest first. */
|
|
317
|
-
async resolveUpCategoryTree(role, startCategoryID, asOf, forCompanyID) {
|
|
318
|
-
if (!startCategoryID)
|
|
319
|
-
return null;
|
|
320
|
-
await this.ensureCategoriesLoaded();
|
|
321
|
-
const seen = new Set();
|
|
322
|
-
let current = startCategoryID;
|
|
323
|
-
while (current && !seen.has(current)) {
|
|
324
|
-
seen.add(current); // cycle guard — the DB CHECK blocks self-parenting, not longer loops
|
|
325
|
-
const hit = this._resolveLink(this._entityIDs.ProductCategory, current, role, asOf, forCompanyID);
|
|
326
|
-
if (hit)
|
|
327
|
-
return hit;
|
|
328
|
-
current = this._categoryParent.get(current) ?? null;
|
|
329
|
-
}
|
|
330
|
-
return null;
|
|
331
|
-
}
|
|
332
378
|
/** Category tree from OrdersEngine — pointer-chasing after this. */
|
|
333
379
|
async ensureCategoriesLoaded() {
|
|
334
380
|
if (this._categoriesLoaded)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLAccountResolver.js","sourceRoot":"","sources":["../src/GLAccountResolver.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE9E,iFAAiF;AACjF,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,kBAAkB,EAAE,qBAAqB;IACzC,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,iBAAiB;IACjC,eAAe,EAAE,kBAAkB;IACnC,yBAAyB,EAAE,8BAA8B;IACzD,6FAA6F;IAC7F,IAAI,EAAE,MAAM;IACZ;;;;OAIG;IACH,aAAa,EAAE,gBAAgB;IAC/B;;;;;;;;;;;OAWG;IACH,iBAAiB,EAAE,qBAAqB;IACxC;;;;;;;;;;;;;;;;;;OAkBG;IACH,kBAAkB,EAAE,qBAAqB;IACzC;;;;;;;;;;;;OAYG;IACH,gBAAgB,EAAE,mBAAmB;CAC/B,CAAC;AAyBX,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAC/C,YACoB,IAAY,EACZ,SAAiB,EACjB,OA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CAAC,CAAC;QACrE,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QACpF,IAAI,OAAO;YAAE,MAAM,OAAO,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACvB,OAAO,GAAG,CAAC,WAAW,CAAC;IAC3B,CAAC;IAED,oEAAoE;IAC5D,KAAK,CAAC,sBAAsB;QAChC,IAAI,IAAI,CAAC,iBAAiB;YAAE,OAAO;QACnC,MAAM,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC1D,KAAK,MAAM,GAAG,IAAI,YAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;YACxD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,uBAAuB,IAAI,IAAI,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAClC,CAAC;CACJ"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The customer named in a journal entry's description (bc-aidp-next-golive#452).
|
|
3
|
+
*
|
|
4
|
+
* Accounting's batch view lists each entry's description as its memo, and accounting cannot read
|
|
5
|
+
* Orders tables to find the customer itself. So the entries Orders writes for an order or a payment
|
|
6
|
+
* name the customer in the description, next to the order and payment numbers already there.
|
|
7
|
+
*
|
|
8
|
+
* The description column has no length limit (NVARCHAR(MAX)) and the lines sent to the ERP carry
|
|
9
|
+
* their own netted text, so the name is written in full.
|
|
10
|
+
*
|
|
11
|
+
* CONNECTS TO:
|
|
12
|
+
* ORDER: ./OrderJournalEntryFactory.ts — booking and recognition entries
|
|
13
|
+
* PAYMENT: ./PaymentAllocationFactory.ts — cash allocation entries, fed by
|
|
14
|
+
* ./PaymentLineEntityServer.ts and ./PaymentHeaderEntityServer.ts
|
|
15
|
+
*/
|
|
16
|
+
/** The billing names an order header carries (denormalized on the order view). */
|
|
17
|
+
export interface OrderCustomerFields {
|
|
18
|
+
BillToOrganization?: string | null;
|
|
19
|
+
BillToPerson?: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** The customer an order bills: its billing organization, else its billing person, else null. */
|
|
22
|
+
export declare function OrderCustomerName(order: OrderCustomerFields): string | null;
|
|
23
|
+
/** ` — <customer>` to splice into a description, or nothing when no customer is known. */
|
|
24
|
+
export declare function CustomerPart(customerName: string | null | undefined): string;
|
|
25
|
+
//# sourceMappingURL=JournalEntryCustomer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JournalEntryCustomer.d.ts","sourceRoot":"","sources":["../src/JournalEntryCustomer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAChC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CAG3E;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG5E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The customer named in a journal entry's description (bc-aidp-next-golive#452).
|
|
3
|
+
*
|
|
4
|
+
* Accounting's batch view lists each entry's description as its memo, and accounting cannot read
|
|
5
|
+
* Orders tables to find the customer itself. So the entries Orders writes for an order or a payment
|
|
6
|
+
* name the customer in the description, next to the order and payment numbers already there.
|
|
7
|
+
*
|
|
8
|
+
* The description column has no length limit (NVARCHAR(MAX)) and the lines sent to the ERP carry
|
|
9
|
+
* their own netted text, so the name is written in full.
|
|
10
|
+
*
|
|
11
|
+
* CONNECTS TO:
|
|
12
|
+
* ORDER: ./OrderJournalEntryFactory.ts — booking and recognition entries
|
|
13
|
+
* PAYMENT: ./PaymentAllocationFactory.ts — cash allocation entries, fed by
|
|
14
|
+
* ./PaymentLineEntityServer.ts and ./PaymentHeaderEntityServer.ts
|
|
15
|
+
*/
|
|
16
|
+
/** The customer an order bills: its billing organization, else its billing person, else null. */
|
|
17
|
+
export function OrderCustomerName(order) {
|
|
18
|
+
const name = order.BillToOrganization?.trim() || order.BillToPerson?.trim();
|
|
19
|
+
return name || null;
|
|
20
|
+
}
|
|
21
|
+
/** ` — <customer>` to splice into a description, or nothing when no customer is known. */
|
|
22
|
+
export function CustomerPart(customerName) {
|
|
23
|
+
const name = customerName?.trim();
|
|
24
|
+
return name ? ` — ${name}` : '';
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=JournalEntryCustomer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JournalEntryCustomer.js","sourceRoot":"","sources":["../src/JournalEntryCustomer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,KAA0B;IACxD,MAAM,IAAI,GAAG,KAAK,CAAC,kBAAkB,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC;IAC5E,OAAO,IAAI,IAAI,IAAI,CAAC;AACxB,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,YAAY,CAAC,YAAuC;IAChE,MAAM,IAAI,GAAG,YAAY,EAAE,IAAI,EAAE,CAAC;IAClC,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -323,6 +323,8 @@ export declare class OrderEntityServer extends OrderHeaderEntity {
|
|
|
323
323
|
* processes that save without one are not direct entry.
|
|
324
324
|
*/
|
|
325
325
|
private passesOrderReviewGate;
|
|
326
|
+
/** Refuse a confirm of an order with no deal by a user outside the NoDealConfirmRoles setting (golive #390). */
|
|
327
|
+
private passesNoDealConfirmGate;
|
|
326
328
|
/**
|
|
327
329
|
* A save of an unconfirmed order that changes its bill-to, company, prices or service dates sends a
|
|
328
330
|
* deal-created or already-reviewed order (back) to review, and an edit to a renewal's carried-forward
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderEntityServer.d.ts","sourceRoot":"","sources":["../src/OrderEntityServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAKH,mBAAmB,EACnB,iBAAiB,EAUjB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAGH,iBAAiB,EAIjB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"OrderEntityServer.d.ts","sourceRoot":"","sources":["../src/OrderEntityServer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAKH,mBAAmB,EACnB,iBAAiB,EAUjB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAGH,iBAAiB,EAIjB,8BAA8B,EAoBjC,MAAM,8BAA8B,CAAC;AAStC,OAAO,EAAmE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA+C9H,OAAO,EAAuX,KAAK,qBAAqB,EAAgD,KAAK,eAAe,EAAiH,MAAM,8BAA8B,CAAC;AAIlnB,OAAO,EAWH,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE/B,MAAM,2BAA2B,CAAC;AAanC,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,8BAA8B,CAAC;IACrC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,e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C;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,gBAAgB;IAgC9B,8EAA8E;YAChE,iBAAiB;IAsD/B;;;OAGG;IACH,OAAO,CAAC,WAAW;IAenB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;YACW,sBAAsB;IA+CpC;;;;;;OAMG;YACW,wBAAwB;IAUtC;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY;IAapB,2FAA2F;YAC7E,eAAe;IAkB7B;;;;;;;;;;OAUG;YACW,kBAAkB;IA6FhC;;;;;OAKG;IACH,iGAAiG;YACnF,yBAAyB;YAiBzB,qBAAqB;YAwDrB,kBAAkB;IA6DhC;;;;;;OAMG;YACW,oBAAoB;IA+BlC;;;;;;;OAOG;YACW,yBAAyB;IA8EvC;;;;;OAKG;YACW,wBAAwB;IAMtC;;;;;;;;;OASG;YACW,iBAAiB;IAI/B;;;;;;;;;OASG;YACW,YAAY;IAuB1B;;;;;;;;;;OAUG;IACH;;;;;;OAMG;YACW,oCAAoC;YAwBpC,oBAAoB;IAqElC,0EAA0E;YAC5D,gCAAgC;IAmB9C,oFAAoF;YACtE,iBAAiB;YA8BjB,mBAAmB;IAMjC,0FAA0F;YAC5E,aAAa;IAI3B,OAAO,CAAC,WAAW;IAInB;;;;;;;;;;;;OAYG;YACW,kBAAkB;IAyBhC;;;;;;;;;;OAUG;YACW,mBAAmB;IA+BjC,2FAA2F;YAC7E,yBAAyB;YA6CzB,mBAAmB;IAcjC;;;OAGG;YACW,mBAAmB;IAiBjC;;;;OAIG;YACW,mBAAmB;YAYnB,mBAAmB;CAcpC;AAgED,0FAA0F;AAC1F,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C"}
|
|
@@ -34,7 +34,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
34
34
|
*/
|
|
35
35
|
import { BaseEntity, BaseEntityResult, CompositeKey, EntitySaveOptions, LogError, LogStatus, Metadata, RunView, ValidationErrorInfo, ValidationErrorType, } from '@memberjunction/core';
|
|
36
36
|
import { MJGlobal, RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
37
|
-
import { ADDRESS_SNAPSHOT_FIELDS, BuildAddressSnapshot, OrderHeaderEntity, OrderLineEntity, mjBizAppsOrdersEventOrderLineEntity, ToISODate, IsEditable, REVIEWED_HEADER_FIELDS, REVIEWED_LINE_FIELDS, HostOrderConfirmVeto, ResolveOrderConfirmRefusal, HostOrderLineEditVeto, ResolveOrderLineEditRefusal, RunAlongsideRefusal, } from '@mj-biz-apps/orders-entities';
|
|
37
|
+
import { ADDRESS_SNAPSHOT_FIELDS, BuildAddressSnapshot, OrderHeaderEntity, OrderLineEntity, mjBizAppsOrdersEventOrderLineEntity, ToISODate, IsEditable, REVIEWED_HEADER_FIELDS, REVIEWED_LINE_FIELDS, HostOrderConfirmVeto, ResolveOrderConfirmRefusal, HostOrderLineEditVeto, ResolveOrderLineEditRefusal, RunAlongsideRefusal, InitialPaymentDay, } from '@mj-biz-apps/orders-entities';
|
|
38
38
|
import { CalendarDayOrToday } from './calendar-day.js';
|
|
39
39
|
import { ResolveLineParty } from './LineParty.js';
|
|
40
40
|
import { BuildGLAccountResolver, EntityIDFor, LoadAccountingEngine, ResolveAccountingOperation, ResolverEntities } from './AccountingBridge.js';
|
|
@@ -52,11 +52,11 @@ import { IssueGiftCards } from './GiftCardEngine.js';
|
|
|
52
52
|
import { ExpandBundleLines } from './BundleEngine.js';
|
|
53
53
|
import { OrdersSettings } from './OrdersSettings.js';
|
|
54
54
|
import { OrderJournalEntryFactory } from './OrderJournalEntryFactory.js';
|
|
55
|
-
import { RequireUUID, RequireUUIDs } from './sql-guards.js';
|
|
55
|
+
import { EscapeSQLString, RequireUUID, RequireUUIDs } from './sql-guards.js';
|
|
56
56
|
import { ExplainMissingAttendees, LoadLinesWithAttendee, LoadProductsRequiringAttendees } from './AttendeeRequirement.js';
|
|
57
57
|
import { FindUnapprovedConcessions } from './ConcessionGate.js';
|
|
58
58
|
import { RaisePriceBelowEngineExceptions } from './PriceBelowEngineExceptions.js';
|
|
59
|
-
import { CheckOrderReviewAtConfirm, CheckOrderReviewOnChange } from './OrderReview.js';
|
|
59
|
+
import { CheckNoDealConfirm, CheckOrderReviewAtConfirm, CheckOrderReviewOnChange } from './OrderReview.js';
|
|
60
60
|
import { IsSystemOriginWrite, OriginWriteRefusal } from './SystemOrderOrigin.js';
|
|
61
61
|
import { RaiseTermLengthExceptions } from './TermLengthExceptions.js';
|
|
62
62
|
import { DimensionDefaultResolver } from './DimensionDefaultResolver.js';
|
|
@@ -470,6 +470,11 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
|
|
|
470
470
|
return false;
|
|
471
471
|
await this.ApplySavePartyDefaults();
|
|
472
472
|
const booking = this.willBookOnThisSave();
|
|
473
|
+
// A form that saved the draft and then confirmed reloads the HEADER only. Booking needs the
|
|
474
|
+
// collection before the gates below, which read the lines (a renewal-only order is exempt from
|
|
475
|
+
// review and the no-deal check), and before it decides subscriptions.
|
|
476
|
+
if (booking && this.IsSaved && !this.Lines.IsLoaded)
|
|
477
|
+
await this.Lines.Load();
|
|
473
478
|
// NO CONFIRM AHEAD OF A CONCESSION'S APPROVAL. Checked before anything is priced or booked,
|
|
474
479
|
// for the same reason as the status move above: a refused confirm must change nothing.
|
|
475
480
|
if (booking && !(await this.passesConcessionGate()))
|
|
@@ -479,6 +484,10 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
|
|
|
479
484
|
return false;
|
|
480
485
|
// NO CONFIRM AHEAD OF AN ORDER REVIEW (golive #320 §5), once concessions are decided, so the
|
|
481
486
|
// reviewer sees the order as it will book. Off until a host switches a trigger on.
|
|
487
|
+
// ONLY THE ROLES THE NoDealConfirmRoles SETTING NAMES CONFIRM AN ORDER NO DEAL CREATED (golive
|
|
488
|
+
// #390), ahead of the review so a confirm the user may not make raises no review. Off by default.
|
|
489
|
+
if (booking && !(await this.passesNoDealConfirmGate()))
|
|
490
|
+
return false;
|
|
482
491
|
if (booking && !(await this.passesOrderReviewGate()))
|
|
483
492
|
return false;
|
|
484
493
|
// ORDINARY PATH — no booking, and no line work to do.
|
|
@@ -617,11 +626,6 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
|
|
|
617
626
|
// lines, subscription decisions settle the quantities, and each line is priced. None of
|
|
618
627
|
// it writes a row, and none of it needs the header's key — the collection stamps the
|
|
619
628
|
// foreign key itself.
|
|
620
|
-
// A form that saved the draft and then confirmed reloads the HEADER only.
|
|
621
|
-
// Booking is the only caller that MUST have the collection before it decides subscriptions.
|
|
622
|
-
if (booking && this.IsSaved && !this.Lines.IsLoaded) {
|
|
623
|
-
await this.Lines.Load();
|
|
624
|
-
}
|
|
625
629
|
await this.expandBundles();
|
|
626
630
|
// EVERY LINE'S PRODUCT IN THE CATALOG CACHE, reloaded once if any is missing (golive #301).
|
|
627
631
|
// Subscription decisions, the company stamp, dimension tags and booking all read the
|
|
@@ -1078,6 +1082,20 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
|
|
|
1078
1082
|
this.RegisterResultHistoryEntry(this.buildFailureResult(new Error(refusal)));
|
|
1079
1083
|
return false;
|
|
1080
1084
|
}
|
|
1085
|
+
/** Refuse a confirm of an order with no deal by a user outside the NoDealConfirmRoles setting (golive #390). */
|
|
1086
|
+
async passesNoDealConfirmGate() {
|
|
1087
|
+
const user = this.ContextCurrentUser;
|
|
1088
|
+
if (!user)
|
|
1089
|
+
return true;
|
|
1090
|
+
const refusal = await CheckNoDealConfirm(this.reviewOrderInput(), {
|
|
1091
|
+
Provider: this.ProviderToUse,
|
|
1092
|
+
User: user,
|
|
1093
|
+
});
|
|
1094
|
+
if (!refusal)
|
|
1095
|
+
return true;
|
|
1096
|
+
this.RegisterResultHistoryEntry(this.buildFailureResult(new Error(refusal)));
|
|
1097
|
+
return false;
|
|
1098
|
+
}
|
|
1081
1099
|
/**
|
|
1082
1100
|
* A save of an unconfirmed order that changes its bill-to, company, prices or service dates sends a
|
|
1083
1101
|
* deal-created or already-reviewed order (back) to review, and an edit to a renewal's carried-forward
|
|
@@ -1887,7 +1905,7 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
|
|
|
1887
1905
|
const rv = new RunView(this.ProviderToUse);
|
|
1888
1906
|
const res = await rv.RunView({
|
|
1889
1907
|
EntityName: CHARGE_TYPE_ENTITY,
|
|
1890
|
-
ExtraFilter: `ID IN (${unique.map((id) => `'${id
|
|
1908
|
+
ExtraFilter: `ID IN (${unique.map((id) => `'${EscapeSQLString(id)}'`).join(',')})`,
|
|
1891
1909
|
ResultType: 'simple',
|
|
1892
1910
|
}, this.ContextCurrentUser);
|
|
1893
1911
|
for (const row of res.Results ?? [])
|
|
@@ -3680,7 +3698,7 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
|
|
|
3680
3698
|
if (types.length === 0)
|
|
3681
3699
|
return null;
|
|
3682
3700
|
const rv = new RunView(this.ProviderToUse);
|
|
3683
|
-
const quoted = types.map((t) => `'${t
|
|
3701
|
+
const quoted = types.map((t) => `'${EscapeSQLString(t)}'`).join(',');
|
|
3684
3702
|
const date = asOf.toISOString().slice(0, 10);
|
|
3685
3703
|
const result = await rv.RunView({
|
|
3686
3704
|
EntityName: RELATIONSHIP_ENTITY,
|
|
@@ -4285,12 +4303,13 @@ let OrderEntityServer = class OrderEntityServer extends OrderHeaderEntity {
|
|
|
4285
4303
|
payment.ReceivingCompanyID = this.CompanyID;
|
|
4286
4304
|
payment.BillToOrganizationID = this.BillToOrganizationID;
|
|
4287
4305
|
payment.BillToPersonID = this.BillToPersonID;
|
|
4288
|
-
// The
|
|
4289
|
-
//
|
|
4290
|
-
// `DATE` column fed `new Date()`
|
|
4291
|
-
//
|
|
4292
|
-
//
|
|
4293
|
-
payment
|
|
4306
|
+
// The day the money arrived when finance gave one (bc-aidp-next-golive#448), else the order's
|
|
4307
|
+
// own day, else today's business day (#209). `OrderDate` is defaulted at `NewRecord()` since
|
|
4308
|
+
// #168, so the last fallback is very likely unreachable — but a `DATE` column fed `new Date()`
|
|
4309
|
+
// is dated tomorrow for the whole American evening, and the next caller to reach this method
|
|
4310
|
+
// with no order date should not discover that. Keeping the stated day matters just as much:
|
|
4311
|
+
// a backdated order's payment must carry the same date, and so must its cash entry.
|
|
4312
|
+
payment.PaymentDate = await CalendarDayOrToday(InitialPaymentDay(this.OrderDate, this.InitialPaymentReceivedDate), provider, user);
|
|
4294
4313
|
payment.PaymentTypeID = this.InitialPaymentTypeID;
|
|
4295
4314
|
payment.Amount = amount;
|
|
4296
4315
|
payment.PaymentDetailID = paymentDetailID;
|