diff --git a/admin-dev/tabs/AdminCustomers.php b/admin-dev/tabs/AdminCustomers.php index 1c8783c5b..f4b97c9e8 100644 --- a/admin-dev/tabs/AdminCustomers.php +++ b/admin-dev/tabs/AdminCustomers.php @@ -1,6 +1,6 @@ delete = true; $this->deleted = true; $this->requiredDatabase = true; - + $this->_select = '(YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5) $this->l('M'), 2 => $this->l('F'), 9 => $this->l('?')); + + $genders_icon = array('default' => 'unknown.gif'); + $genders = array(0 => $this->l('?')); + foreach (Gender::getGenders() as $gender) + { + $genders_icon[$gender['id_gender']] = '../genders/'.$gender['id_gender'].'.jpg'; + $genders[$gender['id_gender']] = $gender['name']; + } + $this->fieldsDisplay = array( 'id_customer' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), - 'id_gender' => array('title' => $this->l('Gender'), 'width' => 25, 'align' => 'center', 'icon' => array(1 => 'male.gif', 2 => 'female.gif', 'default' => 'unknown.gif'), 'orderby' => false, 'type' => 'select', 'select' => $genders, 'filter_key' => 'a!id_gender'), + 'id_gender' => array( + 'title' => $this->l('Gender'), + 'width' => 30, + 'align' => 'center', + 'icon' => $genders_icon, + 'orderby' => false, + 'type' => 'select', + 'select' => $genders, + 'filter_key' => 'a!id_gender', + ), 'lastname' => array('title' => $this->l('Last Name'), 'width' => 80), 'firstname' => array('title' => $this->l('First name'), 'width' => 60), 'email' => array('title' => $this->l('E-mail address'), 'width' => 120, 'maxlength' => 19), @@ -74,7 +91,7 @@ class AdminCustomers extends AdminTab parent::__construct(); } - + public function postProcess() { if (Tools::isSubmit('submitDel'.$this->table) OR Tools::isSubmit('delete'.$this->table)) @@ -102,11 +119,11 @@ class AdminCustomers extends AdminTab
 
'; } - + if (Tools::getValue('submitAdd'.$this->table)) { $groupList = Tools::getValue('groupBox'); - + /* Checking fields validity */ $this->validateRules(); if (!sizeof($this->_errors)) @@ -122,7 +139,7 @@ class AdminCustomers extends AdminTab if (Validate::isLoadedObject($object)) { $customer_email = strval(Tools::getValue('email')); - + // check if e-mail already used if ($customer_email != $object->email) { @@ -131,13 +148,13 @@ class AdminCustomers extends AdminTab if ($customer->id) $this->_errors[] = Tools::displayError('An account already exists for this e-mail address:').' '.$customer_email; } - + if (!is_array($groupList) OR sizeof($groupList) == 0) $this->_errors[] = Tools::displayError('Customer must be in at least one group.'); else if (!in_array(Tools::getValue('id_default_group'), $groupList)) $this->_errors[] = Tools::displayError('Default customer group must be selected in group box.'); - + // Updating customer's group if (!sizeof($this->_errors)) { @@ -248,7 +265,7 @@ class AdminCustomers extends AdminTab $update = Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` SET newsletter = '.($customer->newsletter ? 0 : 1).' WHERE `id_customer` = '.(int)($customer->id)); if (!$update) $this->_errors[] = Tools::displayError('An error occurred while updating customer.'); - Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); + Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); }elseif (Tools::isSubmit('changeOptinVal') AND Tools::getValue('id_customer')) { @@ -261,7 +278,7 @@ class AdminCustomers extends AdminTab $this->_errors[] = Tools::displayError('An error occurred while updating customer.'); Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } - + return parent::postProcess(); } @@ -288,10 +305,12 @@ class AdminCustomers extends AdminTab else $countBetterCustomers = '-'; + $gender = new Gender($customer->id_gender); + echo '
'.$customer->firstname.' '.$customer->lastname.' -
+
'.$customer->email.'

'.$this->l('ID:').' '.sprintf('%06d', $customer->id).'
'.$this->l('Registration date:').' '.Tools::displayDate($customer->date_add, $this->context->language->id, true).'
@@ -331,7 +350,7 @@ class AdminCustomers extends AdminTab echo '
 
'; - + echo '
'.$this->l('Add a private note').'

'.$this->l('This note will be displayed to all the employees but not to the customer.').'

@@ -361,8 +380,8 @@ class AdminCustomers extends AdminTab }); } '; - - + + echo '

'.$this->l('Messages').' ('.sizeof($messages).')

'; if (sizeof($messages)) { @@ -476,7 +495,7 @@ class AdminCustomers extends AdminTab } else echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has not placed any orders yet'); - + if ($products AND sizeof($products)) { echo '
 
@@ -572,7 +591,7 @@ class AdminCustomers extends AdminTab else echo $customer->firstname.' '.$customer->lastname.' '.$this->l('has no discount vouchers').'.'; echo '
 
'; - + echo '

'.$this->l('Carts').' ('.sizeof($carts).')

'; if ($carts AND sizeof($carts)) @@ -608,14 +627,14 @@ class AdminCustomers extends AdminTab else echo $this->l('No cart available').'.'; echo '
'; - + $sql = 'SELECT DISTINCT id_product, c.id_cart, c.id_shop, cp.id_shop AS cp_id_shop - FROM '._DB_PREFIX_.'cart_product cp + FROM '._DB_PREFIX_.'cart_product cp JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart) - WHERE c.id_customer = '.(int)$customer->id.' + WHERE c.id_customer = '.(int)$customer->id.' AND cp.id_product NOT IN ( - SELECT product_id - FROM '._DB_PREFIX_.'orders o + SELECT product_id + FROM '._DB_PREFIX_.'orders o JOIN '._DB_PREFIX_.'order_detail od ON (o.id_order = od.id_order) WHERE o.valid = 1 AND o.id_customer = '.(int)$customer->id.' )'; @@ -638,12 +657,12 @@ class AdminCustomers extends AdminTab } echo ''; } - + echo '
 
'; /* Last connections */ $connections = $customer->getLastConnections(); - if (sizeof($connections)) + if (sizeof($connections)) { echo '

'.$this->l('Last connections').'

@@ -665,7 +684,7 @@ class AdminCustomers extends AdminTab echo '
 
'; } - if (sizeof($referrers)) + if (sizeof($referrers)) { echo '

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

@@ -688,26 +707,27 @@ class AdminCustomers extends AdminTab public function displayForm($isMainTab = true) { parent::displayForm(); - + if (!($obj = $this->loadObject(true))) return; - + $birthday = explode('-', $this->getFieldValue($obj, 'birthday')); $customer_groups = Tools::getValue('groupBox', $obj->getGroups()); $groups = Group::getGroups($this->_defaultFormLanguage, true); - + echo ' '.($obj->id ? '' : '').'
'.$this->l('Customer').' -
- getFieldValue($obj, 'id_gender') == 1 ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'id_gender') == 2 ? 'checked="checked" ' : '').'/> - - getFieldValue($obj, 'id_gender') == 9 OR !$this->getFieldValue($obj, 'id_gender')) ? 'checked="checked" ' : '').'/> - +
'; + foreach (Gender::getGenders() as $gender) + { + echo 'getFieldValue($obj, 'id_gender') == $gender['id_gender'] ? 'checked="checked" ' : '').'/>'; + echo '   '; + } + echo ' getFieldValue($obj, 'id_gender') == 9 || !$this->getFieldValue($obj, 'id_gender')) ? 'checked="checked" ' : '').'/> +
@@ -854,7 +874,7 @@ class AdminCustomers extends AdminTab { return parent::getList(Context::getContext()->language->id, !Tools::getValue($this->table.'Orderby') ? 'date_add' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL); } - + public function beforeDelete($object) { return $object->isUsed(); diff --git a/admin-dev/tabs/AdminGenders.php b/admin-dev/tabs/AdminGenders.php new file mode 100644 index 000000000..fbcd334e4 --- /dev/null +++ b/admin-dev/tabs/AdminGenders.php @@ -0,0 +1,109 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision$ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +class AdminGenders extends AdminTab +{ + public function __construct() + { + $this->table = 'gender'; + $this->className = 'Gender'; + $this->lang = true; + $this->edit = true; + $this->delete = true; + + $this->fieldImageSettings = array('name' => 'image', 'dir' => 'genders'); + $this->fieldsDisplay = array( + 'id_gender' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), + 'name' => array('title' => $this->l('Name'), 'width' => 150, 'filter_key' => 'b!name'), + 'type' => array( + 'title' => $this->l('Type'), + 'width' => 100, + 'orderby' => false, + 'type' => 'select', + 'select' => array(0 => $this->l('Male'), 1 => $this->l('Female')), + 'filter_key' => 'a!type', + 'callback' => 'displayGenderType', + 'callback_object' => $this, + ), + 'image' => array('title' => $this->l('Image'), 'align' => 'center', 'image' => 'genders', 'orderby' => false, 'search' => false), + ); + + parent::__construct(); + } + + public function displayGenderType($value, $tr) + { + return $this->fieldsDisplay['type']['select'][$value]; + } + + public function displayForm($isMainTab = true) + { + parent::displayForm(); + + if (!($obj = $this->loadObject(true))) + return; + + echo ' + + '.($obj->id ? '' : '').' +
'.$this->l('Gender').' + +
'; + foreach ($this->_languages as $language) + echo ' +
+ * + '.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%:  +
'; + $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name'); + echo '
 
'; + + echo ' +
+ getFieldValue($obj, 'type') == 0 ? 'checked="checked" ' : '').'/> + + getFieldValue($obj, 'type') == 1 ? 'checked="checked" ' : '').'/> + +
+
'; + + echo ' +
'; + echo ' '; + if ($obj->getImage()) + echo ''; + echo '
+
'; + + echo '
+ +
+
* '.$this->l('Required field').'
+
+
'; + } +} diff --git a/admin-dev/tabs/AdminGroups.php b/admin-dev/tabs/AdminGroups.php index 500003d40..b0fbb4168 100644 --- a/admin-dev/tabs/AdminGroups.php +++ b/admin-dev/tabs/AdminGroups.php @@ -1,6 +1,6 @@ edit = true; $this->view = true; $this->delete = true; - + $this->_select = ' (SELECT COUNT(jcg.`id_customer`) - FROM `'._DB_PREFIX_.'customer_group` jcg - LEFT JOIN `'._DB_PREFIX_.'customer` jc ON (jc.`id_customer` = jcg.`id_customer`) - WHERE jc.`deleted` != 1 + FROM `'._DB_PREFIX_.'customer_group` jcg + LEFT JOIN `'._DB_PREFIX_.'customer` jc ON (jc.`id_customer` = jcg.`id_customer`) + WHERE jc.`deleted` != 1 AND jcg.`id_group` = a.`id_group`) AS nb '; $this->_listSkipDelete = array(1); @@ -58,7 +58,7 @@ class AdminGroups extends AdminTab public function displayForm($isMainTab = true) { parent::displayForm(); - + if (!($obj = $this->loadObject(true))) return; $groupReductions = $obj->id ? GroupReduction::getGroupReductions($obj->id, $this->context->language->id) : array(); @@ -93,7 +93,7 @@ class AdminGroups extends AdminTab
'; if ($groupReductions) { - + echo '
@@ -168,11 +168,11 @@ class AdminGroups extends AdminTab public function viewgroup() { - $this->context = Context::getContext(); + $this->context = Context::getContext(); self::$currentIndex = 'index.php?tab=AdminGroups'; if (!($obj = $this->loadObject(true))) return; - + echo '
@@ -197,50 +197,50 @@ class AdminGroups extends AdminTab if ($nbCustomers = $obj->getCustomers(true)) { echo '

'.$this->l('Customer members of this group').' ('.$nbCustomers.')

'; - + // Pagination Begin - $customersPerPage = (Tools::getValue('customerPerPage') ? (int)Tools::getValue('customerPerPage') : 50); + $customersPerPage = (Tools::getValue('customerPerPage') ? (int)Tools::getValue('customerPerPage') : 50); $totalPages = ceil($nbCustomers / $customersPerPage); $perPageOptions = array(20, 50, 100, 300); - + $customerPageIndex = (Tools::getValue('customerPageIndex') && Tools::getValue('customerPageIndex') <= $totalPages ? (int)Tools::getValue('customerPageIndex') : 1); $from = (Tools::getValue('customerPageIndex') ? ((int)$customerPageIndex - 1) * ((int)$customersPerPage) : 0); - + $customers = $obj->getCustomers(false, $from, $customersPerPage); - + echo '
'; - + if ($customerPageIndex > 1) { echo '  '; echo '  '; } - + echo 'Page / '.$totalPages; - + if ($customerPageIndex < $totalPages) { echo ' '; echo ' '; } - + echo ' | Display / '.$nbCustomers.' result(s) + echo ' / '.$nbCustomers.' result(s)
'; // Pagination End - + echo ''; foreach ($this->fieldsDisplay AS $field) @@ -248,14 +248,13 @@ class AdminGroups extends AdminTab echo ' '; $irow = 0; - + foreach ($customers AS $k => $customer) { - $imgGender = $customer['id_gender'] == 1 ? ''.$this->l('Male').'' : ($customer['id_gender'] == 2 ? ''.$this->l('Female').'' : ''); echo ' - + diff --git a/admin-dev/tabs/AdminImport.php b/admin-dev/tabs/AdminImport.php index 37f7276d2..a3c8ef1b4 100644 --- a/admin-dev/tabs/AdminImport.php +++ b/admin-dev/tabs/AdminImport.php @@ -82,7 +82,7 @@ class AdminImport extends AdminTab case $this->entities[$this->l('Combinations')]: self::$required_fields = array('id_product', 'options'); $this->available_fields = array( - 'no' => array('label' => $this->l('Ignore this column')), + 'no' => array('label' => $this->l('Ignore this column')), 'id_product' => array('label' => $this->l('Product ID').'*'), 'options' => array('label' => $this->l('Options (Group:Value)').'*'), 'reference' => array('label' => $this->l('Reference')), @@ -95,7 +95,7 @@ class AdminImport extends AdminTab 'quantity' => array('label' => $this->l('Quantity')), 'weight' => array('label' => $this->l('Weight')), 'default_on' => array('label' => $this->l('Default')), - 'image_position' => array('label' => $this->l('Image position'), + 'image_position' => array('label' => $this->l('Image position'), 'help' => $this->l('Position of the product image to use for this combination. If you use this field, leave image URL empty.')), 'image_url' => array('label' => $this->l('Image URL')), ); @@ -180,7 +180,7 @@ class AdminImport extends AdminTab 'online_only' => array('label' => $this->l('Only available online')), 'condition' => array('label' => $this->l('Condition')), 'shop' => array( - 'label' => $this->l('ID / Name of shop'), + 'label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use multishop tool. If you leave this field empty, default shop will be used'), ), ); @@ -210,7 +210,7 @@ class AdminImport extends AdminTab 'no' => array('label' => $this->l('Ignore this column')), 'id' => array('label' => $this->l('ID')), 'active' => array('label' => $this->l('Active (0/1)')), - 'id_gender' => array('label' => $this->l('Gender ID (Mr = 1, Ms = 2, else 9)')), + 'id_gender' => array('label' => $this->l('Gender ID (Mr = 1, Ms = 2, else 0)')), 'email' => array('label' => $this->l('E-mail *')), 'passwd' => array('label' => $this->l('Password *')), 'birthday' => array('label' => $this->l('Birthday (yyyy-mm-dd)')), @@ -219,7 +219,7 @@ class AdminImport extends AdminTab 'newsletter' => array('label' => $this->l('Newsletter (0/1)')), 'optin' => array('label' => $this->l('Opt in (0/1)')), 'id_shop' => array( - 'label' => $this->l('ID / Name of shop'), + 'label' => $this->l('ID / Name of shop'), 'help' => $this->l('Ignore this field if you don\'t use multishop tool. If you leave this field empty, default shop will be used'), ), ); @@ -282,11 +282,11 @@ class AdminImport extends AdminTab 'meta_keywords' => array('label' => $this->l('Meta-keywords')), 'meta_description' => array('label' => $this->l('Meta-description')), 'shop' => array( - 'label' => $this->l('ID / Name of group shop'), + 'label' => $this->l('ID / Name of group shop'), 'help' => $this->l('Ignore this field if you don\'t use multishop tool. If you leave this field empty, default shop will be used'), ), ); - + self::$default_values = array( 'shop' => Shop::getGroupFromShop(Configuration::get('PS_SHOP_DEFAULT')), ); @@ -446,11 +446,11 @@ class AdminImport extends AdminTab /** * copyImg copy an image located in $url and save it in a path - * according to $entity->$id_entity . + * according to $entity->$id_entity . * $id_image is used if we need to add a watermark - * + * * @param int $id_entity id of product or category (set in entity) - * @param int $id_image (default null) id of the image if watermark enabled. + * @param int $id_image (default null) id of the image if watermark enabled. * @param string $url path or url to use * @param string entity 'products' or 'categories' * @return void @@ -798,7 +798,7 @@ class AdminImport extends AdminTab } $product->associateTo($shops); } - + // SpecificPrice (only the basic reduction feature is supported by the import) if ((isset($info['reduction_price']) AND $info['reduction_price'] > 0) OR (isset($info['reduction_percent']) AND $info['reduction_percent'] > 0)) { @@ -863,7 +863,7 @@ class AdminImport extends AdminTab $product->deleteImages(); elseif (isset($product->image) AND is_array($product->image) AND sizeof($product->image)) $product->deleteImages(); - + if (isset($product->image) AND is_array($product->image) and sizeof($product->image)) { $productHasImages = (bool)Image::getImages($this->context->language->id, (int)($product->id)); @@ -926,10 +926,10 @@ class AdminImport extends AdminTab $info = array_map('trim', $info); self::setDefaultValues($info); - + $product = new Product((int)($info['id_product']), false, $defaultLanguage); $id_image = null; - + if (isset($info['image_url']) && $info['image_url']) { $productHasImages = (bool)Image::getImages($this->context->language->id, $product->id); @@ -1035,7 +1035,7 @@ class AdminImport extends AdminTab if (($fieldError = $customer->validateFields(UNFRIENDLY_ERROR, true)) === true AND ($langFieldError = $customer->validateFieldsLang(UNFRIENDLY_ERROR, true)) === true) { $customer->id_group_shop = Shop::getGroupFromShop($customer->id_shop); - + if ($customer->id AND $customer->customerIdExists($customer->id)) $res = $customer->update(); if (!$res) @@ -1125,7 +1125,7 @@ class AdminImport extends AdminTab } if(isset($address->customer_email) and !empty($address->customer_email)) - { + { if( Validate::isEmail($address->customer_email)) { $customer = Customer::customerExists($address->customer_email, true); @@ -1211,7 +1211,7 @@ class AdminImport extends AdminTab $res = $manufacturer->update(); if (!$res) $res = $manufacturer->add(); - + if ($res) { // Associate supplier to group shop @@ -1450,7 +1450,7 @@ class AdminImport extends AdminTab $("label[for=match_ref],#match_ref").show(); } $("#entitie").html($("#entity > option:selected").text().toLowerCase()); - $.getJSON("'.dirname(self::$currentIndex).'/ajax.php", + $.getJSON("'.dirname(self::$currentIndex).'/ajax.php", { getAvailableFields:1, entity: $("#entity").val()}, @@ -1478,7 +1478,7 @@ class AdminImport extends AdminTab $array[$key] = utf8_encode($value); else $array = utf8_encode($array); - + return $array; } @@ -1561,7 +1561,7 @@ class AdminImport extends AdminTab public function displayCSV() { $importMatchs = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'import_match'); - + echo ' ' : ' - - +
@@ -1390,7 +1390,7 @@ class Ebay extends Module WHERE `quantity` > 0 AND `active` = 1 AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0)'); - // Retrieve products list for eBay (which have matched categories) + // Retrieve products list for eBay (which have matched categories) $productsList = Db::getInstance()->ExecuteS(' SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `quantity` > 0 AND `active` = 1 @@ -1400,7 +1400,7 @@ class Ebay extends Module ORDER BY `id_product` LIMIT 1'); - // How Many Product Less ? + // How Many Product Less ? $nbProductsLess = Db::getInstance()->getValue(' SELECT COUNT(`id_product`) FROM `'._DB_PREFIX_.'product` WHERE `quantity` > 0 AND `active` = 1 @@ -1417,7 +1417,7 @@ class Ebay extends Module WHERE `quantity` > 0 AND `active` = 1 AND `id_category_default` IN (SELECT `id_category` FROM `'._DB_PREFIX_.'ebay_category_configuration` WHERE `id_category` > 0 AND `id_ebay_category` > 0 AND `sync` = 1)'); - // Retrieve products list for eBay (which have matched categories) + // Retrieve products list for eBay (which have matched categories) $productsList = Db::getInstance()->ExecuteS(' SELECT `id_product` FROM `'._DB_PREFIX_.'product` WHERE `quantity` > 0 AND `active` = 1 @@ -1427,7 +1427,7 @@ class Ebay extends Module ORDER BY `id_product` LIMIT 1'); - // How Many Product Less ? + // How Many Product Less ? $nbProductsLess = Db::getInstance()->getValue(' SELECT COUNT(`id_product`) FROM `'._DB_PREFIX_.'product` WHERE `quantity` > 0 AND `active` = 1 @@ -1735,7 +1735,7 @@ class Ebay extends Module } } } - } + } else { // No variations case @@ -1897,7 +1897,7 @@ class Ebay extends Module

1) Onglet « Paramètres »

Cette section est à configurer lors de la première utilisation du module.
Vous devez définir votre compte PayPal comme moyen de paiement de produits sur eBay en renseignant l’email que vous utilisez pour votre compte PayPal.
Si vous n’en avez pas, vous devez souscrire à un compte PayPal Business.
Vous devez définir le moyen et les frais de livraison qui seront appliqués à vos produits sur eBay.

- +

2) Onglet « Configuration des catégories »

Avant de publier vos produits sur eBay, vous devez associer les catégories de produits de votre boutique Prestashop avec celles d’eBay. Vous pouvez également choisir de vendre les produits de votre boutique Prestashop à un prix différent sur eBay. Cet impact sur le prix est défini en %.

NB : Certaines catégories bénéficient du nouveau format d’annonce multi-versions.

diff --git a/modules/fianetfraud/fianetfraud.php b/modules/fianetfraud/fianetfraud.php index 477f93425..21933a722 100644 --- a/modules/fianetfraud/fianetfraud.php +++ b/modules/fianetfraud/fianetfraud.php @@ -1,6 +1,6 @@ 'Transporteur (La Poste, Colissimo, UPS, DHL... ou tout transporteur privé)', 5 => 'Emission d’un billet électronique, téléchargements' ); - + private $_payement_type = array( 1 => 'carte', 2 => 'cheque', @@ -157,9 +157,9 @@ class Fianetfraud extends Module } private function _postProcess() - { + { $error = false; - + Configuration::updateValue('SAC_PRODUCTION', ((Tools::getValue('fianetfraud_production') == 1 ) ? 1 : 0)); Configuration::updateValue('SAC_LOGIN', Tools::getValue('fianetfraud_login')); Configuration::updateValue('SAC_PASSWORD', Tools::getValue('fianetfraud_password')); @@ -167,20 +167,20 @@ class Fianetfraud extends Module Configuration::updateValue('SAC_DEFAULT_PRODUCT_TYPE', Tools::getValue('fianetfraud_product_type')); Configuration::updateValue('SAC_DEFAULT_CARRIER_TYPE', Tools::getValue('fianetfraud_default_carrier')); Configuration::updateValue('SAC_MINIMAL_ORDER', Tools::getValue('fianetfraud_minimal_order')); - + if (isset($_POST['payementBox'])) { Configuration::updateValue('SAC_PAYMENT_MODULE', implode(',', $_POST['payementBox'])); - foreach ($_POST['payementBox'] as $payment) + foreach ($_POST['payementBox'] as $payment) Configuration::updateValue('SAC_PAYMENT_TYPE_'.$payment,Tools::getValue($payment)); } - + $categories = Category::getSimpleCategories($this->context->language->id); foreach ($categories AS $category) Configuration::updateValue('SAC_CATEGORY_TYPE_'.$category['id_category'],Tools::getValue('cat_'.$category['id_category'])); - + $carriers = Carrier::getCarriers($this->context->language->id); - foreach ($carriers as $carrier) + foreach ($carriers as $carrier) { if (isset($_POST['carrier_'.$carrier['id_carrier']])) Configuration::updateValue('SAC_CARRIER_TYPE_'.$carrier['id_carrier'], $_POST['carrier_'.$carrier['id_carrier']]); @@ -190,7 +190,7 @@ class Fianetfraud extends Module $this->_html .= '
'.$this->l('Invalid carrier code').'
'; } } - + if (!$error) { $dataSync = ((($site_id = Configuration::get('SAC_SITEID')) AND Configuration::get('SAC_PRODUCTION')) @@ -199,7 +199,7 @@ class Fianetfraud extends Module ); $this->_html .= '
'.$this->l('Settings are updated').$dataSync.'
'; } - + } public function getContent() @@ -289,7 +289,7 @@ class Fianetfraud extends Module $this->_html .= '
 
'; - + /* Get all modules then select only payment ones*/ $modules = Module::getModulesOnDisk(); $modules_is_fianet = explode(',', Configuration::get('SAC_PAYMENT_MODULE')); @@ -303,12 +303,12 @@ class Fianetfraud extends Module $countries = DB::getInstance()->ExecuteS('SELECT id_country FROM '._DB_PREFIX_.'module_country WHERE id_module = '.(int)($module->id)); foreach ($countries as $country) $module->country[] = $country['id_country']; - + $module->currency = array(); $currencies = DB::getInstance()->ExecuteS('SELECT id_currency FROM '._DB_PREFIX_.'module_currency WHERE id_module = '.(int)($module->id)); foreach ($currencies as $currency) $module->currency[] = $currency['id_currency']; - + $module->group = array(); $groups = DB::getInstance()->ExecuteS('SELECT id_group FROM '._DB_PREFIX_.'module_group WHERE id_module = '.(int)($module->id)); foreach ($groups as $group) @@ -327,7 +327,7 @@ class Fianetfraud extends Module
'.$customer['id_customer'].''.$imgGender.' '.stripslashes($customer['lastname']).' '.stripslashes($customer['firstname']).' '.stripslashes($customer['email']).' '.$this->l('Write to this customer').' '.Tools::displayDate($customer['birthday'], $this->context->language->id).'
- + '; foreach ($this->paymentModules as $module) @@ -336,10 +336,10 @@ class Fianetfraud extends Module $this->_html .= ''; } - + $this->_html .= '
'.$this->l('Payment Module').''.$this->l('Payment Type').'
'.$module->name.''.stripslashes($module->displayName).'


@@ -409,10 +409,10 @@ class Fianetfraud extends Module { if ($params['order']->total_paid <= 0) return; - + if (!$this->needCheck($params['order']->module, $params['order']->total_paid)) return false; - + $address_delivery = new Address((int)($params['order']->id_address_delivery)); $address_invoice = new Address((int)($params['order']->id_address_invoice)); $customer = new Customer((int)($params['order']->id_customer)); @@ -423,7 +423,8 @@ class Fianetfraud extends Module else $orderFianet->billing_user->set_quality_professional(); - $orderFianet->billing_user->titre = (($customer->id_gender == 1) ? $this->l('Mr.') : (($customer->id_gender == 2 ) ? $this->l('Mrs') : $this->l('Mr.'))); + $gender = new Gender($customer->id_gender); + $orderFianet->billing_user->titre = $gender->name; $orderFianet->billing_user->nom = utf8_decode($address_invoice->lastname); $orderFianet->billing_user->prenom = utf8_decode($address_invoice->firstname); $orderFianet->billing_user->societe = utf8_decode($address_invoice->company); @@ -455,14 +456,15 @@ class Fianetfraud extends Module { $orderFianet->delivery_user = new fianet_delivery_user_xml(); $orderFianet->delivery_adress = new fianet_delivery_adress_xml(); - + if ($address_delivery->company == '') $orderFianet->delivery_user->set_quality_nonprofessional(); else $orderFianet->delivery_user->set_quality_professional(); - - $orderFianet->delivery_user->titre = (($customer->id_gender == 1) ? $this->l('Mr.') : (($customer->id_gender == 2) ? $this->l('Mrs') : $this->l('Unknown'))); - + + + $orderFianet->delivery_user->titre = $gender->name; + $orderFianet->delivery_user->nom = utf8_decode($address_delivery->lastname); $orderFianet->delivery_user->prenom = utf8_decode($address_delivery->firstname); $orderFianet->delivery_user->societe = utf8_decode($address_delivery->company); @@ -471,7 +473,7 @@ class Fianetfraud extends Module $orderFianet->delivery_user->telmobile = utf8_decode($address_delivery->phone_mobile); $orderFianet->delivery_user->telfax = ''; $orderFianet->delivery_user->email = $customer->email; - + $orderFianet->delivery_adress->rue1 = utf8_decode($address_delivery->address1); $orderFianet->delivery_adress->rue2 = utf8_decode($address_delivery->address2); $orderFianet->delivery_adress->cpostal = utf8_decode($address_delivery->postcode); @@ -479,7 +481,7 @@ class Fianetfraud extends Module $country = new Country((int)($address_delivery->id_country)); $orderFianet->delivery_adress->pays = utf8_decode($country->name[$id_lang]); } - + $orderFianet->info_commande->refid = ($params['order']->id); $orderFianet->info_commande->montant = $params['order']->total_paid; $currency = new Currency((int)($params['order']->id_currency)); @@ -495,7 +497,7 @@ class Fianetfraud extends Module $have_sac_cat = false; $produit = new fianet_product_xml(); - + if(Configuration::get('SAC_CATEGORY_TYPE_'.$product['id_category_default'])) { $produit->type = Configuration::get('SAC_CATEGORY_TYPE_'.$product['id_category_default']); @@ -521,7 +523,7 @@ class Fianetfraud extends Module $sender->mode = 'production'; else $sender->mode = 'test'; - + $sender->add_order($orderFianet); $res = $sender->send_orders_stacking(); Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'fianet_fraud_orders(id_order, date_add) VALUES('.(int)($params['order']->id).', \''.pSQL(date('Y-m-d H:i:s')).'\')'); diff --git a/modules/fianetsceau/fianetsceau.php b/modules/fianetsceau/fianetsceau.php index 2d4295561..bae324411 100644 --- a/modules/fianetsceau/fianetsceau.php +++ b/modules/fianetsceau/fianetsceau.php @@ -1,6 +1,6 @@ name = 'fianetsceau'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->limited_countries = array('fr'); - + parent::__construct(); - + $this->displayName = $this->l('FIA-NET Seal of Confidence'); $this->description = $this->l('Turn your visitors into buyers by creating confidence in your site.'); if (!Configuration::get('FIANET_SCEAU_PRIVATEKEY')) @@ -48,7 +48,7 @@ class FianetSceau extends Module if (!Configuration::get('FIANET_SCEAU_SITEID')) $this->warning = $this->l('Please enter your site ID.'); } - + public function install() { return (parent::install() AND @@ -79,13 +79,13 @@ class FianetSceau extends Module else Configuration::updateValue('FIANET_SCEAU_SITEID', Tools::getValue('FIANET_SCEAU_SITEID')); Configuration::updateValue('FIANET_SCEAU_PRIVATEKEY', Tools::getValue('FIANET_SCEAU_PRIVATEKEY')); - + if ((int)Tools::getValue('fia_net_mode')) $dataSync = (($site_id = Configuration::get('FIANET_SCEAU_SITEID')) ? '' : 'toto'); else $dataSync = ''; return $this->_html .= $this->displayConfirmation($this->l('Configuration updated').$dataSync); } - + public function getContent() { $output = '

'.$this->displayName.'

'; @@ -93,7 +93,7 @@ class FianetSceau extends Module $output .= parent::displayError('You need to enable Curl library to use this module'); else if (Tools::isSubmit('submitFianet')) $output .= self::getProcess(); - + $output .= '
'.$this->displayName.' @@ -131,13 +131,13 @@ class FianetSceau extends Module

 

- +
'; return $output; } - + private function sendXML() { $SiteID = Configuration::get('FIANET_SCEAU_SITEID'); @@ -148,15 +148,15 @@ class FianetSceau extends Module $user = $control->addChild('utilisateur'); $name = $user->addChild('nom', $customer->lastname); - if ($customer->id_gender == 1 OR $customer->id_gender == 2) + if ($customer->id_gender) $name->addAttribute('titre', 1); $user->addChild('prenom', $customer->firstname); $user->addChild('email', $customer->email); - + $info = $control->addChild('infocommande'); $info->addChild('siteid', $SiteID); $info->addChild('refid', (int)$order->id); - + $total = round($order->total_paid / $currency->conversion_rate, 2); $amount = $info->addChild('montant', $total); $amount->addAttribute('devise', 'EUR'); @@ -173,12 +173,12 @@ class FianetSceau extends Module SELECT date_add FROM '._DB_PREFIX_.'orders WHERE id_order = '.(int)$order->id); - $customer_ip = $info->addChild('ip', $ip); + $customer_ip = $info->addChild('ip', $ip); $customer_ip->addAttribute('timestamp', $order_date); $cryptKey = md5(Configuration::get('FIANET_SCEAU_PRIVATEKEY').'_'.(int)$order->id.'+'.$order_date.'='.$customer->email); $control->addChild('crypt', $cryptKey); - + $XMLInfo = $control->asXML(); $CheckSum = md5($XMLInfo); @@ -196,7 +196,7 @@ class FianetSceau extends Module return true; return false; } - + public function hookUpdateOrderStatus($params) { $this->id_order = (int)$params['id_order']; @@ -224,12 +224,12 @@ class FianetSceau extends Module WHERE a.id = '.(int)$res['id']); } } - + public function hookLeftColumn($params) { return $this->hookRightColumn($params); } - + public function hookRightColumn($params) { return 'Voir la fiche marchand sur Fia-net.com'; diff --git a/modules/importerosc/importerosc.php b/modules/importerosc/importerosc.php index 4a2ad6a33..4932f3c7b 100644 --- a/modules/importerosc/importerosc.php +++ b/modules/importerosc/importerosc.php @@ -1,6 +1,6 @@ displayName = $this->l('Importer osCommerce'); - $this->description = $this->l('This module allows you to import from osCommerce to Prestashop.'); + $this->description = $this->l('This module allows you to import from osCommerce to Prestashop.'); } - + public function install() { if (!parent::install() OR !$this->registerHook('beforeAuthentication')) return false; - return true; + return true; } - + public function uninstall() { if (!parent::uninstall()) return false; return true; } - + public function displaySpecificOptions() { $langagues = $this->ExecuteS('SELECT * FROM `'.addslashes($this->prefix).'languages`'); $curencies = $this->ExecuteS('SELECT * FROM `'.addslashes($this->prefix).'currencies`'); - + $html = '
/

'.$this->l('Specify the root URL of your site oscommerce').'

'; - - - + + + return $html; } - + public function validateSpecificOptions() - { + { $errors = array(); if (Tools::getValue('defaultOscLang') == 0) $errors[] = $this->l('Please select a default language'); @@ -103,25 +103,25 @@ class importerosc extends ImportModule die('{"hasError" : true, "error" : '.Tools::jsonEncode($errors).'}'); } - + public function getDefaultIdLang () { return Tools::getValue('defaultOscLang'); } - + public function getDefaultIdCurrency () { return Tools::getValue('defaultOscCurrency'); } - - + + public function getLangagues($limit = 0, $nrb_import = 100) { $identifier = 'id_lang'; $langagues = $this->ExecuteS('SELECT languages_id as id_lang, name as name, code as iso_code, 1 as active FROM `'.addslashes($this->prefix).'languages` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($langagues, $identifier); + return $this->autoFormat($langagues, $identifier); } - + public function getCurrencies($limit = 0, $nrb_import = 100) { $identifier = 'id_currency'; @@ -130,16 +130,16 @@ class importerosc extends ImportModule CONCAT(`symbol_left`, `symbol_right`) as sign, value as conversion_rate FROM `'.addslashes($this->prefix).'currencies` LIMIT '.(int)($limit).' , '.(int)$nrb_import ); - return $this->autoFormat($currencies, $identifier); + return $this->autoFormat($currencies, $identifier); } - + public function getZones($limit = 0, $nrb_import = 100) { $identifier = 'id_zone'; $zones = $this->ExecuteS('SELECT geo_zone_id as id_zone, geo_zone_name as name, 1 as active FROM `'.addslashes($this->prefix).'geo_zones` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($zones, $identifier); + return $this->autoFormat($zones, $identifier); } - + public function getCountries($limit = 0, $nrb_import = 100) { $multiLangFields = array('name'); @@ -150,9 +150,9 @@ class importerosc extends ImportModule SELECT countries_id as id_country, countries_name as name, countries_iso_code_2 as iso_code, '.$defaultIdLang.' as id_lang, 1 as id_zone, 0 as id_currency, 1 as contains_states, 1 as need_identification_number, 1 as active, 1 as display_tax_label FROM `'.addslashes($this->prefix).'countries` as c LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); + return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); } - + public function getStates($limit = 0, $nrb_import = 100) { $identifier = 'id_state'; @@ -164,18 +164,18 @@ class importerosc extends ImportModule 'iso_code' => 999, 'name' => 'osc', 'active' => 0 - ) + ) ); - return $this->autoFormat($states, $identifier); + return $this->autoFormat($states, $identifier); } - + public function getGroups() { $idLang = $this->getDefaultIdLang(); return array( 1 => array( 'id_group' => 1, 'price_display_method' => 0, - 'name' => array($idLang => $this->l('Default osCommerce Group')) + 'name' => array($idLang => $this->l('Default osCommerce Group')) ) ); } @@ -198,11 +198,11 @@ class importerosc extends ImportModule if (isset($customer['id_gender']) && array_key_exists($customer['id_gender'], $genderMatch)) $customer['id_gender'] = $genderMatch[$customer['id_gender']]; else - $customer['id_gender'] = 9; + $customer['id_gender'] = 0; return $this->autoFormat($customers, $identifier); } - + public function getAddresses($limit = 0, $nrb_import = 100) { $identifier = 'id_address'; @@ -218,10 +218,10 @@ class importerosc extends ImportModule $multiLangFields = array('name', 'link_rewrite'); $keyLanguage = 'id_lang'; $identifier = 'id_category'; - + $categories = $this->ExecuteS(' SELECT c.categories_id as id_category, c.parent_id as id_parent, 0 as level_depth, cd.language_id as id_lang, cd.categories_name as name , 1 as active, categories_image as images - FROM `'.addslashes($this->prefix).'categories` c + FROM `'.addslashes($this->prefix).'categories` c LEFT JOIN `'.addslashes($this->prefix).'categories_description` cd ON (c.categories_id = cd.categories_id) WHERE cd.categories_name IS NOT NULL AND cd.language_id IS NOT NULL ORDER BY c.categories_id, cd.language_id @@ -233,7 +233,7 @@ class importerosc extends ImportModule } return $this->autoFormat($categories, $identifier, $keyLanguage, $multiLangFields); } - + public function getAttributesGroups($limit = 0, $nrb_import = 100) { $multiLangFields = array('name', 'public_name'); @@ -241,11 +241,11 @@ class importerosc extends ImportModule $identifier = 'id_attribute_group'; $countries = $this->ExecuteS(' SELECT products_options_id as id_attribute_group, products_options_name as name , products_options_name as public_name, language_id as id_lang, 0 as is_color_group - FROM `'.addslashes($this->prefix).'products_options` + FROM `'.addslashes($this->prefix).'products_options` LIMIT '.(int)($limit).' , '.(int)$nrb_import); - return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); + return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); } - + public function getAttributes($limit = 0, $nrb_import = 100) { $multiLangFields = array('name'); @@ -258,7 +258,7 @@ class importerosc extends ImportModule LIMIT '.(int)($limit).' , '.(int)$nrb_import); return $this->autoFormat($countries, $identifier, $keyLanguage, $multiLangFields); } - + public function getProducts($limit = 0, $nrb_import = 100) { $multiLangFields = array('name', 'link_rewrite', 'description'); @@ -270,11 +270,11 @@ class importerosc extends ImportModule pd.products_description as description, CONCAT(\''.Tools::getProtocol().Tools::getValue('shop_url').'\/images/\',p.`products_image`) as images, (SELECT ptc.categories_id FROM `'.addslashes($this->prefix).'products_to_categories` ptc WHERE ptc.`products_id` = p.`products_id` LIMIT 1) as id_category_default, p.`products_date_added` as date_add - FROM `'.addslashes($this->prefix).'products` p + FROM `'.addslashes($this->prefix).'products` p LEFT JOIN `'.addslashes($this->prefix).'products_description` pd ON (p.products_id = pd.products_id) WHERE pd.products_name IS NOT NULL AND pd.language_id IS NOT NULL LIMIT '.(int)($limit).' , '.(int)$nrb_import); - + $this->Execute('CREATE TABLE IF NOT EXISTS`products_images` ( `id` int(11) NOT NULL AUTO_INCREMENT, `products_id` int(11) NOT NULL, @@ -296,7 +296,7 @@ class importerosc extends ImportModule } return $this->autoFormat($products, $identifier, $keyLanguage, $multiLangFields); } - + public function getProductsCombination($limit = 0, $nrb_import = 100) { $identifier = 'id_product_attribute'; @@ -310,7 +310,7 @@ class importerosc extends ImportModule } return $this->autoFormat($combinations, $identifier); } - + public function getManufacturers($limit = 0, $nrb_import = 100) { $identifier = 'id_manufacturer'; @@ -319,10 +319,10 @@ class importerosc extends ImportModule FROM `'.addslashes($this->prefix).'manufacturers` LIMIT '.(int)($limit).' , '.(int)$nrb_import); foreach($manufacturers as& $manufacturer) $manufacturer['images'] = array(Tools::getProtocol().Tools::getValue('shop_url').'/images/'.$manufacturer['images']); - + return $this->autoFormat($manufacturers, $identifier); } - + public function getOrdersStates($limit = 0, $nrb_import = 100) { $multiLangFields = array('name'); @@ -334,7 +334,7 @@ class importerosc extends ImportModule LIMIT '.(int)($limit).' , '.(int)$nrb_import);//IF(`public_flag` = 0, 1, 0) as hidden return $this->autoFormat($ordersStates, $identifier, $keyLanguage, $multiLangFields); } - + public function getOrders($limit = 0, $nrb_import = 100) { $orders = array(); @@ -344,13 +344,13 @@ class importerosc extends ImportModule $matchAddresses[$address['id_customer']] = $address['id_address']; $psCarrierDefault = (int)Configuration::get('PS_CARRIER_DEFAULT'); $psCurrency = Currency::getCurrencies(); - + foreach($psCurrency as $key => $currency) { $psCurrency[$currency['iso_code']] = $currency['id_currency']; unset($psCurrency[$key]); } - + $orders = $this->ExecuteS(' SELECT orders_id as id_cart, '.$psCarrierDefault.' as id_carrier, 1 as id_lang, currency as id_currency, customers_id as id_customer, payment_method as payment, 1 as valid, date_purchased as date_add, last_modified as date_upd @@ -369,22 +369,22 @@ class importerosc extends ImportModule $orders[$key]['total_discounts'] = 0; $orders[$key]['total_wrapping'] = 0; $orders[$key]['cart_products'] = $this->ExecuteS(' - SELECT `orders_id` as id_cart, `products_id` as id_product, 0 as id_product_attribute, `products_quantity` as quantity + SELECT `orders_id` as id_cart, `products_id` as id_product, 0 as id_product_attribute, `products_quantity` as quantity FROM `'.addslashes($this->prefix).'orders_products` WHERE `orders_id` = '.$order['id_cart']); $orders[$key]['order_products'] = $this->ExecuteS(' SELECT `orders_id` as id_order, `products_id` as product_id, 0 as product_attribute_id, `products_name` as product_name, `products_quantity` as product_quantity, `final_price` as product_price, 0 as product_weight FROM `'.addslashes($this->prefix).'orders_products` WHERE `orders_id` = '.$order['id_cart']); $orders[$key]['order_history'] = $this->ExecuteS(' - SELECT `orders_status_history_id` as id_order_history, 0 as id_employee, `orders_id` as id_order, `orders_status_id` as id_order_state, `date_added` as date_add + SELECT `orders_status_history_id` as id_order_history, 0 as id_employee, `orders_id` as id_order, `orders_status_id` as id_order_state, `date_added` as date_add FROM `'.addslashes($this->prefix).'orders_status_history` WHERE `orders_id` = '.$order['id_cart']); - + } return $orders; } - + private function autoFormat($items, $identifier, $keyLanguage = NULL, $multiLangFields = array()) - { + { $array = array(); foreach ($items AS $item) if (sizeof($multiLangFields) && is_array($multiLangFields) && isset($array[$item[$identifier]][$multiLangFields[0]])) @@ -399,7 +399,7 @@ class importerosc extends ImportModule else $array[$item[$identifier]][$key] = $value; return $array; - } + } public function hookbeforeAuthentication($params) { @@ -410,7 +410,7 @@ class importerosc extends ImportModule FROM `'._DB_PREFIX_ .'customer` WHERE `active` = 1 AND `email` = \''.pSQL($email).'\''); if ($result && !empty($result['passwd_'.$this->name])) - { + { if($this->checkPwd($passwd, $result['passwd_'.pSQL($this->name)])) { $ps_passwd = md5(pSQL(_COOKIE_KEY_.$passwd)); @@ -420,9 +420,9 @@ class importerosc extends ImportModule WHERE `'._DB_PREFIX_.'customer`.`id_customer` ='.(int)$result['id_customer'].' LIMIT 1'); } } - + } - + private function checkPwd($passwd, $encrypt_pwd) { //checks the type of encryption password @@ -432,7 +432,7 @@ class importerosc extends ImportModule $stack = explode(':', $encrypt_pwd); if (sizeof($stack) != 2) return false; - + if (md5($stack[1] . $passwd) == $stack[0]) return true; else @@ -450,7 +450,7 @@ class importerosc extends ImportModule else return false; } - + } public function displayConfigConnector() diff --git a/modules/paypal/express/authentication.tpl b/modules/paypal/express/authentication.tpl index 3e06010ee..d194f9afc 100644 --- a/modules/paypal/express/authentication.tpl +++ b/modules/paypal/express/authentication.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -51,10 +51,10 @@ countries = new Array();

{l s='Your personal information' mod='paypal'}

{l s='Title'} - - - - + {foreach from=$genders key=k item=gender} + + + {/foreach}

diff --git a/modules/paypal/express/submit.php b/modules/paypal/express/submit.php index 9b6cef460..e38fec258 100644 --- a/modules/paypal/express/submit.php +++ b/modules/paypal/express/submit.php @@ -1,6 +1,6 @@ language->id, 'account', Mail::l('Welcome!'), + if (Mail::Send($context->language->id, 'account', Mail::l('Welcome!'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname)) $context->smarty->assign('confirmation', 1); $context->cookie->id_customer = (int)($customer->id); @@ -326,7 +326,8 @@ function displayAccount() 'zip' => (Tools::getValue('postcode') ? Tools::htmlentitiesUTF8(strval(Tools::getValue('postcode'))) : (isset($result['SHIPTOZIP']) ? $result['SHIPTOZIP'] : '')), 'payerID' => $payerID, 'ppToken' => strval(Context::getContext()->cookie->paypal_token), - 'errors'=> $errors + 'errors'=> $errors, + 'genders' => Gender::getGenders(), )); // Display all and exit diff --git a/modules/secuvad/classes/Secuvad_flux.php b/modules/secuvad/classes/Secuvad_flux.php index 5500873a7..bcd8bc6f8 100644 --- a/modules/secuvad/classes/Secuvad_flux.php +++ b/modules/secuvad/classes/Secuvad_flux.php @@ -1,6 +1,6 @@ idsecuvad = $idsecuvad; $this->encoding = $encoding; } - + public function get_flux_xml_fraud($id_order) { $this->id_order = (int)($id_order); $this->imp_time = date("Y-m-d H:i:s"); $this->flux_xml = 'encoding.'" ?>' . "\n"; $this->flux_xml .= ''.$this->idsecuvad.''.(int)($this->id_order).''.$this->imp_time.''; - + return ($this->flux_xml); } - + function get_flux_xml($id_order) { $this->id_order = (int)($id_order); @@ -59,19 +59,19 @@ class Secuvad_flux $this->flux_xml .= '' . "\n"; return $this->flux_xml; } - + private function get_flux_xml_order() - { - $order = new Order((int)($this->id_order)); + { + $order = new Order((int)($this->id_order)); $address_delivery = new Address((int)($order->id_address_delivery)); $address_invoice = new Address((int)($order->id_address_invoice)); $customer = new Customer((int)($order->id_customer)); $currency = new Currency((int)($order->id_currency)); $carrier = new Carrier((int)($order->id_carrier)); - + $ip = Db::getInstance()->getValue(' - SELECT `ip` - FROM `'._DB_PREFIX_.'secuvad_order` + SELECT `ip` + FROM `'._DB_PREFIX_.'secuvad_order` WHERE `id_secuvad_order` = '.(int)($this->id_order)); if (!$ip) return false; @@ -84,53 +84,39 @@ class Secuvad_flux $card_number = $payment_cc['card_number']; $card_expiration = $payment_cc['card_expiration']; } - + $carrier = Db::getInstance()->getRow(' - SELECT at.`transport_id`, td.`transport_delay_name` - FROM `'._DB_PREFIX_.'secuvad_assoc_transport` at - JOIN `'._DB_PREFIX_.'secuvad_transport_delay` td ON (at.`transport_delay_id` = td.`transport_delay_id`) + SELECT at.`transport_id`, td.`transport_delay_name` + FROM `'._DB_PREFIX_.'secuvad_assoc_transport` at + JOIN `'._DB_PREFIX_.'secuvad_transport_delay` td ON (at.`transport_delay_id` = td.`transport_delay_id`) JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = td.`id_lang`) WHERE l.`id_lang` = '.(int)Context::getContext()->language->id.' AND at.`id_carrier` = '.(int)($order->id_carrier)); $transptype = $carrier['transport_id']; $rapidite = $carrier['transport_delay_name']; - + $code_payment = Db::getInstance()->getValue(' - SELECT sap.`code` - FROM `'._DB_PREFIX_.'module` m + SELECT sap.`code` + FROM `'._DB_PREFIX_.'module` m JOIN `'._DB_PREFIX_.'secuvad_assoc_payment` sap ON (m.`id_module` = sap.`id_module`) WHERE m.`name` = \''.pSQL($order->module).'\''); - + $flux_xml = "\n"; - switch ($customer->id_gender) - { - case 1: - $gender = 'M'; - break; - case 2: - $gender = 'Mme'; - break; - case 3: - $gender = 'Mlle'; - break; - default: - $gender = 'M'; - break; - } - + + $gender = new Gender($customer->id_gender); if($address_invoice->company == '') $flux_xml .= ''."\n"; else $flux_xml .= ''."\n"; - $flux_xml .= ''.$address_invoice->lastname.''."\n"; + $flux_xml .= ''.$address_invoice->lastname.''."\n"; $flux_xml .= ''.$address_invoice->firstname.''."\n"; - if($address_invoice->company != '') + if($address_invoice->company != '') $flux_xml .= ''.$address_invoice->company.''."\n"; $flux_xml .= ''.$address_invoice->phone.''."\n"; $flux_xml .= ''.$address_invoice->phone_mobile.''."\n"; $flux_xml .= ''.$customer->email.''."\n"; $flux_xml .= ''; - + $flux_xml .= ''."\n"; $flux_xml .= ''.$address_invoice->address1.''."\n"; $flux_xml .= ''.$address_invoice->address2.''."\n"; @@ -138,7 +124,7 @@ class Secuvad_flux $flux_xml .= ''.$address_invoice->city.''."\n"; $flux_xml .= ''.$address_invoice->country.''."\n"; $flux_xml .= ''."\n"; - + $flux_xml .= ''."\n"; $flux_xml .= ''.$address_delivery->address1.''."\n"; $flux_xml .= ''.$address_delivery->address2.''."\n"; @@ -146,10 +132,10 @@ class Secuvad_flux $flux_xml .= ''.$address_delivery->city.''."\n"; $flux_xml .= ''.$address_delivery->country.''."\n"; $flux_xml .= ''."\n"; - + $flux_xml .= ''."\n"; $flux_xml .= ''.$this->idsecuvad.''."\n"; - $flux_xml .= ''.(int)($this->id_order).''."\n"; + $flux_xml .= ''.(int)($this->id_order).''."\n"; $flux_xml .= ''.$order->date_add.''."\n"; $flux_xml .= ''.$order->total_paid_real.''."\n"; $flux_xml .= ''.$order->total_shipping.''."\n"; @@ -175,21 +161,21 @@ class Secuvad_flux if (!empty($card_number)) { $cc_array = preg_split('/([X0-9]{4})/Ui', strtoupper($card_number), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); - + if (sizeof($cc_array)) { $bin_array = array(); foreach ($cc_array as $element) $bin_array[] = str_replace('X', '', $element); - + $card_number = str_replace('X', '', $card_number); // 16 char $bin = $bin_array[0].'-'.$bin_array[1]; // 6 char $bin4 = $bin_array[0]; // 4 char $bin42 = $bin_array[0].'-'.$bin_array[3]; // 6 char - + if (strlen($bin42) != 7 AND strlen($bin4) != 4 AND strlen($bin) != 7 AND strlen($card_number) != 16) return false; - + $flux_xml .= ''."\n"; } else @@ -198,13 +184,13 @@ class Secuvad_flux else return false; } - $flux_xml .= ''."\n"; + $flux_xml .= ''."\n"; $flux_xml .= ''."\n"; $flux_xml .= ''."\n"; return $flux_xml; } - + private function get_flux_xml_products() { $flux_xml = ''; @@ -213,11 +199,11 @@ class Secuvad_flux foreach($products as $product) { $data = Db::getInstance()->getRow(' - SELECT sac.`category_id`, pl.`name` - FROM `'._DB_PREFIX_.'secuvad_assoc_category` sac + SELECT sac.`category_id`, pl.`name` + FROM `'._DB_PREFIX_.'secuvad_assoc_category` sac JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = sac.`id_category`) JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`) - JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').') + JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').') JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = pl.`id_lang` AND l.`id_lang` = '.(int)Context::getContext()->language->id.') WHERE pl.`id_product` = '.(int)($product['product_id']).' ORDER BY c.`level_depth` DESC @@ -227,7 +213,7 @@ class Secuvad_flux $flux_xml = ''."\n".$flux_xml.''."\n"; return $flux_xml; } - + } diff --git a/modules/socolissimo/socolissimo.php b/modules/socolissimo/socolissimo.php index 5c8db8dc6..7562c981f 100644 --- a/modules/socolissimo/socolissimo.php +++ b/modules/socolissimo/socolissimo.php @@ -144,29 +144,29 @@ class Socolissimo extends CarrierModule //add carrier in back office if(!$this->createSoColissimoCarrier($this->_config)) return false; - + return true; } public function uninstall() { $so_id = (int)Configuration::get('SOCOLISSIMO_CARRIER_ID'); - - if (!parent::uninstall() + + if (!parent::uninstall() OR !Db::getInstance()->Execute('DROP TABLE IF EXISTS`'._DB_PREFIX_.'socolissimo_delivery_info`') - OR !$this->unregisterHook('extraCarrier') - OR !$this->unregisterHook('payment') + OR !$this->unregisterHook('extraCarrier') + OR !$this->unregisterHook('payment') OR !$this->unregisterHook('AdminOrder') - OR !$this->unregisterHook('newOrder') + OR !$this->unregisterHook('newOrder') OR !$this->unregisterHook('updateCarrier') - OR !Configuration::deleteByName('SOCOLISSIMO_ID') - OR !Configuration::deleteByName('SOCOLISSIMO_KEY') + OR !Configuration::deleteByName('SOCOLISSIMO_ID') + OR !Configuration::deleteByName('SOCOLISSIMO_KEY') OR !Configuration::deleteByName('SOCOLISSIMO_URL') - OR !Configuration::deleteByName('SOCOLISSIMO_OVERCOST') - OR !Configuration::deleteByName('SOCOLISSIMO_PREPARATION_TIME') - OR !Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID') - OR !Configuration::deleteByName('SOCOLISSIMO_SUP') - OR !Configuration::deleteByName('SOCOLISSIMO_SUP_URL') + OR !Configuration::deleteByName('SOCOLISSIMO_OVERCOST') + OR !Configuration::deleteByName('SOCOLISSIMO_PREPARATION_TIME') + OR !Configuration::deleteByName('SOCOLISSIMO_CARRIER_ID') + OR !Configuration::deleteByName('SOCOLISSIMO_SUP') + OR !Configuration::deleteByName('SOCOLISSIMO_SUP_URL') OR !Configuration::deleteByName('SOCOLISSIMO_OVERCOST_TAX')) return false; @@ -194,7 +194,7 @@ class Socolissimo extends CarrierModule $this->_html .= '

' . $this->l('So Colissimo').'

'; if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) $this->_html .= '
nok '.$this->l('So Colissimo isn\'t compliant with One Page Checkout feature, in order to use this module, please activate the standard order process (Preferences > "Order process type")').'
'; - + if (!empty($_POST) AND Tools::isSubmit('submitSave')) { $this->_postValidation(); @@ -231,7 +231,7 @@ class Socolissimo extends CarrierModule

'.$this->l('To open your SoColissimo account, please contact "La Poste" at this phone number: 3634 (French phone number).').'

- +
@@ -243,14 +243,14 @@ class Socolissimo extends CarrierModule

'.$this->l('Secure key for back office SoColissimo.').'

- +
'.$this->l('Day(s)').'

' . $this->l('Average time of preparation of materials.') . '
' .$this->l('Average time must be the same in Coliposte back office.').'

- +
id_customer); - $gender = array('1'=>'MR','2'=>'MME'); - if (in_array((int)($customer->id_gender),array(1,2))) - $cecivility = $gender[(int)($customer->id_gender)]; - else - $cecivility = 'MR'; + $gender = new Gender($customer->id_gender); $carrierSo = new Carrier((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID'))); if (isset($carrierSo) AND $carrierSo->active) @@ -371,7 +367,7 @@ class Socolissimo extends CarrierModule 'ORDERID' => $orderId, 'CENAME' => substr($this->lower($params['address']->lastname),0, 34), 'TRCLIENTNUMBER' => $this->upper((int)($params['address']->id_customer)), - 'CECIVILITY' => $cecivility, + 'CECIVILITY' => $gender->name, 'CEFIRSTNAME' => substr($this->lower($params['address']->firstname),0,29), 'CECOMPANYNAME' => substr($this->upper($params['address']->company),0,38), 'CEEMAIL' => $params['cookie']->email, @@ -387,7 +383,7 @@ class Socolissimo extends CarrierModule 'DYPREPARATIONTIME' => (int)(Configuration::Get('SOCOLISSIMO_PREPARATION_TIME')), 'TRRETURNURLKO' => htmlentities($this->url,ENT_NOQUOTES, 'UTF-8'), 'TRRETURNURLOK' => htmlentities($this->url,ENT_NOQUOTES, 'UTF-8')); - + $serialsInput = ''; foreach($inputs as $key => $val) $serialsInput .= '&'.$key.'='.$val; @@ -406,10 +402,10 @@ class Socolissimo extends CarrierModule $this->context->smarty->assign('already_select_delivery', true); else $this->context->smarty->assign('already_select_delivery', false); - - if (($country->iso_code == 'FR') AND (Configuration::Get('SOCOLISSIMO_ID') != NULL) + + if (($country->iso_code == 'FR') AND (Configuration::Get('SOCOLISSIMO_ID') != NULL) AND (Configuration::get('SOCOLISSIMO_KEY') != NULL) AND $this->checkAvailibility() - AND $this->checkSoCarrierAvailable((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID'))) + AND $this->checkSoCarrierAvailable((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID'))) AND in_array((int)(Configuration::get('SOCOLISSIMO_CARRIER_ID')),$ids)) { return $this->display(__FILE__, 'socolissimo_carrier.tpl'); @@ -745,7 +741,7 @@ class Socolissimo extends CarrierModule } return true; } - + public function getOrderShippingCost($params,$shipping_cost) { $deliveryInfo = $this->getDeliveryInfos($this->context->cart->id, $this->context->cart->id_customer); @@ -753,8 +749,8 @@ class Socolissimo extends CarrierModule if ($deliveryInfo['delivery_mode'] == 'RDV') $shipping_cost += (float)(Configuration::get('SOCOLISSIMO_OVERCOST')); return $shipping_cost; - } - + } + public function getOrderShippingCostExternal($params){} } diff --git a/modules/statspersonalinfos/statspersonalinfos.php b/modules/statspersonalinfos/statspersonalinfos.php index 2aabd35b3..4a3eedb02 100644 --- a/modules/statspersonalinfos/statspersonalinfos.php +++ b/modules/statspersonalinfos/statspersonalinfos.php @@ -1,6 +1,6 @@ csvExport(array('type' => 'pie', 'option' => 'currency')); elseif (Tools::getValue('exportType') =='language') $this->csvExport(array('type' => 'pie', 'option' => 'language')); - + $this->_html .= ' - +

'.$this->l('Gender distribution allows you to determine the percentage of men and women among your customers.').'

'.$this->engine(array('type' => 'pie', 'option' => 'gender')).'

'.$this->l('CSV Export').'

@@ -124,27 +124,43 @@ class StatsPersonalInfos extends ModuleGraph { case 'gender': $this->_titles['main'] = $this->l('Gender distribution'); - $sql = 'SELECT `id_gender`, COUNT(`id_customer`) AS total - FROM `'._DB_PREFIX_.'customer` + $genders = array( + 0 => $this->l('Male'), + 1 => $this->l('Female'), + 2 => $this->l('Unknown'), + ); + + $sql = 'SELECT g.type, c.id_gender, COUNT(c.id_customer) AS total + FROM '._DB_PREFIX_.'customer c + LEFT JOIN '._DB_PREFIX_.'gender g ON c.id_gender = g.id_gender WHERE 1 - '.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).' - GROUP BY `id_gender`'; + '.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER, 'c').' + GROUP BY c.id_gender'; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); - $gender = array(1 => $this->l('Male'), 2 => $this->l('Female'), 9 => $this->l('Unknown'), 0 => $this->l('Unknown')); + + $gendersResults = array(); foreach ($result as $row) { - $this->_values[] = $row['total']; - $this->_legend[] = $gender[$row['id_gender']]; + $type = (is_null($row['type'])) ? 2 : $row['type']; + if (!isset($gendersResults[$type])) + $gendersResults[$type] = 0; + $gendersResults[$type] += $row['total']; + } + + foreach ($gendersResults as $type => $total) + { + $this->_values[] = $total; + $this->_legend[] = $genders[$type]; } break; case 'age': $this->_titles['main'] = $this->l('Age ranges'); - + // 0 - 18 years $sql = 'SELECT COUNT(`id_customer`) as total FROM `'._DB_PREFIX_.'customer` - WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 18 + WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 18 '.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).' AND `birthday` IS NOT NULL'; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); @@ -153,7 +169,7 @@ class StatsPersonalInfos extends ModuleGraph $this->_values[] = $result['total']; $this->_legend[] = $this->l('0-18 years old'); } - + // 18 - 24 years $sql = 'SELECT COUNT(`id_customer`) as total FROM `'._DB_PREFIX_.'customer` @@ -195,7 +211,7 @@ class StatsPersonalInfos extends ModuleGraph $this->_values[] = $result['total']; $this->_legend[] = $this->l('35-49 years old'); } - + // 50 - 59 years $sql = 'SELECT COUNT(`id_customer`) as total FROM `'._DB_PREFIX_.'customer` @@ -209,7 +225,7 @@ class StatsPersonalInfos extends ModuleGraph $this->_values[] = $result['total']; $this->_legend[] = $this->l('50-59 years old'); } - + // More than 60 years $sql = 'SELECT COUNT(`id_customer`) as total FROM `'._DB_PREFIX_.'customer` @@ -222,7 +238,7 @@ class StatsPersonalInfos extends ModuleGraph $this->_values[] = $result['total']; $this->_legend[] = $this->l('60 years old and more'); } - + // Total unknown $sql = 'SELECT COUNT(`id_customer`) as total FROM `'._DB_PREFIX_.'customer` diff --git a/override/classes/Gender.php b/override/classes/Gender.php new file mode 100644 index 000000000..2a7676aea --- /dev/null +++ b/override/classes/Gender.php @@ -0,0 +1,7 @@ +

{l s='Title'} - - - - + {foreach from=$genders key=k item=gender} + + + {/foreach}

-

+

@@ -296,8 +296,8 @@ $(function(){ldelim} *

-

- *{l s='Required field'} +

+ *{l s='Required field'}

@@ -309,10 +309,10 @@ $(function(){ldelim}

{l s='Your personal information'}

{l s='Title'} - - - - + {foreach from=$genders key=k item=gender} + + + {/foreach}

diff --git a/themes/prestashop/identity.tpl b/themes/prestashop/identity.tpl index 97900b7bc..f95bdcf2b 100644 --- a/themes/prestashop/identity.tpl +++ b/themes/prestashop/identity.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -43,10 +43,10 @@

{l s='Title'} - - - - + {foreach from=$genders key=k item=gender} + + + {/foreach}

diff --git a/themes/prestashop/order-opc-new-account.tpl b/themes/prestashop/order-opc-new-account.tpl index d4c2fadeb..d7890faaf 100644 --- a/themes/prestashop/order-opc-new-account.tpl +++ b/themes/prestashop/order-opc-new-account.tpl @@ -140,10 +140,10 @@

{l s='Title'} - - - - + {foreach from=$genders key=k item=gender} + + + {/foreach}