Merge remote-tracking branch 'origin/ticket/r13883-exportnewsletterpro' into dev

This commit is contained in:
Michael RICOIS 2017-08-28 10:31:34 +02:00
commit 5d7980ca13
4 changed files with 52 additions and 15 deletions

View File

@ -38,13 +38,15 @@
parent::__construct();
}
public function postProcess(){
public function postProcess()
{
parent::postProcess();
if (Tools::isSubmit('submitNewsletterExportPart')
|| Tools::isSubmit('submitNewsletterExportPartV2')
|| Tools::isSubmit('submitNewsletterExportPartV3')
|| Tools::isSubmit('submitNewsletterExportPartV4')
|| Tools::isSubmit('submitNewsletterExportPartV5')
|| Tools::isSubmit('submitNewsletterExportPartV6')
) {
$_GET['id_group'] = 3;
$this->trackingSuffix = 'PART';
@ -80,6 +82,12 @@
$this->version = 5;
$this->subVersion = true;
}
// Export Pro avec template v5
if (Tools::isSubmit('submitNewsletterExportPartV6')) {
$this->version = 5;
$_GET['id_group'] = 4;
$this->subVersion = true;
}
$this->exportNewsletter();
}
elseif (Tools::isSubmit('submitNewsletterExportPro')){
@ -100,8 +108,8 @@
}
}
public function renderForm(){
public function renderForm()
{
$options = array(
array(
'id_option' => 0,
@ -377,6 +385,20 @@
),
),
);
$formExportPartV6 = array(
'form' => array(
'legend' => array(
'title' => $this->l('Export PART PRO VERSION 5 - Newsletter LIGHT')
),
'input' => array(
),
'submit' => array(
'title' => $this->l('Export PART PRO V5'),
'name' => 'submitNewsletterExportPartV6'
),
),
);
$formExportPro = array(
'form' => array(
@ -392,13 +414,14 @@
)
);
$this->fields_form = array(
$this->fields_form = array(
$formSettings,
$formExportPart,
$formExportPartV2,
$formExportPartV3,
$formExportPartV4,
$formExportPartV5,
$formExportPartV6,
$formExportPro
);
@ -777,8 +800,8 @@
return $id_privatesalesList;
}
public function exportNewsletter(){
public function exportNewsletter()
{
$this->_params = array(
'date' => Tools::getValue('ANT_EXPORT_NEWSLETTER_DATE', Configuration::get('ANT_EXPORT_NEWSLETTER_DATE')),
'blog' => Tools::getValue('ANT_EXPORT_NEWSLETTER_BLOG', Configuration::get('ANT_EXPORT_NEWSLETTER_BLOG')),
@ -801,13 +824,11 @@
}*/
$date = $this->_params['date'];
$newPrivateSales = $this->_getPrivateSales($this->_getNewPrivateSalesQuery(), 0, NULL, self::TYPE_STARTING);
$id_privatesalesExcludeList = $this->_getIdPrivateSalesList($newPrivateSales);
$nearEndPrivateSales = $this->_getPrivateSales($this->_getNearEndPrivateSalesQuery(), 0, $id_privatesalesExcludeList, self::TYPE_CURRENT);
$id_privatesalesExcludeList = array_merge($id_privatesalesExcludeList, $this->_getIdPrivateSalesList($nearEndPrivateSales));
$currentPrivateSales = $this->_getPrivateSales($this->_getCurrentPrivateSalesQuery(), 0, $id_privatesalesExcludeList, self::TYPE_ENDING);
foreach ($newPrivateSales as $key => &$sale) {
$sale['link'] = urlencode($sale['link'].'?tr=NL'.date('dmy', strtotime($this->_params['date'])).'_'.$this->trackingSuffix);
}
@ -960,7 +981,8 @@
die();
}
public function renderView(){
public function renderView()
{
return $this->exportNewsletter();
}
}

View File

@ -1,6 +1,8 @@
<?php
include_once(_PS_MODULE_DIR_.'antadismarketing/antadismarketing.php');
ini_set('memory_limit', '2048M');
class AdminAntMarketingStatsController extends ModuleAdminController {
public $tracking_category = null;

View File

@ -521,7 +521,7 @@ class Mailjet_Sync extends Module
"fai" => $email,
"group" => $isPro ? 'Pro' : 'Particulier',
"date_inscription" => date('Y-m-d\TH:i:s\Z',strtotime($customer->date_add)),
"ref_inscription" => (int)strtotime($customer->date_add),
"ref_inscr" => (int)strtotime($customer->date_add),
"id" => $customer->id,
)
)
@ -555,6 +555,7 @@ class Mailjet_Sync extends Module
)
);
$mj = $this->getClient();
if ($mj->addDetailedContactToList($contacts, $lists)) {
return true;
} else {

View File

@ -302,7 +302,7 @@ class SaleCore extends ObjectModel{
}
elseif ($type == self::STATE_ARCHIVED) {
$sql .= ' AND `archived` = 1 ';
}
}
elseif ($type == self::STATE_HOTSPOT) {
$sql .= ' AND `date_start_hotspot` <= \''.$date_now.'\'
AND `date_end_hotspot` > \''.$date_now.'\'
@ -346,7 +346,8 @@ class SaleCore extends ObjectModel{
*
*/
public static function getSales($type = "all", $date_limit = 0, $active = TRUE, $archived = FALSE, $group = TRUE, $order_by = 'position', $order = 'ASC',$id_category = FALSE, $flashsale = FALSE, $newssale = NULL, $getCollection = FALSE){
public static function getSales($type = "all", $date_limit = 0, $active = TRUE, $archived = FALSE, $group = TRUE, $order_by = 'position', $order = 'ASC',$id_category = FALSE, $flashsale = FALSE, $newssale = NULL, $getCollection = FALSE)
{
$collection = new Collection('SaleCore', Context::getContext()->language->id);
$date_now = date('Y-m-d H:i:s');
@ -390,7 +391,18 @@ class SaleCore extends ObjectModel{
$collection->where('news', '=', 0);
}
if($group){
if (isset($_GET['id_group'])) {
$collection->Sqlwhere('EXISTS (
SELECT g.id_privatesales
FROM `' . _DB_PREFIX_ . 'privatesales_group` g
WHERE
a0.`id_privatesales` = g.`id_privatesales`
AND
g.id_group = '.(int)$_GET['id_group'].')
');
}
if($group) {
$collection->Sqlwhere('EXISTS (
SELECT g.id_privatesales
FROM `' . _DB_PREFIX_ . 'privatesales_group` g
@ -1087,14 +1099,14 @@ class SaleCore extends ObjectModel{
}
}
else {
$delivery_date_range = self::DATE_RANGE_OTHER_DELAY;
$delivery_date_range = self::DATE_RANGE_OTHER_DELAY;
break;
}
}
}
}
if ($delivery_date_range === self::DATE_RANGE_UNKNOWN &&
if ($delivery_date_range === self::DATE_RANGE_UNKNOWN &&
$date_delivery !== null) {
$delivery_date_range = array(