@@ -71,6 +71,9 @@ const createDocumentFromTemplate = async (template, existContact, index) => {
71
71
object . set ( 'IsEnableOTP' , template ?. IsEnableOTP || false ) ;
72
72
object . set ( 'IsTourEnabled' , template ?. IsTourEnabled || false ) ;
73
73
object . set ( 'FileAdapterId' , template ?. FileAdapterId || '' ) ;
74
+ if ( template ?. SignatureType ?. length > 0 ) {
75
+ object . set ( 'SignatureType' , template ?. SignatureType ) ;
76
+ }
74
77
let signers = template ?. Signers || [ ] ;
75
78
const signerobj = {
76
79
__type : 'Pointer' ,
@@ -254,6 +257,7 @@ const deductcount = async _resSub => {
254
257
export default async function PublicUserLinkContactToDoc ( req ) {
255
258
const email = req . params . email ;
256
259
const templateid = req . params . templateid ;
260
+ const signatureType = req . params . signatureType ;
257
261
const name = req . params . name ;
258
262
const phone = req . params . phone ;
259
263
const role = req . params . role ;
@@ -301,8 +305,11 @@ export default async function PublicUserLinkContactToDoc(req) {
301
305
const existContact = await contactCls . first ( { useMasterKey : true } ) ;
302
306
if ( existContact ) {
303
307
const template_json = JSON . parse ( JSON . stringify ( tempRes ) ) ;
308
+ const _template_json = template_json ;
309
+ _template_json . SignatureType =
310
+ signatureType ?. length > 0 ? signatureType : _template_json ?. SignatureType ;
304
311
//update contact in placeholder, signers and update ACl in provide document
305
- const docRes = await createDocumentFromTemplate ( template_json , existContact , index ) ;
312
+ const docRes = await createDocumentFromTemplate ( _template_json , existContact , index ) ;
306
313
if ( docRes ) {
307
314
await deductcount ( _resSub ) ;
308
315
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
@@ -327,9 +334,12 @@ export default async function PublicUserLinkContactToDoc(req) {
327
334
TenantId : _tempRes . ExtUserPtr ?. TenantId ?. objectId ,
328
335
} ;
329
336
const template_json = JSON . parse ( JSON . stringify ( tempRes ) ) ;
337
+ const _template_json = template_json ;
338
+ _template_json . SignatureType =
339
+ signatureType ?. length > 0 ? signatureType : _template_json ?. SignatureType ;
330
340
// if user present on platform create contact on the basis of extended user details
331
341
const contactRes = await saveRoleContact ( contact ) ;
332
- const docRes = await createDocumentFromTemplate ( template_json , contactRes , index ) ;
342
+ const docRes = await createDocumentFromTemplate ( _template_json , contactRes , index ) ;
333
343
if ( docRes ) {
334
344
await deductcount ( _resSub ) ;
335
345
//condition will execute only if sendInOrder will be false for send email to all signers at a time.
@@ -354,11 +364,14 @@ export default async function PublicUserLinkContactToDoc(req) {
354
364
TenantId : _tempRes . ExtUserPtr ?. TenantId ?. objectId ,
355
365
} ;
356
366
const template_json = JSON . parse ( JSON . stringify ( tempRes ) ) ;
367
+ const _template_json = template_json ;
368
+ _template_json . SignatureType =
369
+ signatureType ?. length > 0 ? signatureType : _template_json ?. SignatureType ;
357
370
// Create new contract on the basis provided contact details by user and userId from _User class
358
371
const contactRes = await saveRoleContact ( contact ) ;
359
372
//update contact in placeholder, signers and update ACl in provide document
360
373
const docRes = await createDocumentFromTemplate (
361
- template_json ,
374
+ _template_json ,
362
375
contactRes ,
363
376
index
364
377
) ;
@@ -391,11 +404,14 @@ export default async function PublicUserLinkContactToDoc(req) {
391
404
TenantId : _tempRes . ExtUserPtr ?. TenantId ?. objectId ,
392
405
} ;
393
406
const template_json = JSON . parse ( JSON . stringify ( tempRes ) ) ;
407
+ const _template_json = template_json ;
408
+ _template_json . SignatureType =
409
+ signatureType ?. length > 0 ? signatureType : _template_json ?. SignatureType ;
394
410
// Create new contract on the basis provided contact details by user and userId from _User class
395
411
const contactRes = await saveRoleContact ( contact ) ;
396
412
//update contact in placeholder, signers and update ACl in provide document
397
413
const docRes = await createDocumentFromTemplate (
398
- template_json ,
414
+ _template_json ,
399
415
contactRes ,
400
416
index
401
417
) ;
0 commit comments