Skip to content

Commit 7e5abd1

Browse files
authored
Admin config: added input validation & hide disabled options (#4232)
* Added depend and validate node to system.xml * update
1 parent 2c1626e commit 7e5abd1

File tree

23 files changed

+467
-20
lines changed

23 files changed

+467
-20
lines changed

app/code/core/Mage/Api/etc/system.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<show_in_default>1</show_in_default>
4545
<show_in_website>1</show_in_website>
4646
<show_in_store>1</show_in_store>
47+
<validate>required-entry validate-digits validate-zero-or-greater</validate>
4748
</session_timeout>
4849
<compliance_wsi translate="label">
4950
<label>WS-I Compliance</label>

app/code/core/Mage/Authorizenet/etc/system.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@
4242
<show_in_default>1</show_in_default>
4343
<show_in_website>1</show_in_website>
4444
<show_in_store>0</show_in_store>
45+
<depends><active>1</active></depends>
4546
</payment_action>
4647
<title translate="label">
4748
<label>Title</label>
4849
<sort_order>30</sort_order>
4950
<show_in_default>1</show_in_default>
5051
<show_in_website>1</show_in_website>
5152
<show_in_store>1</show_in_store>
53+
<depends><active>1</active></depends>
5254
</title>
5355
<login translate="label">
5456
<label>API Login ID</label>
@@ -58,6 +60,7 @@
5860
<show_in_default>1</show_in_default>
5961
<show_in_website>1</show_in_website>
6062
<show_in_store>0</show_in_store>
63+
<depends><active>1</active></depends>
6164
</login>
6265
<trans_key translate="label">
6366
<label>Transaction Key</label>
@@ -67,6 +70,7 @@
6770
<show_in_default>1</show_in_default>
6871
<show_in_website>1</show_in_website>
6972
<show_in_store>0</show_in_store>
73+
<depends><active>1</active></depends>
7074
</trans_key>
7175
<signature_key translate="label">
7276
<label>Signature Key</label>
@@ -76,6 +80,7 @@
7680
<show_in_default>1</show_in_default>
7781
<show_in_website>1</show_in_website>
7882
<show_in_store>0</show_in_store>
83+
<depends><active>1</active></depends>
7984
</signature_key>
8085
<trans_md5 translate="label">
8186
<label>Merchant MD5</label>
@@ -85,6 +90,7 @@
8590
<show_in_default>1</show_in_default>
8691
<show_in_website>1</show_in_website>
8792
<show_in_store>0</show_in_store>
93+
<depends><active>1</active></depends>
8894
</trans_md5>
8995
<order_status translate="label">
9096
<label>New Order Status</label>
@@ -94,6 +100,7 @@
94100
<show_in_default>1</show_in_default>
95101
<show_in_website>1</show_in_website>
96102
<show_in_store>0</show_in_store>
103+
<depends><active>1</active></depends>
97104
</order_status>
98105
<test translate="label">
99106
<label>Test Mode</label>
@@ -103,13 +110,15 @@
103110
<show_in_default>1</show_in_default>
104111
<show_in_website>1</show_in_website>
105112
<show_in_store>0</show_in_store>
113+
<depends><active>1</active></depends>
106114
</test>
107115
<cgi_url translate="label">
108116
<label>Gateway URL</label>
109117
<sort_order>90</sort_order>
110118
<show_in_default>1</show_in_default>
111119
<show_in_website>1</show_in_website>
112120
<show_in_store>0</show_in_store>
121+
<depends><active>1</active></depends>
113122
</cgi_url>
114123
<currency translate="label">
115124
<label>Accepted Currency</label>
@@ -119,6 +128,7 @@
119128
<show_in_default>1</show_in_default>
120129
<show_in_website>1</show_in_website>
121130
<show_in_store>0</show_in_store>
131+
<depends><active>1</active></depends>
122132
</currency>
123133
<debug translate="label">
124134
<label>Debug</label>
@@ -128,6 +138,7 @@
128138
<show_in_default>1</show_in_default>
129139
<show_in_website>1</show_in_website>
130140
<show_in_store>0</show_in_store>
141+
<depends><active>1</active></depends>
131142
</debug>
132143
<email_customer translate="label">
133144
<label>Email Customer</label>
@@ -137,6 +148,7 @@
137148
<show_in_default>1</show_in_default>
138149
<show_in_website>1</show_in_website>
139150
<show_in_store>0</show_in_store>
151+
<depends><active>1</active></depends>
140152
</email_customer>
141153
<merchant_email translate="label">
142154
<label>Merchant's Email</label>
@@ -145,6 +157,7 @@
145157
<show_in_default>1</show_in_default>
146158
<show_in_website>1</show_in_website>
147159
<show_in_store>0</show_in_store>
160+
<depends><active>1</active></depends>
148161
</merchant_email>
149162
<cctypes translate="label">
150163
<label>Credit Card Types</label>
@@ -154,6 +167,7 @@
154167
<show_in_default>1</show_in_default>
155168
<show_in_website>1</show_in_website>
156169
<show_in_store>0</show_in_store>
170+
<depends><active>1</active></depends>
157171
</cctypes>
158172
<useccv translate="label">
159173
<label>Credit Card Verification</label>
@@ -163,6 +177,7 @@
163177
<show_in_default>1</show_in_default>
164178
<show_in_website>1</show_in_website>
165179
<show_in_store>0</show_in_store>
180+
<depends><active>1</active></depends>
166181
</useccv>
167182
<allowspecific translate="label">
168183
<label>Payment from Applicable Countries</label>
@@ -172,6 +187,7 @@
172187
<show_in_default>1</show_in_default>
173188
<show_in_website>1</show_in_website>
174189
<show_in_store>0</show_in_store>
190+
<depends><active>1</active></depends>
175191
</allowspecific>
176192
<specificcountry translate="label">
177193
<label>Payment from Specific Countries</label>
@@ -181,20 +197,23 @@
181197
<show_in_default>1</show_in_default>
182198
<show_in_website>1</show_in_website>
183199
<show_in_store>0</show_in_store>
200+
<depends><active>1</active></depends>
184201
</specificcountry>
185202
<min_order_total translate="label">
186203
<label>Minimum Order Total</label>
187204
<sort_order>180</sort_order>
188205
<show_in_default>1</show_in_default>
189206
<show_in_website>1</show_in_website>
190207
<show_in_store>0</show_in_store>
208+
<depends><active>1</active></depends>
191209
</min_order_total>
192210
<max_order_total translate="label">
193211
<label>Maximum Order Total</label>
194212
<sort_order>190</sort_order>
195213
<show_in_default>1</show_in_default>
196214
<show_in_website>1</show_in_website>
197215
<show_in_store>0</show_in_store>
216+
<depends><active>1</active></depends>
198217
</max_order_total>
199218
<sort_order translate="label">
200219
<label>Sort Order</label>
@@ -203,6 +222,7 @@
203222
<show_in_website>1</show_in_website>
204223
<show_in_store>0</show_in_store>
205224
<frontend_class>validate-number</frontend_class>
225+
<depends><active>1</active></depends>
206226
</sort_order>
207227
</fields>
208228
</authorizenet_directpost>

app/code/core/Mage/Catalog/etc/system.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
<show_in_default>1</show_in_default>
165165
<show_in_website>1</show_in_website>
166166
<show_in_store>1</show_in_store>
167+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
167168
</lines_perpage>
168169
</fields>
169170
</sitemap>
@@ -181,6 +182,7 @@
181182
<show_in_default>1</show_in_default>
182183
<show_in_website>1</show_in_website>
183184
<show_in_store>1</show_in_store>
185+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
184186
</base_width>
185187
<small_width translate="label comment">
186188
<label>Small Image Width</label>
@@ -189,6 +191,7 @@
189191
<show_in_default>1</show_in_default>
190192
<show_in_website>1</show_in_website>
191193
<show_in_store>1</show_in_store>
194+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
192195
</small_width>
193196
<max_dimension translate="label comment">
194197
<label>Maximum resolution for upload image</label>
@@ -197,13 +200,15 @@
197200
<show_in_default>1</show_in_default>
198201
<show_in_website>1</show_in_website>
199202
<show_in_store>1</show_in_store>
203+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
200204
</max_dimension>
201205
<progressive_threshold translate="label comment">
202206
<label>Enable Progressive Images Threshold</label>
203207
<comment>Minimum size in megapixel for progressive JPEG resize</comment>
204208
<validate>validate-number</validate>
205209
<sort_order>40</sort_order>
206210
<show_in_default>1</show_in_default>
211+
<validate>validate-digits validate-greater-than-zero</validate>
207212
</progressive_threshold>
208213
</fields>
209214
</product_image>
@@ -400,6 +405,7 @@
400405
<label>Maximal Depth</label>
401406
<sort_order>1</sort_order>
402407
<show_in_default>1</show_in_default>
408+
<frontend_class>validate-digits</frontend_class>
403409
</max_depth>
404410
</fields>
405411
</navigation>
@@ -427,6 +433,7 @@
427433
<show_in_default>1</show_in_default>
428434
<show_in_website>1</show_in_website>
429435
<show_in_store>1</show_in_store>
436+
<depends><use_calendar>1</use_calendar></depends>
430437
</date_fields_order>
431438
<time_format translate="label">
432439
<label>Time Format</label>
@@ -436,6 +443,7 @@
436443
<show_in_default>1</show_in_default>
437444
<show_in_website>1</show_in_website>
438445
<show_in_store>1</show_in_store>
446+
<depends><use_calendar>1</use_calendar></depends>
439447
</time_format>
440448
<year_range translate="label comment">
441449
<label>Year Range</label>
@@ -445,6 +453,7 @@
445453
<show_in_default>1</show_in_default>
446454
<show_in_website>1</show_in_website>
447455
<show_in_store>1</show_in_store>
456+
<depends><use_calendar>1</use_calendar></depends>
448457
</year_range>
449458
</fields>
450459
</custom_options>
@@ -563,6 +572,7 @@
563572
<show_in_website>1</show_in_website>
564573
<show_in_store>0</show_in_store>
565574
<comment><![CDATA[<strong style="color:red">Warning!</strong> Applying MAP by default will hide all product prices on the frontend.]]></comment>
575+
<depends><enabled>1</enabled></depends>
566576
</apply_for_all>
567577
<display_price_type translate="label">
568578
<label>Display Actual Price</label>
@@ -572,6 +582,7 @@
572582
<show_in_default>1</show_in_default>
573583
<show_in_website>1</show_in_website>
574584
<show_in_store>0</show_in_store>
585+
<depends><enabled>1</enabled></depends>
575586
</display_price_type>
576587
<explanation_message translate="label">
577588
<label>Default Popup Text Message</label>
@@ -580,6 +591,7 @@
580591
<show_in_default>1</show_in_default>
581592
<show_in_website>1</show_in_website>
582593
<show_in_store>1</show_in_store>
594+
<depends><enabled>1</enabled></depends>
583595
</explanation_message>
584596
<explanation_message_whats_this translate="label">
585597
<label>Default "What's This" Text Message</label>
@@ -588,6 +600,7 @@
588600
<show_in_default>1</show_in_default>
589601
<show_in_website>1</show_in_website>
590602
<show_in_store>1</show_in_store>
603+
<depends><enabled>1</enabled></depends>
591604
</explanation_message_whats_this>
592605
</fields>
593606
</msrp>

app/code/core/Mage/Checkout/etc/system.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@
157157
<show_in_default>1</show_in_default>
158158
<show_in_website>1</show_in_website>
159159
<show_in_store>1</show_in_store>
160+
<depends><display>1</display></depends>
160161
</count>
161162
</fields>
162163
</sidebar>

app/code/core/Mage/ConfigurableSwatches/etc/system.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<show_in_website>1</show_in_website>
5151
<show_in_store>1</show_in_store>
5252
<can_be_empty>1</can_be_empty>
53+
<depends><enabled>1</enabled></depends>
5354
</swatch_attributes>
5455
<product_list_attribute translate="label">
5556
<label>Product Attribute to Use for Swatches in Product Listing</label>
@@ -59,6 +60,7 @@
5960
<show_in_default>1</show_in_default>
6061
<show_in_website>1</show_in_website>
6162
<show_in_store>1</show_in_store>
63+
<depends><enabled>1</enabled></depends>
6264
</product_list_attribute>
6365
<product_list_price_change translate="label" module="configurableswatches">
6466
<label>Dynamic Price Change for Swatches in Product Listing</label>
@@ -68,6 +70,7 @@
6870
<show_in_default>1</show_in_default>
6971
<show_in_website>1</show_in_website>
7072
<show_in_store>1</show_in_store>
73+
<depends><enabled>1</enabled></depends>
7174
</product_list_price_change>
7275
</fields>
7376
</general>
@@ -85,13 +88,15 @@
8588
<show_in_default>1</show_in_default>
8689
<show_in_website>1</show_in_website>
8790
<show_in_store>1</show_in_store>
91+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
8892
</width>
8993
<height translate="label">
9094
<label>Height</label>
9195
<sort_order>20</sort_order>
9296
<show_in_default>1</show_in_default>
9397
<show_in_website>1</show_in_website>
9498
<show_in_store>1</show_in_store>
99+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
95100
</height>
96101
</fields>
97102
</product_detail_dimensions>
@@ -109,13 +114,15 @@
109114
<show_in_default>1</show_in_default>
110115
<show_in_website>1</show_in_website>
111116
<show_in_store>1</show_in_store>
117+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
112118
</width>
113119
<height translate="label">
114120
<label>Height</label>
115121
<sort_order>20</sort_order>
116122
<show_in_default>1</show_in_default>
117123
<show_in_website>1</show_in_website>
118124
<show_in_store>1</show_in_store>
125+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
119126
</height>
120127
</fields>
121128
</product_listing_dimensions>
@@ -133,13 +140,15 @@
133140
<show_in_default>1</show_in_default>
134141
<show_in_website>1</show_in_website>
135142
<show_in_store>1</show_in_store>
143+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
136144
</width>
137145
<height translate="label">
138146
<label>Height</label>
139147
<sort_order>20</sort_order>
140148
<show_in_default>1</show_in_default>
141149
<show_in_website>1</show_in_website>
142150
<show_in_store>1</show_in_store>
151+
<validate>required-entry validate-digits validate-greater-than-zero</validate>
143152
</height>
144153
</fields>
145154
</layered_nav_dimensions>

app/code/core/Mage/Contacts/etc/system.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
<show_in_default>1</show_in_default>
104104
<show_in_website>1</show_in_website>
105105
<show_in_store>1</show_in_store>
106+
<depends><enabled>1</enabled></depends>
106107
</email_template>
107108
</fields>
108109
</auto_reply>

0 commit comments

Comments
 (0)