Skip to content

Commit d862278

Browse files
committed
Fix #6900 "Springfield PTA Remittance Form: some PDF template fields are not filled"
- regressed with #6707
1 parent 7e95d73 commit d862278

File tree

6 files changed

+110
-58
lines changed

6 files changed

+110
-58
lines changed

form-runner/jvm/src/main/resources/apps/fr/components/controls.xsl

+80-35
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@
6666
]
6767
)">
6868
<fr:date>
69-
<xsl:if test="$is-static-readonly and ($is-pdf-mode or not($date-native-picker = 'always'))">
70-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
71-
</xsl:if>
69+
<xsl:choose>
70+
<xsl:when test="$is-static-readonly and ($is-pdf-mode or not($date-native-picker = 'always'))">
71+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
72+
</xsl:when>
73+
<xsl:when test="$use-pdf-template">
74+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
75+
</xsl:when>
76+
</xsl:choose>
7277
<xsl:apply-templates select="@* | node()" mode="#current"/>
7378
<!-- See other comment further "Q: Do we really need this?" -->
7479
<xsl:if test="empty(xf:alert)">
@@ -84,9 +89,14 @@
8489
]
8590
)">
8691
<fr:time>
87-
<xsl:if test="$is-static-readonly and ($is-pdf-mode or not($time-native-picker = 'always'))">
88-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
89-
</xsl:if>
92+
<xsl:choose>
93+
<xsl:when test="$is-static-readonly and ($is-pdf-mode or not($time-native-picker = 'always'))">
94+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
95+
</xsl:when>
96+
<xsl:when test="$use-pdf-template">
97+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
98+
</xsl:when>
99+
</xsl:choose>
90100
<xsl:apply-templates select="@* | node()" mode="#current"/>
91101
<!-- See other comment further "Q: Do we really need this?" -->
92102
<xsl:if test="empty(xf:alert)">
@@ -109,9 +119,14 @@
109119
mode="within-grid">
110120
<!-- For now this only applies to controls that have an `xf:select1` binding -->
111121
<xsl:element name="xf:select1">
112-
<xsl:if test="$is-static-readonly">
113-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
114-
</xsl:if>
122+
<xsl:choose>
123+
<xsl:when test="$is-static-readonly">
124+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
125+
</xsl:when>
126+
<xsl:when test="$use-pdf-template">
127+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
128+
</xsl:when>
129+
</xsl:choose>
115130
<xsl:apply-templates select="@* except (@appearance, @fr:pdf-appearance)" mode="#current"/>
116131
<xsl:attribute name="appearance" select="(@fr:pdf-appearance, map:get($select1-pdf-appearances, fr:direct-name-for-select1-element(.)))[1]"/>
117132
<xsl:apply-templates select="node()" mode="#current"/>
@@ -146,9 +161,14 @@
146161
<xsl:choose>
147162
<xsl:when test="frf:controlNameFromId(@id) = $choice-validation-selection-control-names">
148163
<xsl:copy>
149-
<xsl:if test="$is-static-readonly">
150-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
151-
</xsl:if>
164+
<xsl:choose>
165+
<xsl:when test="$is-static-readonly">
166+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
167+
</xsl:when>
168+
<xsl:when test="$use-pdf-template">
169+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
170+
</xsl:when>
171+
</xsl:choose>
152172
<xsl:apply-templates select="@* | node()" mode="#current"/>
153173
<xf:alert
154174
ref="
@@ -201,9 +221,14 @@
201221
match="xf:output[exists(xf:label) and empty(@appearance)]"
202222
mode="within-grid">
203223
<xsl:copy>
204-
<xsl:if test="$is-static-readonly">
205-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
206-
</xsl:if>
224+
<xsl:choose>
225+
<xsl:when test="$is-static-readonly">
226+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
227+
</xsl:when>
228+
<xsl:when test="$use-pdf-template">
229+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
230+
</xsl:when>
231+
</xsl:choose>
207232
<xsl:for-each select="$calculated-value-appearance[. != 'full']"><!-- `full` is the default so don't bother adding the attribute in this case -->
208233
<xsl:attribute name="appearance" select="."/>
209234
</xsl:for-each>
@@ -217,9 +242,14 @@
217242
mode="within-grid">
218243
<xsl:param name="library-name" as="xs:string?" tunnel="yes"/>
219244
<xsl:copy>
220-
<xsl:if test="$is-static-readonly">
221-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
222-
</xsl:if>
245+
<xsl:choose>
246+
<xsl:when test="$is-static-readonly">
247+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
248+
</xsl:when>
249+
<xsl:when test="$use-pdf-template">
250+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
251+
</xsl:when>
252+
</xsl:choose>
223253
<xsl:for-each select="@prefix | @suffix">
224254
<xsl:attribute name="{name(.)}" select="frf:replaceVarReferencesWithFunctionCallsFromString(., ., true(), $library-name, ())"/>
225255
</xsl:for-each>
@@ -233,9 +263,14 @@
233263
mode="within-grid">
234264
<xsl:param name="library-name" as="xs:string?" tunnel="yes"/>
235265
<xsl:copy>
236-
<xsl:if test="$is-static-readonly">
237-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
238-
</xsl:if>
266+
<xsl:choose>
267+
<xsl:when test="$is-static-readonly">
268+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
269+
</xsl:when>
270+
<xsl:when test="$use-pdf-template">
271+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
272+
</xsl:when>
273+
</xsl:choose>
239274
<xsl:if test="exists(@resource | @selection)">
240275
<!-- As calls below can generate `frf:controlVariableValue()` -->
241276
<xsl:namespace name="frf" select="'java:org.orbeon.oxf.fr.FormRunner'"/>
@@ -357,19 +392,24 @@
357392
match="*[parent::fr:c or parent::xh:td]"
358393
priority="-10">
359394
<xsl:copy>
360-
<xsl:if test="
361-
$is-static-readonly and (
362-
$is-pdf-mode or (
363-
(: `view` mode :)
364-
not(
365-
(exists(self::fr:date) and (@native-picker/string(), $date-native-picker)[1] = 'always') or
366-
(exists(self::fr:time) and (@native-picker/string(), $time-native-picker)[1] = 'always')
395+
<xsl:choose>
396+
<xsl:when test="
397+
$is-static-readonly and (
398+
$is-pdf-mode or (
399+
(: `view` mode :)
400+
not(
401+
(exists(self::fr:date) and (@native-picker/string(), $date-native-picker)[1] = 'always') or
402+
(exists(self::fr:time) and (@native-picker/string(), $time-native-picker)[1] = 'always')
403+
)
367404
)
368405
)
369-
)
370-
">
371-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
372-
</xsl:if>
406+
">
407+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
408+
</xsl:when>
409+
<xsl:when test="$use-pdf-template">
410+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
411+
</xsl:when>
412+
</xsl:choose>
373413
<xsl:apply-templates select="@* | node()" mode="#current"/>
374414
</xsl:copy>
375415
</xsl:template>
@@ -382,9 +422,14 @@
382422
match="xf:*[local-name() = ('input', 'textarea', 'select', 'select1', 'upload', 'secret') and not(xf:alert)]"
383423
priority="-20">
384424
<xsl:copy>
385-
<xsl:if test="$is-static-readonly">
386-
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
387-
</xsl:if>
425+
<xsl:choose>
426+
<xsl:when test="$is-static-readonly">
427+
<xsl:attribute name="fr:static-readonly">true</xsl:attribute>
428+
</xsl:when>
429+
<xsl:when test="$use-pdf-template">
430+
<xsl:attribute name="fr:pdf-template">true</xsl:attribute>
431+
</xsl:when>
432+
</xsl:choose>
388433
<xsl:apply-templates select="@* | node()" mode="#current"/>
389434
<xf:alert ref="xxf:r('detail.labels.alert', '|fr-fr-resources|')"/>
390435
</xsl:copy>

form-runner/jvm/src/main/resources/xbl/orbeon/date/date.xbl

+1
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@
442442
id="fr-date-output"
443443
element="
444444
fr|date[fr|static-readonly = true],
445+
fr|date[fr|pdf-template = true],
445446
fr|dropdown-date[fr|static-readonly = true],
446447
fr|fields-date[fr|static-readonly = true]"
447448
xxbl:mode="lhha binding value"

form-runner/jvm/src/main/resources/xbl/orbeon/datetime/datetime.xbl

+3-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@
215215

216216
<xbl:binding
217217
id="fr-datetime-output"
218-
element="fr|datetime[fr|static-readonly = true]"
218+
element="
219+
fr|datetime[fr|static-readonly = true]
220+
fr|datetime[fr|pdf-template = true]"
219221
xxbl:mode="lhha binding value"
220222
xxbl:label-for="input">
221223
<xbl:template>

form-runner/jvm/src/main/resources/xbl/orbeon/number/number.xbl

+3-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,9 @@
460460
id="fr-number-output"
461461
element="
462462
fr|number[fr|static-readonly = true],
463-
fr|currency[fr|static-readonly = true]"
463+
fr|currency[fr|static-readonly = true],
464+
fr|number[fr|pdf-template = true],
465+
fr|currency[fr|pdf-template = true]"
464466
xxbl:mode="lhha binding value allow-minimal-label-hint"
465467
xxbl:label-for="input"
466468
xxbl:format="

form-runner/jvm/src/main/resources/xbl/orbeon/time/time.xbl

+3-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,9 @@
386386

387387
<xbl:binding
388388
id="fr-time-output"
389-
element="fr|time[fr|static-readonly = true]"
389+
element="
390+
fr|time[fr|static-readonly = true],
391+
fr|time[fr|pdf-template = true]"
390392
xxbl:mode="lhha binding value"
391393
xxbl:label-for="input"
392394
>

form-runner/jvm/src/test/resources/org/orbeon/oxf/fr/tests-form-unrolling.xml

+20-20
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
description="Form Runner Form Unrolling: Updates to Form Controls"
66
>
7-
<test description="Don't annotate with `static-readonly` in `edit` mode" name="oxf:pipeline">
7+
<test description="Don't annotate with `fr:static-readonly` in `edit` mode" name="oxf:pipeline">
88
<input name="data">
99
<_>
1010
<method>GET</method>
@@ -34,7 +34,7 @@
3434
</output>
3535
</test>
3636

37-
<test description="Annotate with `static-readonly` in `view` mode, except when native picker is used" name="oxf:pipeline">
37+
<test description="Annotate with `fr:static-readonly` in `view` mode, except when native picker is used" name="oxf:pipeline">
3838
<input name="data">
3939
<_>
4040
<method>GET</method>
@@ -64,7 +64,7 @@
6464
</output>
6565
</test>
6666

67-
<test description="Don't annotate with `static-readonly` and `appearance='full'` in `pdf` mode with PDF template" name="oxf:pipeline">
67+
<test description="Annotate with `fr:pdf-template` in `pdf` mode with PDF template" name="oxf:pipeline">
6868
<input name="data">
6969
<_>
7070
<method>GET</method>
@@ -74,27 +74,27 @@
7474
<input name="config" href="unrolling/unroll.xpl"/>
7575
<output name="data">
7676
<_ xmlns:xf="http://www.w3.org/2002/xforms">
77-
<fr:date id="date-us-control" bind="date-us-bind" output-format="[M]/[D]/[Y]" field-width="natural"/>
78-
<fr:time bind="time-bind" id="time-control" field-width="natural" output-format="[h]:[m]:[s] [P,2-2]"/>
79-
<fr:datetime bind="datetime-bind" id="datetime-control" field-width="natural"/>
80-
<fr:dropdown-date bind="dropdown-date-bind" id="dropdown-date-control"/>
81-
<fr:fields-date bind="fields-date-bind" id="fields-date-control"/>
82-
<fr:date bind="native-date-bind" id="native-date-control" ref="" native-picker="always"/>
83-
<fr:time id="native-time-control" bind="native-time-bind" native-picker="always" output-format="[h]:[m]:[s] [P,2-2]"/>
84-
<fr:number suffix="m/s" id="number-with-suffix-control" digits-after-decimal="0" bind="number-with-suffix-bind"/>
85-
<fr:currency bind="currency-bind" id="currency-control"/>
86-
<fr:currency prefix="CHF" bind="currency-with-prefix-bind" id="currency-with-prefix-control"/>
87-
<xf:select1 bind="dropdown-pdf-radio-buttons-bind" id="dropdown-pdf-radio-buttons-control" ref="" appearance="dropdown" fr:pdf-appearance="full"/>
88-
<xf:select1 bind="dropdown-pdf-value-bind" id="dropdown-pdf-value-control" ref="" appearance="dropdown" fr:pdf-appearance="dropdown"/>
89-
<fr:databound-select1 resource="/fr/service/custom/orbeon/controls/countries?all=true" id="dynamic-dropdown-control" bind="dynamic-dropdown-bind"/>
90-
<xf:output bind="calculated-value-bind" id="calculated-value-control"/>
91-
<xf:output bind="calculated-value-borderless-bind" id="calculated-value-borderless-control" appearance="minimal"/>
92-
<xf:output bind="calculated-value-clipboard-bind" id="calculated-value-clipboard-control" appearance="clipboard-copy"/>
77+
<fr:date fr:pdf-template="true" id="date-us-control" bind="date-us-bind" output-format="[M]/[D]/[Y]" field-width="natural"/>
78+
<fr:time fr:pdf-template="true" bind="time-bind" id="time-control" field-width="natural" output-format="[h]:[m]:[s] [P,2-2]"/>
79+
<fr:datetime fr:pdf-template="true" bind="datetime-bind" id="datetime-control" field-width="natural"/>
80+
<fr:dropdown-date fr:pdf-template="true" bind="dropdown-date-bind" id="dropdown-date-control"/>
81+
<fr:fields-date fr:pdf-template="true" bind="fields-date-bind" id="fields-date-control"/>
82+
<fr:date fr:pdf-template="true" bind="native-date-bind" id="native-date-control" ref="" native-picker="always"/>
83+
<fr:time fr:pdf-template="true" id="native-time-control" bind="native-time-bind" native-picker="always" output-format="[h]:[m]:[s] [P,2-2]"/>
84+
<fr:number fr:pdf-template="true" suffix="m/s" id="number-with-suffix-control" digits-after-decimal="0" bind="number-with-suffix-bind"/>
85+
<fr:currency fr:pdf-template="true" bind="currency-bind" id="currency-control"/>
86+
<fr:currency fr:pdf-template="true" prefix="CHF" bind="currency-with-prefix-bind" id="currency-with-prefix-control"/>
87+
<xf:select1 fr:pdf-template="true" bind="dropdown-pdf-radio-buttons-bind" id="dropdown-pdf-radio-buttons-control" ref="" appearance="dropdown" fr:pdf-appearance="full"/>
88+
<xf:select1 fr:pdf-template="true" bind="dropdown-pdf-value-bind" id="dropdown-pdf-value-control" ref="" appearance="dropdown" fr:pdf-appearance="dropdown"/>
89+
<fr:databound-select1 fr:pdf-template="true" resource="/fr/service/custom/orbeon/controls/countries?all=true" id="dynamic-dropdown-control" bind="dynamic-dropdown-bind"/>
90+
<xf:output fr:pdf-template="true" bind="calculated-value-bind" id="calculated-value-control"/>
91+
<xf:output fr:pdf-template="true" bind="calculated-value-borderless-bind" id="calculated-value-borderless-control" appearance="minimal"/>
92+
<xf:output fr:pdf-template="true" bind="calculated-value-clipboard-bind" id="calculated-value-clipboard-control" appearance="clipboard-copy"/>
9393
</_>
9494
</output>
9595
</test>
9696

97-
<test description="Annotate with `static-readonly` and `appearance='full'` in `pdf` mode with `fr-use-pdf-template=false" name="oxf:pipeline">
97+
<test description="Annotate with `fr:static-readonly` and `appearance='full'` in `pdf` mode with `fr-use-pdf-template=false" name="oxf:pipeline">
9898
<input name="data">
9999
<_>
100100
<method>POST</method>

0 commit comments

Comments
 (0)