diff --git a/classes/Customer.php b/classes/Customer.php index 007f3215d..752fd9605 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -173,7 +173,7 @@ class CustomerCore extends ObjectModel 'passwd' => array('type' => self::TYPE_STRING, 'validate' => 'isPasswd', 'required' => true, 'size' => 60), 'last_passwd_gen' => array('type' => self::TYPE_STRING, 'copy_post' => false), 'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), - 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isInt', 'copy_post' => false), + 'id_country' => array('type' => self::TYPE_INT, 'validate' => 'isInt'), 'birthday' => array('type' => self::TYPE_DATE, 'validate' => 'isBirthDate'), 'newsletter' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'newsletter_date_add' => array('type' => self::TYPE_DATE,'copy_post' => false), diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 4346617cf..bb2fd3fc4 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -89,6 +89,7 @@ class AdminCustomersControllerCore extends AdminController $selected_nationalities[$row['id_country']] = $row['name']; } $selected_nationalities[-1] = $this->l('Other'); + $selected_nationalities[0] = $this->l('None'); $selected_countries = array(); $countries_result = Db::getInstance()->executeS(' diff --git a/js/admin.js b/js/admin.js index b42e2e297..26c8d29f9 100644 --- a/js/admin.js +++ b/js/admin.js @@ -504,6 +504,14 @@ function changeCMSActivationAuthorization() getE('PS_CONDITIONS_CMS_ID').disabled = 'disabled'; } +function toggleNationalityMandatoryField() +{ + if ($('#PS_CUSTOMER_NATIONALITY_on').prop('checked')) + $('#conf_id_PS_CUSTOMER_NATIONALITY_MANDATORY').closest('.form-group').show(); + else + $('#conf_id_PS_CUSTOMER_NATIONALITY_MANDATORY').closest('.form-group').hide(); +} + function changeOverbookingOrderAction() { if (getE('PS_OVERBOOKING_ORDER_ACTION').value == $("input[name='OVERBOOKING_ORDER_CANCEL_ACTION']").val()) @@ -998,6 +1006,10 @@ $(document).ready(function() if ($('.kpi-container').length) { refresh_kpis(); } + if ($('#PS_CUSTOMER_NATIONALITY_on').length) { + toggleNationalityMandatoryField(); + $('input[name="PS_CUSTOMER_NATIONALITY"]').on('change', toggleNationalityMandatoryField); + } }); function bindSwapSave()