// Merge -> 8910

This commit is contained in:
rMalie
2011-09-30 08:17:25 +00:00
parent 84e77a9bf4
commit 0c40fb9a06
28 changed files with 2046 additions and 118 deletions
+9 -10
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -25,7 +25,6 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminShipping extends AdminTab
{
private $_fieldsHandling;
@@ -92,7 +91,7 @@ class AdminShipping extends AdminTab
{
/* Get configuration values */
$shipping_method = $carrier->getShippingMethod();
$rangeTable = $carrier->getRangeTable();
$rangeTable = $carrier->getRangeTable();
$carrier->deleteDeliveryPrice($rangeTable);
$currentList = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
@@ -104,7 +103,7 @@ class AdminShipping extends AdminTab
{
$tmpArray = explode('_', $key);
$price = number_format(abs(str_replace(',', '.', $value)), 2, '.', '');
$price = number_format(abs(str_replace(',', '.', $value)), 6, '.', '');
$current = 0;
foreach ($currentList as $item)
if ($item['id_zone'] == $tmpArray[1] && $item['id_'.$rangeTable] == $tmpArray[2])
@@ -115,8 +114,8 @@ class AdminShipping extends AdminTab
$priceList[] = array(
'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_carrier' => (int)$carrier->id,
'id_zone' => (int)$tmpArray[1],
'id_carrier' => (int)$carrier->id,
'id_zone' => (int)$tmpArray[1],
'price' => $price,
);
}
@@ -218,13 +217,13 @@ class AdminShipping extends AdminTab
$id_carrier = (int)$carrierArray[0]['id'];
$carrierSelected = new Carrier($id_carrier);
}
echo '<br /><br />
<h2>'.$this->l('Fees by carrier, geographical zone, and ranges').'</h2>
<form action="'.self::$currentIndex.'&token='.$this->token.'" id="fees" name="fees" method="post">
<fieldset>
<legend><img src="../img/admin/delivery.gif" />'.$this->l('Fees').'</legend>';
if (!count($carrierArray))
echo $this->l('You only have free carriers, there is no need to configure your delivery prices.');
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 '</tr>';
}
foreach ($zones AS $zone)
{
echo '
@@ -284,7 +283,7 @@ class AdminShipping extends AdminTab
</tr>';
}
}
echo '<tr>
<td colspan="'.(sizeof($ranges) + 1).'" class="center" style="border-bottom: none; height: 40px;">
<input type="hidden" name="submitFees'.$this->table.'" value="1" />';
+18 -18
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,27 +31,27 @@ class AdminStores extends AdminTab
{
/** @var array countries list */
private $countriesArray = array();
public function __construct()
{
$this->context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'store';
$this->className = 'Store';
$this->lang = false;
$this->edit = true;
$this->delete = true;
$this->fieldImageSettings = array('name' => 'image', 'dir' => 'st');
$this->_select = 'cl.`name` country, st.`name` state';
$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_.'state` st ON (st.`id_state` = a.`id_state`)';
$countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name'];
$this->fieldsDisplay = array(
'id_store' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'country' => array('title' => $this->l('Country'), 'width' => 100, 'filter_key' => 'cl!name'),
@@ -78,7 +78,7 @@ class AdminStores extends AdminTab
);
parent::__construct();
}
protected function postImage($id)
{
$ret = parent::postImage($id);
@@ -90,14 +90,14 @@ class AdminStores extends AdminTab
}
return $ret;
}
public function 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>';
}
public function postProcess()
{
if (isset($_POST['submitAdd'.$this->table]))
@@ -152,11 +152,11 @@ class AdminStores extends AdminTab
if (!sizeof($this->_errors))
parent::postProcess();
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
echo '
@@ -234,7 +234,7 @@ class AdminStores extends AdminTab
</div>
<label>'.$this->l('Latitude / Longitude:').'</label>
<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>
<p class="clear">'.$this->l('Store coords, eg. 45.265469 / -47.226478').'</p>
</div>
@@ -270,7 +270,7 @@ class AdminStores extends AdminTab
<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 '</div>
<table cellpadding="2" cellspacing="2" style="padding: 10px; margin-top: 15px; border: 1px solid #BBB;">
<tr>
@@ -280,7 +280,7 @@ class AdminStores extends AdminTab
<td>&nbsp;</td>
<td style="font-size: 0.85em;">'.$this->l('Sample: 10:00AM - 9:30PM').'</td>
</tr>';
$days = array();
$days[1] = $this->l('Monday');
$days[2] = $this->l('Tuesday');
@@ -289,11 +289,11 @@ class AdminStores extends AdminTab
$days[5] = $this->l('Friday');
$days[6] = $this->l('Saturday');
$days[7] = $this->l('Sunday');
$hours = $this->getFieldValue($obj, 'hours');
if (!empty($hours))
$hoursUnserialized = unserialize($hours);
for ($i = 1; $i < 8; $i++)
echo '
<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));
if (($type == 'date' OR $type == 'datetime') AND is_string($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))
$sqlFilter = & $this->_tmpTableFilter;
elseif (array_key_exists('havingFilter', $field))
@@ -844,7 +844,7 @@ abstract class AdminTabCore
if (!Validate::isDate($value[0]))
$this->_errors[] = Tools::displayError('\'from:\' date format is invalid (YYYY-MM-DD)');
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]))
@@ -852,7 +852,7 @@ abstract class AdminTabCore
if (!Validate::isDate($value[1]))
$this->_errors[] = Tools::displayError('\'to:\' date format is invalid (YYYY-MM-DD)');
else
$sqlFilter .= ' AND `'.bqSQL($key).'` <= \''.pSQL(Tools::dateTo($value[1])).'\'';
$sqlFilter .= ' AND '.bqSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\'';
}
}
else
+11 -13
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -26,15 +26,15 @@
*/
class CacheFSCore extends Cache {
protected $_depth;
protected function __construct()
{
parent::__construct();
$this->_init();
}
protected function _init()
{
$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();
for ($i = 0; $i < $this->_depth; $i++)
{
$path .= $key[$i].'/';
}
if (file_put_contents($path.$key, serialize($value)))
if (@file_put_contents($path.$key, serialize($value)))
{
$this->_keysCached[$key] = true;
return $key;
}
return false;
}
public function setNumRows($key, $value, $expire = 0)
{
return $this->set($key.'_nrows', $value, $expire);
}
public function getNumRows($key)
{
return $this->get($key.'_nrows');
@@ -150,8 +147,9 @@ class CacheFSCore extends Cache {
public function __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()
@@ -173,7 +171,7 @@ class CacheFSCore extends Cache {
self::createCacheDirectories($level_depth - 1, $new_dir);
}
}
protected function getPath()
{
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 PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE = 4;
const ALL_CARRIERS = 5;
const SHIPPING_METHOD_DEFAULT = 0;
const SHIPPING_METHOD_WEIGHT = 1;
const SHIPPING_METHOD_PRICE = 2;
@@ -412,23 +412,23 @@ class CarrierCore extends ObjectModel
{
if (!Validate::isBool($activeCountries) OR !Validate::isBool($activeCarriers))
die(Tools::displayError());
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT s.*
FROM `'._DB_PREFIX_.'state` s
ORDER BY s.`name` ASC');
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
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)
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)
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) ' : ') ').'
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
'.($activeCountries ? 'AND c.active = 1' : '').'
'.(!is_null($containStates) ? 'AND c.`contains_states` = '.(int)($containStates) : '').'
ORDER BY cl.name ASC');
$countries = array();
foreach ($result AS &$country)
$countries[$country['id_country']] = $country;
@@ -438,12 +438,12 @@ class CarrierCore extends ObjectModel
return $countries;
}
/**
*
* @param int $id_zone
* @param Array $groups group of the customer
* @return Array
* @return Array
*/
public static function getCarriersForOrder($id_zone, $groups = NULL)
{
+6 -4
View File
@@ -986,14 +986,16 @@ class OrderCore extends ObjectModel
return $result;
}
public function setCurrentState($id_order_state)
public function setCurrentState($id_order_state, $id_employee)
{
if (empty($id_order_state))
return false;
$history = new OrderHistory();
$history->id_order = (int)($this->id);
$history->changeIdOrderState((int)$id_order_state, (int)($this->id));
$res = Db::getInstance()->getRow('SELECT `invoice_number`, `invoice_date`, `delivery_number`, `delivery_date`
$history->id_order = (int)$this->id;
$history->id_employee = (int)$id_employee;
$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`
WHERE `id_order` = '.(int)$this->id);
$this->invoice_date = $res['invoice_date'];
+8 -9
View File
@@ -62,9 +62,9 @@ class OrderHistoryCore extends ObjectModel
{
$this->validateFields();
$fields['id_order'] = (int)($this->id_order);
$fields['id_order_state'] = (int)($this->id_order_state);
$fields['id_employee'] = (int)($this->id_employee);
$fields['id_order'] = (int)$this->id_order;
$fields['id_order_state'] = (int)$this->id_order_state;
$fields['id_employee'] = (int)$this->id_employee;
$fields['date_add'] = pSQL($this->date_add);
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_.'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`)
WHERE oh.`id_order_history` = '.(int)($this->id).'
AND os.`send_email` = 1');
WHERE oh.`id_order_history` = '.(int)($this->id).' AND os.`send_email` = 1');
if (isset($result['template']) AND Validate::isEmail($result['email']))
{
$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)
$data = array_merge($data, $templateVars);
$order = new Order((int)($this->id_order));
$data['{total_paid}'] = Tools::displayPrice((float)($order->total_paid), new Currency((int)($order->id_currency)), false);
$data['{order_name}'] = sprintf("#%06d", (int)($order->id));
$order = new Order((int)$this->id_order);
$data['{total_paid}'] = Tools::displayPrice((float)$order->total_paid, new Currency((int)$order->id_currency), false);
$data['{order_name}'] = sprintf("#%06d", (int)$order->id);
// 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)
+40
View File
@@ -128,6 +128,10 @@ class PDFCore extends PDF_PageGroupCore
$this->AddFont($font);
$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']) : '';
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);
}
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->SetFont(self::fontname(), 'B', 15);
$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
*/
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'].' - ' : '').
(!empty($conf['PS_SHOP_PHONE']) ? self::l('PHONE:').' '.$conf['PS_SHOP_PHONE'] : '');
}
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']);
}
if (isset($outOfStock) AND $outOfStock)
if (isset($outOfStock) && $outOfStock && Configuration::get('PS_STOCK_MANAGEMENT'))
{
$history = new OrderHistory();
$history->id_order = (int)$order->id;
+6 -6
View File
@@ -79,7 +79,7 @@ class StoreCore extends ObjectModel
public $active = true;
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',
'city' => 'isCityName', 'latitude' => 'isCoordinate', 'longitude' => 'isCoordinate', 'hours' => 'isSerializedArray', 'phone' => 'isPhoneNumber', 'fax' => 'isPhoneNumber',
'note' => 'isCleanHtml', 'email' => 'isEmail', 'active' => 'isBool');
@@ -99,15 +99,15 @@ class StoreCore extends ObjectModel
{
$this->validateFields();
$fields['id_country'] = (int)($this->id_country);
$fields['id_state'] = (int)($this->id_state);
$fields['id_country'] = (int)$this->id_country;
$fields['id_state'] = (int)$this->id_state;
$fields['name'] = pSQL($this->name);
$fields['address1'] = pSQL($this->address1);
$fields['address2'] = pSQL($this->address2);
$fields['postcode'] = pSQL($this->postcode);
$fields['city'] = pSQL($this->city);
$fields['latitude'] = (float)($this->latitude);
$fields['longitude'] = (float)($this->longitude);
$fields['latitude'] = (float)$this->latitude;
$fields['longitude'] = (float)$this->longitude;
$fields['hours'] = pSQL($this->hours);
$fields['phone'] = pSQL($this->phone);
$fields['fax'] = pSQL($this->fax);
@@ -115,7 +115,7 @@ class StoreCore extends ObjectModel
$fields['email'] = pSQL($this->email);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['active'] = (int)($this->active);
$fields['active'] = (int)$this->active;
return $fields;
}
+2 -1
View File
@@ -67,7 +67,8 @@ class UpgraderCore
if (empty($this->link))
$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;
else
return false;
+1 -1
View File
@@ -849,7 +849,7 @@ class ValidateCore
*/
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'];
if (!Tools::getValue('phone') AND !Tools::getValue('phone_mobile'))
$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()));
/* Preparing 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.');
elseif (!Country::isNeedDniByCountryId($address->id_country))
$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 (!sizeof($this->errors))
if (!$this->errors)
{
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.');
@@ -135,7 +139,6 @@ class AuthControllerCore extends FrontController
$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 (!$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;
try
{
if($smtpChecked)
{
@@ -126,20 +125,15 @@ class ToolsInstall
$swift = new Swift($smtp);
}
else
{
$swift = new Swift(new Swift_Connection_NativeMail());
}
$message = new Swift_Message($subject, $content, $type);
if ($swift->send($message, $to, $from))
{
$result = true;
}
else
{
$result = 999;
}
$swift->disconnect();
}
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_weight` int(10) unsigned default NULL,
`id_zone` int(10) unsigned NOT NULL,
`price` decimal(17,2) NOT NULL,
`price` decimal(20,6) NOT NULL,
PRIMARY KEY (`id_delivery`),
KEY `id_zone` (`id_zone`),
KEY `id_carrier` (`id_carrier`,`id_zone`),
@@ -1614,8 +1614,8 @@ CREATE TABLE `PREFIX_store` (
`address2` varchar(128) DEFAULT NULL,
`city` varchar(64) NOT NULL,
`postcode` varchar(12) NOT NULL,
`latitude` float(10,6) DEFAULT NULL,
`longitude` float(10,6) DEFAULT NULL,
`latitude` decimal(10,8) DEFAULT NULL,
`longitude` decimal(10,8) DEFAULT NULL,
`hours` varchar(254) DEFAULT NULL,
`phone` 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
(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'),
(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'),
(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'),
(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');
+8 -10
View File
@@ -3,15 +3,7 @@ SET NAMES 'utf8';
INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES
('PS_RESTRICT_DELIVERED_COUNTRIES', '0', NOW(), NOW());
UPDATE `PREFIX_country_lang`
SET `name` = 'United States'
WHERE `name` = 'United State'
AND `id_lang` = (
SELECT `id_lang`
FROM `PREFIX_lang`
WHERE `iso_code` = 'en'
LIMIT 1
);
UPDATE `PREFIX_country_lang` SET `name` = 'United States' WHERE `name` = 'United State';
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;
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
('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),
@@ -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),
('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),
('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))
$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;
else
return false;
+7 -4
View File
@@ -5,7 +5,7 @@ class Autoupgrade extends Module
function __construct()
{
$this->name = 'autoupgrade';
$this->tab = 'admin';
$this->tab = 'administration';
$this->version = 0.1;
if (!defined('_PS_ADMIN_DIR_'))
@@ -58,10 +58,13 @@ class Autoupgrade extends Module
$res &= @mkdir($autoupgradeDir);
if(file_exists($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($path.'logo.gif',_PS_ROOT_DIR_. DIRECTORY_SEPARATOR . 'img/t/AdminSelfUpgrade.gif');
$res &= copy(_PS_MODULE_DIR_.'autoupgrade/ajax-upgradetab.php',$autoupgradeDir . DIRECTORY_SEPARATOR . 'ajax-upgradetab.php');
$res &= copy(_PS_MODULE_DIR_.'autoupgrade/logo.gif',_PS_ROOT_DIR_. DIRECTORY_SEPARATOR . 'img/t/AdminSelfUpgrade.gif');
if (!$res
OR !Tab::getIdFromClassName('AdminSelfUpgrade')
+1 -1
View File
@@ -5,7 +5,7 @@
<version><![CDATA[0.1]]></version>
<description><![CDATA[Provides an automated method to upgrade your shop to the last PrestaShop version]]></description>
<author><![CDATA[]]></author>
<tab><![CDATA[admin]]></tab>
<tab><![CDATA[administration]]></tab>
<is_configurable>0</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>ebay</name>
<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>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[market_place]]></tab>
+6 -3
View File
@@ -1096,7 +1096,8 @@ class eBayRequest
foreach ($this->response->OrderArray->Order as $order)
{
$name = str_replace(array('_', ',', ' '), array('', '', ' '), (string)$order->ShippingAddress->Name);
$name = explode(' ', $name);
$name = preg_replace('/\-?\d+/', '', $name);
$name = explode(' ', $name, 2);
$itemList = array();
for ($i = 0; isset($order->TransactionArray->Transaction[$i]); $i++)
{
@@ -1110,6 +1111,8 @@ class eBayRequest
$tmp = explode('-', (string)$transaction->Item->SKU);
if (isset($tmp[1]))
$id_product = $tmp[1];
if (isset($tmp[2]))
$id_product_attribute = $tmp[2];
}
if (isset($transaction->Variation->SKU))
{
@@ -1160,8 +1163,8 @@ class eBayRequest
'status' => (string)$order->CheckoutStatus->Status,
'date' => substr((string)$order->CreatedTime, 0, 10).' '.substr((string)$order->CreatedTime, 11, 8),
'name' => (string)$order->ShippingAddress->Name,
'firstname' => $name[0],
'familyname' => (isset($name[1]) ? $name[1] : $name[0]),
'firstname' => trim($name[0]),
'familyname' => (isset($name[1]) ? trim($name[1]) : trim($name[0])),
'address1' => (string)$order->ShippingAddress->Street1,
'address2' => (string)$order->ShippingAddress->Street2,
'city' => (string)$order->ShippingAddress->CityName,
+14 -3
View File
@@ -59,7 +59,7 @@ class Ebay extends Module
{
$this->name = 'ebay';
$this->tab = 'market_place';
$this->version = '1.2.6';
$this->version = '1.2.8';
$this->author = 'PrestaShop';
parent::__construct ();
$this->displayName = $this->l('eBay');
@@ -656,7 +656,7 @@ class Ebay extends Module
success: function(data)
{
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
setTimeout ("checkToken()", 5000);
}
@@ -1111,10 +1111,11 @@ class Ebay extends Module
$ad = dirname($_SERVER["PHP_SELF"]);
// 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">
<fieldset style="border: 0">
<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' ? '
<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)
{
$fees = 0;
@@ -1529,6 +1538,8 @@ class Ebay extends Module
// Load default category matched in cache
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);
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
$pictures = array();
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>mondialrelay</name>
<displayName><![CDATA[Mondial Relay]]></displayName>
<version><![CDATA[1.7]]></version>
<version><![CDATA[1.7.4]]></version>
<description><![CDATA[Deliver in Relay points]]></description>
<author><![CDATA[]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
+2 -2
View File
@@ -37,13 +37,13 @@ class PaypalLib extends Paypal
unset($response[$k]);
}
}
if (!Configuration::get('PAYPAL_MODE_DEBUG'))
if (!Configuration::get('PAYPAL_DEBUG_MODE'))
$this->_logs = array();
$toExclude = array('TOKEN', 'SUCCESSPAGEREDIRECTREQUESTED', 'VERSION', 'BUILD', 'ACK', 'CORRELATIONID');
$this->_logs[] = '<b>'.$this->l('PayPal response:').'</b>';
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;
$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_SIGNATURE', trim(Tools::getValue('api_signature')));
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_PAYMENT_METHOD', (int)(Tools::getValue('payment_method')));
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');
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;