// Merge -> 8910

This commit is contained in:
rMalie committed 2011-09-30 08:17:25 +00:00
1 parent 84e77a9bf4
commit 0c40fb9a06
28 files changed
+2046 -118

No files matched your search

+9 -10
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -25,7 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
class AdminShipping extends AdminTab class AdminShipping extends AdminTab
{ {
private $_fieldsHandling; private $_fieldsHandling;
@@ -92,7 +91,7 @@ class AdminShipping extends AdminTab
{ {
/* Get configuration values */ /* Get configuration values */
$shipping_method = $carrier->getShippingMethod(); $shipping_method = $carrier->getShippingMethod();
$rangeTable = $carrier->getRangeTable(); $rangeTable = $carrier->getRangeTable();
$carrier->deleteDeliveryPrice($rangeTable); $carrier->deleteDeliveryPrice($rangeTable);
$currentList = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier); $currentList = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
@@ -104,7 +103,7 @@ class AdminShipping extends AdminTab
{ {
$tmpArray = explode('_', $key); $tmpArray = explode('_', $key);
$price = number_format(abs(str_replace(',', '.', $value)), 2, '.', ''); $price = number_format(abs(str_replace(',', '.', $value)), 6, '.', '');
$current = 0; $current = 0;
foreach ($currentList as $item) foreach ($currentList as $item)
if ($item['id_zone'] == $tmpArray[1] && $item['id_'.$rangeTable] == $tmpArray[2]) if ($item['id_zone'] == $tmpArray[1] && $item['id_'.$rangeTable] == $tmpArray[2])
@@ -115,8 +114,8 @@ class AdminShipping extends AdminTab
$priceList[] = array( $priceList[] = array(
'id_range_price' => ($shipping_method == Carrier::SHIPPING_METHOD_PRICE) ? (int)$tmpArray[2] : null, 'id_range_price' => ($shipping_method == Carrier::SHIPPING_METHOD_PRICE) ? (int)$tmpArray[2] : null,
'id_range_weight' => ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) ? (int)$tmpArray[2] : null, 'id_range_weight' => ($shipping_method == Carrier::SHIPPING_METHOD_WEIGHT) ? (int)$tmpArray[2] : null,
'id_carrier' => (int)$carrier->id, 'id_carrier' => (int)$carrier->id,
'id_zone' => (int)$tmpArray[1], 'id_zone' => (int)$tmpArray[1],
'price' => $price, 'price' => $price,
); );
} }
@@ -218,13 +217,13 @@ class AdminShipping extends AdminTab
$id_carrier = (int)$carrierArray[0]['id']; $id_carrier = (int)$carrierArray[0]['id'];
$carrierSelected = new Carrier($id_carrier); $carrierSelected = new Carrier($id_carrier);
} }
echo '<br /><br /> echo '<br /><br />
<h2>'.$this->l('Fees by carrier, geographical zone, and ranges').'</h2> <h2>'.$this->l('Fees by carrier, geographical zone, and ranges').'</h2>
<form action="'.self::$currentIndex.'&token='.$this->token.'" id="fees" name="fees" method="post"> <form action="'.self::$currentIndex.'&token='.$this->token.'" id="fees" name="fees" method="post">
<fieldset> <fieldset>
<legend><img src="../img/admin/delivery.gif" />'.$this->l('Fees').'</legend>'; <legend><img src="../img/admin/delivery.gif" />'.$this->l('Fees').'</legend>';
if (!count($carrierArray)) if (!count($carrierArray))
echo $this->l('You only have free carriers, there is no need to configure your delivery prices.'); echo $this->l('You only have free carriers, there is no need to configure your delivery prices.');
else else
@@ -266,7 +265,7 @@ class AdminShipping extends AdminTab
echo '<td class="center">'.$currency->getSign('left').'<input type="text" id="fees_all_'.$range[$rangeIdentifier].'" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if ((event.keyCode||event.which) != 9){ spreadFees('.$range[$rangeIdentifier].') }" style="width: 45px;" />'.$currency->getSign('right').'</td>'; echo '<td class="center">'.$currency->getSign('left').'<input type="text" id="fees_all_'.$range[$rangeIdentifier].'" onchange="this.value = this.value.replace(/,/g, \'.\');" onkeyup="if ((event.keyCode||event.which) != 9){ spreadFees('.$range[$rangeIdentifier].') }" style="width: 45px;" />'.$currency->getSign('right').'</td>';
echo '</tr>'; echo '</tr>';
} }
foreach ($zones AS $zone) foreach ($zones AS $zone)
{ {
echo ' echo '
@@ -284,7 +283,7 @@ class AdminShipping extends AdminTab
</tr>'; </tr>';
} }
} }
echo '<tr> echo '<tr>
<td colspan="'.(sizeof($ranges) + 1).'" class="center" style="border-bottom: none; height: 40px;"> <td colspan="'.(sizeof($ranges) + 1).'" class="center" style="border-bottom: none; height: 40px;">
<input type="hidden" name="submitFees'.$this->table.'" value="1" />'; <input type="hidden" name="submitFees'.$this->table.'" value="1" />';
+18 -18
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -31,27 +31,27 @@ class AdminStores extends AdminTab
{ {
/** @var array countries list */ /** @var array countries list */
private $countriesArray = array(); private $countriesArray = array();
public function __construct() public function __construct()
{ {
$this->context = Context::getContext(); $this->context = Context::getContext();
$this->table = 'store'; $this->table = 'store';
$this->className = 'Store'; $this->className = 'Store';
$this->lang = false; $this->lang = false;
$this->edit = true; $this->edit = true;
$this->delete = true; $this->delete = true;
$this->fieldImageSettings = array('name' => 'image', 'dir' => 'st'); $this->fieldImageSettings = array('name' => 'image', 'dir' => 'st');
$this->_select = 'cl.`name` country, st.`name` state'; $this->_select = 'cl.`name` country, st.`name` state';
$this->_join = ' $this->_join = '
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.') LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)'; LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)';
$countries = Country::getCountries($this->context->language->id); $countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country) foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name']; $this->countriesArray[$country['id_country']] = $country['name'];
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_store' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_store' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'country' => array('title' => $this->l('Country'), 'width' => 100, 'filter_key' => 'cl!name'), 'country' => array('title' => $this->l('Country'), 'width' => 100, 'filter_key' => 'cl!name'),
@@ -78,7 +78,7 @@ class AdminStores extends AdminTab
); );
parent::__construct(); parent::__construct();
} }
protected function postImage($id) protected function postImage($id)
{ {
$ret = parent::postImage($id); $ret = parent::postImage($id);
@@ -90,14 +90,14 @@ class AdminStores extends AdminTab
} }
return $ret; return $ret;
} }
public function displayOptionsList() public function displayOptionsList()
{ {
parent::displayOptionsList(); parent::displayOptionsList();
echo '<br /><p><img src="../img/admin/asterisk.gif" class="middle" /> '.$this->l('You can also replace the icon representing your store in Google Maps. Go to the Preferences tab, and then the Appearance subtab.').'</p>'; echo '<br /><p><img src="../img/admin/asterisk.gif" class="middle" /> '.$this->l('You can also replace the icon representing your store in Google Maps. Go to the Preferences tab, and then the Appearance subtab.').'</p>';
} }
public function postProcess() public function postProcess()
{ {
if (isset($_POST['submitAdd'.$this->table])) if (isset($_POST['submitAdd'.$this->table]))
@@ -152,11 +152,11 @@ class AdminStores extends AdminTab
if (!sizeof($this->_errors)) if (!sizeof($this->_errors))
parent::postProcess(); parent::postProcess();
} }
public function displayForm($isMainTab = true) public function displayForm($isMainTab = true)
{ {
parent::displayForm(); parent::displayForm();
if (!($obj = $this->loadObject(true))) if (!($obj = $this->loadObject(true)))
return; return;
echo ' echo '
@@ -234,7 +234,7 @@ class AdminStores extends AdminTab
</div> </div>
<label>'.$this->l('Latitude / Longitude:').'</label> <label>'.$this->l('Latitude / Longitude:').'</label>
<div class="margin-form"> <div class="margin-form">
<input type="text" size="8" maxlength="10" name="latitude" value="'.htmlentities($this->getFieldValue($obj, 'latitude'), ENT_COMPAT, 'UTF-8').'" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" /> / <input type="text" size="8" maxlength="10" name="longitude" value="'.htmlentities($this->getFieldValue($obj, 'longitude'), ENT_COMPAT, 'UTF-8').'" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" /> <input type="text" size="11" maxlength="12" name="latitude" value="'.htmlentities($this->getFieldValue($obj, 'latitude'), ENT_COMPAT, 'UTF-8').'" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" /> / <input type="text" size="11" maxlength="12" name="longitude" value="'.htmlentities($this->getFieldValue($obj, 'longitude'), ENT_COMPAT, 'UTF-8').'" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" />
<sup>*</sup> <sup>*</sup>
<p class="clear">'.$this->l('Store coords, eg. 45.265469 / -47.226478').'</p> <p class="clear">'.$this->l('Store coords, eg. 45.265469 / -47.226478').'</p>
</div> </div>
@@ -270,7 +270,7 @@ class AdminStores extends AdminTab
<p class="clear">'.$this->l('Store window picture').'</p>'; <p class="clear">'.$this->l('Store window picture').'</p>';
echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)$this->context->employee->id), true); echo $this->displayImage($obj->id, _PS_STORE_IMG_DIR_.'/'.$obj->id.'.jpg', 350, NULL, Tools::getAdminToken('AdminStores'.(int)(Tab::getIdFromClassName('AdminStores')).(int)$this->context->employee->id), true);
echo '</div> echo '</div>
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;"> <table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;">
<tr> <tr>
@@ -280,7 +280,7 @@ class AdminStores extends AdminTab
<td>&nbsp;</td> <td>&nbsp;</td>
<td style="font-size: 0.85em;">'.$this->l('Sample: 10:00AM - 9:30PM').'</td> <td style="font-size: 0.85em;">'.$this->l('Sample: 10:00AM - 9:30PM').'</td>
</tr>'; </tr>';
$days = array(); $days = array();
$days[1] = $this->l('Monday'); $days[1] = $this->l('Monday');
$days[2] = $this->l('Tuesday'); $days[2] = $this->l('Tuesday');
@@ -289,11 +289,11 @@ class AdminStores extends AdminTab
$days[5] = $this->l('Friday'); $days[5] = $this->l('Friday');
$days[6] = $this->l('Saturday'); $days[6] = $this->l('Saturday');
$days[7] = $this->l('Sunday'); $days[7] = $this->l('Sunday');
$hours = $this->getFieldValue($obj, 'hours'); $hours = $this->getFieldValue($obj, 'hours');
if (!empty($hours)) if (!empty($hours))
$hoursUnserialized = unserialize($hours); $hoursUnserialized = unserialize($hours);
for ($i = 1; $i < 8; $i++) for ($i = 1; $i < 8; $i++)
echo ' echo '
<tr style="color: #7F7F7F; font-size: 0.85em;"> <tr style="color: #7F7F7F; font-size: 0.85em;">
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -828,7 +828,7 @@ abstract class AdminTabCore
$type = (array_key_exists('filter_type', $field) ? $field['filter_type'] : (array_key_exists('type', $field) ? $field['type'] : false)); $type = (array_key_exists('filter_type', $field) ? $field['filter_type'] : (array_key_exists('type', $field) ? $field['type'] : false));
if (($type == 'date' OR $type == 'datetime') AND is_string($value)) if (($type == 'date' OR $type == 'datetime') AND is_string($value))
$value = unserialize($value); $value = unserialize($value);
$key = isset($tmpTab[1]) ? $tmpTab[0].'.`'.$tmpTab[1].'`' : '`'.$tmpTab[0].'`'; $key = isset($tmpTab[1]) ? $tmpTab[0].'.'.$tmpTab[1] : $tmpTab[0];
if (array_key_exists('tmpTableFilter', $field)) if (array_key_exists('tmpTableFilter', $field))
$sqlFilter = & $this->_tmpTableFilter; $sqlFilter = & $this->_tmpTableFilter;
elseif (array_key_exists('havingFilter', $field)) elseif (array_key_exists('havingFilter', $field))
@@ -844,7 +844,7 @@ abstract class AdminTabCore
if (!Validate::isDate($value[0])) if (!Validate::isDate($value[0]))
$this->_errors[] = Tools::displayError('\'from:\' date format is invalid (YYYY-MM-DD)'); $this->_errors[] = Tools::displayError('\'from:\' date format is invalid (YYYY-MM-DD)');
else else
$sqlFilter .= ' AND `'.bqSQL($key).'` >= \''.pSQL(Tools::dateFrom($value[0])).'\''; $sqlFilter .= ' AND '.bqSQL($key).' >= \''.pSQL(Tools::dateFrom($value[0])).'\'';
} }
if (isset($value[1]) AND !empty($value[1])) if (isset($value[1]) AND !empty($value[1]))
@@ -852,7 +852,7 @@ abstract class AdminTabCore
if (!Validate::isDate($value[1])) if (!Validate::isDate($value[1]))
$this->_errors[] = Tools::displayError('\'to:\' date format is invalid (YYYY-MM-DD)'); $this->_errors[] = Tools::displayError('\'to:\' date format is invalid (YYYY-MM-DD)');
else else
$sqlFilter .= ' AND `'.bqSQL($key).'` <= \''.pSQL(Tools::dateTo($value[1])).'\''; $sqlFilter .= ' AND '.bqSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\'';
} }
} }
else else
+11 -13
View File
@@ -1,6 +1,6 @@
<?php <?php
/* /*
* 2007-2011 PrestaShop * 2007-2011 PrestaShop
* *
* NOTICE OF LICENSE * NOTICE OF LICENSE
* *
@@ -26,15 +26,15 @@
*/ */
class CacheFSCore extends Cache { class CacheFSCore extends Cache {
protected $_depth; protected $_depth;
protected function __construct() protected function __construct()
{ {
parent::__construct(); parent::__construct();
$this->_init(); $this->_init();
} }
protected function _init() protected function _init()
{ {
$this->_depth = Db::getInstance()->getValue('SELECT value FROM '._DB_PREFIX_.'configuration WHERE name=\'PS_CACHEFS_DIRECTORY_DEPTH\'', false); $this->_depth = Db::getInstance()->getValue('SELECT value FROM '._DB_PREFIX_.'configuration WHERE name=\'PS_CACHEFS_DIRECTORY_DEPTH\'', false);
@@ -45,23 +45,20 @@ class CacheFSCore extends Cache {
{ {
$path = $this->getPath(); $path = $this->getPath();
for ($i = 0; $i < $this->_depth; $i++) for ($i = 0; $i < $this->_depth; $i++)
{
$path .= $key[$i].'/'; $path .= $key[$i].'/';
} if (@file_put_contents($path.$key, serialize($value)))
if (file_put_contents($path.$key, serialize($value)))
{ {
$this->_keysCached[$key] = true; $this->_keysCached[$key] = true;
return $key; return $key;
} }
return false; return false;
} }
public function setNumRows($key, $value, $expire = 0) public function setNumRows($key, $value, $expire = 0)
{ {
return $this->set($key.'_nrows', $value, $expire); return $this->set($key.'_nrows', $value, $expire);
} }
public function getNumRows($key) public function getNumRows($key)
{ {
return $this->get($key.'_nrows'); return $this->get($key.'_nrows');
@@ -150,8 +147,9 @@ class CacheFSCore extends Cache {
public function __destruct() public function __destruct()
{ {
parent::__destruct(); parent::__destruct();
file_put_contents($this->getPath().'keysCached', serialize($this->_keysCached));
file_put_contents($this->getPath().'tablesCached', serialize($this->_tablesCached)); @file_put_contents($this->getPath().'keysCached', serialize($this->_keysCached));
@file_put_contents($this->getPath().'tablesCached', serialize($this->_tablesCached));
} }
public static function deleteCacheDirectory() public static function deleteCacheDirectory()
@@ -173,7 +171,7 @@ class CacheFSCore extends Cache {
self::createCacheDirectories($level_depth - 1, $new_dir); self::createCacheDirectories($level_depth - 1, $new_dir);
} }
} }
protected function getPath() protected function getPath()
{ {
return (defined('_PS_CACHEFS_DIRECTORY_') ? _PS_CACHEFS_DIRECTORY_ : dirname(__FILE__).'/../cache/cachefs/'); return (defined('_PS_CACHEFS_DIRECTORY_') ? _PS_CACHEFS_DIRECTORY_ : dirname(__FILE__).'/../cache/cachefs/');
+8 -8
View File
@@ -35,7 +35,7 @@ class CarrierCore extends ObjectModel
const CARRIERS_MODULE_NEED_RANGE = 3; const CARRIERS_MODULE_NEED_RANGE = 3;
const PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE = 4; const PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE = 4;
const ALL_CARRIERS = 5; const ALL_CARRIERS = 5;
const SHIPPING_METHOD_DEFAULT = 0; const SHIPPING_METHOD_DEFAULT = 0;
const SHIPPING_METHOD_WEIGHT = 1; const SHIPPING_METHOD_WEIGHT = 1;
const SHIPPING_METHOD_PRICE = 2; const SHIPPING_METHOD_PRICE = 2;
@@ -412,23 +412,23 @@ class CarrierCore extends ObjectModel
{ {
if (!Validate::isBool($activeCountries) OR !Validate::isBool($activeCarriers)) if (!Validate::isBool($activeCountries) OR !Validate::isBool($activeCarriers))
die(Tools::displayError()); die(Tools::displayError());
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' $states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT s.* SELECT s.*
FROM `'._DB_PREFIX_.'state` s FROM `'._DB_PREFIX_.'state` s
ORDER BY s.`name` ASC'); ORDER BY s.`name` ASC');
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone FROM `'._DB_PREFIX_.'country` c SELECT cl.*,c.*, cl.`name` AS country, zz.`name` AS zone FROM `'._DB_PREFIX_.'country` c
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = 1) LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = 1)
INNER JOIN (`'._DB_PREFIX_.'carrier_zone` cz INNER JOIN `'._DB_PREFIX_.'carrier` cr ON ( cr.id_carrier = cz.id_carrier AND cr.deleted = 0 '.($activeCarriers ? INNER JOIN (`'._DB_PREFIX_.'carrier_zone` cz INNER JOIN `'._DB_PREFIX_.'carrier` cr ON ( cr.id_carrier = cz.id_carrier AND cr.deleted = 0 '.($activeCarriers ?
'AND cr.active = 1) ' : ') ').' 'AND cr.active = 1) ' : ') ').'
LEFT JOIN `'._DB_PREFIX_.'zone` zz ON cz.id_zone = zz.id_zone) ON zz.`id_zone` = c.`id_zone` LEFT JOIN `'._DB_PREFIX_.'zone` zz ON cz.id_zone = zz.id_zone) ON zz.`id_zone` = c.`id_zone`
WHERE 1 WHERE 1
'.($activeCountries ? 'AND c.active = 1' : '').' '.($activeCountries ? 'AND c.active = 1' : '').'
'.(!is_null($containStates) ? 'AND c.`contains_states` = '.(int)($containStates) : '').' '.(!is_null($containStates) ? 'AND c.`contains_states` = '.(int)($containStates) : '').'
ORDER BY cl.name ASC'); ORDER BY cl.name ASC');
$countries = array(); $countries = array();
foreach ($result AS &$country) foreach ($result AS &$country)
$countries[$country['id_country']] = $country; $countries[$country['id_country']] = $country;
@@ -438,12 +438,12 @@ class CarrierCore extends ObjectModel
return $countries; return $countries;
} }
/** /**
* *
* @param int $id_zone * @param int $id_zone
* @param Array $groups group of the customer * @param Array $groups group of the customer
* @return Array * @return Array
*/ */
public static function getCarriersForOrder($id_zone, $groups = NULL) public static function getCarriersForOrder($id_zone, $groups = NULL)
{ {
+6 -4
View File
@@ -986,14 +986,16 @@ class OrderCore extends ObjectModel
return $result; return $result;
} }
public function setCurrentState($id_order_state) public function setCurrentState($id_order_state, $id_employee)
{ {
if (empty($id_order_state)) if (empty($id_order_state))
return false; return false;
$history = new OrderHistory(); $history = new OrderHistory();
$history->id_order = (int)($this->id); $history->id_order = (int)$this->id;
$history->changeIdOrderState((int)$id_order_state, (int)($this->id)); $history->id_employee = (int)$id_employee;
$res = Db::getInstance()->getRow('SELECT `invoice_number`, `invoice_date`, `delivery_number`, `delivery_date` $history->changeIdOrderState((int)$id_order_state, (int)$this->id);
$res = Db::getInstance()->getRow('
SELECT `invoice_number`, `invoice_date`, `delivery_number`, `delivery_date`
FROM `'._DB_PREFIX_.'orders` FROM `'._DB_PREFIX_.'orders`
WHERE `id_order` = '.(int)$this->id); WHERE `id_order` = '.(int)$this->id);
$this->invoice_date = $res['invoice_date']; $this->invoice_date = $res['invoice_date'];
+8 -9
View File
@@ -62,9 +62,9 @@ class OrderHistoryCore extends ObjectModel
{ {
$this->validateFields(); $this->validateFields();
$fields['id_order'] = (int)($this->id_order); $fields['id_order'] = (int)$this->id_order;
$fields['id_order_state'] = (int)($this->id_order_state); $fields['id_order_state'] = (int)$this->id_order_state;
$fields['id_employee'] = (int)($this->id_employee); $fields['id_employee'] = (int)$this->id_employee;
$fields['date_add'] = pSQL($this->date_add); $fields['date_add'] = pSQL($this->date_add);
return $fields; return $fields;
@@ -143,18 +143,17 @@ class OrderHistoryCore extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'customer` c ON o.`id_customer` = c.`id_customer` LEFT JOIN `'._DB_PREFIX_.'customer` c ON o.`id_customer` = c.`id_customer`
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON oh.`id_order_state` = os.`id_order_state` LEFT JOIN `'._DB_PREFIX_.'order_state` os ON oh.`id_order_state` = os.`id_order_state`
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`) LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`)
WHERE oh.`id_order_history` = '.(int)($this->id).' WHERE oh.`id_order_history` = '.(int)($this->id).' AND os.`send_email` = 1');
AND os.`send_email` = 1');
if (isset($result['template']) AND Validate::isEmail($result['email'])) if (isset($result['template']) AND Validate::isEmail($result['email']))
{ {
$topic = $result['osname']; $topic = $result['osname'];
$data = array('{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)($this->id_order)); $data = array('{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order);
if ($templateVars) if ($templateVars)
$data = array_merge($data, $templateVars); $data = array_merge($data, $templateVars);
$order = new Order((int)($this->id_order)); $order = new Order((int)$this->id_order);
$data['{total_paid}'] = Tools::displayPrice((float)($order->total_paid), new Currency((int)($order->id_currency)), false); $data['{total_paid}'] = Tools::displayPrice((float)$order->total_paid, new Currency((int)$order->id_currency), false);
$data['{order_name}'] = sprintf("#%06d", (int)($order->id)); $data['{order_name}'] = sprintf("#%06d", (int)$order->id);
// An additional email is sent the first time a virtual item is validated // An additional email is sent the first time a virtual item is validated
if ($virtualProducts = $order->getVirtualProducts() AND (!$lastOrderState OR !$lastOrderState->logable) AND $newOrderState = new OrderState($this->id_order_state, Configuration::get('PS_LANG_DEFAULT')) AND $newOrderState->logable) if ($virtualProducts = $order->getVirtualProducts() AND (!$lastOrderState OR !$lastOrderState->logable) AND $newOrderState = new OrderState($this->id_order_state, Configuration::get('PS_LANG_DEFAULT')) AND $newOrderState->logable)
+40
View File
@@ -128,6 +128,10 @@ class PDFCore extends PDF_PageGroupCore
$this->AddFont($font); $this->AddFont($font);
$this->AddFont($font, 'B'); $this->AddFont($font, 'B');
} }
/* If the user is using a ISO code no present in the languages, use the first language available instead */
if (!isset(self::$_pdfparams[self::$_iso]) && isset($languages[0]['iso_code']))
self::$_iso = strtoupper($languages[0]['iso_code']);
} }
/** /**
@@ -145,9 +149,19 @@ class PDFCore extends PDF_PageGroupCore
$conf['PS_SHOP_STATE'] = isset($conf['PS_SHOP_STATE']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_STATE']) : ''; $conf['PS_SHOP_STATE'] = isset($conf['PS_SHOP_STATE']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_STATE']) : '';
if (file_exists(_PS_IMG_DIR_.'/logo_invoice.jpg')) if (file_exists(_PS_IMG_DIR_.'/logo_invoice.jpg'))
{
if ($this->_isPngFile(_PS_IMG_DIR_.'/logo_invoice.jpg'))
$this->Image(_PS_IMG_DIR_.'/logo_invoice.jpg', 10, 8, 0, 15, 'PNG');
else
$this->Image(_PS_IMG_DIR_.'/logo_invoice.jpg', 10, 8, 0, 15); $this->Image(_PS_IMG_DIR_.'/logo_invoice.jpg', 10, 8, 0, 15);
}
else if (file_exists(_PS_IMG_DIR_.'/logo.jpg')) else if (file_exists(_PS_IMG_DIR_.'/logo.jpg'))
{
if ($this->_isPngFile(_PS_IMG_DIR_.'/logo.jpg'))
$this->Image(_PS_IMG_DIR_.'/logo.jpg', 10, 8, 0, 15, 'PNG');
else
$this->Image(_PS_IMG_DIR_.'/logo.jpg', 10, 8, 0, 15); $this->Image(_PS_IMG_DIR_.'/logo.jpg', 10, 8, 0, 15);
}
$this->SetFont(self::fontname(), 'B', 15); $this->SetFont(self::fontname(), 'B', 15);
$this->Cell(115); $this->Cell(115);
@@ -164,6 +178,31 @@ class PDFCore extends PDF_PageGroupCore
} }
/* /*
* Detect if the file header match a PNG file
*
* @param string $file Filename to check (include full path)
* @return boolean True if the file is a PNG file
*/
private function _isPngFile($file)
{
$pngReferenceHeader = array(137, 80, 78, 71, 13, 10, 26, 10);
$fp = fopen($file, 'r');
if ($fp)
{
for ($n = 0; $n < 8; $n++)
if (ord(fread($fp, 1)) !== $pngReferenceHeader[$n])
{
fclose($fp);
return false;
}
}
else
return false;
return true;
}
/*
* Return the complete Address format * Return the complete Address format
*/ */
private function _getCompleteUSAddressFormat($conf) private function _getCompleteUSAddressFormat($conf)
@@ -209,6 +248,7 @@ class PDFCore extends PDF_PageGroupCore
"\n".(!empty($conf['PS_SHOP_DETAILS']) ? self::l('Details:').' '.$conf['PS_SHOP_DETAILS'].' - ' : ''). "\n".(!empty($conf['PS_SHOP_DETAILS']) ? self::l('Details:').' '.$conf['PS_SHOP_DETAILS'].' - ' : '').
(!empty($conf['PS_SHOP_PHONE']) ? self::l('PHONE:').' '.$conf['PS_SHOP_PHONE'] : ''); (!empty($conf['PS_SHOP_PHONE']) ? self::l('PHONE:').' '.$conf['PS_SHOP_PHONE'] : '');
} }
return $footerText; return $footerText;
} }
+1 -1
View File
@@ -364,7 +364,7 @@ abstract class PaymentModuleCore extends Module
ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']); ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
} }
if (isset($outOfStock) AND $outOfStock) if (isset($outOfStock) && $outOfStock && Configuration::get('PS_STOCK_MANAGEMENT'))
{ {
$history = new OrderHistory(); $history = new OrderHistory();
$history->id_order = (int)$order->id; $history->id_order = (int)$order->id;
+6 -6
View File
@@ -79,7 +79,7 @@ class StoreCore extends ObjectModel
public $active = true; public $active = true;
protected $fieldsRequired = array('id_country', 'name', 'address1', 'city', 'active'); protected $fieldsRequired = array('id_country', 'name', 'address1', 'city', 'active');
protected $fieldsSize = array('name' => 128, 'address1' => 128, 'address2' => 128, 'postcode' => 12, 'city' => 64, 'latitude' => 10, 'longitude' => 10, 'hours' => 254, 'phone' => 16, 'fax' => 16, 'email' => 128, 'note' => 65000); protected $fieldsSize = array('name' => 128, 'address1' => 128, 'address2' => 128, 'postcode' => 12, 'city' => 64, 'latitude' => 12, 'longitude' => 12, 'hours' => 254, 'phone' => 16, 'fax' => 16, 'email' => 128, 'note' => 65000);
protected $fieldsValidate = array('id_country' => 'isUnsignedId', 'id_state' => 'isNullOrUnsignedId', 'name' => 'isGenericName', 'address1' => 'isAddress', 'address2' => 'isAddress', protected $fieldsValidate = array('id_country' => 'isUnsignedId', 'id_state' => 'isNullOrUnsignedId', 'name' => 'isGenericName', 'address1' => 'isAddress', 'address2' => 'isAddress',
'city' => 'isCityName', 'latitude' => 'isCoordinate', 'longitude' => 'isCoordinate', 'hours' => 'isSerializedArray', 'phone' => 'isPhoneNumber', 'fax' => 'isPhoneNumber', 'city' => 'isCityName', 'latitude' => 'isCoordinate', 'longitude' => 'isCoordinate', 'hours' => 'isSerializedArray', 'phone' => 'isPhoneNumber', 'fax' => 'isPhoneNumber',
'note' => 'isCleanHtml', 'email' => 'isEmail', 'active' => 'isBool'); 'note' => 'isCleanHtml', 'email' => 'isEmail', 'active' => 'isBool');
@@ -99,15 +99,15 @@ class StoreCore extends ObjectModel
{ {
$this->validateFields(); $this->validateFields();
$fields['id_country'] = (int)($this->id_country); $fields['id_country'] = (int)$this->id_country;
$fields['id_state'] = (int)($this->id_state); $fields['id_state'] = (int)$this->id_state;
$fields['name'] = pSQL($this->name); $fields['name'] = pSQL($this->name);
$fields['address1'] = pSQL($this->address1); $fields['address1'] = pSQL($this->address1);
$fields['address2'] = pSQL($this->address2); $fields['address2'] = pSQL($this->address2);
$fields['postcode'] = pSQL($this->postcode); $fields['postcode'] = pSQL($this->postcode);
$fields['city'] = pSQL($this->city); $fields['city'] = pSQL($this->city);
$fields['latitude'] = (float)($this->latitude); $fields['latitude'] = (float)$this->latitude;
$fields['longitude'] = (float)($this->longitude); $fields['longitude'] = (float)$this->longitude;
$fields['hours'] = pSQL($this->hours); $fields['hours'] = pSQL($this->hours);
$fields['phone'] = pSQL($this->phone); $fields['phone'] = pSQL($this->phone);
$fields['fax'] = pSQL($this->fax); $fields['fax'] = pSQL($this->fax);
@@ -115,7 +115,7 @@ class StoreCore extends ObjectModel
$fields['email'] = pSQL($this->email); $fields['email'] = pSQL($this->email);
$fields['date_add'] = pSQL($this->date_add); $fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd); $fields['date_upd'] = pSQL($this->date_upd);
$fields['active'] = (int)($this->active); $fields['active'] = (int)$this->active;
return $fields; return $fields;
} }
+2 -1
View File
@@ -67,7 +67,8 @@ class UpgraderCore
if (empty($this->link)) if (empty($this->link))
$this->checkPSVersion(); $this->checkPSVersion();
if (@copy($this->link, realpath($dest).DIRECTORY_SEPARATOR.$filename)) $destPath = realpath($dest).DIRECTORY_SEPARATOR.$filename;
if (@copy($this->link, $destPath) && md5_file($destPath) == $this->md5 )
return true; return true;
else else
return false; return false;
+1 -1
View File
@@ -849,7 +849,7 @@ class ValidateCore
*/ */
public static function isCoordinate($data) public static function isCoordinate($data)
{ {
return ($data == NULL) OR (bool)(preg_match('/^\-?[0-9]{1,6}\.[0-9]{1,6}$/s', $data)); return ($data == NULL) OR (bool)(preg_match('/^\-?[0-9]{1,8}\.[0-9]{1,8}$/s', $data));
} }
/** /**
+7 -4
View File
@@ -83,6 +83,11 @@ class AuthControllerCore extends FrontController
$_POST['firstname'] = $_POST['customer_firstname']; $_POST['firstname'] = $_POST['customer_firstname'];
if (!Tools::getValue('phone') AND !Tools::getValue('phone_mobile')) if (!Tools::getValue('phone') AND !Tools::getValue('phone_mobile'))
$this->errors[] = Tools::displayError('You must register at least one phone number'); $this->errors[] = Tools::displayError('You must register at least one phone number');
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == ''))
$this->errors[] = Tools::displayError('Invalid date of birth');
$customer->birthday = (empty($_POST['years']) ? '' : (int)$_POST['years'].'-'.(int)$_POST['months'].'-'.(int)$_POST['days']);
$this->errors = array_unique(array_merge($this->errors, $customer->validateController())); $this->errors = array_unique(array_merge($this->errors, $customer->validateController()));
/* Preparing address */ /* Preparing address */
$address = new Address(); $address = new Address();
@@ -123,9 +128,8 @@ class AuthControllerCore extends FrontController
$this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.'); $this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
elseif (!Country::isNeedDniByCountryId($address->id_country)) elseif (!Country::isNeedDniByCountryId($address->id_country))
$address->dni = NULL; $address->dni = NULL;
if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) AND !(Tools::getValue('months') == '' AND Tools::getValue('days') == '' AND Tools::getValue('years') == ''))
$this->errors[] = Tools::displayError('Invalid date of birth'); if (!$this->errors)
if (!sizeof($this->errors))
{ {
if (Customer::customerExists(Tools::getValue('email'))) if (Customer::customerExists(Tools::getValue('email')))
$this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.'); $this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.');
@@ -135,7 +139,6 @@ class AuthControllerCore extends FrontController
$customer->newsletter_date_add = pSQL(date('Y-m-d H:i:s')); $customer->newsletter_date_add = pSQL(date('Y-m-d H:i:s'));
} }
$customer->birthday = (empty($_POST['years']) ? '' : (int)($_POST['years']).'-'.(int)($_POST['months']).'-'.(int)($_POST['days']));
if (!sizeof($this->errors)) if (!sizeof($this->errors))
{ {
if (!$country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT')) OR !Validate::isLoadedObject($country)) if (!$country = new Country($address->id_country, Configuration::get('PS_LANG_DEFAULT')) OR !Validate::isLoadedObject($country))
+1 -7
View File
@@ -115,7 +115,6 @@ class ToolsInstall
$result = NULL; $result = NULL;
try try
{ {
if($smtpChecked) if($smtpChecked)
{ {
@@ -126,20 +125,15 @@ class ToolsInstall
$swift = new Swift($smtp); $swift = new Swift($smtp);
} }
else else
{
$swift = new Swift(new Swift_Connection_NativeMail()); $swift = new Swift(new Swift_Connection_NativeMail());
}
$message = new Swift_Message($subject, $content, $type); $message = new Swift_Message($subject, $content, $type);
if ($swift->send($message, $to, $from)) if ($swift->send($message, $to, $from))
{
$result = true; $result = true;
}
else else
{
$result = 999; $result = 999;
}
$swift->disconnect(); $swift->disconnect();
} }
catch (Swift_Connection_Exception $e) catch (Swift_Connection_Exception $e)
+3 -3
View File
@@ -553,7 +553,7 @@ CREATE TABLE `PREFIX_delivery` (
`id_range_price` int(10) unsigned default NULL, `id_range_price` int(10) unsigned default NULL,
`id_range_weight` int(10) unsigned default NULL, `id_range_weight` int(10) unsigned default NULL,
`id_zone` int(10) unsigned NOT NULL, `id_zone` int(10) unsigned NOT NULL,
`price` decimal(17,2) NOT NULL, `price` decimal(20,6) NOT NULL,
PRIMARY KEY (`id_delivery`), PRIMARY KEY (`id_delivery`),
KEY `id_zone` (`id_zone`), KEY `id_zone` (`id_zone`),
KEY `id_carrier` (`id_carrier`,`id_zone`), KEY `id_carrier` (`id_carrier`,`id_zone`),
@@ -1614,8 +1614,8 @@ CREATE TABLE `PREFIX_store` (
`address2` varchar(128) DEFAULT NULL, `address2` varchar(128) DEFAULT NULL,
`city` varchar(64) NOT NULL, `city` varchar(64) NOT NULL,
`postcode` varchar(12) NOT NULL, `postcode` varchar(12) NOT NULL,
`latitude` float(10,6) DEFAULT NULL, `latitude` decimal(10,8) DEFAULT NULL,
`longitude` float(10,6) DEFAULT NULL, `longitude` decimal(10,8) DEFAULT NULL,
`hours` varchar(254) DEFAULT NULL, `hours` varchar(254) DEFAULT NULL,
`phone` varchar(16) DEFAULT NULL, `phone` varchar(16) DEFAULT NULL,
`fax` varchar(16) DEFAULT NULL, `fax` varchar(16) DEFAULT NULL,
+2 -2
View File
@@ -1120,8 +1120,8 @@ INSERT INTO `PREFIX_profile_lang` (`id_lang`, `id_profile`, `name`) VALUES
INSERT INTO `PREFIX_store` (`id_store`, `id_country`, `id_state`, `name`, `address1`, `address2`, `city`, `postcode`, `latitude`, `longitude`, `hours`, `phone`, `fax`, `email`, `note`, `active`, `date_add`, `date_upd`) VALUES INSERT INTO `PREFIX_store` (`id_store`, `id_country`, `id_state`, `name`, `address1`, `address2`, `city`, `postcode`, `latitude`, `longitude`, `hours`, `phone`, `fax`, `email`, `note`, `active`, `date_add`, `date_upd`) VALUES
(1, 21, 9, 'Dade County', '3030 SW 8th St Miami', '', 'Miami', ' 33135', 25.765005, -80.243797, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 10:53:13', '2010-11-09 10:53:13'), (1, 21, 9, 'Dade County', '3030 SW 8th St Miami', '', 'Miami', ' 33135', 25.765005, -80.243797, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 10:53:13', '2010-11-09 10:53:13'),
(2, 21, 9, 'E Fort Lauderdale', '1000 Northeast 4th Ave Fort Lauderdale', '', 'miami', ' 33304', 26.137936, -80.139435, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 10:56:26', '2010-11-09 10:56:26'), (2, 21, 9, 'E Fort Lauderdale', '1000 Northeast 4th Ave Fort Lauderdale', '', 'Miami', ' 33304', 26.137936, -80.139435, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 10:56:26', '2010-11-09 10:56:26'),
(3, 21, 9, 'Pembroke Pines', '11001 Pines Blvd Pembroke Pines', '', 'miami', '33026', 26.009987, -80.294472, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 10:58:42', '2010-11-09 11:01:11'), (3, 21, 9, 'Pembroke Pines', '11001 Pines Blvd Pembroke Pines', '', 'Miami', '33026', 26.009987, -80.294472, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 10:58:42', '2010-11-09 11:01:11'),
(4, 21, 9, 'Coconut Grove', '2999 SW 32nd Avenue', '', ' Miami', ' 33133', 25.736296, -80.244797, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 11:00:38', '2010-11-09 11:04:52'), (4, 21, 9, 'Coconut Grove', '2999 SW 32nd Avenue', '', ' Miami', ' 33133', 25.736296, -80.244797, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 11:00:38', '2010-11-09 11:04:52'),
(5, 21, 9, 'N Miami/Biscayne', '12055 Biscayne Blvd', '', 'Miami', '33181', 25.886740, -80.163292, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 11:11:28', '2010-11-09 11:11:28'); (5, 21, 9, 'N Miami/Biscayne', '12055 Biscayne Blvd', '', 'Miami', '33181', 25.886740, -80.163292, 'a:7:{i:0;s:13:"09:00 - 19:00";i:1;s:13:"09:00 - 19:00";i:2;s:13:"09:00 - 19:00";i:3;s:13:"09:00 - 19:00";i:4;s:13:"09:00 - 19:00";i:5;s:13:"10:00 - 16:00";i:6;s:13:"10:00 - 16:00";}', '', '', '', '', 1, '2010-11-09 11:11:28', '2010-11-09 11:11:28');
+8 -10
View File
@@ -3,15 +3,7 @@ SET NAMES 'utf8';
INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES
('PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW()); ('PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW());
UPDATE `PREFIX_country_lang` UPDATE `PREFIX_country_lang` SET `name` = 'United States' WHERE `name` = 'United State';
SET `name` = 'United States'
WHERE `name` = 'United State'
AND `id_lang` = (
SELECT `id_lang`
FROM `PREFIX_lang`
WHERE `iso_code` = 'en'
LIMIT 1
);
ALTER TABLE `PREFIX_discount` ADD `include_tax` TINYINT(1) NOT NULL DEFAULT '0'; ALTER TABLE `PREFIX_discount` ADD `include_tax` TINYINT(1) NOT NULL DEFAULT '0';
@@ -19,6 +11,11 @@ UPDATE `PREFIX_order_detail` SET `product_price` = `product_price` /( 1-(`group_
DELETE FROM `PREFIX_configuration` WHERE name IN ('PS_LAYERED_BITLY_USERNAME', 'PS_LAYERED_BITLY_API_KEY', 'PS_LAYERED_SHARE') LIMIT 3; DELETE FROM `PREFIX_configuration` WHERE name IN ('PS_LAYERED_BITLY_USERNAME', 'PS_LAYERED_BITLY_API_KEY', 'PS_LAYERED_SHARE') LIMIT 3;
ALTER TABLE `PREFIX_delivery` CHANGE `price` `price` DECIMAL(20, 6) NOT NULL;
ALTER TABLE `PREFIX_store` CHANGE `latitude` `latitude` DECIMAL(10, 8) NULL DEFAULT NULL;
ALTER TABLE `PREFIX_store` CHANGE `longitude` `longitude` DECIMAL(10, 8) NULL DEFAULT NULL;
INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edit`) VALUES
('attributeGroupForm', 'Add fields to the form "attribute group"', 'Add fields to the form "attribute group"', 0, 0), ('attributeGroupForm', 'Add fields to the form "attribute group"', 'Add fields to the form "attribute group"', 0, 0),
('afterSaveAttributeGroup', 'On saving attribute group', 'On saving attribute group', 0, 0), ('afterSaveAttributeGroup', 'On saving attribute group', 'On saving attribute group', 0, 0),
@@ -37,4 +34,5 @@ INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edi
('attributeForm', 'Add fields to the form "feature value"', 'Add fields to the form "feature value"', 0, 0), ('attributeForm', 'Add fields to the form "feature value"', 'Add fields to the form "feature value"', 0, 0),
('postProcessAttribute', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0), ('postProcessAttribute', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0),
('afterDeleteAttribute', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0), ('afterDeleteAttribute', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0),
('afterSaveAttribute', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0); ('afterSaveAttribute', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0);
+2 -1
View File
@@ -67,7 +67,8 @@ class UpgraderCore
if (empty($this->link)) if (empty($this->link))
$this->checkPSVersion(); $this->checkPSVersion();
if (@copy($this->link, realpath($dest).DIRECTORY_SEPARATOR.$filename)) $destPath = realpath($dest).DIRECTORY_SEPARATOR.$filename;
if (@copy($this->link, $destPath) && md5_file($destPath) == $this->md5 )
return true; return true;
else else
return false; return false;
+7 -4
View File
@@ -5,7 +5,7 @@ class Autoupgrade extends Module
function __construct() function __construct()
{ {
$this->name = 'autoupgrade'; $this->name = 'autoupgrade';
$this->tab = 'admin'; $this->tab = 'administration';
$this->version = 0.1; $this->version = 0.1;
if (!defined('_PS_ADMIN_DIR_')) if (!defined('_PS_ADMIN_DIR_'))
@@ -58,10 +58,13 @@ class Autoupgrade extends Module
$res &= @mkdir($autoupgradeDir); $res &= @mkdir($autoupgradeDir);
if(file_exists($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php')) if(file_exists($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'))
$res &= unlink($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php'); $res &= unlink($autoupgradeDir.DIRECTORY_SEPARATOR.'ajax-upgradetab.php');
$path = dirname(__FILE__).'/'; if (!defined('_PS_MODULE_DIR_'))
{
define('_PS_MODULE_DIR_', _PS_ROOT_DIR_.'/modules/');
}
$res &= copy($path.'ajax-upgradetab.php',$autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php'); $res &= copy(_PS_MODULE_DIR_.'autoupgrade/ajax-upgradetab.php',$autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
$res &= copy($path.'logo.gif',_PS_ROOT_DIR_. DIRECTORY_SEPARATOR . 'img/t/AdminSelfUpgrade.gif'); $res &= copy(_PS_MODULE_DIR_.'autoupgrade/logo.gif',_PS_ROOT_DIR_. DIRECTORY_SEPARATOR . 'img/t/AdminSelfUpgrade.gif');
if (!$res if (!$res
OR !Tab::getIdFromClassName('AdminSelfUpgrade') OR !Tab::getIdFromClassName('AdminSelfUpgrade')
+1 -1
View File
@@ -5,7 +5,7 @@
<version><![CDATA[0.1]]></version> <version><![CDATA[0.1]]></version>
<description><![CDATA[Provides an automated method to upgrade your shop to the last PrestaShop version]]></description> <description><![CDATA[Provides an automated method to upgrade your shop to the last PrestaShop version]]></description>
<author><![CDATA[]]></author> <author><![CDATA[]]></author>
<tab><![CDATA[admin]]></tab> <tab><![CDATA[administration]]></tab>
<is_configurable>0</is_configurable> <is_configurable>0</is_configurable>
<need_instance>1</need_instance> <need_instance>1</need_instance>
<limited_countries></limited_countries> <limited_countries></limited_countries>
+1 -1
View File
@@ -2,7 +2,7 @@
<module> <module>
<name>ebay</name> <name>ebay</name>
<displayName><![CDATA[eBay]]></displayName> <displayName><![CDATA[eBay]]></displayName>
<version><![CDATA[1.2.6]]></version> <version><![CDATA[1.2.8]]></version>
<description><![CDATA[Open your shop on the eBay market place !]]></description> <description><![CDATA[Open your shop on the eBay market place !]]></description>
<author><![CDATA[PrestaShop]]></author> <author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[market_place]]></tab> <tab><![CDATA[market_place]]></tab>
+6 -3
View File
@@ -1096,7 +1096,8 @@ class eBayRequest
foreach ($this->response->OrderArray->Order as $order) foreach ($this->response->OrderArray->Order as $order)
{ {
$name = str_replace(array('_', ',', ' '), array('', '', ' '), (string)$order->ShippingAddress->Name); $name = str_replace(array('_', ',', ' '), array('', '', ' '), (string)$order->ShippingAddress->Name);
$name = explode(' ', $name); $name = preg_replace('/\-?\d+/', '', $name);
$name = explode(' ', $name, 2);
$itemList = array(); $itemList = array();
for ($i = 0; isset($order->TransactionArray->Transaction[$i]); $i++) for ($i = 0; isset($order->TransactionArray->Transaction[$i]); $i++)
{ {
@@ -1110,6 +1111,8 @@ class eBayRequest
$tmp = explode('-', (string)$transaction->Item->SKU); $tmp = explode('-', (string)$transaction->Item->SKU);
if (isset($tmp[1])) if (isset($tmp[1]))
$id_product = $tmp[1]; $id_product = $tmp[1];
if (isset($tmp[2]))
$id_product_attribute = $tmp[2];
} }
if (isset($transaction->Variation->SKU)) if (isset($transaction->Variation->SKU))
{ {
@@ -1160,8 +1163,8 @@ class eBayRequest
'status' => (string)$order->CheckoutStatus->Status, 'status' => (string)$order->CheckoutStatus->Status,
'date' => substr((string)$order->CreatedTime, 0, 10).' '.substr((string)$order->CreatedTime, 11, 8), 'date' => substr((string)$order->CreatedTime, 0, 10).' '.substr((string)$order->CreatedTime, 11, 8),
'name' => (string)$order->ShippingAddress->Name, 'name' => (string)$order->ShippingAddress->Name,
'firstname' => $name[0], 'firstname' => trim($name[0]),
'familyname' => (isset($name[1]) ? $name[1] : $name[0]), 'familyname' => (isset($name[1]) ? trim($name[1]) : trim($name[0])),
'address1' => (string)$order->ShippingAddress->Street1, 'address1' => (string)$order->ShippingAddress->Street1,
'address2' => (string)$order->ShippingAddress->Street2, 'address2' => (string)$order->ShippingAddress->Street2,
'city' => (string)$order->ShippingAddress->CityName, 'city' => (string)$order->ShippingAddress->CityName,
+14 -3
View File
@@ -59,7 +59,7 @@ class Ebay extends Module
{ {
$this->name = 'ebay'; $this->name = 'ebay';
$this->tab = 'market_place'; $this->tab = 'market_place';
$this->version = '1.2.6'; $this->version = '1.2.8';
$this->author = 'PrestaShop'; $this->author = 'PrestaShop';
parent::__construct (); parent::__construct ();
$this->displayName = $this->l('eBay'); $this->displayName = $this->l('eBay');
@@ -656,7 +656,7 @@ class Ebay extends Module
success: function(data) success: function(data)
{ {
if (data == \'OK\') if (data == \'OK\')
window.location.href = \''.Tools::safeOutput($_SERVER['REQUEST_URI']).'&action=validateToken\'; window.location.href = \'index.php?tab='.Tools::safeOutput($_GET['tab']).'&configure='.Tools::safeOutput($_GET['configure']).'&token='.Tools::safeOutput($_GET['token']).'&tab_module='.Tools::safeOutput($_GET['tab_module']).'&module_name='.Tools::safeOutput($_GET['module_name']).'&action=validateToken\';
else else
setTimeout ("checkToken()", 5000); setTimeout ("checkToken()", 5000);
} }
@@ -1111,10 +1111,11 @@ class Ebay extends Module
$ad = dirname($_SERVER["PHP_SELF"]); $ad = dirname($_SERVER["PHP_SELF"]);
// Display Form // Display Form
$forbiddenJs = array('textarea', 'script', 'onmousedown', 'onmousemove', 'onmmouseup', 'onmouseover', 'onmouseout', 'onload', 'onunload', 'onfocus', 'onblur', 'onchange', 'onsubmit', 'ondblclick', 'onclick', 'onkeydown', 'onkeyup', 'onkeypress', 'onmouseenter', 'onmouseleave', 'onerror');
$html = '<form action="index.php?tab='.Tools::safeOutput($_GET['tab']).'&configure='.Tools::safeOutput($_GET['configure']).'&token='.Tools::safeOutput($_GET['token']).'&tab_module='.Tools::safeOutput($_GET['tab_module']).'&module_name='.Tools::safeOutput($_GET['module_name']).'&id_tab=3&section=template" method="post" class="form" id="configForm3"> $html = '<form action="index.php?tab='.Tools::safeOutput($_GET['tab']).'&configure='.Tools::safeOutput($_GET['configure']).'&token='.Tools::safeOutput($_GET['token']).'&tab_module='.Tools::safeOutput($_GET['tab_module']).'&module_name='.Tools::safeOutput($_GET['module_name']).'&id_tab=3&section=template" method="post" class="form" id="configForm3">
<fieldset style="border: 0"> <fieldset style="border: 0">
<h4>'.$this->l('You can customise the template for your products page on eBay').' :</h4> <h4>'.$this->l('You can customise the template for your products page on eBay').' :</h4>
<textarea class="rte" cols="100" rows="50" name="ebay_product_template">'.Tools::safeOutput(Tools::getValue('ebay_product_template', Configuration::get('EBAY_PRODUCT_TEMPLATE'))).'</textarea><br /> <textarea class="rte" cols="100" rows="50" name="ebay_product_template">'.str_replace($forbiddenJs, '', Tools::getValue('ebay_product_template', Configuration::get('EBAY_PRODUCT_TEMPLATE'))).'</textarea><br />
'.(substr(_PS_VERSION_, 0, 3) == '1.3' ? ' '.(substr(_PS_VERSION_, 0, 3) == '1.3' ? '
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
@@ -1498,6 +1499,14 @@ class Ebay extends Module
} }
} }
public function findIfCategoryParentIsMultiSku($id_category_ref)
{
$row = Db::getInstance()->getRow('SELECT `id_category_ref_parent`, `is_multi_sku` FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_category_ref` = '.(int)$id_category_ref);
if ($row['id_category_ref_parent'] != $id_category_ref)
return $this->findIfCategoryParentIsMultiSku($row['id_category_ref_parent']);
return $row['is_multi_sku'];
}
private function _syncProducts($productsList) private function _syncProducts($productsList)
{ {
$fees = 0; $fees = 0;
@@ -1529,6 +1538,8 @@ class Ebay extends Module
// Load default category matched in cache // Load default category matched in cache
if (!isset($categoryDefaultCache[$product->id_category_default])) if (!isset($categoryDefaultCache[$product->id_category_default]))
$categoryDefaultCache[$product->id_category_default] = Db::getInstance()->getRow('SELECT ec.`id_category_ref`, ec.`is_multi_sku`, ecc.`percent` FROM `'._DB_PREFIX_.'ebay_category` ec LEFT JOIN `'._DB_PREFIX_.'ebay_category_configuration` ecc ON (ecc.`id_ebay_category` = ec.`id_ebay_category`) WHERE ecc.`id_category` = '.(int)$product->id_category_default); $categoryDefaultCache[$product->id_category_default] = Db::getInstance()->getRow('SELECT ec.`id_category_ref`, ec.`is_multi_sku`, ecc.`percent` FROM `'._DB_PREFIX_.'ebay_category` ec LEFT JOIN `'._DB_PREFIX_.'ebay_category_configuration` ecc ON (ecc.`id_ebay_category` = ec.`id_ebay_category`) WHERE ecc.`id_category` = '.(int)$product->id_category_default);
if ($categoryDefaultCache[$product->id_category_default]['is_multi_sku'] != 1)
$categoryDefaultCache[$product->id_category_default]['is_multi_sku'] = $this->findIfCategoryParentIsMultiSku($categoryDefaultCache[$product->id_category_default]['id_category_ref']);
// Load Pictures // Load Pictures
$pictures = array(); $pictures = array();
+1 -1
View File
@@ -2,7 +2,7 @@
<module> <module>
<name>mondialrelay</name> <name>mondialrelay</name>
<displayName><![CDATA[Mondial Relay]]></displayName> <displayName><![CDATA[Mondial Relay]]></displayName>
<version><![CDATA[1.7]]></version> <version><![CDATA[1.7.4]]></version>
<description><![CDATA[Deliver in Relay points]]></description> <description><![CDATA[Deliver in Relay points]]></description>
<author><![CDATA[]]></author> <author><![CDATA[]]></author>
<tab><![CDATA[shipping_logistics]]></tab> <tab><![CDATA[shipping_logistics]]></tab>
+2 -2
View File
@@ -37,13 +37,13 @@ class PaypalLib extends Paypal
unset($response[$k]); unset($response[$k]);
} }
} }
if (!Configuration::get('PAYPAL_MODE_DEBUG')) if (!Configuration::get('PAYPAL_DEBUG_MODE'))
$this->_logs = array(); $this->_logs = array();
$toExclude = array('TOKEN', 'SUCCESSPAGEREDIRECTREQUESTED', 'VERSION', 'BUILD', 'ACK', 'CORRELATIONID'); $toExclude = array('TOKEN', 'SUCCESSPAGEREDIRECTREQUESTED', 'VERSION', 'BUILD', 'ACK', 'CORRELATIONID');
$this->_logs[] = '<b>'.$this->l('PayPal response:').'</b>'; $this->_logs[] = '<b>'.$this->l('PayPal response:').'</b>';
foreach ($response as $k => $res) foreach ($response as $k => $res)
{ {
if (!Configuration::get('PAYPAL_MODE_DEBUG') AND in_array($k, $toExclude)) if (!Configuration::get('PAYPAL_DEBUG_MODE') AND in_array($k, $toExclude))
continue; continue;
$this->_logs[] = $k.' -> '.$res; $this->_logs[] = $k.' -> '.$res;
} }
+1 -1
View File
@@ -886,7 +886,7 @@ class PayPal extends PaymentModule
Configuration::updateValue('PAYPAL_API_PASSWORD', trim(Tools::getValue('api_password'))); Configuration::updateValue('PAYPAL_API_PASSWORD', trim(Tools::getValue('api_password')));
Configuration::updateValue('PAYPAL_API_SIGNATURE', trim(Tools::getValue('api_signature'))); Configuration::updateValue('PAYPAL_API_SIGNATURE', trim(Tools::getValue('api_signature')));
Configuration::updateValue('PAYPAL_EXPRESS_CHECKOUT', (int)(Tools::isSubmit('paypal_express'))); Configuration::updateValue('PAYPAL_EXPRESS_CHECKOUT', (int)(Tools::isSubmit('paypal_express')));
Configuration::updateValue('PAYPAL_MODE_DEBUG', (int)(Tools::isSubmit('paypal_debug'))); Configuration::updateValue('PAYPAL_DEBUG_MODE', (int)(Tools::isSubmit('paypal_debug')));
Configuration::updateValue('PAYPAL_CAPTURE', (int)(Tools::getValue('paypal_capture'))); Configuration::updateValue('PAYPAL_CAPTURE', (int)(Tools::getValue('paypal_capture')));
Configuration::updateValue('PAYPAL_PAYMENT_METHOD', (int)(Tools::getValue('payment_method'))); Configuration::updateValue('PAYPAL_PAYMENT_METHOD', (int)(Tools::getValue('payment_method')));
Configuration::updateValue('PAYPAL_TEMPLATE', Tools::getValue('template_paypal')); Configuration::updateValue('PAYPAL_TEMPLATE', Tools::getValue('template_paypal'));
+1 -1
View File
@@ -7,7 +7,7 @@ ini_set('display_errors', 'off');
$moduleName = Tools::getValue('moduleName'); $moduleName = Tools::getValue('moduleName');
if (!Tools::getValue('ajax') || Tools::getValue('token') != sha1(_COOKIE_KEY_.'ajaxShopImporter') || !ctype_alnum($moduleName)) if (!Tools::getValue('ajax') || Tools::getValue('token') != sha1(_COOKIE_KEY_.'ajaxShopImporter') || (!empty($moduleName) && !ctype_alnum($moduleName)))
die; die;