ticket-12948-PrivatesaleNewsletter
This commit is contained in:
parent
434816c22c
commit
2641936fae
@ -20,7 +20,7 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
<div class="margin-form">
|
||||
<div id="title" style="float: left;">
|
||||
<div style="margin-bottom:10px;">
|
||||
FR : <input type="text" style="width: 500px;" name="title" value="'. Configuration::get('TITLE_NEWS_DIMANCHE') .'" />
|
||||
FR : <input type="text" style="width: 500px;" name="title" value="'. Configuration::get('TITLE_NEWS_DIMANCHE') .'" />
|
||||
</div>
|
||||
<div style="margin:10px 0;">
|
||||
ES : <input type="text" style="width: 500px;" name="title_es" value="'. Configuration::get('TITLE_NEWS_DIMANCHE_ES') .'" />
|
||||
@ -31,7 +31,7 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
|
||||
echo '
|
||||
<div class="margin-form">
|
||||
<input type="submit" class="button" name="submitTitleDimanche" value="'.$this->l('Update this title').'" />
|
||||
<input type="submit" class="button" name="submitTitleDimanche" value="'.$this->l('Update this title').'" />
|
||||
</div>';
|
||||
|
||||
echo '</fieldset>
|
||||
@ -78,11 +78,11 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
<select id="version" name="version">
|
||||
<option '.($this->curnewsletter !== NULL ? ($this->curnewsletter['version'] == 'fr' ? 'selected' : '' ) : 'selected').' value="fr">FR</option>
|
||||
<option '.($this->curnewsletter !== NULL ? ($this->curnewsletter['version'] == 'es' ? 'selected' : '' ) : '').' value="es">ES</option>
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>';
|
||||
|
||||
|
||||
echo '<br class="clear" />
|
||||
<div class="margin-form">
|
||||
<input type="hidden" name="id_newsletter" value="'.($this->curnewsletter !== NULL? $this->curnewsletter['id_newsletter']: '').'" />
|
||||
@ -112,7 +112,7 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
<legend><img src="'.__PS_BASE_URI__.'modules/privatesales_newsletter/prefs.gif" alt="" title="" /> '.$this->l('Vente en avant').'</legend>
|
||||
<form action="'.$currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesNewsletter').'" method="post">
|
||||
<table class="table" style="width: 100%;">';
|
||||
|
||||
|
||||
$sales = Sale::getSales(NULL, NULL, NULL, 'not_ended', FALSE, FALSE, '`position` DESC');
|
||||
$ids = array();
|
||||
foreach ($sales as $key => $sale) {
|
||||
@ -157,7 +157,7 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
ORDER BY `id_newsletter` DESC
|
||||
LIMIT 30
|
||||
') as $news) {
|
||||
|
||||
|
||||
echo '<tr>
|
||||
<td>'.$news['id_newsletter'].'</td>
|
||||
<td>'.$news['title'].'</td>
|
||||
@ -179,18 +179,26 @@ 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')) {
|
||||
// echo $this->displayError($this->l('An error occured during the image upload.'));
|
||||
@ -212,7 +220,7 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
WHERE `id_newsletter` = '.$id_newsletter.'
|
||||
');
|
||||
}
|
||||
|
||||
|
||||
// if(isset($_FILES['image']) && $_FILES['image']['name'] != '') {
|
||||
// if(!copy($_FILES['image']['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/newsletter/'.$id_newsletter.'.jpg')) {
|
||||
// echo $this->displayError($this->l('An error occured during the image upload.'));
|
||||
@ -227,9 +235,9 @@ class AdminPrivateSalesNewsletter extends AdminTab {
|
||||
} else if(Tools::isSubmit('submitTitleDimanche')) {
|
||||
Configuration::updateValue('TITLE_NEWS_DIMANCHE', Tools::getValue('title'));
|
||||
Configuration::updateValue('TITLE_NEWS_DIMANCHE_ES', Tools::getValue('title_es'));
|
||||
|
||||
|
||||
Configuration::updateValue('TITLE_NEWS_LAST_DAY', Tools::getValue('title_last_day'));
|
||||
|
||||
|
||||
Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesNewsletter'));
|
||||
} else if(Tools::isSubmit('submitForwardSale')) {
|
||||
$forward = Tools::getValue('sale_forward', 0);
|
||||
|
Loading…
Reference in New Issue
Block a user