ticket-12948-PrivatesaleNewsletter

This commit is contained in:
Marion Muszynski 2017-04-25 15:56:28 +02:00
parent 434816c22c
commit 2641936fae

View File

@ -179,6 +179,13 @@ class AdminPrivateSalesNewsletter extends AdminTab {
global $cookie, $currentIndex;
if(Tools::isSubmit('submitNewsletterAdd')) {
$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,
@ -190,6 +197,7 @@ class AdminPrivateSalesNewsletter extends AdminTab {
)
');
$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')) {