// Merge -> revision 9061

This commit is contained in:
rMalie
2011-10-05 15:21:55 +00:00
parent d8f04cedb7
commit bbc6c6bdc4
53 changed files with 795 additions and 456 deletions

View File

@@ -38,4 +38,4 @@ if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
$_REQUEST['controller'] = strtolower($_REQUEST['tab']);
Dispatcher::getInstance()->setControllerDirectories(array(_PS_ADMIN_DIR_.'/tabs/', _PS_ADMIN_CONTROLLER_DIR_));
Dispatcher::getInstance()->dispatch();
Dispatcher::getInstance()->dispatch();

View File

@@ -559,9 +559,13 @@ if (Tools::isSubmit('helpAccess'))
if (Tools::isSubmit('getHookableList'))
{
if (!strlen(Tools::getValue('hooks_list')))
die('{"hasError" : true, "errors" : ["Live Edit : no module on this page"]}');
$modules_list = explode(',', Tools::getValue('modules_list'));
$hooks_list = explode(',', Tools::getValue('hooks_list'));
$hookableList = array();
foreach ($modules_list as $module)
{
$module = trim($module);
@@ -581,6 +585,7 @@ if (Tools::isSubmit('getHookableList'))
}
}
$hookableList['hasError'] = false;
die(Tools::jsonEncode($hookableList));
}

View File

@@ -275,11 +275,11 @@ class AdminCarriers extends AdminTab
private function changeGroups($id_carrier, $delete = true)
{
if ($delete)
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier='.(int)($id_carrier));
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$id_carrier);
$groups = Db::getInstance()->ExecuteS('SELECT id_group FROM `'._DB_PREFIX_.'group`');
foreach ($groups as $group)
if (Tools::getIsset('groupBox') && in_array($group['id_group'], Tools::getValue('groupBox')))
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'carrier_group (id_group, id_carrier) VALUES('.(int)($group['id_group']).','.(int)($id_carrier).')');
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'carrier_group (id_group, id_carrier) VALUES('.(int)$group['id_group'].','.(int)$id_carrier.')');
}
public function postProcess()
@@ -300,7 +300,7 @@ class AdminCarriers extends AdminTab
$object = new $this->className($id);
if (Validate::isLoadedObject($object))
{
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier='.(int)($id));
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'carrier_group WHERE id_carrier = '.(int)$id);
$object->deleted = 1;
$object->update();
$objectNew = new $this->className();
@@ -348,6 +348,18 @@ class AdminCarriers extends AdminTab
}
}
}
elseif ((isset($_GET['status'.$this->table]) OR isset($_GET['status'])) AND Tools::getValue($this->identifier))
{
if ($this->tabAccess['edit'] === '1')
{
if (Tools::getValue('id_carrier') == Configuration::get('PS_CARRIER_DEFAULT'))
$this->_errors[] = Tools::displayError('You can\'t disable the default carrier, please change your default carrier first.');
else
parent::postProcess();
}
else
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
else
{
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
@@ -383,5 +395,4 @@ class AdminCarriers extends AdminTab
$this->_list[$key]['name'] = Configuration::get('PS_SHOP_NAME');
parent::displayListContent($token);
}
}
}

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -47,7 +47,7 @@ class AdminCategories extends AdminTab
'description' => array('title' => $this->l('Description'), 'width' => 500, 'maxlength' => 90, 'callback' => 'getDescriptionClean', 'orderby' => false),
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
'active' => array('title' => $this->l('Displayed'), 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
$this->_category = AdminCatalog::getCurrentCategory();
$this->_filter = 'AND `id_parent` = '.(int)($this->_category->id);
$this->_select = 'position ';
@@ -76,6 +76,7 @@ class AdminCategories extends AdminTab
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subcategory')))).' '.$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
if ($this->tabAccess['add'] === '1')
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCatalog&add'.$this->table.'&id_parent='.$this->_category->id.'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
echo '<div style="margin:10px;">';
$this->displayList($token);
echo '</div>';
@@ -215,9 +216,9 @@ class AdminCategories extends AdminTab
<div class="margin-form">';
// Translations are not automatic for the moment ;)
$trads = array(
'Home' => $this->l('Home'),
'selected' => $this->l('selected'),
'Collapse All' => $this->l('Collapse All'),
'Home' => $this->l('Home'),
'selected' => $this->l('selected'),
'Collapse All' => $this->l('Collapse All'),
'Expand All' => $this->l('Expand All')
);
echo Helper::renderAdminCategorieTree($trads, array(isset($obj->id_parent) ? $obj->id_parent : Tools::getValue('id_parent', 1)), 'id_parent', true);
@@ -237,7 +238,7 @@ class AdminCategories extends AdminTab
echo ' <br /><input type="file" name="image" />
<p>'.$this->l('Upload category logo from your computer').'</p>
</div>
<div class="clear"><br /></div>
<div class="clear"><br /></div>
<label>'.$this->l('Meta title:').' </label>
<div class="margin-form translatable">';
foreach ($this->_languages AS $language)

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -34,18 +34,20 @@ class AdminLanguages extends AdminTab
$this->lang = false;
$this->edit = true;
$this->delete = true;
$this->fieldImageSettings = array(array('name' => 'flag', 'dir' => 'l'), array('name' => 'no-picture', 'dir' => 'p'));
$this->fieldsDisplay = array(
'id_lang' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'flag' => array('title' => $this->l('Logo'), 'align' => 'center', 'image' => 'l', 'orderby' => false, 'search' => false),
'name' => array('title' => $this->l('Name'), 'width' => 120),
'iso_code' => array('title' => $this->l('ISO code'), 'width' => 70, 'align' => 'center'),
'language_code' => array('title' => $this->l('Language code'), 'width' => 70, 'align' => 'center'),
'date_format_lite' => array('title' => $this->l('Date format')),
'date_format_full' => array('title' => $this->l('Date format (full)')),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool'),
);
$this->optionsList = array(
'general' => array(
'title' => $this->l('Languages options'),
@@ -57,7 +59,7 @@ class AdminLanguages extends AdminTab
parent::__construct();
}
/**
* Copy a no-product image
*
@@ -79,7 +81,7 @@ class AdminLanguages extends AdminTab
if (!imageResize($tmpName, _PS_IMG_DIR_.'m/'.$language.'.jpg'))
$this->_errors[] = Tools::displayError('An error occurred while copying no-picture image to your manufacturer folder');
else
{
{
$imagesTypes = ImageType::getImagesTypes('products');
foreach ($imagesTypes AS $k => $imageType)
{
@@ -94,11 +96,11 @@ class AdminLanguages extends AdminTab
unlink($tmpName);
}
}
/**
* deleteNoPictureImages will delete all default image created for the language id_language
*
* @param string $id_language
*
* @param string $id_language
* @return boolean true if no error
*/
private function deleteNoPictureImages($id_language)
@@ -133,7 +135,7 @@ class AdminLanguages extends AdminTab
{
if (isset($_GET['delete'.$this->table]))
{
if ($this->tabAccess['delete'] === '1')
if ($this->tabAccess['delete'] === '1')
{
if (Validate::isLoadedObject($object = $this->loadObject()) AND isset($this->fieldImageSettings))
{
@@ -242,26 +244,26 @@ class AdminLanguages extends AdminTab
else
return parent::postProcess();
}
public function beforeUpdateOptions()
{
$lang = new Language((int)Tools::getValue('PS_LANG_DEFAULT'));
if (!$lang->active)
$this->_errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
}
public function displayList()
{
$this->displayWarning($this->l('When you delete a language, all related translations in the database will be deleted.'));
parent::displayList();
$languages = Language::getLanguages(false);
}
public function displayListContent($token=NULL)
{
$irow = 0;
if ($this->_list)
foreach ($this->_list AS $tr)
{
$id = $tr[$this->identifier];
@@ -314,11 +316,11 @@ class AdminLanguages extends AdminTab
echo '</tr>';
}
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
@@ -337,18 +339,28 @@ class AdminLanguages extends AdminTab
<input type="hidden" value="'._PS_VERSION_.'" name="ps_version" id="ps_version" />
<label>'.$this->l('Name:').' </label>
<div class="margin-form">
<input type="text" size="8" maxlength="32" name="name" value="'.htmlentities($this->getFieldValue($obj, 'name'), ENT_COMPAT, 'UTF-8').'" /> <sup>*</sup>
<input type="text" size="8" maxlength="32" name="name" value="'.Tools::htmlentitiesUTF8($this->getFieldValue($obj, 'name')).'" /> <sup>*</sup>
</div>
<label>'.$this->l('ISO code:').' </label>
<div class="margin-form">
<input type="text" size="4" maxlength="2" name="iso_code" id="iso_code" value="'.htmlentities($this->getFieldValue($obj, 'iso_code'), ENT_COMPAT, 'UTF-8').'" onKeyUp="checkLangPack();" /> <sup>*</sup>
<input type="text" size="4" maxlength="2" name="iso_code" id="iso_code" value="'.Tools::htmlentitiesUTF8($this->getFieldValue($obj, 'iso_code')).'" onKeyUp="checkLangPack();" /> <sup>*</sup>
<p>'.$this->l('2-letter ISO code (e.g., fr, en, de)').'</p>
</div>
<label>'.$this->l('Language code:').' </label>
<div class="margin-form">
<input type="text" size="10" maxlength="5" name="language_code" id="language_code" value="'.htmlentities($this->getFieldValue($obj, 'language_code'), ENT_COMPAT, 'UTF-8').'"/> <sup>*</sup>
<input type="text" size="10" maxlength="5" name="language_code" id="language_code" value="'.Tools::htmlentitiesUTF8($this->getFieldValue($obj, 'language_code')).'"/> <sup>*</sup>
<p>'.$this->l('Full language code (e.g., en-us, pt-br)').'</p>
</div>
<label>'.$this->l('Date format:').' </label>
<div class="margin-form">
<input type="text" size="15" name="date_format_lite" id="date_format_lite" value="'.Tools::htmlentitiesUTF8($this->getFieldValue($obj, 'date_format_lite')).'"/> <sup>*</sup>
<p>'.$this->l('Date format, lite (e.g., Y-m-d, d/m/Y)').'</p>
</div>
<label>'.$this->l('Date format (full):').' </label>
<div class="margin-form">
<input type="text" size="25" name="date_format_full" id="date_format_full" value="'.Tools::htmlentitiesUTF8($this->getFieldValue($obj, 'date_format_full')).'"/> <sup>*</sup>
<p>'.$this->l('Date format, full (e.g., Y-m-d H:i:s, d/m/Y H:i)').'</p>
</div>
<label>'.$this->l('Flag:').' </label>
<div class="margin-form">
<input type="file" name="flag" /> <sup>*</sup>
@@ -389,7 +401,7 @@ class AdminLanguages extends AdminTab
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
</fieldset>
</form>';
if ($obj->id AND !$obj->checkFiles())
{
echo '
@@ -420,7 +432,7 @@ class AdminLanguages extends AdminTab
</fieldset>';
}
}
public function displayFilesList($files)
{
foreach ($files as $key => $file)

View File

@@ -3340,15 +3340,15 @@ class AdminProducts extends AdminTab
<td style="padding-bottom:5px;">
<div id="divAccessories">';
foreach ($accessories as $accessory)
echo $accessory['name'].(!empty($accessory['reference']) ? ' ('.$accessory['reference'].')' : '').' <span onclick="delAccessory('.$accessory['id_product'].');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />';
echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8').(!empty($accessory['reference']) ? ' ('.$accessory['reference'].')' : '').' <span onclick="delAccessory('.$accessory['id_product'].');" style="cursor: pointer;"><img src="../img/admin/delete.gif" class="middle" alt="" /></span><br />';
echo '</div>
<input type="hidden" name="inputAccessories" id="inputAccessories" value="';
foreach ($accessories as $accessory)
echo $accessory['id_product'].'-';
echo (int)$accessory['id_product'].'-';
echo '" />
<input type="hidden" name="nameAccessories" id="nameAccessories" value="';
foreach ($accessories as $accessory)
echo $accessory['name'].'¤';
echo htmlentities($accessory['name'], ENT_COMPAT, 'UTF-8').'¤';
echo '" />
<script type="text/javascript">

View File

@@ -180,6 +180,12 @@ abstract class AdminTabCore
public $ajax = false;
/**
* if true, ajax-tab will not wait 1 sec
* @var boolean
*/
public $ignore_sleep = false;
public static $tabParenting = array(
'AdminProducts' => 'AdminCatalog',
'AdminCategories' => 'AdminCatalog',

View File

@@ -444,6 +444,29 @@ class CarrierCore extends ObjectModel
return $countries;
}
/**
* Return the default carrier to use
*
* @param array $carriers
* @param array $defaultCarrier the last carrier selected
* @return number the id of the default carrier
*/
public static function getDefaultCarrierSelection($carriers, $defaultCarrier = 0)
{
if(empty($carriers))
return 0;
if ((int)$defaultCarrier != 0)
foreach ($carriers AS $carrier)
if ($carrier['id_carrier'] == (int)$defaultCarrier)
return (int)$carrier['id_carrier'];
foreach ($carriers AS $carrier)
if ($carrier['id_carrier'] == (int)Configuration::get('PS_CARRIER_DEFAULT'))
return (int)$carrier['id_carrier'];
return (int)$carriers[0]['id_carrier'];
}
/**
*
* @param int $id_zone

View File

@@ -1004,6 +1004,12 @@ class CategoryCore extends ObjectModel
return $return;
}
/** this function return the number of category + 1 having $id_category_parent as parent.
*
* @todo rename that function to make it understandable (getNewLastPosition for example)
* @param int $id_category_parent the parent category
* @return int
*/
public static function getLastPosition($id_category_parent)
{
return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'category` WHERE `id_parent` = '.(int)($id_category_parent)));

View File

@@ -175,6 +175,25 @@ class GroupCore extends ObjectModel
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_GROUP_FEATURE_ACTIVE', self::isCurrentlyUsed());
// Add default group (id 1) to customers without groups
Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'customer_group` (
SELECT c.id_customer, 1 FROM `'._DB_PREFIX_.'customer` c
LEFT JOIN `'._DB_PREFIX_.'customer_group` cg
ON cg.id_customer = c.id_customer
WHERE cg.id_customer IS NULL)');
// Set to the customer the default group
// Select the minimal id from customer_group
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'customer` cg
SET id_default_group =
IFNULL((
SELECT min(id_group) FROM `'._DB_PREFIX_.'customer_group`
WHERE id_customer = cg.id_customer),
1)
WHERE `id_default_group` = '.(int)$this->id);
Discount::deleteByIdGroup($this->id);
return true;
}
return false;

View File

@@ -38,15 +38,22 @@ class LanguageCore extends ObjectModel
/** @var string 5-letter iso code */
public $language_code;
/** @var string date format http://http://php.net/manual/en/function.date.php with the date only */
public $date_format_lite = 'Y-m-d';
/** @var string date format http://http://php.net/manual/en/function.date.php with hours and minutes */
public $date_format_full = 'Y-m-d H:i:s';
/** @var bool true if this language is right to left language */
public $is_rtl = false;
/** @var boolean Status */
public $active = true;
protected $fieldsRequired = array('name', 'iso_code');
protected $fieldsSize = array('name' => 32, 'iso_code' => 2, 'language_code' => 5);
protected $fieldsValidate = array('name' => 'isGenericName', 'iso_code' => 'isLanguageIsoCode', 'language_code' => 'isLanguageCode', 'active' => 'isBool', 'is_rtl' => 'isBool');
protected $fieldsRequired = array('name', 'iso_code', 'date_format_lite', 'date_format_full');
protected $fieldsSize = array('name' => 32, 'iso_code' => 2, 'language_code' => 5, 'date_format_lite' => 32, 'date_format_full' => 32);
protected $fieldsValidate = array('name' => 'isGenericName', 'iso_code' => 'isLanguageIsoCode', 'language_code' => 'isLanguageCode',
'active' => 'isBool', 'is_rtl' => 'isBool', 'date_format_lite' => 'isPhpDateFormat', 'date_format_full' => 'isPhpDateFormat');
protected $table = 'lang';
protected $identifier = 'id_lang';
@@ -82,17 +89,19 @@ class LanguageCore extends ObjectModel
$fields['is_rtl'] = (int)$this->is_rtl;
if (empty($fields['language_code']))
$fields['language_code'] = $fields['iso_code'];
$fields['date_format_lite'] = pSQL($this->date_format_lite);
$fields['date_format_full'] = pSQL($this->date_format_full);
$fields['active'] = (int)$this->active;
return $fields;
}
/**
* Generate traslations files
*
*
*/
private function _generateFiles($newIso){
$iso_code = $newIso?$newIso:$this->iso_code;
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
foreach ($this->translationsFilesAndVars as $file => $var)
@@ -102,7 +111,7 @@ class LanguageCore extends ObjectModel
$'.$var.' = array();
?>');
}
/**
* Move translations files after editiing language iso code
*/
@@ -122,7 +131,7 @@ class LanguageCore extends ObjectModel
{
if (file_exists(_PS_MODULE_DIR_.$moduleDir.'/mails/'.$this->iso_code))
rename(_PS_MODULE_DIR_.$moduleDir.'/mails/'.$this->iso_code, _PS_MODULE_DIR_.$moduleDir.'/mails/'.$newIso);
if (file_exists(_PS_MODULE_DIR_.$moduleDir.'/'.$this->iso_code.'.php'))
rename(_PS_MODULE_DIR_.$moduleDir.'/'.$this->iso_code.'.php', _PS_MODULE_DIR_.$moduleDir.'/'.$newIso.'.php');
}
@@ -140,7 +149,7 @@ class LanguageCore extends ObjectModel
rename(_PS_ALL_THEMES_DIR_.$theme.'/modules/'.$module.'/'.$this->iso_code.'.php', _PS_ALL_THEMES_DIR_.$theme.'/modules/'.$module.'/'.$newIso.'.php');
}
}
/**
* Return an array with themes and thumbnails
*
@@ -152,10 +161,10 @@ class LanguageCore extends ObjectModel
while ($folder = readdir($dir))
if ($folder != '.' AND $folder != '..' AND file_exists(_PS_ALL_THEMES_DIR_.'/'.$folder.'/preview.jpg'))
$themes[$folder]['name'] = $folder;
closedir($dir);
closedir($dir);
return isset($themes) ? $themes : array();
}
public function add($autodate = true, $nullValues = false)
{
if (!parent::add($autodate))
@@ -237,37 +246,19 @@ class LanguageCore extends ObjectModel
}
$lFiles = array('admin'.'.php', 'errors'.'.php', 'fields'.'.php', 'pdf'.'.php');
$mFiles = array(
'account.html', 'account.txt',
'bankwire.html', 'bankwire.txt',
'cheque.html', 'cheque.txt',
'contact.html', 'contact.txt',
'contact_form.html', 'contact_form.txt',
'credit_slip.html', 'credit_slip.txt',
'download_product.html', 'download_product.txt',
'download-product.tpl',
'employee_password.html', 'employee_password.txt',
'forward_msg.html', 'forward_msg.txt',
'guest_to_customer.html', 'guest_to_customer.txt',
'in_transit.html', 'in_transit.txt',
'newsletter.html', 'newsletter.txt',
'order_canceled.html', 'order_canceled.txt',
'order_conf.html', 'order_conf.txt',
'order_customer_comment.html', 'order_customer_comment.txt',
'order_merchant_comment.html', 'order_merchant_comment.txt',
'order_return_state.html', 'order_return_state.txt',
'outofstock.html', 'outofstock.txt',
'password.html', 'password.txt',
'password_query.html', 'password_query.txt',
'payment.html', 'payment.txt',
'payment_error.html', 'payment_error.txt',
'preparation.html', 'preparation.txt',
'refund.html', 'refund.txt',
'reply_msg.html', 'reply_msg.txt',
'shipped.html', 'shipped.txt',
'test.html', 'test.txt',
'voucher.html', 'voucher.txt',
);
$mFiles = array('account.html', 'account.txt', 'bankwire.html', 'bankwire.txt',
'cheque.html', 'cheque.txt', 'contact.html', 'contact.txt', 'contact_form.html',
'contact_form.txt', 'credit_slip.html', 'credit_slip.txt', 'download_product.html',
'download_product.txt', 'download-product.tpl', 'employee_password.html', 'employee_password.txt',
'forward_msg.html', 'forward_msg.txt', 'guest_to_customer.html', 'guest_to_customer.txt',
'in_transit.html', 'in_transit.txt', 'log_alert.html', 'log_alert.txt', 'newsletter.html', 'newsletter.txt',
'order_canceled.html', 'order_canceled.txt', 'order_conf.html', 'order_conf.txt',
'order_customer_comment.html', 'order_customer_comment.txt', 'order_merchant_comment.html',
'order_merchant_comment.txt', 'order_return_state.html', 'order_return_state.txt',
'outofstock.html', 'outofstock.txt', 'password.html', 'password.txt', 'password_query.html',
'password_query.txt', 'payment.html', 'payment.txt', 'payment_error.html', 'payment_error.txt',
'preparation.html', 'preparation.txt', 'refund.html', 'refund.txt', 'reply_msg.html',
'reply_msg.txt', 'shipped.html', 'shipped.txt', 'test.html', 'test.txt', 'voucher.html', 'voucher.txt');
$number = -1;
@@ -277,7 +268,6 @@ class LanguageCore extends ObjectModel
$files_mail = array();
$files_modules = array();
// When a copy is made from a theme in specific language
// to an other theme for the same language,
// it's avoid to copy Translations, Mails files
@@ -351,7 +341,7 @@ class LanguageCore extends ObjectModel
/**
* loadUpdateSQL will create default lang values when you create a new lang, based on default id lang
*
*
* @return boolean true if succeed
*/
public function loadUpdateSQL()
@@ -612,18 +602,14 @@ class LanguageCore extends ObjectModel
{
self::$_LANGUAGES = array();
$result = Db::getInstance()->ExecuteS('
SELECT l.`id_lang`, l.`name`, l.`iso_code`, l.`active`, ls.`id_shop`
FROM `'._DB_PREFIX_.'lang` l
LEFT JOIN `'._DB_PREFIX_.'lang_shop` ls ON (l.id_lang = ls.id_lang)');
$sql = 'SELECT l.*, ls.`id_shop`
FROM `'._DB_PREFIX_.'lang` l
LEFT JOIN `'._DB_PREFIX_.'lang_shop` ls ON (l.id_lang = ls.id_lang)';
$result = Db::getInstance()->ExecuteS($sql);
foreach ($result AS $row)
{
if (!isset(self::$_LANGUAGES[(int)$row['id_lang']]))
self::$_LANGUAGES[(int)$row['id_lang']] = array('id_lang' => (int)$row['id_lang'],
'name' => $row['name'],
'iso_code' => $row['iso_code'],
'active' => (int)$row['active'],);
self::$_LANGUAGES[(int)$row['id_lang']] = $row;
self::$_LANGUAGES[(int)$row['id_lang']]['shops'][(int)$row['id_shop']] = true;
}
}
@@ -631,7 +617,7 @@ class LanguageCore extends ObjectModel
public function update($nullValues = false)
{
if (!parent::update($nullValues))
return false;
@@ -732,7 +718,7 @@ class LanguageCore extends ObjectModel
/**
* Check if more on than one language is activated
*
*
* @since 1.5.0
* @return bool
*/

View File

@@ -870,6 +870,13 @@ abstract class ModuleCore
return $output;
}
/**
* Returns the list of the payment module associated to the current customer
* @see PaymentModule::getInstalledPaymentModules() if you don't care about the context
*
* @return array module informations
*/
public static function getPaymentModules()
{
$context = Context::getContext();

View File

@@ -148,6 +148,7 @@ abstract class ObjectModelCore
$this->id = (int)($id);
foreach ($result AS $key => $value)
if (key_exists($key, $this))
// Todo: stripslashes() MUST BE removed in 1.4.6 and later, but is kept in 1.4.5 for a compatibility issue
$this->{$key} = stripslashes($value);
if (!$id_lang AND method_exists($this, 'getTranslationsFieldsChild'))
@@ -164,6 +165,8 @@ abstract class ObjectModelCore
{
if (!is_array($this->{$key}))
$this->{$key} = array();
// @Todo: stripslashes() MUST BE removed in 1.4.6 and later, but is kept in 1.4.5 for a compatibility issue
$this->{$key}[$row['id_lang']] = stripslashes($value);
}
}
@@ -200,7 +203,7 @@ abstract class ObjectModelCore
public function add($autodate = true, $nullValues = false)
{
if (!Validate::isTableOrIdentifier($this->table))
die(Tools::displayError());
die(Tools::displayError('not table or identifier : ').$this->table);
/* Automatically fill dates */
if ($autodate AND key_exists('date_add', $this))
@@ -229,7 +232,7 @@ abstract class ObjectModelCore
{
foreach (array_keys($field) AS $key)
if (!Validate::isTableOrIdentifier($key))
die(Tools::displayError());
die(Tools::displayError('key is not table or identifier, ').$key);
$field[$this->identifier] = (int)$this->id;
if (isset($assos[$this->table.'_lang']) && $assos[$this->table.'_lang']['type'] == 'fk_shop')
@@ -401,7 +404,7 @@ abstract class ObjectModelCore
{
/* WARNING : Product do not use this function, so do not forget to report any modification if necessary */
if (!Validate::isTableOrIdentifier($this->identifier))
die(Tools::displayError());
die(Tools::displayError('identifier is not table or identifier : ').$this->identifier);
$fields = array();

View File

@@ -537,6 +537,8 @@ class OrderCore extends ObjectModel
/**
* Check if order contains (only) virtual products
*
* @param boolean $strict If false return true if there are at least one product virtual
* @return boolean true if is a virtual order or false
*
*/
@@ -545,7 +547,7 @@ class OrderCore extends ObjectModel
$products = $this->getProducts();
if (count($products) < 1)
return false;
$virtual = false;
$virtual = true;
foreach ($products AS $product)
{
$pd = ProductDownload::getIdFromIdProduct((int)($product['product_id']));
@@ -553,8 +555,9 @@ class OrderCore extends ObjectModel
{
if ($strict === false)
return true;
$virtual &= true;
}
else
$virtual &= false;
}
return $virtual;
}

View File

@@ -775,7 +775,7 @@ class PDFCore extends PDF_PageGroupCore
$products = self::$order->getProducts();
}
else
$products = self::$orderSlip->getProducts();
$products = self::$orderSlip->getOrdersSlipProducts(self::$orderSlip->id, self::$order);
$customizedDatas = Product::getAllCustomizedDatas((int)(self::$order->id_cart));
Product::addCustomizationPrice($products, $customizedDatas);
@@ -974,7 +974,10 @@ class PDFCore extends PDF_PageGroupCore
$tmp = 0;
$product = &$tmp;
/* And secondly assign to each tax its own reduction part */
$discountAmount = 0;
if (!self::$orderSlip)
$discountAmount = (float)(self::$order->total_discounts);
foreach ($products as $product)
{
$ratio = $amountWithoutTax == 0 ? 0 : $product['priceWithoutTax'] / $amountWithoutTax;

View File

@@ -276,7 +276,7 @@ abstract class PaymentModuleCore extends Module
$productsList .=
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').' - '.$this->l('Customized').(!empty($customizationText) ? ' - '.$customizationText : '').'</strong></td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.$this->l('Customized').(!empty($customizationText) ? ' - '.$customizationText : '').'</strong></td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>
<td style="padding: 0.6em 0.4em; text-align: center;">'.$customizationQuantity.'</td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice($customizationQuantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>
@@ -287,7 +287,7 @@ abstract class PaymentModuleCore extends Module
$productsList .=
'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').'</strong></td>
<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</strong></td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>
<td style="padding: 0.6em 0.4em; text-align: center;">'.((int)($product['cart_quantity']) - $customizationQuantity).'</td>
<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(((int)($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>

View File

@@ -353,7 +353,6 @@ class SearchCore
public static function indexation($full = false, $id_product = false)
{
$db = Db::getInstance();
$dropIndex = false;
if ($id_product)
$full = false;
@@ -363,11 +362,10 @@ class SearchCore
$db->Execute('TRUNCATE '._DB_PREFIX_.'search_index');
$db->Execute('TRUNCATE '._DB_PREFIX_.'search_word');
$db->Execute('UPDATE '._DB_PREFIX_.'product SET indexed = 0');
$dropIndex = true;
}
else
{
// Do it even if you already know the product id on order to be sure that it exists
// Do it even if you already know the product id in order to be sure that it exists
$products = $db->ExecuteS('
SELECT id_product
FROM '._DB_PREFIX_.'product
@@ -377,24 +375,8 @@ class SearchCore
if ($products)
foreach($products AS $product)
$ids[] = (int)$product['id_product'];
if (sizeof($ids))
if (count($ids))
$db->Execute('DELETE FROM '._DB_PREFIX_.'search_index WHERE id_product IN ('.implode(',', $ids).')');
if (count($products) > 2000)
$dropIndex = true;
}
if ($dropIndex)
{
$dropIndex = false;
$result = $db->ExecuteS('SHOW INDEX FROM `'._DB_PREFIX_.'search_index`');
foreach ($result as $row)
if (strtolower($row['Key_name']) == 'primary')
$dropIndex = true;
if ($dropIndex)
$db->Execute('ALTER TABLE '._DB_PREFIX_.'search_index DROP PRIMARY KEY');
$dropIndex = true;
}
// Every fields are weighted according to the configuration in the backend
@@ -477,11 +459,10 @@ class SearchCore
}
$existingWords = $db->ExecuteS('
SELECT word FROM '._DB_PREFIX_.'search_word
SELECT DISTINCT word FROM '._DB_PREFIX_.'search_word
WHERE word IN ('.implode(',', $queryArray2).')
AND id_lang = '.(int)$product['id_lang'].' GROUP BY word');
AND id_lang = '.(int)$product['id_lang']);
if($existingWords)
foreach($existingWords as $data)
unset($queryArray[Tools::replaceAccentedChars($data['word'])]);
@@ -530,20 +511,6 @@ class SearchCore
// One last save is done at the end in order to save what's left
Search::saveIndex($queryArray3);
}
// If it has been deleted, the index is created again once the indexation is done
if (!$dropIndex)
{
$dropIndex = true;
$result = $db->ExecuteS('SHOW INDEX FROM `'._DB_PREFIX_.'search_index`');
foreach ($result as $row)
if (strtolower($row['Key_name']) == 'primary')
$dropIndex = false;
}
if ($dropIndex)
$db->Execute('ALTER TABLE `'._DB_PREFIX_.'search_index` ADD PRIMARY KEY (`id_word`, `id_product`)');
Configuration::updateValue('PS_NEED_REBUILD_INDEX', 0);
return true;
}

View File

@@ -70,9 +70,18 @@ class TabCore extends ObjectModel
return $this->getTranslationsFields(array('name'));
}
public function add($autodate = true, $null_values = false)
/**
* additionnal treatments for Tab when creating new one :
* - generate a new position
* - add access for admin profile
*
* @param boolean $autodate
* @param boolean $nullValues
* @return int id_tab
*/
public function add($autodate = true, $nullValues = false)
{
$this->position = self::getNbTabs($this->id_parent) + 1;
$this->position = self::getNewLastPosition($this->id_parent);
if (parent::add($autodate, $null_values))
{
// refresh cache when adding new tab
@@ -82,6 +91,12 @@ class TabCore extends ObjectModel
return false;
}
/** When creating a new tab $id_tab, this add default rights to the table access
*
* @todo this should not be public static but protected
* @param int $id_tab
* @return boolean true if succeed
*/
public static function initAccess($id_tab, Context $context = null)
{
if (!$context)
@@ -89,16 +104,22 @@ class TabCore extends ObjectModel
if (!$context->employee->id_profile)
return false;
/* Profile selection */
$profiles = Db::getInstance()->ExecuteS('SELECT `id_profile` FROM '._DB_PREFIX_.'profile');
$profiles = Db::getInstance()->ExecuteS('SELECT `id_profile` FROM '._DB_PREFIX_.'profile where `id_profile` != 1');
if (!$profiles || empty($profiles))
return false;
/* Query definition */
$query = 'INSERT INTO `'._DB_PREFIX_.'access` VALUES ';
// note : insert ignore should be avoided
$query = 'INSERT IGNORE INTO `'._DB_PREFIX_.'access` (`id_profile`, `id_tab`, `view`, `add`, `edit`, `delete`) VALUES ';
// default admin
$query .= '(1, '.(int)$id_tab.', 1, 1, 1, 1),';
foreach ($profiles as $profile)
{
$rights = (((int)$profile['id_profile'] == 1 || (int)$profile['id_profile'] == $context->employee->id_profile) ? 1 : 0);
$query .= ($profile === $profiles[0] ? '' : ', ').'('.(int)$profile['id_profile'].', '.(int)($id_tab).', '.$rights.', '.$rights.', '.$rights.', '.$rights.')';
// no cast needed for profile[id_profile], which cames from db
// And we disable all profile but current one
$rights = $profile['id_profile'] == $context->employee->id_profile ? 1 : 0;
$query .= '('.$profile['id_profile'].', '.(int)$id_tab.', '.$rights.', '.$rights.', '.$rights.', '.$rights.'),';
}
$query = trim($query, ', ');
return Db::getInstance()->Execute($query);
}
@@ -205,6 +226,17 @@ class TabCore extends ObjectModel
'.(!is_null($id_parent) ? 'WHERE t.`id_parent` = '.(int)$id_parent : ''));
}
/**
* return an available position in subtab for parent $id_parent
*
* @param mixed $id_parent
* @return int
*/
public static function getNewLastPosition($id_parent)
{
return (Db::getInstance()->getValue('SELECT MAX(position)+1 FROM `'._DB_PREFIX_.'tab` WHERE `id_parent` = '.(int)($id_parent)));
}
public function move($direction)
{
$nb_tabs = self::getNbTabs($this->id_parent);

View File

@@ -485,20 +485,16 @@ class ToolsCore
*/
public static function displayDate($date, $id_lang, $full = false, $separator='-')
{
if (!$date OR !strtotime($date))
if (!$date OR !($time = strtotime($date)))
return $date;
if (!Validate::isDate($date) OR !Validate::isBool($full))
die (self::displayError('Invalid date'));
$tmpTab = explode($separator, substr($date, 0, 10));
$hour = ' '.substr($date, -8);
$language = Language::getLanguage((int)($id_lang));
if ($language AND strtolower($language['iso_code']) == 'fr')
return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : ''));
else
return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : ''));
$language = Language::getLanguage((int)$id_lang);
return date($full ? $language['date_format_full'] : $language['date_format_lite'], $time);
}
/**
* Sanitize a string
*
@@ -1191,6 +1187,7 @@ class ToolsCore
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $curlTimeOut);
curl_setopt($curl, CURLOPT_TIMEOUT, $curlTimeOut);
$content = curl_exec($curl);
curl_close($curl);
return $content;

View File

@@ -408,6 +408,18 @@ class ValidateCore
return preg_match('/^[a-zA-Z_0-9-]+$/', $configName);
}
/**
* Check date formats like http://php.net/manual/en/function.date.php
*
* @param string $date_format date format to check
* @return boolean Validity is ok or not
*/
public static function isPhpDateFormat($date_format)
{
// We can't really check if this is valid or not, because this is a string and you can write whatever you want in it. That's why only < et > are forbidden (HTML)
return preg_match('/^[^<>]+$/', $date_format);
}
/**
* Check for date format
*

View File

@@ -237,13 +237,15 @@ class CartControllerCore extends FrontController
if (Tools::getIsset('summary'))
{
$result = array();
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
{
$groups = (Validate::isLoadedObject($this->context->customer)) ? $this->context->customer->getGroups() : array(1);
if ($this->context->cart->id_address_delivery)
$deliveryAddress = new Address($this->context->cart->id_address_delivery);
$id_country = (isset($deliveryAddress) && $deliveryAddress->id) ? $deliveryAddress->id_country : Configuration::get('PS_COUNTRY_DEFAULT');
$result = array('carriers' => Carrier::getCarriersForOrder(Country::getIdZone($id_country), $groups));
$result['carriers'] = Carrier::getCarriersForOrder(Country::getIdZone($id_country), $groups);
$result['checked'] = Carrier::getDefaultCarrierSelection($result['carriers'], (int)$this->cart->id_carrier);
}
$result['summary'] = $this->context->cart->getSummaryDetails();
$result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);

View File

@@ -46,11 +46,11 @@ class ParentOrderControllerCore extends FrontController
public function init()
{
parent::init();
/* Disable some cache related bugs on the cart/order */
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$this->nbProducts = $this->context->cart->nbProducts();
global $isVirtualCart;
@@ -131,7 +131,7 @@ class ParentOrderControllerCore extends FrontController
public function setMedia()
{
parent::setMedia();
// Adding CSS style sheet
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
// Adding JS files
@@ -462,27 +462,10 @@ class ParentOrderControllerCore extends FrontController
*/
protected function _setDefaultCarrierSelection($carriers)
{
if (count($carriers))
{
$defaultCarrierIsPresent = false;
if ((int)self::$cart->id_carrier != 0)
foreach ($carriers as $carrier)
if ($carrier['id_carrier'] == (int)self::$cart->id_carrier)
$defaultCarrierIsPresent = true;
if (!$defaultCarrierIsPresent)
foreach ($carriers as $carrier)
if ($carrier['id_carrier'] == (int)Configuration::get('PS_CARRIER_DEFAULT'))
{
$defaultCarrierIsPresent = true;
self::$cart->id_carrier = (int)$carrier['id_carrier'];
}
if (!$defaultCarrierIsPresent)
self::$cart->id_carrier = (int)$carriers[0]['id_carrier'];
}
else
self::$cart->id_carrier = 0;
if (self::$cart->update())
return self::$cart->id_carrier;
$this->cart->id_carrier = Carrier::getDefaultCarrierSelection($carriers, (int)$this->cart->id_carrier);
if ($this->cart->update())
return $this->cart->id_carrier;
return 0;
}

View File

@@ -816,6 +816,8 @@ CREATE TABLE `PREFIX_lang` (
`active` tinyint(3) unsigned NOT NULL default '0',
`iso_code` char(2) NOT NULL,
`language_code` char(5) NOT NULL,
`date_format_lite` char(32) NOT NULL DEFAULT 'Y-m-d',
`date_format_full` char(32) NOT NULL DEFAULT 'Y-m-d H:i:s',
`is_rtl` TINYINT(1) NOT NULL default '0',
PRIMARY KEY (`id_lang`),
KEY `lang_iso_code` (`iso_code`)

View File

@@ -246,8 +246,12 @@ INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`,
(74, 4, 'Lieber Kunde,\r\n\r\nMit freundlichen Grüßen,\r\nIhr Kundenservice', NOW()),
(74, 5, 'Gentile Cliente,\r\n\r\nCordiali saluti,\r\nServizio Clienti', NOW());
INSERT INTO `PREFIX_lang` (`id_lang`, `name`, `active`, `iso_code`, `language_code`) VALUES
(1, 'English (English)', 1, 'en', 'en-us'),(2, 'Français (French)', 1, 'fr', 'fr'),(3, 'Español (Spanish)', 1, 'es', 'es'),(4, 'Deutsch (German)', 1, 'de', 'de'),(5, 'Italiano (Italian)', 1, 'it', 'it');
INSERT INTO `PREFIX_lang` (`id_lang`, `name`, `active`, `iso_code`, `language_code`, `date_format_lite`, `date_format_full`) VALUES
(1, 'English (English)', 1, 'en', 'en-us', 'm/j/Y', 'm/j/Y H:i:s'),
(2, 'Français (French)', 1, 'fr', 'fr', 'd/m/Y', 'd/m/Y H:i:s'),
(3, 'Español (Spanish)', 1, 'es', 'es', 'd/m/Y', 'd/m/Y H:i:s'),
(4, 'Deutsch (German)', 1, 'de', 'de', 'd.m.Y', 'd.m.Y H:i:s'),
(5, 'Italiano (Italian)', 1, 'it', 'it', 'd/m/Y', 'd/m/Y H:i:s');
INSERT INTO `PREFIX_lang_shop` (`id_lang`, `id_shop`) VALUES (1,1), (2,1), (3,1), (4,1), (5,1);
@@ -352,7 +356,7 @@ INSERT INTO `PREFIX_country` (`id_country`, `id_zone`, `iso_code`, `call_prefix`
(104, 6, 'GY', 592, 1, 0, 0, 1, '', 1),(105, 8, 'HT', 509, 1, 0, 0, 1, '', 1),(106, 5, 'HM', 0, 1, 0, 0, 1, '', 1),(107, 7, 'VA', 379, 1, 0, 0, 1, 'NNNNN', 1),(108, 8, 'HN', 504, 1, 0, 0, 1, '', 1),
(109, 7, 'IS', 354, 1, 0, 0, 1, 'NNN', 1),(110, 3, 'IN', 91, 1, 0, 0, 1, 'NNN NNN', 1),(111, 3, 'ID', 62, 1, 1, 0, 1, 'NNNNN', 1),(112, 3, 'IR', 98, 1, 0, 0, 1, 'NNNNN-NNNNN', 1),
(113, 3, 'IQ', 964, 1, 0, 0, 1, 'NNNNN', 1),(114, 7, 'IM', 0, 1, 0, 0, 1, 'CN NLL', 1),(115, 8, 'JM', 0, 1, 0, 0, 1, '', 1),(116, 7, 'JE', 0, 1, 0, 0, 1, 'CN NLL', 1),(117, 3, 'JO', 962, 1, 0, 0, 1, '', 1),
(118, 3, 'KZ', 7, 1, 0, 0, 1, 'NNNNNN', 1),(119, 4, 'KE', 254, 1, 0, 0, 1, '', 1),(120, 7, 'KI', 686, 1, 0, 0, 1, '', 1),(121, 3, 'KP', 850, 1, 0, 0, 1, '', 1),(122, 3, 'KW', 965, 1, 0, 0, 1, '', 1),
(118, 3, 'KZ', 7, 1, 0, 0, 1, 'NNNNNN', 1),(119, 4, 'KE', 254, 1, 0, 0, 1, '', 1),(120, 5, 'KI', 686, 1, 0, 0, 1, '', 1),(121, 3, 'KP', 850, 1, 0, 0, 1, '', 1),(122, 3, 'KW', 965, 1, 0, 0, 1, '', 1),
(123, 3, 'KG', 996, 1, 0, 0, 1, '', 1),(124, 3, 'LA', 856, 1, 0, 0, 1, '', 1),(125, 1, 'LV', 371, 1, 0, 0, 1, 'C-NNNN', 1),(126, 3, 'LB', 961, 1, 0, 0, 1, '', 1),(127, 4, 'LS', 266, 1, 0, 0, 1, '', 1),
(128, 4, 'LR', 231, 1, 0, 0, 1, '', 1),(129, 4, 'LY', 218, 1, 0, 0, 1, '', 1),(130, 1, 'LI', 423, 1, 0, 0, 1, 'NNNN', 1),(131, 1, 'LT', 370, 1, 0, 0, 1, 'NNNNN', 1),(132, 3, 'MO', 853, 1, 0, 0, 0, '', 1),
(133, 7, 'MK', 389, 1, 0, 0, 1, '', 1),(134, 4, 'MG', 261, 1, 0, 0, 1, '', 1),(135, 4, 'MW', 265, 1, 0, 0, 1, '', 1),(136, 3, 'MY', 60, 1, 0, 0, 1, 'NNNNN', 1),(137, 3, 'MV', 960, 1, 0, 0, 1, '', 1),
@@ -841,7 +845,7 @@ INSERT INTO `PREFIX_tab` (`id_tab`, `class_name`, `id_parent`, `position`) VALUE
(38, 'AdminThemes', 8, 2),(56, 'AdminMeta', 8, 3),(27, 'AdminPPreferences', 8, 4),(24, 'AdminEmails', 8, 5),(26, 'AdminImages', 8, 6),(23, 'AdminDb', 8, 7),
(48, 'AdminPDF', 3, 8),(44, 'AdminLocalization', 8, 9),(67, 'AdminSearchConf', 8, 10),(32, 'AdminLanguages', 9, 1),(33, 'AdminTranslations', 9, 2),
(35, 'AdminTabs', 29, 3),(37, 'AdminQuickAccesses', 9, 4),(40, 'AdminAliases', 8, 5),(41, 'AdminImport', 9, 6),(52, 'AdminSubDomains', 9, 7),
(53, 'AdminBackup', 9, 8),(57, 'AdminCMSContent', 9, 9),(64, 'AdminGenerator', 9, 10),(43, 'AdminSearch', -1, 0),(69, 'AdminInformation', 9, 11),
(53, 'AdminBackup', 9, 8),(57, 'AdminCMSContent', 9, 9),(64, 'AdminGenerator', 9, 10),(43, 'AdminSearch', -1, 0),(69, 'AdminInformation', 9, 5),
(70, 'AdminPerformance', 8, 11),(71, 'AdminCustomerThreads', 29, 4),(72, 'AdminWebservice', 9, 12),(73, 'AdminStockMvt', 1, 9),
(80, 'AdminAddonsCatalog', 7, 1),(81, 'AdminAddonsMyAccount', 7, 2),(83, 'AdminThemes', 7, 3),(84, 'AdminGeolocation', 8, 12),
(85, 'AdminTaxRulesGroup', 4, 3),(86, 'AdminLogs', 9, 13), (87,'AdminHome',-1,0),
@@ -862,7 +866,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(1, 61, 'Search Engines'),(1, 62, 'Referrers'),(1, 63, 'Groups'),(1, 64, 'Generators'),(1, 65, 'Shopping Carts'),(1, 66, 'Tags'),(1, 67, 'Search'),
(1, 68, 'Attachments'),(1, 69, 'Configuration Information'),(1, 70, 'Performance'),(1, 71, 'Customer Service'),(1, 72, 'Webservice'),(1, 73, 'Stock Movements'),
(1, 80, 'Modules & Themes Catalog'),(1, 81, 'My Account'),(1, 82, 'Stores'),(1, 83, 'Themes'),(1, 84, 'Geolocation'),(1, 85, 'Tax Rules'),(1, 86, 'Log'),
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders'),(1, 92, 'SQL Manager');
(1, 87, 'Home'), (1, 88, 'Shops'), (1, 89, 'Group Shops'), (1, 90, 'Shop Urls'),(1, 91, 'Genders'),(1, 92, 'SQL Manager'),(1, 93, 'County');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 1, 'Catalogue'),(2, 2, 'Clients'),(2, 3, 'Commandes'),(2, 4, 'Paiement'),(2, 5, 'Transport'),
@@ -877,7 +881,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(2, 62, 'Sites affluents'),(2, 63, 'Groupes'),(2, 64, 'Générateurs'),(2, 65, 'Paniers'),(2, 66, 'Tags'),(2, 67, 'Recherche'),
(2, 68, 'Documents joints'),(2, 69, 'Informations'),(2, 70, 'Performances'),(2, 71, 'SAV'),(2, 72, 'Service web'),(2, 73, 'Mouvements de Stock'),
(2, 80, 'Catalogue de modules et thèmes'),(2, 81, 'Mon compte'),(2, 82, 'Magasins'),(2, 83, 'Thèmes'),(2, 84, 'Géolocalisation'),(2, 85, 'Règles de taxes'),(2, 86, 'Log'),
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres'),(2, 92, 'SQL Manager');
(2, 87,'Accueil'), (2, 88, 'Boutiques'), (2, 89, 'Groupes de boutique'), (2, 90, 'URLs de boutique'),(2, 91, 'Genres'),(2, 92, 'SQL Manager'),(2, 93, 'Comtés');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 1, 'Catálogo'),(3, 2, 'Clientes'),(3, 3, 'Pedidos'),(3, 4, 'Pago'),(3, 5, 'Transporte'),
@@ -891,7 +895,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(3, 55, 'Albaranes de entrega'),(3, 56, 'SEO & URLs'),(3, 57, 'CMS'),(3, 58, 'Mapeo de la imagen'),(3, 59, 'Mensajes del cliente'),(3, 60, 'Rastreo'),
(3, 61, 'Motores de búsqueda'),(3, 62, 'Referido'),(3, 63, 'Grupos'),(3, 64, 'Generadores'),(3, 65, 'Carritos'),(3, 66, 'Etiquetas'),(3, 67, 'Búsqueda'),(3, 68, 'Adjuntos'),
(3, 69, 'Informaciones'),(3, 70, 'Rendimiento'),(3, 72, 'Web service'),(3, 71, 'Servicio al cliente'),(3, 73, 'Movimiento de Stock'), (3, 82, 'Tiendas'),(3, 83, 'Temas'),(3, 84, 'Geolocalización'),(3, 85, 'Reglas de Impuestos'),(3, 86, 'Log'),
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders'),(3, 92, 'SQL Manager');
(3, 87,'Home'), (3, 88, 'Shops'), (3, 89, 'Group Shops'), (3, 90, 'Shop Urls'),(3, 91, 'Genders'),(3, 92, 'SQL Manager'),(3, 93, 'Condados');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 1, 'Katalog'),(4, 2, 'Kunden'),(4, 3, 'Bestellungen'),(4, 4, 'Zahlung'),
@@ -906,7 +910,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(4, 61, 'Suchmaschinen'),(4, 62, 'Referrer'),(4, 63, 'Gruppen'),(4, 64, 'Generatoren'),(4, 65, 'Warenkörbe'),(4, 66, 'Tags'),(4, 67, 'Suche'),
(4, 68, 'Anhänge'),(4, 69, 'Konfigurationsinformationen'),(4, 70, 'Leistung'),(4, 71, 'Kundenservice'),(4, 72, 'Webservice'),(4, 73, 'Lagerbewegungen'),
(4, 80, 'Module und Themenkatalog'),(4, 81, 'Mein Konto'),(4, 82, 'Shops'),(4, 83, 'Themen'),(4, 84, 'Geotargeting'),(4, 85, 'Steuerregeln'),(4, 86, 'Log'),
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'SQL Manager');
(4, 87,'Home'), (4, 88, 'Shops'), (4, 89, 'Group Shops'), (4, 90, 'Shop Urls'),(4, 91, 'Genders'),(4, 92, 'SQL Manager'),(4, 93, 'County');
INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 1, 'Catalogo'),(5, 2, 'Clienti'),(5, 3, 'Ordini'),(5, 4, 'Pagamento'),
@@ -921,7 +925,7 @@ INSERT INTO `PREFIX_tab_lang` (`id_lang`, `id_tab`, `name`) VALUES
(5, 61, 'Motori di ricerca'),(5, 62, 'Referenti'),(5, 63, 'Gruppi'),(5, 64, 'Generatori'),(5, 65, 'Carrelli shopping'),(5, 66, 'Tag'),(5, 67, 'Cerca'),
(5, 68, 'Allegati'),(5, 69, 'Informazioni di configurazione'),(5, 70, 'Performance'),(5, 71, 'Servizio clienti'),(5, 72, 'Webservice'),(5, 73, 'Movimenti magazzino'),
(5, 80, 'Moduli & Temi catalogo'),(5, 81, 'Il mio Account'),(5, 82, 'Negozi'),(5, 83, 'Temi'),(5, 84, 'Geolocalizzazione'),(5, 85, 'Regimi fiscali'),(5, 86, 'Log'),
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders'),(5, 92, 'SQL Manager');
(5, 87,'Home'), (5, 88, 'Shops'), (5, 89, 'Group Shops'), (5, 90, 'Shop Urls'),(5, 91, 'Genders'),(5, 92, 'SQL Manager'),(5, 93, 'County');
INSERT IGNORE INTO `PREFIX_tab_lang` (`id_tab`, `id_lang`, `name`)
(SELECT `id_tab`, id_lang, (SELECT tl.`name`

View File

@@ -37,3 +37,14 @@ INSERT INTO `PREFIX_hook` (`name`, `title`, `description`, `position`, `live_edi
('afterSaveAttribute', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0);
ALTER TABLE `PREFIX_employee` ADD `bo_show_screencast` TINYINT(1) NOT NULL DEFAULT '1' AFTER `bo_uimode`;
UPDATE `PREFIX_country` SET id_zone = (SELECT id_zone FROM `PREFIX_zone` WHERE name = 'Oceania') WHERE iso_code = 'KI' LIMIT 1
ALTER TABLE `PREFIX_lang` ADD `date_format_lite` char(32) NOT NULL DEFAULT 'Y-m-d' AFTER language_code;
ALTER TABLE `PREFIX_lang` ADD `date_format_full` char(32) NOT NULL DEFAULT 'Y-m-d H:i:s' AFTER date_format_lite;
UPDATE `PREFIX_lang` SET `date_format_lite` = 'd/m/Y' WHERE `iso_code` IN ('fr', 'es', 'it');
UPDATE `PREFIX_lang` SET `date_format_full` = 'd/m/Y H:i:s' WHERE `iso_code` IN ('fr', 'es', 'it');
UPDATE `PREFIX_lang` SET `date_format_lite` = 'd.m.Y' WHERE `iso_code` = 'de';
UPDATE `PREFIX_lang` SET `date_format_full` = 'd.m.Y H:i:s' WHERE `iso_code` = 'de';
UPDATE `PREFIX_lang` SET `date_format_lite` = 'm/d/Y' WHERE `iso_code` = 'en';
UPDATE `PREFIX_lang` SET `date_format_full` = 'm/d/Y H:i:s' WHERE `iso_code` = 'en';

View File

@@ -638,7 +638,7 @@ ul#optional {
.blockInfoEnd a.BO,
.blockInfoEnd a.FO {
float:right;
padding:0 0 0 12px;
padding:0 0 0 10px;
height:33px;
line-height:33px;
color:#fff;

View File

@@ -126,6 +126,16 @@ function getHookableList() {
dataType: 'json',
data: 'ajax=true&getHookableList&hooks_list=' + hooks_list + '&modules_list=' + modules_list + '&id_shop=' + get('id_shop'),
success: function(jsonData) {
if (jsonData.hasError)
{
var errors = '';
for(error in jsonData.errors)
//IE6 bug fix
if(error != 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
}
else
hookable_list = jsonData;
},
error: function(XMLHttpRequest, textStatus, errorThrown) {

View File

@@ -2139,6 +2139,72 @@ FileETag INode MTime Size
{
$smarty->clearAllCache();
}
/**
* getMemoryLimit allow to get the memory limit in octet
*
* @since 1.4.5.0
* @return int the memory limit value in octet
*/
public static function getMemoryLimit()
{
$memory_limit = @ini_get('memory_limit');
if (preg_match('/[0-9]+k/i', $memory_limit))
return 1024 * (int)$memory_limit;
if (preg_match('/[0-9]+m/i', $memory_limit))
return 1024 * 1024 * (int)$memory_limit;
if (preg_match('/[0-9]+g/i', $memory_limit))
return 1024 * 1024 * 1024 * (int)$memory_limit;
return $memory_limit;
}
public static function isX86_64arch()
{
return (PHP_INT_MAX == '9223372036854775807');
}
/**
* apacheModExists return true if the apache module $name is loaded
* @TODO move this method in class Information (when it will exist)
*
* @param string $name module name
* @return boolean true if exists
* @since 1.4.5.0
*/
public static function apacheModExists($name)
{
if(function_exists('apache_get_modules'))
{
static $apacheModuleList = null;
if (!is_array($apacheModuleList))
$apacheModuleList = apache_get_modules();
// we need strpos (example can be evasive20
foreach($apacheModuleList as $module)
{
if (strpos($module, $name)!==false)
return true;
}
}
else{
// If apache_get_modules does not exists,
// one solution should be parsing httpd.conf,
// but we could simple parse phpinfo(INFO_MODULES) return string
ob_start();
phpinfo(INFO_MODULES);
$phpinfo = ob_get_contents();
ob_end_clean();
if (strpos($phpinfo, $module) !== false)
return true;
}
return false;
}
}
}

View File

@@ -154,6 +154,14 @@ class Hipay extends PaymentModule
return $id_currency;
}
private function formatLanguageCode($language_code)
{
$languageCodeArray = preg_split('/-|_/', $language_code);
if (!isset($languageCodeArray[1]))
$languageCodeArray[1] = $languageCodeArray[0];
return strtoupper($languageCodeArray[0]).'_'.strtolower($languageCodeArray[1]);
}
public function payment()
{
$id_currency = (int)$this->getModuleCurrency($this->context->cart);
@@ -178,7 +186,11 @@ class Hipay extends PaymentModule
$paymentParams = new HIPAY_MAPI_PaymentParams();
$paymentParams->setLogin($hipayAccount, $hipayPassword);
$paymentParams->setAccounts($hipayAccount, $hipayAccount);
$paymentParams->setDefaultLang(strtolower($language->iso_code).'_'.strtoupper($language->iso_code));
// EN_us is not a standard format, but that's what Hipay uses
if (isset($language->language_code))
$paymentParams->setDefaultLang($this->formatLanguageCode($language->language_code));
else
$paymentParams->setDefaultLang(strtoupper($language->iso_code).'_'.strtolower($language->iso_code));
$paymentParams->setMedia('WEB');
$paymentParams->setRating(Configuration::get('HIPAY_RATING'));
$paymentParams->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);

View File

@@ -126,6 +126,11 @@ class MRGetRelayPoint implements IMondialRelayWSMethod
foreach($this->_fields['list'] as $paramName => &$valueDetailed)
if ($paramName != 'Texte' && $paramName != 'Security')
{
// Mac server make an empty string instead of a cleaned string
// TODO : test on windows and linux server
$cleanedString = MRTools::replaceAccentedCharacters($valueDetailed['value']);
$valueDetailed['value'] = !empty($cleanedString) ? strtoupper($cleanedString) : strtoupper($valueDetailed['value']);
$valueDetailed['value'] = strtoupper($valueDetailed['value']);
// Call a pointer function if exist to do different test
if (isset($valueDetailed['methodValidation']) &&

View File

@@ -2,7 +2,7 @@
<module>
<name>mondialrelay</name>
<displayName><![CDATA[Mondial Relay]]></displayName>
<version><![CDATA[1.7.4]]></version>
<version><![CDATA[1.7.5]]></version>
<description><![CDATA[Deliver in Relay points]]></description>
<author><![CDATA[]]></author>
<tab><![CDATA[shipping_logistics]]></tab>

View File

@@ -109,6 +109,7 @@ $_MODULE['<{mondialrelay}prestashop>mondialrelay_61e70b58e38fd01daa254f44c4fa264
$_MODULE['<{mondialrelay}prestashop>mondialrelay_bba366864d25056c941b72f18ef79e7c'] = 'Cette erreur n\'est pas mentionnée:';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_e0626222614bdee31951d84c64e5e9ff'] = 'Choisir';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_91b442d385b54e1418d81adc34871053'] = 'Sélectionné';
$_MODULE['<{mondialrelay}prestashop>mondialrelay_ef2a1f426c2c289ed5986c7636a5d696'] = 'Merci de choisir un point relay';
$_MODULE['<{mondialrelay}prestashop>orderdetail_81b7b4587a2a3ea7a0d6bb1df3fbba54'] = 'Livraison à';
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_a1c3470a944b9625cfb924fd15c8bdbf'] = 'Veuillez choisir au moins une commande';
$_MODULE['<{mondialrelay}prestashop>mrcreatetickets_dc41aac14af17f1d19fca5e3b9439e74'] = 'Cette clé';

View File

@@ -59,7 +59,7 @@ class MondialRelay extends Module
{
$this->name = 'mondialrelay';
$this->tab = 'shipping_logistics';
$this->version = '1.7.4';
$this->version = '1.7.5';
parent::__construct();

View File

@@ -2,7 +2,7 @@
<module>
<name>paypal</name>
<displayName><![CDATA[PayPal]]></displayName>
<version><![CDATA[2.8.1]]></version>
<version><![CDATA[2.8.2]]></version>
<description><![CDATA[Accepts payments by credit cards (CB, Visa, MasterCard, Amex, Aurore, Cofinoga, 4 stars) with PayPal.]]></description>
<author><![CDATA[]]></author>
<tab><![CDATA[payments_gateways]]></tab>

View File

@@ -40,7 +40,7 @@ class PayPal extends PaymentModule
{
$this->name = 'paypal';
$this->tab = 'payments_gateways';
$this->version = '2.8.1';
$this->version = '2.8.2';
$this->currencies = true;
$this->currencies_mode = 'radio';
@@ -59,11 +59,16 @@ class PayPal extends PaymentModule
$this->warning = $this->l('All features of Paypal API module are be include in the new Paypal module. In order to don\'t have any conflict, please don\'t use and remove PayPalAPI module.');
/* For 1.4.3 and less compatibility */
$updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT');
if (!Configuration::get('PS_OS_PAYMENT'))
foreach ($updateConfig as $u)
if (!Configuration::get($u) && defined('_'.$u.'_'))
$updateConfig = array('PS_OS_CHEQUE' => 1, 'PS_OS_PAYMENT' => 2, 'PS_OS_PREPARATION' => 3, 'PS_OS_SHIPPING' => 4, 'PS_OS_DELIVERED' => 5, 'PS_OS_CANCELED' => 6,
'PS_OS_REFUND' => 7, 'PS_OS_ERROR' => 8, 'PS_OS_OUTOFSTOCK' => 9, 'PS_OS_BANKWIRE' => 10, 'PS_OS_PAYPAL' => 11, 'PS_OS_WS_PAYMENT' => 12);
foreach ($updateConfig as $u => $v)
if (!Configuration::get($u) || (int)Configuration::get($u) < 1)
{
if (defined('_'.$u.'_') && (int)constant('_'.$u.'_') > 0)
Configuration::updateValue($u, constant('_'.$u.'_'));
else
Configuration::updateValue($u, $v);
}
/* Check preactivation warning */
if (Configuration::get('PS_PREACTIVATION_PAYPAL_WARNING'))

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -44,7 +44,7 @@ class ReferralProgram extends Module
$this->description = $this->l('Integrate a referral program system into your shop.');
if (Configuration::get('REFERRAL_DISCOUNT_TYPE') == 1 AND !Configuration::get('REFERRAL_PERCENTAGE'))
$this->warning = $this->l('Please specify an amount for referral program vouchers.');
if ($this->id)
{
$this->_configuration = Configuration::getMultiple(array('REFERRAL_NB_FRIENDS', 'REFERRAL_ORDER_QUANTITY', 'REFERRAL_DISCOUNT_TYPE', 'REFERRAL_DISCOUNT_VALUE'));
@@ -68,11 +68,11 @@ class ReferralProgram extends Module
OR !$this->registerHook('adminCustomers') OR !$this->registerHook('createAccount')
OR !$this->registerHook('createAccountForm') OR !$this->registerHook('customerAccount'))
return false;
/* Define a default value for fixed amount vouchers, for each currency */
foreach (Currency::getCurrencies() AS $currency)
Configuration::updateValue('REFERRAL_DISCOUNT_VALUE_'.(int)($currency['id_currency']), 5);
/* Define a default value for the percentage vouchers */
Configuration::updateValue('REFERRAL_PERCENTAGE', 5);
@@ -107,7 +107,7 @@ class ReferralProgram extends Module
foreach (Currency::getCurrencies() AS $currency)
$result = $result AND Configuration::deleteByName('REFERRAL_DISCOUNT_VALUE_'.(int)($currency['id_currency']));
if (!parent::uninstall() OR !$this->uninstallDB() OR !$this->removeMail() OR !$result
OR !Configuration::deleteByName('REFERRAL_PERCENTAGE') OR !Configuration::deleteByName('REFERRAL_ORDER_QUANTITY')
OR !Configuration::deleteByName('REFERRAL_PERCENTAGE') OR !Configuration::deleteByName('REFERRAL_ORDER_QUANTITY')
OR !Configuration::deleteByName('REFERRAL_DISCOUNT_TYPE') OR !Configuration::deleteByName('REFERRAL_NB_FRIENDS')
OR !Configuration::deleteByName('REFERRAL_DISCOUNT_DESCRIPTION'))
return false;
@@ -273,7 +273,7 @@ class ReferralProgram extends Module
<td>'.(Configuration::get('PS_CURRENCY_DEFAULT') == $currency['id_currency'] ? '<span style="font-weight: bold;">' : '').htmlentities($currency['name'], ENT_NOQUOTES, 'utf-8').(Configuration::get('PS_CURRENCY_DEFAULT') == $currency['id_currency'] ? '<span style="font-weight: bold;">' : '').'</td>
<td><input type="text" name="discount_value['.(int)($currency['id_currency']).']" id="discount_value['.(int)($currency['id_currency']).']" value="'.Tools::safeOutput(Tools::getValue('discount_value['.(int)($currency['id_currency']).']', Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)($currency['id_currency'])))).'" style="width: 50px; text-align: right;" /> '.$currency['sign'].'</td>
</tr>';
$this->_html .= '
</table>
<p>
@@ -312,7 +312,7 @@ class ReferralProgram extends Module
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
$this->_html .= '
<script type="text/javascript">
<script type="text/javascript">
var iso = \''.$isoTinyMCE.'\' ;
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
var ad = \''.$ad.'\' ;
@@ -346,7 +346,7 @@ class ReferralProgram extends Module
public function hookShoppingCart($params)
{
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
if (!isset($params['cart']->id_customer))
return false;
if (!($id_referralprogram = ReferralProgramModule::isSponsorised((int)($params['cart']->id_customer), true)))
@@ -357,7 +357,7 @@ class ReferralProgram extends Module
$discount = new Discount($referralprogram->id_discount);
if (!Validate::isLoadedObject($discount))
return false;
if ($params['cart']->checkDiscountValidity($discount, $params['cart']->getDiscounts(), $params['cart']->getOrderTotal(true, Cart::ONLY_PRODUCTS), $params['cart']->getProducts(), false, $this->context) === false)
{
$this->context->smarty->assign(array('discount_display' => Discount::display($discount->value, $discount->id_discount_type, new Currency($params['cookie']->id_currency)), 'discount' => $discount));
@@ -374,7 +374,7 @@ class ReferralProgram extends Module
{
return $this->display(__FILE__, 'my-account.tpl');
}
public function hookMyAccountBlock($params)
{
return $this->hookCustomerAccount($params);
@@ -387,7 +387,7 @@ class ReferralProgram extends Module
public function hookCreateAccountForm($params)
{
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
if (Configuration::get('PS_CIPHER_ALGORITHM'))
$cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
else
@@ -427,7 +427,7 @@ class ReferralProgram extends Module
$sponsorEmail = $postVars['referralprogram'];
if (!Validate::isEmail($sponsorEmail) OR $sponsorEmail == $newCustomer->email)
return false;
$sponsor = new Customer();
if ($sponsor = $sponsor->getByEmail($sponsorEmail, NULL, $this->context))
{
@@ -458,9 +458,25 @@ class ReferralProgram extends Module
$discount = new Discount((int)$referralprogram->id_discount);
if (Validate::isLoadedObject($discount))
{
$data = array('{firstname}' => $newCustomer->firstname, '{lastname}' => $newCustomer->lastname, '{voucher_num}' => $discount->name,
'{voucher_amount}' => Tools::displayPrice((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)$this->context->currency->id), (int)Configuration::get('PS_CURRENCY_DEFAULT')));
Mail::Send($this->context->language->id, 'referralprogram-voucher', Mail::l('Congratulations!'), $data, $newCustomer->email, $newCustomer->firstname.' '.$newCustomer->lastname, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
$data = array(
'{firstname}' => $newCustomer->firstname,
'{lastname}' => $newCustomer->lastname,
'{voucher_num}' => $discount->name,
'{voucher_amount}' => (Configuration::get('REFERRAL_DISCOUNT_TYPE') == 2 ? Tools::displayPrice((float)Configuration::get('REFERRAL_DISCOUNT_VALUE_'.(int)$this->context->currency->id), (int)Configuration::get('PS_CURRENCY_DEFAULT')) : (float)Configuration::get('REFERRAL_PERCENTAGE').'%'));
Mail::Send(
(int)$cookie->id_lang,
'referralprogram-voucher',
Mail::l('Congratulations!'),
$data,
$newCustomer->email,
$newCustomer->firstname.' '.$newCustomer->lastname,
strval(Configuration::get('PS_SHOP_EMAIL')),
strval(Configuration::get('PS_SHOP_NAME')),
null,
null,
dirname(__FILE__).'/mails/'
);
}
}
return true;
@@ -476,7 +492,7 @@ class ReferralProgram extends Module
public function hookAdminCustomers($params)
{
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
$customer = new Customer((int)$params['id_customer']);
if (!Validate::isLoadedObject($customer))
die (Tools::displayError('Incorrect object Customer.'));
@@ -539,7 +555,7 @@ class ReferralProgram extends Module
return die(Tools::displayError('Incorrect object Order.'));
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
$customer = new Customer((int)$params['objOrder']->id_customer);
$stats = $customer->getStats();
$nbOrdersCustomer = (int)$stats['nb_orders'] + 1; // hack to count current order
@@ -570,9 +586,9 @@ class ReferralProgram extends Module
$order = new Order((int)($params['id_order']));
if ($order AND !Validate::isLoadedObject($order))
die(Tools::displayError('Incorrect object Order.'));
include_once(dirname(__FILE__).'/ReferralProgramModule.php');
$customer = new Customer((int)$order->id_customer);
$stats = $customer->getStats();
$nbOrdersCustomer = (int)$stats['nb_orders'] + 1; // hack to count current order

View File

@@ -0,0 +1,65 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{capture name=path}{l s='Send to a friend' mod='sendtoafriend'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
<h1>{l s='Send to a friend' mod='sendtoafriend'}</h1>
<p class="bold">{l s='Send this page to a friend who might be interested in the item below.' mod='sendtoafriend'}.</p>
{include file="$tpl_dir./errors.tpl"}
{if isset($smarty.get.submited)}
<p class="success">{l s='Your email has been sent successfully' mod='sendtoafriend'}</p>
{else}
<form method="post" action="{$request_uri}" class="std">
<fieldset>
<h3>{l s='Send a message' mod='sendtoafriend'}</h3>
<p class="align_center">
<a href="{$productLink}"><img src="{$link->getImageLink($product->link_rewrite, $cover.id_image, 'small')}" alt="" title="{$cover.legend|escape:'htmlall':'UTF-8'}" /></a><br/>
<a href="{$productLink}">{$product->name|escape:'htmlall':'UTF-8'}</a>
</p>
<p>
<label for="friend-name">{l s='Friend\'s name:' mod='sendtoafriend'}</label>
<input type="text" id="friend-name" name="name" value="{if isset($smarty.post.name)}{$smarty.post.name|escape:'htmlall':'UTF-8'|stripslashes}{/if}" />
</p>
<p>
<label for="friend-address">{l s='Friend\'s email:' mod='sendtoafriend'}</label>
<input type="text" id="friend-address" name="email" value="{if isset($smarty.post.name)}{$smarty.post.email|escape:'htmlall'|stripslashes}{/if}" />
</p>
<p class="submit">
<input type="submit" name="submitAddtoafriend" value="{l s='send' mod='sendtoafriend'}" class="button" />
</p>
</fieldset>
</form>
{/if}
<ul class="footer_links">
<li><a href="{$productLink}" class="button_large">{l s='Back to product page' mod='sendtoafriend'}</a></li>
</ul>

View File

@@ -1434,7 +1434,7 @@ class shopimporter extends ImportModule
$carrier = new Carrier((int)$item['id_carrier']);
$currency = new Currency($order->id_currency);
$order->conversion_rate = $currency->conversion_rate;
$order->conversion_rate = !empty($currency->conversion_rate) ? $currency->conversion_rate : 1;
$order->total_products = (float)$item['total_products'];
$order->total_products_wt = (float)$item['total_products_wt'];
$order->total_discounts = (float)$item['total_discounts'];

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -57,7 +57,7 @@ class StatsSearch extends ModuleGraph
$this->displayName = $this->l('Shop search');
$this->description = $this->l('Display which keywords have been searched by your visitors.');
}
function install()
{
if (!parent::install() OR !$this->registerHook('search') OR !$this->registerHook('AdminStatsModules'))
@@ -119,7 +119,7 @@ class StatsSearch extends ModuleGraph
</tr>';
}
$table .= '</tbody></table></div>';
if (sizeof($result))
$this->_html .= '<center>'.$this->engine(array('type' => 'pie')).'</center>
<p><a href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&export=1"><img src="../img/admin/asterisk.gif" />'.$this->l('CSV Export').'</a></p>

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>uspscarrier</name>
<displayName><![CDATA[U.S.P.S Rate Calulator]]></displayName>
<version><![CDATA[1.1]]></version>
<description><![CDATA[Offer your customers, different delivery methods with USPS]]></description>
<displayName><![CDATA[U.S.P.S. Rate Calulator]]></displayName>
<version><![CDATA[1.2]]></version>
<description><![CDATA[Calculates shipping rates for United States Postal Service for Domestic shipping within the USA.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[shipping_logistics]]></tab>
<is_configurable>1</is_configurable>

View File

@@ -0,0 +1 @@
deny from all

View File

@@ -0,0 +1,13 @@
<?php
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;
?>

View File

@@ -17,21 +17,15 @@
// Insert Service in database
$sql[] = "INSERT INTO `"._DB_PREFIX_."usps_rate_service_code` (`id_carrier`, `id_carrier_history`, `code`, `service`, `active`) VALUES
('0', '', 'FIRST CLASS', 'First Class', '0'),
('0', '', 'PRIORITY', 'Priority', '0'),
('0', '', 'PRIORITY COMMERCIAL', 'Priority Commercial', '0'),
('0', '', 'EXPRESS', 'Express', '0'),
('0', '', 'EXPRESS COMMERCIAL', 'Express Commercial', '0'),
('0', '', 'EXPRESS SH', 'Express SH', '0'),
('0', '', 'EXPRESS SH COMMERCIAL', 'Express SH Commercial', '0'),
('0', '', 'EXPRESS HFP', 'Express HFP', '0'),
('0', '', 'EXPRESS HFP COMMERCIAL', 'Express HFP Commercial', '0'),
('0', '', 'BPM', 'BPM', '0'),
('0', '', 'PARCEL', 'Parcel', '0'),
('0', '', 'MEDIA', 'Media', '0'),
('0', '', 'LIBRARY', 'Library', '0'),
('0', '', 'ALL', 'All', '0'),
('0', '', 'ONLINE', 'Online', '0');";
('0', '', 'FIRST CLASS', 'First-Class Mail (2-3 days)', '0'),
('0', '', 'FIRST CLASS COMMERCIAL', 'First-Class Mail (2-3 days)', '0'),
('0', '', 'PRIORITY', 'Priority Mail (1-3 days)', '0'),
('0', '', 'PRIORITY COMMERCIAL', 'Priority Mail (1-3 days)', '0'),
('0', '', 'EXPRESS', 'Express Mail (1-2 days)', '0'),
('0', '', 'EXPRESS COMMERCIAL', 'Express Mail (1-2 days)', '0'),
('0', '', 'PARCEL', 'Parcel Post (2-9 days)', '0'),
('0', '', 'MEDIA', 'Media Mail (2-9 days)', '0'),
('0', '', 'LIBRARY', 'Library Mail (2-9 days)', '0');";
// Create Cache Table in Database
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'usps_cache` (
@@ -82,4 +76,4 @@
PRIMARY KEY (`id_usps_rate_config_service`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';
?>

View File

@@ -34,7 +34,7 @@ class UspsCarrier extends CarrierModule
private $_html = '';
private $_postErrors = array();
private $_webserviceTestResult = '';
private $_webserviceTestResult = '';
private $_webserviceError = '';
private $_fieldsList = array();
private $_packagingSizeList = array();
@@ -47,18 +47,20 @@ class UspsCarrier extends CarrierModule
private $_weightUnitList = array('KG' => 'KGS', 'KGS' => 'KGS', 'LBS' => 'LBS', 'LB' => 'LBS');
private $_moduleName = 'uspscarrier';
private $debug = false;
public function __construct()
{
$this->name = 'uspscarrier';
$this->tab = 'shipping_logistics';
$this->version = '1.1';
$this->version = '1.2';
$this->author = 'PrestaShop';
$this->limited_countries = array('us');
parent::__construct ();
$this->displayName = $this->l('U.S.P.S Rate Calulator');
$this->description = $this->l('Offer your customers, different delivery methods with USPS');
$this->displayName = $this->l('U.S.P.S. Rate Calulator');
$this->description = $this->l('Calculates shipping rates for United States Postal Service for Domestic shipping within the USA.');
if (self::isInstalled($this->name))
{
@@ -67,14 +69,14 @@ class UspsCarrier extends CarrierModule
$this->loadingVar();
// Check Configuration Values
foreach ($this->_fieldsList as $keyConfiguration => $name)
if (!Configuration::get($keyConfiguration) && !empty($name))
$warning[] = '\''.$name.'\' ';
// Check calculation mode
if (!Configuration::get('USPS_CARRIER_CALCUL_MODE'))
Configuration::updateValue('USPS_CARRIER_CALCUL_MODE', 'split');
foreach ($this->_fieldsList as $keyConfiguration => $tab)
if (!Configuration::get($keyConfiguration) && isset($tab['name']))
{
if (isset($tab['default']))
Configuration::updateValue($keyConfiguration, $tab['default']);
else
$warning[] = '\''.$tab['name'].'\' ';
}
// Checking Unit
$this->_dimensionUnit = $this->_dimensionUnitList[strtoupper(Configuration::get('PS_DIMENSION_UNIT'))];
@@ -94,26 +96,20 @@ 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'),
'USPS_CARRIER_ADDRESS1' => '',
'USPS_CARRIER_ADDRESS2' => '',
'USPS_CARRIER_POSTAL_CODE' => '',
'USPS_CARRIER_CITY' => '',
'USPS_CARRIER_STATE' => '',
'USPS_CARRIER_COUNTRY' => '',
'USPS_CARRIER_CALCUL_MODE' => '',
'USPS_CARRIER_USER_ID' => array('name' => $this->l('USPS User ID')),
'USPS_CARRIER_POSTAL_CODE' => array('name' => $this->l('USPS Zip Code')),
'USPS_CARRIER_PACKAGING_WEIGHT' => array('name' => $this->l('Packaging weight'), 'default' => '0.00'),
'USPS_CARRIER_HANDLING_FEE' => array('name' => $this->l('Handling fee'), 'default' => '0.00'),
'USPS_CARRIER_PACKAGING_SIZE' => array('name' => $this->l('USPS Packaging Size'), 'default' => 'REGULAR'),
'USPS_CARRIER_PACKAGING_TYPE' => array('name' => $this->l('USPS Packaging Type'), 'default' => 'VARIABLE'),
'USPS_CARRIER_MACHINABLE' => array('name' => $this->l('USPS Machinable'), 'default' => 'False'),
'USPS_CARRIER_CALCULATION_MODE' => array('name' => $this->l('USPS Calculation Mode'), 'default' => 'split'),
);
// Loading packaging size list
$this->_packagingSizeList = array(
'REGULAR' => $this->l('Regular'),
'LARGE' => $this->l('Large'),
'OVERSIZE' => $this->l('Oversize')
'LARGE' => $this->l('Large')
);
// Loading packaging type list
@@ -217,7 +213,7 @@ class UspsCarrier extends CarrierModule
Db::getInstance()->autoExecute(_DB_PREFIX_.'usps_rate_service_code', array('id_carrier' => (int)($id_carrier), 'id_carrier_history' => (int)($id_carrier)), 'UPDATE', '`id_usps_rate_service_code` = '.(int)($rateService['id_usps_rate_service_code']));
}
}
public static function installExternalCarrier($config)
{
$carrier = new Carrier();
@@ -291,7 +287,7 @@ class UspsCarrier extends CarrierModule
public function getContent()
{
$this->_html .= '<h2>' . $this->l('USPS Carrier').'</h2>';
$this->_html .= '<h2>' . $this->l('U.S.P.S. Rate Calculator').'</h2>';
if (!empty($_POST) AND Tools::isSubmit('submitSave'))
{
$this->_postValidation();
@@ -321,12 +317,12 @@ class UspsCarrier extends CarrierModule
if (!count($alert))
$this->_html .= '<img src="'._PS_IMG_.'admin/module_install.png" /><strong>'.$this->l('USPS Carrier is configured and online!').'</strong>';
$this->_html .= '<img src="'._PS_IMG_.'admin/module_install.png" /><strong>'.$this->l('U.S.P.S. Rate Calculator is configured and online!').'</strong>';
else
{
$this->_html .= '<img src="'._PS_IMG_.'admin/warn2.png" /><strong>'.$this->l('USPS Carrier is not configured yet, you have to :').'</strong>';
$this->_html .= '<br />'.(isset($alert['generalSettings']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 1) '.$this->l('Fill the "General Settings" form');
$this->_html .= '<br />'.(isset($alert['deliveryServices']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 2) '.$this->l('Select your available delivery service');
$this->_html .= '<img src="'._PS_IMG_.'admin/warn2.png" /><strong>'.$this->l('U.S.P.S. Rate Calculator is not configured yet, you have to :').'</strong>';
$this->_html .= '<br />'.(isset($alert['generalSettings']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 1) '.$this->l('Fill in USPS User ID and Orignation Zip Code on the "General Settings" form');
$this->_html .= '<br />'.(isset($alert['deliveryServices']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 2) '.$this->l('Select your available Delivery Services');
$this->_html .= '<br />'.(isset($alert['webserviceTest']) ? '<img src="'._PS_IMG_.'admin/warn2.png" />' : '<img src="'._PS_IMG_.'admin/module_install.png" />').' 3) '.$this->l('Webservice test connection').($this->_webserviceError ? ' : '.$this->_webserviceError : '');
}
@@ -447,6 +443,20 @@ 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('Origination Zip Code').' : </label>
<div class="margin-form"><input type="text" size="20" name="usps_carrier_postal_code" value="'.Tools::getValue('usps_carrier_postal_code', Configuration::get('USPS_CARRIER_POSTAL_CODE')).'" /></div><br />
<label>'.$this->l('Delivery Services').' : </label>
<div class="margin-form">';
$rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'usps_rate_service_code`');
foreach($rateServiceList as $rateService)
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($rateService['active'] == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].' '.('COMMERCIAL' == substr($rateService['code'], -10) ? '['.$this->l('COMMERCIAL RATE').']' : '['.$this->l('REGULAR RATE').']').' '.($this->webserviceTest($rateService['code']) ? '('.$this->l('Available').')' : '('.$this->l('Not available').')').'<input type="hidden" name="service_validate['.$rateService['id_usps_rate_service_code'].']" value="'.$rateService['code'].'"><br />';
$html .= '<p>'.$this->l('Choose the Delivery Services you want to be available to your customers.').'<br />
'.$this->l('For First-Class, Priority and Express Mail you have the option of either COMMERCIAL RATE or REGULAR RATE.').'<br />
'.$this->l('-If you pay for postage either online or with a postage meter then choose COMMERCIAL RATE.').'<br />
'.$this->l('-If you pay for postage at the post office then choose REGULAR RATE.').'<br />
'.$this->l('-Choose only the COMMERCIAL RATE or the REGULAR RATE. Do not choose both.').'<br />
'.$this->l('For Parcel Post, Media Mail and Library Mail they will display as REGULAR RATE only since there is no difference in price.').'</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')).'" />
@@ -473,59 +483,11 @@ class UspsCarrier extends CarrierModule
</div>
</fieldset>
<fieldset style="border: 0px;">
<h4>'.$this->l('Address configuration').' :</h4>
<label>'.$this->l('Address (Line 1)').' : </label>
<div class="margin-form"><input type="text" size="20" name="usps_carrier_address1" value="'.Tools::getValue('usps_carrier_address1', Configuration::get('USPS_CARRIER_ADDRESS1')).'" /></div>
<label>'.$this->l('Address (Line 2)').' : </label>
<div class="margin-form"><input type="text" size="20" name="usps_carrier_address2" value="'.Tools::getValue('usps_carrier_address2', Configuration::get('USPS_CARRIER_ADDRESS2')).'" /></div>
<label>'.$this->l('Zip / Postal Code').' : </label>
<div class="margin-form"><input type="text" size="20" name="usps_carrier_postal_code" value="'.Tools::getValue('usps_carrier_postal_code', Configuration::get('USPS_CARRIER_POSTAL_CODE')).'" /></div><br />
<label>'.$this->l('City').' : </label>
<div class="margin-form"><input type="text" size="20" name="usps_carrier_city" value="'.Tools::getValue('usps_carrier_city', Configuration::get('USPS_CARRIER_CITY')).'" /></div>
<label>'.$this->l('Country').' : </label>
<div class="margin-form">
<select name="usps_carrier_country" id="usps_carrier_country">
<option value="0">'.$this->l('Select a country ...').'</option>';
$idcountries = array();
foreach (Country::getCountries($this->context->language->id) as $v)
{
$html .= '<option value="'.$v['id_country'].'" '.($v['id_country'] == (int)(Tools::getValue('usps_carrier_country', Configuration::get('USPS_CARRIER_COUNTRY'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>';
$idcountries[] = $v['id_country'];
}
$html .= '</select>
<p>' . $this->l('Select country from within the list.') . '</p>
</div>
<label>'.$this->l('State').' : </label>
<div class="margin-form">';
$id_country_current = 0;
$statesList = Db::getInstance()->ExecuteS('
SELECT `id_state`, `id_country`, `name`
FROM `'._DB_PREFIX_.'state` WHERE `active` = 1
ORDER BY `id_country`, `name` ASC');
foreach ($statesList as $v)
{
if ($id_country_current != $v['id_country'])
{
if ($id_country_current != 0)
$html .= '</select>';
$html .= '<select id="usps_carrier_state_'.$v['id_country'].'" class="stateInput">
<option value="0">'.$this->l('Select a state ...').'</option>';
}
$html .= '<option value="'.$v['id_state'].'" '.($v['id_state'] == (int)(Tools::getValue('usps_carrier_state', Configuration::get('USPS_CARRIER_STATE'))) ? 'selected="selected"' : '').'>'.$v['name'].'</option>';
$id_country_current = $v['id_country'];
}
$html .= '</select><div id="usps_carrier_state_none" class="stateInput selected">'.$this->l('There is no state configuration for this country').'</div>
<input type="hidden" id="usps_carrier_state" name="usps_carrier_state" value="s" />
</div>
</fieldset>
<fieldset style="border: 0px;">
<h4>'.$this->l('Service configuration').' :</h4>
<label>'.$this->l('Packaging Size').' : </label>
<div class="margin-form">
<select name="usps_carrier_packaging_size">
<option value="0">'.$this->l('Select a packaging size ...').'</option>';
<select name="usps_carrier_packaging_size">';
foreach($this->_packagingSizeList as $kpickup => $vpickup)
$html .= '<option value="'.$kpickup.'" '.($kpickup == (Tools::getValue('usps_carrier_packaging_size', Configuration::get('USPS_CARRIER_PACKAGING_SIZE'))) ? 'selected="selected"' : '').'>'.$vpickup.'</option>';
$html .= '</select>
@@ -533,8 +495,7 @@ class UspsCarrier extends CarrierModule
</div>
<label>'.$this->l('Packaging Type').' : </label>
<div class="margin-form">
<select name="usps_carrier_packaging_type">
<option value="0">'.$this->l('Select a packaging type ...').'</option>';
<select name="usps_carrier_packaging_type">';
foreach($this->_packagingTypeList as $kpackaging => $vpackaging)
$html .= '<option value="'.$kpackaging.'" '.($kpackaging == (Tools::getValue('usps_carrier_packaging_type', Configuration::get('USPS_CARRIER_PACKAGING_TYPE'))) ? 'selected="selected"' : '').'>'.$vpackaging.'</option>';
$html .= '</select>
@@ -549,26 +510,18 @@ class UspsCarrier extends CarrierModule
$html .= '</select>
<p>' . $this->l('Select if it is machinable or not by default.') . '</p>
</div>
<label>'.$this->l('Calculation mode').' : </label>
<label>'.$this->l('Calculation Mode').' : </label>
<div class="margin-form">
<select name="usps_carrier_calcul_mode">';
<select name="usps_carrier_calculation_mode">';
$idcalculmode = array();
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 .= '<option value="'.$kcalculmode.'" '.($kcalculmode == (Tools::getValue('usps_carrier_calculation_mode', Configuration::get('USPS_CARRIER_CALCULATION_MODE'))) ? 'selected="selected"' : '').'>'.$vcalculmode.'</option>';
$html .= '</select>
<p>' . $this->l('Using the calculation 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">';
$rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'usps_rate_service_code`');
foreach($rateServiceList as $rateService)
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($rateService['active'] == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].' '.($this->webserviceTest($rateService['code']) ? '('.$this->l('Available').')' : '('.$this->l('Not available').')').'<br />';
$html .= '
<p>' . $this->l('Choose the delivery service available to your customers.') . '</p>
<p>' . $this->l('Using Calculation Mode "All items in one package" will automatically use default packaging size, packaging type and delivery services. Specific configurations for categories or products won\'t be used.') . '</p>
</div>
</fieldset>
<div class="margin-form"><input class="button" name="submitSave" type="submit"></div>
<div class="margin-form"><input class="button" name="submitSave" type="submit" value="Configure"></div>
</form>
<script>
@@ -589,19 +542,58 @@ class UspsCarrier extends CarrierModule
{
// Check configuration values
if (Tools::getValue('usps_carrier_user_id') == NULL)
$this->_postErrors[] = $this->l('Your USPS user ID is not specified');
$this->_postErrors[] = $this->l('Your USPS User ID is not specified');
elseif (Tools::getValue('usps_carrier_postal_code') == NULL)
$this->_postErrors[] = $this->l('Your Zip / Postal code is not specified');
elseif (Tools::getValue('usps_carrier_city') == NULL)
$this->_postErrors[] = $this->l('Your city is not specified');
elseif (Tools::getValue('usps_carrier_country') == NULL OR Tools::getValue('usps_carrier_country') == 0)
$this->_postErrors[] = $this->l('Your country is not specified');
elseif (Tools::getValue('usps_carrier_packaging_size') == NULL OR Tools::getValue('usps_carrier_packaging_size') == '')
$this->_postErrors[] = $this->l('Your packaging size is not specified');
elseif (Tools::getValue('usps_carrier_packaging_type') == NULL OR Tools::getValue('usps_carrier_packaging_type') == '')
$this->_postErrors[] = $this->l('Your packaging type is not specified');
elseif (Tools::getValue('usps_carrier_machinable') == NULL OR Tools::getValue('usps_carrier_machinable') == '')
$this->_postErrors[] = $this->l('Your machinable field is not set');
$this->_postErrors[] = $this->l('Your Origination Zip Code is not specified');
elseif (Tools::getValue('usps_carrier_postal_code') < 1 || Tools::getValue('usps_carrier_postal_code') > 99999 || !is_numeric(Tools::getValue('usps_carrier_postal_code')) || !ctype_digit(Tools::getValue('usps_carrier_postal_code')) || strlen(Tools::getValue('usps_carrier_postal_code')) != 5)
$this->_postErrors[] = $this->l('Your Origination Zip Code is not valid');
elseif (Tools::getValue('usps_carrier_packaging_weight') < 0 || !is_numeric(Tools::getValue('usps_carrier_packaging_weight')))
$this->_postErrors[] = $this->l('The Packaging Weight must be "equal to" or "greater than" 0');
elseif (Tools::getValue('usps_carrier_handling_fee') < 0 || !is_numeric(Tools::getValue('usps_carrier_handling_fee')))
$this->_postErrors[] = $this->l('The Handling Fee must be "equal to" or "greater than" 0');
elseif (!Tools::getValue('service'))
$this->_postErrors[] = $this->l('You must choose at least one Delivery Service');
// Validate the Delivery Services to make sure that only one of COMMERCIAL rate or REGULAR rate was chosen
$usps_service_validate_all = Tools::getValue('service_validate');
$usps_service_validate_picks = Tools::getValue('service');
$usps_service_validate_error = false;
if (count($usps_service_validate_picks) > 1)
{
// There has to be two or more services picked for there to be a problem
foreach ($usps_service_validate_all as $usps_sva_id => $usps_sva_code)
{
// Loop thru list of all services
$usps_was_picked = false;
foreach ($usps_service_validate_picks as $usps_picked)
{
// See if it's one of the checked services
if ($usps_sva_id == $usps_picked)
$usps_was_picked = true;
}
if ($usps_was_picked)
{
// If it was checked, then continue
foreach ($usps_service_validate_picks as $usps_pick)
{
//Loop thru checked services only
if ($usps_sva_id != $usps_pick)
{
// Don't compare it to itself
$usps_str_len = strlen($usps_sva_code);
$usps_pick_start = substr($usps_service_validate_all[$usps_pick], 0, $usps_str_len);
// Compare the first part of the CODE to see if match (ex: PRIORITY == PRIORITY)
if ($usps_pick_start == $usps_sva_code)
$usps_service_validate_error = true;
}
}
}
}
}
if ($usps_service_validate_error)
$this->_postErrors[] = $this->l('You must pick either COMMERCIAL RATE or REGULAR RATE for each mail type. You cannot choose both.');
// Check usps webservice availibity
if (!$this->_postErrors)
@@ -631,13 +623,8 @@ class UspsCarrier extends CarrierModule
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'));
Configuration::updateValue('USPS_CARRIER_ADDRESS1', Tools::getValue('usps_carrier_address1'));
Configuration::updateValue('USPS_CARRIER_ADDRESS2', Tools::getValue('usps_carrier_address2'));
Configuration::updateValue('USPS_CARRIER_POSTAL_CODE', Tools::getValue('usps_carrier_postal_code'));
Configuration::updateValue('USPS_CARRIER_CITY', Tools::getValue('usps_carrier_city'));
Configuration::updateValue('USPS_CARRIER_STATE', Tools::getValue('usps_carrier_state'));
Configuration::updateValue('USPS_CARRIER_COUNTRY', Tools::getValue('usps_carrier_country'));
Configuration::updateValue('USPS_CARRIER_CALCUL_MODE', Tools::getValue('usps_carrier_calcul_mode'));
Configuration::updateValue('USPS_CARRIER_CALCULATION_MODE', Tools::getValue('usps_carrier_calculation_mode'));
Configuration::updateValue('PS_WEIGHT_UNIT', $this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]);
Configuration::updateValue('PS_DIMENSION_UNIT', $this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))]);
if (isset($this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]))
@@ -659,10 +646,7 @@ class UspsCarrier extends CarrierModule
Configuration::updateValue('USPS_CARRIER_PACKAGING_TYPE', Tools::getValue('usps_carrier_packaging_type')) AND
Configuration::updateValue('USPS_CARRIER_MACHINABLE', Tools::getValue('usps_carrier_machinable')) AND
Configuration::updateValue('USPS_CARRIER_POSTAL_CODE', Tools::getValue('usps_carrier_postal_code')) AND
Configuration::updateValue('USPS_CARRIER_CITY', Tools::getValue('usps_carrier_city')) AND
Configuration::updateValue('USPS_CARRIER_STATE', Tools::getValue('usps_carrier_state')) AND
Configuration::updateValue('USPS_CARRIER_COUNTRY', Tools::getValue('usps_carrier_country')) AND
Configuration::updateValue('USPS_CARRIER_CALCUL_MODE', Tools::getValue('usps_carrier_calcul_mode')) AND
Configuration::updateValue('USPS_CARRIER_CALCULATION_MODE', Tools::getValue('usps_carrier_calculation_mode')) AND
Configuration::updateValue('PS_WEIGHT_UNIT', $this->_weightUnitList[strtoupper(Tools::getValue('ps_weight_unit'))]) AND
Configuration::updateValue('PS_DIMENSION_UNIT', $this->_dimensionUnitList[strtoupper(Tools::getValue('ps_dimension_unit'))]))
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
@@ -699,11 +683,11 @@ class UspsCarrier extends CarrierModule
$nCategories = (int)sizeof($categories);
foreach ($categories AS $category)
$pathTab[] = htmlentities($category['name'], ENT_NOQUOTES, 'UTF-8');
return $pathTab;
}
}
private function _getChildCategories($categories, $id, $path = array(), $pathAdd = '')
{
$html = '';
@@ -732,7 +716,7 @@ class UspsCarrier extends CarrierModule
return 1;
return 0;
}
private function _displayFormCategory()
{
// Check if the module is configured
@@ -817,7 +801,7 @@ class UspsCarrier extends CarrierModule
{
// Loading config
$configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'usps_rate_config` WHERE `id_usps_rate_config` = '.(int)(Tools::getValue('id_usps_rate_config')));
// Category Path
$path = '';
$pathTab = $this->_getPathInTab($configSelected['id_category']);
@@ -863,7 +847,7 @@ class UspsCarrier extends CarrierModule
foreach($rateServiceList as $rateService)
{
$configServiceSelected = Db::getInstance()->getValue('SELECT `id_usps_rate_service_code` FROM `'._DB_PREFIX_.'usps_rate_config_service` WHERE `id_usps_rate_config` = '.(int)(Tools::getValue('id_usps_rate_config')).' AND `id_usps_rate_service_code` = '.(int)($rateService['id_usps_rate_service_code']));
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1 || $configServiceSelected > 0) ? 'checked="checked"' : '').' /> '.$rateService['service'].'<br />';
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1 || $configServiceSelected > 0) ? 'checked="checked"' : '').' /> '.$rateService['service'].' '.('COMMERCIAL' == substr($rateService['code'], -10) ? '['.$this->l('COMMERCIAL RATE').']' : '['.$this->l('REGULAR RATE').']').'<br />';
}
$html .= '
<p>' . $this->l('Choose the delivery service available to your customers.') . '</p>
@@ -912,7 +896,7 @@ class UspsCarrier extends CarrierModule
<div class="margin-form">';
$rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'usps_rate_service_code`');
foreach($rateServiceList as $rateService)
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].'<br />';
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].' '.('COMMERCIAL' == substr($rateService['code'], -10) ? '['.$this->l('COMMERCIAL RATE').']' : '['.$this->l('REGULAR RATE').']').'<br />';
$html .= '
<p>' . $this->l('Choose the delivery service available to your customers.') . '</p>
</div>
@@ -1018,7 +1002,7 @@ class UspsCarrier extends CarrierModule
if ($result1)
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
else
$this->_html .= $this->displayErrors($this->l('Settings failed'));
$this->_html .= $this->displayErrors($this->l('Settings failed'));
}
}
@@ -1145,7 +1129,7 @@ class UspsCarrier extends CarrierModule
foreach($rateServiceList as $rateService)
{
$configServiceSelected = Db::getInstance()->getValue('SELECT `id_usps_rate_service_code` FROM `'._DB_PREFIX_.'usps_rate_config_service` WHERE `id_usps_rate_config` = '.(int)(Tools::getValue('id_usps_rate_config')).' AND `id_usps_rate_service_code` = '.(int)($rateService['id_usps_rate_service_code']));
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1 || $configServiceSelected > 0) ? 'checked="checked"' : '').' /> '.$rateService['service'].'<br />';
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1 || $configServiceSelected > 0) ? 'checked="checked"' : '').' /> '.$rateService['service'].' '.('COMMERCIAL' == substr($rateService['code'], -10) ? '['.$this->l('COMMERCIAL RATE').']' : '['.$this->l('REGULAR RATE').']').'<br />';
}
$html .= '
<p>' . $this->l('Choose the delivery service available to your customers.') . '</p>
@@ -1200,7 +1184,7 @@ class UspsCarrier extends CarrierModule
<div class="margin-form">';
$rateServiceList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'usps_rate_service_code`');
foreach($rateServiceList as $rateService)
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].'<br />';
$html .= '<input type="checkbox" name="service[]" value="'.$rateService['id_usps_rate_service_code'].'" '.(($this->_isPostCheck($rateService['id_usps_rate_service_code']) == 1) ? 'checked="checked"' : '').' /> '.$rateService['service'].' '.('COMMERCIAL' == substr($rateService['code'], -10) ? '['.$this->l('COMMERCIAL RATE').']' : '['.$this->l('REGULAR RATE').']').'<br />';
$html .= '
<p>' . $this->l('Choose the delivery service available to your customers.') . '</p>
</div>
@@ -1210,7 +1194,7 @@ class UspsCarrier extends CarrierModule
return $html;
}
private function _postValidationProduct()
{
// Check post values
@@ -1234,7 +1218,7 @@ class UspsCarrier extends CarrierModule
$this->_postErrors[] = $this->l('An error occurred, please try again.');
}
}
private function _postProcessProduct()
{
// Init Var
@@ -1306,7 +1290,7 @@ class UspsCarrier extends CarrierModule
if ($result1)
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
else
$this->_html .= $this->displayErrors($this->l('Settings failed'));
$this->_html .= $this->displayErrors($this->l('Settings failed'));
}
}
@@ -1325,7 +1309,7 @@ class UspsCarrier extends CarrierModule
<p><b><u>1. '.$this->l('General Settings').'</u></b></p>
<p>'.$this->l('See below for the description of each field :').'</p>
<p><b>'.$this->l('Your USPS User ID').' :</b> '.$this->l('You must subscribe to the USPS website at this address').' <a href="http://www.usps.com/webtools/" target="_blank">http://www.usps.com/webtools/</a></p>
<p><b>'.$this->l('Zip / Postal Code').' :</b> '.$this->l('This field identifies the Zip / Postal code of your package starting point.').'</p>
<p><b>'.$this->l('Origination Zip Code').' :</b> '.$this->l('This field identifies the Zip Code of your package starting point.').'</p>
<p><b>'.$this->l('Country').' :</b> '.$this->l('This field identifies the country of origin of your package.').'</p>
<p><b>'.$this->l('Packaging Type').' :</b> '.$this->l('This field corresponds to the default packaging type (when there is no specific configuration for the product or the category product).').'</p>
<p><b>'.$this->l('Delivery Service').' :</b> '.$this->l('These checkboxes correspond to the delivery services you want available (when there is no specific configuration for the product or the category product).').'</p>
@@ -1373,7 +1357,7 @@ class UspsCarrier extends CarrierModule
}
return $conversionRate;
}
public function getOrderShippingCostHash($wsParams)
{
$paramHash = '';
@@ -1387,11 +1371,15 @@ class UspsCarrier extends CarrierModule
foreach ($wsParams as $k => $v)
if ($k != 'products')
$paramHash .= '/'.$v;
return md5($productHash.$paramHash.Configuration::get('USPS_CARRIER_CALCUL_MODE'));
return md5($productHash.$paramHash.Configuration::get('USPS_CARRIER_CALCULATION_MODE'));
}
public function getOrderShippingCostCache($wsParams)
{
// Debug
if ($this->debug == true)
return false;
// Get Cache
$row = Db::getInstance()->getRow("
SELECT * FROM `"._DB_PREFIX_."usps_cache`
@@ -1408,7 +1396,7 @@ class UspsCarrier extends CarrierModule
// Return Cache
return $row;
}
return false;
}
@@ -1436,7 +1424,7 @@ class UspsCarrier extends CarrierModule
{
// Init var
$config = array();
// Check if there is a specific product configuration
if ($product['id_product'] > 0)
{
@@ -1484,7 +1472,7 @@ class UspsCarrier extends CarrierModule
// Init var
$cost = 0;
if (Configuration::get('USPS_CARRIER_CALCUL_MODE') == 'onepackage')
if (Configuration::get('USPS_CARRIER_CALCULATION_MODE') == 'onepackage')
{
$width = 0;
$height = 0;
@@ -1515,7 +1503,7 @@ class UspsCarrier extends CarrierModule
'width' => ($width > 0 ? $width : 1),
'height' => ($height > 0 ? $height : 1),
'depth' => ($depth > 0 ? $depth : 1),
'weight' => ($weight > 0.1 ? $weight : 0.1),
'weight' => ($weight > 0 ? $weight : 0.5),
'packaging_type' => Configuration::get('USPS_CARRIER_PACKAGING_TYPE'),
'packaging_size' => Configuration::get('USPS_CARRIER_PACKAGING_SIZE'),
'machinable' => Configuration::get('USPS_CARRIER_MACHINABLE'),
@@ -1541,7 +1529,7 @@ class UspsCarrier extends CarrierModule
'width' => ($product['width'] ? $product['width'] : 1),
'height' => ($product['height'] ? $product['height'] : 1),
'depth' => ($product['depth'] ? $product['depth'] : 1),
'weight' => ($product['weight'] > 0.1 ? $product['weight'] : 0.1),
'weight' => ($product['weight'] > 0 ? $product['weight'] : 0.5),
'packaging_type' => (isset($config['packaging_type_code']) ? $config['packaging_type_code'] : Configuration::get('USPS_CARRIER_PACKAGING_TYPE')),
'packaging_size' => (isset($config['packaging_size_code']) ? $config['packaging_size_code'] : Configuration::get('USPS_CARRIER_PACKAGING_SIZE')),
'machinable' => (isset($config['machinable_code']) ? $config['machinable_code'] : Configuration::get('USPS_CARRIER_MACHINABLE')),
@@ -1566,7 +1554,7 @@ class UspsCarrier extends CarrierModule
}
public function getOrderShippingCost($params, $shipping_cost)
{
{
// Init var
$address = new Address($params->id_address_delivery);
$recipient_country = Db::getInstance()->getRow('SELECT `iso_code` FROM `'._DB_PREFIX_.'country` WHERE `id_country` = '.(int)($address->id_country));
@@ -1585,12 +1573,7 @@ class UspsCarrier extends CarrierModule
'recipient_city' => $address->city,
'recipient_country_iso' => $recipient_country['iso_code'],
'recipient_state_iso' => $recipient_state['iso_code'],
'shipper_address1' => Configuration::get('USPS_CARRIER_ADDRESS1'),
'shipper_address2' => Configuration::get('USPS_CARRIER_ADDRESS2'),
'shipper_postalcode' => Configuration::get('USPS_CARRIER_POSTAL_CODE'),
'shipper_city' => Configuration::get('USPS_CARRIER_CITY'),
'shipper_country_iso' => $shipper_country['iso_code'],
'shipper_state_iso' => $shipper_state['iso_code'],
'products' => $params->getProducts()
);
$wsParams['hash'] = $this->getOrderShippingCostHash($wsParams);
@@ -1626,38 +1609,6 @@ class UspsCarrier extends CarrierModule
**
*/
public function parseXML($valTab)
{
$level = 0;
$levelTab = array();
$resultTab = array();
foreach ($valTab as $tmp)
{
if ($tmp['level'] > $level)
$levelTab[] = $tmp['tag'];
elseif ($tmp['level'] < $level)
array_pop($levelTab);
elseif ($tmp['level'] == $level)
{
array_pop($levelTab);
$levelTab[] = $tmp['tag'];
}
$level = $tmp['level'];
if ($tmp['type'] == 'complete' && isset($tmp['value']))
$this->recurseTab($resultTab, $levelTab, 0, $tmp['value']);
}
return $resultTab;
}
public function recurseTab(&$resultTab, $levelTab, $index, $value)
{
if (isset($levelTab[$index]))
$this->recurseTab($resultTab[$levelTab[$index]], $levelTab, $index + 1, $value);
else
$resultTab = $value;
}
public function webserviceTest($service = '')
{
// Check API Key
@@ -1683,7 +1634,7 @@ class UspsCarrier extends CarrierModule
'package_list' => array(
array('width' => 10, 'height' => 3, 'depth' => 10, 'weight' => 0.75, 'packaging_size' => Configuration::get('USPS_CARRIER_PACKAGING_SIZE'), 'packaging_type' => Configuration::get('USPS_CARRIER_PACKAGING_TYPE'), 'machinable' => Configuration::get('USPS_CARRIER_MACHINABLE')),
array('width' => 3, 'height' => 3, 'depth' => 3, 'weight' => 0.75, 'packaging_size' => Configuration::get('USPS_CARRIER_PACKAGING_SIZE'), 'packaging_type' => Configuration::get('USPS_CARRIER_PACKAGING_TYPE'), 'machinable' => Configuration::get('USPS_CARRIER_MACHINABLE')),
),
),
);
// Unit or Large Test
@@ -1697,21 +1648,22 @@ class UspsCarrier extends CarrierModule
{
// Sending Request
$wsParams['service'] = $service['code'];
$resultTab = Db::getInstance()->getValue('SELECT `result` FROM `'._DB_PREFIX_.'usps_cache_test` WHERE `hash` = \''.pSQL(md5($this->getXml($wsParams))).'\'');
if ($resultTab)
$resultTab = Db::getInstance()->getValue('SELECT `result` FROM `'._DB_PREFIX_.'usps_cache_test` WHERE `hash` = \''.pSQL(md5(var_export($this->getXml($wsParams), true))).'\'');
if ($resultTab && $this->debug != true)
$resultTab = unserialize($resultTab);
else
$resultTab = $this->sendRequest($wsParams);
// Return results
if (isset($resultTab['RATEV4RESPONSE']['PACKAGE']['POSTAGE']['RATE']))
if (isset($resultTab['Rate']))
{
Db::getInstance()->autoExecute(_DB_PREFIX_.'usps_cache_test', array('hash' => pSQL(md5($this->getXml($wsParams))), 'result' => pSQL(serialize($resultTab)), 'date_add' => pSQL(date('Y-m-d H:i:s')), 'date_upd' => pSQL(date('Y-m-d H:i:s'))), 'INSERT');
Db::getInstance()->autoExecute(_DB_PREFIX_.'usps_cache_test', array('hash' => pSQL(md5(var_export($this->getXml($wsParams), true))), 'result' => pSQL(serialize($resultTab)), 'date_add' => pSQL(date('Y-m-d H:i:s')), 'date_upd' => pSQL(date('Y-m-d H:i:s'))), 'INSERT');
return true;
}
if (isset($resultTab['RATEV4RESPONSE']['PACKAGE']['ERROR']['HELPCONTEXT']))
$this->_webserviceError = $this->l('Error').' '.$resultTab['RATEV4RESPONSE']['PACKAGE']['ERROR']['HELPCONTEXT'].' : '.$resultTab['RATEV4RESPONSE']['PACKAGE']['ERROR']['DESCRIPTION'];
if (isset($resultTab['Error']))
$this->_webserviceError = $this->l('Error').' '.$resultTab['Error'];
else
{
$this->_webserviceError = $this->l('USPS Webservice seems to be down, please wait a few minutes and try again.');
@@ -1733,15 +1685,15 @@ class UspsCarrier extends CarrierModule
// Check currency
$conversionRate = 1;
if (isset($resultTab['RATEV4RESPONSE']['PACKAGE']['POSTAGE']['RATE']))
if (isset($resultTab['Rate']))
$conversionRate = $this->getCartCurrencyRate(Currency::getIdByIsoCode('USD'), $wsParams['id_cart']);
// Return results
if (isset($resultTab['RATEV4RESPONSE']['PACKAGE']['POSTAGE']['RATE']))
return array('connect' => true, 'cost' => $resultTab['RATEV4RESPONSE']['PACKAGE']['POSTAGE']['RATE'] * $conversionRate);
if (isset($resultTab['Rate']))
return array('connect' => true, 'cost' => $resultTab['Rate'] * $conversionRate);
if (isset($resultTab['RATEV4RESPONSE']['PACKAGE']['ERROR']['HELPCONTEXT']))
$this->_webserviceError = $this->l('Error').' '.$resultTab['RATEV4RESPONSE']['PACKAGE']['ERROR']['HELPCONTEXT'].' : '.$resultTab['RATEV4RESPONSE']['PACKAGE']['ERROR']['DESCRIPTION'];
if (isset($resultTab['Error']))
$this->_webserviceError = $this->l('Error').' '.$resultTab['Error'];
else
$this->_webserviceError = $this->l('USPS Webservice seems to be down, please wait a few minutes and try again.');
@@ -1752,8 +1704,23 @@ class UspsCarrier extends CarrierModule
{
// POST Request
$errno = $errstr = $result = '';
$xml = $this->getXml($wsParams);
$xmlTab = $this->getXml($wsParams);
$resultTab = array();
// Debug Xml
if ($this->debug == true)
{
$fh_xml_date = date('Y-m-d H-i-s');
$fh_xml = fopen(dirname(__FILE__).'/log/log_xml_'.$fh_xml_date.'.txt', 'a');
fwrite($fh_xml, "\n========================================\nREQUEST: ".$fh_xml_date."\n----------------------------------------\n");
fwrite($fh_xml, print_r($xmlTab, true));
fwrite($fh_xml, "========================================\nRESPONSE: ".$fh_xml_date." NOTE: If response is empty then an error occured\n----------------------------------------\n");
fclose($fh_xml);
}
// Loop on Xml
foreach ($xmlTab as $xml)
{
if (is_callable('curl_exec'))
{
// Curl Request
@@ -1771,7 +1738,7 @@ class UspsCarrier extends CarrierModule
{
// FsockOpen Request
$timeout = 5;
$fp = fsockopen("http://production.shippingapis.com", "80", $errno, $errstr, $timeout);
$fp = fsockopen("http://production.shippingapis.com", "80", $errno, $errstr, $timeout);
if ($fp)
{
$xml = 'API=RateV4&XML='.$xml;
@@ -1808,12 +1775,39 @@ class UspsCarrier extends CarrierModule
// Get xml from HTTP Result
$data = strstr($result, '<?');
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $data, $valTab, $indexTab);
xml_parser_free($xml_parser);
// Parsing XML
$resultTab = $this->parseXML($valTab);
$resultTabTmp = simplexml_load_string($data);
$resultTabTmpDebug[] = $resultTabTmp;
foreach ($resultTabTmp->Package as $package)
{
if (isset($package->Error))
{
if (!isset($resultTab['Error']))
$resultTab['Error'] = '';
$tmp = (array)$package;
$resultTab['Error'] .= (isset($package->Error->Description) ? 'Error <b>'.(string)$package->Error->HelpContext.'</b> on package <b>'.(string)$tmp['@attributes']['ID'].'</b> : '.(string)$package->Error->Description : 'Error')."\n";
}
if (isset($package->Postage->Rate))
{
if (!isset($resultTab['Rate']))
$resultTab['Rate'] = 0;
$resultTab['Rate'] += (string)$package->Postage->Rate;
}
}
}
// Log
if ($this->debug == true)
{
$fh_xml_data = str_replace("><", ">\n<", $data);
$fh_xml = fopen(dirname(__FILE__).'/log/log_xml_'.$fh_xml_date.'.txt', 'a');
fwrite($fh_xml, $fh_xml_data);
fwrite($fh_xml, "resultTab ".print_r($resultTab, true));
//fwrite($fh_xml, "resultTabTmpDebug ".print_r($resultTabTmpDebug, true));
fclose($fh_xml);
}
return $resultTab;
}
@@ -1821,6 +1815,8 @@ class UspsCarrier extends CarrierModule
public function getXml($wsParams = array())
{
// Template Xml Package List
$count = 0;
$xmlTab = array();
$xmlPackageList = '';
$xmlPackageTemplate = @file_get_contents(dirname(__FILE__).'/xml-package.tpl');
@@ -1834,7 +1830,7 @@ class UspsCarrier extends CarrierModule
$p['weight_pounds'] = 0;
// First class management
if ($wsParams['service'] == 'FIRST CLASS')
if (substr($wsParams['service'], 0, 11) == 'FIRST CLASS')
$wsParams['firstclassmailtype'] = '<FirstClassMailType>PARCEL</FirstClassMailType>';
else
$wsParams['firstclassmailtype'] = '';
@@ -1871,21 +1867,34 @@ class UspsCarrier extends CarrierModule
$p['machinable']
);
$xmlPackageList .= str_replace($search, $replace, $xmlPackageTemplate);
$count++;
if ($count == 25)
{
// Template Xml
$search = array('[[USERID]]', '[[PackageList]]');
$replace = array(Configuration::get('USPS_CARRIER_USER_ID'), $xmlPackageList);
$xmlTemplate = @file_get_contents(dirname(__FILE__).'/xml.tpl');
$xmlTab[] = str_replace($search, $replace, $xmlTemplate);
$xmlPackageList = '';
$count = 0;
}
}
// Template Xml
if ($count > 0)
{
$search = array('[[USERID]]', '[[PackageList]]');
$replace = array(Configuration::get('USPS_CARRIER_USER_ID'), $xmlPackageList);
$xmlTemplate = @file_get_contents(dirname(__FILE__).'/xml.tpl');
$xml = str_replace($search, $replace, $xmlTemplate);
$xmlTab[] = str_replace($search, $replace, $xmlTemplate);
}
// Return
return $xml;
return $xmlTab;
}
}
?>

View File

@@ -1,3 +1,3 @@
<FilesMatch "\.tpl$">
Deny from all
</FilesMatch>
</FilesMatch>

View File

@@ -24,6 +24,7 @@ ul.address {
position: relative;
width: 268px
}
ul.address.full_width { width: 536px }
ul.address li {
padding-left: 1.4em;
margin-top: 0.6em
@@ -39,6 +40,7 @@ li.address_title {
}
ul.item li.address_title { background-image: url('../img/address_alias_left.gif') }
ul.alternate_item li.address_title { background-image: url('../img/address_alias_right.gif') }
ul.full_width li.address_title { background-image: url('../img/address_alias_full_width.gif') }
li.address_name,
li.address_firstname,
li.address_lastname,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -66,21 +66,29 @@ function updateCarrierList(json)
else
var extraHtml = '';
if (taxEnabled && displayPrice == 0)
var price = carriers[i].price;
if (carriers[i].price == 0)
var price = txtFree;
else
var price = carriers[i].price_tax_exc;
{
if (taxEnabled && displayPrice == 0)
var price = '<span class="price">'+formatCurrency(carriers[i].price, currencyFormat, currencySign, currencyBlank)+'</span>';
else
var price = '<span class="price">'+formatCurrency(carriers[i].price_tax_exc, currencyFormat, currencySign, currencyBlank)+'</span>';
}
html = html +
'<tr class="'+itemType+'">'+
'<td class="carrier_action radio"><input type="radio" name="id_carrier" value="'+carriers[i].id_carrier+'" id="id_carrier'+carriers[i].id_carrier+'" onclick="updateCarrierSelectionAndGift();" '+extraHtml+' /></td>'+
'<td class="carrier_name"><label for="id_carrier'+carriers[i].id_carrier+'">'+name+'</label></td>'+
'<td class="carrier_infos">'+carriers[i].delay+'</td>'+
'<td class="carrier_price"><span class="price">'+formatCurrency(price, currencyFormat, currencySign, currencyBlank)+'</span>';
'<td class="carrier_price">'+price;
if (carriers[i].price != 0)
{
if (taxEnabled && displayPrice == 0)
html = html + ' ' + txtWithTax;
else
html = html + ' ' + txtWithoutTax;
}
html = html + '</td>'+
'</tr>';
}
@@ -143,7 +151,12 @@ function updateAddressSelection()
$('#opc_payment_methods-overlay').fadeOut('slow');
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
$('#opc_account-overlay').fadeOut('slow');
$('#opc_delivery_methods-overlay').fadeOut('slow');
$('#opc_payment_methods-overlay').fadeOut('slow');
}
});
}
@@ -226,7 +239,11 @@ function updateCarrierSelectionAndGift()
$('#opc_delivery_methods-overlay').fadeOut('slow');
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save carrier \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("TECHNICAL ERROR: unable to save carrier \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
$('#opc_payment_methods-overlay').fadeOut('slow');
$('#opc_delivery_methods-overlay').fadeOut('slow');
}
});
}
@@ -325,7 +342,12 @@ function saveAddress(type)
result = true;
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
$('#opc_new_account-overlay').fadeOut('slow');
$('#opc_delivery_methods-overlay').fadeOut('slow');
$('#opc_payment_methods-overlay').fadeOut('slow');
}
});
return result;
@@ -371,7 +393,11 @@ function updateNewAccountToAddressBlock()
});
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("TECHNICAL ERROR: unable to send login informations \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
$('#opc_delivery_methods-overlay').fadeOut('slow');
$('#opc_payment_methods-overlay').fadeOut('slow');
}
});
}
@@ -603,7 +629,12 @@ $(function() {
$('#opc_delivery_methods-overlay').fadeOut('slow');
$('#opc_payment_methods-overlay').fadeOut('slow');
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save account \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("TECHNICAL ERROR: unable to save account \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
$('#opc_new_account-overlay').fadeOut('slow');
$('#opc_delivery_methods-overlay').fadeOut('slow');
$('#opc_payment_methods-overlay').fadeOut('slow');
}
});
return false;
});
@@ -633,7 +664,10 @@ $(function() {
else
$('#opc_delivery_methods-overlay').fadeOut('slow');
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save message \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("TECHNICAL ERROR: unable to save message \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
$('#opc_delivery_methods-overlay').fadeOut('slow');
}
});
});

View File

@@ -91,8 +91,8 @@
function getAddressesTitles()
{ldelim}
return {ldelim}
'invoice': "{l s='Your billing address'}"
, 'delivery': "{l s='Your delivery address'}"
'invoice': "{l s='Your billing address'}",
'delivery': "{l s='Your delivery address'}"
{rdelim};
{rdelim}
@@ -173,7 +173,7 @@
</select>
</p>
<p class="checkbox">
<p class="checkbox" {if $cart->isVirtualCart()}style="display:none;"{/if}>
<input type="checkbox" name="same" id="addressesAreEquals" value="1" onclick="updateAddressesDisplay();{if $opc}updateAddressSelection();{/if}" {if $cart->id_address_invoice == $cart->id_address_delivery || $addresses|@count == 1}checked="checked"{/if} />
<label for="addressesAreEquals">{l s='Use the same address for billing.'}</label>
</p>
@@ -196,9 +196,9 @@
{/if}
</p>
<div class="clear"></div>
<ul class="address item" id="address_delivery">
<ul class="address item" id="address_delivery" {if $cart->isVirtualCart()}style="display:none;"{/if}>
</ul>
<ul class="address alternate_item" id="address_invoice">
<ul class="address alternate_item {if $cart->isVirtualCart()}full_width{/if}" id="address_invoice">
</ul>
<br class="clear" />
<p class="address_add submit">

View File

@@ -50,6 +50,10 @@
{/literal}
//]]>
</script>
{else}
<script type="text/javascript">
var txtFree = "{l s='Free!'}";
</script>
{/if}
{if !$virtual_cart && $giftAllowed && $cart->gift == 1}

View File

@@ -87,7 +87,7 @@
<p>{l s='Message:'} {$order->gift_message|nl2br}</p>
{/if}
<br />
<ul class="address item">
<ul class="address item" {if $order->isVirtual()}style="display:none;"{/if}>
<li class="address_title">{l s='Invoice'}</li>
{foreach from=$inv_adr_fields name=inv_loop item=field_item}
{if $field_item eq "company" && isset($address_invoice->company)}<li class="address_company">{$address_invoice->company|escape:'htmlall':'UTF-8'}</li>
@@ -100,7 +100,7 @@
{/foreach}
</ul>
<ul class="address alternate_item">
<ul class="address alternate_item {if $order->isVirtual()}full_width{/if}">
<li class="address_title">{l s='Delivery'}</li>
{foreach from=$dlv_adr_fields name=dlv_loop item=field_item}
{if $field_item eq "company" && isset($address_delivery->company)}<li class="address_company">{$address_delivery->company|escape:'htmlall':'UTF-8'}</li>

View File

@@ -60,6 +60,7 @@
<ul class="bullet">
<li>{l s='Personalized and secure access'}</li>
<li>{l s='Fast and easy check out'}</li>
<li>{l s='Separate billing and shipping addresses'}</li>
</ul>
<p>
<input type="button" class="button_large" id="opc_createAccount" value="{l s='Create an account'}" />

View File

@@ -1152,6 +1152,8 @@ $_LANGADM['AdminImport7a1920d61156abc05a60135aefe8bc67'] = 'Défaut';
$_LANGADM['AdminImport9b93b45649ec5961b8cc84e905964683'] = 'Position de l\'image';
$_LANGADM['AdminImport9c163d2934fbdd2775356db804d451fc'] = 'Position de l\'image produit à utiliser pour cette déclinaison. Si vous remplissez ce champ, laissez le champ \"URL de l\'image\" vide.';
$_LANGADM['AdminImport427b6d816d7fdd86cabe48d8180a3cc9'] = 'URL de l\'image';
$_LANGADM['AdminImport14913d7e9d486e77b5c8d085e3797f94'] = 'Supprimer les images existantes (0 = non, 1 = oui)';
$_LANGADM['AdminImporte6691747add3b37b9c381b8d9476fd4c'] = 'Si vous ne spécifiez pas cette colonne et vous spécifier la colonne images, toutes les images du produit seront remplacé par celle spécifié dans le fichier d\'import';
$_LANGADM['AdminImportb718adec73e04ce3ec720dd11a06a308'] = 'Identifiant';
$_LANGADM['AdminImportfd0dcc6233b026d257763713c133cf72'] = 'Actif (0/1)';
$_LANGADM['AdminImport2688a544cd5ac33f27ab78c8d8c3acaa'] = 'Nom *';
@@ -1182,8 +1184,6 @@ $_LANGADM['AdminImportf2149c422ab7577f063b69a2884d17f0'] = 'Disponible';
$_LANGADM['AdminImportb1a2a959c20b1bd847895e73a5fddbc9'] = 'Date d\'ajout d\'un produit';
$_LANGADM['AdminImporte1a5e653bc356ed6745d6814d50213eb'] = 'Afficher le prix';
$_LANGADM['AdminImport4d2589e1bcd4263cb99927b59f0f88d2'] = 'URLs des images (x,y,z...)';
$_LANGADM['AdminImport14913d7e9d486e77b5c8d085e3797f94'] = 'Supprimer les images existantes (0 = non, 1 = oui)';
$_LANGADM['AdminImporte6691747add3b37b9c381b8d9476fd4c'] = 'Si vous ne spécifiez pas cette colonne et vous spécifier la colonne images, toutes les images du produit seront remplacé par celle spécifié dans le fichier d\'import';
$_LANGADM['AdminImportecde3e896afb64e9a48781b8363b9a03'] = 'Caractéristique(Nom:Valeur:Position)';
$_LANGADM['AdminImport93b145201f52e9210402f4281ff8c188'] = 'Position de la caractéristique';
$_LANGADM['AdminImport71d0ceacdf562024f2d4c3a76d3b63e4'] = 'Uniquement disponible en ligne';
@@ -1342,6 +1342,8 @@ $_LANGADM['AdminLanguages8c2857a9ad1d8f31659e35e904e20fa6'] = 'Logo';
$_LANGADM['AdminLanguages49ee3087348e8d44e1feda1917443987'] = 'Nom';
$_LANGADM['AdminLanguagesad68f9bafd9bf2dcf3865dac55662fd5'] = 'Code ISO';
$_LANGADM['AdminLanguagese59a41e120686e63cbb743f003bea4e6'] = 'Code language';
$_LANGADM['AdminLanguages534fd46732986cba0efeda8701592427'] = 'Format de date';
$_LANGADM['AdminLanguagesc11566e30920ed4786e534e5332d5b87'] = 'Format de date (complet)';
$_LANGADM['AdminLanguages00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_LANGADM['AdminLanguages950baf75b9fd48b9cb4a3d30ffeda4ef'] = 'Préférences langues';
$_LANGADM['AdminLanguages7c89197a7b81992ee832cb5a89fa6d9d'] = 'Langue par défaut:';
@@ -1365,6 +1367,10 @@ $_LANGADM['AdminLanguages3af4c1797da60fd50670ddbb669fc0aa'] = 'Code ISO :';
$_LANGADM['AdminLanguages6b7af0b6d91545318696c648d6b466ac'] = 'Code ISO sur 2 lettres (ex : fr, en, de)';
$_LANGADM['AdminLanguages01a3b3d8af14e844c49a3a5acc870c6b'] = 'Code language:';
$_LANGADM['AdminLanguages8bc0a3b0cb05ff731e0fb30f35264898'] = 'Code language complet (ex : en-us, pt-br)';
$_LANGADM['AdminLanguages104f1a7d59077b514d4105fcee0e42ff'] = 'Format de date :';
$_LANGADM['AdminLanguages9d03b9a48a9f2f06a9698d1f9484011b'] = 'Format de date, sans les heures (ex : Y-m-d, d/m/Y)';
$_LANGADM['AdminLanguages3253758a8726c828bbbdc0cc8de30410'] = 'Format de date (complet) :';
$_LANGADM['AdminLanguages4728927eaacb4a87f8661de4a791589b'] = 'Format de date, avec les heures (ex : Y-m-d H:i:s, d/m/Y H:i)';
$_LANGADM['AdminLanguagesc907a021c935ae6144fa2ccadfe9360d'] = 'Drapeau :';
$_LANGADM['AdminLanguages581e03e07411d053e8c0f275f90fcabc'] = 'Charger le drapeau du pays à partir de votre ordinateur';
$_LANGADM['AdminLanguages70212b3d97d23361e0ec0bc567d7ea30'] = 'Image \"Aucune image\" :';