@mj-biz-apps/contracts-entities 0.1.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/LICENSE +183 -0
- package/dist/ContractEntity.d.ts +181 -0
- package/dist/ContractEntity.d.ts.map +1 -0
- package/dist/ContractEntity.js +261 -0
- package/dist/ContractEntity.js.map +1 -0
- package/dist/ContractTemplateEntity.d.ts +50 -0
- package/dist/ContractTemplateEntity.d.ts.map +1 -0
- package/dist/ContractTemplateEntity.js +85 -0
- package/dist/ContractTemplateEntity.js.map +1 -0
- package/dist/ContractTemplateModificationEntity.d.ts +46 -0
- package/dist/ContractTemplateModificationEntity.d.ts.map +1 -0
- package/dist/ContractTemplateModificationEntity.js +72 -0
- package/dist/ContractTemplateModificationEntity.js.map +1 -0
- package/dist/ContractTemplateProvisionEntity.d.ts +45 -0
- package/dist/ContractTemplateProvisionEntity.d.ts.map +1 -0
- package/dist/ContractTemplateProvisionEntity.js +73 -0
- package/dist/ContractTemplateProvisionEntity.js.map +1 -0
- package/dist/ContractTypeEntity.d.ts +55 -0
- package/dist/ContractTypeEntity.d.ts.map +1 -0
- package/dist/ContractTypeEntity.js +82 -0
- package/dist/ContractTypeEntity.js.map +1 -0
- package/dist/contract-state.d.ts +49 -0
- package/dist/contract-state.d.ts.map +1 -0
- package/dist/contract-state.js +48 -0
- package/dist/contract-state.js.map +1 -0
- package/dist/generated/entity_subclasses.d.ts +1235 -0
- package/dist/generated/entity_subclasses.d.ts.map +1 -0
- package/dist/generated/entity_subclasses.js +1817 -0
- package/dist/generated/entity_subclasses.js.map +1 -0
- package/dist/generated/remote_operations.d.ts +1145 -0
- package/dist/generated/remote_operations.d.ts.map +1 -0
- package/dist/generated/remote_operations.js +426 -0
- package/dist/generated/remote_operations.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/required-field-prose.d.ts +48 -0
- package/dist/required-field-prose.d.ts.map +1 -0
- package/dist/required-field-prose.js +55 -0
- package/dist/required-field-prose.js.map +1 -0
- package/dist/value-list-validation.d.ts +69 -0
- package/dist/value-list-validation.d.ts.map +1 -0
- package/dist/value-list-validation.js +88 -0
- package/dist/value-list-validation.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,1817 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseEntity, CompositeKey, ValidationErrorInfo, ValidationErrorType } from "@memberjunction/core";
|
|
8
|
+
import { RegisterClass } from "@memberjunction/global";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
export const loadModule = () => {
|
|
11
|
+
// no-op, only used to ensure this file is a valid module and to allow easy loading
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* zod schema definition for the entity MJ_BizApps_Contracts: Contract Template Modifications
|
|
15
|
+
*/
|
|
16
|
+
export const mjBizAppsContractsContractTemplateModificationSchema = z.object({
|
|
17
|
+
ID: z.string().describe(`
|
|
18
|
+
* * Field Name: ID
|
|
19
|
+
* * Display Name: ID
|
|
20
|
+
* * SQL Data Type: uniqueidentifier
|
|
21
|
+
* * Default Value: newsequentialid()`),
|
|
22
|
+
ContractID: z.string().describe(`
|
|
23
|
+
* * Field Name: ContractID
|
|
24
|
+
* * Display Name: Contract
|
|
25
|
+
* * SQL Data Type: uniqueidentifier
|
|
26
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contracts (vwContracts.ID)`),
|
|
27
|
+
ContractTemplateProvisionID: z.string().describe(`
|
|
28
|
+
* * Field Name: ContractTemplateProvisionID
|
|
29
|
+
* * Display Name: Contract Template Provision
|
|
30
|
+
* * SQL Data Type: uniqueidentifier
|
|
31
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Template Provisions (vwContractTemplateProvisions.ID)
|
|
32
|
+
* * Description: The provision being modified — the structured identifier, and the only one. A server rule enforces what this replaces: the provision must belong to a template this contract incorporates.`),
|
|
33
|
+
ModificationText: z.string().describe(`
|
|
34
|
+
* * Field Name: ModificationText
|
|
35
|
+
* * Display Name: Modification Text
|
|
36
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
37
|
+
* * Description: What this contract says INSTEAD of the standard clause. Read as a pair with ContractTemplateProvision.ProvisionText.`),
|
|
38
|
+
Notes: z.string().nullable().describe(`
|
|
39
|
+
* * Field Name: Notes
|
|
40
|
+
* * Display Name: Notes
|
|
41
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
42
|
+
* * Description: Optional working note, e.g. who negotiated it.`),
|
|
43
|
+
__mj_CreatedAt: z.date().describe(`
|
|
44
|
+
* * Field Name: __mj_CreatedAt
|
|
45
|
+
* * Display Name: Created At
|
|
46
|
+
* * SQL Data Type: datetimeoffset
|
|
47
|
+
* * Default Value: getutcdate()`),
|
|
48
|
+
__mj_UpdatedAt: z.date().describe(`
|
|
49
|
+
* * Field Name: __mj_UpdatedAt
|
|
50
|
+
* * Display Name: Updated At
|
|
51
|
+
* * SQL Data Type: datetimeoffset
|
|
52
|
+
* * Default Value: getutcdate()`),
|
|
53
|
+
Contract: z.string().nullable().describe(`
|
|
54
|
+
* * Field Name: Contract
|
|
55
|
+
* * Display Name: Contract
|
|
56
|
+
* * SQL Data Type: nvarchar(50)`),
|
|
57
|
+
ContractTemplateProvision: z.string().describe(`
|
|
58
|
+
* * Field Name: ContractTemplateProvision
|
|
59
|
+
* * Display Name: Contract Template Provision
|
|
60
|
+
* * SQL Data Type: nvarchar(20)`),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* zod schema definition for the entity MJ_BizApps_Contracts: Contract Template Provisions
|
|
64
|
+
*/
|
|
65
|
+
export const mjBizAppsContractsContractTemplateProvisionSchema = z.object({
|
|
66
|
+
ID: z.string().describe(`
|
|
67
|
+
* * Field Name: ID
|
|
68
|
+
* * Display Name: ID
|
|
69
|
+
* * SQL Data Type: uniqueidentifier
|
|
70
|
+
* * Default Value: newsequentialid()`),
|
|
71
|
+
ContractTemplateID: z.string().describe(`
|
|
72
|
+
* * Field Name: ContractTemplateID
|
|
73
|
+
* * Display Name: Contract Template
|
|
74
|
+
* * SQL Data Type: uniqueidentifier
|
|
75
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Templates (vwContractTemplates.ID)`),
|
|
76
|
+
ProvisionNumber: z.string().describe(`
|
|
77
|
+
* * Field Name: ProvisionNumber
|
|
78
|
+
* * Display Name: Provision Number
|
|
79
|
+
* * SQL Data Type: nvarchar(20)
|
|
80
|
+
* * Description: The clause number as the document writes it, e.g. "3.5(b)". Unique within its template.`),
|
|
81
|
+
Title: z.string().describe(`
|
|
82
|
+
* * Field Name: Title
|
|
83
|
+
* * Display Name: Title
|
|
84
|
+
* * SQL Data Type: nvarchar(200)
|
|
85
|
+
* * Description: The clause heading, e.g. "Limitation of Liability". This plus the number is what a person picks from.`),
|
|
86
|
+
ProvisionText: z.string().describe(`
|
|
87
|
+
* * Field Name: ProvisionText
|
|
88
|
+
* * Display Name: Provision Text
|
|
89
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
90
|
+
* * Description: The STANDARD wording of this clause. Read as a pair with ContractTemplateModification.ModificationText, which holds what a given contract says instead — a dispute needs the comparison, not either half.`),
|
|
91
|
+
Description: z.string().nullable().describe(`
|
|
92
|
+
* * Field Name: Description
|
|
93
|
+
* * Display Name: Description
|
|
94
|
+
* * SQL Data Type: nvarchar(MAX)`),
|
|
95
|
+
ProvisionSortKey: z.string().nullable().describe(`
|
|
96
|
+
* * Field Name: ProvisionSortKey
|
|
97
|
+
* * Display Name: Sort Key
|
|
98
|
+
* * SQL Data Type: nvarchar(200)
|
|
99
|
+
* * Description: Collation key derived from ProvisionNumber: every run of digits zero-padded to six places, everything else upper-cased. Makes a plain SQL ORDER BY produce natural order ('1.9' before '1.10'), which ordering by ProvisionNumber cannot. READ-ONLY -- a persisted computed column; nobody should be able to set a sort key. Replaced the hand-maintained Sequence column, which had already collided in the seeded data.`),
|
|
100
|
+
__mj_CreatedAt: z.date().describe(`
|
|
101
|
+
* * Field Name: __mj_CreatedAt
|
|
102
|
+
* * Display Name: Created At
|
|
103
|
+
* * SQL Data Type: datetimeoffset
|
|
104
|
+
* * Default Value: getutcdate()`),
|
|
105
|
+
__mj_UpdatedAt: z.date().describe(`
|
|
106
|
+
* * Field Name: __mj_UpdatedAt
|
|
107
|
+
* * Display Name: Updated At
|
|
108
|
+
* * SQL Data Type: datetimeoffset
|
|
109
|
+
* * Default Value: getutcdate()`),
|
|
110
|
+
ContractTemplate: z.string().describe(`
|
|
111
|
+
* * Field Name: ContractTemplate
|
|
112
|
+
* * Display Name: Contract Template Name
|
|
113
|
+
* * SQL Data Type: nvarchar(200)`),
|
|
114
|
+
});
|
|
115
|
+
/**
|
|
116
|
+
* zod schema definition for the entity MJ_BizApps_Contracts: Contract Template Types
|
|
117
|
+
*/
|
|
118
|
+
export const mjBizAppsContractsContractTemplateTypeSchema = z.object({
|
|
119
|
+
ID: z.string().describe(`
|
|
120
|
+
* * Field Name: ID
|
|
121
|
+
* * Display Name: ID
|
|
122
|
+
* * SQL Data Type: uniqueidentifier
|
|
123
|
+
* * Default Value: newsequentialid()`),
|
|
124
|
+
Name: z.string().describe(`
|
|
125
|
+
* * Field Name: Name
|
|
126
|
+
* * Display Name: Name
|
|
127
|
+
* * SQL Data Type: nvarchar(100)`),
|
|
128
|
+
Description: z.string().nullable().describe(`
|
|
129
|
+
* * Field Name: Description
|
|
130
|
+
* * Display Name: Description
|
|
131
|
+
* * SQL Data Type: nvarchar(MAX)`),
|
|
132
|
+
Status: z.union([z.literal('Active'), z.literal('Inactive')]).describe(`
|
|
133
|
+
* * Field Name: Status
|
|
134
|
+
* * Display Name: Status
|
|
135
|
+
* * SQL Data Type: nvarchar(10)
|
|
136
|
+
* * Default Value: Active
|
|
137
|
+
* * Value List Type: List
|
|
138
|
+
* * Possible Values
|
|
139
|
+
* * Active
|
|
140
|
+
* * Inactive
|
|
141
|
+
* * Description: Active | Inactive. Retiring a type hides it from pickers without touching the templates that used it.`),
|
|
142
|
+
__mj_CreatedAt: z.date().describe(`
|
|
143
|
+
* * Field Name: __mj_CreatedAt
|
|
144
|
+
* * Display Name: Created At
|
|
145
|
+
* * SQL Data Type: datetimeoffset
|
|
146
|
+
* * Default Value: getutcdate()`),
|
|
147
|
+
__mj_UpdatedAt: z.date().describe(`
|
|
148
|
+
* * Field Name: __mj_UpdatedAt
|
|
149
|
+
* * Display Name: Updated At
|
|
150
|
+
* * SQL Data Type: datetimeoffset
|
|
151
|
+
* * Default Value: getutcdate()`),
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* zod schema definition for the entity MJ_BizApps_Contracts: Contract Templates
|
|
155
|
+
*/
|
|
156
|
+
export const mjBizAppsContractsContractTemplateSchema = z.object({
|
|
157
|
+
ID: z.string().describe(`
|
|
158
|
+
* * Field Name: ID
|
|
159
|
+
* * Display Name: ID
|
|
160
|
+
* * SQL Data Type: uniqueidentifier
|
|
161
|
+
* * Default Value: newsequentialid()`),
|
|
162
|
+
Name: z.string().describe(`
|
|
163
|
+
* * Field Name: Name
|
|
164
|
+
* * Display Name: Name
|
|
165
|
+
* * SQL Data Type: nvarchar(200)`),
|
|
166
|
+
ContractTemplateTypeID: z.string().describe(`
|
|
167
|
+
* * Field Name: ContractTemplateTypeID
|
|
168
|
+
* * Display Name: Contract Template Type ID
|
|
169
|
+
* * SQL Data Type: uniqueidentifier
|
|
170
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Template Types (vwContractTemplateTypes.ID)`),
|
|
171
|
+
VersionLabel: z.string().nullable().describe(`
|
|
172
|
+
* * Field Name: VersionLabel
|
|
173
|
+
* * Display Name: Version Label
|
|
174
|
+
* * SQL Data Type: nvarchar(50)
|
|
175
|
+
* * Description: The version the document names itself, e.g. "v6". Free text, because it is the documents own label rather than something we derive.`),
|
|
176
|
+
IntroducedDate: z.date().nullable().describe(`
|
|
177
|
+
* * Field Name: IntroducedDate
|
|
178
|
+
* * Display Name: Introduced Date
|
|
179
|
+
* * SQL Data Type: date
|
|
180
|
+
* * Description: When this version started being offered. NOT an effective date: a template becomes effective for a customer when THAT customer signs it, never on a calendar date. Naming it EffectiveDate would invite exactly the wrong query.`),
|
|
181
|
+
SourceURL: z.string().nullable().describe(`
|
|
182
|
+
* * Field Name: SourceURL
|
|
183
|
+
* * Display Name: Source URL
|
|
184
|
+
* * SQL Data Type: nvarchar(1000)
|
|
185
|
+
* * Description: The dated public URL a customer can open to read the standard terms. NULLABLE: reachability is enforceable by nothing (a well-formed dead link passes any format check), and the real rule is "a URL OR an attached file" — the file half attaching through __mj.FileEntityRecordLink, which cannot reference a record that does not exist yet, so on CREATE it is unsatisfiable in principle. A template with neither is INCOMPLETE rather than invalid; the derived IsUsable column on vwContractTemplates is what says so.`),
|
|
186
|
+
Description: z.string().nullable().describe(`
|
|
187
|
+
* * Field Name: Description
|
|
188
|
+
* * Display Name: Description
|
|
189
|
+
* * SQL Data Type: nvarchar(MAX)`),
|
|
190
|
+
Status: z.union([z.literal('Draft'), z.literal('Published')]).describe(`
|
|
191
|
+
* * Field Name: Status
|
|
192
|
+
* * Display Name: Status
|
|
193
|
+
* * SQL Data Type: nvarchar(20)
|
|
194
|
+
* * Default Value: Draft
|
|
195
|
+
* * Value List Type: List
|
|
196
|
+
* * Possible Values
|
|
197
|
+
* * Draft
|
|
198
|
+
* * Published
|
|
199
|
+
* * Description: Publication lifecycle. 'Draft' -- freely editable, provisions may be added, changed and removed, and a contract may not NEWLY reference it. 'Published' -- the provisions are frozen against INSERT, UPDATE and DELETE by trg_ContractTemplateProvision_Immutability, and contracts may reference it. Publishing is ONE-WAY (enforced in ContractTemplateEntity): to change published terms, publish a new version -- that is what VersionLabel exists for. Existing references are never invalidated by this column; only new ones are policed, the same way ContractType.Status works.`),
|
|
200
|
+
__mj_CreatedAt: z.date().describe(`
|
|
201
|
+
* * Field Name: __mj_CreatedAt
|
|
202
|
+
* * Display Name: Created At
|
|
203
|
+
* * SQL Data Type: datetimeoffset
|
|
204
|
+
* * Default Value: getutcdate()`),
|
|
205
|
+
__mj_UpdatedAt: z.date().describe(`
|
|
206
|
+
* * Field Name: __mj_UpdatedAt
|
|
207
|
+
* * Display Name: Updated At
|
|
208
|
+
* * SQL Data Type: datetimeoffset
|
|
209
|
+
* * Default Value: getutcdate()`),
|
|
210
|
+
ContractTemplateType: z.string().describe(`
|
|
211
|
+
* * Field Name: ContractTemplateType
|
|
212
|
+
* * Display Name: Contract Template Type
|
|
213
|
+
* * SQL Data Type: nvarchar(100)`),
|
|
214
|
+
IsUsable: z.boolean().nullable().describe(`
|
|
215
|
+
* * Field Name: IsUsable
|
|
216
|
+
* * Display Name: Is Usable
|
|
217
|
+
* * SQL Data Type: bit`),
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* zod schema definition for the entity MJ_BizApps_Contracts: Contract Types
|
|
221
|
+
*/
|
|
222
|
+
export const mjBizAppsContractsContractTypeSchema = z.object({
|
|
223
|
+
ID: z.string().describe(`
|
|
224
|
+
* * Field Name: ID
|
|
225
|
+
* * Display Name: ID
|
|
226
|
+
* * SQL Data Type: uniqueidentifier
|
|
227
|
+
* * Default Value: newsequentialid()`),
|
|
228
|
+
Name: z.string().describe(`
|
|
229
|
+
* * Field Name: Name
|
|
230
|
+
* * Display Name: Name
|
|
231
|
+
* * SQL Data Type: nvarchar(100)`),
|
|
232
|
+
Description: z.string().nullable().describe(`
|
|
233
|
+
* * Field Name: Description
|
|
234
|
+
* * Display Name: Description
|
|
235
|
+
* * SQL Data Type: nvarchar(MAX)`),
|
|
236
|
+
RequiresExecutedDocument: z.boolean().describe(`
|
|
237
|
+
* * Field Name: RequiresExecutedDocument
|
|
238
|
+
* * Display Name: Requires Executed Document
|
|
239
|
+
* * SQL Data Type: bit
|
|
240
|
+
* * Default Value: 1
|
|
241
|
+
* * Description: Whether paper is ever expected for this kind of contract. No for a Payment Link, which has an implied agreement and no signature. This is what stops such a contract asking forever for a document that will never arrive: "awaiting the document" is DERIVED as requires-it AND no-linked-file, never stored and never a status value.`),
|
|
242
|
+
Status: z.union([z.literal('Active'), z.literal('Inactive')]).describe(`
|
|
243
|
+
* * Field Name: Status
|
|
244
|
+
* * Display Name: Status
|
|
245
|
+
* * SQL Data Type: nvarchar(10)
|
|
246
|
+
* * Default Value: Active
|
|
247
|
+
* * Value List Type: List
|
|
248
|
+
* * Possible Values
|
|
249
|
+
* * Active
|
|
250
|
+
* * Inactive
|
|
251
|
+
* * Description: Active | Inactive.`),
|
|
252
|
+
MustBeRoot: z.boolean().describe(`
|
|
253
|
+
* * Field Name: MustBeRoot
|
|
254
|
+
* * Display Name: Must Be Root
|
|
255
|
+
* * SQL Data Type: bit
|
|
256
|
+
* * Default Value: 0
|
|
257
|
+
* * Description: This type of contract may NOT name a ParentContractID -- it is a root agreement. Enforced in ContractEntityServer.ValidateAsync. Mutually exclusive with MustBeChild (CK_ContractType_RootOrChild); both false means no restriction on where in the tree this type may sit, which is the honest default.`),
|
|
258
|
+
MustBeChild: z.boolean().describe(`
|
|
259
|
+
* * Field Name: MustBeChild
|
|
260
|
+
* * Display Name: Must Be Child
|
|
261
|
+
* * SQL Data Type: bit
|
|
262
|
+
* * Default Value: 0
|
|
263
|
+
* * Description: This type of contract MUST name a ParentContractID -- a Change Order that amends nothing is not a change order, and would never appear in the original agreement's lineage. Enforced in ContractEntityServer.ValidateAsync. Mutually exclusive with MustBeRoot.`),
|
|
264
|
+
TemplateRequired: z.boolean().describe(`
|
|
265
|
+
* * Field Name: TemplateRequired
|
|
266
|
+
* * Display Name: Template Required
|
|
267
|
+
* * SQL Data Type: bit
|
|
268
|
+
* * Default Value: 0
|
|
269
|
+
* * Description: This type of contract must carry its own ContractTemplateID -- the standard terms it incorporates. On the TYPE rather than inferred from the placement flags, because 'where in the tree' and 'does it need its own paper' are different questions and a future type could want any combination.`),
|
|
270
|
+
__mj_CreatedAt: z.date().describe(`
|
|
271
|
+
* * Field Name: __mj_CreatedAt
|
|
272
|
+
* * Display Name: Created At
|
|
273
|
+
* * SQL Data Type: datetimeoffset
|
|
274
|
+
* * Default Value: getutcdate()`),
|
|
275
|
+
__mj_UpdatedAt: z.date().describe(`
|
|
276
|
+
* * Field Name: __mj_UpdatedAt
|
|
277
|
+
* * Display Name: Updated At
|
|
278
|
+
* * SQL Data Type: datetimeoffset
|
|
279
|
+
* * Default Value: getutcdate()`),
|
|
280
|
+
});
|
|
281
|
+
/**
|
|
282
|
+
* zod schema definition for the entity MJ_BizApps_Contracts: Contracts
|
|
283
|
+
*/
|
|
284
|
+
export const mjBizAppsContractsContractSchema = z.object({
|
|
285
|
+
ID: z.string().describe(`
|
|
286
|
+
* * Field Name: ID
|
|
287
|
+
* * Display Name: ID
|
|
288
|
+
* * SQL Data Type: uniqueidentifier
|
|
289
|
+
* * Default Value: newsequentialid()`),
|
|
290
|
+
ContractNumber: z.string().nullable().describe(`
|
|
291
|
+
* * Field Name: ContractNumber
|
|
292
|
+
* * Display Name: Contract Number
|
|
293
|
+
* * SQL Data Type: nvarchar(50)
|
|
294
|
+
* * Description: CTR-000001, minted by spAssignNextContractNumber from the seq_ContractNumber database SEQUENCE. Unique. NULLABLE at the schema level because MJ cannot express 'NOT NULL, assigned by the server on insert' -- ContractEntityServer.Save() is what guarantees every contract has one. Gaps are normal and are not to be 'fixed': a save that fails after taking a number leaves one behind, and UQ_Contract_ContractNumber is what guarantees no two contracts share a number.`),
|
|
295
|
+
ContractTypeID: z.string().describe(`
|
|
296
|
+
* * Field Name: ContractTypeID
|
|
297
|
+
* * Display Name: Contract Type
|
|
298
|
+
* * SQL Data Type: uniqueidentifier
|
|
299
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Types (vwContractTypes.ID)`),
|
|
300
|
+
CompanyID: z.string().describe(`
|
|
301
|
+
* * Field Name: CompanyID
|
|
302
|
+
* * Display Name: Company
|
|
303
|
+
* * SQL Data Type: uniqueidentifier
|
|
304
|
+
* * Related Entity/Foreign Key: MJ: Companies (vwCompanies.ID)
|
|
305
|
+
* * Description: The SELLING company (__mj.Company) — which of OUR entities holds this agreement. Not the customer. Stored rather than derived because it is not reliably recoverable from the deal.`),
|
|
306
|
+
CustomerOrganizationID: z.string().describe(`
|
|
307
|
+
* * Field Name: CustomerOrganizationID
|
|
308
|
+
* * Display Name: Customer Organization
|
|
309
|
+
* * SQL Data Type: uniqueidentifier
|
|
310
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Common: Organizations (vwOrganizations.ID)
|
|
311
|
+
* * Description: The customer. NOT NULL: contracts are B2B here by definition, and the individual case lives entirely in orders. v1 allowed an organization-or-person XOR; that is gone.`),
|
|
312
|
+
PrimaryContactPersonID: z.string().nullable().describe(`
|
|
313
|
+
* * Field Name: PrimaryContactPersonID
|
|
314
|
+
* * Display Name: Primary Contact Person
|
|
315
|
+
* * SQL Data Type: uniqueidentifier
|
|
316
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Common: People (vwPeople.ID)
|
|
317
|
+
* * Description: Their named contact, optional.`),
|
|
318
|
+
ContractTemplateID: z.string().nullable().describe(`
|
|
319
|
+
* * Field Name: ContractTemplateID
|
|
320
|
+
* * Display Name: Contract Template
|
|
321
|
+
* * SQL Data Type: uniqueidentifier
|
|
322
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Templates (vwContractTemplates.ID)
|
|
323
|
+
* * Description: The agreement version this contract incorporates. Nullable because a contract created automatically at Closed Won has none until finance reads the PDF.`),
|
|
324
|
+
CreatingEntityID: z.string().nullable().describe(`
|
|
325
|
+
* * Field Name: CreatingEntityID
|
|
326
|
+
* * Display Name: Creating Entity
|
|
327
|
+
* * SQL Data Type: uniqueidentifier
|
|
328
|
+
* * Related Entity/Foreign Key: MJ: Entities (vwEntities.ID)
|
|
329
|
+
* * Description: Polymorphic reference part 1: the MJ Entity of the record that CREATED this contract, in practice Deals. A real foreign key to __mj.Entity — this is the half that is enforced, and the half that lets MJ resolve the pair generically. Same pattern accounting uses for JournalEntry provenance.`),
|
|
330
|
+
CreatingRecordID: z.string().nullable().describe(`
|
|
331
|
+
* * Field Name: CreatingRecordID
|
|
332
|
+
* * Display Name: Creating Record
|
|
333
|
+
* * SQL Data Type: nvarchar(450)
|
|
334
|
+
* * Description: Polymorphic reference part 2: the creating records id. Soft by nature — it points at a record owned by an app this repo has no knowledge of. Set together with CreatingEntityID or not at all.`),
|
|
335
|
+
ParentContractID: z.string().nullable().describe(`
|
|
336
|
+
* * Field Name: ParentContractID
|
|
337
|
+
* * Display Name: Parent Contract
|
|
338
|
+
* * SQL Data Type: uniqueidentifier
|
|
339
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contracts (vwContracts.ID)
|
|
340
|
+
* * Description: The contract this one amends. How a change order attaches: a change order is signed paper with its own PDF, dates and modifications, so it reuses this entity rather than getting one of its own. The original stays in force.`),
|
|
341
|
+
SupersededByContractID: z.string().nullable().describe(`
|
|
342
|
+
* * Field Name: SupersededByContractID
|
|
343
|
+
* * Display Name: Superseded By Contract
|
|
344
|
+
* * SQL Data Type: uniqueidentifier
|
|
345
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contracts (vwContracts.ID)
|
|
346
|
+
* * Description: The contract that REPLACED this one, where an agreement was re-papered rather than amended. Also the sole source of the derived Superseded state, which is why the old CHECK tying it to a Status column disappeared with that column.`),
|
|
347
|
+
SigningProviderURL: z.string().nullable().describe(`
|
|
348
|
+
* * Field Name: SigningProviderURL
|
|
349
|
+
* * Display Name: Signing Provider URL
|
|
350
|
+
* * SQL Data Type: nvarchar(1000)
|
|
351
|
+
* * Description: Direct link to the document in the signing provider (PandaDoc). The fallback that works before any integration exists, and when a storage sync has broken.`),
|
|
352
|
+
EffectiveDate: z.date().nullable().describe(`
|
|
353
|
+
* * Field Name: EffectiveDate
|
|
354
|
+
* * Display Name: Effective Date
|
|
355
|
+
* * SQL Data Type: date
|
|
356
|
+
* * Description: When the agreement takes effect.`),
|
|
357
|
+
ExecutedDate: z.date().nullable().describe(`
|
|
358
|
+
* * Field Name: ExecutedDate
|
|
359
|
+
* * Display Name: Executed Date
|
|
360
|
+
* * SQL Data Type: date
|
|
361
|
+
* * Description: When it was signed. May legitimately PRECEDE EffectiveDate — sign in December for a January start is the ordinary case. There is deliberately no constraint ordering the two; v1 had one and it rejected exactly the data a correct contract produces.`),
|
|
362
|
+
EndDate: z.date().nullable().describe(`
|
|
363
|
+
* * Field Name: EndDate
|
|
364
|
+
* * Display Name: End Date
|
|
365
|
+
* * SQL Data Type: date
|
|
366
|
+
* * Description: When the current term ends. This is what drives the renewal watchlist and every expiry projection.`),
|
|
367
|
+
TerminatedDate: z.date().nullable().describe(`
|
|
368
|
+
* * Field Name: TerminatedDate
|
|
369
|
+
* * Display Name: Terminated Date
|
|
370
|
+
* * SQL Data Type: date
|
|
371
|
+
* * Description: When the agreement ended early. Stored rather than derived: it is only recoverable from a successors effective date, and a contract can end with no successor at all when a customer simply leaves.`),
|
|
372
|
+
AutoRenew: z.boolean().describe(`
|
|
373
|
+
* * Field Name: AutoRenew
|
|
374
|
+
* * Display Name: Auto Renew
|
|
375
|
+
* * SQL Data Type: bit
|
|
376
|
+
* * Default Value: 0
|
|
377
|
+
* * Description: Whether the agreement auto-renews, AS THE PAPER STATES IT. True or false, no third state. Distinct from the subscriptions operational setting in orders, which someone can change later; when the two disagree that is a finding, not a bug.`),
|
|
378
|
+
RenewalNoticeDays: z.number().nullable().describe(`
|
|
379
|
+
* * Field Name: RenewalNoticeDays
|
|
380
|
+
* * Display Name: Renewal Notice Days
|
|
381
|
+
* * SQL Data Type: int
|
|
382
|
+
* * Description: Days of written notice we owe before a renewal price change, as stated in the agreement. NOT the same field as CancellationWindowDays even though many agreements set them equal — conflating them silently is how a notice obligation gets missed.`),
|
|
383
|
+
CancellationWindowDays: z.number().nullable().describe(`
|
|
384
|
+
* * Field Name: CancellationWindowDays
|
|
385
|
+
* * Display Name: Cancellation Window Days
|
|
386
|
+
* * SQL Data Type: int
|
|
387
|
+
* * Description: Days of notice the customer owes to cancel without renewing.`),
|
|
388
|
+
AnnualIncreasePercent: z.number().nullable().describe(`
|
|
389
|
+
* * Field Name: AnnualIncreasePercent
|
|
390
|
+
* * Display Name: Annual Increase Percent
|
|
391
|
+
* * SQL Data Type: decimal(7, 4)
|
|
392
|
+
* * Description: The negotiated year-over-year uplift. Exists here because it exists nowhere else: the orders schema has no escalation concept of any kind, which is why a two-year agreement stepping up 10% in year two is recorded in no other system.`),
|
|
393
|
+
HasModifications: z.boolean().describe(`
|
|
394
|
+
* * Field Name: HasModifications
|
|
395
|
+
* * Display Name: Has Modifications
|
|
396
|
+
* * SQL Data Type: bit
|
|
397
|
+
* * Default Value: 0
|
|
398
|
+
* * Description: Whether the standard agreement was changed for this customer. ASSERTED by a person, not derived — its job is to say "go read the PDF" BEFORE anyone has recorded the modifications, and a derived flag would read false for every contract nobody has processed yet. One direction IS enforced server-side: if modification rows exist this must be true. It is never cleared automatically.`),
|
|
399
|
+
Description: z.string().nullable().describe(`
|
|
400
|
+
* * Field Name: Description
|
|
401
|
+
* * Display Name: Description
|
|
402
|
+
* * SQL Data Type: nvarchar(MAX)`),
|
|
403
|
+
Notes: z.string().nullable().describe(`
|
|
404
|
+
* * Field Name: Notes
|
|
405
|
+
* * Display Name: Notes
|
|
406
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
407
|
+
* * Description: Free-text working notes for whoever is processing the contract.`),
|
|
408
|
+
__mj_CreatedAt: z.date().describe(`
|
|
409
|
+
* * Field Name: __mj_CreatedAt
|
|
410
|
+
* * Display Name: Created At
|
|
411
|
+
* * SQL Data Type: datetimeoffset
|
|
412
|
+
* * Default Value: getutcdate()`),
|
|
413
|
+
__mj_UpdatedAt: z.date().describe(`
|
|
414
|
+
* * Field Name: __mj_UpdatedAt
|
|
415
|
+
* * Display Name: Updated At
|
|
416
|
+
* * SQL Data Type: datetimeoffset
|
|
417
|
+
* * Default Value: getutcdate()`),
|
|
418
|
+
ContractType: z.string().describe(`
|
|
419
|
+
* * Field Name: ContractType
|
|
420
|
+
* * Display Name: Contract Type Name
|
|
421
|
+
* * SQL Data Type: nvarchar(100)`),
|
|
422
|
+
Company: z.string().describe(`
|
|
423
|
+
* * Field Name: Company
|
|
424
|
+
* * Display Name: Company Name
|
|
425
|
+
* * SQL Data Type: nvarchar(50)`),
|
|
426
|
+
CustomerOrganization: z.string().describe(`
|
|
427
|
+
* * Field Name: CustomerOrganization
|
|
428
|
+
* * Display Name: Customer Name
|
|
429
|
+
* * SQL Data Type: nvarchar(255)`),
|
|
430
|
+
PrimaryContactPerson: z.string().nullable().describe(`
|
|
431
|
+
* * Field Name: PrimaryContactPerson
|
|
432
|
+
* * Display Name: Primary Contact Name
|
|
433
|
+
* * SQL Data Type: nvarchar(100)`),
|
|
434
|
+
ContractTemplate: z.string().nullable().describe(`
|
|
435
|
+
* * Field Name: ContractTemplate
|
|
436
|
+
* * Display Name: Contract Template Name
|
|
437
|
+
* * SQL Data Type: nvarchar(200)`),
|
|
438
|
+
CreatingEntity: z.string().nullable().describe(`
|
|
439
|
+
* * Field Name: CreatingEntity
|
|
440
|
+
* * Display Name: Creating Entity Name
|
|
441
|
+
* * SQL Data Type: nvarchar(255)`),
|
|
442
|
+
ParentContract: z.string().nullable().describe(`
|
|
443
|
+
* * Field Name: ParentContract
|
|
444
|
+
* * Display Name: Parent Contract Name
|
|
445
|
+
* * SQL Data Type: nvarchar(50)`),
|
|
446
|
+
SupersededByContract: z.string().nullable().describe(`
|
|
447
|
+
* * Field Name: SupersededByContract
|
|
448
|
+
* * Display Name: Superseded By Contract Name
|
|
449
|
+
* * SQL Data Type: nvarchar(50)`),
|
|
450
|
+
State: z.string().describe(`
|
|
451
|
+
* * Field Name: State
|
|
452
|
+
* * Display Name: State
|
|
453
|
+
* * SQL Data Type: varchar(10)`),
|
|
454
|
+
IsAwaitingDocument: z.boolean().nullable().describe(`
|
|
455
|
+
* * Field Name: IsAwaitingDocument
|
|
456
|
+
* * Display Name: Is Awaiting Document
|
|
457
|
+
* * SQL Data Type: bit`),
|
|
458
|
+
DaysToEnd: z.number().nullable().describe(`
|
|
459
|
+
* * Field Name: DaysToEnd
|
|
460
|
+
* * Display Name: Days To End
|
|
461
|
+
* * SQL Data Type: int`),
|
|
462
|
+
RenewalNoticeDeadline: z.date().nullable().describe(`
|
|
463
|
+
* * Field Name: RenewalNoticeDeadline
|
|
464
|
+
* * Display Name: Renewal Notice Deadline
|
|
465
|
+
* * SQL Data Type: date`),
|
|
466
|
+
IsInCancellationWindow: z.boolean().nullable().describe(`
|
|
467
|
+
* * Field Name: IsInCancellationWindow
|
|
468
|
+
* * Display Name: Is In Cancellation Window
|
|
469
|
+
* * SQL Data Type: bit`),
|
|
470
|
+
});
|
|
471
|
+
/**
|
|
472
|
+
* MJ_BizApps_Contracts: Contract Template Modifications - strongly typed entity sub-class
|
|
473
|
+
* * Schema: __mj_BizAppsContracts
|
|
474
|
+
* * Base Table: ContractTemplateModification
|
|
475
|
+
* * Base View: vwContractTemplateModifications
|
|
476
|
+
* * @description What THIS contract changed about the standard agreement. Deliberately lean: it names a provision and carries what the contract says instead. Carries no ContractTemplateID — the provision belongs to exactly one template in every future, so the template derives through the provision, and a stored copy of a derivation can only agree or lie.
|
|
477
|
+
* * Primary Key: ID
|
|
478
|
+
* @extends {BaseEntity}
|
|
479
|
+
* @class
|
|
480
|
+
* @public
|
|
481
|
+
*/
|
|
482
|
+
let mjBizAppsContractsContractTemplateModificationEntity = class mjBizAppsContractsContractTemplateModificationEntity extends BaseEntity {
|
|
483
|
+
/**
|
|
484
|
+
* Loads the MJ_BizApps_Contracts: Contract Template Modifications record from the database
|
|
485
|
+
* @param ID: string - primary key value to load the MJ_BizApps_Contracts: Contract Template Modifications record.
|
|
486
|
+
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
487
|
+
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
488
|
+
* @public
|
|
489
|
+
* @async
|
|
490
|
+
* @memberof mjBizAppsContractsContractTemplateModificationEntity
|
|
491
|
+
* @method
|
|
492
|
+
* @override
|
|
493
|
+
*/
|
|
494
|
+
async Load(ID, EntityRelationshipsToLoad) {
|
|
495
|
+
const compositeKey = new CompositeKey();
|
|
496
|
+
compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
|
|
497
|
+
return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Validate() method override for MJ_BizApps_Contracts: Contract Template Modifications entity. This is an auto-generated method that invokes the generated validators for this entity for the following fields:
|
|
501
|
+
* * ModificationText: The modification text must contain actual text and cannot be empty or consist only of spaces.
|
|
502
|
+
* @public
|
|
503
|
+
* @method
|
|
504
|
+
* @override
|
|
505
|
+
*/
|
|
506
|
+
Validate() {
|
|
507
|
+
const result = super.Validate();
|
|
508
|
+
this.ValidateModificationTextNotEmpty(result);
|
|
509
|
+
result.Success = result.Success && (result.Errors.length === 0);
|
|
510
|
+
return result;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* The modification text must contain actual text and cannot be empty or consist only of spaces.
|
|
514
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
515
|
+
* @public
|
|
516
|
+
* @method
|
|
517
|
+
*/
|
|
518
|
+
ValidateModificationTextNotEmpty(result) {
|
|
519
|
+
if (this.ModificationText == null || this.ModificationText.trim().length === 0) {
|
|
520
|
+
result.Errors.push(new ValidationErrorInfo("ModificationText", "Modification text cannot be empty or contain only whitespace.", this.ModificationText, ValidationErrorType.Failure));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* * Field Name: ID
|
|
525
|
+
* * Display Name: ID
|
|
526
|
+
* * SQL Data Type: uniqueidentifier
|
|
527
|
+
* * Default Value: newsequentialid()
|
|
528
|
+
*/
|
|
529
|
+
get ID() {
|
|
530
|
+
return this.Get('ID');
|
|
531
|
+
}
|
|
532
|
+
set ID(value) {
|
|
533
|
+
this.Set('ID', value);
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* * Field Name: ContractID
|
|
537
|
+
* * Display Name: Contract
|
|
538
|
+
* * SQL Data Type: uniqueidentifier
|
|
539
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contracts (vwContracts.ID)
|
|
540
|
+
*/
|
|
541
|
+
get ContractID() {
|
|
542
|
+
return this.Get('ContractID');
|
|
543
|
+
}
|
|
544
|
+
set ContractID(value) {
|
|
545
|
+
this.Set('ContractID', value);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* * Field Name: ContractTemplateProvisionID
|
|
549
|
+
* * Display Name: Contract Template Provision
|
|
550
|
+
* * SQL Data Type: uniqueidentifier
|
|
551
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Template Provisions (vwContractTemplateProvisions.ID)
|
|
552
|
+
* * Description: The provision being modified — the structured identifier, and the only one. A server rule enforces what this replaces: the provision must belong to a template this contract incorporates.
|
|
553
|
+
*/
|
|
554
|
+
get ContractTemplateProvisionID() {
|
|
555
|
+
return this.Get('ContractTemplateProvisionID');
|
|
556
|
+
}
|
|
557
|
+
set ContractTemplateProvisionID(value) {
|
|
558
|
+
this.Set('ContractTemplateProvisionID', value);
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* * Field Name: ModificationText
|
|
562
|
+
* * Display Name: Modification Text
|
|
563
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
564
|
+
* * Description: What this contract says INSTEAD of the standard clause. Read as a pair with ContractTemplateProvision.ProvisionText.
|
|
565
|
+
*/
|
|
566
|
+
get ModificationText() {
|
|
567
|
+
return this.Get('ModificationText');
|
|
568
|
+
}
|
|
569
|
+
set ModificationText(value) {
|
|
570
|
+
this.Set('ModificationText', value);
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* * Field Name: Notes
|
|
574
|
+
* * Display Name: Notes
|
|
575
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
576
|
+
* * Description: Optional working note, e.g. who negotiated it.
|
|
577
|
+
*/
|
|
578
|
+
get Notes() {
|
|
579
|
+
return this.Get('Notes');
|
|
580
|
+
}
|
|
581
|
+
set Notes(value) {
|
|
582
|
+
this.Set('Notes', value);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* * Field Name: __mj_CreatedAt
|
|
586
|
+
* * Display Name: Created At
|
|
587
|
+
* * SQL Data Type: datetimeoffset
|
|
588
|
+
* * Default Value: getutcdate()
|
|
589
|
+
*/
|
|
590
|
+
get __mj_CreatedAt() {
|
|
591
|
+
return this.Get('__mj_CreatedAt');
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* * Field Name: __mj_UpdatedAt
|
|
595
|
+
* * Display Name: Updated At
|
|
596
|
+
* * SQL Data Type: datetimeoffset
|
|
597
|
+
* * Default Value: getutcdate()
|
|
598
|
+
*/
|
|
599
|
+
get __mj_UpdatedAt() {
|
|
600
|
+
return this.Get('__mj_UpdatedAt');
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* * Field Name: Contract
|
|
604
|
+
* * Display Name: Contract
|
|
605
|
+
* * SQL Data Type: nvarchar(50)
|
|
606
|
+
*/
|
|
607
|
+
get Contract() {
|
|
608
|
+
return this.Get('Contract');
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* * Field Name: ContractTemplateProvision
|
|
612
|
+
* * Display Name: Contract Template Provision
|
|
613
|
+
* * SQL Data Type: nvarchar(20)
|
|
614
|
+
*/
|
|
615
|
+
get ContractTemplateProvision() {
|
|
616
|
+
return this.Get('ContractTemplateProvision');
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
mjBizAppsContractsContractTemplateModificationEntity = __decorate([
|
|
620
|
+
RegisterClass(BaseEntity, 'MJ_BizApps_Contracts: Contract Template Modifications')
|
|
621
|
+
], mjBizAppsContractsContractTemplateModificationEntity);
|
|
622
|
+
export { mjBizAppsContractsContractTemplateModificationEntity };
|
|
623
|
+
/**
|
|
624
|
+
* MJ_BizApps_Contracts: Contract Template Provisions - strongly typed entity sub-class
|
|
625
|
+
* * Schema: __mj_BizAppsContracts
|
|
626
|
+
* * Base Table: ContractTemplateProvision
|
|
627
|
+
* * Base View: vwContractTemplateProvisions
|
|
628
|
+
* * @description The numbered clause list of a template version, and the home of all standard contract text. Hangs off ContractTemplate rather than standing alone because provision numbering belongs to a VERSION — the moment a new version renumbers, a single global list is wrong.
|
|
629
|
+
* * Primary Key: ID
|
|
630
|
+
* @extends {BaseEntity}
|
|
631
|
+
* @class
|
|
632
|
+
* @public
|
|
633
|
+
*/
|
|
634
|
+
let mjBizAppsContractsContractTemplateProvisionEntity = class mjBizAppsContractsContractTemplateProvisionEntity extends BaseEntity {
|
|
635
|
+
/**
|
|
636
|
+
* Loads the MJ_BizApps_Contracts: Contract Template Provisions record from the database
|
|
637
|
+
* @param ID: string - primary key value to load the MJ_BizApps_Contracts: Contract Template Provisions record.
|
|
638
|
+
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
639
|
+
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
640
|
+
* @public
|
|
641
|
+
* @async
|
|
642
|
+
* @memberof mjBizAppsContractsContractTemplateProvisionEntity
|
|
643
|
+
* @method
|
|
644
|
+
* @override
|
|
645
|
+
*/
|
|
646
|
+
async Load(ID, EntityRelationshipsToLoad) {
|
|
647
|
+
const compositeKey = new CompositeKey();
|
|
648
|
+
compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
|
|
649
|
+
return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Validate() method override for MJ_BizApps_Contracts: Contract Template Provisions entity. This is an auto-generated method that invokes the generated validators for this entity for the following fields:
|
|
653
|
+
* * ProvisionText: The provision text cannot be empty or consist only of spaces. It must contain actual text content.
|
|
654
|
+
* @public
|
|
655
|
+
* @method
|
|
656
|
+
* @override
|
|
657
|
+
*/
|
|
658
|
+
Validate() {
|
|
659
|
+
const result = super.Validate();
|
|
660
|
+
this.ValidateProvisionTextNotEmpty(result);
|
|
661
|
+
result.Success = result.Success && (result.Errors.length === 0);
|
|
662
|
+
return result;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* The provision text cannot be empty or consist only of spaces. It must contain actual text content.
|
|
666
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
667
|
+
* @public
|
|
668
|
+
* @method
|
|
669
|
+
*/
|
|
670
|
+
ValidateProvisionTextNotEmpty(result) {
|
|
671
|
+
if (this.ProvisionText === undefined || this.ProvisionText === null || this.ProvisionText.trim().length === 0) {
|
|
672
|
+
result.Errors.push(new ValidationErrorInfo("ProvisionText", "Provision text cannot be empty or consist only of spaces.", this.ProvisionText, ValidationErrorType.Failure));
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* * Field Name: ID
|
|
677
|
+
* * Display Name: ID
|
|
678
|
+
* * SQL Data Type: uniqueidentifier
|
|
679
|
+
* * Default Value: newsequentialid()
|
|
680
|
+
*/
|
|
681
|
+
get ID() {
|
|
682
|
+
return this.Get('ID');
|
|
683
|
+
}
|
|
684
|
+
set ID(value) {
|
|
685
|
+
this.Set('ID', value);
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* * Field Name: ContractTemplateID
|
|
689
|
+
* * Display Name: Contract Template
|
|
690
|
+
* * SQL Data Type: uniqueidentifier
|
|
691
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Templates (vwContractTemplates.ID)
|
|
692
|
+
*/
|
|
693
|
+
get ContractTemplateID() {
|
|
694
|
+
return this.Get('ContractTemplateID');
|
|
695
|
+
}
|
|
696
|
+
set ContractTemplateID(value) {
|
|
697
|
+
this.Set('ContractTemplateID', value);
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* * Field Name: ProvisionNumber
|
|
701
|
+
* * Display Name: Provision Number
|
|
702
|
+
* * SQL Data Type: nvarchar(20)
|
|
703
|
+
* * Description: The clause number as the document writes it, e.g. "3.5(b)". Unique within its template.
|
|
704
|
+
*/
|
|
705
|
+
get ProvisionNumber() {
|
|
706
|
+
return this.Get('ProvisionNumber');
|
|
707
|
+
}
|
|
708
|
+
set ProvisionNumber(value) {
|
|
709
|
+
this.Set('ProvisionNumber', value);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* * Field Name: Title
|
|
713
|
+
* * Display Name: Title
|
|
714
|
+
* * SQL Data Type: nvarchar(200)
|
|
715
|
+
* * Description: The clause heading, e.g. "Limitation of Liability". This plus the number is what a person picks from.
|
|
716
|
+
*/
|
|
717
|
+
get Title() {
|
|
718
|
+
return this.Get('Title');
|
|
719
|
+
}
|
|
720
|
+
set Title(value) {
|
|
721
|
+
this.Set('Title', value);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* * Field Name: ProvisionText
|
|
725
|
+
* * Display Name: Provision Text
|
|
726
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
727
|
+
* * Description: The STANDARD wording of this clause. Read as a pair with ContractTemplateModification.ModificationText, which holds what a given contract says instead — a dispute needs the comparison, not either half.
|
|
728
|
+
*/
|
|
729
|
+
get ProvisionText() {
|
|
730
|
+
return this.Get('ProvisionText');
|
|
731
|
+
}
|
|
732
|
+
set ProvisionText(value) {
|
|
733
|
+
this.Set('ProvisionText', value);
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* * Field Name: Description
|
|
737
|
+
* * Display Name: Description
|
|
738
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
739
|
+
*/
|
|
740
|
+
get Description() {
|
|
741
|
+
return this.Get('Description');
|
|
742
|
+
}
|
|
743
|
+
set Description(value) {
|
|
744
|
+
this.Set('Description', value);
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* * Field Name: ProvisionSortKey
|
|
748
|
+
* * Display Name: Sort Key
|
|
749
|
+
* * SQL Data Type: nvarchar(200)
|
|
750
|
+
* * Description: Collation key derived from ProvisionNumber: every run of digits zero-padded to six places, everything else upper-cased. Makes a plain SQL ORDER BY produce natural order ('1.9' before '1.10'), which ordering by ProvisionNumber cannot. READ-ONLY -- a persisted computed column; nobody should be able to set a sort key. Replaced the hand-maintained Sequence column, which had already collided in the seeded data.
|
|
751
|
+
*/
|
|
752
|
+
get ProvisionSortKey() {
|
|
753
|
+
return this.Get('ProvisionSortKey');
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* * Field Name: __mj_CreatedAt
|
|
757
|
+
* * Display Name: Created At
|
|
758
|
+
* * SQL Data Type: datetimeoffset
|
|
759
|
+
* * Default Value: getutcdate()
|
|
760
|
+
*/
|
|
761
|
+
get __mj_CreatedAt() {
|
|
762
|
+
return this.Get('__mj_CreatedAt');
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* * Field Name: __mj_UpdatedAt
|
|
766
|
+
* * Display Name: Updated At
|
|
767
|
+
* * SQL Data Type: datetimeoffset
|
|
768
|
+
* * Default Value: getutcdate()
|
|
769
|
+
*/
|
|
770
|
+
get __mj_UpdatedAt() {
|
|
771
|
+
return this.Get('__mj_UpdatedAt');
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* * Field Name: ContractTemplate
|
|
775
|
+
* * Display Name: Contract Template Name
|
|
776
|
+
* * SQL Data Type: nvarchar(200)
|
|
777
|
+
*/
|
|
778
|
+
get ContractTemplate() {
|
|
779
|
+
return this.Get('ContractTemplate');
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
mjBizAppsContractsContractTemplateProvisionEntity = __decorate([
|
|
783
|
+
RegisterClass(BaseEntity, 'MJ_BizApps_Contracts: Contract Template Provisions')
|
|
784
|
+
], mjBizAppsContractsContractTemplateProvisionEntity);
|
|
785
|
+
export { mjBizAppsContractsContractTemplateProvisionEntity };
|
|
786
|
+
/**
|
|
787
|
+
* MJ_BizApps_Contracts: Contract Template Types - strongly typed entity sub-class
|
|
788
|
+
* * Schema: __mj_BizAppsContracts
|
|
789
|
+
* * Base Table: ContractTemplateType
|
|
790
|
+
* * Base View: vwContractTemplateTypes
|
|
791
|
+
* * @description The kind of standard agreement (Master Agreement, Statement of Work). A lookup TABLE rather than a CHECK because the list is additive at runtime and a business user should be able to add one without a migration. Carries no behaviour.
|
|
792
|
+
* * Primary Key: ID
|
|
793
|
+
* @extends {BaseEntity}
|
|
794
|
+
* @class
|
|
795
|
+
* @public
|
|
796
|
+
*/
|
|
797
|
+
let mjBizAppsContractsContractTemplateTypeEntity = class mjBizAppsContractsContractTemplateTypeEntity extends BaseEntity {
|
|
798
|
+
/**
|
|
799
|
+
* Loads the MJ_BizApps_Contracts: Contract Template Types record from the database
|
|
800
|
+
* @param ID: string - primary key value to load the MJ_BizApps_Contracts: Contract Template Types record.
|
|
801
|
+
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
802
|
+
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
803
|
+
* @public
|
|
804
|
+
* @async
|
|
805
|
+
* @memberof mjBizAppsContractsContractTemplateTypeEntity
|
|
806
|
+
* @method
|
|
807
|
+
* @override
|
|
808
|
+
*/
|
|
809
|
+
async Load(ID, EntityRelationshipsToLoad) {
|
|
810
|
+
const compositeKey = new CompositeKey();
|
|
811
|
+
compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
|
|
812
|
+
return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* * Field Name: ID
|
|
816
|
+
* * Display Name: ID
|
|
817
|
+
* * SQL Data Type: uniqueidentifier
|
|
818
|
+
* * Default Value: newsequentialid()
|
|
819
|
+
*/
|
|
820
|
+
get ID() {
|
|
821
|
+
return this.Get('ID');
|
|
822
|
+
}
|
|
823
|
+
set ID(value) {
|
|
824
|
+
this.Set('ID', value);
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* * Field Name: Name
|
|
828
|
+
* * Display Name: Name
|
|
829
|
+
* * SQL Data Type: nvarchar(100)
|
|
830
|
+
*/
|
|
831
|
+
get Name() {
|
|
832
|
+
return this.Get('Name');
|
|
833
|
+
}
|
|
834
|
+
set Name(value) {
|
|
835
|
+
this.Set('Name', value);
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* * Field Name: Description
|
|
839
|
+
* * Display Name: Description
|
|
840
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
841
|
+
*/
|
|
842
|
+
get Description() {
|
|
843
|
+
return this.Get('Description');
|
|
844
|
+
}
|
|
845
|
+
set Description(value) {
|
|
846
|
+
this.Set('Description', value);
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* * Field Name: Status
|
|
850
|
+
* * Display Name: Status
|
|
851
|
+
* * SQL Data Type: nvarchar(10)
|
|
852
|
+
* * Default Value: Active
|
|
853
|
+
* * Value List Type: List
|
|
854
|
+
* * Possible Values
|
|
855
|
+
* * Active
|
|
856
|
+
* * Inactive
|
|
857
|
+
* * Description: Active | Inactive. Retiring a type hides it from pickers without touching the templates that used it.
|
|
858
|
+
*/
|
|
859
|
+
get Status() {
|
|
860
|
+
return this.Get('Status');
|
|
861
|
+
}
|
|
862
|
+
set Status(value) {
|
|
863
|
+
this.Set('Status', value);
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* * Field Name: __mj_CreatedAt
|
|
867
|
+
* * Display Name: Created At
|
|
868
|
+
* * SQL Data Type: datetimeoffset
|
|
869
|
+
* * Default Value: getutcdate()
|
|
870
|
+
*/
|
|
871
|
+
get __mj_CreatedAt() {
|
|
872
|
+
return this.Get('__mj_CreatedAt');
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* * Field Name: __mj_UpdatedAt
|
|
876
|
+
* * Display Name: Updated At
|
|
877
|
+
* * SQL Data Type: datetimeoffset
|
|
878
|
+
* * Default Value: getutcdate()
|
|
879
|
+
*/
|
|
880
|
+
get __mj_UpdatedAt() {
|
|
881
|
+
return this.Get('__mj_UpdatedAt');
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
mjBizAppsContractsContractTemplateTypeEntity = __decorate([
|
|
885
|
+
RegisterClass(BaseEntity, 'MJ_BizApps_Contracts: Contract Template Types')
|
|
886
|
+
], mjBizAppsContractsContractTemplateTypeEntity);
|
|
887
|
+
export { mjBizAppsContractsContractTemplateTypeEntity };
|
|
888
|
+
/**
|
|
889
|
+
* MJ_BizApps_Contracts: Contract Templates - strongly typed entity sub-class
|
|
890
|
+
* * Schema: __mj_BizAppsContracts
|
|
891
|
+
* * Base Table: ContractTemplate
|
|
892
|
+
* * Base View: vwContractTemplates
|
|
893
|
+
* * @description One VERSION of a standard agreement — in practice the Master Agreement. Versions matter because each is published at its own dated URL that never goes away, so a customer stays bound to the text they signed. Carries no prose of its own: every clauses standard wording lives on its ContractTemplateProvision row.
|
|
894
|
+
* * Primary Key: ID
|
|
895
|
+
* @extends {BaseEntity}
|
|
896
|
+
* @class
|
|
897
|
+
* @public
|
|
898
|
+
*/
|
|
899
|
+
let mjBizAppsContractsContractTemplateEntity = class mjBizAppsContractsContractTemplateEntity extends BaseEntity {
|
|
900
|
+
constructor() {
|
|
901
|
+
super(...arguments);
|
|
902
|
+
/**
|
|
903
|
+
* Related records: MJ_BizApps_Contracts: Contract Template Provisions
|
|
904
|
+
*
|
|
905
|
+
* Loads, validates and persists as one unit with this MJ_BizApps_Contracts: Contract Templates record — see
|
|
906
|
+
* guides/TRANSACTIONS_AND_BATCHING_GUIDE.md. Declared by the RelatedRecordCollection metadata on
|
|
907
|
+
* the 'MJ_BizApps_Contracts: Contract Templates → MJ_BizApps_Contracts: Contract Template Provisions' relationship; edit that row, not this file.
|
|
908
|
+
*
|
|
909
|
+
*/
|
|
910
|
+
this.Provisions = this.DeclareRelatedRecords({
|
|
911
|
+
Name: 'Provisions',
|
|
912
|
+
RelatedEntity: 'MJ_BizApps_Contracts: Contract Template Provisions',
|
|
913
|
+
RelatedEntityJoinField: 'ContractTemplateID',
|
|
914
|
+
OrderBy: 'ProvisionSortKey ASC',
|
|
915
|
+
Load: 'explicit',
|
|
916
|
+
OnRemove: 'delete',
|
|
917
|
+
Source: 'database',
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Loads the MJ_BizApps_Contracts: Contract Templates record from the database
|
|
922
|
+
* @param ID: string - primary key value to load the MJ_BizApps_Contracts: Contract Templates record.
|
|
923
|
+
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
924
|
+
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
925
|
+
* @public
|
|
926
|
+
* @async
|
|
927
|
+
* @memberof mjBizAppsContractsContractTemplateEntity
|
|
928
|
+
* @method
|
|
929
|
+
* @override
|
|
930
|
+
*/
|
|
931
|
+
async Load(ID, EntityRelationshipsToLoad) {
|
|
932
|
+
const compositeKey = new CompositeKey();
|
|
933
|
+
compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
|
|
934
|
+
return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* * Field Name: ID
|
|
938
|
+
* * Display Name: ID
|
|
939
|
+
* * SQL Data Type: uniqueidentifier
|
|
940
|
+
* * Default Value: newsequentialid()
|
|
941
|
+
*/
|
|
942
|
+
get ID() {
|
|
943
|
+
return this.Get('ID');
|
|
944
|
+
}
|
|
945
|
+
set ID(value) {
|
|
946
|
+
this.Set('ID', value);
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* * Field Name: Name
|
|
950
|
+
* * Display Name: Name
|
|
951
|
+
* * SQL Data Type: nvarchar(200)
|
|
952
|
+
*/
|
|
953
|
+
get Name() {
|
|
954
|
+
return this.Get('Name');
|
|
955
|
+
}
|
|
956
|
+
set Name(value) {
|
|
957
|
+
this.Set('Name', value);
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* * Field Name: ContractTemplateTypeID
|
|
961
|
+
* * Display Name: Contract Template Type ID
|
|
962
|
+
* * SQL Data Type: uniqueidentifier
|
|
963
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Template Types (vwContractTemplateTypes.ID)
|
|
964
|
+
*/
|
|
965
|
+
get ContractTemplateTypeID() {
|
|
966
|
+
return this.Get('ContractTemplateTypeID');
|
|
967
|
+
}
|
|
968
|
+
set ContractTemplateTypeID(value) {
|
|
969
|
+
this.Set('ContractTemplateTypeID', value);
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* * Field Name: VersionLabel
|
|
973
|
+
* * Display Name: Version Label
|
|
974
|
+
* * SQL Data Type: nvarchar(50)
|
|
975
|
+
* * Description: The version the document names itself, e.g. "v6". Free text, because it is the documents own label rather than something we derive.
|
|
976
|
+
*/
|
|
977
|
+
get VersionLabel() {
|
|
978
|
+
return this.Get('VersionLabel');
|
|
979
|
+
}
|
|
980
|
+
set VersionLabel(value) {
|
|
981
|
+
this.Set('VersionLabel', value);
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* * Field Name: IntroducedDate
|
|
985
|
+
* * Display Name: Introduced Date
|
|
986
|
+
* * SQL Data Type: date
|
|
987
|
+
* * Description: When this version started being offered. NOT an effective date: a template becomes effective for a customer when THAT customer signs it, never on a calendar date. Naming it EffectiveDate would invite exactly the wrong query.
|
|
988
|
+
*/
|
|
989
|
+
get IntroducedDate() {
|
|
990
|
+
return this.Get('IntroducedDate');
|
|
991
|
+
}
|
|
992
|
+
set IntroducedDate(value) {
|
|
993
|
+
this.Set('IntroducedDate', value);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* * Field Name: SourceURL
|
|
997
|
+
* * Display Name: Source URL
|
|
998
|
+
* * SQL Data Type: nvarchar(1000)
|
|
999
|
+
* * Description: The dated public URL a customer can open to read the standard terms. NULLABLE: reachability is enforceable by nothing (a well-formed dead link passes any format check), and the real rule is "a URL OR an attached file" — the file half attaching through __mj.FileEntityRecordLink, which cannot reference a record that does not exist yet, so on CREATE it is unsatisfiable in principle. A template with neither is INCOMPLETE rather than invalid; the derived IsUsable column on vwContractTemplates is what says so.
|
|
1000
|
+
*/
|
|
1001
|
+
get SourceURL() {
|
|
1002
|
+
return this.Get('SourceURL');
|
|
1003
|
+
}
|
|
1004
|
+
set SourceURL(value) {
|
|
1005
|
+
this.Set('SourceURL', value);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* * Field Name: Description
|
|
1009
|
+
* * Display Name: Description
|
|
1010
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
1011
|
+
*/
|
|
1012
|
+
get Description() {
|
|
1013
|
+
return this.Get('Description');
|
|
1014
|
+
}
|
|
1015
|
+
set Description(value) {
|
|
1016
|
+
this.Set('Description', value);
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* * Field Name: Status
|
|
1020
|
+
* * Display Name: Status
|
|
1021
|
+
* * SQL Data Type: nvarchar(20)
|
|
1022
|
+
* * Default Value: Draft
|
|
1023
|
+
* * Value List Type: List
|
|
1024
|
+
* * Possible Values
|
|
1025
|
+
* * Draft
|
|
1026
|
+
* * Published
|
|
1027
|
+
* * Description: Publication lifecycle. 'Draft' -- freely editable, provisions may be added, changed and removed, and a contract may not NEWLY reference it. 'Published' -- the provisions are frozen against INSERT, UPDATE and DELETE by trg_ContractTemplateProvision_Immutability, and contracts may reference it. Publishing is ONE-WAY (enforced in ContractTemplateEntity): to change published terms, publish a new version -- that is what VersionLabel exists for. Existing references are never invalidated by this column; only new ones are policed, the same way ContractType.Status works.
|
|
1028
|
+
*/
|
|
1029
|
+
get Status() {
|
|
1030
|
+
return this.Get('Status');
|
|
1031
|
+
}
|
|
1032
|
+
set Status(value) {
|
|
1033
|
+
this.Set('Status', value);
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* * Field Name: __mj_CreatedAt
|
|
1037
|
+
* * Display Name: Created At
|
|
1038
|
+
* * SQL Data Type: datetimeoffset
|
|
1039
|
+
* * Default Value: getutcdate()
|
|
1040
|
+
*/
|
|
1041
|
+
get __mj_CreatedAt() {
|
|
1042
|
+
return this.Get('__mj_CreatedAt');
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* * Field Name: __mj_UpdatedAt
|
|
1046
|
+
* * Display Name: Updated At
|
|
1047
|
+
* * SQL Data Type: datetimeoffset
|
|
1048
|
+
* * Default Value: getutcdate()
|
|
1049
|
+
*/
|
|
1050
|
+
get __mj_UpdatedAt() {
|
|
1051
|
+
return this.Get('__mj_UpdatedAt');
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* * Field Name: ContractTemplateType
|
|
1055
|
+
* * Display Name: Contract Template Type
|
|
1056
|
+
* * SQL Data Type: nvarchar(100)
|
|
1057
|
+
*/
|
|
1058
|
+
get ContractTemplateType() {
|
|
1059
|
+
return this.Get('ContractTemplateType');
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* * Field Name: IsUsable
|
|
1063
|
+
* * Display Name: Is Usable
|
|
1064
|
+
* * SQL Data Type: bit
|
|
1065
|
+
*/
|
|
1066
|
+
get IsUsable() {
|
|
1067
|
+
return this.Get('IsUsable');
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
mjBizAppsContractsContractTemplateEntity = __decorate([
|
|
1071
|
+
RegisterClass(BaseEntity, 'MJ_BizApps_Contracts: Contract Templates')
|
|
1072
|
+
], mjBizAppsContractsContractTemplateEntity);
|
|
1073
|
+
export { mjBizAppsContractsContractTemplateEntity };
|
|
1074
|
+
/**
|
|
1075
|
+
* MJ_BizApps_Contracts: Contract Types - strongly typed entity sub-class
|
|
1076
|
+
* * Schema: __mj_BizAppsContracts
|
|
1077
|
+
* * Base Table: ContractType
|
|
1078
|
+
* * Base View: vwContractTypes
|
|
1079
|
+
* * @description The kind of paper: Order Form, Statement of Work, Payment Link, Change Order. A lookup TABLE for the same reason as ContractTemplateType.
|
|
1080
|
+
* * Primary Key: ID
|
|
1081
|
+
* @extends {BaseEntity}
|
|
1082
|
+
* @class
|
|
1083
|
+
* @public
|
|
1084
|
+
*/
|
|
1085
|
+
let mjBizAppsContractsContractTypeEntity = class mjBizAppsContractsContractTypeEntity extends BaseEntity {
|
|
1086
|
+
/**
|
|
1087
|
+
* Loads the MJ_BizApps_Contracts: Contract Types record from the database
|
|
1088
|
+
* @param ID: string - primary key value to load the MJ_BizApps_Contracts: Contract Types record.
|
|
1089
|
+
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
1090
|
+
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
1091
|
+
* @public
|
|
1092
|
+
* @async
|
|
1093
|
+
* @memberof mjBizAppsContractsContractTypeEntity
|
|
1094
|
+
* @method
|
|
1095
|
+
* @override
|
|
1096
|
+
*/
|
|
1097
|
+
async Load(ID, EntityRelationshipsToLoad) {
|
|
1098
|
+
const compositeKey = new CompositeKey();
|
|
1099
|
+
compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
|
|
1100
|
+
return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Validate() method override for MJ_BizApps_Contracts: Contract Types entity. This is an auto-generated method that invokes the generated validators for this entity for the following fields:
|
|
1104
|
+
* * Table-Level: An entity cannot be designated as both a root and a child at the same time.
|
|
1105
|
+
* @public
|
|
1106
|
+
* @method
|
|
1107
|
+
* @override
|
|
1108
|
+
*/
|
|
1109
|
+
Validate() {
|
|
1110
|
+
const result = super.Validate();
|
|
1111
|
+
this.ValidateRootAndChildExclusivity(result);
|
|
1112
|
+
result.Success = result.Success && (result.Errors.length === 0);
|
|
1113
|
+
return result;
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* An entity cannot be designated as both a root and a child at the same time.
|
|
1117
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1118
|
+
* @public
|
|
1119
|
+
* @method
|
|
1120
|
+
*/
|
|
1121
|
+
ValidateRootAndChildExclusivity(result) {
|
|
1122
|
+
if (this.MustBeRoot && this.MustBeChild) {
|
|
1123
|
+
result.Errors.push(new ValidationErrorInfo("MustBeRoot", "An entity cannot be designated as both a root and a child at the same time.", this.MustBeRoot, ValidationErrorType.Failure));
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
/**
|
|
1127
|
+
* * Field Name: ID
|
|
1128
|
+
* * Display Name: ID
|
|
1129
|
+
* * SQL Data Type: uniqueidentifier
|
|
1130
|
+
* * Default Value: newsequentialid()
|
|
1131
|
+
*/
|
|
1132
|
+
get ID() {
|
|
1133
|
+
return this.Get('ID');
|
|
1134
|
+
}
|
|
1135
|
+
set ID(value) {
|
|
1136
|
+
this.Set('ID', value);
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* * Field Name: Name
|
|
1140
|
+
* * Display Name: Name
|
|
1141
|
+
* * SQL Data Type: nvarchar(100)
|
|
1142
|
+
*/
|
|
1143
|
+
get Name() {
|
|
1144
|
+
return this.Get('Name');
|
|
1145
|
+
}
|
|
1146
|
+
set Name(value) {
|
|
1147
|
+
this.Set('Name', value);
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* * Field Name: Description
|
|
1151
|
+
* * Display Name: Description
|
|
1152
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
1153
|
+
*/
|
|
1154
|
+
get Description() {
|
|
1155
|
+
return this.Get('Description');
|
|
1156
|
+
}
|
|
1157
|
+
set Description(value) {
|
|
1158
|
+
this.Set('Description', value);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* * Field Name: RequiresExecutedDocument
|
|
1162
|
+
* * Display Name: Requires Executed Document
|
|
1163
|
+
* * SQL Data Type: bit
|
|
1164
|
+
* * Default Value: 1
|
|
1165
|
+
* * Description: Whether paper is ever expected for this kind of contract. No for a Payment Link, which has an implied agreement and no signature. This is what stops such a contract asking forever for a document that will never arrive: "awaiting the document" is DERIVED as requires-it AND no-linked-file, never stored and never a status value.
|
|
1166
|
+
*/
|
|
1167
|
+
get RequiresExecutedDocument() {
|
|
1168
|
+
return this.Get('RequiresExecutedDocument');
|
|
1169
|
+
}
|
|
1170
|
+
set RequiresExecutedDocument(value) {
|
|
1171
|
+
this.Set('RequiresExecutedDocument', value);
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* * Field Name: Status
|
|
1175
|
+
* * Display Name: Status
|
|
1176
|
+
* * SQL Data Type: nvarchar(10)
|
|
1177
|
+
* * Default Value: Active
|
|
1178
|
+
* * Value List Type: List
|
|
1179
|
+
* * Possible Values
|
|
1180
|
+
* * Active
|
|
1181
|
+
* * Inactive
|
|
1182
|
+
* * Description: Active | Inactive.
|
|
1183
|
+
*/
|
|
1184
|
+
get Status() {
|
|
1185
|
+
return this.Get('Status');
|
|
1186
|
+
}
|
|
1187
|
+
set Status(value) {
|
|
1188
|
+
this.Set('Status', value);
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* * Field Name: MustBeRoot
|
|
1192
|
+
* * Display Name: Must Be Root
|
|
1193
|
+
* * SQL Data Type: bit
|
|
1194
|
+
* * Default Value: 0
|
|
1195
|
+
* * Description: This type of contract may NOT name a ParentContractID -- it is a root agreement. Enforced in ContractEntityServer.ValidateAsync. Mutually exclusive with MustBeChild (CK_ContractType_RootOrChild); both false means no restriction on where in the tree this type may sit, which is the honest default.
|
|
1196
|
+
*/
|
|
1197
|
+
get MustBeRoot() {
|
|
1198
|
+
return this.Get('MustBeRoot');
|
|
1199
|
+
}
|
|
1200
|
+
set MustBeRoot(value) {
|
|
1201
|
+
this.Set('MustBeRoot', value);
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* * Field Name: MustBeChild
|
|
1205
|
+
* * Display Name: Must Be Child
|
|
1206
|
+
* * SQL Data Type: bit
|
|
1207
|
+
* * Default Value: 0
|
|
1208
|
+
* * Description: This type of contract MUST name a ParentContractID -- a Change Order that amends nothing is not a change order, and would never appear in the original agreement's lineage. Enforced in ContractEntityServer.ValidateAsync. Mutually exclusive with MustBeRoot.
|
|
1209
|
+
*/
|
|
1210
|
+
get MustBeChild() {
|
|
1211
|
+
return this.Get('MustBeChild');
|
|
1212
|
+
}
|
|
1213
|
+
set MustBeChild(value) {
|
|
1214
|
+
this.Set('MustBeChild', value);
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* * Field Name: TemplateRequired
|
|
1218
|
+
* * Display Name: Template Required
|
|
1219
|
+
* * SQL Data Type: bit
|
|
1220
|
+
* * Default Value: 0
|
|
1221
|
+
* * Description: This type of contract must carry its own ContractTemplateID -- the standard terms it incorporates. On the TYPE rather than inferred from the placement flags, because 'where in the tree' and 'does it need its own paper' are different questions and a future type could want any combination.
|
|
1222
|
+
*/
|
|
1223
|
+
get TemplateRequired() {
|
|
1224
|
+
return this.Get('TemplateRequired');
|
|
1225
|
+
}
|
|
1226
|
+
set TemplateRequired(value) {
|
|
1227
|
+
this.Set('TemplateRequired', value);
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* * Field Name: __mj_CreatedAt
|
|
1231
|
+
* * Display Name: Created At
|
|
1232
|
+
* * SQL Data Type: datetimeoffset
|
|
1233
|
+
* * Default Value: getutcdate()
|
|
1234
|
+
*/
|
|
1235
|
+
get __mj_CreatedAt() {
|
|
1236
|
+
return this.Get('__mj_CreatedAt');
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* * Field Name: __mj_UpdatedAt
|
|
1240
|
+
* * Display Name: Updated At
|
|
1241
|
+
* * SQL Data Type: datetimeoffset
|
|
1242
|
+
* * Default Value: getutcdate()
|
|
1243
|
+
*/
|
|
1244
|
+
get __mj_UpdatedAt() {
|
|
1245
|
+
return this.Get('__mj_UpdatedAt');
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
mjBizAppsContractsContractTypeEntity = __decorate([
|
|
1249
|
+
RegisterClass(BaseEntity, 'MJ_BizApps_Contracts: Contract Types')
|
|
1250
|
+
], mjBizAppsContractsContractTypeEntity);
|
|
1251
|
+
export { mjBizAppsContractsContractTypeEntity };
|
|
1252
|
+
/**
|
|
1253
|
+
* MJ_BizApps_Contracts: Contracts - strongly typed entity sub-class
|
|
1254
|
+
* * Schema: __mj_BizAppsContracts
|
|
1255
|
+
* * Base Table: Contract
|
|
1256
|
+
* * Base View: vwContracts
|
|
1257
|
+
* * @description The signed agreement — one row per piece of signed (or implied) paper, and the centre of the app. Carries NO hard reference to a Deal: sales creates contracts, so sales depends on this app and a reference upward would invert the dependency graph. The link is the typed polymorphic pair CreatingEntityID + CreatingRecordID.
|
|
1258
|
+
* * Primary Key: ID
|
|
1259
|
+
* @extends {BaseEntity}
|
|
1260
|
+
* @class
|
|
1261
|
+
* @public
|
|
1262
|
+
*/
|
|
1263
|
+
let mjBizAppsContractsContractEntity = class mjBizAppsContractsContractEntity extends BaseEntity {
|
|
1264
|
+
constructor() {
|
|
1265
|
+
super(...arguments);
|
|
1266
|
+
/**
|
|
1267
|
+
* Related records: MJ_BizApps_Contracts: Contract Template Modifications
|
|
1268
|
+
*
|
|
1269
|
+
* Loads, validates and persists as one unit with this MJ_BizApps_Contracts: Contracts record — see
|
|
1270
|
+
* guides/TRANSACTIONS_AND_BATCHING_GUIDE.md. Declared by the RelatedRecordCollection metadata on
|
|
1271
|
+
* the 'MJ_BizApps_Contracts: Contracts → MJ_BizApps_Contracts: Contract Template Modifications' relationship; edit that row, not this file.
|
|
1272
|
+
*
|
|
1273
|
+
*/
|
|
1274
|
+
this.Modifications = this.DeclareRelatedRecords({
|
|
1275
|
+
Name: 'Modifications',
|
|
1276
|
+
RelatedEntity: 'MJ_BizApps_Contracts: Contract Template Modifications',
|
|
1277
|
+
RelatedEntityJoinField: 'ContractID',
|
|
1278
|
+
OrderBy: '__mj_CreatedAt ASC',
|
|
1279
|
+
Load: 'explicit',
|
|
1280
|
+
OnRemove: 'delete',
|
|
1281
|
+
Source: 'database',
|
|
1282
|
+
});
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Loads the MJ_BizApps_Contracts: Contracts record from the database
|
|
1286
|
+
* @param ID: string - primary key value to load the MJ_BizApps_Contracts: Contracts record.
|
|
1287
|
+
* @param EntityRelationshipsToLoad - (optional) the relationships to load
|
|
1288
|
+
* @returns {Promise<boolean>} - true if successful, false otherwise
|
|
1289
|
+
* @public
|
|
1290
|
+
* @async
|
|
1291
|
+
* @memberof mjBizAppsContractsContractEntity
|
|
1292
|
+
* @method
|
|
1293
|
+
* @override
|
|
1294
|
+
*/
|
|
1295
|
+
async Load(ID, EntityRelationshipsToLoad) {
|
|
1296
|
+
const compositeKey = new CompositeKey();
|
|
1297
|
+
compositeKey.KeyValuePairs.push({ FieldName: 'ID', Value: ID });
|
|
1298
|
+
return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Validate() method override for MJ_BizApps_Contracts: Contracts entity. This is an auto-generated method that invokes the generated validators for this entity for the following fields:
|
|
1302
|
+
* * AnnualIncreasePercent: The annual increase percentage must be greater than or equal to zero, ensuring that contract rates do not decrease automatically.
|
|
1303
|
+
* * CancellationWindowDays: The cancellation window days must be zero or a positive number, ensuring that we do not record a negative number of days for the contract cancellation period.
|
|
1304
|
+
* * RenewalNoticeDays: Renewal notice days must be 0 or greater, if specified.
|
|
1305
|
+
* * Table-Level: Both Creating Entity ID and Creating Record ID must be provided together, or both must be left empty, to ensure consistent tracking of the source entity and record.
|
|
1306
|
+
* * Table-Level: The contract end date must be on or after the effective date to ensure logical date ordering.
|
|
1307
|
+
* * Table-Level: A contract cannot be its own parent contract to prevent circular references in the contract hierarchy.
|
|
1308
|
+
* * Table-Level: A contract cannot be superseded by itself. The superseding contract must be a different contract record.
|
|
1309
|
+
* @public
|
|
1310
|
+
* @method
|
|
1311
|
+
* @override
|
|
1312
|
+
*/
|
|
1313
|
+
Validate() {
|
|
1314
|
+
const result = super.Validate();
|
|
1315
|
+
this.ValidateAnnualIncreasePercentNonNegative(result);
|
|
1316
|
+
this.ValidateCancellationWindowDaysGreaterThanOrEqualToZero(result);
|
|
1317
|
+
this.ValidateRenewalNoticeDaysGreaterThanOrEqualToZero(result);
|
|
1318
|
+
this.ValidateCreatingEntityAndRecordCoexistence(result);
|
|
1319
|
+
this.ValidateEndDateAfterOrEqualToEffectiveDate(result);
|
|
1320
|
+
this.ValidateParentContractIDNotEqualToID(result);
|
|
1321
|
+
this.ValidateSupersededByContractIDNotEqualToID(result);
|
|
1322
|
+
result.Success = result.Success && (result.Errors.length === 0);
|
|
1323
|
+
return result;
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* The annual increase percentage must be greater than or equal to zero, ensuring that contract rates do not decrease automatically.
|
|
1327
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1328
|
+
* @public
|
|
1329
|
+
* @method
|
|
1330
|
+
*/
|
|
1331
|
+
ValidateAnnualIncreasePercentNonNegative(result) {
|
|
1332
|
+
if (this.AnnualIncreasePercent != null && this.AnnualIncreasePercent < 0) {
|
|
1333
|
+
result.Errors.push(new ValidationErrorInfo("AnnualIncreasePercent", "Annual increase percentage must be greater than or equal to 0.", this.AnnualIncreasePercent, ValidationErrorType.Failure));
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* The cancellation window days must be zero or a positive number, ensuring that we do not record a negative number of days for the contract cancellation period.
|
|
1338
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1339
|
+
* @public
|
|
1340
|
+
* @method
|
|
1341
|
+
*/
|
|
1342
|
+
ValidateCancellationWindowDaysGreaterThanOrEqualToZero(result) {
|
|
1343
|
+
if (this.CancellationWindowDays != null && this.CancellationWindowDays < 0) {
|
|
1344
|
+
result.Errors.push(new ValidationErrorInfo("CancellationWindowDays", "Cancellation window days must be 0 or a positive number.", this.CancellationWindowDays, ValidationErrorType.Failure));
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Renewal notice days must be 0 or greater, if specified.
|
|
1349
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1350
|
+
* @public
|
|
1351
|
+
* @method
|
|
1352
|
+
*/
|
|
1353
|
+
ValidateRenewalNoticeDaysGreaterThanOrEqualToZero(result) {
|
|
1354
|
+
if (this.RenewalNoticeDays != null && this.RenewalNoticeDays < 0) {
|
|
1355
|
+
result.Errors.push(new ValidationErrorInfo("RenewalNoticeDays", "Renewal notice days must be 0 or greater.", this.RenewalNoticeDays, ValidationErrorType.Failure));
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Both Creating Entity ID and Creating Record ID must be provided together, or both must be left empty, to ensure consistent tracking of the source entity and record.
|
|
1360
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1361
|
+
* @public
|
|
1362
|
+
* @method
|
|
1363
|
+
*/
|
|
1364
|
+
ValidateCreatingEntityAndRecordCoexistence(result) {
|
|
1365
|
+
const hasEntity = this.CreatingEntityID != null;
|
|
1366
|
+
const hasRecord = this.CreatingRecordID != null && this.CreatingRecordID !== "";
|
|
1367
|
+
if (hasEntity !== hasRecord) {
|
|
1368
|
+
result.Errors.push(new ValidationErrorInfo("CreatingEntityID", "Creating Entity ID and Creating Record ID must either both be specified or both be empty.", this.CreatingEntityID, ValidationErrorType.Failure));
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* The contract end date must be on or after the effective date to ensure logical date ordering.
|
|
1373
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1374
|
+
* @public
|
|
1375
|
+
* @method
|
|
1376
|
+
*/
|
|
1377
|
+
ValidateEndDateAfterOrEqualToEffectiveDate(result) {
|
|
1378
|
+
if (this.EndDate != null && this.EffectiveDate != null) {
|
|
1379
|
+
if (this.EndDate < this.EffectiveDate) {
|
|
1380
|
+
result.Errors.push(new ValidationErrorInfo("EndDate", "The contract End Date must be on or after the Effective Date.", this.EndDate, ValidationErrorType.Failure));
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* A contract cannot be its own parent contract to prevent circular references in the contract hierarchy.
|
|
1386
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1387
|
+
* @public
|
|
1388
|
+
* @method
|
|
1389
|
+
*/
|
|
1390
|
+
ValidateParentContractIDNotEqualToID(result) {
|
|
1391
|
+
if (this.ParentContractID != null && this.ParentContractID === this.ID) {
|
|
1392
|
+
result.Errors.push(new ValidationErrorInfo("ParentContractID", "A contract cannot be its own parent contract.", this.ParentContractID, ValidationErrorType.Failure));
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* A contract cannot be superseded by itself. The superseding contract must be a different contract record.
|
|
1397
|
+
* @param result - the ValidationResult object to add any errors or warnings to
|
|
1398
|
+
* @public
|
|
1399
|
+
* @method
|
|
1400
|
+
*/
|
|
1401
|
+
ValidateSupersededByContractIDNotEqualToID(result) {
|
|
1402
|
+
if (this.SupersededByContractID != null && this.SupersededByContractID === this.ID) {
|
|
1403
|
+
result.Errors.push(new ValidationErrorInfo("SupersededByContractID", "A contract cannot be superseded by itself. Please select a different contract.", this.SupersededByContractID, ValidationErrorType.Failure));
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* * Field Name: ID
|
|
1408
|
+
* * Display Name: ID
|
|
1409
|
+
* * SQL Data Type: uniqueidentifier
|
|
1410
|
+
* * Default Value: newsequentialid()
|
|
1411
|
+
*/
|
|
1412
|
+
get ID() {
|
|
1413
|
+
return this.Get('ID');
|
|
1414
|
+
}
|
|
1415
|
+
set ID(value) {
|
|
1416
|
+
this.Set('ID', value);
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* * Field Name: ContractNumber
|
|
1420
|
+
* * Display Name: Contract Number
|
|
1421
|
+
* * SQL Data Type: nvarchar(50)
|
|
1422
|
+
* * Description: CTR-000001, minted by spAssignNextContractNumber from the seq_ContractNumber database SEQUENCE. Unique. NULLABLE at the schema level because MJ cannot express 'NOT NULL, assigned by the server on insert' -- ContractEntityServer.Save() is what guarantees every contract has one. Gaps are normal and are not to be 'fixed': a save that fails after taking a number leaves one behind, and UQ_Contract_ContractNumber is what guarantees no two contracts share a number.
|
|
1423
|
+
*/
|
|
1424
|
+
get ContractNumber() {
|
|
1425
|
+
return this.Get('ContractNumber');
|
|
1426
|
+
}
|
|
1427
|
+
set ContractNumber(value) {
|
|
1428
|
+
this.Set('ContractNumber', value);
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* * Field Name: ContractTypeID
|
|
1432
|
+
* * Display Name: Contract Type
|
|
1433
|
+
* * SQL Data Type: uniqueidentifier
|
|
1434
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Types (vwContractTypes.ID)
|
|
1435
|
+
*/
|
|
1436
|
+
get ContractTypeID() {
|
|
1437
|
+
return this.Get('ContractTypeID');
|
|
1438
|
+
}
|
|
1439
|
+
set ContractTypeID(value) {
|
|
1440
|
+
this.Set('ContractTypeID', value);
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* * Field Name: CompanyID
|
|
1444
|
+
* * Display Name: Company
|
|
1445
|
+
* * SQL Data Type: uniqueidentifier
|
|
1446
|
+
* * Related Entity/Foreign Key: MJ: Companies (vwCompanies.ID)
|
|
1447
|
+
* * Description: The SELLING company (__mj.Company) — which of OUR entities holds this agreement. Not the customer. Stored rather than derived because it is not reliably recoverable from the deal.
|
|
1448
|
+
*/
|
|
1449
|
+
get CompanyID() {
|
|
1450
|
+
return this.Get('CompanyID');
|
|
1451
|
+
}
|
|
1452
|
+
set CompanyID(value) {
|
|
1453
|
+
this.Set('CompanyID', value);
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* * Field Name: CustomerOrganizationID
|
|
1457
|
+
* * Display Name: Customer Organization
|
|
1458
|
+
* * SQL Data Type: uniqueidentifier
|
|
1459
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Common: Organizations (vwOrganizations.ID)
|
|
1460
|
+
* * Description: The customer. NOT NULL: contracts are B2B here by definition, and the individual case lives entirely in orders. v1 allowed an organization-or-person XOR; that is gone.
|
|
1461
|
+
*/
|
|
1462
|
+
get CustomerOrganizationID() {
|
|
1463
|
+
return this.Get('CustomerOrganizationID');
|
|
1464
|
+
}
|
|
1465
|
+
set CustomerOrganizationID(value) {
|
|
1466
|
+
this.Set('CustomerOrganizationID', value);
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* * Field Name: PrimaryContactPersonID
|
|
1470
|
+
* * Display Name: Primary Contact Person
|
|
1471
|
+
* * SQL Data Type: uniqueidentifier
|
|
1472
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Common: People (vwPeople.ID)
|
|
1473
|
+
* * Description: Their named contact, optional.
|
|
1474
|
+
*/
|
|
1475
|
+
get PrimaryContactPersonID() {
|
|
1476
|
+
return this.Get('PrimaryContactPersonID');
|
|
1477
|
+
}
|
|
1478
|
+
set PrimaryContactPersonID(value) {
|
|
1479
|
+
this.Set('PrimaryContactPersonID', value);
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* * Field Name: ContractTemplateID
|
|
1483
|
+
* * Display Name: Contract Template
|
|
1484
|
+
* * SQL Data Type: uniqueidentifier
|
|
1485
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contract Templates (vwContractTemplates.ID)
|
|
1486
|
+
* * Description: The agreement version this contract incorporates. Nullable because a contract created automatically at Closed Won has none until finance reads the PDF.
|
|
1487
|
+
*/
|
|
1488
|
+
get ContractTemplateID() {
|
|
1489
|
+
return this.Get('ContractTemplateID');
|
|
1490
|
+
}
|
|
1491
|
+
set ContractTemplateID(value) {
|
|
1492
|
+
this.Set('ContractTemplateID', value);
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* * Field Name: CreatingEntityID
|
|
1496
|
+
* * Display Name: Creating Entity
|
|
1497
|
+
* * SQL Data Type: uniqueidentifier
|
|
1498
|
+
* * Related Entity/Foreign Key: MJ: Entities (vwEntities.ID)
|
|
1499
|
+
* * Description: Polymorphic reference part 1: the MJ Entity of the record that CREATED this contract, in practice Deals. A real foreign key to __mj.Entity — this is the half that is enforced, and the half that lets MJ resolve the pair generically. Same pattern accounting uses for JournalEntry provenance.
|
|
1500
|
+
*/
|
|
1501
|
+
get CreatingEntityID() {
|
|
1502
|
+
return this.Get('CreatingEntityID');
|
|
1503
|
+
}
|
|
1504
|
+
set CreatingEntityID(value) {
|
|
1505
|
+
this.Set('CreatingEntityID', value);
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* * Field Name: CreatingRecordID
|
|
1509
|
+
* * Display Name: Creating Record
|
|
1510
|
+
* * SQL Data Type: nvarchar(450)
|
|
1511
|
+
* * Description: Polymorphic reference part 2: the creating records id. Soft by nature — it points at a record owned by an app this repo has no knowledge of. Set together with CreatingEntityID or not at all.
|
|
1512
|
+
*/
|
|
1513
|
+
get CreatingRecordID() {
|
|
1514
|
+
return this.Get('CreatingRecordID');
|
|
1515
|
+
}
|
|
1516
|
+
set CreatingRecordID(value) {
|
|
1517
|
+
this.Set('CreatingRecordID', value);
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* * Field Name: ParentContractID
|
|
1521
|
+
* * Display Name: Parent Contract
|
|
1522
|
+
* * SQL Data Type: uniqueidentifier
|
|
1523
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contracts (vwContracts.ID)
|
|
1524
|
+
* * Description: The contract this one amends. How a change order attaches: a change order is signed paper with its own PDF, dates and modifications, so it reuses this entity rather than getting one of its own. The original stays in force.
|
|
1525
|
+
*/
|
|
1526
|
+
get ParentContractID() {
|
|
1527
|
+
return this.Get('ParentContractID');
|
|
1528
|
+
}
|
|
1529
|
+
set ParentContractID(value) {
|
|
1530
|
+
this.Set('ParentContractID', value);
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* * Field Name: SupersededByContractID
|
|
1534
|
+
* * Display Name: Superseded By Contract
|
|
1535
|
+
* * SQL Data Type: uniqueidentifier
|
|
1536
|
+
* * Related Entity/Foreign Key: MJ_BizApps_Contracts: Contracts (vwContracts.ID)
|
|
1537
|
+
* * Description: The contract that REPLACED this one, where an agreement was re-papered rather than amended. Also the sole source of the derived Superseded state, which is why the old CHECK tying it to a Status column disappeared with that column.
|
|
1538
|
+
*/
|
|
1539
|
+
get SupersededByContractID() {
|
|
1540
|
+
return this.Get('SupersededByContractID');
|
|
1541
|
+
}
|
|
1542
|
+
set SupersededByContractID(value) {
|
|
1543
|
+
this.Set('SupersededByContractID', value);
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* * Field Name: SigningProviderURL
|
|
1547
|
+
* * Display Name: Signing Provider URL
|
|
1548
|
+
* * SQL Data Type: nvarchar(1000)
|
|
1549
|
+
* * Description: Direct link to the document in the signing provider (PandaDoc). The fallback that works before any integration exists, and when a storage sync has broken.
|
|
1550
|
+
*/
|
|
1551
|
+
get SigningProviderURL() {
|
|
1552
|
+
return this.Get('SigningProviderURL');
|
|
1553
|
+
}
|
|
1554
|
+
set SigningProviderURL(value) {
|
|
1555
|
+
this.Set('SigningProviderURL', value);
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* * Field Name: EffectiveDate
|
|
1559
|
+
* * Display Name: Effective Date
|
|
1560
|
+
* * SQL Data Type: date
|
|
1561
|
+
* * Description: When the agreement takes effect.
|
|
1562
|
+
*/
|
|
1563
|
+
get EffectiveDate() {
|
|
1564
|
+
return this.Get('EffectiveDate');
|
|
1565
|
+
}
|
|
1566
|
+
set EffectiveDate(value) {
|
|
1567
|
+
this.Set('EffectiveDate', value);
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* * Field Name: ExecutedDate
|
|
1571
|
+
* * Display Name: Executed Date
|
|
1572
|
+
* * SQL Data Type: date
|
|
1573
|
+
* * Description: When it was signed. May legitimately PRECEDE EffectiveDate — sign in December for a January start is the ordinary case. There is deliberately no constraint ordering the two; v1 had one and it rejected exactly the data a correct contract produces.
|
|
1574
|
+
*/
|
|
1575
|
+
get ExecutedDate() {
|
|
1576
|
+
return this.Get('ExecutedDate');
|
|
1577
|
+
}
|
|
1578
|
+
set ExecutedDate(value) {
|
|
1579
|
+
this.Set('ExecutedDate', value);
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* * Field Name: EndDate
|
|
1583
|
+
* * Display Name: End Date
|
|
1584
|
+
* * SQL Data Type: date
|
|
1585
|
+
* * Description: When the current term ends. This is what drives the renewal watchlist and every expiry projection.
|
|
1586
|
+
*/
|
|
1587
|
+
get EndDate() {
|
|
1588
|
+
return this.Get('EndDate');
|
|
1589
|
+
}
|
|
1590
|
+
set EndDate(value) {
|
|
1591
|
+
this.Set('EndDate', value);
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* * Field Name: TerminatedDate
|
|
1595
|
+
* * Display Name: Terminated Date
|
|
1596
|
+
* * SQL Data Type: date
|
|
1597
|
+
* * Description: When the agreement ended early. Stored rather than derived: it is only recoverable from a successors effective date, and a contract can end with no successor at all when a customer simply leaves.
|
|
1598
|
+
*/
|
|
1599
|
+
get TerminatedDate() {
|
|
1600
|
+
return this.Get('TerminatedDate');
|
|
1601
|
+
}
|
|
1602
|
+
set TerminatedDate(value) {
|
|
1603
|
+
this.Set('TerminatedDate', value);
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* * Field Name: AutoRenew
|
|
1607
|
+
* * Display Name: Auto Renew
|
|
1608
|
+
* * SQL Data Type: bit
|
|
1609
|
+
* * Default Value: 0
|
|
1610
|
+
* * Description: Whether the agreement auto-renews, AS THE PAPER STATES IT. True or false, no third state. Distinct from the subscriptions operational setting in orders, which someone can change later; when the two disagree that is a finding, not a bug.
|
|
1611
|
+
*/
|
|
1612
|
+
get AutoRenew() {
|
|
1613
|
+
return this.Get('AutoRenew');
|
|
1614
|
+
}
|
|
1615
|
+
set AutoRenew(value) {
|
|
1616
|
+
this.Set('AutoRenew', value);
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* * Field Name: RenewalNoticeDays
|
|
1620
|
+
* * Display Name: Renewal Notice Days
|
|
1621
|
+
* * SQL Data Type: int
|
|
1622
|
+
* * Description: Days of written notice we owe before a renewal price change, as stated in the agreement. NOT the same field as CancellationWindowDays even though many agreements set them equal — conflating them silently is how a notice obligation gets missed.
|
|
1623
|
+
*/
|
|
1624
|
+
get RenewalNoticeDays() {
|
|
1625
|
+
return this.Get('RenewalNoticeDays');
|
|
1626
|
+
}
|
|
1627
|
+
set RenewalNoticeDays(value) {
|
|
1628
|
+
this.Set('RenewalNoticeDays', value);
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* * Field Name: CancellationWindowDays
|
|
1632
|
+
* * Display Name: Cancellation Window Days
|
|
1633
|
+
* * SQL Data Type: int
|
|
1634
|
+
* * Description: Days of notice the customer owes to cancel without renewing.
|
|
1635
|
+
*/
|
|
1636
|
+
get CancellationWindowDays() {
|
|
1637
|
+
return this.Get('CancellationWindowDays');
|
|
1638
|
+
}
|
|
1639
|
+
set CancellationWindowDays(value) {
|
|
1640
|
+
this.Set('CancellationWindowDays', value);
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* * Field Name: AnnualIncreasePercent
|
|
1644
|
+
* * Display Name: Annual Increase Percent
|
|
1645
|
+
* * SQL Data Type: decimal(7, 4)
|
|
1646
|
+
* * Description: The negotiated year-over-year uplift. Exists here because it exists nowhere else: the orders schema has no escalation concept of any kind, which is why a two-year agreement stepping up 10% in year two is recorded in no other system.
|
|
1647
|
+
*/
|
|
1648
|
+
get AnnualIncreasePercent() {
|
|
1649
|
+
return this.Get('AnnualIncreasePercent');
|
|
1650
|
+
}
|
|
1651
|
+
set AnnualIncreasePercent(value) {
|
|
1652
|
+
this.Set('AnnualIncreasePercent', value);
|
|
1653
|
+
}
|
|
1654
|
+
/**
|
|
1655
|
+
* * Field Name: HasModifications
|
|
1656
|
+
* * Display Name: Has Modifications
|
|
1657
|
+
* * SQL Data Type: bit
|
|
1658
|
+
* * Default Value: 0
|
|
1659
|
+
* * Description: Whether the standard agreement was changed for this customer. ASSERTED by a person, not derived — its job is to say "go read the PDF" BEFORE anyone has recorded the modifications, and a derived flag would read false for every contract nobody has processed yet. One direction IS enforced server-side: if modification rows exist this must be true. It is never cleared automatically.
|
|
1660
|
+
*/
|
|
1661
|
+
get HasModifications() {
|
|
1662
|
+
return this.Get('HasModifications');
|
|
1663
|
+
}
|
|
1664
|
+
set HasModifications(value) {
|
|
1665
|
+
this.Set('HasModifications', value);
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* * Field Name: Description
|
|
1669
|
+
* * Display Name: Description
|
|
1670
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
1671
|
+
*/
|
|
1672
|
+
get Description() {
|
|
1673
|
+
return this.Get('Description');
|
|
1674
|
+
}
|
|
1675
|
+
set Description(value) {
|
|
1676
|
+
this.Set('Description', value);
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* * Field Name: Notes
|
|
1680
|
+
* * Display Name: Notes
|
|
1681
|
+
* * SQL Data Type: nvarchar(MAX)
|
|
1682
|
+
* * Description: Free-text working notes for whoever is processing the contract.
|
|
1683
|
+
*/
|
|
1684
|
+
get Notes() {
|
|
1685
|
+
return this.Get('Notes');
|
|
1686
|
+
}
|
|
1687
|
+
set Notes(value) {
|
|
1688
|
+
this.Set('Notes', value);
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* * Field Name: __mj_CreatedAt
|
|
1692
|
+
* * Display Name: Created At
|
|
1693
|
+
* * SQL Data Type: datetimeoffset
|
|
1694
|
+
* * Default Value: getutcdate()
|
|
1695
|
+
*/
|
|
1696
|
+
get __mj_CreatedAt() {
|
|
1697
|
+
return this.Get('__mj_CreatedAt');
|
|
1698
|
+
}
|
|
1699
|
+
/**
|
|
1700
|
+
* * Field Name: __mj_UpdatedAt
|
|
1701
|
+
* * Display Name: Updated At
|
|
1702
|
+
* * SQL Data Type: datetimeoffset
|
|
1703
|
+
* * Default Value: getutcdate()
|
|
1704
|
+
*/
|
|
1705
|
+
get __mj_UpdatedAt() {
|
|
1706
|
+
return this.Get('__mj_UpdatedAt');
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* * Field Name: ContractType
|
|
1710
|
+
* * Display Name: Contract Type Name
|
|
1711
|
+
* * SQL Data Type: nvarchar(100)
|
|
1712
|
+
*/
|
|
1713
|
+
get ContractType() {
|
|
1714
|
+
return this.Get('ContractType');
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* * Field Name: Company
|
|
1718
|
+
* * Display Name: Company Name
|
|
1719
|
+
* * SQL Data Type: nvarchar(50)
|
|
1720
|
+
*/
|
|
1721
|
+
get Company() {
|
|
1722
|
+
return this.Get('Company');
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* * Field Name: CustomerOrganization
|
|
1726
|
+
* * Display Name: Customer Name
|
|
1727
|
+
* * SQL Data Type: nvarchar(255)
|
|
1728
|
+
*/
|
|
1729
|
+
get CustomerOrganization() {
|
|
1730
|
+
return this.Get('CustomerOrganization');
|
|
1731
|
+
}
|
|
1732
|
+
/**
|
|
1733
|
+
* * Field Name: PrimaryContactPerson
|
|
1734
|
+
* * Display Name: Primary Contact Name
|
|
1735
|
+
* * SQL Data Type: nvarchar(100)
|
|
1736
|
+
*/
|
|
1737
|
+
get PrimaryContactPerson() {
|
|
1738
|
+
return this.Get('PrimaryContactPerson');
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* * Field Name: ContractTemplate
|
|
1742
|
+
* * Display Name: Contract Template Name
|
|
1743
|
+
* * SQL Data Type: nvarchar(200)
|
|
1744
|
+
*/
|
|
1745
|
+
get ContractTemplate() {
|
|
1746
|
+
return this.Get('ContractTemplate');
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* * Field Name: CreatingEntity
|
|
1750
|
+
* * Display Name: Creating Entity Name
|
|
1751
|
+
* * SQL Data Type: nvarchar(255)
|
|
1752
|
+
*/
|
|
1753
|
+
get CreatingEntity() {
|
|
1754
|
+
return this.Get('CreatingEntity');
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* * Field Name: ParentContract
|
|
1758
|
+
* * Display Name: Parent Contract Name
|
|
1759
|
+
* * SQL Data Type: nvarchar(50)
|
|
1760
|
+
*/
|
|
1761
|
+
get ParentContract() {
|
|
1762
|
+
return this.Get('ParentContract');
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* * Field Name: SupersededByContract
|
|
1766
|
+
* * Display Name: Superseded By Contract Name
|
|
1767
|
+
* * SQL Data Type: nvarchar(50)
|
|
1768
|
+
*/
|
|
1769
|
+
get SupersededByContract() {
|
|
1770
|
+
return this.Get('SupersededByContract');
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* * Field Name: State
|
|
1774
|
+
* * Display Name: State
|
|
1775
|
+
* * SQL Data Type: varchar(10)
|
|
1776
|
+
*/
|
|
1777
|
+
get State() {
|
|
1778
|
+
return this.Get('State');
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* * Field Name: IsAwaitingDocument
|
|
1782
|
+
* * Display Name: Is Awaiting Document
|
|
1783
|
+
* * SQL Data Type: bit
|
|
1784
|
+
*/
|
|
1785
|
+
get IsAwaitingDocument() {
|
|
1786
|
+
return this.Get('IsAwaitingDocument');
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* * Field Name: DaysToEnd
|
|
1790
|
+
* * Display Name: Days To End
|
|
1791
|
+
* * SQL Data Type: int
|
|
1792
|
+
*/
|
|
1793
|
+
get DaysToEnd() {
|
|
1794
|
+
return this.Get('DaysToEnd');
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* * Field Name: RenewalNoticeDeadline
|
|
1798
|
+
* * Display Name: Renewal Notice Deadline
|
|
1799
|
+
* * SQL Data Type: date
|
|
1800
|
+
*/
|
|
1801
|
+
get RenewalNoticeDeadline() {
|
|
1802
|
+
return this.Get('RenewalNoticeDeadline');
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* * Field Name: IsInCancellationWindow
|
|
1806
|
+
* * Display Name: Is In Cancellation Window
|
|
1807
|
+
* * SQL Data Type: bit
|
|
1808
|
+
*/
|
|
1809
|
+
get IsInCancellationWindow() {
|
|
1810
|
+
return this.Get('IsInCancellationWindow');
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
mjBizAppsContractsContractEntity = __decorate([
|
|
1814
|
+
RegisterClass(BaseEntity, 'MJ_BizApps_Contracts: Contracts')
|
|
1815
|
+
], mjBizAppsContractsContractEntity);
|
|
1816
|
+
export { mjBizAppsContractsContractEntity };
|
|
1817
|
+
//# sourceMappingURL=entity_subclasses.js.map
|