Skip to content

Commit 5f43b78

Browse files
MAGETWO-47553: Customer account info form is broken if middle name attribute is visible
1 parent 644e60d commit 5f43b78

File tree

7 files changed

+65
-26
lines changed

7 files changed

+65
-26
lines changed

app/code/Magento/Customer/Setup/CustomerSetup.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function getDefaultEntities()
166166
],
167167
'prefix' => [
168168
'type' => 'static',
169-
'label' => 'Prefix',
169+
'label' => 'Name Prefix',
170170
'input' => 'text',
171171
'required' => false,
172172
'sort_order' => 30,
@@ -202,7 +202,7 @@ public function getDefaultEntities()
202202
],
203203
'suffix' => [
204204
'type' => 'static',
205-
'label' => 'Suffix',
205+
'label' => 'Name Suffix',
206206
'input' => 'text',
207207
'required' => false,
208208
'sort_order' => 70,
@@ -350,7 +350,7 @@ public function getDefaultEntities()
350350
'attributes' => [
351351
'prefix' => [
352352
'type' => 'static',
353-
'label' => 'Prefix',
353+
'label' => 'Name Prefix',
354354
'input' => 'text',
355355
'required' => false,
356356
'sort_order' => 10,
@@ -386,7 +386,7 @@ public function getDefaultEntities()
386386
],
387387
'suffix' => [
388388
'type' => 'static',
389-
'label' => 'Suffix',
389+
'label' => 'Name Suffix',
390390
'input' => 'text',
391391
'required' => false,
392392
'sort_order' => 50,

app/code/Magento/Customer/Setup/InstallSchema.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
100100
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
101101
40,
102102
['nullable' => true, 'default' => null],
103-
'Prefix'
103+
'Name Prefix'
104104
)->addColumn(
105105
'firstname',
106106
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -124,7 +124,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
124124
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
125125
40,
126126
['nullable' => true, 'default' => null],
127-
'Suffix'
127+
'Name Suffix'
128128
)->addColumn(
129129
'dob',
130130
\Magento\Framework\DB\Ddl\Table::TYPE_DATE,
@@ -308,7 +308,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
308308
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
309309
40,
310310
['nullable' => true, 'default' => null],
311-
'Prefix'
311+
'Name Prefix'
312312
)->addColumn(
313313
'region',
314314
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -332,7 +332,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
332332
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
333333
40,
334334
['nullable' => true, 'default' => null],
335-
'Suffix'
335+
'Name Suffix'
336336
)->addColumn(
337337
'telephone',
338338
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,

app/code/Magento/Customer/Test/Unit/Block/Widget/NameTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class NameTest extends \PHPUnit_Framework_TestCase
4444

4545
const INVALID_ATTRIBUTE_CODE = 'invalid attribute code';
4646

47-
const PREFIX_STORE_LABEL = 'Prefix';
47+
const PREFIX_STORE_LABEL = 'Name Prefix';
4848

4949
/**#@-*/
5050

app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function testSendNewAccountEmailWithoutStoreId()
198198
'firstname' => 'FirstName',
199199
'lastname' => 'LastName',
200200
'middlename' => 'MiddleName',
201-
'prefix' => 'Prefix',
201+
'prefix' => 'Name Prefix',
202202
]);
203203
$this->_model->sendNewAccountEmail('registered');
204204
}

app/design/frontend/Magento/blank/Magento_Customer/web/css/source/_module.less

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,25 @@
8787
}
8888
}
8989

90+
// Full name fieldset
91+
.fieldset {
92+
.fullname {
93+
&.field {
94+
> .label {
95+
&:extend(.abs-visually-hidden all);
96+
97+
+ .control {
98+
width: 100%;
99+
}
100+
}
101+
}
102+
103+
.field {
104+
&:extend(.abs-add-clearfix all);
105+
}
106+
}
107+
}
108+
90109
//
91110
// My account
92111
// ---------------------------------------------
@@ -400,18 +419,23 @@
400419
}
401420
}
402421

403-
.form-create-account {
404-
.fieldset-fullname {
405-
.fields {
406-
.field {
422+
// Full name fieldset
423+
.fieldset {
424+
.fullname {
425+
.field {
426+
.label {
427+
.lib-css(margin, @form-field-type-label-inline__margin);
428+
.lib-css(padding, @form-field-type-label-inline__padding);
429+
.lib-css(text-align, @form-field-type-label-inline__align);
430+
.lib-css(width, @form-field-type-label-inline__width);
431+
box-sizing: border-box;
407432
float: left;
408-
margin: 0 @indent__s @indent__s 0;
409433
}
410-
}
411434

412-
.field-name-prefix,
413-
.field-name-suffix {
414-
width: 50px;
435+
.control {
436+
.lib-css(width, @form-field-type-control-inline__width);
437+
float: left;
438+
}
415439
}
416440
}
417441
}

app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@
9595
}
9696
}
9797

98+
// Full name fieldset
99+
.fieldset {
100+
.fullname {
101+
> .label {
102+
&:extend(.abs-visually-hidden all);
103+
}
104+
}
105+
}
106+
98107
.box-billing-address,
99108
.box-shipping-address,
100109
.box-information,
@@ -349,9 +358,15 @@
349358
.form-create-account {
350359
.fieldset-fullname {
351360
.fields {
361+
display: table;
362+
width: 100%;
363+
352364
.field {
353-
float: left;
354-
margin: 0 @indent__s @indent__s 0;
365+
display: table-cell;
366+
367+
+ .field {
368+
padding-left: @indent__s;
369+
}
355370
}
356371
}
357372

@@ -441,7 +456,7 @@
441456
}
442457

443458
.form-address-edit {
444-
.fieldset {
459+
> .fieldset {
445460
&:extend(.abs-blocks-2columns all);
446461
}
447462
}

dev/tests/integration/testsuite/Magento/Customer/Block/Widget/NameTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function testToHtmlSimpleName()
4848
$this->assertContains('title="Last Name"', $html);
4949
$this->assertContains('value="Doe"', $html);
5050
$this->assertNotContains('title="Middle Name/Initial"', $html);
51-
$this->assertNotContains('title="Prefix"', $html);
52-
$this->assertNotContains('title="Suffix"', $html);
51+
$this->assertNotContains('title="Name Prefix"', $html);
52+
$this->assertNotContains('title="Name Suffix"', $html);
5353
}
5454

5555
/**
@@ -84,9 +84,9 @@ public function testToHtmlFancyName()
8484
$this->assertContains('value="Doe"', $html);
8585
$this->assertContains('title="Middle Name/Initial"', $html);
8686
$this->assertContains('value="Roe"', $html);
87-
$this->assertContains('title="Prefix"', $html);
87+
$this->assertContains('title="Name Prefix"', $html);
8888
$this->assertContains('value="Dr."', $html);
89-
$this->assertContains('title="Suffix"', $html);
89+
$this->assertContains('title="Name Suffix"', $html);
9090
$this->assertContains('value="Ph.D."', $html);
9191
}
9292
}

0 commit comments

Comments
 (0)