Skip to content

Make "is_required" and "is_visible" properties of telephone, company and fax attributes of addresses configurable #8519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

avstudnitz
Copy link
Contributor

@avstudnitz avstudnitz commented Feb 11, 2017

Fixes #1691.
We added configuration for telephone, fax and company fields in configuration:
grafik
You can set them to be optional, required, or not shown at all. All necessary forms have been adjusted.

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Feb 11, 2017

CLA assistant check
All committers have signed the CLA.

<div class="control">
<input type="text" name="company" id="company" value="<?php echo $block->escapeHtmlAttr($block->getCompany()) ?>" title="<?php echo $block->escapeHtmlAttr(__('Company')) ?>" class="input-text <?php echo $block->escapeHtmlAttr($this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('company')) ?>">
</div>
</div>
Copy link
Contributor

@Igloczek Igloczek Feb 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be nice to improve code formatting in templates 😉 Copy-paste code bellow.

<div class="field company <?php echo $block->isRequired() ? 'required' : '' ?>">
    <label for="company" class="label">
        <span>
            <?php echo $block->escapeHtml(__('Company')) ?>
        </span>
    </label>
    <div class="control">
        <?php
            $_validationClass = $block->escapeHtmlAttr(
                $this->helper('Magento\Customer\Helper\Address')
                     ->getAttributeValidationClass('company')
            );
        ?>
        <input type="text"
               name="company"
               id="company"
               value="<?php echo $block->escapeHtmlAttr($block->getCompany()) ?>"
               title="<?php echo $block->escapeHtmlAttr(__('Company')) ?>"
               class="input-text <?php echo $_validationClass ?? '' ?>"
         >
    </div>
</div>

PS. Remember about new line at the end of file.

<div class="control">
<input type="text" name="fax" id="fax" value="<?php echo $block->escapeHtmlAttr($block->getFax()) ?>" title="<?php echo $block->escapeHtmlAttr(__('Fax')) ?>" class="input-text <?php echo $block->escapeHtmlAttr($this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('fax')) ?>">
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<div class="field fax <?php echo $block->isRequired() ? 'required' : '' ?>">
    <label for="fax" class="label">
        <span>
            <?php echo $block->escapeHtml(__('Fax')) ?>
        </span>
    </label>
    <div class="control">
        <?php
            $_validationClass = $block->escapeHtmlAttr(
                $this->helper('Magento\Customer\Helper\Address')
                     ->getAttributeValidationClass('fax')
            );
        ?>
        <input type="text"
               name="fax"
               id="fax"
               value="<?php echo $block->escapeHtmlAttr($block->getFax()) ?>"
               title="<?php echo $block->escapeHtmlAttr(__('Fax')) ?>"
               class="input-text <?php echo $_validationClass ?? '' ?>"
        >
    </div>
</div>

<div class="control">
<input type="text" name="telephone" id="telephone" value="<?php echo $block->escapeHtmlAttr($block->getTelephone()) ?>" title="<?php echo $block->escapeHtmlAttr(__('Phone Number')) ?>" class="input-text <?php echo $block->escapeHtmlAttr($this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('telephone')) ?>">
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<div class="field telephone <?php echo $block->isRequired() ? 'required' : '' ?>">
    <label for="telephone" class="label">
        <span>
            <?php echo $block->escapeHtml(__('Phone Number')) ?>
        </span>
    </label>
    <div class="control">
        <?php
            $_validationClass = $block->escapeHtmlAttr(
                $this->helper('Magento\Customer\Helper\Address')
                     ->getAttributeValidationClass('fax')
            );
        ?>
        <input type="text"
               name="telephone"
               id="telephone"
               value="<?php echo $block->escapeHtmlAttr($block->getTelephone()) ?>"
               title="<?php echo $block->escapeHtmlAttr(__('Phone Number')) ?>"
               class="input-text <?php echo $_validationClass ?? '' ?>"
        >
    </div>
</div>

@hostep
Copy link
Contributor

hostep commented Feb 11, 2017

Nice work @avstudnitz!

Just something I have to think about, take a look at this code:

'company' => [
'validation' => [
'min_text_length' => 0,
],
],
'fax' => [
'validation' => [
'min_text_length' => 0,
],
],
'telephone' => [
'config' => [
'tooltip' => [
'description' => __('For delivery questions.'),
],
],
],

I think you'll need to figure something out, to add the required-entry validation of those 3 billing address fields in there, based on the chosen configuration?

(not 100% sure about this though)

@avstudnitz
Copy link
Contributor Author

@hostep In our tests it set the correct validation on the checkout without modifying anything, based on the attribute settings. so I think this is not necessary.

@fooman
Copy link
Contributor

fooman commented Feb 11, 2017

Nice work - I believe if you want to increase your chances of a quick merge I suggest taking a look at making the constructor changes here https://github.com/magento/magento2/pull/8519/files#diff-abecee6a6fc7dfb7ec46099d0ffec980R55 use an optional parameter similar to how @dmanners has been doing here https://github.com/magento/magento2/pull/8481/files#diff-ab7a66b8a18582a01b9661fe9270486aR51

@vrann vrann self-assigned this Feb 16, 2017
@vrann vrann added this to the February 2017 milestone Feb 16, 2017
@vrann
Copy link
Contributor

vrann commented Feb 23, 2017

@avstudnitz Thank you for the contribution! I'm verifying it at the moment.
Can you please take a look at the failing Travis tests?

@@ -25,6 +25,8 @@
* @method int getCountryId()
* @method string getCity()
* @method string getTelephone()
* @method string getCompany()
* @method string getFax()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@avstudnitz
Copy link
Contributor Author

@vrann Yes, will do that over the weekend. It's the unit tests, right?

@vrann
Copy link
Contributor

vrann commented Feb 23, 2017

@avstudnitz actually nevermind issues in the unit tests (Travis), it was fast fix and I just did it.
Verifying the functionality and will let you know is there anything need to be changed.

@vrann
Copy link
Contributor

vrann commented Feb 23, 2017

@avstudnitz from the review perspective all the changes looks good and the functionality works perfectly.

@avstudnitz
Copy link
Contributor Author

Great to hear @vrann!

@mmansoor-magento mmansoor-magento merged commit ed3ffe6 into magento:develop Feb 25, 2017
@okorshenko
Copy link
Contributor

@avstudnitz thank you for your contribution. PR is merged

markpol added a commit to markpol/magento2 that referenced this pull request Mar 5, 2017
* MAGETWO-64607: Implement custom provider to collect store and system configuration

* MAGETWO-64608: Configure store and website reports for data collection

* MAGETWO-64612: Implement config for Analytics cron setting

* Create wishlist.js

* Delete wishlist.js

* Update requirejs-config.js

* MAGETWO-64607: Implement custom provider to collect store and system configuration

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64629: Add plugin for base url change

small refactoring

* MAGETWO-64630: Create cronjob that executes update command

* MAGETWO-64629: Add plugin for base url change

review fixes

* MTO-142: [Test] Captcha on front login

- Defects fixed.

* MTO-142: [Test] Captcha on front login

- Defects fixed.

* MAGETWO-64630: Create cronjob that executes update command

* MAGETWO-63406: [Github] Paypal Payment Order Transaction ID Link will result to 404 not found

- Fixed returned link
- Fixed unit tests

* Update Save.php

If quantity is changed using mass action for attribute changes, but no stock item exists for the product, saving the newly created stockItem in StockItemRepository->save($stockItem) returns without saving the stockItem, since $stockItem->getProductId() is null, due to it being added to the array with key '0' (see line 165). To fix this, the array key has been changed to "product_id", such that StockItemRepository successfully creates the stockItem.
Also, in my opinion, StockItemRepository->save() should not just return without notice, especially as it already encapsulates the functionality in a try/catch block. Throwing an exception would actually tell the user that something went wrong.

* MAGETWO-64630: Create cronjob that executes update command

* MAGETWO-64224: Remove usages of AttributeCache from customer module

- fixing annotation

* MAGETWO-64224: Remove usages of AttributeCache from customer module

- making inheritdoc lowercase

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64612: Implement config for Analytics cron setting

* MAGETWO-64629: Add plugin for base url change

add secure url check

* MAGETWO-64629: Add plugin for base url change

add secure url check test

* MAGETWO-64802: Implement corrupted data reporting for fieldDataConverter

* MAGETWO-64505: [Integration] Advanced Analytics subscription create API request

add data provider

* MAGETWO-64505: [Integration] Advanced Analytics subscription create API request

* MTO-111: [Test] Update Category if Use Category Flat (Cron is ON, "Update on Save" Mode)

- Defects fixed.

* MTO-113: [Test] Captcha on admin login

- Defects fixed

* MAGETWO-64625: Implement API for file downloading by MA

allow only secure connections for analytics

* MAGETWO-53457: [COMMUNITY] [FEEDBACK] Improve error reporting for failed order placement (checkout) magento#4682

updated unit tests

* MTO-142: [Test] Captcha on front login

- Defects fixed.

* MTO-113: [Test] Captcha on admin login

- Defects fixed

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64630: Create cronjob that executes update command

* MAGETWO-65047 [GitHub][PR] Refactor contact module magento#8420

- fix code style issues

* MAGETWO-65047 [GitHub][PR] Refactor contact module magento#8420

- fix integrity tests issues

* MAGETWO-65047 [GitHub][PR] Refactor contact module magento#8420

- fix integration tests

* MAGETWO-64902: [GitHub][PR] bug magento#8277 fixing bug with https downloading. magento#8278

* MAGETWO-64775: [GitHub] [PR] Make "is_required" and "is_visible" properties of telephone, company and fax attributes of addresses configurable magento#8519

- fix unit and integration tests

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64802: Implement corrupted data reporting for fieldDataConverter

* MAGETWO-64625: Implement API for file downloading by MA

add base64 encoding for transferring binary vector

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64613: Implement service to enrypt collected data

* MAGETWO-64775: [GitHub] [PR] Make "is_required" and "is_visible" properties of telephone, company and fax attributes of addresses configurable magento#8519

- fix unit tests

* MAGETWO-64613: Implement service to enrypt collected data

* MAGETWO-64609: Extend modules report for data colection

* MAGETWO-64802: Implement corrupted data reporting for fieldDataConverter

* MAGETWO-64802: Implement corrupted data reporting for fieldDataConverter

- covered skipping already converted data with integration test

* MAGETWO-64608: Configure store and website reports for data collection

* MAGETWO-64613: Implement service to enrypt collected data

* MAGETWO-64505: [Integration] Advanced Analytics subscription create API request

-- fix test

* MAGETWO-62322: Performance Profile Generator

* MAGETWO-62322: Performance Profile Generator

* Add correct return type in order service

The method return $this. I corrected the doc-block.

* MAGETWO-64625: Implement API for file downloading by MA

fix tests

* MAGETWO-62549: Collect Data by cron and encrypt file

-- fix code style

* MAGETWO-64625: Implement API for file downloading by MA

allow only secure connections for analytics

* MAGETWO-62549: Collect Data by cron and encrypt file

-- fix code style

* MAGETWO-64802: Implement corrupted data reporting for fieldDataConverter

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Issue added to variation

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64626: Web API test for file export

edit test for run on http

* MAGETWO-65006: [GitHub][PR] Keep transparency when resizing images magento#7307

 - fix is created based on public pull request magento#7307 by @kassner
 - closing magento#7307

* MAGETWO-51176: ST compiler supplies ObjectManagerInterface to direct third party dependencies

* Fixed Doc Block for the dispatch method of the Rest Controller

- provided more information on how dispatch method handles the Request

* remove unused ComponentRegistrar instance from being passed to Populator::populateMappings

* Fixed return type of OrderRepository::getList

* MAGETWO-64802: Implement corrupted data reporting for fieldDataConverter

- custom converters coverage

* MAGETWO-64626: Web API test for file export

edit test for run on http

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64626: Web API test for file export

edit test for run on http

* MAGETWO-64626: Web API test for file export

allow only secure connections for analytics

* MTO-111: [Test] Update Category if Use Category Flat (Cron is ON, "Update on Save" Mode)

- Duplicated new line removed.

* MAGETWO-64626: Web API test for file export

edit test for run on http

* MTO-146: [Test] Create offline Order from "Edit Customer" Admin page

- Defects fixed

* MAGETWO-64802: Implement corrupted data reporting for fieldDataConverter

- custom converters
- fixed integration test and removed dependency

* MTO-142: [Test] Captcha on front login

- Defects fixed.

* MAGETWO-64796: Added fixture for Customer module with assigned website

* MAGETWO-64601: [Integration] report page API request for Advanced analytics

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-61095: When attempting to place a reorder after a product is disabled, product still gets added to the cart

* MAGETWO-64515: change comment in file due to PR risk

* MAGETWO-64515: change comment in file due to PR risk

* MAGETWO-62168: Improve field data converter logging and error reporting

* MAGETWO-62168: Improve field data converter logging and error reporting

* MAGETWO-62168: Improve field data converter logging and error reporting

* MAGETWO-62168: Improve field data converter logging and error reporting

* MAGETWO-62168: Improve field data converter logging and error reporting

* MAGETWO-62168: Improve field data converter logging and error reporting
@markpol markpol mentioned this pull request Mar 5, 2017
@avstudnitz avstudnitz deleted the telephone-not-required branch November 8, 2017 08:03
magento-devops-reposync-svc pushed a commit that referenced this pull request Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants