Fix database insert
This commit is contained in:
parent
0e32796c24
commit
854bdca3fd
@ -3,6 +3,12 @@
|
||||
class Process
|
||||
{
|
||||
private $data;
|
||||
private $mail_dir;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->mail_dir = dirname(__FILE__).'/mails/';
|
||||
}
|
||||
|
||||
public function addProvider($post)
|
||||
{
|
||||
@ -13,28 +19,39 @@ class Process
|
||||
$errors[] = 'All fields are not filled';
|
||||
}
|
||||
|
||||
$query = Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'contactform`(brand, compagny, lastname, firstname, function, email1, email2, phone1, phone2, purpose, content, date_add, type)
|
||||
VALUES("'.pSQL($this->data['brand']).'",
|
||||
"'.pSQL($this->data['compagny']).'",
|
||||
"'.pSQL($this->data['lastname']).'",
|
||||
"'.pSQL($this->data['firstname']).'",
|
||||
"'.pSQL($this->data['function']).'",
|
||||
"'.pSQL($this->data['email1']).'",
|
||||
"'.pSQL($this->data['email2']).'",
|
||||
"'.pSQL($this->data['phone1']).'",
|
||||
"'.pSQL($this->data['phone2']).'",
|
||||
"'.pSQL($this->data['purpose']).'",
|
||||
"'.pSQL($this->data['content']).'",
|
||||
NOW(),
|
||||
'.Contactform::TYPE_PROVIDER.')');
|
||||
|
||||
var_dump(Db::getInstance()->getMsgError());
|
||||
$query = Db::getInstance()->autoExecute(_DB_PREFIX_.'contactform', [
|
||||
'brand' => pSQL($this->data['brand']),
|
||||
'compagny' => pSQL($this->data['compagny']),
|
||||
'lastname' => pSQL($this->data['lastname']),
|
||||
'firstname' => pSQL($this->data['firstname']),
|
||||
'function' => pSQL($this->data['function']),
|
||||
'email1' => pSQL($this->data['email1']),
|
||||
'email2' => pSQL($this->data['email2']),
|
||||
'phone1' => pSQL($this->data['phone1']),
|
||||
'phone2' => pSQL($this->data['phone2']),
|
||||
'purpose' => pSQL($this->data['purpose']),
|
||||
'content' => pSQL($this->data['content']),
|
||||
'type' => Contactform::TYPE_PROVIDER
|
||||
], 'INSERT');
|
||||
|
||||
if (!$query) {
|
||||
$errors[] = "something went wrong";
|
||||
}
|
||||
|
||||
Mail::Send(
|
||||
intval($cookie->id_lang),
|
||||
'provider',
|
||||
'sujet',
|
||||
[],
|
||||
'simonet@antadis.fr',
|
||||
NULL,
|
||||
$this->data['email1'],
|
||||
$this->data['lastname'].' '.$this->data['firstname'],
|
||||
NULL,
|
||||
NULL,
|
||||
$this->mail_dir
|
||||
);
|
||||
|
||||
return ['errors' => $errors];
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ class Contactform extends Module {
|
||||
$this->displayName = $this->l('Contact form for press and providers');
|
||||
$this->description = $this->l('Integrate contact form.');
|
||||
|
||||
//$this->confirmUninstall = $this->l('All sponsors and friends will be deleted. Are you sure you want to uninstall this module?');
|
||||
$this->_errors = array();
|
||||
}
|
||||
|
||||
|
@ -4,38 +4,38 @@
|
||||
<div id="idTab1">
|
||||
|
||||
<form action="/modules/contactform/provider.php" method="post">
|
||||
<label for="brand">{l s='brand' mod='contactform'}</label>
|
||||
<label for="brand">{l s='brand' mod='contactform'}*</label>
|
||||
<input type="text" name="brand" id="brand">
|
||||
|
||||
<label for="compagny">{l s='compagny' mod='contactform'}</label>
|
||||
<label for="compagny">{l s='compagny' mod='contactform'}*</label>
|
||||
<input type="text" name="compagny" id="compagny">
|
||||
|
||||
<label for="lastname">{l s='lastname' mod='contactform'}</label>
|
||||
<label for="lastname">{l s='lastname' mod='contactform'}*</label>
|
||||
<input type="text" name="lastname" id="lastname">
|
||||
|
||||
<label for="firstname">{l s='firstname' mod='contactform'}</label>
|
||||
<label for="firstname">{l s='firstname' mod='contactform'}*</label>
|
||||
<input type="text" name="firstname" id="firstname">
|
||||
|
||||
<label for="function">{l s='function' mod='contactform'}</label>
|
||||
<label for="function">{l s='function' mod='contactform'}*</label>
|
||||
<input type="text" name="function" id="function">
|
||||
|
||||
<label for="email1">{l s='email' mod='contactform'}</label>
|
||||
<label for="email1">{l s='email' mod='contactform'}*</label>
|
||||
<input type="text" name="email1" id="email1">
|
||||
|
||||
<label for="email2">{l s='email_other' mod='contactform'}</label>
|
||||
<input type="text" name="email2" id="email2">
|
||||
|
||||
<label for="phone1">{l s='phone' mod='contactform'}</label>
|
||||
<label for="phone1">{l s='phone' mod='contactform'}*</label>
|
||||
<input type="text" name="phone1" id="phone1">
|
||||
|
||||
<label for="phone2">{l s='phone_other' mod='contactform'}</label>
|
||||
<input type="text" name="phone2" id="phone2">
|
||||
|
||||
<label for="purpose">{l s='purpose' mod='contactform'}</label>
|
||||
<label for="purpose">{l s='purpose' mod='contactform'}*</label>
|
||||
<input type="text" name="purpose" id="purpose">
|
||||
|
||||
<label for="content">{l s='content' mod='contactform'}</label>
|
||||
<input type="text" name="content" id="content">
|
||||
<label for="content">{l s='content' mod='contactform'}*</label>
|
||||
<textarea type="text" name="content" id="content"></textarea>
|
||||
|
||||
<input type="hidden" name="type" value="{Contactform::TYPE_PROVIDER}">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user