* @copyright 2012-2015 IXYCOM * @license You are just allowed to modify this copy for your own use. You must not redistribute it. License is permitted for one Prestashop instance only but you can install it on your test instances. */ class SiretProgramActionsModuleFrontController extends ModuleFrontController { public $customer, $retour; public function init() { parent::init(); $this->customer = new Customer(Context::getContext()->customer->id); } public function postProcess() { $the_siret = htmlspecialchars(Tools::getValue('siret')); $this->whatAboutSiret($the_siret); } public function initContent() { parent::initContent(); if (!Context::getContext()->customer->id) Tools::redirect(__PS_BASE_URI__); $this->context->controller->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/style.css'); return $this->setTemplate('module:siretprogram/views/templates/front/siretprogram-program.tpl'); } public function whatAboutSiret($siret) { $sp = new SiretProgram(); if (empty($siret) && Configuration::get('SIRET_OBLIGATOIRE')) { $this->context->smarty->assign('erreur', $sp->l('SIRET requis')); $this->context->smarty->assign(array( 'mode_manuel' => (int)Configuration::get('SIRET_MODE_MANUEL'), 'en_attente' => (int)Configuration::get('SIRET_ACCES_VALIDATION'), 'ok' => $sp->l('SIRET supprimé.'), 'siret' => '')); } else { if (empty($siret)) $siret = ''; $statut = $sp->processSiret($siret, $this->customer); if (!$statut) { $this->context->smarty->assign('ok', ''); $this->context->smarty->assign('statut', ''); $this->context->smarty->assign('erreur', $sp->l('SIRET invalide.')); } else { $this->context->smarty->assign('ok', $sp->l('SIRET enregistré.')); $this->context->smarty->assign('statut', $statut); $this->context->smarty->assign('erreur', ''); } $this->context->smarty->assign(array( 'mode_manuel' => (int)Configuration::get('SIRET_MODE_MANUEL'), 'en_attente' => (int)Configuration::get('SIRET_ACCES_VALIDATION'), 'siret' => (int)$siret)); } } public function getBreadcrumbLinks() { $breadcrumb = parent::getBreadcrumbLinks(); $breadcrumb['links'][] = $this->addMyAccountToBreadcrumb(); return $breadcrumb; } }