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 @@ -
{$errors}
-{l s='Merci un conseiller prendra contact avec vous rapidement' mod='addcustomer'}
-