ticket-12948-PrivatesaleNewsletter
This commit is contained in:
parent
434816c22c
commit
2641936fae
@ -179,17 +179,25 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
if(Tools::isSubmit('submitNewsletterAdd')) {
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'privatesale_newsletter` VALUES (
|
||||
DEFAULT,
|
||||
"'.pSQL(Tools::getValue('title')).'",
|
||||
"'.pSQL(Tools::getValue('image_url')).'",
|
||||
"'.pSQL(Tools::getValue('date_pub')).'",
|
||||
"'.pSQL(Tools::getValue('version')).'",
|
||||
"'.pSQL(Tools::getValue('preheader')).'"
|
||||
)
|
||||
');
|
||||
$id_newsletter = Db::getInstance()->Insert_ID();
|
||||
$date = Tools::getValue('date_pub');
|
||||
$now = date('Y-m-d');
|
||||
$now_seven_more = date('Y-m-d',strtotime($now.' + 7 days'));
|
||||
|
||||
if($date<$now || $date>$now_seven_more) {
|
||||
$this->_errors[] = Tools::displayError('Vous ne pouvez pas créer une newsletter dans le passé ou dans plus de 7 jours');
|
||||
} else {
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'privatesale_newsletter` VALUES (
|
||||
DEFAULT,
|
||||
"'.pSQL(Tools::getValue('title')).'",
|
||||
"'.pSQL(Tools::getValue('image_url')).'",
|
||||
"'.pSQL(Tools::getValue('date_pub')).'",
|
||||
"'.pSQL(Tools::getValue('version')).'",
|
||||
"'.pSQL(Tools::getValue('preheader')).'"
|
||||
)
|
||||
');
|
||||
$id_newsletter = Db::getInstance()->Insert_ID();
|
||||
}
|
||||
|
||||
// if(isset($_FILES['image']) && $_FILES['image']['name'] != '') {
|
||||
// if(!copy($_FILES['image']['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/newsletter/'.$id_newsletter.'.jpg')) {
|
||||
|
Loading…
Reference in New Issue
Block a user