mirror of
https://github.com/docusealco/docuseal
synced 2026-11-16 08:12:32 -05:00
Merge from docusealco/wip
This commit is contained in:
24 files changed
+168
-92
No files matched your search
@@ -104,7 +104,7 @@ jobs:
|
|||||||
bundle install --jobs 4 --retry 4
|
bundle install --jobs 4 --retry 4
|
||||||
yarn install
|
yarn install
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install libvips liblept5
|
sudo apt-get install libvips libleptonica6
|
||||||
- name: Run Brakeman
|
- name: Run Brakeman
|
||||||
run: bundle exec brakeman -q --exit-on-warn
|
run: bundle exec brakeman -q --exit-on-warn
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -75,7 +75,7 @@ GEM
|
|||||||
securerandom (>= 0.3)
|
securerandom (>= 0.3)
|
||||||
tzinfo (~> 2.0, >= 2.0.5)
|
tzinfo (~> 2.0, >= 2.0.5)
|
||||||
uri (>= 0.13.1)
|
uri (>= 0.13.1)
|
||||||
addressable (2.9.0)
|
addressable (2.9.2)
|
||||||
public_suffix (>= 2.0.2, < 8.0)
|
public_suffix (>= 2.0.2, < 8.0)
|
||||||
annotaterb (4.22.0)
|
annotaterb (4.22.0)
|
||||||
activerecord (>= 6.0.0)
|
activerecord (>= 6.0.0)
|
||||||
@@ -309,7 +309,7 @@ GEM
|
|||||||
minitest (6.0.6)
|
minitest (6.0.6)
|
||||||
drb (~> 2.0)
|
drb (~> 2.0)
|
||||||
prism (~> 1.5)
|
prism (~> 1.5)
|
||||||
msgpack (1.8.4)
|
msgpack (1.8.7)
|
||||||
multi_json (1.21.2)
|
multi_json (1.21.2)
|
||||||
net-http (0.9.1)
|
net-http (0.9.1)
|
||||||
uri (>= 0.11.1)
|
uri (>= 0.11.1)
|
||||||
|
|||||||
@@ -49,9 +49,11 @@ class AccountsController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
authorize!(:manage, current_account)
|
authorize!(:manage, current_account)
|
||||||
|
|
||||||
|
removed_email = true_user.email.sub('@', '+removed@')
|
||||||
|
removed_email = true_user.email.sub('@', "+removed#{Time.current.to_i}@") if User.exists?(email: removed_email)
|
||||||
|
|
||||||
true_user.skip_reconfirmation!
|
true_user.skip_reconfirmation!
|
||||||
true_user.update!(locked_at: Time.current, archived_at: Time.current,
|
true_user.update!(locked_at: Time.current, archived_at: Time.current, email: removed_email)
|
||||||
email: true_user.email.sub('@', '+removed@'))
|
|
||||||
true_user.account.update!(archived_at: Time.current)
|
true_user.account.update!(archived_at: Time.current)
|
||||||
|
|
||||||
# rubocop:disable-next Layout/LineLength
|
# rubocop:disable-next Layout/LineLength
|
||||||
|
|||||||
@@ -42,21 +42,21 @@ module Api
|
|||||||
|
|
||||||
authorization_check!(attachment, @record, exp)
|
authorization_check!(attachment, @record, exp)
|
||||||
|
|
||||||
|
no_store
|
||||||
|
|
||||||
if request.headers['Range'].present?
|
if request.headers['Range'].present?
|
||||||
send_blob_byte_range_data blob, request.headers['Range']
|
send_blob_byte_range_data blob, request.headers['Range']
|
||||||
else
|
else
|
||||||
http_cache_forever public: true do
|
response.headers['Accept-Ranges'] = 'bytes'
|
||||||
response.headers['Accept-Ranges'] = 'bytes'
|
|
||||||
|
|
||||||
if request.head?
|
if request.head?
|
||||||
response.headers['Content-Type'] = blob.content_type_for_serving
|
response.headers['Content-Type'] = blob.content_type_for_serving
|
||||||
head :ok
|
head :ok
|
||||||
else
|
else
|
||||||
send_blob_stream blob, disposition: params[:disposition]
|
send_blob_stream blob, disposition: params[:disposition]
|
||||||
end
|
|
||||||
|
|
||||||
response.headers['Content-Length'] = blob.byte_size.to_s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
response.headers['Content-Length'] = blob.byte_size.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,9 @@ module Api
|
|||||||
|
|
||||||
if attrs[:completed]
|
if attrs[:completed]
|
||||||
submitter.values = Submitters::SubmitValues.merge_default_values(submitter)
|
submitter.values = Submitters::SubmitValues.merge_default_values(submitter)
|
||||||
submitter.values = Submitters::SubmitValues.maybe_remove_condition_values(submitter)
|
submitter.values = Submitters::SubmitValues.maybe_remove_condition_values(
|
||||||
|
submitter, formula_values: Submitters::SubmitValues.build_formula_values(submitter)
|
||||||
|
)
|
||||||
|
|
||||||
formula_values = Submitters::SubmitValues.build_formula_values(submitter)
|
formula_values = Submitters::SubmitValues.build_formula_values(submitter)
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,12 @@ module Mcp
|
|||||||
|
|
||||||
return render_tool_error('Template has no fields') if @template.fields.blank?
|
return render_tool_error('Template has no fields') if @template.fields.blank?
|
||||||
|
|
||||||
|
if @template.variables_schema.present?
|
||||||
|
Rollbar.warning("MCP send variables template: #{@template.id}") if defined?(Rollbar)
|
||||||
|
|
||||||
|
return render_tool_error('Templates with variables are not supported')
|
||||||
|
end
|
||||||
|
|
||||||
submitters = (mcp_params['submitters'] || []).map do |s|
|
submitters = (mcp_params['submitters'] || []).map do |s|
|
||||||
attrs = s.slice('email', 'name', 'role', 'phone').compact_blank
|
attrs = s.slice('email', 'name', 'role', 'phone').compact_blank
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class SubmitFormController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
unless Submitters::AuthorizedForForm.call(@submitter, current_user, request)
|
unless Submitters::AuthorizedForForm.call(@submitter, current_user, request, with_order: with_order(@submitter))
|
||||||
return render json: { error: I18n.t('verification_required_refresh_the_page_and_pass_2fa') },
|
return render json: { error: I18n.t('verification_required_refresh_the_page_and_pass_2fa') },
|
||||||
status: :unprocessable_content
|
status: :unprocessable_content
|
||||||
end
|
end
|
||||||
@@ -154,6 +154,11 @@ class SubmitFormController < ApplicationController
|
|||||||
.preload(:blob).index_by(&:uuid)
|
.preload(:blob).index_by(&:uuid)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def with_order(submitter)
|
||||||
|
params[:completed] == 'true' && submitter.present? &&
|
||||||
|
submitter.submission.template&.preferences&.dig('submitters_order') == 'preserved'
|
||||||
|
end
|
||||||
|
|
||||||
def lang
|
def lang
|
||||||
params[:lang].presence
|
params[:lang].presence
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ class SubmitFormDeclineController < ApplicationController
|
|||||||
@submitter.viewer? ||
|
@submitter.viewer? ||
|
||||||
!Submitters::AuthorizedForForm.call(@submitter,
|
!Submitters::AuthorizedForForm.call(@submitter,
|
||||||
current_user,
|
current_user,
|
||||||
request)
|
request,
|
||||||
|
with_order: true)
|
||||||
|
|
||||||
ApplicationRecord.transaction do
|
ApplicationRecord.transaction do
|
||||||
@submitter.update!(declined_at: Time.current, values: @submitter.preferences['default_values'] || {})
|
@submitter.update!(declined_at: Time.current, values: @submitter.preferences['default_values'] || {})
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class SubmitFormInviteController < ApplicationController
|
|||||||
!submitter.submission.expired? &&
|
!submitter.submission.expired? &&
|
||||||
!submitter.submission.template&.archived_at? &&
|
!submitter.submission.template&.archived_at? &&
|
||||||
!submitter.viewer? &&
|
!submitter.viewer? &&
|
||||||
Submitters::AuthorizedForForm.call(submitter, current_user, request)
|
Submitters::AuthorizedForForm.call(submitter, current_user, request, with_order: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def filter_invite_submitters(submitter, key = 'invite_by_uuid')
|
def filter_invite_submitters(submitter, key = 'invite_by_uuid')
|
||||||
|
|||||||
@@ -660,7 +660,7 @@
|
|||||||
:native-platform="nativePlatform"
|
:native-platform="nativePlatform"
|
||||||
/>
|
/>
|
||||||
<nav
|
<nav
|
||||||
v-if="stepFields.length < 80"
|
v-if="stepFields.length > 2 && stepFields.length < 80"
|
||||||
:aria-label="t('form_progress')"
|
:aria-label="t('form_progress')"
|
||||||
:aria-hidden="isCompleted"
|
:aria-hidden="isCompleted"
|
||||||
class="flex justify-center mt-3 sm:mt-4 mb-0 sm:mb-1 select-none"
|
class="flex justify-center mt-3 sm:mt-4 mb-0 sm:mb-1 select-none"
|
||||||
@@ -684,7 +684,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="mt-5"
|
class="mt-3"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1093,7 +1093,8 @@ export default {
|
|||||||
submittedValues: {},
|
submittedValues: {},
|
||||||
isFormStarted: false,
|
isFormStarted: false,
|
||||||
recalculateButtonDisabledKey: '',
|
recalculateButtonDisabledKey: '',
|
||||||
isAccessibilityMode: false
|
isAccessibilityMode: false,
|
||||||
|
isMathLoaded: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -1197,6 +1198,24 @@ export default {
|
|||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
},
|
},
|
||||||
|
formulaFieldsUuidIndex () {
|
||||||
|
return this.fields.reduce((acc, f) => {
|
||||||
|
if (f.preferences?.formula && f.type !== 'payment') {
|
||||||
|
acc[f.uuid] = f
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
},
|
||||||
|
readonlyValues () {
|
||||||
|
return this.fields.reduce((acc, f) => {
|
||||||
|
if (f.readonly) {
|
||||||
|
acc[f.uuid] = isEmpty(this.values[f.uuid]) ? f.default_value : this.values[f.uuid]
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
},
|
||||||
previousInitialsValue () {
|
previousInitialsValue () {
|
||||||
if (this.reuseSignature !== false) {
|
if (this.reuseSignature !== false) {
|
||||||
const initialsField = this.fields.findLast
|
const initialsField = this.fields.findLast
|
||||||
@@ -1449,6 +1468,16 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
normalizeFormula: FormulaFieldAreas.methods.normalizeFormula,
|
||||||
|
calculateFormula: FormulaFieldAreas.methods.calculateFormula,
|
||||||
|
dateFormulaValue: FormulaFieldAreas.methods.dateFormulaValue,
|
||||||
|
evalTextFormula: FormulaFieldAreas.methods.evalTextFormula,
|
||||||
|
loadCalculator () {
|
||||||
|
this.calculatorPromise ||= import('./calculator').then(({ Calculator }) => {
|
||||||
|
this.math = new Calculator()
|
||||||
|
this.isMathLoaded = true
|
||||||
|
})
|
||||||
|
},
|
||||||
t (key) {
|
t (key) {
|
||||||
return this.i18n[key] || i18n[this.language?.toLowerCase()]?.[key] || i18n[this.browserLanguage]?.[key] || i18n.en[key] || key
|
return this.i18n[key] || i18n[this.language?.toLowerCase()]?.[key] || i18n[this.browserLanguage]?.[key] || i18n.en[key] || key
|
||||||
},
|
},
|
||||||
@@ -1497,17 +1526,25 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultValue = !field || isEmpty(field.default_value) ? null : field.default_value
|
const defaultValue = !field || isEmpty(field.default_value) ? null : field.default_value
|
||||||
|
const isFormulaField = !!field?.preferences?.formula && field.type !== 'payment'
|
||||||
|
|
||||||
|
if (isFormulaField && !this.isMathLoaded) {
|
||||||
|
this.loadCalculator()
|
||||||
|
}
|
||||||
|
|
||||||
|
const formulaValue = isFormulaField && this.isMathLoaded
|
||||||
|
? (field.type === 'text' ? this.evalTextFormula(field) : this.calculateFormula(field))
|
||||||
|
: null
|
||||||
|
const fieldValue = formulaValue ?? this.values[condition.field_uuid] ?? defaultValue
|
||||||
|
|
||||||
if (['empty', 'unchecked'].includes(condition.action)) {
|
if (['empty', 'unchecked'].includes(condition.action)) {
|
||||||
return isEmpty(this.values[condition.field_uuid] ?? defaultValue)
|
return isEmpty(fieldValue)
|
||||||
} else if (['not_empty', 'checked'].includes(condition.action)) {
|
} else if (['not_empty', 'checked'].includes(condition.action)) {
|
||||||
return !isEmpty(this.values[condition.field_uuid] ?? defaultValue)
|
return !isEmpty(fieldValue)
|
||||||
} else if (field?.type === 'number' && ['equal', 'not_equal', 'greater_than', 'less_than'].includes(condition.action)) {
|
} else if (field?.type === 'number' && ['equal', 'not_equal', 'greater_than', 'less_than'].includes(condition.action)) {
|
||||||
const value = this.values[condition.field_uuid] ?? defaultValue
|
if (isEmpty(fieldValue) || isEmpty(condition.value)) return false
|
||||||
|
|
||||||
if (isEmpty(value) || isEmpty(condition.value)) return false
|
const actual = parseFloat(fieldValue)
|
||||||
|
|
||||||
const actual = parseFloat(value)
|
|
||||||
const expected = parseFloat(condition.value)
|
const expected = parseFloat(condition.value)
|
||||||
|
|
||||||
if (Number.isNaN(actual) || Number.isNaN(expected)) return false
|
if (Number.isNaN(actual) || Number.isNaN(expected)) return false
|
||||||
@@ -1523,21 +1560,21 @@ export default {
|
|||||||
const option = field.options.find((o) => o.uuid === condition.value)
|
const option = field.options.find((o) => o.uuid === condition.value)
|
||||||
|
|
||||||
if (option) {
|
if (option) {
|
||||||
const values = [this.values[condition.field_uuid] ?? defaultValue].flat()
|
const values = [fieldValue].flat()
|
||||||
|
|
||||||
return values.includes(this.optionValue(option, field.options.indexOf(option)))
|
return values.includes(this.optionValue(option, field.options.indexOf(option)))
|
||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return [this.values[condition.field_uuid] ?? defaultValue].flat().includes(condition.value)
|
return [fieldValue].flat().includes(condition.value)
|
||||||
}
|
}
|
||||||
} else if (['not_equal', 'does_not_contain'].includes(condition.action) && field) {
|
} else if (['not_equal', 'does_not_contain'].includes(condition.action) && field) {
|
||||||
if (field.options) {
|
if (field.options) {
|
||||||
const option = field.options.find((o) => o.uuid === condition.value)
|
const option = field.options.find((o) => o.uuid === condition.value)
|
||||||
|
|
||||||
if (option) {
|
if (option) {
|
||||||
const values = [this.values[condition.field_uuid] ?? defaultValue].flat()
|
const values = [fieldValue].flat()
|
||||||
|
|
||||||
return !values.includes(this.optionValue(option, field.options.indexOf(option)))
|
return !values.includes(this.optionValue(option, field.options.indexOf(option)))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -557,7 +557,7 @@ export default {
|
|||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(this.baseUrl + `/s/${this.submitterSlug}/kba/${this.field.uuid}`, {
|
const resp = await fetch(this.baseUrl + `/s/${this.submitterSlug}/kba/${encodeURIComponent(this.field.uuid)}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
token: this.token,
|
token: this.token,
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async submit () {
|
async submit () {
|
||||||
if (this.sessionId) {
|
if (this.sessionId) {
|
||||||
return fetch(this.baseUrl + this.paymentEndpoint + '/' + this.sessionId, {
|
return fetch(this.baseUrl + this.paymentEndpoint + '/' + encodeURIComponent(this.sessionId), {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
...this.fetchOptions,
|
...this.fetchOptions,
|
||||||
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
|
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
start () {
|
start () {
|
||||||
return fetch(this.baseUrl + `/s/${this.submitterSlug}/identity_verification/${this.field.uuid}`, {
|
return fetch(this.baseUrl + `/s/${this.submitterSlug}/identity_verification/${encodeURIComponent(this.field.uuid)}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
redirect_url: document.location.href
|
redirect_url: document.location.href
|
||||||
|
|||||||
@@ -700,11 +700,12 @@ export default {
|
|||||||
this.save()
|
this.save()
|
||||||
},
|
},
|
||||||
onDefaultValueEnter (e) {
|
onDefaultValueEnter (e) {
|
||||||
if (this.field.type !== 'heading') {
|
if (this.field.type === 'heading') return
|
||||||
e.preventDefault()
|
if (e.shiftKey && this.field.type === 'text') return
|
||||||
|
|
||||||
this.$refs.defaultValue.blur()
|
e.preventDefault()
|
||||||
}
|
|
||||||
|
this.$refs.defaultValue.blur()
|
||||||
},
|
},
|
||||||
resize (e) {
|
resize (e) {
|
||||||
if (e.target.id === 'mask') {
|
if (e.target.id === 'mask') {
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ const SAFE_URL_REGEXP = /^(?:https?:\/\/|data:image\/|blob:|mailto:|tel:|\{|#)/i
|
|||||||
function isSafeAttr (name, value) {
|
function isSafeAttr (name, value) {
|
||||||
const lowerName = name.toLowerCase()
|
const lowerName = name.toLowerCase()
|
||||||
|
|
||||||
if (lowerName.startsWith('on') || DROP_ATTRS.includes(lowerName)) return false
|
if (lowerName.startsWith('on') || lowerName.startsWith('data-turbo') || DROP_ATTRS.includes(lowerName)) return false
|
||||||
if ((lowerName === 'href' || lowerName === 'src') && !SAFE_URL_REGEXP.test(value.trim())) return false
|
if ((lowerName === 'href' || lowerName === 'src') && !SAFE_URL_REGEXP.test(value.trim())) return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -432,8 +432,25 @@ function buildOperators (tags) {
|
|||||||
return operators
|
return operators
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UNSAFE_KEYS = ['__proto__', 'constructor', 'prototype']
|
||||||
|
|
||||||
function hasBlankKey (keyString) {
|
function hasBlankKey (keyString) {
|
||||||
return !keyString || keyString.split('.').some((key) => !key.trim())
|
return !keyString || keyString.split('.').some((key) => !key.trim() || UNSAFE_KEYS.includes(key.trim()))
|
||||||
|
}
|
||||||
|
|
||||||
|
function digProperties (properties, keys) {
|
||||||
|
return keys.reduce((current, key) => {
|
||||||
|
if (!current[key]) current[key] = { type: 'object', properties: {} }
|
||||||
|
|
||||||
|
const item = current[key].type === 'array' ? current[key].items : current[key]
|
||||||
|
|
||||||
|
if (!item.properties) {
|
||||||
|
item.type = 'object'
|
||||||
|
item.properties = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
return item.properties
|
||||||
|
}, properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
function assignNestedSchema (propertiesHash, parentProperties, keyString, value) {
|
function assignNestedSchema (propertiesHash, parentProperties, keyString, value) {
|
||||||
@@ -442,23 +459,7 @@ function assignNestedSchema (propertiesHash, parentProperties, keyString, value)
|
|||||||
const keys = keyString.split('.')
|
const keys = keyString.split('.')
|
||||||
const lastKey = keys.pop()
|
const lastKey = keys.pop()
|
||||||
|
|
||||||
let currentLevel = null
|
const currentLevel = digProperties(keys.length > 0 && parentProperties[keys[0]] ? parentProperties : propertiesHash, keys)
|
||||||
|
|
||||||
if (keys.length > 0 && parentProperties[keys[0]]) {
|
|
||||||
currentLevel = keys.reduce((current, key) => {
|
|
||||||
if (!current[key]) current[key] = { type: 'object', properties: {} }
|
|
||||||
|
|
||||||
return current[key].properties
|
|
||||||
}, parentProperties)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!currentLevel) {
|
|
||||||
currentLevel = keys.reduce((current, key) => {
|
|
||||||
if (!current[key]) current[key] = { type: 'object', properties: {} }
|
|
||||||
|
|
||||||
return current[key].properties
|
|
||||||
}, propertiesHash)
|
|
||||||
}
|
|
||||||
|
|
||||||
currentLevel[lastKey] = value
|
currentLevel[lastKey] = value
|
||||||
}
|
}
|
||||||
@@ -469,23 +470,7 @@ function assignNestedSchemaWithPriority (propertiesHash, parentProperties, keySt
|
|||||||
const keys = keyString.split('.')
|
const keys = keyString.split('.')
|
||||||
const lastKey = keys.pop()
|
const lastKey = keys.pop()
|
||||||
|
|
||||||
let currentLevel = null
|
const currentLevel = digProperties(keys.length > 0 && parentProperties[keys[0]] ? parentProperties : propertiesHash, keys)
|
||||||
|
|
||||||
if (keys.length > 0 && parentProperties[keys[0]]) {
|
|
||||||
currentLevel = keys.reduce((current, key) => {
|
|
||||||
if (!current[key]) current[key] = { type: 'object', properties: {} }
|
|
||||||
|
|
||||||
return current[key].properties
|
|
||||||
}, parentProperties)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!currentLevel) {
|
|
||||||
currentLevel = keys.reduce((current, key) => {
|
|
||||||
if (!current[key]) current[key] = { type: 'object', properties: {} }
|
|
||||||
|
|
||||||
return current[key].properties
|
|
||||||
}, propertiesHash)
|
|
||||||
}
|
|
||||||
|
|
||||||
const existing = currentLevel[lastKey]
|
const existing = currentLevel[lastKey]
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<a target="_blank" href="<%= Docuseal::GITHUB_URL %>" rel="noopener noreferrer nofollow" class="relative flex items-center rounded-full px-2 py-0.5 text-xs leading-4 mt-1 text-base-content border border-base-300 tooltip tooltip-bottom tooltip-no-touch" data-tip="Give a star on GitHub">
|
<a target="_blank" href="<%= Docuseal::GITHUB_URL %>" rel="noopener noreferrer nofollow" class="relative flex items-center rounded-full px-2 py-0.5 text-xs leading-4 mt-1 text-base-content border border-base-300 tooltip tooltip-bottom tooltip-no-touch" data-tip="Give a star on GitHub">
|
||||||
<span class="flex items-center justify-between space-x-0.5 font-medium">
|
<span class="flex items-center justify-between space-x-0.5 font-medium">
|
||||||
<%= svg_icon('start', class: 'h-3 w-3') %>
|
<%= svg_icon('start', class: 'h-3 w-3') %>
|
||||||
<span>18k</span>
|
<span>19k</span>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<%= render 'templates/dashboard_folder_dropzone', style: 'height: 114px' %>
|
<%= render 'templates/dashboard_folder_dropzone', style: 'height: 114px' %>
|
||||||
<div class="flex items-center flex-grow min-w-0 max-md:group-has-[search-input:focus-within]/header:hidden <%= 'max-md:hidden' if params[:q].present? %>">
|
<div class="flex items-center flex-grow min-w-0 max-md:group-has-[search-input:focus-within]/header:hidden <%= 'max-md:hidden' if params[:q].present? %>">
|
||||||
<% if has_archived || @pagy.count.nil? || @pagy.count > 0 || @template_folders.present? %>
|
<% if current_account.created_at < 1.day.ago || has_archived || @pagy.count.nil? || @pagy.count > 0 || @template_folders.present? %>
|
||||||
<div class="mr-2">
|
<div class="mr-2">
|
||||||
<%= render 'dashboard/toggle_view', selected: 'templates' %>
|
<%= render 'dashboard/toggle_view', selected: 'templates' %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -835,6 +835,9 @@ en: &en
|
|||||||
manage_subscription: Manage Subscription
|
manage_subscription: Manage Subscription
|
||||||
docuseal_version_security_release_is_available: "DocuSeal v%{version} security release is available."
|
docuseal_version_security_release_is_available: "DocuSeal v%{version} security release is available."
|
||||||
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Click here</a> to view the instructions and update your app.'
|
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Click here</a> to view the instructions and update your app.'
|
||||||
|
your_pro_subscription_includes_count_user_seats_but_there_are_users_active_users_in_your_account_html:
|
||||||
|
one: 'Your Pro subscription includes <b>%{count}</b> user seat, but there are <b>%{users}</b> active users in your account.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Upgrade</a> your plan to cover <b>%{users}</b> users or remove inactive users via <a href="%{settings_url}" class="link font-bold">Settings</a>.'
|
||||||
|
other: 'Your Pro subscription includes <b>%{count}</b> user seats, but there are <b>%{users}</b> active users in your account.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Upgrade</a> your plan to cover <b>%{users}</b> users or remove inactive users via <a href="%{settings_url}" class="link font-bold">Settings</a>.'
|
||||||
submission_created_by_email_html: '<b>Submission created</b> by %{email}'
|
submission_created_by_email_html: '<b>Submission created</b> by %{email}'
|
||||||
submission_created_by_email_via_source_html: '<b>Submission created</b> by %{email} via %{source}'
|
submission_created_by_email_via_source_html: '<b>Submission created</b> by %{email} via %{source}'
|
||||||
submission_created_via_source_html: '<b>Submission created</b> via %{source}'
|
submission_created_via_source_html: '<b>Submission created</b> via %{source}'
|
||||||
@@ -1997,6 +2000,9 @@ es: &es
|
|||||||
manage_subscription: Gestionar Suscripción
|
manage_subscription: Gestionar Suscripción
|
||||||
docuseal_version_security_release_is_available: "La versión de seguridad DocuSeal v%{version} está disponible."
|
docuseal_version_security_release_is_available: "La versión de seguridad DocuSeal v%{version} está disponible."
|
||||||
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Haz clic aquí</a> para ver las instrucciones y actualizar tu aplicación.'
|
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Haz clic aquí</a> para ver las instrucciones y actualizar tu aplicación.'
|
||||||
|
your_pro_subscription_includes_count_user_seats_but_there_are_users_active_users_in_your_account_html:
|
||||||
|
one: 'Tu suscripción Pro incluye <b>%{count}</b> plaza de usuario, pero hay <b>%{users}</b> usuarios activos en tu cuenta.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Amplía</a> tu plan para cubrir <b>%{users}</b> usuarios o elimina los usuarios inactivos en la <a href="%{settings_url}" class="link font-bold">Configuración</a>.'
|
||||||
|
other: 'Tu suscripción Pro incluye <b>%{count}</b> plazas de usuario, pero hay <b>%{users}</b> usuarios activos en tu cuenta.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Amplía</a> tu plan para cubrir <b>%{users}</b> usuarios o elimina los usuarios inactivos en la <a href="%{settings_url}" class="link font-bold">Configuración</a>.'
|
||||||
submission_created_by_email_html: '<b>Envío creado</b> por %{email}'
|
submission_created_by_email_html: '<b>Envío creado</b> por %{email}'
|
||||||
submission_created_by_email_via_source_html: '<b>Envío creado</b> por %{email} a través de %{source}'
|
submission_created_by_email_via_source_html: '<b>Envío creado</b> por %{email} a través de %{source}'
|
||||||
submission_created_via_source_html: '<b>Envío creado</b> a través de %{source}'
|
submission_created_via_source_html: '<b>Envío creado</b> a través de %{source}'
|
||||||
@@ -3165,6 +3171,9 @@ it: &it
|
|||||||
manage_subscription: Gestisci Abbonamento
|
manage_subscription: Gestisci Abbonamento
|
||||||
docuseal_version_security_release_is_available: "È disponibile il rilascio di sicurezza DocuSeal v%{version}."
|
docuseal_version_security_release_is_available: "È disponibile il rilascio di sicurezza DocuSeal v%{version}."
|
||||||
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Fai clic qui</a> per vedere le istruzioni e aggiornare la tua app.'
|
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Fai clic qui</a> per vedere le istruzioni e aggiornare la tua app.'
|
||||||
|
your_pro_subscription_includes_count_user_seats_but_there_are_users_active_users_in_your_account_html:
|
||||||
|
one: 'Il tuo abbonamento Pro include <b>%{count}</b> posto utente, ma nel tuo account ci sono <b>%{users}</b> utenti attivi.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Aggiorna</a> il tuo piano per coprire <b>%{users}</b> utenti oppure rimuovi gli utenti inattivi dalle <a href="%{settings_url}" class="link font-bold">Impostazioni</a>.'
|
||||||
|
other: 'Il tuo abbonamento Pro include <b>%{count}</b> posti utente, ma nel tuo account ci sono <b>%{users}</b> utenti attivi.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Aggiorna</a> il tuo piano per coprire <b>%{users}</b> utenti oppure rimuovi gli utenti inattivi dalle <a href="%{settings_url}" class="link font-bold">Impostazioni</a>.'
|
||||||
submission_created_by_email_html: '<b>Invio creato</b> da %{email}'
|
submission_created_by_email_html: '<b>Invio creato</b> da %{email}'
|
||||||
submission_created_by_email_via_source_html: '<b>Invio creato</b> da %{email} tramite %{source}'
|
submission_created_by_email_via_source_html: '<b>Invio creato</b> da %{email} tramite %{source}'
|
||||||
submission_created_via_source_html: '<b>Invio creato</b> tramite %{source}'
|
submission_created_via_source_html: '<b>Invio creato</b> tramite %{source}'
|
||||||
@@ -4319,6 +4328,9 @@ fr: &fr
|
|||||||
manage_subscription: Gérer l’abonnement
|
manage_subscription: Gérer l’abonnement
|
||||||
docuseal_version_security_release_is_available: "La mise à jour de sécurité DocuSeal v%{version} est disponible."
|
docuseal_version_security_release_is_available: "La mise à jour de sécurité DocuSeal v%{version} est disponible."
|
||||||
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Cliquez ici</a> pour voir les instructions et mettre à jour votre application.'
|
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Cliquez ici</a> pour voir les instructions et mettre à jour votre application.'
|
||||||
|
your_pro_subscription_includes_count_user_seats_but_there_are_users_active_users_in_your_account_html:
|
||||||
|
one: 'Votre abonnement Pro inclut <b>%{count}</b> place d’utilisateur, mais votre compte compte <b>%{users}</b> utilisateurs actifs.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Mettez à niveau</a> votre offre pour couvrir <b>%{users}</b> utilisateurs ou supprimez les utilisateurs inactifs dans les <a href="%{settings_url}" class="link font-bold">Paramètres</a>.'
|
||||||
|
other: 'Votre abonnement Pro inclut <b>%{count}</b> places d’utilisateur, mais votre compte compte <b>%{users}</b> utilisateurs actifs.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Mettez à niveau</a> votre offre pour couvrir <b>%{users}</b> utilisateurs ou supprimez les utilisateurs inactifs dans les <a href="%{settings_url}" class="link font-bold">Paramètres</a>.'
|
||||||
submission_created_by_email_html: "<b>Soumission créée</b> par %{email}"
|
submission_created_by_email_html: "<b>Soumission créée</b> par %{email}"
|
||||||
submission_created_by_email_via_source_html: "<b>Soumission créée</b> par %{email} via %{source}"
|
submission_created_by_email_via_source_html: "<b>Soumission créée</b> par %{email} via %{source}"
|
||||||
submission_created_via_source_html: "<b>Soumission créée</b> via %{source}"
|
submission_created_via_source_html: "<b>Soumission créée</b> via %{source}"
|
||||||
@@ -5483,6 +5495,9 @@ pt: &pt
|
|||||||
manage_subscription: Gerenciar Assinatura
|
manage_subscription: Gerenciar Assinatura
|
||||||
docuseal_version_security_release_is_available: "A versão de segurança DocuSeal v%{version} está disponível."
|
docuseal_version_security_release_is_available: "A versão de segurança DocuSeal v%{version} está disponível."
|
||||||
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Clique aqui</a> para ver as instruções e atualizar seu aplicativo.'
|
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Clique aqui</a> para ver as instruções e atualizar seu aplicativo.'
|
||||||
|
your_pro_subscription_includes_count_user_seats_but_there_are_users_active_users_in_your_account_html:
|
||||||
|
one: 'Sua assinatura Pro inclui <b>%{count}</b> lugar de usuário, mas há <b>%{users}</b> usuários ativos na sua conta.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Atualize</a> seu plano para cobrir <b>%{users}</b> usuários ou remova os usuários inativos nas <a href="%{settings_url}" class="link font-bold">Configurações</a>.'
|
||||||
|
other: 'Sua assinatura Pro inclui <b>%{count}</b> lugares de usuário, mas há <b>%{users}</b> usuários ativos na sua conta.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Atualize</a> seu plano para cobrir <b>%{users}</b> usuários ou remova os usuários inativos nas <a href="%{settings_url}" class="link font-bold">Configurações</a>.'
|
||||||
submission_created_by_email_html: '<b>Envio criado</b> por %{email}'
|
submission_created_by_email_html: '<b>Envio criado</b> por %{email}'
|
||||||
submission_created_by_email_via_source_html: '<b>Envio criado</b> por %{email} via %{source}'
|
submission_created_by_email_via_source_html: '<b>Envio criado</b> por %{email} via %{source}'
|
||||||
submission_created_via_source_html: '<b>Envio criado</b> via %{source}'
|
submission_created_via_source_html: '<b>Envio criado</b> via %{source}'
|
||||||
@@ -6650,6 +6665,9 @@ de: &de
|
|||||||
manage_subscription: Abonnement verwalten
|
manage_subscription: Abonnement verwalten
|
||||||
docuseal_version_security_release_is_available: "Das Sicherheitsupdate DocuSeal v%{version} ist verfügbar."
|
docuseal_version_security_release_is_available: "Das Sicherheitsupdate DocuSeal v%{version} ist verfügbar."
|
||||||
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Klicken Sie hier</a>, um die Anleitung anzuzeigen und Ihre App zu aktualisieren.'
|
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Klicken Sie hier</a>, um die Anleitung anzuzeigen und Ihre App zu aktualisieren.'
|
||||||
|
your_pro_subscription_includes_count_user_seats_but_there_are_users_active_users_in_your_account_html:
|
||||||
|
one: 'Ihr Pro-Abonnement umfasst <b>%{count}</b> Benutzerplatz, aber in Ihrem Konto gibt es <b>%{users}</b> aktive Benutzer.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Erweitern</a> Sie Ihren Plan auf <b>%{users}</b> Benutzer oder entfernen Sie inaktive Benutzer in den <a href="%{settings_url}" class="link font-bold">Einstellungen</a>.'
|
||||||
|
other: 'Ihr Pro-Abonnement umfasst <b>%{count}</b> Benutzerplätze, aber in Ihrem Konto gibt es <b>%{users}</b> aktive Benutzer.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Erweitern</a> Sie Ihren Plan auf <b>%{users}</b> Benutzer oder entfernen Sie inaktive Benutzer in den <a href="%{settings_url}" class="link font-bold">Einstellungen</a>.'
|
||||||
submission_created_by_email_html: '<b>Einreichung erstellt</b> von %{email}'
|
submission_created_by_email_html: '<b>Einreichung erstellt</b> von %{email}'
|
||||||
submission_created_by_email_via_source_html: '<b>Einreichung erstellt</b> von %{email} über %{source}'
|
submission_created_by_email_via_source_html: '<b>Einreichung erstellt</b> von %{email} über %{source}'
|
||||||
submission_created_via_source_html: '<b>Einreichung erstellt</b> über %{source}'
|
submission_created_via_source_html: '<b>Einreichung erstellt</b> über %{source}'
|
||||||
@@ -8345,6 +8363,9 @@ nl: &nl
|
|||||||
manage_subscription: Abonnement beheren
|
manage_subscription: Abonnement beheren
|
||||||
docuseal_version_security_release_is_available: "Beveiligingsupdate DocuSeal v%{version} is beschikbaar."
|
docuseal_version_security_release_is_available: "Beveiligingsupdate DocuSeal v%{version} is beschikbaar."
|
||||||
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Klik hier</a> om de instructies te bekijken en uw app bij te werken.'
|
click_here_to_view_the_instructions_and_update_your_app_html: '<a href="%{url}" class="link" target="_blank" rel="noopener noreferrer nofollow">Klik hier</a> om de instructies te bekijken en uw app bij te werken.'
|
||||||
|
your_pro_subscription_includes_count_user_seats_but_there_are_users_active_users_in_your_account_html:
|
||||||
|
one: 'Uw Pro-abonnement omvat <b>%{count}</b> gebruikersplaats, maar er zijn <b>%{users}</b> actieve gebruikers in uw account.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Upgrade</a> uw abonnement naar <b>%{users}</b> gebruikers of verwijder inactieve gebruikers via de <a href="%{settings_url}" class="link font-bold">Instellingen</a>.'
|
||||||
|
other: 'Uw Pro-abonnement omvat <b>%{count}</b> gebruikersplaatsen, maar er zijn <b>%{users}</b> actieve gebruikers in uw account.<br><a href="%{upgrade_url}" class="link font-bold" target="_blank" rel="noopener noreferrer nofollow">Upgrade</a> uw abonnement naar <b>%{users}</b> gebruikers of verwijder inactieve gebruikers via de <a href="%{settings_url}" class="link font-bold">Instellingen</a>.'
|
||||||
submission_created_by_email_html: "<b>Inzending aangemaakt</b> door %{email}"
|
submission_created_by_email_html: "<b>Inzending aangemaakt</b> door %{email}"
|
||||||
submission_created_by_email_via_source_html: "<b>Inzending aangemaakt</b> door %{email} via %{source}"
|
submission_created_by_email_via_source_html: "<b>Inzending aangemaakt</b> door %{email} via %{source}"
|
||||||
submission_created_via_source_html: "<b>Inzending aangemaakt</b> via %{source}"
|
submission_created_via_source_html: "<b>Inzending aangemaakt</b> via %{source}"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ module ReplaceEmailVariables
|
|||||||
SUBMISSION_LINK = /\{+submission\.link\}+/i
|
SUBMISSION_LINK = /\{+submission\.link\}+/i
|
||||||
SUBMISSION_ID = /\{+submission\.id\}+/i
|
SUBMISSION_ID = /\{+submission\.id\}+/i
|
||||||
SUBMISSION_EXPIRE_AT = /\{+submission\.expire_at\}+/i
|
SUBMISSION_EXPIRE_AT = /\{+submission\.expire_at\}+/i
|
||||||
|
SUBMISSION_VARIABLE = /\{+submission\.(?<variable_name>[^}]+)\}+/i
|
||||||
SUBMITTERS = /\{+(?:submission\.)?submitters\}+/i
|
SUBMITTERS = /\{+(?:submission\.)?submitters\}+/i
|
||||||
SUBMITTERS_N_EMAIL = /\{+submitters\[(?<index>\d+)\]\.email\}+/i
|
SUBMITTERS_N_EMAIL = /\{+submitters\[(?<index>\d+)\]\.email\}+/i
|
||||||
SUBMITTERS_N_NAME = /\{+submitters\[(?<index>\d+)\]\.name\}+/i
|
SUBMITTERS_N_NAME = /\{+submitters\[(?<index>\d+)\]\.name\}+/i
|
||||||
@@ -65,6 +66,10 @@ module ReplaceEmailVariables
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
text = replace(text, SUBMISSION_VARIABLE, html_escape:) do |match|
|
||||||
|
build_submission_variable(submitter.submission, match[:variable_name].to_s.strip)
|
||||||
|
end
|
||||||
|
|
||||||
text = replace(text, SUBMITTERS_N_NAME, html_escape:) do |match|
|
text = replace(text, SUBMITTERS_N_NAME, html_escape:) do |match|
|
||||||
build_submitters_n_field(submitter.submission, match[:index].to_i - 1, :name)
|
build_submitters_n_field(submitter.submission, match[:index].to_i - 1, :name)
|
||||||
end
|
end
|
||||||
@@ -103,6 +108,12 @@ module ReplaceEmailVariables
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def build_submission_variable(submission, variable_name)
|
||||||
|
variable_name.split('.').reduce(submission.variables) do |value, key|
|
||||||
|
value[key] if value.is_a?(Hash)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def build_submitters_n_field(submission, index, field_name, value_name = nil)
|
def build_submitters_n_field(submission, index, field_name, value_name = nil)
|
||||||
uuid = (submission.template_submitters || submission.template.submitters).dig(index, 'uuid')
|
uuid = (submission.template_submitters || submission.template.submitters).dig(index, 'uuid')
|
||||||
|
|
||||||
|
|||||||
@@ -459,7 +459,9 @@ module Submissions
|
|||||||
|
|
||||||
def assign_completed_attributes(submitter, with_verification: true)
|
def assign_completed_attributes(submitter, with_verification: true)
|
||||||
submitter.values = Submitters::SubmitValues.merge_default_values(submitter, with_verification:)
|
submitter.values = Submitters::SubmitValues.merge_default_values(submitter, with_verification:)
|
||||||
submitter.values = Submitters::SubmitValues.maybe_remove_condition_values(submitter)
|
submitter.values = Submitters::SubmitValues.maybe_remove_condition_values(
|
||||||
|
submitter, formula_values: Submitters::SubmitValues.build_formula_values(submitter)
|
||||||
|
)
|
||||||
|
|
||||||
formula_values = Submitters::SubmitValues.build_formula_values(submitter)
|
formula_values = Submitters::SubmitValues.build_formula_values(submitter)
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ module Submissions
|
|||||||
document.metadata['sha256'] || document.checksum,
|
document.metadata['sha256'] || document.checksum,
|
||||||
"\n",
|
"\n",
|
||||||
{ text: "#{I18n.t('generated_at')}: ", font: [FONT_NAME, { variant: :bold }] },
|
{ text: "#{I18n.t('generated_at')}: ", font: [FONT_NAME, { variant: :bold }] },
|
||||||
"#{I18n.l(document.created_at.in_time_zone(timezone), format: :long, locale: account.locale)} " \
|
"#{I18n.l(document.created_at.in_time_zone(timezone), format: :long)} " \
|
||||||
"#{TimeUtils.timezone_abbr(timezone, document.created_at)}"
|
"#{TimeUtils.timezone_abbr(timezone, document.created_at)}"
|
||||||
], line_spacing: 1.3
|
], line_spacing: 1.3
|
||||||
)
|
)
|
||||||
@@ -440,7 +440,7 @@ module Submissions
|
|||||||
composer.formatted_text_box([{ text: value.to_s.titleize }], padding: [0, 0, 10, 0])
|
composer.formatted_text_box([{ text: value.to_s.titleize }], padding: [0, 0, 10, 0])
|
||||||
else
|
else
|
||||||
if field['type'] == 'date'
|
if field['type'] == 'date'
|
||||||
value = TimeUtils.format_date_string(value, field.dig('preferences', 'format'), account.locale,
|
value = TimeUtils.format_date_string(value, field.dig('preferences', 'format'), I18n.locale,
|
||||||
timezone:)
|
timezone:)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -533,7 +533,7 @@ module Submissions
|
|||||||
time_format = with_timestamp_seconds ? :detailed : :long
|
time_format = with_timestamp_seconds ? :detailed : :long
|
||||||
|
|
||||||
[
|
[
|
||||||
"#{I18n.l(event.event_timestamp.in_time_zone(timezone), format: time_format, locale: account.locale)} " \
|
"#{I18n.l(event.event_timestamp.in_time_zone(timezone), format: time_format)} " \
|
||||||
"#{TimeUtils.timezone_abbr(timezone, event.event_timestamp)}",
|
"#{TimeUtils.timezone_abbr(timezone, event.event_timestamp)}",
|
||||||
composer.document.layout.formatted_text_box(text_box)
|
composer.document.layout.formatted_text_box(text_box)
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -75,13 +75,14 @@ module Submitters
|
|||||||
submitter.completed_at = Time.current
|
submitter.completed_at = Time.current
|
||||||
submitter.ip = request.remote_ip
|
submitter.ip = request.remote_ip
|
||||||
submitter.ua = request.user_agent
|
submitter.ua = request.user_agent
|
||||||
submitter.timezone = request.params[:timezone]
|
submitter.timezone = request.params[:timezone] if ActiveSupport::TimeZone[request.params[:timezone].to_s]
|
||||||
|
|
||||||
submitter.values = merge_default_values(submitter)
|
submitter.values = merge_default_values(submitter)
|
||||||
|
|
||||||
required_field_uuids_acc = Set.new
|
required_field_uuids_acc = Set.new
|
||||||
|
|
||||||
submitter.values = maybe_remove_condition_values(submitter, required_field_uuids_acc:)
|
submitter.values = maybe_remove_condition_values(submitter, formula_values: build_formula_values(submitter),
|
||||||
|
required_field_uuids_acc:)
|
||||||
|
|
||||||
formula_values = build_formula_values(submitter)
|
formula_values = build_formula_values(submitter)
|
||||||
|
|
||||||
@@ -204,10 +205,10 @@ module Submitters
|
|||||||
default_values.compact_blank.merge(submitter.values)
|
default_values.compact_blank.merge(submitter.values)
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_formula_values(submitter)
|
def build_formula_values(submitter, submission_values: nil)
|
||||||
submission_values = nil
|
submission = submitter.submission
|
||||||
|
|
||||||
computed_values = submitter.submission.template_fields.each_with_object({}) do |field, acc|
|
computed_values = (submission.template_fields || submission.template.fields).each_with_object({}) do |field, acc|
|
||||||
next if field['submitter_uuid'] != submitter.uuid
|
next if field['submitter_uuid'] != submitter.uuid
|
||||||
next if field['type'] == 'payment'
|
next if field['type'] == 'payment'
|
||||||
|
|
||||||
@@ -297,17 +298,17 @@ module Submitters
|
|||||||
field:)
|
field:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def maybe_remove_condition_values(submitter, required_field_uuids_acc: nil)
|
def maybe_remove_condition_values(submitter, formula_values: {}, required_field_uuids_acc: nil)
|
||||||
submission = submitter.submission
|
submission = submitter.submission
|
||||||
|
|
||||||
submitters_values = nil
|
submitters_values = formula_values.merge(merge_submitters_values(submitter)) if formula_values.present?
|
||||||
has_other_submitters = submission.template_submitters.size > 1
|
has_other_submitters = submission.template_submitters.size > 1
|
||||||
|
|
||||||
has_document_conditions = submission_has_document_conditions?(submission)
|
has_document_conditions = submission_has_document_conditions?(submission)
|
||||||
|
|
||||||
attachments_index =
|
attachments_index =
|
||||||
if has_document_conditions
|
if has_document_conditions
|
||||||
submitters_values = merge_submitters_values(submitter)
|
submitters_values ||= merge_submitters_values(submitter)
|
||||||
|
|
||||||
Submissions.filtered_conditions_schema(submission, values: submitters_values)
|
Submissions.filtered_conditions_schema(submission, values: submitters_values)
|
||||||
.index_by { |i| i['attachment_uuid'] }
|
.index_by { |i| i['attachment_uuid'] }
|
||||||
|
|||||||
@@ -100,13 +100,15 @@ module Templates
|
|||||||
Zip::File.open(file.tempfile).each do |entry|
|
Zip::File.open(file.tempfile).each do |entry|
|
||||||
next if entry.directory?
|
next if entry.directory?
|
||||||
|
|
||||||
total_size += entry.size
|
tempfile = Tempfile.new(entry.name)
|
||||||
|
tempfile.binmode
|
||||||
|
|
||||||
|
total_size += entry.get_input_stream do |in_stream|
|
||||||
|
IO.copy_stream(in_stream, tempfile, MAX_ZIP_SIZE - total_size + 1)
|
||||||
|
end
|
||||||
|
|
||||||
raise InvalidFileType, 'zip_too_large' if total_size > MAX_ZIP_SIZE
|
raise InvalidFileType, 'zip_too_large' if total_size > MAX_ZIP_SIZE
|
||||||
|
|
||||||
tempfile = Tempfile.new(entry.name)
|
|
||||||
tempfile.binmode
|
|
||||||
entry.get_input_stream { |in_stream| IO.copy_stream(in_stream, tempfile) }
|
|
||||||
tempfile.rewind
|
tempfile.rewind
|
||||||
|
|
||||||
type = Marcel::MimeType.for(tempfile, name: entry.name)
|
type = Marcel::MimeType.for(tempfile, name: entry.name)
|
||||||
|
|||||||
Reference in new issue
Block a user