Merge pull request #26697 from passatgt/master

Fixes for Hungarian address format and name order
This commit is contained in:
Claudio Sanches 2020-07-01 12:55:50 -03:00 committed by GitHub
commit 9ac5bcb586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 3 deletions

View File

@ -101,6 +101,10 @@ jQuery( function( $ ) {
field.show();
}
}
// Class changes.
field.removeClass( 'form-row-first form-row-last form-row-wide' );
field.addClass( fieldLocale.class.join( ' ' ) );
});
var fieldsets = $(

View File

@ -516,7 +516,7 @@ class WC_Countries {
'DK' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'FR' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city_upper}\n{country}",
'HK' => "{company}\n{first_name} {last_name_upper}\n{address_1}\n{address_2}\n{city_upper}\n{state_upper}\n{country}",
'HU' => "{name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}",
'HU' => "{last_name} {first_name}\n{company}\n{city}\n{address_1}\n{address_2}\n{postcode}\n{country}",
'IN' => "{company}\n{name}\n{address_1}\n{address_2}\n{city} {postcode}\n{state}, {country}",
'IS' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}",
'IT' => "{company}\n{name}\n{address_1}\n{address_2}\n{postcode}\n{city}\n{state_upper}\n{country}",
@ -982,6 +982,27 @@ class WC_Countries {
),
),
'HU' => array(
'last_name' => array(
'class' => array( 'form-row-first' ),
'priority' => 10,
),
'first_name' => array(
'class' => array( 'form-row-last' ),
'priority' => 20,
),
'postcode' => array(
'class' => array( 'form-row-first', 'address-field' ),
'priority' => 65,
),
'city' => array(
'class' => array( 'form-row-last', 'address-field' ),
),
'address_1' => array(
'priority' => 71,
),
'address_2' => array(
'priority' => 72,
),
'state' => array(
'label' => __( 'County', 'woocommerce' ),
),
@ -1040,12 +1061,12 @@ class WC_Countries {
'priority' => 20,
),
'postcode' => array(
'class' => array( 'form-row-first' ),
'class' => array( 'form-row-first', 'address-field' ),
'priority' => 65,
),
'state' => array(
'label' => __( 'Prefecture', 'woocommerce' ),
'class' => array( 'form-row-last' ),
'class' => array( 'form-row-last', 'address-field' ),
'priority' => 66,
),
'city' => array(

View File

@ -70,6 +70,9 @@ class WC_Validation {
case 'GB':
$valid = self::is_gb_postcode( $postcode );
break;
case 'HU':
$valid = (bool) preg_match( '/^([0-9]{4})$/i', $postcode );
break;
case 'IE':
$valid = (bool) preg_match( '/([AC-FHKNPRTV-Y]\d{2}|D6W)[0-9AC-FHKNPRTV-Y]{4}/', wc_normalize_postcode( $postcode ) );
break;