diff --git a/modules/addcustomer/addcustomer.php b/modules/addcustomer/addcustomer.php deleted file mode 100755 index af72d81..0000000 --- a/modules/addcustomer/addcustomer.php +++ /dev/null @@ -1,58 +0,0 @@ -name = 'addcustomer'; - $this->tab = 'front_office_feature'; - $this->version = '1.0'; - $this->author = 'Antadis'; - $this->need_instance = 0; - $this->ps_versions_compliance = array('min' => '1.5', 'max' => _PS_VERSION_); - - parent::__construct(); - - $this->displayName = $this->l('Add customer'); - $this->description = $this->l('Ajout de client pouvant passer des commandes pro.'); - - $this->confirmUninstall = $this->l('Are you sure you want to uninstall this module?'); - } - - public function install() - { - return parent::install() && $this->registerHook('DisplayHomeAddCusto') && $this->registerHook('moduleRoutes'); - } - - public function hookDisplayHomeAddCusto($params) - { - $this->context->smarty->assign( - array( - 'formLink' => $this->context->link->getModuleLink('addcustomer', 'form'), - ) - ); - return $this->display(__FILE__, 'views/templates/hook/addcustomer.tpl'); - } - - public function hookModuleRoutes($params) - { - return [ - 'module-addcustomer-form' => [ - 'controller' => 'form', - 'rule' => 'ouverture-compte.html', - 'keywords' => [ - 'code'=> array( - 'regexp'=>'[\w]+', - 'param'=>'short_code' - ) - ], - 'params' => [ - 'fc' => 'module', - 'module' => 'addcustomer', - 'controller' => 'form' - ] - ] - ]; - } - -} \ No newline at end of file diff --git a/modules/addcustomer/controllers/front/form.php b/modules/addcustomer/controllers/front/form.php deleted file mode 100755 index 096b260..0000000 --- a/modules/addcustomer/controllers/front/form.php +++ /dev/null @@ -1,80 +0,0 @@ -processRequest(); - if (empty($this->errors)) { - $this->sendMail(); - } - } - - $this->context->smarty->assign( - array( - 'hasError' => !empty($this->errors), - 'errors' => $this->errors, - ) - ); - - parent::initContent(); - $this->setTemplate('form.tpl'); - } - - private function processRequest() - { - if (!Tools::getValue('lastName')) { - $this->errors = Tools::displayError('Un nom est requis'); - } elseif (!Validate::isName(Tools::getValue('lastName'))) { - $this->errors = Tools::displayError('Veuillez renseigner un nom correct'); - } elseif (!Tools::getValue('firstName')) { - $this->errors = Tools::displayError('Un prenom est requis'); - } elseif (!Validate::isName(Tools::getValue('firstName'))) { - $this->errors = Tools::displayError('Veuillez renseigner un prenom correct'); - } elseif (!Tools::getValue('phoneNumber')) { - $this->errors = Tools::displayError('Un numéro est requis'); - } elseif (!$this->isPhoneNumber(Tools::getValue('phoneNumber'))) { - $this->errors = Tools::displayError('Veuillez renseigner un numéro correct'); - } elseif (!Tools::getValue('email')) { - $this->errors = Tools::displayError('Une adresse mail est requise'); - } elseif (!Validate::isEmail(Tools::getValue('email'))) { - $this->errors = Tools::displayError('Veuillez renseigner une adresse mail correct'); - } elseif (!Tools::getValue('name')) { - $this->errors = Tools::displayError('Un nom d\'entrerpise est requise'); - } elseif (!Validate::isAnything(Tools::getValue('name'))) { - $this->errors = Tools::displayError('Veuillez renseigner un nom d\'entrerpise correct'); - } elseif (!Tools::getValue('siret')) { - $this->errors = Tools::displayError('Un SIRET est requise'); - } elseif (!Validate::isSiret(Tools::getValue('siret'))) { - $this->errors = Tools::displayError('Veuillez renseigner un SIRET correct'); - } - } - - private function sendMail() - { - global $cookie; - - $subject = 'Demande d\'accès à l\'espace professionnel'; - $data = array( - '{lastName}' => Tools::getValue('lastName'), - '{firstName}' => Tools::getValue('firstName'), - '{phoneNumber}' => Tools::getValue('phoneNumber'), - '{email}' => Tools::getValue('email'), - '{name}' => Tools::getValue('name'), - '{siret}' => Tools::getValue('siret'), - ); - - $dest = 'tarlowski@antadis.com'; - - Mail::Send(intval($cookie->id_lang), 'addcustomer', $subject, $data, $dest, null, null, null, null, null, 'modules/addcustomer/mails/'); - } - - private function isPhoneNumber($number) - { - return preg_match('/^[+0-9. ()-]{10}$/', $number); - } - -} \ No newline at end of file diff --git a/modules/addcustomer/templates/front/form.tpl b/modules/addcustomer/templates/front/form.tpl deleted file mode 100755 index 2474dea..0000000 --- a/modules/addcustomer/templates/front/form.tpl +++ /dev/null @@ -1 +0,0 @@ -

{l s='test' mod='addcustomer'}

\ No newline at end of file diff --git a/modules/addcustomer/views/templates/front/form.tpl b/modules/addcustomer/views/templates/front/form.tpl deleted file mode 100644 index fc6de55..0000000 --- a/modules/addcustomer/views/templates/front/form.tpl +++ /dev/null @@ -1,62 +0,0 @@ -
-
-

Inscription espace professionnel

-
-
-
-
-
- {if $hasError === true} -
-

{$errors}

-
- {/if} - {if $errors === null || $hasError === true} -
-
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
-
- {else} -
-

{l s='Merci un conseiller prendra contact avec vous rapidement' mod='addcustomer'}

-
- {/if} -
-
-
- \ No newline at end of file diff --git a/modules/addcustomer/views/templates/hook/addcustomer.tpl b/modules/addcustomer/views/templates/hook/addcustomer.tpl deleted file mode 100755 index 7fd3abe..0000000 --- a/modules/addcustomer/views/templates/hook/addcustomer.tpl +++ /dev/null @@ -1,3 +0,0 @@ -

-

Pas encore inscrit ?

-Demander un accès à l'espace professionnel \ No newline at end of file diff --git a/override/classes/controller/FrontController.php b/override/classes/controller/FrontController.php index 0d7088f..e2794d5 100755 --- a/override/classes/controller/FrontController.php +++ b/override/classes/controller/FrontController.php @@ -3,14 +3,13 @@ define('ANTADIS_CHECK_GROUPS', true); class FrontController extends FrontControllerCore { - public function display() { global $cookie; if (empty($cookie->tmp)) { $cookie->tmp = serialize($this->errors); } - + if (defined('ANTADIS_CHECK_GROUPS') && ANTADIS_CHECK_GROUPS) { $id_customer_group = Configuration::get('PS_CUSTOMER_GROUP'); if ($id_customer_group!==FALSE && (int)$id_customer_group>0) { @@ -37,25 +36,20 @@ class FrontController extends FrontControllerCore } /* - // * Force assign template - // */ - if (!$cookie->isLogged() - && (!Context::getContext()->controller instanceOf addCustomerFormModuleFrontController) - ) { + * Force assign template + */ + if (!$cookie->isLogged()) { $this->template = _PS_THEME_DIR_.'authentication.tpl'; if ($this->php_self == 'password') { $this->php_self = 'index'; $this->template = _PS_THEME_DIR_.'password.tpl'; - } - if (!in_array($this->php_self, ['index', 'password']) - || Tools::getValue('submitAccount') - || Tools::getValue('SubmitCreate')) { + if (!in_array($this->php_self, ['index', 'password']) || Tools::getValue('submitAccount') || Tools::getValue('SubmitCreate')) { Tools::redirect('index'); exit; - } + } + } - Tools::safePostVars(); // assign css_files and js_files at the very last time @@ -72,7 +66,7 @@ class FrontController extends FrontControllerCore /* Override destroy all css */ $this->css_files = array(); - // Override Add real css + /* Override Add real css */ $this->css_files[_THEME_CSS_DIR_.'strapivarious.css?v='.filemtime($this->getThemeDir().'css/strapivarious.css')] = 'all'; $this->css_files[_THEME_CSS_DIR_.'k2000.css?v='.filemtime($this->getThemeDir().'css/k2000.css')] = 'all'; $this->css_files[_THEME_CSS_DIR_.'global.css?v='.filemtime($this->getThemeDir().'css/global.css')] = 'all'; @@ -153,7 +147,7 @@ class FrontController extends FrontControllerCore $entity = $this->php_self; if (!$cookie->isLogged() && (!Context::getContext()->controller instanceOf addCustomerFormModuleFrontController)) { - if (!in_array($this->php_self, ['index', 'password']) || Tools::getValue('submitAccount') || Tools::getValue('SubmitCreate')) { + if (!in_array($this->php_self, ['index', 'password']) || Tools::getValue('submitAccount') || Tools::getValue('SubmitCreate')) { Tools::redirect('index'); exit; } diff --git a/themes/roykin/authentication.tpl b/themes/roykin/authentication.tpl index 8727942..9231300 100755 --- a/themes/roykin/authentication.tpl +++ b/themes/roykin/authentication.tpl @@ -41,7 +41,6 @@ {l s='Forgot your password?'} - {hook h="DisplayHomeAddCusto"} diff --git a/themes/roykin/footer.tpl b/themes/roykin/footer.tpl index e446f9f..8f01ec6 100755 --- a/themes/roykin/footer.tpl +++ b/themes/roykin/footer.tpl @@ -1,5 +1,5 @@ {if !isset($content_only) || !$content_only} - {if $page_name != 'category' && $page_name != 'index' && $page_name != 'search' && $page_name != 'password' && $page_name != 'module-addcustomer-form'} + {if $page_name != 'category' && $page_name != 'index' && $page_name != 'search' && $page_name != 'password'}