diff --git a/adm/tabs/AdminImport.php b/adm/tabs/AdminImport.php index 30fbf0ba..a4e8773f 100755 --- a/adm/tabs/AdminImport.php +++ b/adm/tabs/AdminImport.php @@ -792,10 +792,10 @@ class AdminImport extends AdminTab VALUES ( '.(int) $product->id.', "'.pSQL($product->nc8).'", - '.(int) $product->origin_country_id.' + '. pSQL($product->origin_country_id).' ) ON DUPLICATE KEY UPDATE `nc8` = "'.pSQL($product->nc8).'", - `id_country` = '.(int) $product->origin_country_id.' + `id_country` = '.pSQL($product->origin_country_id).' '); } diff --git a/adm/tabs/AdminProducts.php b/adm/tabs/AdminProducts.php index d18903be..5b3e1cf4 100755 --- a/adm/tabs/AdminProducts.php +++ b/adm/tabs/AdminProducts.php @@ -1381,10 +1381,10 @@ class AdminProducts extends AdminTab VALUES ( '.(int) $object->id.', "'.pSQL(Tools::getValue('nc8')).'", - '.(int) Tools::getValue('id_country').' + '.pSQL(Tools::getValue('id_country')).' ) ON DUPLICATE KEY UPDATE `nc8` = "'.pSQL(Tools::getValue('nc8')).'", - `id_country` = '.(int) Tools::getValue('id_country').' + `id_country` = '.pSQL(Tools::getValue('id_country')).' '); if (Validate::isLoadedObject($object)) diff --git a/cgi-bin/index.php b/cgi-bin/index.php new file mode 100644 index 00000000..db7500da --- /dev/null +++ b/cgi-bin/index.php @@ -0,0 +1,25 @@ + +* @copyright 2007-2014 PrestaShop SA +* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../'); +exit; \ No newline at end of file diff --git a/cgi-bin/module_debian64bits_noyau2-6-18_libc2-3-6.cgi b/cgi-bin/module_debian64bits_noyau2-6-18_libc2-3-6.cgi new file mode 100644 index 00000000..32d5a353 Binary files /dev/null and b/cgi-bin/module_debian64bits_noyau2-6-18_libc2-3-6.cgi differ diff --git a/cgi-bin/modulev2.cgi b/cgi-bin/modulev2.cgi new file mode 100644 index 00000000..a91148ae Binary files /dev/null and b/cgi-bin/modulev2.cgi differ diff --git a/cgi-bin/modulev2.cgi_pour libc_2.7 b/cgi-bin/modulev2.cgi_pour libc_2.7 new file mode 100644 index 00000000..64805e25 Binary files /dev/null and b/cgi-bin/modulev2.cgi_pour libc_2.7 differ diff --git a/cgi-bin/modulev2_CentOS_42.cgi b/cgi-bin/modulev2_CentOS_42.cgi new file mode 100644 index 00000000..e863aaa2 Binary files /dev/null and b/cgi-bin/modulev2_CentOS_42.cgi differ diff --git a/cgi-bin/modulev2_Linux64bits.cgi b/cgi-bin/modulev2_Linux64bits.cgi new file mode 100644 index 00000000..7c59c847 Binary files /dev/null and b/cgi-bin/modulev2_Linux64bits.cgi differ diff --git a/cgi-bin/modulev2_SCO.cgi b/cgi-bin/modulev2_SCO.cgi new file mode 100644 index 00000000..0819af19 Binary files /dev/null and b/cgi-bin/modulev2_SCO.cgi differ diff --git a/cgi-bin/modulev2__old.cgi b/cgi-bin/modulev2__old.cgi new file mode 100644 index 00000000..9d672f89 Binary files /dev/null and b/cgi-bin/modulev2__old.cgi differ diff --git a/cgi-bin/modulev2_aix_bullescala.cgi b/cgi-bin/modulev2_aix_bullescala.cgi new file mode 100644 index 00000000..1b262775 Binary files /dev/null and b/cgi-bin/modulev2_aix_bullescala.cgi differ diff --git a/cgi-bin/modulev2_cobalt.cgi b/cgi-bin/modulev2_cobalt.cgi new file mode 100644 index 00000000..490948f2 Binary files /dev/null and b/cgi-bin/modulev2_cobalt.cgi differ diff --git a/cgi-bin/modulev2_linux_64bits.cgi b/cgi-bin/modulev2_linux_64bits.cgi new file mode 100644 index 00000000..f471e237 Binary files /dev/null and b/cgi-bin/modulev2_linux_64bits.cgi differ diff --git a/cgi-bin/modulev2_old.cgi b/cgi-bin/modulev2_old.cgi new file mode 100644 index 00000000..56ab961a Binary files /dev/null and b/cgi-bin/modulev2_old.cgi differ diff --git a/cgi-bin/modulev2_redhat72.cgi b/cgi-bin/modulev2_redhat72.cgi new file mode 100644 index 00000000..8912848d Binary files /dev/null and b/cgi-bin/modulev2_redhat72.cgi differ diff --git a/cgi-bin/modulev2_redhat73.cgi b/cgi-bin/modulev2_redhat73.cgi new file mode 100644 index 00000000..51f3298c Binary files /dev/null and b/cgi-bin/modulev2_redhat73.cgi differ diff --git a/cgi-bin/modulev2_redhat8.cgi b/cgi-bin/modulev2_redhat8.cgi new file mode 100644 index 00000000..3aea83ef Binary files /dev/null and b/cgi-bin/modulev2_redhat8.cgi differ diff --git a/cgi-bin/modulev2_redhat8_.cgi b/cgi-bin/modulev2_redhat8_.cgi new file mode 100644 index 00000000..3c4a3374 Binary files /dev/null and b/cgi-bin/modulev2_redhat8_.cgi differ diff --git a/cgi-bin/modulev2_sunsolaris_10_intel.cgi b/cgi-bin/modulev2_sunsolaris_10_intel.cgi new file mode 100644 index 00000000..829eac38 Binary files /dev/null and b/cgi-bin/modulev2_sunsolaris_10_intel.cgi differ diff --git a/cgi-bin/modulev2_sunsolaris_58_risc.cgi b/cgi-bin/modulev2_sunsolaris_58_risc.cgi new file mode 100644 index 00000000..083e3c64 Binary files /dev/null and b/cgi-bin/modulev2_sunsolaris_58_risc.cgi differ diff --git a/cgi-bin/modulev2_suse_92.cgi b/cgi-bin/modulev2_suse_92.cgi new file mode 100644 index 00000000..5dbdfca9 Binary files /dev/null and b/cgi-bin/modulev2_suse_92.cgi differ diff --git a/cgi-bin/modulev2_unix_hp.cgi b/cgi-bin/modulev2_unix_hp.cgi new file mode 100644 index 00000000..99c60f8e Binary files /dev/null and b/cgi-bin/modulev2_unix_hp.cgi differ diff --git a/cgi-bin/modulev305_CentOS_5.cgi b/cgi-bin/modulev305_CentOS_5.cgi new file mode 100644 index 00000000..0f13540f Binary files /dev/null and b/cgi-bin/modulev305_CentOS_5.cgi differ diff --git a/cgi-bin/modulev305_FreeBSD7.cgi b/cgi-bin/modulev305_FreeBSD7.cgi new file mode 100644 index 00000000..17aff434 Binary files /dev/null and b/cgi-bin/modulev305_FreeBSD7.cgi differ diff --git a/cgi-bin/modulev3_debian_noyau2-4-20_libc2-3-2.cgi b/cgi-bin/modulev3_debian_noyau2-4-20_libc2-3-2.cgi new file mode 100644 index 00000000..40a146c3 Binary files /dev/null and b/cgi-bin/modulev3_debian_noyau2-4-20_libc2-3-2.cgi differ diff --git a/cgi-bin/modulev3_debian_noyau2-6-18_libc2-3-6.cgi b/cgi-bin/modulev3_debian_noyau2-6-18_libc2-3-6.cgi new file mode 100644 index 00000000..77aca100 Binary files /dev/null and b/cgi-bin/modulev3_debian_noyau2-6-18_libc2-3-6.cgi differ diff --git a/cgi-bin/modulev3_rhe5_32bits.cgi b/cgi-bin/modulev3_rhe5_32bits.cgi new file mode 100644 index 00000000..62a3bf92 Binary files /dev/null and b/cgi-bin/modulev3_rhe5_32bits.cgi differ diff --git a/cgi-bin/modulev3_rhe5_64bits.cgi b/cgi-bin/modulev3_rhe5_64bits.cgi new file mode 100644 index 00000000..8e65ddc1 Binary files /dev/null and b/cgi-bin/modulev3_rhe5_64bits.cgi differ diff --git a/cgi-bin/modulev3_unbuntu10_64bits.cgi b/cgi-bin/modulev3_unbuntu10_64bits.cgi new file mode 100644 index 00000000..a09cf3f7 Binary files /dev/null and b/cgi-bin/modulev3_unbuntu10_64bits.cgi differ diff --git a/modules/blocklogo/blocklogo.tpl b/modules/blocklogo/blocklogo.tpl index d5829a9b..880000c4 100755 --- a/modules/blocklogo/blocklogo.tpl +++ b/modules/blocklogo/blocklogo.tpl @@ -3,7 +3,7 @@ {if isset($smarty.get.sponsor) && isset($smarty.get.create_account)} Bebeboutik {else} - Bebeboutik + Bebeboutik {/if} diff --git a/modules/contactform/fr/press.html b/modules/contactform/fr/press.html new file mode 100644 index 00000000..f0cc6f46 --- /dev/null +++ b/modules/contactform/fr/press.html @@ -0,0 +1,24 @@ + + + + + Message de votre boutique + + + + + + + + + + + + + + + + +
Vous avez reçu un message de la part d'un client depuis votre boutique
 
{lastname} {firstname} {function} {compagny} Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if} Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if}   {content}
+ + diff --git a/modules/contactform/fr/press.txt b/modules/contactform/fr/press.txt new file mode 100644 index 00000000..f626d97f --- /dev/null +++ b/modules/contactform/fr/press.txt @@ -0,0 +1,9 @@ +Vous avez reçu un message de la part d'un client depuis votre boutique + +Nom: {lastname} {firstname} +{function} +{compagny} +Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if} +Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if} + +{content} diff --git a/modules/contactform/fr/provider.html b/modules/contactform/fr/provider.html new file mode 100644 index 00000000..1d1bc71c --- /dev/null +++ b/modules/contactform/fr/provider.html @@ -0,0 +1,26 @@ + + + + + Message de votre boutique + + + + + + + + + + + + + + + + + + +
Vous avez reçu un message de la part d'un client depuis votre boutique
 
{lastname} {firstname} {function} {brand} - {compagny} Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if} Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if}   Proposition : {purpose}   {content}
+ + diff --git a/modules/contactform/fr/provider.txt b/modules/contactform/fr/provider.txt new file mode 100644 index 00000000..ea9a6ebf --- /dev/null +++ b/modules/contactform/fr/provider.txt @@ -0,0 +1,11 @@ +Vous avez reçu un message de la part d'un client depuis votre boutique + +Nom: {lastname} {firstname} +{function} +{brand} - {compagny} +Adresse électronique : {email1} {if email2 =! ''} - {email2}{/if} +Téléphone : Adresse électronique : {phone1} {if phone2 =! ''} - {phone2}{/if} + +Proposition : {purpose} + +{content} diff --git a/modules/emarsys_rss/flux.php b/modules/emarsys_rss/flux.php index 7ddcabbe..e56e0f9a 100755 --- a/modules/emarsys_rss/flux.php +++ b/modules/emarsys_rss/flux.php @@ -155,7 +155,7 @@ class Catalog $this->_xml .= 'reduction.']]>'; $this->_xml .= ''; $this->_xml .= '<![CDATA['.$item->title[(int) $id_lang].']]>'; - $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_2.jpg'; + $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg'; $this->_xml .= ''; $this->_xml.=''; @@ -187,7 +187,7 @@ class Catalog $this->_xml .= 'reduction.']]>'; $this->_xml .= ''; $this->_xml .= '<![CDATA['.$item->title[(int) $id_lang].']]>'; - $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_2.jpg'; + $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg'; $this->_xml .= ''; $this->_xml.=''; @@ -219,7 +219,7 @@ class Catalog $this->_xml .= 'reduction.']]>'; $this->_xml .= ''; $this->_xml .= '<![CDATA['.$item->title[(int) $id_lang].']]>'; - $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_2.jpg'; + $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg'; $this->_xml .= ''; $this->_xml.=''; @@ -239,7 +239,7 @@ class Catalog $this->_xml .= 'reduction.']]>'; $this->_xml .= ''; $this->_xml .= '<![CDATA['.$item->title[(int) $id_lang].']]>'; - $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_2.jpg'; + $this->_xml .= 'http://static.bebeboutik.com/modules/privatesales/img/'.$item->id.'/liston_'.(int) $id_lang.'.jpg'; $this->_xml .= ''; $this->_xml.=''; diff --git a/modules/fluxcatalogue/flux.php b/modules/fluxcatalogue/flux.php index 0d780628..6c7da45c 100755 --- a/modules/fluxcatalogue/flux.php +++ b/modules/fluxcatalogue/flux.php @@ -72,7 +72,13 @@ class Catalog $this->_xml .= ''; $this->_xml .= 'http://www.bebeboutik.com/img/logo.png'; $this->_xml .= 'bebeboutik.com'; - $this->_xml .= 'www.bebeboutik.com'; + + if (Tools::getValue('partenaire') + && Tools::getValue('partenaire') == "family_deal") { + $this->_xml .= ''; + } else { + $this->_xml .= 'www.bebeboutik.com'; + } $this->_xml .= ''; foreach ($items as $item) { diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php index 2276aa3a..aeee3fbb 100755 --- a/modules/privatesales/AdminPrivateSalesSales.php +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -2,886 +2,903 @@ include_once(_PS_ROOT_DIR_.'/modules/privatesales/Sale.php'); class AdminPrivateSalesSales extends AdminTab { - private $imagelist; - - public function __construct() { - $this->lang = TRUE; - parent::__construct(); - $this->imagelist = array( - 'thumb' => array($this->l('Thumbnail'), '260x108'), - 'liston' => array($this->l('Listing image (on)'), '380x178'), - 'listoff' => array($this->l('Listing image (off)'), '380x178'), - 'fb' => array($this->l('Facebook image'), '100x100'), - 'trailerbg' => array($this->l('Trailer background'), '*x*'), - 'trailercenter' => array($this->l('Trailer center background'), '560x*'), - ); - } - - public function displayForm($isMainTab=TRUE) { - global $currentIndex, $cookie; - parent::displayForm(); - - $iso = Language::getIsoById((int)($cookie->id_lang)); - $images = array(); - foreach(array_keys($this->imagelist) as $img) { - $images[] = 'img_'.$img; - } - $divLangName = 'description¤video¤'.implode('¤', $images); - - echo ' - - - -
-
- '.$this->l('Edit a sale').''; - - $categories = Db::getInstance()->ExecuteS(' - SELECT c.`id_category`, l.`name`, l.`link_rewrite` - FROM `'._DB_PREFIX_.'category` c, `'._DB_PREFIX_.'category_lang` l - WHERE c.`id_category` = l.`id_category` AND l.`id_lang` = '.intval($cookie->id_lang).' AND c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' - ORDER BY c.`id_category` - '); - - $used_categories = array(); - foreach(Db::getInstance()->ExecuteS(' - SELECT p.`id_category` - FROM `'._DB_PREFIX_.'privatesale_category` p - WHERE `id_category` IN ( - SELECT c.`id_category` - FROM `'._DB_PREFIX_.'category` c - WHERE c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' - ) - ') as $cat) { - $used_categories[] = $cat['id_category']; - } - $categories_ordered = array(); - echo ' - -
- - * -

'.$this->l('Categories already affected to other sales are greyed.').'

-
- - '; - - echo ' -
-
- -

'.$this->l('This value is set by the name of the root category for this sale.').'

-
-
-
'; - - echo ' -
-
- -

'.$this->l('This value is set by the alias of the root category for this sale.').'

-
-
-
'; - - echo ' -
-
- - * -
-
-
'; - - echo ' -
-
- - * -
-
-
'; - - echo ' -
-
- cursale!==NULL?($this->cursale->enabled==0?' checked="checked"': ''):'').' /> '.$this->l('Disabled').'   cursale!==NULL?($this->cursale->enabled==1?' checked="checked"': ''):'checked="checked"').' /> '.$this->l('Enabled').' - * -
-
-
'; - - echo ' -
-
- cursale!==NULL? ($this->cursale->logout==0? ' checked="checked"': ''):' ').' /> '.$this->l('Only for logged in users').'   cursale!==NULL? ($this->cursale->logout==1? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Show to guests too').' - * -
-
-
'; - - - echo ' -
-
- cursale!==NULL? ($this->cursale->pub==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->pub==1? ' checked="checked"': '').' /> '.$this->l('Yes').' - * -
-
-
'; - - echo ' -
-
- cursale!==NULL? ($this->cursale->braderie==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->braderie ==1? ' checked="checked"': '').' /> '.$this->l('Yes').' - * -
-
-
'; - - echo ' -
- -
-
'; - - echo ' -
- - * -
-
'; - - - echo ' -
-
- cursale!==NULL? ($this->cursale->new==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->new==1?' checked="checked"': '').' /> '.$this->l('Oui').' - * -
-
-
'; - - - echo ' -
-
- cursale!==NULL? ($this->cursale->forward_news==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->forward_news==1?' checked="checked"': '').' /> '.$this->l('Oui').' - * -
-
-
'; - - - echo ' -
-
- - * -
-
-
'; - - $groups = Db::getInstance()->ExecuteS(' - SELECT l.`id_group`, l.`name`'.($this->cursale !== NULL? ', ( - SELECT IFNULL(g.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_group` g WHERE l.`id_group` = g.`id_group` AND g.`id_sale` = '.$this->cursale->id.' - ) AS `id_sale`': '').' - FROM `'._DB_PREFIX_.'group_lang` l - WHERE l.`id_lang` = '.$cookie->id_lang - ); - echo ' -
-
- -
- -
-
'; - - $site_versions = array('fr', 'es'/*, 'it'*/); - echo ' -
-
- -
- -
-
'; - - // if(Configuration::get('PRIVATESALES_CARRIERFENCE')) { - $carriers = Db::getInstance()->ExecuteS(' - SELECT c.`id_carrier`, IF(c.`name` = "0", "'.Configuration::get('PS_SHOP_NAME').'", c.`name`) AS `name`'.($this->cursale !== NULL? ', ( - SELECT IFNULL(p.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_carrier` p WHERE c.`id_carrier` = p.`id_carrier` AND p.`id_sale` = '.$this->cursale->id.' - ) AS `id_sale`': '').' - FROM `'._DB_PREFIX_.'carrier` c - WHERE c.`deleted` != 1 - '); - - $carriers_default = array(33, 22, 37, 45); - - echo ' -
-
- -
- -
-
'; - // } - - // echo ' - //
- //
- // '.$this->l('SALETYPE1').' cursale->sale_type) && in_array(1,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="1"> - // '.$this->l('SALETYPE2').' cursale->sale_type) && in_array(2,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="2"> - // '.$this->l('SALETYPE3').' cursale->sale_type) && in_array(3,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="3"> - //
- //
'; - - echo ' -
'; - foreach($this->_languages as $language) { - echo '
- -
'; - } - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'description'); - echo '
-
'; - - echo ' -
'; - foreach($this->_languages as $language) { - echo '
- cursale !== NULL? ' value="'.htmlentities($this->cursale->video[$language['id_lang']]).'"': '').' />'; - echo '
'; - } - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'video'); - echo '
-

'.$this->l('Youtube full URL').'

-
'; - - foreach($this->imagelist as $k => $v) { - echo ' -
'; - foreach($this->_languages as $language) { - echo '
- -

'.$this->l('Size:').' '.$v[1].'

'; - if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) { - echo '

'.$this->l('Preview').'

'; - } - echo ' -
'; - } - $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k); - echo '
-
'; - } - - Module::hookExec('privatesales_edit', array('sale' => $this->cursale)); - - echo '
-
- - cursale !== NULL ? 'disabled=disabled': '').' name="submitSaleAdd" value="'.$this->l('Add this sale').'" /> - cursale !== NULL? '': ' disabled="disabled"').' id="submitSaleUpdate" /> -
'; - - echo '
-
'; - } - - public function display() { - global $cookie, $currentIndex; - $this->cursale = NULL; - if($id = Tools::getValue('id')) { - $this->cursale = new Sale($id); - if($this->cursale->id === NULL) { - Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales')); - } - } - - // // ANTADIS INSERT TYPE - // $ventes = Sale::getSales(NULL, NULL, NULL, NULL , FALSE, FALSE, 'position ASC'); - // foreach ($ventes as $key => $vente) { - // global $cookie; - // if($cookie->id_employee == 1){ - // Db::getInstance()->autoExecute('ps_privatesale_type', array( - // 'id_sale' => $vente->id, - // 'id_sale_type' => $vente->sale_type, - // ), 'INSERT'); - // } - // } - - $this->displayForm(); - - $export = Module::isInstalled('exports'); - - $employees = array(); - foreach(Db::getInstance()->ExecuteS(' - SELECT `id_employee`, `firstname`, `lastname` - FROM `'._DB_PREFIX_.'employee` - ') as $row) { - $employees[(int) $row['id_employee']] = $row['firstname'].' '.$row['lastname']; - } - - //ANTADIS - echo '
'; - echo 'Tri des ventes'; - echo ''; - echo ''; - echo ''; - echo '
'; - - ?> - - - - - '; - - - echo '
- '.$this->l('Sales list').' - - - - - - - - - - - - - - - - - - '; - echo ' '; - - $sales = Sale::getSales(NULL, NULL, NULL, 'not_ended', FALSE, FALSE, '`position` DESC',NULL, NULL, FALSE); - $ids = array(); - foreach ($sales as $key => $sale) { - $ids[] = $sale->id; - } - $extrafields = PrivateSales_ExtraFields::getFieldsForSale($ids); - - foreach($sales as $key => $sale) { - echo ' - - - - - - '; - - if($sale->new == 0){ - echo ""; - } - else if($sale->new == 1){ - echo ""; - } - else if($sale->new == 3){ - echo ""; - } - - echo ' - - - - - - - - - '; - } - echo ' - -
'.$this->l('ID').''.$this->l('Title').''.$this->l('Start').''.$this->l('End').''.$this->l('Enabled').''.$this->l('Nouveau').''.$this->l('Employee').''.$this->l('FR').''.$this->l('ES').''.$this->l('News').''.$this->l('Position').''.$this->l('Actions').'
'.$sale->id.''.$sale->title[intval($cookie->id_lang)].'
'.$extrafields[$sale->id][1].'
'.$sale->date_start.''.$sale->date_end.''.($sale->enabled?$this->l('Yes'):$this->l('No')).'".$this->l('No')."".$this->l('Yes')."".$this->l('Non défini')."'.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'versions) ? 'class="green"' : 'class="red"').'>FRversions) ? 'class="green"' : 'class="red"').'>ES'. $sale->forward_news .''; - if($key != 0){ - echo 'Haut'; - } - if($key + 1 != count($sales)){ - echo 'Bas'; - } - $category_link = Link::getCategoryLink($sale->id_category); - echo ' - '.($export? '': '').' - - - - - -
-
'; - - } - public static function getSaleType($sale_type){ - $type = ""; - - if(in_array(1, $sale_type)){ - $type.= "Bébé "; - } - if(in_array(2, $sale_type)){ - $type.= "Enfant "; - } - if(in_array(3, $sale_type)){ - $type.= "Maman "; - } - - if(empty($type)){ - return "undefined"; - } - return $type; - } - - public function postProcess() { - global $cookie, $currentIndex; - - if(Tools::isSubmit('submitSaleAdd')) { - if (Sale::getSaleFromCategory(Tools::getValue('id_category'))) { - return false; - } - - $sql_position = 'SELECT MAX(position) FROM '. _DB_PREFIX_.'privatesale'; - $position = Db::getInstance()->getValue($sql_position); - - $sale = new Sale(); - $sale->date_start = Tools::getValue('date_start', '0000-00-00 00:00:00'); - $sale->date_end = Tools::getValue('date_end', '0000-00-00 00:00:00'); - $sale->enabled = Tools::getValue('enabled', 0); - $sale->featured = Tools::getValue('featured', 0); - $sale->logout = Tools::getValue('logout', 0); - $sale->new = Tools::getValue('new', 0); - $sale->braderie = Tools::getValue('braderie', 0); - $sale->forward_news = Tools::getValue('forward_news', 0); - $sale->pub = Tools::getValue('pub', 0); - $sale->id_category = Tools::getValue('id_category', Configuration::get('PRIVATESALES_ROOT')); - $sale->id_employee = (int) Tools::getValue('id_employee'); - $sale->delivery_delay = (int) Tools::getValue('delivery_delay'); - $sale->sale_type = array(); - $sale->versions = array(); - foreach(Tools::getValue('sale_type', array()) as $sale_type) { - $sale->sale_type[] = (int) $sale_type; - } - - foreach(Language::getLanguages(FALSE) as $language) { - if($description = Tools::getValue('description_'.$language['id_lang'])) { - $sale->description[$language['id_lang']] = $description; - } else { - $sale->description[$language['id_lang']] = ''; - } - if($video = Tools::getValue('video_'.$language['id_lang'])) { - $sale->video[$language['id_lang']] = $video; - } else { - $sale->video[$language['id_lang']] = ''; - } - } - foreach(Tools::getValue('m_groups', array()) as $group) { - $sale->groups[] = (int) $group; - } - - foreach(Tools::getValue('m_versions', array()) as $version) { - $sale->versions[] = pSql($version); - } - - foreach(Tools::getValue('m_carriers', array()) as $carrier) { - $sale->carriers[] = (int) $carrier; - } - - if( empty($sale->carriers)) { - echo '
'.Tools::displayError($this->l('Impossible de créer une vente sans transporteur.')).'
'; - exit; - } - - $sale->save(); - $sale->buildCategoryCache(); - - if( empty($sale->carriers)) { - mail('valentin@bebeboutik.com', 'Vente sans transporteur', - 'La vente '. $sale->id.' est sans transporteur', - 'Content-Type: text/plain; charset="utf-8"'."\r\n".'From: contact@bebeboutik.com'."\r\n".'Reply-To: thibault@antadis.com'."\r\n".'Return-Path: thibault@antadis.com'."\r\n"); - } - - if(!is_dir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id)) { - mkdir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id, 0775); - } - - foreach(Language::getLanguages(FALSE) as $language) { - foreach(array_keys($this->imagelist) as $img) { - if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { - if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/'.$img.'_'.$language['id_lang'].'.jpg')) { - echo $this->displayError($this->l('An error occured during the image upload.')); - } - } - } - } - } elseif(Tools::isSubmit('submitSaleUpdate') && $id_sale = (int) Tools::getValue('id_sale')) { - $sale = new Sale($id_sale); - $sale->date_start = Tools::getValue('date_start', '0000-00-00 00:00:00'); - $sale->date_end = Tools::getValue('date_end', '0000-00-00 00:00:00'); - $sale->enabled = Tools::getValue('enabled', 0); - $sale->featured = Tools::getValue('featured', 0); - $sale->logout = Tools::getValue('logout', 0); - $sale->pub = Tools::getValue('pub', 0); - $sale->new = Tools::getValue('new', 0); - $sale->braderie = Tools::getValue('braderie', 0); - $sale->forward_news = Tools::getValue('forward_news', 0); - $sale->id_category = Tools::getValue('id_category', Configuration::get('PRIVATESALES_ROOT')); - $sale->id_employee = (int) Tools::getValue('id_employee'); - $sale->delivery_delay = (int) Tools::getValue('delivery_delay'); - $sale->sale_type = array(); - $sale->description = array(); - $sale->video = array(); - $sale->groups = array(); - $sale->carriers = array(); - $sale->versions = array(); - foreach(Language::getLanguages(FALSE) as $language) { - if($description = Tools::getValue('description_'.$language['id_lang'])) { - $sale->description[$language['id_lang']] = $description; - } else { - $sale->description[$language['id_lang']] = ''; - } - if($video = Tools::getValue('video_'.$language['id_lang'])) { - $sale->video[$language['id_lang']] = $video; - } else { - $sale->video[$language['id_lang']] = ''; - } - } - foreach(Tools::getValue('m_groups', array()) as $group) { - $sale->groups[] = (int) $group; - } - foreach(Tools::getValue('m_carriers', array()) as $carrier) { - $sale->carriers[] = (int) $carrier; - } - foreach(Tools::getValue('m_versions', array()) as $version) { - $sale->versions[] = pSql($version); - } - foreach(Tools::getValue('sale_type', array()) as $sale_type) { - $sale->sale_type[] = (int) $sale_type; - } - - if( empty($sale->carriers)) { - echo '
'.Tools::displayError($this->l('Impossible d\'éditer une vente sans transporteur.')).'
'; - exit; - } - - $sale->save(); - $sale->buildCategoryCache(); - - if(!is_dir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id)) { - mkdir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id, 0775); - } - - foreach(Language::getLanguages(FALSE) as $language) { - foreach(array_keys($this->imagelist) as $img) { - if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { - if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/'.$img.'_'.$language['id_lang'].'.jpg')) { - echo $this->displayError($this->l('An error occured during the image upload.')); - } - } - } - } - } elseif(isset($_GET['delete']) && $id_sale = Tools::getValue('id')) { - Sale::deleteSale($id_sale); - Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales')); - } - } + + private $imagelist; + + public function __construct() { + $this->lang = TRUE; + parent::__construct(); + $this->imagelist = array( + 'thumb' => array($this->l('Thumbnail'), '260x108'), + 'liston' => array($this->l('Listing image (on)'), '380x178'), + 'listoff' => array($this->l('Listing image (off)'), '380x178'), + 'fb' => array($this->l('Facebook image'), '100x100'), + 'trailerbg' => array($this->l('Trailer background'), '*x*'), + 'trailercenter' => array($this->l('Trailer center background'), '560x*'), + ); + } + + public function displayForm($isMainTab=TRUE) { + global $currentIndex, $cookie; + parent::displayForm(); + + $iso = Language::getIsoById((int)($cookie->id_lang)); + $images = array(); + foreach(array_keys($this->imagelist) as $img) { + $images[] = 'img_'.$img; + } + $divLangName = 'description¤video¤'.implode('¤', $images); + + echo ' + + + +
+
+ '.$this->l('Edit a sale').''; + + $categories = Db::getInstance()->ExecuteS(' + SELECT c.`id_category`, l.`name`, l.`link_rewrite` + FROM `'._DB_PREFIX_.'category` c, `'._DB_PREFIX_.'category_lang` l + WHERE c.`id_category` = l.`id_category` AND l.`id_lang` = '.intval($cookie->id_lang).' AND c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' + ORDER BY c.`id_category` + '); + + $used_categories = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT p.`id_category` + FROM `'._DB_PREFIX_.'privatesale_category` p + WHERE `id_category` IN ( + SELECT c.`id_category` + FROM `'._DB_PREFIX_.'category` c + WHERE c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' + ) + ') as $cat) { + $used_categories[] = $cat['id_category']; + } + $categories_ordered = array(); + echo ' + +
+ + * +

'.$this->l('Categories already affected to other sales are greyed.').'

+
+ + '; + + echo ' +
+
+ +

'.$this->l('This value is set by the name of the root category for this sale.').'

+
+
+
'; + + echo ' +
+
+ +

'.$this->l('This value is set by the alias of the root category for this sale.').'

+
+
+
'; + + echo ' +
+
+ + * +
+
+
'; + + echo ' +
+
+ + * +
+
+
'; + + echo ' +
+
+ cursale!==NULL?($this->cursale->enabled==0?' checked="checked"': ''):'').' /> '.$this->l('Disabled').'   cursale!==NULL?($this->cursale->enabled==1?' checked="checked"': ''):'checked="checked"').' /> '.$this->l('Enabled').' + * +
+
+
'; + + echo ' +
+
+ cursale!==NULL? ($this->cursale->logout==0? ' checked="checked"': ''):' ').' /> '.$this->l('Only for logged in users').'   cursale!==NULL? ($this->cursale->logout==1? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Show to guests too').' + * +
+
+
'; + + + echo ' +
+
+ cursale!==NULL? ($this->cursale->pub==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->pub==1? ' checked="checked"': '').' /> '.$this->l('Yes').' + * +
+
+
'; + + echo ' +
+
+ cursale!==NULL? ($this->cursale->braderie==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->braderie ==1? ' checked="checked"': '').' /> '.$this->l('Yes').' + * +
+
+
'; + + echo ' +
+ +
+
'; + + echo ' +
+ + * +
+
'; + + + echo ' +
+
+ cursale!==NULL? ($this->cursale->new==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->new==1?' checked="checked"': '').' /> '.$this->l('Oui').' + * +
+
+
'; + + + echo ' +
+
+ cursale!==NULL? ($this->cursale->forward_news==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->forward_news==1?' checked="checked"': '').' /> '.$this->l('Oui').' + * +
+
+
'; + + + echo ' +
+
+ + * +
+
+
'; + + $groups = Db::getInstance()->ExecuteS(' + SELECT l.`id_group`, l.`name`'.($this->cursale !== NULL? ', ( + SELECT IFNULL(g.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_group` g WHERE l.`id_group` = g.`id_group` AND g.`id_sale` = '.$this->cursale->id.' + ) AS `id_sale`': '').' + FROM `'._DB_PREFIX_.'group_lang` l + WHERE l.`id_lang` = '.$cookie->id_lang + ); + echo ' +
+
+ +
+ +
+
'; + + $site_versions = array('fr', 'es'/*, 'it'*/); + echo ' +
+
+ +
+ +
+
'; + + $countries = Country::getCountries($cookie->id_lang, false); + echo ' +
+
+ +
+
+
'; + + // if(Configuration::get('PRIVATESALES_CARRIERFENCE')) { + $carriers = Db::getInstance()->ExecuteS(' + SELECT c.`id_carrier`, IF(c.`name` = "0", "'.Configuration::get('PS_SHOP_NAME').'", c.`name`) AS `name`'.($this->cursale !== NULL? ', ( + SELECT IFNULL(p.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_carrier` p WHERE c.`id_carrier` = p.`id_carrier` AND p.`id_sale` = '.$this->cursale->id.' + ) AS `id_sale`': '').' + FROM `'._DB_PREFIX_.'carrier` c + WHERE c.`deleted` != 1 + '); + + $carriers_default = array(33, 22, 37, 45); + + echo ' +
+
+ +
+ +
+
'; + // } + + // echo ' + //
+ //
+ // '.$this->l('SALETYPE1').' cursale->sale_type) && in_array(1,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="1"> + // '.$this->l('SALETYPE2').' cursale->sale_type) && in_array(2,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="2"> + // '.$this->l('SALETYPE3').' cursale->sale_type) && in_array(3,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="3"> + //
+ //
'; + + echo ' +
'; + foreach($this->_languages as $language) { + echo '
+ +
'; + } + $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'description'); + echo '
+
'; + + echo ' +
'; + foreach($this->_languages as $language) { + echo '
+ cursale !== NULL? ' value="'.htmlentities($this->cursale->video[$language['id_lang']]).'"': '').' />'; + echo '
'; + } + $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'video'); + echo '
+

'.$this->l('Youtube full URL').'

+
'; + + foreach($this->imagelist as $k => $v) { + echo ' +
'; + foreach($this->_languages as $language) { + echo '
+ +

'.$this->l('Size:').' '.$v[1].'

'; + if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) { + echo '

'.$this->l('Preview').'

'; + } + echo ' +
'; + } + $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k); + echo '
+
'; + } + + Module::hookExec('privatesales_edit', array('sale' => $this->cursale)); + + echo '
+
+ + cursale !== NULL ? 'disabled=disabled': '').' name="submitSaleAdd" value="'.$this->l('Add this sale').'" /> + cursale !== NULL? '': ' disabled="disabled"').' id="submitSaleUpdate" /> +
'; + + echo '
+
'; + } + + public function display() { + global $cookie, $currentIndex; + $this->cursale = NULL; + if($id = Tools::getValue('id')) { + $this->cursale = new Sale($id); + if($this->cursale->id === NULL) { + Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales')); + } + } + + // // ANTADIS INSERT TYPE + // $ventes = Sale::getSales(NULL, NULL, NULL, NULL , FALSE, FALSE, 'position ASC'); + // foreach ($ventes as $key => $vente) { + // global $cookie; + // if($cookie->id_employee == 1){ + // Db::getInstance()->autoExecute('ps_privatesale_type', array( + // 'id_sale' => $vente->id, + // 'id_sale_type' => $vente->sale_type, + // ), 'INSERT'); + // } + // } + + $this->displayForm(); + + $export = Module::isInstalled('exports'); + + $employees = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_employee`, `firstname`, `lastname` + FROM `'._DB_PREFIX_.'employee` + ') as $row) { + $employees[(int) $row['id_employee']] = $row['firstname'].' '.$row['lastname']; + } + + //ANTADIS + echo '
'; + echo 'Tri des ventes'; + echo ''; + echo ''; + echo ''; + echo '
'; + + ?> + + + + + '; + + + echo '
+ '.$this->l('Sales list').' + + + + + + + + + + + + + + + + + + '; + echo ' '; + + $sales = Sale::getSales(NULL, NULL, NULL, 'not_ended', FALSE, FALSE, '`position` DESC'); + $ids = array(); + foreach ($sales as $key => $sale) { + $ids[] = $sale->id; + } + $extrafields = PrivateSales_ExtraFields::getFieldsForSale($ids); + + foreach($sales as $key => $sale) { + echo ' + + + + + + '; + + if($sale->new == 0){ + echo ""; + } + else if($sale->new == 1){ + echo ""; + } + else if($sale->new == 3){ + echo ""; + } + + echo ' + + + + + + + + + '; + } + echo ' + +
'.$this->l('ID').''.$this->l('Title').''.$this->l('Start').''.$this->l('End').''.$this->l('Enabled').''.$this->l('Nouveau').''.$this->l('Employee').''.$this->l('FR').''.$this->l('ES').''.$this->l('News').''.$this->l('Position').''.$this->l('Actions').'
'.$sale->id.''.$sale->title[intval($cookie->id_lang)].'
'.$extrafields[$sale->id][1].'
'.$sale->date_start.''.$sale->date_end.''.($sale->enabled?$this->l('Yes'):$this->l('No')).'".$this->l('No')."".$this->l('Yes')."".$this->l('Non défini')."'.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'versions) ? 'class="green"' : 'class="red"').'>FRversions) ? 'class="green"' : 'class="red"').'>ES'. $sale->forward_news .''; + if($key != 0){ + echo 'Haut'; + } + if($key + 1 != count($sales)){ + echo 'Bas'; + } + $category_link = Link::getCategoryLink($sale->id_category); + echo ' + '.($export? '': '').' + + + + + +
+
'; + + } + public static function getSaleType($sale_type){ + $type = ""; + + if(in_array(1, $sale_type)){ + $type.= "Bébé "; + } + if(in_array(2, $sale_type)){ + $type.= "Enfant "; + } + if(in_array(3, $sale_type)){ + $type.= "Maman "; + } + + if(empty($type)){ + return "undefined"; + } + return $type; + } + + public function postProcess() { + global $cookie, $currentIndex; + + if(Tools::isSubmit('submitSaleAdd')) { + if (Sale::getSaleFromCategory(Tools::getValue('id_category'))) { + return false; + } + + $sql_position = 'SELECT MAX(position) FROM '. _DB_PREFIX_.'privatesale'; + $position = Db::getInstance()->getValue($sql_position); + + $sale = new Sale(); + $sale->date_start = Tools::getValue('date_start', '0000-00-00 00:00:00'); + $sale->date_end = Tools::getValue('date_end', '0000-00-00 00:00:00'); + $sale->id_country = (int) Tools::getValue('id_country'); + $sale->enabled = Tools::getValue('enabled', 0); + $sale->featured = Tools::getValue('featured', 0); + $sale->logout = Tools::getValue('logout', 0); + $sale->new = Tools::getValue('new', 0); + $sale->braderie = Tools::getValue('braderie', 0); + $sale->forward_news = Tools::getValue('forward_news', 0); + $sale->pub = Tools::getValue('pub', 0); + $sale->id_category = Tools::getValue('id_category', Configuration::get('PRIVATESALES_ROOT')); + $sale->id_employee = (int) Tools::getValue('id_employee'); + $sale->delivery_delay = (int) Tools::getValue('delivery_delay'); + $sale->sale_type = array(); + $sale->versions = array(); + foreach(Tools::getValue('sale_type', array()) as $sale_type) { + $sale->sale_type[] = (int) $sale_type; + } + + foreach(Language::getLanguages(FALSE) as $language) { + if($description = Tools::getValue('description_'.$language['id_lang'])) { + $sale->description[$language['id_lang']] = $description; + } else { + $sale->description[$language['id_lang']] = ''; + } + if($video = Tools::getValue('video_'.$language['id_lang'])) { + $sale->video[$language['id_lang']] = $video; + } else { + $sale->video[$language['id_lang']] = ''; + } + } + foreach(Tools::getValue('m_groups', array()) as $group) { + $sale->groups[] = (int) $group; + } + + foreach(Tools::getValue('m_versions', array()) as $version) { + $sale->versions[] = pSql($version); + } + + foreach(Tools::getValue('m_carriers', array()) as $carrier) { + $sale->carriers[] = (int) $carrier; + } + + if( empty($sale->carriers)) { + echo '
'.Tools::displayError($this->l('Impossible de créer une vente sans transporteur.')).'
'; + exit; + } + + $sale->save(); + $sale->buildCategoryCache(); + + if( empty($sale->carriers)) { + mail('valentin@bebeboutik.com', 'Vente sans transporteur', + 'La vente '. $sale->id.' est sans transporteur', + 'Content-Type: text/plain; charset="utf-8"'."\r\n".'From: contact@bebeboutik.com'."\r\n".'Reply-To: thibault@antadis.com'."\r\n".'Return-Path: thibault@antadis.com'."\r\n"); + } + + if(!is_dir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id)) { + mkdir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id, 0775); + } + + foreach(Language::getLanguages(FALSE) as $language) { + foreach(array_keys($this->imagelist) as $img) { + if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { + if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/'.$img.'_'.$language['id_lang'].'.jpg')) { + echo $this->displayError($this->l('An error occured during the image upload.')); + } + } + } + } + } elseif(Tools::isSubmit('submitSaleUpdate') && $id_sale = (int) Tools::getValue('id_sale')) { + $sale = new Sale($id_sale); + $sale->date_start = Tools::getValue('date_start', '0000-00-00 00:00:00'); + $sale->date_end = Tools::getValue('date_end', '0000-00-00 00:00:00'); + $sale->id_country = (int) Tools::getValue('id_country'); + $sale->enabled = Tools::getValue('enabled', 0); + $sale->featured = Tools::getValue('featured', 0); + $sale->logout = Tools::getValue('logout', 0); + $sale->pub = Tools::getValue('pub', 0); + $sale->new = Tools::getValue('new', 0); + $sale->braderie = Tools::getValue('braderie', 0); + $sale->forward_news = Tools::getValue('forward_news', 0); + $sale->id_category = Tools::getValue('id_category', Configuration::get('PRIVATESALES_ROOT')); + $sale->id_employee = (int) Tools::getValue('id_employee'); + $sale->delivery_delay = (int) Tools::getValue('delivery_delay'); + $sale->sale_type = array(); + $sale->description = array(); + $sale->video = array(); + $sale->groups = array(); + $sale->carriers = array(); + $sale->versions = array(); + foreach(Language::getLanguages(FALSE) as $language) { + if($description = Tools::getValue('description_'.$language['id_lang'])) { + $sale->description[$language['id_lang']] = $description; + } else { + $sale->description[$language['id_lang']] = ''; + } + if($video = Tools::getValue('video_'.$language['id_lang'])) { + $sale->video[$language['id_lang']] = $video; + } else { + $sale->video[$language['id_lang']] = ''; + } + } + foreach(Tools::getValue('m_groups', array()) as $group) { + $sale->groups[] = (int) $group; + } + foreach(Tools::getValue('m_carriers', array()) as $carrier) { + $sale->carriers[] = (int) $carrier; + } + foreach(Tools::getValue('m_versions', array()) as $version) { + $sale->versions[] = pSql($version); + } + foreach(Tools::getValue('sale_type', array()) as $sale_type) { + $sale->sale_type[] = (int) $sale_type; + } + + if( empty($sale->carriers)) { + echo '
'.Tools::displayError($this->l('Impossible d\'éditer une vente sans transporteur.')).'
'; + exit; + } + + $sale->save(); + $sale->buildCategoryCache(); + + if(!is_dir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id)) { + mkdir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id, 0775); + } + + foreach(Language::getLanguages(FALSE) as $language) { + foreach(array_keys($this->imagelist) as $img) { + if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { + if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/'.$img.'_'.$language['id_lang'].'.jpg')) { + echo $this->displayError($this->l('An error occured during the image upload.')); + } + } + } + } + } elseif(isset($_GET['delete']) && $id_sale = Tools::getValue('id')) { + Sale::deleteSale($id_sale); + Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales')); + } + } } diff --git a/modules/privatesales/Sale.php b/modules/privatesales/Sale.php index a3d2d2ff..2d01ae65 100755 --- a/modules/privatesales/Sale.php +++ b/modules/privatesales/Sale.php @@ -7,6 +7,7 @@ class Sale { var $date_start; var $date_end; var $timelaps; + var $id_country = 0; var $enabled = 0; var $featured = 0; var $logout = 0; @@ -31,6 +32,7 @@ class Sale { $this->date_start = $sale['date_start']; $this->date_end = $sale['date_end']; $this->date_upd = $sale['date_upd']; + $this->id_country = $sale['id_country']; $this->enabled = $sale['enabled']; $this->featured = $sale['featured']; $this->logout = $sale['logout']; @@ -82,6 +84,7 @@ class Sale { UPDATE `'._DB_PREFIX_.'privatesale` SET `date_start` = "'.pSQL($this->date_start).'", `date_end` = "'.pSQL($this->date_end).'", + `id_country` = '.(int) $this->id_country.', `enabled` = '.(int) $this->enabled.', `featured` = '.(int) $this->featured.', `logout` = '.(int) $this->logout.', @@ -175,6 +178,7 @@ class Sale { DEFAULT, "'.pSQL($this->date_start).'", "'.pSQL($this->date_end).'", + '.(int) $this->id_country.', '.(int) $this->enabled.', '.(int) $this->featured.', '.(int) $this->logout.', @@ -309,6 +313,7 @@ class Sale { 'date_end' => $ps[0]['date_end'], 'date_upd' => $ps[0]['date_upd'], 'timelaps' => $diff, + 'id_country' => $ps[0]['id_country'], 'enabled' => $ps[0]['enabled'], 'featured' => $ps[0]['featured'], 'logout' => $ps[0]['logout'], diff --git a/modules/privatesales/home.tpl b/modules/privatesales/home.tpl index 7bbe76d2..2e99e7cf 100755 --- a/modules/privatesales/home.tpl +++ b/modules/privatesales/home.tpl @@ -18,7 +18,7 @@
{*{l s='Trailer' mod='privatesales'}*} - {l s='Share on Facebook' mod='privatesales'} + {l s='Share on Facebook' mod='privatesales'} {l s='Tweet this page' mod='privatesales'} {l s='Send to a friend' mod='privatesales'} {l s='View the sale' mod='privatesales'} @@ -51,7 +51,7 @@ {l s='From' mod='privatesales'} {$sale->date_start|date_format:'%A %e %B %H:%M'} {l s='To' mod='privatesales'} {$sale->date_end|date_format:'%A %e %B %H:%M'}
- {l s='Share on Facebook' mod='privatesales'} + {l s='Share on Facebook' mod='privatesales'} {l s='Tweet this page' mod='privatesales'} {l s='Send to a friend' mod='privatesales'} {l s='Trailer' mod='privatesales'} diff --git a/themes/site/header.tpl b/themes/site/header.tpl index a5d4a1b5..3a354461 100755 --- a/themes/site/header.tpl +++ b/themes/site/header.tpl @@ -166,16 +166,7 @@ - - - + {if !$content_only} {if isset($restricted_country_mode) && $restricted_country_mode}
diff --git a/themes/site/lang/fr.php b/themes/site/lang/fr.php index 3b0ca7c4..3fe8a29a 100755 --- a/themes/site/lang/fr.php +++ b/themes/site/lang/fr.php @@ -310,6 +310,7 @@ $_LANG['order-carrier_8f90815af11493295587f91f571c2f95'] = 'Il n\'y a pas de tra $_LANG['order-carrier_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur'; $_LANG['order-carrier_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Informations'; $_LANG['order-carrier_3601146c4e948c32b6424d2c0a7f0118'] = 'Prix'; +$_LANG['order-carrier_4cd4c5ff8d8913c314f7c26f32f6cf96'] = 'Délai de livraison affiché durant la commande'; $_LANG['order-carrier_21034ae6d01a83e702839a72ba8a77b0'] = 'HT'; $_LANG['order-carrier_1f87346a16cf80c372065de3c54c86d9'] = 'TTC'; $_LANG['order-carrier_0d9175fe89fb80d815e7d03698b6e83a'] = 'Cadeau'; diff --git a/themes/site/modules/privatesales/home.tpl b/themes/site/modules/privatesales/home.tpl index 39dc37c6..91e302df 100755 --- a/themes/site/modules/privatesales/home.tpl +++ b/themes/site/modules/privatesales/home.tpl @@ -184,7 +184,7 @@
{*{l s='Trailer' mod='privatesales'}*} - {l s='Share on Facebook' mod='privatesales'} + {l s='Share on Facebook' mod='privatesales'} {l s='Tweet this page' mod='privatesales'} {l s='Send to a friend' mod='privatesales'} {l s='View the sale' mod='privatesales'} @@ -240,9 +240,9 @@
{if $cookie->id_lang == 2} - + {elseif $cookie->id_lang == 3} - + {/if}
@@ -265,7 +265,7 @@