// MERGE with 1.4 r7770

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7776 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-07-28 09:20:57 +00:00
parent df255f66c1
commit a875fecb20
968 changed files with 26082 additions and 3937 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>uspscarrier</name>
<displayName><![CDATA[USPS Carrier]]></displayName>
<version><![CDATA[1.0]]></version>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Offer your customers, different delivery methods with USPS]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
-2
View File
@@ -119,5 +119,3 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_902b0d55fddef6f8d651fe1035b7d4bd'
$_MODULE['<{uspscarrier}prestashop>uspscarrier_ad20d10621babf619967b16f690a05f2'] = 'Der USPS Webservice scheint heruntergefahren zu sein, warten Sie bitte ein paar Minuten und versuchen Sie es erneut';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_a4692f93340d1d8c0c01e94baa56b8b9'] = 'USPS Webservice hat die Zeit überschritten.';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_ef87d840de42d54364089d1d45f8d08c'] = 'Konnte keine Verbindung zu USPS.com herstellen';
?>
+5 -1
View File
@@ -8,6 +8,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_883fa0069f4b0454e2277dd567ab3991'
$_MODULE['<{uspscarrier}prestashop>uspscarrier_5a3ceec65d417f5d92c26dbf0dccc00d'] = '\'Unité de mesure (CM ou IN)\'';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_4d470fde8487e755a50e9235e3dc13ab'] = 'doit être configuré pour fonctionner correctement';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_d2d22fe4f85d971b090bcbacec8f0123'] = 'USPS User ID';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_20449d3f0b6c6b9265a5cd2a470a6451'] = 'Poids du colis';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_bfc00de34bc04366e7fee516adf7dca5'] = 'Frais supplémentaire';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_761c02f2b956cac5abe5539c6d908508'] = 'La taille des paquets USPS';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_ca9df8a12e7558c34bcf7b88aab5cba5'] = 'Le type de paquet USPS';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f347d2e6d32688d9174b7aa1fc0124b1'] = 'Cela peut il être traité par une machine';
@@ -40,6 +42,8 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_6a26f548831e6a8c26bfbbd9f6ec61e0'
$_MODULE['<{uspscarrier}prestashop>uspscarrier_d2126da975d5b9a5b846efaf57d3fd53'] = 'Configuration générale';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_b150f21f4d216c6c275de3d69dffac68'] = 'Votre Identifiant USPS';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_ebbbab87d3a60b18f370b76f59dab31e'] = 'Cliquez ici pour obtenir votre USPS API Key';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_db06a2900c66a3a2cb78fe3a470f1b85'] = 'Poids du colis';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_0274f749472f365e7d48a501e14793e6'] = 'Frais supplémentaire';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_83ad4fdaf06650e6d9d7ca18f82fb975'] = 'Configuration de localisation';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_f489118ea95c746d648d36bb50c226f0'] = 'Unité de poids';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_659c95668841b7d6602ead454b28d4ba'] = 'L\'unité de poids de votre magasin (ex: kg ou lbs)';
@@ -66,7 +70,7 @@ $_MODULE['<{uspscarrier}prestashop>uspscarrier_795de10b1bdcb843b3703c63ad577fc6'
$_MODULE['<{uspscarrier}prestashop>uspscarrier_93c8645dbbc33cf8d126266a827a5501'] = 'Machinable';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_67cd0f5256c40c16a6cfd6effe3ab06b'] = 'Choisissez si cela peut être traité par une machine ou non par défaut';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_8d6bd50f3fe3ee2f4513066c25e5fb4a'] = 'Mode de calcul';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_37fa4a1a7af70286d9067ac63555cbf4'] = 'Utilisation du mode de calcul : \"Tous les articles dans un seul paquet\" utilisera automatiquement la taille des emballages par défaut, le type d\'emballage et de livraison. Les configurations spécifiques pour les catégories ou un produit ne seront pas utilisées.';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_3169c5057093f8e6c2750f1949a0900d'] = 'Utiliser la méthode de calcul \"Tous les produits dans un colis\" utilisera automatiquement la taille de colis, le type de colis et les services de livraison par défaut. Les configurations spécifiques des catégories et des produits ne seront pas utilisés.';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_5cdd307ba6e260beb4801c0c10e22a3a'] = 'Service de livraison';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_78945de8de090e90045d299651a68a9b'] = 'Disponible';
$_MODULE['<{uspscarrier}prestashop>uspscarrier_2d25c72c1b18e562f6654fff8e11711e'] = 'Non disponible';
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;
+24 -6
View File
@@ -50,7 +50,7 @@ class UspsCarrier extends CarrierModule
{
$this->name = 'uspscarrier';
$this->tab = 'shipping_logistics';
$this->version = '1.0';
$this->version = '1.1';
$this->author = 'PrestaShop';
$this->limited_countries = array('us');
@@ -94,6 +94,8 @@ class UspsCarrier extends CarrierModule
// Loading Fields List
$this->_fieldsList = array(
'USPS_CARRIER_USER_ID' => $this->l('USPS User ID'),
'USPS_CARRIER_PACKAGING_WEIGHT' => $this->l('Packaging weight'),
'USPS_CARRIER_HANDLING_FEE' => $this->l('Handling fee'),
'USPS_CARRIER_PACKAGING_SIZE' => $this->l('USPS Packaging Size'),
'USPS_CARRIER_PACKAGING_TYPE' => $this->l('USPS Packaging Type'),
'USPS_CARRIER_MACHINABLE' => $this->l('USPS Machinable'),
@@ -409,6 +411,7 @@ class UspsCarrier extends CarrierModule
private function _displayFormGeneral()
{
global $cookie;
$configCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
$html = '<script>
$(document).ready(function() {
@@ -444,6 +447,16 @@ class UspsCarrier extends CarrierModule
<input type="text" size="20" name="usps_carrier_user_id" value="'.Tools::getValue('usps_carrier_user_id', Configuration::get('USPS_CARRIER_USER_ID')).'" />
<p><a href="http://www.usps.com/webtools/" target="_blank">' . $this->l('Please click here to get your USPS API Key.') . '</a></p>
</div>
<label>'.$this->l('Packaging Weight').' : </label>
<div class="margin-form">
<input type="text" size="5" name="usps_carrier_packaging_weight" value="'.Tools::getValue('usps_carrier_packaging_weight', Configuration::get('USPS_CARRIER_PACKAGING_WEIGHT')).'" />
'.Tools::getValue('ps_weight_unit', Configuration::get('PS_WEIGHT_UNIT')).'
</div>
<label>'.$this->l('Handling Fee').' : </label>
<div class="margin-form">
<input type="text" size="5" name="usps_carrier_handling_fee" value="'.Tools::getValue('usps_carrier_handling_fee', Configuration::get('USPS_CARRIER_HANDLING_FEE')).'" />
'.$configCurrency->sign.'
</div>
</fieldset>
<fieldset style="border: 0px;">
@@ -543,7 +556,7 @@ class UspsCarrier extends CarrierModule
foreach($this->_calculModeList as $kcalculmode => $vcalculmode)
$html .= '<option value="'.$kcalculmode.'" '.($kcalculmode == (Tools::getValue('usps_carrier_calcul_mode', Configuration::get('USPS_CARRIER_CALCUL_MODE'))) ? 'selected="selected"' : '').'>'.$vcalculmode.'</option>';
$html .= '</select>
<p>' . $this->l('Using the calcul mode "All items in one package" will automatically use default packaging size, packaging type and delivery services. Specific configurations for categories or product won\'t be used.') . '</p>
<p>' . $this->l('Using the calcul mode "All items in one package" will automatically use default packaging size, packaging type and delivery services. Specifics configurations for categories or product won\'t be used.') . '</p>
</div>
<label>'.$this->l('Delivery Service').' : </label>
<div class="margin-form">';
@@ -613,6 +626,8 @@ class UspsCarrier extends CarrierModule
// All new configurations values are saved to be sure to test webservices with it
Configuration::updateValue('USPS_CARRIER_USER_ID', Tools::getValue('usps_carrier_user_id'));
Configuration::updateValue('USPS_CARRIER_PACKAGING_WEIGHT', Tools::getValue('usps_carrier_packaging_weight'));
Configuration::updateValue('USPS_CARRIER_HANDLING_FEE', Tools::getValue('usps_carrier_handling_fee'));
Configuration::updateValue('USPS_CARRIER_PACKAGING_SIZE', Tools::getValue('usps_carrier_packaging_size'));
Configuration::updateValue('USPS_CARRIER_PACKAGING_TYPE', Tools::getValue('usps_carrier_packaging_type'));
Configuration::updateValue('USPS_CARRIER_MACHINABLE', Tools::getValue('usps_carrier_machinable'));
@@ -638,6 +653,8 @@ class UspsCarrier extends CarrierModule
{
// Saving new configurations
if (Configuration::updateValue('USPS_CARRIER_USER_ID', Tools::getValue('usps_carrier_user_id')) AND
Configuration::updateValue('USPS_CARRIER_PACKAGING_WEIGHT', Tools::getValue('usps_carrier_packaging_weight')) AND
Configuration::updateValue('USPS_CARRIER_HANDLING_FEE', Tools::getValue('usps_carrier_handling_fee')) AND
Configuration::updateValue('USPS_CARRIER_PACKAGING_SIZE', Tools::getValue('usps_carrier_packaging_size')) AND
Configuration::updateValue('USPS_CARRIER_PACKAGING_TYPE', Tools::getValue('usps_carrier_packaging_type')) AND
Configuration::updateValue('USPS_CARRIER_MACHINABLE', Tools::getValue('usps_carrier_machinable')) AND
@@ -1152,7 +1169,7 @@ class UspsCarrier extends CarrierModule
<option value="0">'.$this->l('Select a product ...').'</option>';
$productsList = Db::getInstance()->ExecuteS('
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 2)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$cookie->id_lang.')
WHERE p.`active` = 1
ORDER BY pl.`name`');
foreach ($productsList as $product)
@@ -1376,7 +1393,7 @@ class UspsCarrier extends CarrierModule
foreach ($wsParams as $k => $v)
if ($k != 'products')
$paramHash .= '/'.$v;
return md5($productHash.$paramHash);
return md5($productHash.$paramHash.Configuration::get('USPS_CARRIER_CALCUL_MODE'));
}
public function getOrderShippingCostCache($wsParams)
@@ -1488,6 +1505,7 @@ class UspsCarrier extends CarrierModule
if ($product['weight'])
$weight += ($product['weight'] * $product['quantity']);
}
$weight += Tools::getValue('usps_carrier_packaging_weight', Configuration::get('USPS_CARRIER_PACKAGING_WEIGHT'));
// Get service in adequation with carrier and check if available
$servicesConfiguration = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'usps_rate_service_code` WHERE `active` = 1');
@@ -1549,7 +1567,7 @@ class UspsCarrier extends CarrierModule
// If webservice return a cost, we add it, else, we return the original shipping cost
$result = $this->getUspsShippingCost($wsParams);
if ($result['connect'] && $result['cost'] > 0)
return ($cost + $result['cost']);
return ($cost + $result['cost'] + Tools::getValue('usps_carrier_handling_fee', Configuration::get('USPS_CARRIER_HANDLING_FEE')));
return false;
}
@@ -1722,7 +1740,7 @@ class UspsCarrier extends CarrierModule
// Check currency
$conversionRate = 1;
if (isset($resultTab['RATEV4RESPONSE']['PACKAGE']['POSTAGE']['RATE']))
$conversionRate = $this->getCartCurrencyRate(2, $wsParams['id_cart']);
$conversionRate = $this->getCartCurrencyRate(Currency::getIdByIsoCode('USD'), $wsParams['id_cart']);
// Return results
if (isset($resultTab['RATEV4RESPONSE']['PACKAGE']['POSTAGE']['RATE']))