Compare commits

...

44 Commits

Author SHA1 Message Date
Michael RICOIS
84d72f07b1 Mode 0644 don't work in preprod so we use 0777 2017-09-06 15:47:35 +02:00
Michael RICOIS
218169e21f use redirectAdmin after delete 2017-09-06 14:59:19 +02:00
Michael RICOIS
513bb86c3e Wait file is really upload to save in db 2017-09-06 14:44:24 +02:00
Michael RICOIS
ee416c8041 Translate 2017-08-23 12:32:09 +02:00
Michael RICOIS
ea5e539bb9 Translate 2017-08-23 12:18:26 +02:00
Michael RICOIS
8e80044c97 Module string 2017-08-23 12:10:22 +02:00
Michael RICOIS
5c8d19854f Translate 2017-08-23 12:04:35 +02:00
Michael RICOIS
ee0ba31617 Display 2017-08-23 11:58:35 +02:00
Michael RICOIS
b368e4fe00 Fix permission on upload 2017-08-23 11:17:09 +02:00
Michael RICOIS
c5ee4748c6 Filter only files associated to customer 2017-08-23 11:09:32 +02:00
Michael RICOIS
9960d45989 Fix display 2017-08-23 11:08:42 +02:00
Michael RICOIS
92c7928b6e Add logo 2017-08-23 10:55:18 +02:00
Michael RICOIS
8ee25f935e Fix file path 2017-08-23 10:16:04 +02:00
Michael RICOIS
193fe9e5d3 Add global file in list 2017-08-23 10:11:09 +02:00
Michael RICOIS
d623f19f56 Path to db install 2017-08-23 10:08:32 +02:00
Michael RICOIS
fc2df29f23 Add menu for MyDownloads 2017-08-23 10:03:45 +02:00
Michael RICOIS
5e93244674 Module Db install 2017-08-23 10:03:17 +02:00
Michael RICOIS
104eb16be2 File path 2017-08-23 09:58:49 +02:00
Michael RICOIS
dcb82b8096 added property 2017-08-23 09:56:54 +02:00
Michael RICOIS
f4cabfa29b Module antadisfiles 2017-08-22 17:09:06 +02:00
RoykinPROD
738aa51c1e update img cart 2017-08-01 15:16:13 +02:00
Thibault GUILLAUME
301bef8069 Merge branch 'ticket/favicon_logo_13604-2' into 'master'
Modification favicon

See merge request !6
2017-07-05 17:53:06 +02:00
Thibault GUILLAUME
5392d1d300 Merge branch 'pb_image' into 'master'
fix pb file exist

See merge request !3
2017-06-29 11:08:39 +02:00
Valentin
b9d4cfcf5b Modification favicon 2017-06-28 16:04:08 +02:00
Thibault GUILLAUME
2b9b182030 Merge branch 'tickets/r13484-addpageregister' into 'master'
Rajout des input ville et code postal

See merge request !2
2017-06-26 09:55:06 +02:00
root
6c0a154096 fix pb file exist 2017-06-26 09:52:48 +02:00
Valentin
b15a82b1ae Modification du destinataire de l'email 2017-06-23 15:43:02 +02:00
Valentin
f646c42db7 Rajout des input ville et code postal 2017-06-23 15:35:56 +02:00
root
51442d7287 Merge branch 'tickets/r13536-addpageregister' 2017-06-21 18:01:32 +02:00
RoykinPROD
88a2834870 push prod 2017-06-21 15:44:30 +02:00
Valentin
11b9f278c0 Nom et Prenom passé en required 2017-06-20 21:27:38 +02:00
Valentin
820e080976 Modification affichage erreur du form 2017-06-20 20:46:41 +02:00
Valentin
8f17f76225 Modification du message d'information 2017-06-20 20:38:07 +02:00
Valentin
773b8db153 Petite modification du front 2017-06-20 20:28:35 +02:00
Valentin
5b49ba1fcd Modification du visu du form 2017-06-20 20:16:25 +02:00
Valentin
4f314a1310 Modification de l'affichage du block d'inscription 2017-06-20 20:10:13 +02:00
Valentin
ea946e212c modification du form 2017-06-20 18:41:48 +02:00
Valentin
2969c5b01a Modification du mail 2017-06-20 17:23:38 +02:00
Valentin
c64355eb2a ajout de la traducition 2017-06-20 13:02:23 +02:00
Valentin
9fa6bcaa42 Ajout de la redirection, du dossier mail et modification du form 2017-06-20 12:55:58 +02:00
root
a31bb7105a divers 2017-06-19 18:02:46 +02:00
root
47f206a351 add index file 2017-06-19 17:50:41 +02:00
root
fa56cdd243 replace layout function 2017-06-19 17:47:56 +02:00
Valentin
90cab265de Ajout du module pour ajouter des clients à l'espace professionnel 2017-06-19 17:46:51 +02:00
48 changed files with 1681 additions and 26 deletions

View File

@ -91,5 +91,10 @@ foreach ($final as $key => $item) {
$address->id_country = ErpTools::getCountryIdForPresta($item['addr']['country_id'][0]); $address->id_country = ErpTools::getCountryIdForPresta($item['addr']['country_id'][0]);
$address->is_erp = 1; $address->is_erp = 1;
$address->id_erp = $item['addr']['id']; $address->id_erp = $item['addr']['id'];
$address->save(); if (!empty($address->address1)) {
} $address->save();
}
else {
error_log('erp_update_address - customer id #'.$customer->id.' / erp id #'.$item['company_id_erp'].' empty address');
}
}

View File

@ -166,7 +166,13 @@ foreach ($ids_customer_update as $id_customer) {
$address->id_country = ErpTools::getCountryIdForPresta($other_address['country_id'][0]); $address->id_country = ErpTools::getCountryIdForPresta($other_address['country_id'][0]);
$address->is_erp = 1; $address->is_erp = 1;
$address->id_erp = $other_address['id']; $address->id_erp = $other_address['id'];
$address->save();
if (!empty($address->address1)) {
$address->save();
}
else {
error_log('erp_customer_update : customer id #'.$customer->id.' / erp id #'.$record['id'].' empty address');
}
} }
} }
} }

View File

@ -31,8 +31,9 @@ $ids_product = $models->execute_kw($db, $uid, $password,
$d = Db::getInstance(); $d = Db::getInstance();
foreach ($ids_product as $key => $id) { $date = date('Y-m-d H:i:s');
foreach ($ids_product as $key => $id) {
// get product's information // get product's information
$record = $models->execute_kw($db, $uid, $password, $record = $models->execute_kw($db, $uid, $password,
'product.template', 'read', array($id) 'product.template', 'read', array($id)
@ -80,7 +81,8 @@ foreach ($ids_product as $key => $id) {
p.`reference` = "'.$record['default_code'].'", p.`reference` = "'.$record['default_code'].'",
p.`weight` = '.(float)$record['weight'].', p.`weight` = '.(float)$record['weight'].',
p.`out_of_stock` = 2, p.`out_of_stock` = 2,
pl.`name` = "'.pSQL(trim(utf8_encode($name_product))).'" pl.`name` = "'.pSQL(trim(utf8_encode($name_product))).'",
p.`date_upd` = "' . $date .'"
WHERE WHERE
`id_erp` = '.(int)$id.' `id_erp` = '.(int)$id.'
AND p.`id_product` = pl.id_product AND p.`id_product` = pl.id_product
@ -97,6 +99,8 @@ foreach ($ids_product as $key => $id) {
$sql = 'SELECT `id_image` FROM '._DB_PREFIX_.'image WHERE `id_product` = '.(int)$product_id; $sql = 'SELECT `id_image` FROM '._DB_PREFIX_.'image WHERE `id_product` = '.(int)$product_id;
$id_image = $d->getValue($sql); $id_image = $d->getValue($sql);
if ($id_image) { if ($id_image) {
$image = new Image($id_image); $image = new Image($id_image);
$imagesTypes = ImageType::getImagesTypes('products'); $imagesTypes = ImageType::getImagesTypes('products');
@ -104,7 +108,7 @@ foreach ($ids_product as $key => $id) {
$image_exists = true; $image_exists = true;
foreach ($imagesTypes as $imageType) { foreach ($imagesTypes as $imageType) {
$image_exists = file_exists($existing_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format); $image_exists = file_exists('../img/p/'.$existing_path.'-'.stripslashes($imageType['name']).'.'.$image->image_format);
if (!$image_exists) { if (!$image_exists) {
break; break;
} }

View File

@ -0,0 +1,60 @@
<?php
class addCustomer extends Module
{
public function __construct()
{
$this->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'),
'register' => Tools::getValue('register'),
)
);
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'
]
]
];
}
}

View File

@ -0,0 +1,86 @@
<?php
class addCustomerFormModuleFrontController extends ModuleFrontController
{
public $errors = null;
public function initContent()
{
if (Tools::isSubmit('SubmitRegister')) {
$this->processRequest();
if (empty($this->errors)) {
$this->sendMail();
}
}
$this->context->smarty->assign(array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
'formLink' => $this->context->link->getModuleLink('addcustomer', 'form'),
));
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 nom 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 (!Validate::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 (!Tools::getValue('address')) {
$this->errors = Tools::displayError('Une adresse est requise');
} elseif (!Validate::isAddress(Tools::getValue('address'))) {
$this->errors = Tools::displayError('Veuillez renseigner une adresse correct');
}elseif (!Tools::getValue('city')) {
$this->errors = Tools::displayError('Une ville est requise');
} elseif (!Validate::isCityName(Tools::getValue('city'))) {
$this->errors = Tools::displayError('Veuillez renseigner une ville correct');
} elseif (!Tools::getValue('code')) {
$this->errors = Tools::displayError('Un code postal est requise');
} elseif (!Validate::isInt(Tools::getValue('code'))) {
$this->errors = Tools::displayError('Veuillez renseigner un code postal 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()
{
$subject = 'Demande d\'accès à l\'espace professionnel';
$data = array(
'{lastName}' => Tools::getValue('lastName'),
'{firstName}' => Tools::getValue('firstName'),
'{phoneNumber}' => Tools::getValue('phoneNumber'),
'{address}' => Tools::getValue('address'),
'{city}' => Tools::getValue('city'),
'{code}' => Tools::getValue('code'),
'{email}' => Tools::getValue('email'),
'{name}' => Tools::getValue('name'),
'{siret}' => Tools::getValue('siret'),
);
Mail::Send(intval(Context::getContext()->language->id), 'addcustomer', $subject, $data, 'christophe@roykin.fr', null, null, null, null, null, 'modules/addcustomer/mails/');
Mail::Send(intval(Context::getContext()->language->id), 'addcustomer', $subject, $data, 'gerald@roykin.fr', null, null, null, null, null, 'modules/addcustomer/mails/');
$link = $this->context->link->getPageLink('index').'?register=success';
Tools::redirect($link);
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,119 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Message de {shop_name}</title>
<style> @media only screen and (max-width: 300px){
body {
width:218px !important;
margin:auto !important;
}
.table {width:195px !important;margin:auto !important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
span.title{font-size:20px !important;line-height: 23px !important}
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
td.box p{font-size: 12px !important;font-weight: bold !important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
display: block !important;
}
.table-recap{width: 200px!important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
@media only screen and (min-width: 301px) and (max-width: 500px) {
body {width:308px!important;margin:auto!important;}
.table {width:285px!important;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr {
display: block !important;
}
.table-recap{width: 295px !important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
}
@media only screen and (min-width: 501px) and (max-width: 768px) {
body {width:478px!important;margin:auto!important;}
.table {width:450px!important;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
}
@media only screen and (max-device-width: 480px) {
body {width:308px!important;margin:auto!important;}
.table {width:285px;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap{width: 295px!important;}
.table-recap tr td, .conf_body td{text-align:center!important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
</style>
</head>
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:100%;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto">
<table bgcolor="{mail-bg-color}" class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
<tr>
<td class="space" style="width:20px;padding:7px 0">&nbsp;</td>
<td align="center">
<table class="table" bgcolor="{table-bg-color}" style="width:600px" cellspacing="0" cellspacing="0">
<tr>
<td align="center" class="logo">
<a title="{shop_name}" href="{shop_url}" style="color:{link-color}">
<img src="{header_img}" alt="{shop_name}">
</a>
</td>
</tr>
</table>
<table bgcolor="{table-bg-color}" style="width:600px" cellspacing="0">
<tr>
<td class="titleblock" style="padding:10px 25px">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="color:{titre1-color};font-weight:500;font-size:28px;line-height:33px">Demande d'accès à l'espace professionnel !</span>
</font>
</td>
</tr>
<tr>
<td class="box" style="padding:10px 25px">
<table class="table" style="border:1px solid {box-border-color};background-color:{box-bg-color};width:100%">
<tr>
<td width="5" style="padding:15px 5px">&nbsp;</td>
<td style="padding:15px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span style="color:#777">
<span style="color:#333"><strong>Nom du client :</strong></span> {firstName} {lastName}<br /><br />
<span style="color:#333"><strong>Nom de l'enseigne :</strong></span> {name}<br /><br />
<span style="color:#333"><strong>Adresse du siège social :</strong></span> {address}<br /><br />
<span style="color:#333"><strong>Ville du siège social :</strong></span> {city}<br /><br />
<span style="color:#333"><strong>Code postal du siège social :</strong></span> {code}<br /><br />
<span style="color:#333"><strong>SIRET de l'entreprise :</strong></span> {siret}<br /><br />
<span style="color:#333"><strong>Adresse e-mail du client : <a href="mailto:{email}" style="color:#337ff1">{email}</a></strong></span><br /><br />
<span style="color:#333"><strong>Numéro de telephone du client :</strong></span> {phoneNumber}<br /><br />
</span>
</font>
</td>
<td width="10" style="padding:15px 5px">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<table class="table" bgcolor="{table-bg-color}" style="width:600px;padding-top:10px" cellspacing="0" cellpadding="0">
<tr>
<td class="footer">
<img src="{footer_img}" alt="{shop_name}">
</td>
</tr>
</table>
</td>
<td class="space" style="width:20px;padding:7px 0">&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,23 @@
[{shop_url}]
Demande d'accès à l'espace professionnel !
Nom du client : {firstName} {lastName}
Nom de l'entreprise : {name}
Adresse du siège social : {address}
Ville du siège social : {city}
Code postal du siège social : {code}
SIRET de l'entreprise : {siret}
Adresse e-mail du client : {email}
Numéro de telephone du client : {phoneNumber}
{shop_name} [{shop_url}] réalisé avec
PrestaShop(tm) [http://www.prestashop.com/]

View File

@ -0,0 +1 @@
<h1>{l s='test' mod='addcustomer'}</h1>

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,67 @@
<body style="background-color: black;">
<header class="page-heading">
<div class="ctn">
<h1>{l s='Inscription espace professionnel' mod='addcustomer'}</h1>
</div>
</header>
<div id="auth" class="ctn">
<div class="row">
<div class="offset-lg3 lg6 offset-md2 md8 sm12">
{if $errors === null || $hasError === true}
<form action="{$formLink}" method="post" class="box" id="login_form">
<div class="inner">
<div class="box-content clearfix">
{if $hasError === true}
<div class="alert alert-danger displayError" style="margin-bottom: 20px;">{$errors}</div>
{/if}
<div class="form-group">
<label for="lastName">{l s='Nom' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="lastName" class="account_input form-control" {if (isset($smarty.post.lastName))} value="{$smarty.post.lastName}"{/if}>
</div>
<div class="form-group">
<label for="firstName">{l s='Prenom' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="firstName" class="account_input form-control" {if (isset($smarty.post.firstName))} value="{$smarty.post.firstName}"{/if}>
</div>
<div class="form-group">
<label for="phoneNumber">{l s='Numéro de téléphone' mod='addcustomer'} <sup>*</sup></label>
<input type="tel" required name="phoneNumber" class="account_input form-control" {if (isset($smarty.post.phoneNumber))} value="{$smarty.post.phoneNumber}"{/if}>
</div>
<div class="form-group">
<label for="email">{l s='Adresse e-mail' mod='addcustomer'} <sup>*</sup></label>
<input type="email" required name="email" class="account_input form-control" {if (isset($smarty.post.email))} value="{$smarty.post.email}"{/if}>
</div>
<div class="form-group">
<label for="name">{l s='Nom de l\'enseigne' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="name" class="account_input form-control" {if (isset($smarty.post.name))} value="{$smarty.post.name}"{/if}>
</div>
<div class="form-group">
<label for="address">{l s='Adresse du siège social' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="address" class="account_input form-control" {if (isset($smarty.post.address))} value="{$smarty.post.address}"{/if}>
</div>
<div class="form-group">
<label for="address">{l s='Ville du siège social' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="city" class="account_input form-control" {if (isset($smarty.post.city))} value="{$smarty.post.city}"{/if}>
</div>
<div class="form-group">
<label for="address">{l s='Code Postal du siège social' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="code" class="account_input form-control" {if (isset($smarty.post.code))} value="{$smarty.post.code}"{/if}>
</div>
<div class="form-group">
<label for="siret">{l s='SIRET de l\'entreprise' mod='addcustomer'} <sup>*</sup></label>
<input type="text" required name="siret" class="account_input form-control" {if (isset($smarty.post.siret))} value="{$smarty.post.siret}"{/if}>
</div>
<button type="submit" id="SubmitLogin" name="SubmitRegister" class="btn btn-full-width no-icon">
<span>{l s='envoyer' mod='addcustomer'}</span>
</button>
</div>
</div>
</form>
{else}
<div class="displayError">
<p>{l s='Merci un conseiller prendra contact avec vous rapidement' mod='addcustomer'}</p>
</div>
{/if}
</div>
</div>
</div>
</body>

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,12 @@
<div class="lg6 md6 sm12 xs12">
<div class="box">
<div class="inner">
<h2 class="title">{l s='Pas encore inscrit ?' mod='addcustomer'}</h2>
{if $register == 'success'}
<p class="alert alert-success">{l s='L\'email a bien était envoyé et nous traitons votre demande d\'accès dans les plus bref délais.' mod='addcustomer'}</p>
{else}
<a style="color: #bfa56d;" class="lost_password" href="{$formLink}">{l s='Demander un accès à l\'espace professionnel' mod='addcustomer'}</a>
{/if}
</div>
</div>
</div>

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,35 @@
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2014 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@ -0,0 +1,167 @@
<?php
require_once dirname(__FILE__).'/classes/Files.php';
class AntadisFiles extends Module
{
public function __construct()
{
$this->name = 'antadisfiles';
$this->tab = 'front_office_features';
$this->version = '0.1';
$this->author = 'antadis';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('Files for customers');
$this->description = $this->l('With this module, you could assign files to customers.');
}
public function install()
{
// Call install parent method
if (!parent::install()) {
return false;
}
// Execute module install SQL statements
$sql_file = dirname(__FILE__).'/install/db.txt';
if (!$this->loadSQLFile($sql_file)) {
return false;
}
// Menu
if (!$this->installTab('AdminCustomers', 'AdminAntadisFiles', 'Files for customers')) {
return false;
}
// Controllers
// Register hooks
if (!$this->registerHook('displayAdminCustomers')
|| !$this->registerHook('displayBackOfficeHeader')
|| !$this->registerHook('ModuleRoutes')) {
return false;
}
return true;
}
public function uninstall()
{
// Call uninstall parent method
if (!parent::uninstall()) {
return false;
}
// Hook
if (!$this->unregisterHook('displayAdminCustomers')
|| !$this->unregisterHook('displayBackOfficeHeader')
|| !$this->unregisterHook('ModuleRoutes')) {
return false;
}
// Controllers
// Menu
if (!$this->uninstallTab('AdminAntadisFiles')) {
return false;
}
// All went well!
return true;
}
public function installTab($parent, $class_name, $name)
{
// Create new admin tab
$tab = new Tab();
$tab->id_parent = (int)Tab::getIdFromClassName($parent);
$tab->name = array();
foreach (Language::getLanguages(true) as $lang)
$tab->name[$lang['id_lang']] = $name;
$tab->class_name = $class_name;
$tab->module = $this->name;
$tab->active = 1;
return $tab->add();
}
public function uninstallTab($class_name)
{
// Retrieve Tab ID
$id_tab = (int)Tab::getIdFromClassName($class_name);
// Load tab
$tab = new Tab((int)$id_tab);
// Delete it
return $tab->delete();
}
public function loadSQLFile($sql_file)
{
// Get install SQL file content
$sql_content = file_get_contents($sql_file);
// Replace prefix and store SQL command in array
$sql_content = str_replace('PREFIX_', _DB_PREFIX_, $sql_content);
$sql_requests = preg_split("/;\s*[\r\n]+/", $sql_content);
// Execute each SQL statement
$result = true;
foreach($sql_requests as $request) {
if (!empty($request)) {
$result &= Db::getInstance()->execute(trim($request));
}
}
return $result;
}
public function getHookController($hook_name)
{
// Include the controller file
require_once(dirname(__FILE__).'/controllers/hook/'. $hook_name.'.php');
// Build dynamically the controller name
$controller_name = $this->name.$hook_name.'Controller';
// Instantiate controller
$controller = new $controller_name($this, __FILE__, $this->_path);
// Return the controller
return $controller;
}
public function getContent()
{
$ajax_hook = Tools::getValue('ajax_hook');
if ($ajax_hook != '') {
$ajax_method = 'hook'.ucfirst($ajax_hook);
if (method_exists($this, $ajax_method)) {
die($this->{$ajax_method}(array()));
}
}
$controller = $this->getHookController('getContent');
return $controller->run();
}
public function hookDisplayAdminCustomers($params)
{
$controller = $this->getHookController('displayAdminCustomers');
return $controller->run();
}
public function hookDisplayBackOfficeHeader($params)
{
$controller = $this->getHookController('displayBackOfficeHeader');
return $controller->run($params);
}
public function hookModuleRoutes()
{
$controller = $this->getHookController('modulesRoutes');
return $controller->run();
}
}

View File

@ -0,0 +1,78 @@
<?php
class Files extends ObjectModel
{
public $id_file;
public $id_customer;
public $reference;
public $name;
public $added;
public static $definition = array(
'table' => 'antadis_files',
'primary' => 'id_file',
'multilang' => false,
'fields' => array(
'id_customer' => array('type' => self::TYPE_INT),
'reference' => array('type' => self::TYPE_STRING),
'name' => array('type' => self::TYPE_STRING),
'added' => array('type' => self::TYPE_DATE),
),
'associations' => array(
'customer' => array('type' => self::HAS_ONE),
),
);
public function getAdminCustomerFiles($id, $limit_start, $limit_end = false)
{
$limit = (int)$limit_start;
if ($limit_end) {
$limit = (int)$limit_start.','.(int)$limit_end;
}
$files = Db::getInstance()->executeS('
SELECT * FROM `'._DB_PREFIX_.'antadis_files`
WHERE `id_customer` = '.(int)$id.
' ORDER BY `added` DESC LIMIT '.$limit
);
return $files;
}
public function getAdminCustomerNbFiles($id)
{
$nb = Db::getInstance()->getValue('
SELECT COUNT(`id_file`)
FROM `'._DB_PREFIX_.'antadis_files`
WHERE `id_customer` = '.(int)$id
);
return $nb;
}
public function getCustomerFiles($id, $limit_start, $limit_end = false)
{
$limit = (int)$limit_start;
if ($limit_end) {
$limit = (int)$limit_start.','.(int)$limit_end;
}
$files = Db::getInstance()->executeS('
SELECT * FROM `'._DB_PREFIX_.'antadis_files`
WHERE `id_customer`=0 OR `id_customer` = '.(int)$id.
' ORDER BY `added` DESC LIMIT '.$limit
);
return $files;
}
public function getCustomerNbFiles($id)
{
$nb = Db::getInstance()->getValue('
SELECT COUNT(`id_file`)
FROM `'._DB_PREFIX_.'antadis_files`
WHERE `id_customer`=0 OR `id_customer` = '.(int)$id
);
return $nb;
}
}

View File

@ -0,0 +1,263 @@
<?php
class AdminAntadisFilesController extends ModuleAdminController
{
public function __construct()
{
$this->table = 'antadis_files';
$this->className = 'Files';
$this->identifier = 'id_file';
$this->lang = false;
$this->list_simple_header = false;
// Set fields list
$this->fields_list = array(
'customer' => array(
'title' => $this->l('Client'),
),
'reference' => array(
'title' => $this->l('Reference'),
'type' => 'text',
),
'name' => array(
'title' => $this->l('Fichier'),
'type' => 'text',
),
);
// Enable bootstrap
$this->bootstrap = true;
// Call of the parent constructor method
parent::__construct();
}
//public function init(){}
//public function setMedia(){}
public function postProcess()
{
if (Tools::getIsset('submitAddFiles')) {
$this->processUpload();
}
if (Tools::getIsset('deleteantadis_files')) {
$this->processDelete();
}
if (Tools::getIsset('download')) {
$this->processDownload();
}
parent::postProcess();
}
public function processDelete()
{
$id_file = Tools::getValue('id_file');
$id_customer = Tools::getValue('id_customer', 0);
$fileM = new Files($id_file);
$pathUpload = _PS_UPLOAD_DIR_.'customer/global';
if ($id_customer > 0) {
$pathUpload = _PS_UPLOAD_DIR_.'customer/'.$id_customer;
}
if (file_exists($pathUpload.'/'.$fileM->name)) {
unlink($pathUpload.'/'.$fileM->name);
}
$isDeleted = $fileM->delete();
if ($isDeleted) {
$link = $this->context->link->getAdminLink('AdminAntadisFiles', true);
if ($id_customer > 0) {
$link.= '&id_customer='.$id_customer;
}
Tools::redirectAdmin($link);
} else {
Tools::displayError("Error : Can't delete file");
}
}
public function processUpload()
{
if (!$reference = Tools::getValue('reference')) {
$this->errors[] = Tools::displayError("Error : no reference");
}
$id_customer = Tools::getValue('id_customer', 0);
if(count($this->errors) == 0 && isset($_FILES) && count($_FILES['file']) > 0) {
if ($_FILES['file']['error'] == UPLOAD_ERR_OK) {
$file = $_FILES['file'];
$isInsert = $isUpload = false;
// File
$pathUpload = _PS_UPLOAD_DIR_.'customer/global';
if ($id_customer > 0) {
$pathUpload = _PS_UPLOAD_DIR_.'customer/'.$id_customer;
}
if (!file_exists($pathUpload)) {
mkdir($pathUpload, 0777, true);
}
$isUpload = move_uploaded_file($file['tmp_name'], $pathUpload.'/'.$file['name']);
// Form
if ($isUpload) {
$fileM = new Files();
$fileM->id_customer = $id_customer;
$fileM->name = $file['name'];
$fileM->reference = $reference;
$fileM->added = date('Ymdhis');
$isInsert = $fileM->add();
}
if (!$isInsert || !$isUpload) {
Tools::displayError("Error : Can't add file");
}
} else {
$this->errors[] = Tools::displayError("Error : file not sent");
}
}
}
public function processDownload()
{
$id_file = Tools::getValue('id_file');
$fileM = new Files($id_file);
$filename = $fileM->name;
$pathUpload = _PS_UPLOAD_DIR_.'customer/global';
if ($fileM->id_customer > 0) {
$pathUpload = _PS_UPLOAD_DIR_.'customer/'.$fileM->id_customer;
}
$file = $pathUpload.'/'.$filename;
if (file_exists($file)) {
$content_type = 'application/pdf';
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: inline; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
}
//public function initHeader(){}
//public function initContent(){}
//public function initFooter(){}
public function renderList()
{
$id_customer = (int)Tools::getValue('id_customer', 0);
$customer = null;
$this->toolbar_btn = array();
if ($id_customer > 0) {
$this->_where = ' AND a.`id_customer`='.(int)$id_customer;
$customer = new Customer($id_customer);
// Override page title
$this->page_header_toolbar_title.= ' : '.$customer->email;
$this->toolbar_title[count($this->toolbar_title)-1].= ' : '.$customer->email;
}
else {
// Override page title
$this->page_header_toolbar_title.= ' : Global';
$this->toolbar_title[count($this->toolbar_title)-1].= ' : Global';
}
$this->_select = ' CONCAT(CONCAT_WS(" ", c.`firstname`, c.`lastname`), " (", c.`email`, ")") AS customer';
$this->_join = ' LEFT JOIN `'._DB_PREFIX_.'customer` c ON(c.`id_customer` = a.`id_customer`)';
$this->_orderBy = 'added';
$this->_orderWay = 'DESC';
$this->addRowAction('download');
$this->addRowAction('delete');
$list = parent::renderList();
// Create upload view
$tpl = $this->context->smarty->createTemplate(_PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/upload.tpl');
$tpl->assign(array(
'customer' => $customer,
));
$html = $tpl->fetch();
return $html.$list;
}
public function renderForm()
{
$id_file = Tools::getValue('id_file');
$id_customer = Tools::getValue('id_customer');
$fileM = new Files($id_file);
// Override page title
$this->page_header_toolbar_title.= ' - '.$fileM->reference;
// Override cancel
if ($id_customer) {
self::$currentIndex = self::$currentIndex.'&id_customer='.(int)$id_customer;
}
$this->fields_form = array(
'legend' => array('title' => $this->l('Edit file reference')),
'input' => array(
'id_file' => array(
'type' => 'hidden',
),
'id_customer' => array(
'type' => 'hidden',
),
'reference' => array(
'type' => 'text',
'name' => 'reference'
),
'name' => array(
'type' => 'hidden',
),
'added' => array(
'type' => 'hidden',
),
),
'submit' => array('title' => $this->l('Save')),
);
$this->fields_value = array(
'id_file' => $fileM->id,
'id_customer' => $fileM->id_customer,
'reference' => $fileM->reference,
'name' => $fileM->name,
'added' => $fileM->added,
);
return parent::renderForm();
}
public function displayDownloadLink($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('helpers/list/list_action_details.tpl');
if (!array_key_exists('Download', self::$cache_lang)) {
self::$cache_lang['Download'] = $this->l('Download', 'Helper');
}
$link = $this->context->link->getAdminLink('AdminAntadisFiles', true);
$tpl->assign(array(
'href' => $link.'&download&id_file='.$id,
'action' => self::$cache_lang['Download'],
'id' => $id
));
return $tpl->fetch();
}
}

View File

@ -0,0 +1,40 @@
<?php
class AntadisFilesGetModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$id = Tools::getValue('id');
$filename = Tools::getValue('q');
$fileM = new Files($id);
if ($fileM->name != $filename) {
http_response_code(403);
exit('403 Forbidden');
}
$pathUpload = _PS_UPLOAD_DIR_.'customer/global';
if ($fileM->id_customer > 0) {
$pathUpload = _PS_UPLOAD_DIR_.'customer/'.$fileM->id_customer;
}
$file = $pathUpload.'/'.$filename;
if (file_exists($file)) {
$content_type = 'application/pdf';
ini_set('zlib.output_compression', '0');
header('Content-Transfer-Encoding: none');
header('Content-Type: ' . $content_type.'');
header('Content-Length: ' . filesize($file));
header('Content-MD5: ' . base64_encode(md5_file($file)));
header('Content-Disposition: inline; filename="' . basename($file) . '"');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
readfile($file);
exit;
}
http_response_code(404);
exit('404 Not Found');
}
}

View File

@ -0,0 +1,34 @@
<?php
class AntadisFilesListModuleFrontController extends ModuleFrontController
{
public function initContent()
{
parent::initContent();
$id_customer = $this->context->customer->id;
$fileM = new Files();
// Get number of files
$nb_files = $fileM->getCustomerNbFiles($id_customer);
// Init
$nb_per_page = 50;
$nb_pages = ceil($nb_files / $nb_per_page);
$page = (int)Tools::getValue('page', 1);
if ($page < 1) {
$page = 1;
}
$limit_start = ($page - 1) * $nb_per_page;
$limit_end = $nb_per_page;
// Get comments
$files = $fileM->getCustomerFiles($id_customer, $limit_start, $limit_end);
// Assign comments and product object
$this->context->smarty->assign('files', $files);
$this->context->smarty->assign('page', $page);
$this->context->smarty->assign('nb_pages', $nb_pages);
$this->setTemplate('list.tpl');
}
}

View File

@ -0,0 +1,34 @@
<?php
class AntadisFilesDisplayAdminCustomersController
{
public function __construct($module, $file, $path)
{
$this->file = $file;
$this->module = $module;
$this->context = Context::getContext();
$this->_path = $path;
}
public function run()
{
$id_customer = (int)Tools::getValue('id_customer');
$nbFiles = 0;
$files = array();
if ($id_customer > 0) {
// Get files list
$filesM = new Files();
$nbFiles = $filesM->getAdminCustomerNbFiles($id_customer);
$files = $filesM->getAdminCustomerFiles($id_customer, 10);
}
$this->context->smarty->assign(array(
'id_customer' => $id_customer,
'nbFiles' => $nbFiles,
'files' => $files,
));
return $this->module->display($this->file, 'displayAdminCustomers.tpl');
}
}

View File

@ -0,0 +1,26 @@
<?php
class AntadisFilesDisplayBackOfficeHeaderController
{
public function __construct($module, $file, $path)
{
$this->file = $file;
$this->module = $module;
$this->context = Context::getContext();
$this->_path = $path;
}
public function run($params)
{
// If we are not on section modules, we do not add JS file
if (!in_array(Tools::getValue('controller'), array('AdminCustomers', 'AdminAntadisFiles'))) {
return '';
}
// Assign module base dir
$this->context->smarty->assign('pc_base_dir', __PS_BASE_URI__.'modules/'.$this->module->name.'/');
// Display template
return $this->module->display($this->file, 'displayBackOfficeHeader.tpl');
}
}

View File

@ -0,0 +1,17 @@
<?php
class AntadisFilesGetContentController
{
public function __construct($module, $file, $path)
{
$this->file = $file;
$this->module = $module;
$this->context = Context::getContext();
$this->_path = $path;
}
public function run()
{
return $this->module->display($this->file, 'getContent.tpl');
}
}

View File

@ -0,0 +1,44 @@
<?php
class AntadisFilesModulesRoutesController
{
public function run()
{
return array(
'module-antadisfiles-list' => array(
'controller' => 'list',
'rule' => 'mydownloads/list{/page/:page}',
'keywords' => array(
'page' => array(
'regexp' => '[\d]+',
'param' => 'page'
),
),
'params' => array(
'fc' => 'module',
'module' => 'antadisfiles',
'controller' => 'list'
)
),
'module-antadisfiles-get' => array(
'controller' => 'get',
'rule' => 'mydownloads/get{/:id}{/:q}',
'keywords' => array(
'q' => array(
'regexp' => '[\w-\. ]+',
'param' => 'q'
),
'id' => array(
'regexp' => '[\d]+',
'param' => 'id'
),
),
'params' => array(
'fc' => 'module',
'module' => 'antadisfiles',
'controller' => 'get'
)
),
);
}
}

View File

@ -0,0 +1,8 @@
CREATE TABLE IF NOT EXISTS `PREFIX_antadis_files` (
`id_file` int(11) NOT NULL AUTO_INCREMENT,
`id_customer` int(11) NOT NULL DEFAULT '0',
`reference` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`added` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id_file`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

View File

@ -0,0 +1,4 @@
<?php
header("Location: ../");
exit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -0,0 +1,21 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{antadisfiles}prestashop>antadisfiles_8c60b56cb112d1abbff3fd78de0514f9'] = 'Fichiers client';
$_MODULE['<{antadisfiles}prestashop>antadisfiles_beb81167411200bd66e2439be28f0ab2'] = 'Avec ce module, vous pouvez associer des fichiers à vos clients';
$_MODULE['<{antadisfiles}prestashop>adminantadisfilescontroller_577d7068826de925ea2aec01dbadf5e4'] = 'Client';
$_MODULE['<{antadisfiles}prestashop>adminantadisfilescontroller_63d5049791d9d79d86e9a108b0a999ca'] = 'Référence';
$_MODULE['<{antadisfiles}prestashop>adminantadisfilescontroller_a7516634dda136a038e76e37bf15e7ec'] = 'Fichier';
$_MODULE['<{antadisfiles}prestashop>adminantadisfilescontroller_75c0912ebad8851ac872b6055a1dd7ce'] = 'Editer la référence fichier';
$_MODULE['<{antadisfiles}prestashop>upload_94495b6b79180d544e53ae9a0ded9aff'] = 'Choisir un fichier';
$_MODULE['<{antadisfiles}prestashop>upload_ec183306633f912ff99285620fb3793e'] = 'Ajouter le fichier';
$_MODULE['<{antadisfiles}prestashop>list_f83dea9405cc68eacb68a3224e51f968'] = 'Vos téléchargements';
$_MODULE['<{antadisfiles}prestashop>list_c521b7a548c42eb16fd317e357a1988d'] = 'Liste des fichiers à télécharger';
$_MODULE['<{antadisfiles}prestashop>list_63d5049791d9d79d86e9a108b0a999ca'] = 'Référence';
$_MODULE['<{antadisfiles}prestashop>list_0b27918290ff5323bea1e3b78a9cf04e'] = 'Fichier';
$_MODULE['<{antadisfiles}prestashop>list_70e44c96a76c910aa18b40e143661d71'] = 'Aucun fichier de disponible';
$_MODULE['<{antadisfiles}prestashop>displayadmincustomers_d3fcac47f342842c8b0a6361c1d776bc'] = 'Fichiers liés au client';
$_MODULE['<{antadisfiles}prestashop>displayadmincustomers_63d5049791d9d79d86e9a108b0a999ca'] = 'Référence';
$_MODULE['<{antadisfiles}prestashop>displayadmincustomers_a7516634dda136a038e76e37bf15e7ec'] = 'Fichier';
$_MODULE['<{antadisfiles}prestashop>displayadmincustomers_ac0c0db9735061f3bbd512983edb1dea'] = 'Aucun fichier lié au client';

View File

@ -0,0 +1,58 @@
window.onload = function() {
$(document).ready(function(){
$('#file-selectbutton').click(function(e) {
$('#file').trigger('click');
});
$('#file-name').click(function(e) {
$('#file').trigger('click');
});
$('#file-name').on('dragenter', function(e) {
e.stopPropagation();
e.preventDefault();
});
$('#file-name').on('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
});
$('#file-name').on('drop', function(e) {
e.preventDefault();
var files = e.originalEvent.dataTransfer.files;
$('#file')[0].files = files;
$(this).val(files[0].name);
});
$('#file').change(function(e) {
if ($(this)[0].files !== undefined)
{
var files = $(this)[0].files;
var name = '';
$.each(files, function(index, value) {
name += value.name+', ';
});
$('#file-name').val(name.slice(0, -2));
}
else // Internet Explorer 9 Compatibility
{
var name = $(this).val().split(/[\\/]/);
$('#file-name').val(name[name.length-1]);
}
});
if (typeof file_max_files !== 'undefined')
{
$('#file').closest('form').on('submit', function(e) {
if ($('#file')[0].files.length > file_max_files) {
e.preventDefault();
alert('You can upload a maximum of files');
}
});
}
});
}

View File

@ -0,0 +1,25 @@
<div class="panel">
{if isset($customer)}
<div class="panel-heading">{l s="Ajout de fichier pour le client" mod="antadisfiles"} {$customer->email}</div>
{else}
<div class="panel-heading">{l s="Ajout de fichier disponible pour tous les clients" mod="antadisfiles"}</div>
{/if}
<div class="panel-body">
<form method="POST" action="#" enctype="multipart/form-data" class="form-inline">
<input id="file" type="file" name="file" class="hide" accept=".pdf">
<div class="dummyfile input-group">
<span class="input-group-addon"><i class="icon-file"></i></span>
<input id="file-name" type="text" name="filename" readonly/>
<span class="input-group-btn">
<button id="file-selectbutton" type="button" class="btn btn-default">
<i class="icon-folder-open"></i> {l s='Choisir un fichier' mod='antadisfiles'}</button>
</span>
</div>
<div class="form-group">
<label class="sr-only" for="reference">Reference</label>
<input type="text" class="form-control" id="reference" name="reference" placeholder="Reference" value=""/>
</div>
<button type="submit" name="submitAddFiles" class="btn btn-default">{l s='Ajouter le fichier' mod='antadisfiles'}</button>
</form>
</div>
</div>

View File

@ -0,0 +1,67 @@
{capture name=title}{l s='Your downloads' mod='antadisfiles'}{/capture}
{capture name=subtitle}{l s='Here you will find your files to download' mod='antadisfiles'}{/capture}
<main>
<section>
{include file="$tpl_dir./page-heading.tpl" title=$smarty.capture.title subtitle=$smarty.capture.subtitle type='account'}
{if $slowValidation}
<p class="alert alert-warning">{l s='If you have just placed an order, it may take a few minutes for it to be validated. Please refresh this page if your order is missing.'}</p>
{/if}
<div class="ctn account">
<div class="row">
<div class="md12">
<div class="box">
<div class="inner">
<h2 class="title">{l s='Your downloads' mod='antadisfiles'}</h2>
<div class="box-content">
{if $files && count($files)}
<div class="table-div">
<div class="table-head">
<div class="md2 hidden-sm hidden-xs hidden-xxs">{l s='Reference' mod='antadisfiles'}</div>
<div class="md2 hidden-sm hidden-xs hidden-xxs">{l s='File' mod='antadisfiles'}</div>
</div>
{foreach $files as $f}
<div class="table-row row{$smarty.foreach.myLoop.index % 2}">
<div class="md2">
{$f.reference}
</div>
<div class="md2">
{assign var=params value=[
'id' => $f.id_file,
'q' => $f.name
]}
<a href="{$link->getModuleLink('antadisfiles', 'get', $params)|escape:'html':'UTF-8'}" target="_blank">{$f.name}</a>
</div>
</div>
{/foreach}
</div>
{else}
<p class="alert alert-warning">{l s='No file is available.' mod='antadisfiles'}</p>
{/if}
{if $nb_pages > 1}
<ul class="pagination">
{for $count=1 to $nb_pages}
{assign var=params value=[
'page' => $count
]}
{if $page ne $count}
<li><a href="{$link->getModuleLink('antadisfiles', 'list', $params)|escape:'html':'UTF-8'}"><span>{$count}</span> </a></li>
{else}
<li class="active current"><span><span>{$count}</span></span> </li>
{/if}
{/for}
</ul>
{/if}
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>

View File

@ -0,0 +1,37 @@
<div class="col-lg-12">
<div class="panel">
<div class="panel-heading">
<i class="icon-file"></i> {l s='Fichiers liés au client' mod='antadisfiles'}<span class="badge">{$nbFiles}</span>
<div class="panel-heading-action">
<a class="btn btn-default" href="{$link->getAdminLink('AdminAntadisFiles', true)|escape:'html':'UTF-8'}&id_customer={$id_customer}">Voir tous les fichiers liés au client</a>
</div>
</div>
{if $nbFiles > 0}
<table class="table">
<thead>
<tr>
<th><span class="title_box">{l s='Reference' mod='antadisfiles'}</span></th>
<th><span class="title_box">{l s='Fichier' mod='antadisfiles'}</span></th>
</tr>
</thead>
<tbody>
{foreach $files as $k => $v}
<tr>
<td>{$v['reference']}</td>
<td>
{assign var=params value=[
'id' => $v.id_file,
'q' => $v.name
]}
<a href="{$link->getModuleLink('antadisfiles', 'get', $params)|escape:'html':'UTF-8'}" target="_blank">{$v['name']}</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
{else}
<p>{l s='Aucun fichier lié au client' mod='antadisfiles'}</p>
{/if}
</div>
</div>

View File

@ -0,0 +1 @@
<script type="text/javascript" src="{$pc_base_dir}views/assets/js/addfile.js"></script>

View File

@ -0,0 +1,3 @@
{if isset($confirmation)}
<div class="alert alert-success">{l s='Settings updated' mod='antadisfiles'}</div>
{/if}

View File

@ -3,13 +3,14 @@ define('ANTADIS_CHECK_GROUPS', true);
class FrontController extends FrontControllerCore class FrontController extends FrontControllerCore
{ {
public function display() public function display()
{ {
global $cookie; global $cookie;
if (empty($cookie->tmp)) { if (empty($cookie->tmp)) {
$cookie->tmp = serialize($this->errors); $cookie->tmp = serialize($this->errors);
} }
if (defined('ANTADIS_CHECK_GROUPS') && ANTADIS_CHECK_GROUPS) { if (defined('ANTADIS_CHECK_GROUPS') && ANTADIS_CHECK_GROUPS) {
$id_customer_group = Configuration::get('PS_CUSTOMER_GROUP'); $id_customer_group = Configuration::get('PS_CUSTOMER_GROUP');
if ($id_customer_group!==FALSE && (int)$id_customer_group>0) { if ($id_customer_group!==FALSE && (int)$id_customer_group>0) {
@ -36,21 +37,25 @@ class FrontController extends FrontControllerCore
} }
/* /*
* Force assign template // * Force assign template
*/ // */
if (!$cookie->isLogged()) { if (!$cookie->isLogged()
&& (!Context::getContext()->controller instanceOf addCustomerFormModuleFrontController)
) {
$this->template = _PS_THEME_DIR_.'authentication.tpl'; $this->template = _PS_THEME_DIR_.'authentication.tpl';
if ($this->php_self == 'password') { if ($this->php_self == 'password') {
$this->php_self = 'index'; $this->php_self = 'index';
$this->template = _PS_THEME_DIR_.'password.tpl'; $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'); Tools::redirect('index');
exit; exit;
} }
} }
Tools::safePostVars(); Tools::safePostVars();
// assign css_files and js_files at the very last time // assign css_files and js_files at the very last time
@ -67,7 +72,7 @@ class FrontController extends FrontControllerCore
/* Override destroy all css */ /* Override destroy all css */
$this->css_files = array(); $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_.'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_.'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'; $this->css_files[_THEME_CSS_DIR_.'global.css?v='.filemtime($this->getThemeDir().'css/global.css')] = 'all';
@ -141,14 +146,15 @@ class FrontController extends FrontControllerCore
return true; return true;
} }
public function getLayout() public function getLayout()
{ {
global $cookie; global $cookie;
$entity = $this->php_self; $entity = $this->php_self;
if (!$cookie->isLogged()) { 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'); Tools::redirect('index');
exit; exit;

View File

@ -14,12 +14,13 @@
<main> <main>
<section> <section>
{include file="$tpl_dir./page-heading.tpl" title=$smarty.capture.title type=''} {include file="$tpl_dir./page-heading.tpl" title=$smarty.capture.title type=''}
<p style="text-align: center;color: #fff;font-size: 16px;">{l s='Tel : 01 80 91 74 21'}</p>
<div id="auth" class="ctn"> <div id="auth" class="ctn">
<div class="row"> <div class="row">
<!-- Connexion --> <!-- Connexion -->
<div class="offset-lg3 lg6 offset-md2 md8 sm12"> <div class="lg6 md6 sm12 xs12">
<form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="login_form" class="box"> <form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="login_form" class="box">
<div class="inner"> <div class="inner">
<h2 class="title">{l s='Already registered?'}</h2> <h2 class="title">{l s='Already registered?'}</h2>
@ -44,6 +45,7 @@
</div> </div>
</form> </form>
</div> </div>
{hook h="DisplayHomeAddCusto"}
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
{if !isset($content_only) || !$content_only} {if !isset($content_only) || !$content_only}
{if $page_name != 'category' && $page_name != 'index' && $page_name != 'search' && $page_name != 'password'} {if $page_name != 'category' && $page_name != 'index' && $page_name != 'search' && $page_name != 'password' && $page_name != 'module-addcustomer-form'}
<footer id="footer"> <footer id="footer">
<div class="ctn"> <div class="ctn">
{hook h='displayReassurance'} {hook h='displayReassurance'}

View File

@ -50,7 +50,7 @@
</div> </div>
{/if} {/if}
{$page_array = ['index', 'password']} {$page_array = ['index', 'password', 'module-addcustomer-form']}
<header id="header"> <header id="header">
<div class="ctn"> <div class="ctn">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,12 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{antadisfiles}roykin>antadisfiles_8c60b56cb112d1abbff3fd78de0514f9'] = 'Fichiers client';
$_MODULE['<{antadisfiles}roykin>antadisfiles_beb81167411200bd66e2439be28f0ab2'] = 'Avec ce module, vous pouvez assignez des fichiers à vos clients';
$_MODULE['<{antadisfiles}roykin>adminantadisfilescontroller_63d5049791d9d79d86e9a108b0a999ca'] = 'Référence';
$_MODULE['<{antadisfiles}roykin>adminantadisfilescontroller_75c0912ebad8851ac872b6055a1dd7ce'] = 'Editer la référence du fichier';
$_MODULE['<{antadisfiles}roykin>list_f83dea9405cc68eacb68a3224e51f968'] = 'Vos téléchargements';
$_MODULE['<{antadisfiles}roykin>list_63d5049791d9d79d86e9a108b0a999ca'] = 'Référence';
$_MODULE['<{antadisfiles}roykin>list_0b27918290ff5323bea1e3b78a9cf04e'] = 'Fichier';
$_MODULE['<{antadisfiles}roykin>list_70e44c96a76c910aa18b40e143661d71'] = 'Aucun fichier de disponible';

View File

@ -6,13 +6,23 @@
<a href="{$link->getPageLink('history', true)|escape:'html':'UTF-8'}" title="{l s='My orders' mod='blockmyaccount'}"> <a href="{$link->getPageLink('history', true)|escape:'html':'UTF-8'}" title="{l s='My orders' mod='blockmyaccount'}">
{l s='My orders' mod='blockmyaccount'} {l s='My orders' mod='blockmyaccount'}
</a> </a>
{if Module::isEnabled('allinone_rewards') && isset($link_rewards)}
/
<a href="{$link_rewards}" title="{l s='My rewards' mod='blockmyaccount'}">
{l s='My rewards' mod='blockmyaccount'}
</a>
{/if}
</li> </li>
{if Module::isEnabled('allinone_rewards') && isset($link_rewards)}
<li>
<a href="{$link_rewards}" title="{l s='My rewards' mod='blockmyaccount'}">
{l s='My rewards' mod='blockmyaccount'}
</a>
</li>
{/if}
{if Module::isEnabled('antadisfiles')}
<li>
{assign var=params value=[
'page' => 1
]}
<a href="{$link->getModuleLink('antadisfiles', 'list', $params)|escape:'html':'UTF-8'}">
{l s='Mes téléchargements'}</a>
</li>
{/if}
<li> <li>
<a href="{$link->getPageLink('index', true, NULL, 'mylogout')|escape:'html'}" title="{l s='Logout'}"> <a href="{$link->getPageLink('index', true, NULL, 'mylogout')|escape:'html'}" title="{l s='Logout'}">
<span>{l s='Logout' mod='blockmyaccount'}</span> <span>{l s='Logout' mod='blockmyaccount'}</span>