Describe the bug
We can create from the BO a new customer successfully without setting required field "Partner offers"

To Reproduce
Steps to reproduce the behavior:

Additionnal information
PrestaShop version: 1.7.6.3
PHP version: 7.2
This issue is fixed previously in the PS1.7.6.0 with this PR: https://github.com/PrestaShop/PrestaShop/pull/13887
It is ok with PS1.7.6.0 and PS1.7.6.1 and PS1.7.6.2
Ping @nesrineabdmouleh
We need to check what happened in 1763 which introduced this bug again.
It seems this is because of PR https://github.com/PrestaShop/PrestaShop/pull/16648 which fixed issue https://github.com/PrestaShop/PrestaShop/issues/16509 (milestone 1.7.6.3)
@colinegin There is a misunderstanding here.
When I look into the code, I can see that, when we create a customer, we check whether or not in the form the "required field"s have been given to the BO admin and indeed it works.
Setting a field to "required" means "we require the BO admin to fill this field".
There is a misunderstanding on "what is a required field".
In the legacy code from the BO I can see the check ObjectModel::validateFieldsRequiredDatabase() and it uses 1st version. So when we submit customer form, it sees the checkbox and consider that leaving it empty is valid. A checkbox is always filled in, it's either checked or unchecked. It's not like a text input (= you need to fill it) or a dropdown (=you need to select a choice).
This issue description considers that a "required" field is rather the 2nd version, and then it seems to be different from legacy behavior (according to the code).
As I can see, there is a different meaning in what "required fields" means between the address page and the customer page. When looking at the user documentation(1.6 and 1.7), it seems that putting an optin as required means that it has to be checked to be able to create a customer account.
Below the customers table is the "Set required fields for this section" button. It opens a form where you can indicate if a database field is necessary or not by checking the appropriate boxes: this way, you can make it so fields such "partner offers" are mandatory when a visitor is creating a customer account on your shop.
So I would recommend to go for option 2 in the customer page and keep the legacy behaviour in the address page. Is this ok for you @matks ?
Hello @khouloudbelguith ,
After investigation, it seems that it is actually the expected behaviour that we decided on 1763 as you can see in my comment here : https://github.com/PrestaShop/PrestaShop/issues/16509#issuecomment-561768934.
Although the field is required we want to give the possibility to the merchant to create or edit an account and leave the optin unchecked.
So we won't fix this issue, and we need to update automated tests accordingly.
ping @boubkerbribri @SimonGrn
Most helpful comment
Hello @khouloudbelguith ,
After investigation, it seems that it is actually the expected behaviour that we decided on 1763 as you can see in my comment here : https://github.com/PrestaShop/PrestaShop/issues/16509#issuecomment-561768934.
Although the field is required we want to give the possibility to the merchant to create or edit an account and leave the optin unchecked.
So we won't fix this issue, and we need to update automated tests accordingly.
ping @boubkerbribri @SimonGrn