mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-22 23:52:30 +02:00
Merge pull request #2460 from nxglabs/sync-to-public_repo-25861367352
Merge pull request #2459 from nxglabs/staging
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const randomId = () => Math.floor(1000 + Math.random() * 9000);
|
||||
import { randomId } from '../../Utils.js';
|
||||
|
||||
export default async function saveAsTemplate(request) {
|
||||
const docId = request.params.docId;
|
||||
const Ip = request?.headers?.['x-real-ip'] || '';
|
||||
@@ -23,6 +24,7 @@ export default async function saveAsTemplate(request) {
|
||||
templateCls.set('Description', _docRes?.Description);
|
||||
templateCls.set('OriginIp', Ip);
|
||||
templateCls.set('SendinOrder', _docRes?.SendinOrder || false);
|
||||
templateCls.set('SendInOrderStrict', _docRes?.SendInOrderStrict || false);
|
||||
templateCls.set('AutomaticReminders', _docRes?.AutomaticReminders || false);
|
||||
templateCls.set('ExtUserPtr', _docRes?.ExtUserPtr);
|
||||
templateCls.set('CreatedBy', _docRes?.CreatedBy);
|
||||
@@ -91,18 +93,27 @@ export default async function saveAsTemplate(request) {
|
||||
pos: (page.pos || []).map(widget => {
|
||||
// if there is a defaultValue in options, zero it out
|
||||
if (widget.options && widget.options.defaultValue !== undefined) {
|
||||
const { SignUrl, ...rest } = widget;
|
||||
return {
|
||||
...widget,
|
||||
signatureType: '',
|
||||
...rest,
|
||||
type: widget.type === 'text' ? 'text input' : widget.type,
|
||||
...(widget.type === 'signature' ? { signatureType: '' } : {}),
|
||||
options: {
|
||||
...widget.options,
|
||||
defaultValue: '',
|
||||
response: '',
|
||||
...(widget?.options?.isReadOnly ? { isReadOnly: false } : {}),
|
||||
},
|
||||
}; // reset only the value
|
||||
}
|
||||
// otherwise, return the widget unchanged
|
||||
return widget;
|
||||
const { SignUrl, ...rest } = widget;
|
||||
return {
|
||||
...rest,
|
||||
type: widget.type === 'text' ? 'text input' : widget.type,
|
||||
...(widget.type === 'signature' ? { signatureType: '' } : {}),
|
||||
options: { ...widget.options, response: '' },
|
||||
};
|
||||
}),
|
||||
})),
|
||||
}));
|
||||
@@ -116,6 +127,9 @@ export default async function saveAsTemplate(request) {
|
||||
if (_docRes?.Bcc?.length > 0) {
|
||||
templateCls.set('Bcc', _docRes?.Bcc);
|
||||
}
|
||||
if (_docRes?.Cc?.length > 0) {
|
||||
templateCls.set('Cc', _docRes?.Cc);
|
||||
}
|
||||
if (_docRes?.PenColors?.length > 0) {
|
||||
templateCls.set('PenColors', _docRes?.PenColors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user