Skip to content

Commit b5ab1ee

Browse files
committed
Merge branch 'main_develop' into bugfix2
2 parents 1c08d51 + 10ff4f8 commit b5ab1ee

File tree

41 files changed

+581
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+581
-204
lines changed

app/code/Magento/Authorizenet/view/adminhtml/templates/directpost/info.phtml

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
3535
</label>
3636
<div class="admin__field-control">
3737
<select id="<?php /* @noEscape */ echo $code; ?>_cc_type" name="payment[cc_type]"
38-
class="required-entry validate-cc-type-select admin__control-select">
39-
<option value=""></option>
38+
class="admin__control-select"
39+
data-validate="{
40+
'required':true,
41+
'validate-cc-type-select':'#<?php /* @noEscape */ echo $code; ?>_cc_number'
42+
}">
43+
<option value=""><?php echo $block->escapeHtml(__('Please Select')); ?></option>
4044
<?php foreach ($block->getCcAvailableTypes() as $typeCode => $typeName): ?>
4145
<option value="<?php echo $block->escapeHtml($typeCode); ?>"
4246
<?php if ($typeCode == $ccType): ?>selected="selected"<?php endif; ?>>
@@ -46,27 +50,37 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
4650
</select>
4751
</div>
4852
</div>
53+
4954
<div class="admin__field _required">
5055
<label for="<?php /* @noEscape */ echo $code; ?>_cc_number" class="admin__field-label">
5156
<span><?php echo $block->escapeHtml(__('Credit Card Number')); ?></span>
5257
</label>
53-
5458
<div class="admin__field-control">
5559
<input type="text" id="<?php /* @noEscape */ echo $code; ?>_cc_number"
5660
name="payment[cc_number]"
57-
class="input-text required-entry validate-cc-number admin__control-text"
61+
data-validate="{
62+
'required-number':true,
63+
'validate-cc-number':'#<?php /* @noEscape */ echo $code; ?>_cc_type',
64+
'validate-cc-type':'#<?php /* @noEscape */ echo $code; ?>_cc_type'
65+
}"
66+
class="admin__control-text"
5867
value="<?php /* @noEscape */ echo $block->getInfoData('cc_number'); ?>"/>
5968
</div>
6069
</div>
61-
<div class="admin__field _required">
70+
71+
<div class="admin__field _required field-date" id="<?php /* @noEscape */ echo $code; ?>_cc_type_exp_div">
6272
<label for="<?php /* @noEscape */ echo $code; ?>_expiration" class="admin__field-label">
6373
<span><?php echo $block->escapeHtml(__('Expiration Date')); ?></span>
6474
</label>
6575

6676
<div class="admin__field-control">
6777
<select id="<?php /* @noEscape */ echo $code; ?>_expiration"
6878
name="payment[cc_exp_month]"
69-
class="validate-cc-exp required-entry admin__control-select admin__control-select-month">
79+
class="admin__control-select admin__control-select-month"
80+
data-validate="{
81+
'required':true,
82+
'validate-cc-exp':'#<?php /* @noEscape */ echo $code; ?>_expiration_yr'
83+
}">
7084
<?php foreach ($block->getCcMonths() as $k => $v): ?>
7185
<option value="<?php echo $block->escapeHtml($k); ?>"
7286
<?php if ($k == $ccExpMonth): ?>selected="selected"<?php endif; ?>>
@@ -76,7 +90,9 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
7690
</select>
7791
<select id="<?php /* @noEscape */ echo $code; ?>_expiration_yr"
7892
name="payment[cc_exp_year]"
79-
class="required-entry admin__control-select admin__control-select-year">
93+
class="admin__control-select admin__control-select-year"
94+
data-container="<?php /* @noEscape */ echo $code; ?>-cc-year"
95+
data-validate="{required:true}">
8096
<?php foreach ($block->getCcYears() as $k => $v): ?>
8197
<option value="<?php /* @noEscape */ echo $k ? $block->escapeHtml($k) : ''; ?>"
8298
<?php if ($k == $ccExpYear): ?>selected="selected"<?php endif; ?>>
@@ -86,17 +102,27 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
86102
</select>
87103
</div>
88104
</div>
105+
89106
<?php if ($block->hasVerification()): ?>
90-
<div class="admin__field _required">
91-
<label for="<?php /* @noEscape */ echo $code; ?>_cc_cid">
107+
<div class="admin__field _required field-cvv">
108+
<label class="admin__field-label"
109+
for="<?php /* @noEscape */ echo $code; ?>_cc_cid"
110+
id="<?php /* @noEscape */ echo $code; ?>_cc_type_cvv_div">
92111
<span><?php echo $block->escapeHtml(__('Card Verification Number')); ?></span>
93112
</label>
94113

95114
<div class="admin__field-control">
96115
<input type="text"
97-
class="required-entry input-text validate-cc-cvn admin__control-text"
116+
data-container="<?php /* @noEscape */ echo $code; ?>-cc-cvv"
117+
title="<?php echo $block->escapeHtml(__('Card Verification Number')); ?>"
118+
class="admin__control-text cvv"
98119
id="<?php /* @noEscape */ echo $code; ?>_cc_cid" name="payment[cc_cid]"
99-
value="<?php /* @noEscape */ echo $block->getInfoData('cc_cid') ?>"/>
120+
value="<?php /* @noEscape */ echo $block->getInfoData('cc_cid') ?>"
121+
data-validate="{
122+
'required-number':true,
123+
'validate-cc-cvn':'#<?php /* @noEscape */ echo $code; ?>_cc_type'
124+
}"
125+
autocomplete="off"/>
100126
</div>
101127
</div>
102128
<?php endif; ?>
@@ -105,7 +131,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
105131
require([
106132
'prototype',
107133
'Magento_Sales/order/create/scripts',
108-
"Magento_Sales/order/create/form",
134+
'Magento_Sales/order/create/form',
109135
'Magento_Authorizenet/js/direct-post'
110136
], function(){
111137

app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -831,20 +831,6 @@ private function getStatusStockProviderData($extensionAttributesMock)
831831
];
832832
}
833833

834-
public function testStatusAfterLoad()
835-
{
836-
$this->resource->expects($this->once())->method('load')->with($this->model, 1, null);
837-
$this->eventManagerMock->expects($this->exactly(4))->method('dispatch');
838-
$this->model->load(1);
839-
$this->assertEquals(
840-
Status::STATUS_ENABLED,
841-
$this->model->getData(\Magento\Catalog\Model\Product::STATUS)
842-
);
843-
$this->assertFalse($this->model->hasDataChanges());
844-
$this->model->setStatus(Status::STATUS_DISABLED);
845-
$this->assertTrue($this->model->hasDataChanges());
846-
}
847-
848834
/**
849835
* Test retrieving price Info
850836
*/

app/code/Magento/Catalog/view/adminhtml/web/js/components/import-handler.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
*/
55

66
define([
7+
'underscore',
78
'Magento_Ui/js/form/element/textarea'
8-
], function (Textarea) {
9+
], function (_, Textarea) {
910
'use strict';
1011

1112
return Textarea.extend({
@@ -123,24 +124,21 @@ define([
123124
* Update field value, if it's allowed
124125
*/
125126
updateValue: function () {
126-
var str = this.mask,
127+
var str = this.mask || '',
127128
nonEmptyValueFlag = false,
128-
placeholder,
129-
property,
130129
tmpElement;
131130

132131
if (!this.allowImport) {
133132
return;
134133
}
135134

136-
for (property in this.values) {
137-
if (this.values.hasOwnProperty(property)) {
138-
placeholder = '';
139-
placeholder = placeholder.concat('{{', property, '}}');
140-
str = str.replace(placeholder, this.values[property]);
141-
nonEmptyValueFlag = nonEmptyValueFlag || !!this.values[property];
142-
}
135+
if (str) {
136+
_.each(this.values, function (propertyValue, propertyName) {
137+
str = str.replace('{{' + propertyName + '}}', propertyValue);
138+
nonEmptyValueFlag = nonEmptyValueFlag || !!propertyValue;
139+
});
143140
}
141+
144142
// strip tags
145143
tmpElement = document.createElement('div');
146144
tmpElement.innerHTML = str;

app/code/Magento/Customer/view/frontend/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ var config = {
1010
address: 'Magento_Customer/address',
1111
changeEmailPassword: 'Magento_Customer/change-email-password',
1212
passwordStrengthIndicator: 'Magento_Customer/js/password-strength-indicator',
13-
zxcvbn: 'Magento_Customer/js/zxcvbn'
13+
zxcvbn: 'Magento_Customer/js/zxcvbn',
14+
addressValidation: 'Magento_Customer/js/addressValidation'
1415
}
1516
}
1617
};

app/code/Magento/Customer/view/frontend/templates/address/edit.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
<script type="text/x-magento-init">
204204
{
205205
"#form-validate": {
206-
"validation": {}
206+
"addressValidation": {}
207207
},
208208
"#country": {
209209
"regionUpdater": {
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Copyright © 2016 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
/*jshint browser:true jquery:true*/
6+
define([
7+
'jquery',
8+
'jquery/ui',
9+
'validation'
10+
], function ($) {
11+
'use strict';
12+
13+
$.widget('mage.addressValidation', {
14+
options: {
15+
selectors: {
16+
button: '[data-action=save-address]'
17+
}
18+
},
19+
20+
/**
21+
* Validation creation
22+
* @protected
23+
*/
24+
_create: function () {
25+
var button = $(this.options.selectors.button, this.element);
26+
27+
this.element.validation({
28+
29+
/**
30+
* Submit Handler
31+
* @param {Element} form - address form
32+
*/
33+
submitHandler: function (form) {
34+
35+
button.attr('disabled', true);
36+
form.submit();
37+
}
38+
});
39+
}
40+
});
41+
42+
return $.mage.addressValidation;
43+
});

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ public function load($object, $entityId, $attributes = [])
950950
/**
951951
* Load object base row data
952952
*/
953+
$object->beforeLoad($entityId);
953954
$select = $this->_getLoadRowSelect($object, $entityId);
954955
$row = $this->getConnection()->fetchRow($select);
955956

@@ -962,11 +963,10 @@ public function load($object, $entityId, $attributes = [])
962963
$this->loadAttributesMetadata($attributes);
963964

964965
$this->_loadModelAttributes($object);
965-
966-
$object->setOrigData();
967-
968966
$this->_afterLoad($object);
969-
967+
$object->afterLoad();
968+
$object->setOrigData();
969+
$object->setHasDataChanges(false);
970970
\Magento\Framework\Profiler::stop('EAV:load_entity');
971971
return $this;
972972
}

app/code/Magento/Payment/view/adminhtml/web/transparent.js

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
define([
77
'jquery',
88
'mage/template',
9-
'Magento_Ui/js/modal/alert'
9+
'Magento_Ui/js/modal/alert',
10+
'Magento_Payment/js/model/credit-card-validation/validator'
1011
], function ($, mageTemplate, alert) {
1112
'use strict';
1213

1314
$.widget('mage.transparent', {
1415
options: {
16+
editFormSelector: '#edit_form',
1517
hiddenFormTmpl:
1618
'<form target="<%= data.target %>" action="<%= data.action %>"' +
1719
'method="POST" hidden' +
@@ -33,37 +35,51 @@ define([
3335
* @private
3436
*/
3537
_create: function () {
38+
this.hiddenFormTmpl = mageTemplate(this.options.hiddenFormTmpl);
3639

37-
/**
38-
* @param {Object} event
39-
* @param {String} method
40-
*/
41-
var prepare = function (event, method) {
42-
if (method === this.options.gateway) {
43-
$('#edit_form')
44-
.off('submitOrder')
45-
.on('submitOrder.' + this.options.gateway, this._orderSave.bind(this));
46-
} else {
47-
$('#edit_form')
48-
.off('submitOrder.' + this.options.gateway);
49-
}
50-
},
51-
$editForm = $('#edit_form');
40+
$(this.options.editFormSelector).on('changePaymentMethod', this._setPlaceOrderHandler.bind(this));
41+
$(this.options.editFormSelector).trigger('changePaymentMethod', [
42+
$(this.options.editFormSelector).find(':radio[name="payment[method]"]:checked').val()
43+
]);
44+
},
5245

53-
this.hiddenFormTmpl = mageTemplate(this.options.hiddenFormTmpl);
54-
$editForm.on('changePaymentMethod', prepare.bind(this));
55-
56-
$editForm.trigger(
57-
'changePaymentMethod',
58-
[
59-
$editForm.find(':radio[name="payment[method]"]:checked').val()
60-
]
61-
);
46+
/**
47+
* Handler for form submit.
48+
*
49+
* @param {Object} event
50+
* @param {String} method
51+
*/
52+
_setPlaceOrderHandler: function (event, method) {
53+
if (method === this.options.gateway) {
54+
$(this.options.editFormSelector)
55+
.off('submitOrder')
56+
.on('submitOrder.' + this.options.gateway, this._placeOrderHandler.bind(this));
57+
} else {
58+
$(this.options.editFormSelector)
59+
.off('submitOrder.' + this.options.gateway);
60+
}
61+
},
62+
63+
/**
64+
* Handler for form submit to call gateway for credit card validation.
65+
*
66+
* @return {Boolean}
67+
* @private
68+
*/
69+
_placeOrderHandler: function () {
70+
if ($(this.options.editFormSelector).valid()) {
71+
this._orderSave();
72+
} else {
73+
$('body').trigger('processStop');
74+
}
75+
76+
return false;
6277
},
6378

6479
/**
65-
* handler for Place Order button to call gateway for credit card validation
66-
* Save order and generate post data for gateway call
80+
* Handler for Place Order button to call gateway for credit card validation.
81+
* Save order and generate post data for gateway call.
82+
*
6783
* @private
6884
*/
6985
_orderSave: function () {
@@ -99,7 +115,8 @@ define([
99115
},
100116

101117
/**
102-
* Post data to gateway for credit card validation
118+
* Post data to gateway for credit card validation.
119+
*
103120
* @param {Object} response
104121
* @private
105122
*/
@@ -136,7 +153,7 @@ define([
136153
},
137154

138155
/**
139-
* Add credit card fields to post data for gateway
156+
* Add credit card fields to post data for gateway.
140157
*
141158
* @param {Object} response
142159
* @private

0 commit comments

Comments
 (0)