// Merge -> revision 8342
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8344 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -68,7 +68,6 @@ if (empty($tab) and !sizeof($_POST))
|
||||
});
|
||||
});</script>';
|
||||
|
||||
|
||||
echo '<div class="path_bar">
|
||||
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;">
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@ class AdminCounty extends AdminTab
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_county' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('County'), 'width' => 130, 'filter_key' => 'b!name'),
|
||||
'name' => array('title' => $this->l('County'), 'width' => 130, 'filter_key' => 'a!name'),
|
||||
'state' => array('title' => $this->l('State'), 'width' => 70, 'filter_key' => 's!name'),
|
||||
'a!active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active'));
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ class AdminImport extends AdminTab
|
||||
$product = new Product((int)($info['id']));
|
||||
$categoryData = Product::getProductCategories((int)($product->id));
|
||||
foreach ($categoryData as $tmp)
|
||||
$product->category[] = $tmp['id_category'];
|
||||
$product->category[] = $tmp;
|
||||
}
|
||||
else
|
||||
$product = new Product();
|
||||
|
||||
+317
-70
@@ -25,13 +25,14 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
|
||||
require_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php');
|
||||
|
||||
class AdminUpgrade extends AdminPreferences
|
||||
{
|
||||
public $ajax = false;
|
||||
public $nextResponseType = 'json'; // json, xml
|
||||
public $next = 'N/A';
|
||||
public $isModule = false;
|
||||
|
||||
/**
|
||||
* set to false if the current step is a loop
|
||||
@@ -39,12 +40,31 @@ class AdminUpgrade extends AdminPreferences
|
||||
* @var boolean
|
||||
*/
|
||||
public $stepDone = true;
|
||||
public $status = true;
|
||||
public $error ='0';
|
||||
public $nextDesc = '.';
|
||||
public $nextParams = array();
|
||||
public $nextQuickInfo = array();
|
||||
public $currentParams = array();
|
||||
public $autoupgradePath = '';
|
||||
/**
|
||||
* @var array theses values will be automatically added in "nextParams"
|
||||
* if their properties exists
|
||||
*/
|
||||
public $ajaxParams = array(
|
||||
// autoupgrade options
|
||||
'dontBackupImages',
|
||||
'keepDefaultTheme',
|
||||
'keepTrad',
|
||||
'manualMode',
|
||||
'desactivateCustomModule',
|
||||
|
||||
//
|
||||
'backupDbFilename',
|
||||
'backupFilesFilename',
|
||||
|
||||
|
||||
);
|
||||
public $autoupgradePath = null;
|
||||
/**
|
||||
* autoupgradeDir
|
||||
*
|
||||
@@ -53,6 +73,7 @@ class AdminUpgrade extends AdminPreferences
|
||||
public $autoupgradeDir = 'autoupgrade';
|
||||
public $latestRootDir = '';
|
||||
public $prodRootDir = '';
|
||||
public $adminDir = '';
|
||||
public $rootWritable = false;
|
||||
public $svnDir = 'svn';
|
||||
public $destDownloadFilename = 'prestashop.zip';
|
||||
@@ -64,6 +85,9 @@ class AdminUpgrade extends AdminPreferences
|
||||
private $excludeFilesFromUpgrade = array();
|
||||
private $excludeAbsoluteFilesFromUpgrade = array();
|
||||
|
||||
private $backupFilesFilename = '';
|
||||
private $backupDbFilename = '';
|
||||
|
||||
/**
|
||||
* int loopBackupFiles : if your server has a low memory size, lower this value
|
||||
* @TODO remove the static, add a const, and use it like this : min(AdminUpgrade::DEFAULT_LOOP_ADD_FILE_TO_ZIP,Configuration::get('LOOP_ADD_FILE_TO_ZIP');
|
||||
@@ -84,13 +108,75 @@ class AdminUpgrade extends AdminPreferences
|
||||
|
||||
protected $_includeContainer = false;
|
||||
|
||||
public function encrypt($string)
|
||||
{
|
||||
return md5(_COOKIE_KEY_.$string);
|
||||
}
|
||||
public function checkToken()
|
||||
{
|
||||
// simple checkToken in ajax-mode, to be free of Cookie class (and no Tools::encrypt() too )
|
||||
if ($this->ajax)
|
||||
return ($_COOKIE['autoupgrade'] == $this->encrypt($_COOKIE['id_employee']));
|
||||
else
|
||||
return parent::checkToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* create cookies id_employee, id_tab and autoupgrade (token)
|
||||
*/
|
||||
public function createCustomToken()
|
||||
{
|
||||
// ajax-mode for autoupgrade, we can't use the classic authentication
|
||||
// so, we'll create a cookie in admin dir, based on cookie key
|
||||
global $cookie;
|
||||
$id_employee = $cookie->id_employee;
|
||||
|
||||
$cookiePath = __PS_BASE_URI__.str_replace($this->prodRootDir,'',trim($this->adminDir,'/'));
|
||||
setcookie('id_employee', $id_employee, time()+3600, $cookiePath);
|
||||
setcookie('id_tab', $this->id, time()+3600, $cookiePath);
|
||||
setcookie('autoupgrade', $this->encrypt($id_employee), time()+3600, $cookiePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function viewAccess($disable = false){
|
||||
if ($this->ajax)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
// simple access : we'll allow only admin
|
||||
global $cookie;
|
||||
if ($cookie->profile == 1)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@set_time_limit(0);
|
||||
@ini_set('max_execution_time', '0');
|
||||
|
||||
$this->init();
|
||||
// retrocompatibility when used in module : Tab can't work,
|
||||
// but we saved the tab id in a cookie.
|
||||
if(class_exists('Tab',false))
|
||||
parent::__construct();
|
||||
else
|
||||
$this->id = $_COOKIE['id_tab'];
|
||||
}
|
||||
|
||||
protected function l($string, $class = 'AdminTab', $addslashes = FALSE, $htmlentities = TRUE)
|
||||
{
|
||||
if($this->isModule)
|
||||
{
|
||||
$currentClass = get_class($this);
|
||||
// need to be called in order to populate $classInModule
|
||||
return SelfModule::findTranslation('autoupgrade', $string, 'AdminSelfUpgrade');
|
||||
}
|
||||
else
|
||||
return parent::l($string, $class, $addslashes, $htmlentities);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,6 +200,11 @@ class AdminUpgrade extends AdminPreferences
|
||||
'title' => $this->l('Keep translations'), 'cast' => 'intval', 'validation' => 'isBool',
|
||||
'type' => 'bool', 'desc'=>$this->l('If set too yes, you will keep all your translations'),
|
||||
);
|
||||
|
||||
$this->_fieldsAutoUpgrade['PS_AUTOUP_CUSTOM_MOD_DESACT'] = array(
|
||||
'title' => $this->l('Desactivate custom modules'), 'cast' => 'intval', 'validation' => 'isBool',
|
||||
'type' => 'bool', 'desc'=>$this->l('If you don\'t desactivate your modules, you can have some compatibility problem and the Modules page might not load correctly.'),
|
||||
);
|
||||
// allow manual mode only for dev
|
||||
if (defined('_PS_MODE_DEV_') AND _PS_MODE_DEV_)
|
||||
$this->_fieldsAutoUpgrade['PS_AUTOUP_MANUAL_MODE'] = array(
|
||||
@@ -130,6 +221,13 @@ class AdminUpgrade extends AdminPreferences
|
||||
}
|
||||
}
|
||||
|
||||
public function configOk()
|
||||
{
|
||||
$allowed = (ConfigurationTest::test_fopen() && $this->rootWritable);
|
||||
$allowed &= !Configuration::get('PS_SHOP_ENABLE');
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
/**
|
||||
* isUpgradeAllowed checks if all server configuration is valid for upgrade
|
||||
*
|
||||
@@ -158,6 +256,12 @@ class AdminUpgrade extends AdminPreferences
|
||||
$this->adminDir = _PS_ADMIN_DIR_;
|
||||
|
||||
// test writable recursively
|
||||
if ($this->isModule)
|
||||
{
|
||||
require_once('ConfigurationTest.php');
|
||||
if(!class_exists('ConfigurationTest', false) AND class_exists('ConfigurationTestCore'))
|
||||
eval('class ConfigurationTest extends ConfigurationTestCore{}');
|
||||
}
|
||||
if (ConfigurationTest::test_dir($this->prodRootDir,true))
|
||||
$this->rootWritable = true;
|
||||
|
||||
@@ -167,14 +271,15 @@ class AdminUpgrade extends AdminPreferences
|
||||
// If you have defined this somewhere, you know what you do
|
||||
if (defined('_PS_ALLOW_UPGRADE_UNSTABLE_') AND _PS_ALLOW_UPGRADE_UNSTABLE_ AND function_exists('svn_checkout'))
|
||||
{
|
||||
if (!$this->isModule OR class_exists('Configuration',false))
|
||||
$this->useSvn = Configuration::get('PS_AUTOUP_USE_SVN');
|
||||
}
|
||||
else
|
||||
$this->useSvn = false;
|
||||
|
||||
// from $_POST or $_GET
|
||||
$this->action = Tools::getValue('action');
|
||||
$this->currentParams = Tools::getValue('params');
|
||||
$this->action = empty($_REQUEST['action'])?null:$_REQUEST['action'];
|
||||
$this->currentParams = empty($_REQUEST['params'])?null:$_REQUEST['params'];
|
||||
|
||||
// If not exists in this sessions, "create"
|
||||
// session handling : from current to next params
|
||||
@@ -184,20 +289,30 @@ class AdminUpgrade extends AdminPreferences
|
||||
if (isset($this->currentParams['filesToUpgrade']))
|
||||
$this->nextParams['filesToUpgrade'] = $this->currentParams['filesToUpgrade'];
|
||||
|
||||
if (class_exists('Configuration',false))
|
||||
{
|
||||
$time = time();
|
||||
$this->backupDbFilename = Configuration::get('UPGRADER_BACKUPDB_FILENAME');
|
||||
if(!file_exists($this->backupDbFilename))
|
||||
{
|
||||
// If not exists, the filename is generated by Backup.php
|
||||
$this->backupDbFilename = '';
|
||||
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME','');
|
||||
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $this->backupDbFilename);
|
||||
}
|
||||
|
||||
$this->backupFilesFilename = Configuration::get('UPGRADER_BACKUPFILES_FILENAME');
|
||||
if(!file_exists($this->backupFilesFilename))
|
||||
{
|
||||
$this->backupFilesFilename = '';
|
||||
Configuration::updateValue('UPGRADER_BACKUPFILES_FILENAME','');
|
||||
$this->backupFilesFilename = $this->autoupgradePath . DIRECTORY_SEPARATOR . 'backupfile-'.date('Y-m-d').'-'.$time.'.zip';
|
||||
Configuration::updateValue('UPGRADER_BACKUPFILES_FILENAME', $this->backupFilesFilename);
|
||||
}
|
||||
}
|
||||
else{
|
||||
// backupDbFilename should never be empty
|
||||
$this->backupDbFilename = $this->currentParams['backupDbFilename'];
|
||||
// backupFilesFilename should never etc.
|
||||
$this->backupFilesFilename = $this->currentParams['backupFilesFilename'];
|
||||
}
|
||||
|
||||
|
||||
$this->autoupgradePath = $this->adminDir.DIRECTORY_SEPARATOR.$this->autoupgradeDir;
|
||||
|
||||
if (!file_exists($this->autoupgradePath))
|
||||
@@ -214,11 +329,23 @@ class AdminUpgrade extends AdminPreferences
|
||||
// @TODO future option
|
||||
// $this->testRootDir = $this->autoupgradePath.DIRECTORY_SEPARATOR.'test';
|
||||
|
||||
/* optional skips */
|
||||
/* option */
|
||||
if (class_exists('Configuration',false))
|
||||
{
|
||||
$this->dontBackupImages = Configuration::get('PS_AUTOUP_DONT_SAVE_IMAGES');
|
||||
$this->keepDefaultTheme = Configuration::get('PS_AUTOUP_KEEP_DEFAULT_THEME');
|
||||
$this->keepTrad = Configuration::get('PS_AUTOUP_KEEP_TRAD');
|
||||
$this->manualMode = Configuration::get('PS_AUTOUP_MANUAL_MODE');
|
||||
$this->desactivateCustomModule = Configuration::get('PS_AUTOUP_CUSTOM_MOD_DESACT');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->dontBackupImages = $this->currentParams['dontBackupImages'];
|
||||
$this->keepDefaultTheme = $this->currentParams['keepDefaultTheme'];
|
||||
$this->keepTrad = $this->currentParams['keepTrad'];
|
||||
$this->manualMode = $this->currentParams['manualMode'];
|
||||
$this->desactivateCustomModule = $this->current['desactivateCustomModule'];
|
||||
}
|
||||
// We can add any file or directory in the exclude dir : theses files will be not removed or overwritten
|
||||
// @TODO cache should be ignored recursively, but we have to reconstruct it after upgrade
|
||||
// - compiled from smarty
|
||||
@@ -264,9 +391,11 @@ class AdminUpgrade extends AdminPreferences
|
||||
{
|
||||
$this->_setFields();
|
||||
|
||||
if (!empty($_POST))
|
||||
if (sizeof($_POST)>0)
|
||||
{
|
||||
$this->_postConfig($this->_fieldsAutoUpgrade);
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessUpgradeComplete()
|
||||
{
|
||||
@@ -277,8 +406,19 @@ class AdminUpgrade extends AdminPreferences
|
||||
public function ajaxProcessUpgradeNow()
|
||||
{
|
||||
$this->nextDesc = $this->l('Starting upgrade ...');
|
||||
$this->next = 'desactiveShop';
|
||||
|
||||
if ($this->useSvn)
|
||||
{
|
||||
$this->next = 'svnCheckout';
|
||||
$this->nextDesc = $this->l('switching to svn checkout (useSvn set to true)');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->next = 'download';
|
||||
$this->nextDesc = $this->l('Shop desactivated. Now downloading (this can takes some times )...');
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessSvnExport()
|
||||
{
|
||||
if ($this->useSvn)
|
||||
@@ -317,7 +457,9 @@ class AdminUpgrade extends AdminPreferences
|
||||
}
|
||||
|
||||
public function ajaxProcessUnzip(){
|
||||
// @TODO : not require_once like that.
|
||||
if ($this->isModule AND !class_exists('Tools',false))
|
||||
require_once('Tools.php');
|
||||
|
||||
$filepath = $this->getFilePath();
|
||||
$destExtract = $this->autoupgradePath.DIRECTORY_SEPARATOR.'latest';
|
||||
if (file_exists($destExtract))
|
||||
@@ -420,21 +562,6 @@ class AdminUpgrade extends AdminPreferences
|
||||
$this->nextParams['filesToUpgrade'] = $this->toUpgradeFileList;
|
||||
}
|
||||
|
||||
public function ajaxProcessDesactiveShop()
|
||||
{
|
||||
$this->ShopActiveValue = Configuration::get('PS_SHOP_ENABLE');
|
||||
Configuration::updateValue('PS_SHOP_ENABLE',0);
|
||||
if ($this->useSvn)
|
||||
{
|
||||
$this->next = 'svnCheckout';
|
||||
$this->nextDesc = $this->l('switching to svn checkout (useSvn set to true)');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->next = 'download';
|
||||
$this->nextDesc = $this->l('Shop desactivated. Now downloading (this can takes some times )...');
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessUpgradeFiles(){
|
||||
// @TODO :
|
||||
@@ -488,7 +615,7 @@ class AdminUpgrade extends AdminPreferences
|
||||
}
|
||||
|
||||
/**
|
||||
* model_doUpgrade prepare the call to doUpgrade.php file (like model.php)
|
||||
* _modelDoUpgrade prepare the call to doUpgrade.php file (like model.php)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -528,7 +655,7 @@ class AdminUpgrade extends AdminPreferences
|
||||
// Copy from model.php
|
||||
///////////////////////
|
||||
$upgrader = $this->upgrader;
|
||||
$upgrader->checkPSVersion();
|
||||
$upgrader->checkPSVersion(true);
|
||||
|
||||
define('INSTALL_VERSION', $upgrader->version_num);
|
||||
// now the install dir to use is in a subdirectory of the admin dir
|
||||
@@ -573,8 +700,8 @@ class AdminUpgrade extends AdminPreferences
|
||||
// @TODO
|
||||
// 4) upgrade
|
||||
// install/model.php?_=1309193641470&method=doUpgrade&customModule=desactivate
|
||||
if (isset($this->currentParams['customModule']))
|
||||
$_GET['customModule'] = $this->currentParams['customModule'];
|
||||
if (!empty($this->currentParams['desactivateCustomModule']))
|
||||
$_GET['customModule'] = 'desactivate';
|
||||
|
||||
if (!$this->_modelDoUpgrade())
|
||||
{
|
||||
@@ -655,7 +782,7 @@ class AdminUpgrade extends AdminPreferences
|
||||
// 1st, need to analyse what was wrong.
|
||||
|
||||
$this->nextParams = $this->currentParams;
|
||||
if (!empty($this->backupFilesFilename))
|
||||
if (!empty($this->backupFilesFilename) AND file_exists($this->backupFilesFilename))
|
||||
{
|
||||
$this->next = 'restoreFiles';
|
||||
$this->status = 'ok';
|
||||
@@ -663,7 +790,7 @@ class AdminUpgrade extends AdminPreferences
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($this->backupDbFilename))
|
||||
if (!empty($this->backupDbFilename) AND file_exists($this->backupDbFilename))
|
||||
{
|
||||
$this->next = 'restoreDb';
|
||||
$this->status = 'ok';
|
||||
@@ -689,7 +816,7 @@ class AdminUpgrade extends AdminPreferences
|
||||
public function ajaxProcessRestoreFiles()
|
||||
{
|
||||
// @TODO : workaround max_execution_time / ajax batch unzip
|
||||
if (!empty($this->backupFilesFilename))
|
||||
if (!empty($this->backupFilesFilename) AND file_exists($this->backupFilesFilename))
|
||||
{
|
||||
// cleanup current PS tree
|
||||
$list = $this->_listArchivedFiles();
|
||||
@@ -805,6 +932,55 @@ class AdminUpgrade extends AdminPreferences
|
||||
|
||||
public function ajaxProcessBackupDb()
|
||||
{
|
||||
if(!class_exists('ObjectModel',false))
|
||||
{
|
||||
require_once(_PS_ROOT_DIR_.'/classes/ObjectModel.php');
|
||||
if(!class_exists('ObjectModel',false))
|
||||
eval('Class ObjectModel extends ObjectModelCore{}');
|
||||
}
|
||||
|
||||
if(!class_exists('Language',false))
|
||||
{
|
||||
require_once(_PS_ROOT_DIR_.'/classes/Language.php');
|
||||
if(!class_exists('Language',false))
|
||||
eval('Class Language extends LanguageCore{}');
|
||||
}
|
||||
if(!class_exists('Validate',false))
|
||||
{
|
||||
require_once(_PS_ROOT_DIR_.'/classes/Validate.php');
|
||||
if(!class_exists('Validate',false))
|
||||
eval('Class Validate extends ValidateCore{}');
|
||||
}
|
||||
if(!class_exists('Db',false))
|
||||
{
|
||||
require_once(_PS_ROOT_DIR_.'/classes/Db.php');
|
||||
if(!class_exists('Db',false))
|
||||
eval('abstract Class Db extends DbCore{}');
|
||||
}
|
||||
if(!class_exists('MySQL',false))
|
||||
{
|
||||
require_once(_PS_ROOT_DIR_.'/classes/MySQL.php');
|
||||
if(!class_exists('MySQL',false))
|
||||
eval('Class MySQL extends MySQLCore{}');
|
||||
}
|
||||
if(!class_exists('Configuration',false))
|
||||
{
|
||||
require_once(_PS_ROOT_DIR_.'/classes/Configuration.php');
|
||||
if(!class_exists('Configuration',false))
|
||||
eval('Class Configuration extends ConfigurationCore{}');
|
||||
}
|
||||
if(!class_exists('Backup',false))
|
||||
{
|
||||
require_once('Backup.php');
|
||||
if(!class_exists('ObjectModel',false))
|
||||
eval('Class ObjectModel extends ObjectModelCore{}');
|
||||
}
|
||||
|
||||
if(!defined('_PS_MAGIC_QUOTES_GPC_'))
|
||||
define('_PS_MAGIC_QUOTES_GPC_', get_magic_quotes_gpc());
|
||||
if(!defined('_PS_MYSQL_REAL_ESCAPE_STRING_'))
|
||||
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string'));
|
||||
|
||||
$backup = new Backup();
|
||||
// for backup db, use autoupgrade directory
|
||||
// @TODO : autoupgrade must not be static
|
||||
@@ -813,6 +989,9 @@ class AdminUpgrade extends AdminPreferences
|
||||
$res = $backup->add();
|
||||
if ($res)
|
||||
{
|
||||
$this->nextParams['backupDbFilename'] = $backup->id;
|
||||
// We need to load configuration to use it ...
|
||||
Configuration::loadConfiguration();
|
||||
Configuration::updateValue('UPGRADER_BACKUPDB_FILENAME', $backup->id);
|
||||
|
||||
$this->next = 'upgradeFiles';
|
||||
@@ -837,10 +1016,6 @@ class AdminUpgrade extends AdminPreferences
|
||||
if (file_exists($this->backupFilesFilename))
|
||||
unlink($this->backupFilesFilename);
|
||||
|
||||
$time = time();
|
||||
$this->backupFilesFilename = $this->autoupgradePath . DIRECTORY_SEPARATOR . 'backupfile-'.date('Y-m-d').'-'.$time.'.zip';
|
||||
|
||||
Configuration::updateValue('UPGRADER_BACKUPFILES_FILENAME', $this->backupFilesFilename);
|
||||
$this->nextQuickInfo[] = sprintf($this->l('backup files initialized in %s'), $this->backupFilesFilename);
|
||||
}
|
||||
|
||||
@@ -1068,10 +1243,12 @@ class AdminUpgrade extends AdminPreferences
|
||||
$return['next'] = $this->next;
|
||||
$return['status'] = $this->next == 'error' ? 'error' : 'ok';
|
||||
$return['nextDesc'] = $this->nextDesc;
|
||||
if (!empty($this->nextParams))
|
||||
|
||||
foreach($this->ajaxParams as $v)
|
||||
if(property_exists($this,$v))
|
||||
$this->nextParams[$v] = $this->$v;
|
||||
|
||||
$return['nextParams'] = $this->nextParams;
|
||||
else
|
||||
$return['nextParams'] = array();
|
||||
|
||||
$return['nextParams']['typeResult'] = $this->nextResponseType;
|
||||
|
||||
@@ -1086,8 +1263,9 @@ class AdminUpgrade extends AdminPreferences
|
||||
*/
|
||||
public function displayConf()
|
||||
{
|
||||
if (version_compare(_PS_VERSION_,'1.4.4.0','<') AND false)
|
||||
if(!$this->isModule)
|
||||
{
|
||||
if (version_compare(_PS_VERSION_,'1.4.4.0','<') AND false)
|
||||
$this->_errors[] = Tools::displayError('This class depends of several files modified in 1.4.4.0 version and should not be used in an older version');
|
||||
}
|
||||
parent::displayConf();
|
||||
@@ -1096,10 +1274,12 @@ class AdminUpgrade extends AdminPreferences
|
||||
|
||||
public function ajaxPreProcess()
|
||||
{
|
||||
if (Tools::getValue('responseType') == 'json')
|
||||
if (!empty($_POST['responseType']) AND $_POST['responseType'] == 'json')
|
||||
header('Content-Type: application/json');
|
||||
$action = (Tools::getValue('action'));
|
||||
|
||||
if(!empty($_POST['action']))
|
||||
{
|
||||
$action = $_POST['action'];
|
||||
if (isset(self::$skipAction[strtolower($action)]))
|
||||
{
|
||||
$this->next = self::$skipAction[$action];
|
||||
@@ -1113,6 +1293,7 @@ class AdminUpgrade extends AdminPreferences
|
||||
$this->next = 'error';
|
||||
$this->error = '1';
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->apacheModExists('mod_evasive'))
|
||||
sleep(1);
|
||||
@@ -1126,16 +1307,29 @@ class AdminUpgrade extends AdminPreferences
|
||||
*/
|
||||
function apacheModExists($name)
|
||||
{
|
||||
if(function_exists('apache_get_modules'))
|
||||
{
|
||||
static $apacheModuleList = null;
|
||||
|
||||
if (!is_array($apacheModuleList) AND function_exists('apache_get_modules'))
|
||||
{
|
||||
if (!is_array($apacheModuleList))
|
||||
$apacheModuleList = apache_get_modules();
|
||||
}
|
||||
|
||||
// we need strpos (example can be evasive20
|
||||
foreach($apacheModuleList as $module)
|
||||
if (strpos($name, $module)!==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;
|
||||
}
|
||||
@@ -1215,9 +1409,9 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
{
|
||||
echo '<div id="rollbackContainer"><a class="upgradestep button" href="" id="rollback">'.$this->l('rollback').'</a></div><br/>';
|
||||
}
|
||||
if (!empty($this->backupFilesFilename))
|
||||
if (!empty($this->backupFilesFilename) AND file_exists($this->backupFilesFilename))
|
||||
echo '<div id="restoreFilesContainer"><a href="" class="upgradestep button" id="restoreFiles">restoreFiles</a> '.sprintf($this->l('click to restore %s'),$this->backupFilesFilename).'</div><br/>';
|
||||
if (!empty($this->backupDbFilename))
|
||||
if (!empty($this->backupDbFilename) AND file_exists($this->backupDbFilename))
|
||||
echo '<div id="restoreDbContainer"><a href="" class="upgradestep button" id="restoreDb">restoreDb</a> '.sprintf($this->l('click to restore %s'), $this->backupDbFilename).'</div><br/>';
|
||||
|
||||
echo '</div></fieldset>';
|
||||
@@ -1225,6 +1419,7 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
|
||||
private function _displayUpgraderForm()
|
||||
{
|
||||
global $cookie;
|
||||
$pleaseUpdate = $this->upgrader->checkPSVersion();
|
||||
|
||||
echo '<fieldset class="width autoupgrade " >';
|
||||
@@ -1248,15 +1443,15 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
|
||||
if (Configuration::get('PS_SHOP_ENABLE'))
|
||||
{
|
||||
$srcShopStatus = '../img/admin/enabled.gif';
|
||||
$label = $this->l('Active');
|
||||
$srcShopStatus = '../img/admin/disabled.gif';
|
||||
$label = $this->l('No');
|
||||
}
|
||||
else
|
||||
{
|
||||
$srcShopStatus = '../img/admin/disabled.gif';
|
||||
$label = $this->l('Inactive');
|
||||
$srcShopStatus = '../img/admin/enabled.gif';
|
||||
$label = $this->l('Yes');
|
||||
}
|
||||
echo '<b>'.$this->l('Shop status').' : </b>'.'<img src="'.$srcShopStatus.'" />'.$label.'<br/><br/>';
|
||||
echo '<b>'.$this->l('Shop desactivated').' : </b>'.'<img src="'.$srcShopStatus.'" />'.$label.'<br/><br/>';
|
||||
|
||||
$max_exec_time = ini_get('max_execution_time');
|
||||
if ($max_exec_time == 0)
|
||||
@@ -1293,16 +1488,23 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
echo '<br/>';
|
||||
if ($this->upgrader->needUpgrade)
|
||||
{
|
||||
if($this->configOk())
|
||||
echo '<a href="" id="upgradeNow" class="button-autoupgrade upgradestep">'.$this->l('Upgrade PrestaShop now !').'</a>';
|
||||
else
|
||||
echo $this->displayWarning('Your current configuration does not allow upgrade.');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<p>'.$this->l('Your shop is already up to date').'</p>';
|
||||
echo '<span class="button-autoupgrade upgradestep" >'.$this->l('Your shop is already up to date.').'</span> ';
|
||||
}
|
||||
echo '<small>'.sprintf($this->l('last datetime check : %s '),date('Y-m-d H:i:s',Configuration::get('PS_LAST_VERSION_CHECK'))).'</span>
|
||||
<a class="button" href="index.php?tab=AdminUpgrade&token='.Tools::getAdminToken(get_class($this).(int)(Tab::getIdFromClassName(get_class($this))).(int)$cookie->id_employee).'&refreshCurrentVersion=1">'.$this->l('Please click to refresh').'</a>
|
||||
</small>';
|
||||
|
||||
echo'</div>
|
||||
<div id="currentlyProcessing" style="display:none;float:right"><h4>Currently processing :</h4>
|
||||
<div id="infoStep" class="processing" style=height:50px;width:400px;" >I\'m waiting for your command, sir</div>';
|
||||
<div id="currentlyProcessing" style="display:none;float:right"><h4>Currently processing <img id="pleaseWait" src="'.__PS_BASE_URI__.'img/loader.gif"/></h4>
|
||||
|
||||
<div id="infoStep" class="processing" style=height:50px;width:400px;" >'.$this->l('I\'m waiting for your command, sir').'</div>';
|
||||
echo '</div>';
|
||||
|
||||
echo '</fieldset>';
|
||||
@@ -1315,7 +1517,6 @@ txtError[37] = "'.$this->l('The config/defines.inc.php file was not found. Where
|
||||
echo '<fieldset class="autoupgradeSteps"><legend>'.$this->l('Step').'</legend>';
|
||||
echo '<h4>'.$this->l('Upgrade steps').'</h4>';
|
||||
echo '<div>';
|
||||
echo '<a href="" id="desactiveShop" class="button upgradestep" >desactiveShop</a>';
|
||||
echo '<a href="" id="download" class="button upgradestep" >download</a>';
|
||||
echo '<a href="" id="unzip" class="button upgradestep" >unzip</a>'; // unzip in autoupgrade/latest
|
||||
echo '<a href="" id="removeSamples" class="button upgradestep" >removeSamples</a>'; // remove samples (iWheel images)
|
||||
@@ -1364,6 +1565,19 @@ echo '</script>';
|
||||
|
||||
public function display()
|
||||
{
|
||||
if(isset($_GET['refreshCurrentVersion']))
|
||||
{
|
||||
$upgrader = new Upgrader();
|
||||
$upgrader->checkPSVersion(true);
|
||||
}
|
||||
echo '<style>
|
||||
.autoupgradeSteps div { line-height: 30px; }
|
||||
.upgradestep { margin-right: 5px;padding-left: 10px; padding-right: 5px;}
|
||||
#upgradeNow.stepok, .autoupgradeSteps a.stepok { background-image: url("../img/admin/enabled.gif");background-position: left center;background-repeat: no-repeat;padding-left: 15px;}
|
||||
#upgradeNow {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;font-size: medium;padding: 5px;}
|
||||
.button-autoupgrade {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;font-size: medium;padding: 5px;}
|
||||
.processing {overflow: auto;}
|
||||
</style>';
|
||||
$this->displayWarning($this->l('This function is experimental. It\'s highly recommended to make a backup of your files and database before starting the upgrade process.'));
|
||||
|
||||
// update['name'] = version name
|
||||
@@ -1373,6 +1587,7 @@ echo '</script>';
|
||||
|
||||
if ($this->isUpgradeAllowed())
|
||||
{
|
||||
$this->createCustomToken();
|
||||
if ($this->useSvn)
|
||||
echo '<div class="error"><h1>'.$this->l('Unstable upgrade').'</h1>
|
||||
<p class="warning">'.$this->l('Your current configuration indicate you want to upgrade your system from the unstable development branch, with no version number. If you upgrade, you will not be able to follow the official release process anymore').'.</p>
|
||||
@@ -1384,6 +1599,14 @@ echo '</script>';
|
||||
|
||||
echo '<br/>';
|
||||
$this->_displayForm('autoUpgradeOptions',$this->_fieldsAutoUpgrade,'<a href="" name="options" id="options">'.$this->l('Options').'</a>', '','prefs');
|
||||
|
||||
if ($this->isModule)
|
||||
{
|
||||
echo '<script type="text/javascript">
|
||||
jq13 = jQuery.noConflict(true);
|
||||
</script>
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'modules/autoupgrade/jquery-1.6.2.min.js"></script>';
|
||||
}
|
||||
echo '<script type="text/javascript">'.$this->_getJsInit().'</script>';
|
||||
}
|
||||
else
|
||||
@@ -1443,6 +1666,8 @@ function addQuickInfo(arrQuickInfo){
|
||||
$js .= 'var manualMode = false;';
|
||||
|
||||
$js .= '
|
||||
var firstTimeParams = '.$this->buildAjaxResult().';
|
||||
firstTimeParams = firstTimeParams.nextParams;
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".upgradestep").click(function(e)
|
||||
@@ -1459,10 +1684,10 @@ $(document).ready(function(){
|
||||
|
||||
|
||||
// prepare available button here, without params ?
|
||||
prepareNextButton("#upgradeNow",{});
|
||||
prepareNextButton("#rollback",{});
|
||||
prepareNextButton("#restoreDb",{});
|
||||
prepareNextButton("#restoreFiles",{});
|
||||
prepareNextButton("#upgradeNow",firstTimeParams);
|
||||
prepareNextButton("#rollback",firstTimeParams);
|
||||
prepareNextButton("#restoreDb",firstTimeParams);
|
||||
prepareNextButton("#restoreFiles",firstTimeParams);
|
||||
|
||||
});
|
||||
|
||||
@@ -1506,6 +1731,11 @@ function parseXMLResult(xmlRet)
|
||||
return ret
|
||||
};
|
||||
|
||||
function afterUpgradeComplete()
|
||||
{
|
||||
$("#pleaseWait").hide();
|
||||
$("#infoStep").html("<h3>'.$this->l('Upgrade Complete ! ').'</h3>");
|
||||
}
|
||||
/**
|
||||
* afterBackupDb display the button
|
||||
*
|
||||
@@ -1536,13 +1766,13 @@ function afterBackupFiles()
|
||||
function doAjaxRequest(action, nextParams){
|
||||
req = $.ajax({
|
||||
type:"POST",
|
||||
url : "'.str_replace('index', 'ajax-tab', self::$currentIndex).'",
|
||||
url : "'.($this->isModule? __PS_BASE_URI__ . trim($this->adminDir,'/').'/autoupgrade/ajax-upgradetab.php' : str_replace('index','ajax-tab',self::$currentIndex)).'",
|
||||
async: true,
|
||||
data : {
|
||||
dir:"'.$this->adminDir.'",
|
||||
dir:"'.trim($this->adminDir,'/').'",
|
||||
ajaxMode : "1",
|
||||
token : "'.$this->token.'",
|
||||
tab : "AdminUpgrade",
|
||||
tab : "'.get_class($this).'",
|
||||
action : action,
|
||||
params : nextParams
|
||||
},
|
||||
@@ -1564,13 +1794,28 @@ function doAjaxRequest(action, nextParams){
|
||||
}
|
||||
else
|
||||
{
|
||||
try{
|
||||
res = $.parseJSON(res);
|
||||
nextParams = res.nextParams;
|
||||
}
|
||||
catch(e){
|
||||
res = {status : "error"};
|
||||
alert("error during "+action);
|
||||
/*
|
||||
nextParams = {
|
||||
error:"0",
|
||||
next:"cancelUpgrade",
|
||||
nextDesc:"Error detected during ["+action+"] step, reverting...",
|
||||
nextQuickInfo:[],
|
||||
status:"ok",
|
||||
"stepDone":true
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
if (res.status == "ok")
|
||||
{
|
||||
// a
|
||||
$("#"+action).addClass("done");
|
||||
if (res.stepDone)
|
||||
$("#"+action).addClass("stepok");
|
||||
@@ -1678,8 +1923,9 @@ function handleError(res)
|
||||
// In case the rollback button has been desactivated, just re-enable it
|
||||
prepareNextButton("#rollback",res.nextParams);
|
||||
// ask if you want to rollback
|
||||
// @TODO !!!
|
||||
if (confirm(res.NextDesc+"\r\r'.$this->l('Do you want to rollback ?').'"))
|
||||
// TODO : be sure there is useful infos
|
||||
addQuickInfo(res);
|
||||
if (confirm(res+"\r\r'.$this->l('Do you want to rollback ?').'"))
|
||||
{
|
||||
if (manualMode)
|
||||
alert("'.$this->l('Please go manually go to rollback button').'");
|
||||
@@ -1698,7 +1944,8 @@ function handleError(res)
|
||||
// as we need theses files for restore operation, we can't remove them.
|
||||
// They will be overwritten
|
||||
$skipDirs = array('backups', 'pclzip', 'autoupgrade', '.', '..', '.svn');
|
||||
$skipFiles = array('autoload.php', 'init.php', 'settings.inc.php', 'config.inc.php', 'Tools.php', 'AdminUpgrade.php', 'ajax-tab.php');
|
||||
$skipFiles = array('autoload.php', 'init.php', 'settings.inc.php', 'config.inc.php', 'Tools.php', 'AdminUpgrade.php');
|
||||
$skipFiles[] = $this->isModule?'ajax-upgradetab.php':'ajax-tab.php';
|
||||
if (is_dir($path))
|
||||
{
|
||||
$fp = opendir($path);
|
||||
|
||||
+10
-2
@@ -36,6 +36,9 @@ class BackupCore
|
||||
/** @var string custom backup directory. */
|
||||
public $customBackupDir = NULL;
|
||||
|
||||
public $psBackupAll = true;
|
||||
public $psBackupDropTable = true;
|
||||
|
||||
/**
|
||||
* Creates a new backup object
|
||||
*
|
||||
@@ -45,6 +48,11 @@ class BackupCore
|
||||
{
|
||||
if ($filename)
|
||||
$this->id = $this->getRealBackupPath($filename);
|
||||
|
||||
$psBackupAll = Configuration::get('PS_BACKUP_ALL');
|
||||
$psBackupDropTable = Configuration::get('PS_BACKUP_DROP_TABLE');
|
||||
$this->psBackupAll = $psBackupAll !== false ? $psBackupAll : true;
|
||||
$this->psBackupDropTable = $psBackupDropTable !== false ? $psBackupDropTable : true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +177,7 @@ class BackupCore
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Configuration::get('PS_BACKUP_ALL'))
|
||||
if (!$this->psBackupAll)
|
||||
$ignore_insert_table = array(_DB_PREFIX_.'connections', _DB_PREFIX_.'connections_page', _DB_PREFIX_.'connections_source', _DB_PREFIX_.'guest', _DB_PREFIX_.'statssearch');
|
||||
else
|
||||
$ignore_insert_table = array();
|
||||
@@ -228,7 +236,7 @@ class BackupCore
|
||||
|
||||
fwrite($fp, '/* Scheme for table ' . $schema[0]['Table'] . " */\n");
|
||||
|
||||
if (Configuration::get('PS_BACKUP_DROP_TABLE'))
|
||||
if ($this->psBackupDropTable)
|
||||
fwrite($fp, 'DROP TABLE IF EXISTS `'.$schema[0]['Table'].'`;'."\n");
|
||||
|
||||
fwrite($fp, $schema[0]['Create Table'] . ";\n\n");
|
||||
|
||||
+7
-4
@@ -897,6 +897,8 @@ class PDFCore extends PDF_PageGroupCore
|
||||
$priceBreakDown['totalsWithTax'][$product['tax_rate']] = 0;
|
||||
if (!isset($priceBreakDown['totalsEcotax'][$product['tax_rate']]))
|
||||
$priceBreakDown['totalsEcotax'][$product['tax_rate']] = 0;
|
||||
if (!isset($priceBreakDown['totalsEcotaxWithTax'][$product['tax_rate']]))
|
||||
$priceBreakDown['totalsEcotaxWithTax'][$product['tax_rate']] = 0;
|
||||
if (!isset($priceBreakDown['totalsWithoutTax'][$product['tax_rate']]))
|
||||
$priceBreakDown['totalsWithoutTax'][$product['tax_rate']] = 0;
|
||||
if (!isset($taxes[$product['tax_rate']]))
|
||||
@@ -950,6 +952,7 @@ class PDFCore extends PDF_PageGroupCore
|
||||
}
|
||||
|
||||
$priceBreakDown['totalsEcotax'][$product['tax_rate']] += ($product['priceEcotax'] * $product['product_quantity']);
|
||||
$priceBreakDown['totalsEcotaxWithTax'][$product['tax_rate']] += ($product['priceEcotax'] * (1 + ($product['ecotax_tax_rate'] / 100)) * $product['product_quantity']);
|
||||
if ($priceBreakDown['totalsEcotax'][$product['tax_rate']])
|
||||
$priceBreakDown['hasEcotax'] = 1;
|
||||
$taxes[$product['tax_rate']] += $vat;
|
||||
@@ -965,9 +968,9 @@ class PDFCore extends PDF_PageGroupCore
|
||||
{
|
||||
$priceBreakDown['totalsWithoutTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsWithoutTax'][$tax_rate], 2);
|
||||
$priceBreakDown['totalsProductsWithoutTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsWithoutTax'][$tax_rate], 2);
|
||||
$priceBreakDown['totalsWithTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsWithoutTax'][$tax_rate] * (1 + $tax_rate / 100), 2);
|
||||
$priceBreakDown['totalsProductsWithTax'][$tax_rate] = Tools::ps_round($priceBreakDown['totalsProductsWithoutTax'][$tax_rate] * (1 + $tax_rate / 100), 2);
|
||||
$priceBreakDown['totalsProductsWithTaxAndReduction'][$product['tax_rate']] += Tools::ps_round($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$product['tax_rate']] * (1 + $tax_rate / 100), 2);
|
||||
$priceBreakDown['totalsWithTax'][$tax_rate] = Tools::ps_round(($priceBreakDown['totalsWithoutTax'][$tax_rate]- $priceBreakDown['totalsEcotax'][$tax_rate]) * (1 + $tax_rate / 100) + $priceBreakDown['totalsEcotaxWithTax'][$tax_rate], 2);
|
||||
$priceBreakDown['totalsProductsWithTax'][$tax_rate] = Tools::ps_round(($priceBreakDown['totalsProductsWithoutTax'][$tax_rate] - $priceBreakDown['totalsEcotax'][$tax_rate]) * (1 + $tax_rate / 100) + $priceBreakDown['totalsEcotaxWithTax'][$tax_rate], 2);
|
||||
$priceBreakDown['totalsProductsWithTaxAndReduction'][$tax_rate] += Tools::ps_round(($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate] - $priceBreakDown['totalsEcotax'][$tax_rate]) * (1 + $tax_rate / 100) + $priceBreakDown['totalsEcotaxWithTax'][$tax_rate], 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1043,7 +1046,7 @@ class PDFCore extends PDF_PageGroupCore
|
||||
$this->SetXY($this->GetX(), $this->GetY() - $lineSize + 3);
|
||||
$this->Cell($w[0], $lineSize, self::l('Products'), 0, 0, 'R');
|
||||
$this->Cell($w[1], $lineSize, number_format($tax_rate, 3, ',', ' ').' %', 0, 0, 'R');
|
||||
$this->Cell($w[2], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate], self::$currency, true)), 0, 0, 'R');
|
||||
$this->Cell($w[2], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate] - $priceBreakDown['totalsEcotax'][$tax_rate], self::$currency, true)), 0, 0, 'R');
|
||||
$this->Cell($w[3], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithTaxAndReduction'][$tax_rate] - $priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate], self::$currency, true)), 0, 0, 'R');
|
||||
if ($priceBreakDown['hasEcotax'])
|
||||
$this->Cell($w[4], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsEcotax'][$tax_rate], self::$currency, true)), 0, 0, 'R');
|
||||
|
||||
@@ -222,7 +222,7 @@ abstract class PaymentModuleCore extends Module
|
||||
if (!empty($product['ecotax']))
|
||||
$ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
|
||||
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, true, false);
|
||||
$product_price = (float)Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, false, false);
|
||||
$quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], $this->context->shop->getID(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']);
|
||||
$unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
$quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00;
|
||||
|
||||
+16
-2
@@ -1934,14 +1934,28 @@ FileETag INode MTime Size
|
||||
* @param string $type by|way
|
||||
* @param string $value If no index given, use default order from admin -> pref -> products
|
||||
*/
|
||||
public static function getProductsOrder($type, $value = null)
|
||||
public static function getProductsOrder($type, $value = null, $prefix = false)
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 'by' :
|
||||
$orderByPrefix = '';
|
||||
if($prefix) {
|
||||
if ($value == 'id_product' OR $value == 'date_add')
|
||||
$orderByPrefix = 'p.';
|
||||
elseif ($value == 'name')
|
||||
$orderByPrefix = 'pl.';
|
||||
elseif ($value == 'manufacturer')
|
||||
{
|
||||
$orderByPrefix = 'm.';
|
||||
}
|
||||
elseif ($value == 'position')
|
||||
$orderByPrefix = 'cp.';
|
||||
}
|
||||
|
||||
$value = (is_null($value) || $value === false || $value === '') ? (int)Configuration::get('PS_PRODUCTS_ORDER_BY') : $value;
|
||||
$list = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
|
||||
return ((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
|
||||
return $orderByPrefix.((isset($list[$value])) ? $list[$value] : ((in_array($value, $list)) ? $value : 'position'));
|
||||
break;
|
||||
|
||||
case 'way' :
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
class UpgraderCore{
|
||||
const DEFAULT_CHECK_VERSION_DELAY_HOURS = 24;
|
||||
private static $rss_version_link = 'http://www.prestashop.com/xml/version.xml';
|
||||
/**
|
||||
* link contains hte url where to download the file
|
||||
*
|
||||
@@ -98,7 +99,7 @@ class UpgraderCore{
|
||||
if (!($this->autoUpgrade AND $lastCheck) AND ($force OR ($lastCheck < time() - (3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS))) )
|
||||
{
|
||||
libxml_set_streams_context(stream_context_create(array('http' => array('timeout' => 3))));
|
||||
if ($feed = @simplexml_load_file('http://www.prestashop.com/xml/version.xml'))
|
||||
if ($feed = @simplexml_load_file(self::$rss_version_link))
|
||||
{
|
||||
$this->version_name = (string)$feed->version->name;
|
||||
$this->version_num = (string)$feed->version->num;
|
||||
|
||||
@@ -39,6 +39,8 @@ class GuestTrackingControllerCore extends FrontController
|
||||
|
||||
public function process()
|
||||
{
|
||||
global $link;
|
||||
|
||||
parent::process();
|
||||
|
||||
if ($id_order = Tools::getValue('id_order') AND $email = Tools::getValue('email'))
|
||||
@@ -116,7 +118,7 @@ class GuestTrackingControllerCore extends FrontController
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'action' => 'guest-tracking.php',
|
||||
'action' => $link->getPageLink('guest-tracking.php'),
|
||||
'errors' => $this->errors
|
||||
));
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ class LanguageManager
|
||||
*/
|
||||
private function setLanguage()
|
||||
{
|
||||
if ( !empty($_GET['language']))
|
||||
if (isset($_GET['language']))
|
||||
$id_lang = (int)($_GET['language'])>0 ? $_GET['language'] : 0;
|
||||
if (empty($id_lang))
|
||||
if (!isset($id_lang))
|
||||
$id_lang = ($this->getIdByHAL());
|
||||
$this->lang = $this->xml_file->lang[(int)($id_lang)];
|
||||
}
|
||||
@@ -107,3 +107,4 @@ class LanguageManager
|
||||
return ($this->lang == NULL) ? false : dirname(__FILE__).$this->lang['trad_file'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+63
-41
@@ -258,7 +258,7 @@ function verifyThisStep()
|
||||
|
||||
function setInstallerLanguage ()
|
||||
{
|
||||
$("#formSetInstallerLanguage").submit();
|
||||
$('#formSetInstallerLanguage').submit();
|
||||
}
|
||||
|
||||
function verifyAndSetRequire(firsttime)
|
||||
@@ -446,20 +446,36 @@ function createDB()
|
||||
for (i = 0; countries_ret[i]; i=i+1)
|
||||
{
|
||||
html = html + '<option rel="'+countries_ret[i].getAttribute('iso')+'" value="'+countries_ret[i].getAttribute("value")+'" ';
|
||||
if (countries_ret[i].getAttribute("value") == 8)
|
||||
if (id_lang == 0)
|
||||
$('#infosCountry').find('option[disabled=disabled]').attr('selected', 'selected');
|
||||
else if (id_lang == 1 && countries_ret[i].getAttribute('value') == 8) /* France */
|
||||
html = html + ' selected="selected" ';
|
||||
html = html + ' >'+countries_ret[i].getAttribute("name")+'</option>';
|
||||
else if (id_lang == 2 && countries_ret[i].getAttribute('value') == 6) /* Spain */
|
||||
html = html + ' selected="selected" ';
|
||||
else if (id_lang == 3 && countries_ret[i].getAttribute('value') == 1) /* Germany */
|
||||
html = html + ' selected="selected" ';
|
||||
else if (id_lang == 4 && countries_ret[i].getAttribute('value') == 10) /* Italy */
|
||||
html = html + ' selected="selected" ';
|
||||
html = html + ' >'+countries_ret[i].getAttribute('name')+'</option>';
|
||||
}
|
||||
$('#infosCountry').html(html);
|
||||
$('#infosCountry').append(html);
|
||||
html = '';
|
||||
for (i = 0; timezone_ret[i]; i=i+1)
|
||||
{
|
||||
html = html + '<option value="'+timezone_ret[i].getAttribute("value")+'" ';
|
||||
if (timezone_ret[i].getAttribute("value") == "Europe/Paris")
|
||||
if (id_lang == 0)
|
||||
$('#infosTimezone').find('option[disabled=disabled]').attr('selected', 'selected');
|
||||
else if (id_lang == 1 && timezone_ret[i].getAttribute('value') == 'Europe/Paris') /* France */
|
||||
html = html + ' selected="selected" ';
|
||||
else if (id_lang == 2 && timezone_ret[i].getAttribute('value') == 'Europe/Madrid') /* Spain */
|
||||
html = html + ' selected="selected" ';
|
||||
else if (id_lang == 3 && timezone_ret[i].getAttribute('value') == 'Europe/Berlin') /* Germany */
|
||||
html = html + ' selected="selected" ';
|
||||
else if (id_lang == 4 && timezone_ret[i].getAttribute('value') == 'Europe/Rome') /* Italy */
|
||||
html = html + ' selected="selected" ';
|
||||
html = html + ' >'+timezone_ret[i].getAttribute("name")+'</option>';
|
||||
}
|
||||
$('#infosTimezone').html(html);
|
||||
$('#infosTimezone').append(html);
|
||||
showStep(step+1, 'next');
|
||||
}
|
||||
else
|
||||
@@ -628,25 +644,25 @@ function moveLanguage(direction)
|
||||
}
|
||||
}
|
||||
|
||||
function ajaxRefreshField(nthField, idResultField, fieldsList, inputId)
|
||||
function ajaxRefreshField(ret, idResultField, fieldMsg)
|
||||
{
|
||||
var result = fieldsList[nthField].getAttribute("result");
|
||||
if (result != "ok")
|
||||
var pattern = 'field[id='+idResultField+']';
|
||||
var result = $(ret).children().find(pattern).attr('result');
|
||||
var error = $(ret).children().find(pattern).attr('error');
|
||||
|
||||
if (error === undefined || result === undefined)
|
||||
return true;
|
||||
|
||||
if (result != 'ok')
|
||||
{
|
||||
$("#"+idResultField)
|
||||
.html( txtError[parseInt(fieldsList[nthField].getAttribute("error"))] )
|
||||
.addClass("errorBlock")
|
||||
.show("slow");
|
||||
$('#'+fieldMsg).html(txtError[parseInt(error)]).addClass('errorBlock').show('slow');
|
||||
if (validShopInfos)
|
||||
$("#"+inputId).focus();
|
||||
$('#'+idResultField).focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#"+idResultField)
|
||||
.html("")
|
||||
.removeClass("errorBlock")
|
||||
.show("slow");
|
||||
$('#'+fieldMsg).html('').removeClass('errorBlock').show('slow');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -664,7 +680,7 @@ function verifyShopInfos()
|
||||
|
||||
$.ajax(
|
||||
{
|
||||
url: "model.php",
|
||||
url: 'model.php',
|
||||
async: true,
|
||||
cache: false,
|
||||
data:
|
||||
@@ -693,21 +709,22 @@ function verifyShopInfos()
|
||||
"&isoCodeLocalLanguage="+isoCodeLocalLanguage,
|
||||
success: function(ret)
|
||||
{
|
||||
fieldsList = ret.getElementsByTagName('shopConfig')[0].getElementsByTagName('field');
|
||||
validShopInfos = true;
|
||||
if (!ajaxRefreshField(0, "resultInfosShop", fieldsList, "infosShop")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(4, "resultInfosShop", fieldsList, "validateShop")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(1, "resultInfosFirstname", fieldsList, "infosFirstname")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(2, "resultInfosName", fieldsList, "infosName")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(3, "resultInfosEmail", fieldsList, "infosEmail")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(7, "resultInfosPassword", fieldsList, "infosPassword")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(8, "resultInfosPasswordRepeat", fieldsList, "infosPasswordRepeat")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(9, "resultInfosLanguages", fieldsList, "infosLanguages")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(11, "resultInfosSQL", fieldsList, "infosSQL")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(10, "resultInfosNotification", fieldsList, "infosNotification")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(5, "resultInfosFirstname", fieldsList, "validateFirstname")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(6, "resultInfosName", fieldsList, "validateName")) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(12, "resultCatalogMode", fieldsList, "validateCatalogMode")) validCatalogMode = false;
|
||||
if (!ajaxRefreshField(ret, 'infosShop', 'resultInfosShop')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosCountry', 'resultInfosCountry')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosTimezone', 'resultInfosTimezone')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'validateShop', 'resultInfosShop')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosFirstname', 'resultInfosFirstname')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosName', 'resultInfosName')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosEmail', 'resultInfosEmail')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosPassword', 'resultInfosPassword')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosPasswordRepeat', 'resultInfosPasswordRepeat')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosLanguages', 'resultInfosLanguages')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosSQL', 'resultInfosSQL')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'infosNotification', 'resultInfosNotification')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'validateFirstname', 'resultInfosFirstname')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'validateName', 'resultInfosName')) validShopInfos = false;
|
||||
else if (!ajaxRefreshField(ret, 'validateCatalogMode', 'resultCatalogMode')) validCatalogMode = false;
|
||||
else
|
||||
{
|
||||
$('#endShopName').html($('input#infosShop').val());
|
||||
@@ -721,15 +738,10 @@ function verifyShopInfos()
|
||||
);
|
||||
}
|
||||
|
||||
function autoCheckField(idField, idResultSpan, typeVerif)
|
||||
function checkRequired(idResultSpan, resValue)
|
||||
{
|
||||
switch (typeVerif)
|
||||
if(resValue == "")
|
||||
{
|
||||
case "required" :
|
||||
$(idField).blur(function()
|
||||
{
|
||||
if($(this).val() == "")
|
||||
{
|
||||
$(idResultSpan)
|
||||
.show("slow")
|
||||
.addClass("errorBlock")
|
||||
@@ -743,7 +755,15 @@ function autoCheckField(idField, idResultSpan, typeVerif)
|
||||
.html("");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function autoCheckField(idField, idResultSpan, typeVerif)
|
||||
{
|
||||
switch (typeVerif)
|
||||
{
|
||||
case "required" :
|
||||
$(idField).blur(function() { checkRequired(idResultSpan, $(this).val()); });
|
||||
if (idField == '#infosCountry' || idField == '#infosTimezone')
|
||||
$(idField).change(function() { checkRequired(idResultSpan, $(this).val()); });
|
||||
break;
|
||||
|
||||
case "mailFormat" :
|
||||
@@ -998,6 +1018,8 @@ $(document).ready(
|
||||
//autocheck fields
|
||||
autoCheckField("#infosShop", "#resultInfosShop", "required");
|
||||
autoCheckField("#infosFirstname", "#resultInfosFirstname", "firstnameFormat");
|
||||
autoCheckField("#infosCountry", "#resultInfosCountry", "required");
|
||||
autoCheckField("#infosTimezone", "#resultInfosTimezone", "required");
|
||||
autoCheckField("#infosName", "#resultInfosName", "nameFormat");
|
||||
autoCheckField("#infosEmail", "#resultInfosEmail", "mailFormat");
|
||||
autoCheckField("#infosPassword", "#resultInfosPassword", "required");
|
||||
|
||||
+46
-26
@@ -124,10 +124,10 @@ if ($lm->getIncludeTradFilename())
|
||||
//php to js vars
|
||||
var isoCodeLocalLanguage = "<?php echo $lm->getIsoCodeSelectedLang(); ?>";
|
||||
var ps_base_uri = "<?php echo PS_BASE_URI; ?>";
|
||||
var id_lang = "<?php echo (isset($_GET['language']) ? (int)($_GET['language']) : 0); ?>";
|
||||
var id_lang = <?php echo (isset($_GET['language']) ? (int)($_GET['language']) : 0); ?>;
|
||||
|
||||
//localWords
|
||||
var Step1Title = "<?php echo lang('Welcome').' - '.sprintf(lang('PrestaShop %s Installer'), INSTALL_VERSION); ?>";
|
||||
var Step1Title = "<?php echo sprintf(lang('Welcome to the PrestaShop %s Installer'), INSTALL_VERSION); ?>";
|
||||
var step2title = "<?php echo lang('System Compatibility').' - '.sprintf(lang('PrestaShop %s Installer'), INSTALL_VERSION); ?>";
|
||||
var step3title = "<?php echo lang('System Configuration').' - '.sprintf(lang('PrestaShop %s Installer'), INSTALL_VERSION); ?>";
|
||||
var step4title = "<?php echo lang('Shop Configuration').' - '.sprintf(lang('PrestaShop %s Installer'), INSTALL_VERSION); ?>";
|
||||
@@ -268,6 +268,11 @@ if ($lm->getIncludeTradFilename())
|
||||
<div><?php echo '<span>'.lang('Contact us!').'</span><br />'.lang('+33 (0)1.40.18.30.04'); ?></div>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ((isset($_GET['language']) AND $_GET['language'] == 0) OR $lm->getIsoCodeSelectedLang() == 'en'): ?>
|
||||
<li id="phone_block" class="last">
|
||||
<div><?php echo '<span>'.lang('Contact us!').'</span><br />'.lang('+1 (888) 947-6543'); ?></div>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<div id="PrestaShopLogo">PrestaShop</div>
|
||||
@@ -311,7 +316,8 @@ if ($lm->getIncludeTradFilename())
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h2><?php echo lang('Welcome to the PrestaShop '.INSTALL_VERSION.' Installer.')?></h2>
|
||||
<h2 id="welcome-title"><?php echo lang('Welcome to the PrestaShop '.INSTALL_VERSION.' Installer.'); ?></h2>
|
||||
<script type="text/javascript">$('#welcome-title').html(Step1Title);</script>
|
||||
<p><?php echo lang('Please allow 5-15 minutes to complete the installation process.')?></p>
|
||||
<p><?php echo lang('The PrestaShop Installer will do most of the work in just a few clicks.')?><br /><?php echo lang('However, you must know how to do the following manually:')?></p>
|
||||
<ul>
|
||||
@@ -326,9 +332,9 @@ if ($lm->getIncludeTradFilename())
|
||||
<h2><?php echo lang('Choose the installer language:')?></h2>
|
||||
<form id="formSetInstallerLanguage" action="<?php $_SERVER['REQUEST_URI']; ?>" method="get">
|
||||
<ul id="langList" style="line-height: 20px;">
|
||||
<?php foreach ($lm->getAvailableLangs() as $lang): ?>
|
||||
<?php foreach ($lm->getAvailableLangs() AS $lang): ?>
|
||||
<li><input onclick="setInstallerLanguage()" type="radio" value="<?php echo $lang['id'] ?>" <?php echo ( $lang['id'] == $lm->getIdSelectedLang() ) ? "checked=\"checked\"" : '' ?> id="lang_<?php echo $lang['id'] ?>" name="language" style="vertical-align: middle; margin-right: 0;" /><label for="lang_<?php echo $lang['id'] ?>">
|
||||
<?php foreach ($lang->flags->url as $url_flag): ?>
|
||||
<?php foreach ($lang->flags->url AS $url_flag): ?>
|
||||
<img src="<?php echo $url_flag ?>" alt="<?php echo $lang['label'] ?>" style="vertical-align: middle;" />
|
||||
<?php endforeach; ?>
|
||||
<?php echo $lang['label'] ?></label></li>
|
||||
@@ -639,16 +645,20 @@ if ($lm->getIncludeTradFilename())
|
||||
<div class="field">
|
||||
<label for="infosCountry" class="aligned"><?php echo lang('Default country:'); ?></label>
|
||||
<span class="contentinput">
|
||||
<select id="infosCountry">
|
||||
</select>
|
||||
<select name="infosCountry" id="infosCountry">
|
||||
<option disabled="disabled"><?php echo lang('-- Select your country --'); ?></option>
|
||||
</select> <sup class="required">*</sup>
|
||||
</span>
|
||||
<span id="resultInfosCountry" class="result aligned"></span>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="infosTimezone" class="aligned"><?php echo lang('Shop\'s timezone:'); ?></label>
|
||||
<span class="contentinput">
|
||||
<select id="infosTimezone">
|
||||
</select>
|
||||
<select name="infosTimezone" id="infosTimezone">
|
||||
<option disabled="disabled"><?php echo lang('-- Select your timezone --'); ?></option>
|
||||
</select> <sup class="required">*</sup>
|
||||
</span>
|
||||
<span id="resultInfosTimezone" class="result aligned"></span>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="infosLogo" class="aligned logo"><?php echo lang('Shop logo'); ?> : </label>
|
||||
@@ -737,6 +747,11 @@ if ($lm->getIncludeTradFilename())
|
||||
$(".installModuleList.selected").removeClass("selected");
|
||||
if ($("#modulesList" + $('select#infosCountry option:selected').attr('rel')))
|
||||
$("#modulesList" + $('select#infosCountry option:selected').attr('rel')).addClass("selected");
|
||||
$('#benefitsBlock').show();
|
||||
if ($('div .installModuleList:visible').length == 0)
|
||||
$('#benefitsBlock').hide();
|
||||
else
|
||||
$('#benefitsBlock').show();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "./php?controller=country_to_timezone.php?country="+$("select#infosCountry option:selected").attr('rel'),
|
||||
@@ -744,6 +759,9 @@ if ($lm->getIncludeTradFilename())
|
||||
$("select#infosTimezone").val(timezone);
|
||||
}
|
||||
});
|
||||
|
||||
autoCheckField("#infosCountry", "#resultInfosCountry", "required");
|
||||
autoCheckField("#infosTimezone", "#resultInfosTimezone", "required");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -769,35 +787,36 @@ if ($lm->getIncludeTradFilename())
|
||||
$result = simplexml_load_string($content);
|
||||
if ($result->partner)
|
||||
{
|
||||
echo '
|
||||
<h2>'.lang('Additional Benefits').'</h2>
|
||||
<h3>'.lang('Exclusive offers dedicated to PrestaShop merchants').'</h3>';
|
||||
|
||||
$modulesHelpInstall = array();
|
||||
$modulesDescription = array();
|
||||
$modulesPrechecked = array();
|
||||
foreach ($result->partner as $p)
|
||||
foreach ($result->partner AS $p)
|
||||
{
|
||||
$modulesDescription[trim($p->key)] = array('name' => trim($p->label), 'logo' => trim($p->logo_medium), 'label' => getPreinstallXmlLang($p, 'label'), 'description' => getPreinstallXmlLang($p, 'description'), 'more' => getPreinstallXmlLang($p, 'more'));
|
||||
foreach ($p->country as $country_iso_code)
|
||||
foreach ($p->country AS $country_iso_code)
|
||||
$modulesHelpInstall[trim($country_iso_code)][] = trim($p->key);
|
||||
if ($p->prechecked)
|
||||
foreach ($p->prechecked as $country_iso_code)
|
||||
foreach ($p->prechecked AS $country_iso_code)
|
||||
$modulesPrechecked[trim($p->key)][trim($country_iso_code)] = 1;
|
||||
}
|
||||
echo '<table cellpadding="0" callspacing="0" border="0" class="moduleTable">
|
||||
|
||||
if (sizeof($modulesHelpInstall))
|
||||
{
|
||||
echo '
|
||||
<h2>'.lang('Additional Benefits').'</h2>
|
||||
<h3>'.lang('Exclusive offers dedicated to PrestaShop merchants').'</h3>
|
||||
<table cellpadding="0" callspacing="0" border="0" class="moduleTable">
|
||||
<tr>
|
||||
<th style="width: 30px;"></th>
|
||||
<th style="width: 100px;">Modules</th>
|
||||
<th style="padding: 12px; width: 430px;">Avantages</th>
|
||||
<th style="width: 100px;">'.lang('Modules').'</th>
|
||||
<th style="padding: 12px; width: 430px;">'.lang('Benefits').'</th>
|
||||
</tr>
|
||||
</table>
|
||||
';
|
||||
</table>';
|
||||
|
||||
foreach ($modulesHelpInstall as $country_iso_code => $modulesList)
|
||||
foreach ($modulesHelpInstall AS $country_iso_code => $modulesList)
|
||||
{
|
||||
echo '<div class="installModuleList'.($country_iso_code == 'FR' ? ' selected' : '').'" id="modulesList'.$country_iso_code.'">';
|
||||
foreach ($modulesList as $module)
|
||||
foreach ($modulesList AS $module)
|
||||
{
|
||||
echo '
|
||||
<table cellpadding="0" callspacing="0" border="0" class="moduleTable">
|
||||
@@ -881,6 +900,7 @@ if ($lm->getIncludeTradFilename())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- Partner Modules -->
|
||||
@@ -891,7 +911,7 @@ if ($lm->getIncludeTradFilename())
|
||||
|
||||
<?php echo lang('Optional languages'); ?><br/>
|
||||
<select style="width:300px;" id="aLList" multiple="multiple" size="4">
|
||||
<?php foreach ($lm->getAvailableLangs() as $lang){
|
||||
<?php foreach ($lm->getAvailableLangs() AS $lang){
|
||||
if ( $lang['id'] != $lm->getIdSelectedLang() AND $lang['id'] != "0" ){ ?>
|
||||
<option value="<?php echo $lang->idLangPS ?>"><?php echo $lang['label'] ?></option>
|
||||
<?php }} ?>
|
||||
@@ -907,7 +927,7 @@ if ($lm->getIncludeTradFilename())
|
||||
<?php echo lang('Available shop languages'); ?><br/>
|
||||
<select style="width:240px;" id="wLList" size="4">
|
||||
<option value="en">English (English)</option>
|
||||
<?php foreach ($lm->getAvailableLangs() as $lang){
|
||||
<?php foreach ($lm->getAvailableLangs() AS $lang){
|
||||
if ( $lang['id'] == $lm->getIdSelectedLang() AND $lang['id'] != "0" ){ ?>
|
||||
<option value="<?php echo $lang->idLangPS ?>"><?php echo $lang['label'] ?></option>
|
||||
<?php }} ?>
|
||||
@@ -916,7 +936,7 @@ if ($lm->getIncludeTradFilename())
|
||||
<label for="dLList"><?php echo lang('Shop\'s default language'); ?></label><br/>
|
||||
<select style="width:180px;" id="dLList">
|
||||
<option selected="selected" value="en">English (English)</option>
|
||||
<?php foreach ($lm->getAvailableLangs() as $lang){
|
||||
<?php foreach ($lm->getAvailableLangs() AS $lang){
|
||||
if ( $lang['id'] == $lm->getIdSelectedLang() AND $lang['id'] != "0" ){ ?>
|
||||
<option selected="selected" value="<?php echo $lang->idLangPS ?>"><?php echo $lang['label'] ?></option>
|
||||
<?php }} ?>
|
||||
|
||||
@@ -143,7 +143,7 @@ $_LANG['Verify system compatibility'] = 'Systemkompatibilit√§t';
|
||||
$_LANG['WARNING: For more security, you must delete the \'install\' folder.'] = 'VORSICHT: Aus Sicherheitsgründen löschen Sie bitte den Ordner \'/install\' und die readme-Dateien (readme_fr.txt, readme_en.txt, readme_es.txt, readme_de.txt, readme_it.txt, CHANGELOG).';
|
||||
$_LANG['Warning: a manual backup is HIGHLY recommended before continuing!'] = 'Vorsicht: eine manuelle Sicherung ist UNERLÄSSLICH, bevor mit der Aktualisierung der PrestaShop-Anwendung begonnen wird, um jeglichen versehentlichen Datenverlust zu verhindern';
|
||||
$_LANG['Welcome'] = 'Willkommen';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer.'] = 'Bienvenue dans l\'installation de PrestaShop %s';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer'] = 'Bienvenue dans l\'installation de PrestaShop %s';
|
||||
$_LANG['When your files and database are saving in an other support, please certify that your shop is really backed up.'] = 'Sobald die Anwendungsdateien und Ihre Datenbank gesichert sind, werden wir Sie um Bestätigung bitten. Damit übernehmen Sie die gesamte Haftung eines möglichen Datenverlusts durch die Aktualisierung der PrestaShop-Anwendung.';
|
||||
$_LANG['Write permissions on folders (and subfolders):'] = 'Schreibberechtigung für die Ordner (und deren Unterordner):';
|
||||
$_LANG['Write permissions on files and folders:'] = 'Schreibberechtigung für die Dateien und Ordner:';
|
||||
@@ -284,3 +284,5 @@ $_LANG['Additional Benefits'] = 'Exklusiv Angebot';
|
||||
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Exklusiv Angebot für die Verkäufer PrestaShop';
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'Die PHP-Option "magic quotes" ist deaktiviert (empfohlen)';
|
||||
$_LANG['Other activity...'] = 'Andere activiteit...';
|
||||
$_LANG['Modules'] = 'Módulos';
|
||||
$_LANG['Benefits'] = 'Vorteile';
|
||||
@@ -141,7 +141,7 @@ $_LANG['Verify system compatibility'] = 'Compatibilidad sistema';
|
||||
$_LANG['WARNING: For more security, you must delete the \'install\' folder.'] = 'ATENCION : para m√°s seguridad, por favor suprima la carpeta \'/install\' y los archivos readme (readme_fr.txt, readme_en.txt, readme_es.txt, readme_de.txt, readme_it.txt, CHANGELOG)..';
|
||||
$_LANG['Warning: a manual backup is HIGHLY recommended before continuing!'] = '¡Atención: se recomienda hacer una copia de seguridad manual antes de continuar!';
|
||||
$_LANG['Welcome'] = 'Bienvenido';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer.'] = 'Bienvenido a la instalación de PrestaShop %s';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer'] = 'Bienvenido a la instalación de PrestaShop %s';
|
||||
$_LANG['When your files and database are saving in an other support, please certify that your shop is really backed up.'] = 'Una vez que los archivos de aplicación y su base de datos se hayan guardado, le pediremos que los certifique. Por lo tanto, usted asume plenamente su responsabilidad por cualquier pérdida de datos debido a la actualización de la aplicación PrestaShop.';
|
||||
$_LANG['Write permissions on folders (and subfolders):'] = 'en escritura en las carpetas (y sus subcarpetas) :';
|
||||
$_LANG['Write permissions on files and folders:'] = 'Derechos en escritura en los archivos y carpetas :';
|
||||
@@ -284,3 +284,5 @@ $_LANG['Additional Benefits'] = 'Otros beneficios';
|
||||
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Ofertas exclusivas dedicadas a los comerciantes PrestaShop';
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'La opción PHP "magic quotes" está desactivada (aconsejable)';
|
||||
$_LANG['Other activity...'] = 'Otra actividad...';
|
||||
$_LANG['Modules'] = 'Módulos';
|
||||
$_LANG['Benefits'] = 'Beneficios';
|
||||
@@ -63,7 +63,7 @@ $_LANG['Installation : complete install of the PrestaShop Solution'] = 'Installa
|
||||
$_LANG['Installation is complete!'] = 'Installation terminée !';
|
||||
$_LANG['Installation method'] = 'Méthode d\'installation';
|
||||
$_LANG['Last name:'] = 'Nom :';
|
||||
$_LANG['Licenses Agreement'] = 'Contrat de Licences';
|
||||
$_LANG['Licenses Agreement'] = 'Contrat de licences';
|
||||
$_LANG['PrestaShop core is released under the OSL 3.0 while PrestaShop modules and themes are released under the AFL 3.0.'] = 'Le coeur de PrestaShop est publié sous licence OSL 3.0 tandis que les modules et thèmes sont publiés sous licence AFL 3.0.';
|
||||
$_LANG['Login:'] = 'Identifiant :';
|
||||
$_LANG['Merchant info'] = 'Informations à propos du vendeur';
|
||||
@@ -144,7 +144,7 @@ $_LANG['Verify system compatibility'] = 'Compatibilité système';
|
||||
$_LANG['WARNING: For more security, you must delete the \'install\' folder.'] = 'ATTENTION : pour plus de sécurité, merci de supprimer le dossier \'/install\' et les fichiers readme (readme_fr.txt, readme_en.txt, readme_es.txt, readme_de.txt, readme_it.txt, CHANGELOG).';
|
||||
$_LANG['Warning: a manual backup is HIGHLY recommended before continuing!'] = 'Attention : une sauvegarde manuelle est INDISPENSABLE avant de procéder à la mise à jour de l\'application PrestaShop, cela afin de prévenir toute perte de données accidentelle';
|
||||
$_LANG['Welcome'] = 'Bienvenue';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer.'] = 'Bienvenue dans l\'installation de PrestaShop %s';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer'] = 'Bienvenue dans l\'installation de PrestaShop %s';
|
||||
$_LANG['When your files and database are saving in an other support, please certify that your shop is really backed up.'] = 'Une fois que les fichiers de l\'application et votre base de données seront sauvegardés, nous vous demanderons de le certifier. De ce fait, vous assumerez l\'entière responsabilité d\'une éventuelle perte de données liée à la mise à jour de l\'application PrestaShop.';
|
||||
$_LANG['Write permissions on folders (and subfolders):'] = 'Droits en écriture sur les dossiers (et leurs sous-dossiers) :';
|
||||
$_LANG['Write permissions on files and folders:'] = 'Droits en écriture sur les fichiers et dossiers:';
|
||||
@@ -290,3 +290,5 @@ $_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Offres réservé
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'L\'option PHP "magic quotes" est désactivée (recommandé)';
|
||||
$_LANG['Dom extension loaded'] = 'L\'extension Dom est activée';
|
||||
$_LANG['Other activity...'] = 'Autre activité..';
|
||||
$_LANG['Modules'] = 'Modules';
|
||||
$_LANG['Benefits'] = 'Avantages';
|
||||
@@ -143,7 +143,7 @@ $_LANG['Verify system compatibility'] = 'Compatibilità sistema';
|
||||
$_LANG['WARNING: For more security, you must delete the \'install\' folder.'] = 'ATTENZIONE: per motivi di sicurezza, adesso devi cancellare la cartella \'install\' e i file readme (readme_fr.txt, readme_en.txt, readme_es.txt, readme_de.txt, readme_it.txt, CHANGELOG).';
|
||||
$_LANG['Warning: a manual backup is HIGHLY recommended before continuing!'] = 'Attenzione: E\' FONDAMENTALE un backup manuale prima di continuare l\'aggiornamento dell\'applicazione Prestashop, al fine di evitare la perdita accidentale di dati.';
|
||||
$_LANG['Welcome'] = 'Benvenuto';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer.'] = 'Benvenuto nell\'installazione di PrestaShop %s';
|
||||
$_LANG['Welcome to the PrestaShop %s Installer'] = 'Benvenuto nell\'installazione di PrestaShop %s';
|
||||
$_LANG['When your files and database are saving in an other support, please certify that your shop is really backed up.'] = 'Una volta salvati i tuoi file applicazione e il database, ti chiederemo di certificarlo. Così facendo, ti assumerai tutte le responsabilità per qualsiasi perdita di dati dovuti ad un aggiornamento del software PrestaShop.';
|
||||
$_LANG['Write permissions on folders (and subfolders):'] = 'Scrivi i permessi sulle cartelle (e le loro sottocartelle):';
|
||||
$_LANG['Write permissions on files and folders:'] = 'Permessi di scrittura su file e cartelle:';
|
||||
@@ -271,3 +271,5 @@ $_LANG['Additional Benefits'] = 'Ulteriori vantaggi';
|
||||
$_LANG['Exclusive offers dedicated to PrestaShop merchants'] = 'Offerte esclusivo dedicato ai venditori PrestaShop';
|
||||
$_LANG['PHP magic quotes option is off (recommended)'] = 'Opzione magic quotes PHP è disattivata (consigliato)';
|
||||
$_LANG['Other activity...'] = 'Altre attività ...';
|
||||
$_LANG['Modules'] = 'Moduli';
|
||||
$_LANG['Benefits'] = 'Vantaggi';
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once('../classes/Tools.php');
|
||||
if (!isset($_GET['language']))
|
||||
$_GET['language'] = 0;
|
||||
@@ -26,7 +27,7 @@
|
||||
{
|
||||
$varList = "";
|
||||
echo '<br clear="left" /><hr /><br clear="left" />';
|
||||
foreach ($result->field as $field)
|
||||
foreach ($result->field AS $field)
|
||||
{
|
||||
echo '<div><label class="aligned" style="float:left;width:200px;padding-left:10px;">'.getPreinstallXmlLang($field, 'label').' :</label>';
|
||||
if ($field->type == 'text' || $field->type == 'password')
|
||||
@@ -96,7 +97,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($_GET['request'] == 'send')
|
||||
{
|
||||
$stream_context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5)));
|
||||
|
||||
@@ -232,7 +232,7 @@ INSERT INTO `PREFIX_category_lang` (`id_category`, `id_lang`, `name`, `descripti
|
||||
|
||||
INSERT INTO `PREFIX_order_state` (`id_order_state`, `invoice`, `send_email`, `color`, `unremovable`, `logable`, `delivery`) VALUES
|
||||
(1, 0, 1, 'lightblue', 1, 0, 0),(2, 1, 1, '#DDEEFF', 1, 1, 0),(3, 1, 1, '#FFDD99', 1, 1, 1),(4, 1, 1, '#EEDDFF', 1, 1, 1),(5, 1, 0, '#DDFFAA', 1, 1, 1),
|
||||
(6, 0, 1, '#DADADA', 1, 0, 0),(7, 1, 1, '#FFFFBB', 1, 0, 0),(8, 0, 1, '#FFDFDF', 1, 0, 0),(9, 1, 1, '#FFD3D3', 1, 0, 0),(10, 0, 1, 'lightblue', 1, 0, 0),(11, 0, 0, 'lightblue', 1, 0, 0),(12, 0, 0, 'lightblue', 1, 0, 0);
|
||||
(6, 0, 1, '#DADADA', 1, 0, 0),(7, 1, 1, '#FFFFBB', 1, 0, 0),(8, 0, 1, '#FFDFDF', 1, 0, 0),(9, 1, 1, '#FFD3D3', 1, 0, 0),(10, 0, 1, 'lightblue', 1, 0, 0),(11, 0, 0, 'lightblue', 1, 0, 0),(12, 1, 0, '#DDEEFF', 1, 1, 0);
|
||||
|
||||
INSERT INTO `PREFIX_order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`) VALUES
|
||||
(1, 1, 'Awaiting cheque payment', 'cheque'),
|
||||
@@ -307,7 +307,7 @@ INSERT INTO `PREFIX_country` (`id_country`, `id_zone`, `iso_code`, `call_prefix`
|
||||
(6, 1, 'ES', 34, 1, 0, 1, 1, 'NNNNN', 1),(7, 1, 'FI', 358, 1, 0, 0, 1, 'NNNNN', 1),(8, 1, 'FR', 33, 1, 0, 0, 1, 'NNNNN', 1),(9, 1, 'GR', 30, 1, 0, 0, 1, 'NNNNN', 1),(10, 1, 'IT', 39, 1, 1, 0, 1, 'NNNNN', 1),
|
||||
(11, 3, 'JP', 81, 1, 1, 0, 1, 'NNN-NNNN', 1),(12, 1, 'LU', 352, 1, 0, 0, 1, 'NNNN', 1),(13, 1, 'NL', 31, 1, 0, 0, 1, 'NNNN LL', 1),(14, 1, 'PL', 48, 1, 0, 0, 1, 'NN-NNN', 1),
|
||||
(15, 1, 'PT', 351, 1, 0, 0, 1, 'NNNN NNN', 1),(16, 1, 'CZ', 420, 1, 0, 0, 1, 'NNN NN', 1),(17, 1, 'GB', 44, 1, 0, 0, 1, '', 1),(18, 1, 'SE', 46, 1, 0, 0, 1, 'NNN NN', 1),
|
||||
(19, 7, 'CH', 41, 1, 0, 0, 1, 'NNNN', 1),(20, 1, 'DK', 45, 1, 0, 0, 1, 'NNNN', 1),(21, 2, 'US', 1, 1, 1, 0, 1, 'NNNNN', 1),(22, 3, 'HK', 852, 1, 0, 0, 0, '', 1),(23, 1, 'NO', 47, 1, 0, 0, 1, 'NNNN', 1),
|
||||
(19, 7, 'CH', 41, 1, 0, 0, 1, 'NNNN', 1),(20, 1, 'DK', 45, 1, 0, 0, 1, 'NNNN', 1),(21, 2, 'US', 1, 1, 1, 0, 1, 'NNNNN', 0),(22, 3, 'HK', 852, 1, 0, 0, 0, '', 1),(23, 1, 'NO', 47, 1, 0, 0, 1, 'NNNN', 1),
|
||||
(24, 5, 'AU', 61, 1, 0, 0, 1, 'NNNN', 1),(25, 3, 'SG', 65, 1, 0, 0, 1, 'NNNNNN', 1),(26, 1, 'IE', 353, 1, 0, 0, 1, '', 1),(27, 5, 'NZ', 64, 1, 0, 0, 1, 'NNNN', 1),(28, 3, 'KR', 82, 1, 0, 0, 1, 'NNN-NNN', 1),
|
||||
(29, 3, 'IL', 972, 1, 0, 0, 1, 'NNNNN', 1),(30, 4, 'ZA', 27, 1, 0, 0, 1, 'NNNN', 1),(31, 4, 'NG', 234, 1, 0, 0, 1, '', 1),(32, 4, 'CI', 225, 1, 0, 0, 1, '', 1),(33, 4, 'TG', 228, 1, 0, 0, 1, '', 1),
|
||||
(34, 6, 'BO', 591, 1, 0, 0, 1, '', 1),(35, 4, 'MU', 230, 1, 0, 0, 1, '', 1),(36, 1, 'RO', 40, 1, 0, 0, 1, 'NNNNNN', 1),(37, 1, 'SK', 421, 1, 0, 0, 1, 'NNN NN', 1),(38, 4, 'DZ', 213, 1, 0, 0, 1, 'NNNNN', 1),
|
||||
|
||||
@@ -12,7 +12,7 @@ ALTER TABLE `PREFIX_orders` ADD INDEX `date_add`(`date_add`);
|
||||
INSERT IGNORE INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VALUES
|
||||
('PS_STOCK_MVT_REASON_DEFAULT', 3, NOW(), NOW());
|
||||
|
||||
/* PHP:add_order_state(PS_OS_WS_PAYMENT, en:Payment remotely accepted|fr:Paiement à distance accepté, 0, 0, lightblue, 1, 0, 0); */;
|
||||
/* PHP:add_order_state(PS_OS_WS_PAYMENT, en:Payment remotely accepted|fr:Paiement à distance accepté, 1, 0, #DDEEFF, 1, 1, 0); */;
|
||||
/* PHP:alter_blocklink(); */;
|
||||
/* PHP:update_module_loyalty(); */;
|
||||
/* PHP:remove_module_from_hook(blockcategories, afterCreateHtaccess); */;
|
||||
|
||||
@@ -43,11 +43,11 @@ define('__PS_BASE_URI__', Context::getContext()->shop->getBaseURI());
|
||||
function isFormValid()
|
||||
{
|
||||
global $error;
|
||||
$validInfos = true;
|
||||
|
||||
foreach ($error as $anError)
|
||||
if ($anError != '')
|
||||
$validInfos = false;
|
||||
return $validInfos;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
$error = array();
|
||||
@@ -85,6 +85,16 @@ if (isset($_GET['infosShop']) AND !Validate::isGenericName($_GET['infosShop']))
|
||||
else
|
||||
$error['validateShop'] = '';
|
||||
|
||||
if (!isset($_GET['infosCountry']) OR empty($_GET['infosCountry']))
|
||||
$error['infosCountry'] = '0';
|
||||
else
|
||||
$error['infosCountry'] = '';
|
||||
|
||||
if (!isset($_GET['infosTimezone']) OR empty($_GET['infosTimezone']))
|
||||
$error['infosTimezone'] = '0';
|
||||
else
|
||||
$error['infosTimezone'] = '';
|
||||
|
||||
if (isset($_GET['infosFirstname']) AND !Validate::isName($_GET['infosFirstname']))
|
||||
$error['validateFirstname'] = '47';
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@ class authorizeAIM extends PaymentModule
|
||||
{
|
||||
$this->name = 'authorizeaim';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '1.2';
|
||||
$this->version = '1.2.1';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->limited_countries = array('us');
|
||||
$this->need_instance = 0;
|
||||
@@ -140,7 +140,7 @@ class authorizeAIM extends PaymentModule
|
||||
|
||||
public function hookPayment($params)
|
||||
{
|
||||
if (Tools::usingSecureMode() AND Configuration::get('PS_SSL_ENABLED'))
|
||||
if (Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off'))
|
||||
{
|
||||
$invoiceAddress = new Address((int)$params['cart']->id_address_invoice);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>authorizeaim</name>
|
||||
<displayName><![CDATA[Authorize.net AIM (Advanced Integration Method)]]></displayName>
|
||||
<version><![CDATA[1.2]]></version>
|
||||
<version><![CDATA[1.2.1]]></version>
|
||||
<description><![CDATA[Receive payment with Authorize.net]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[payments_gateways]]></tab>
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
*/
|
||||
|
||||
/* Getting cookie or logout */
|
||||
/*include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/blocklayered.php');*/
|
||||
include(dirname(__FILE__).'/blocklayered.php');
|
||||
|
||||
/* Clean categoryBox before use */
|
||||
if (isset($_GET['categoryBox']) AND is_array($_GET['categoryBox']))
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
include(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
include(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/blocklayered.php');
|
||||
|
||||
if (substr(Tools::encrypt('blocklayered/index'),0,10) != Tools::getValue('token') || !Module::isInstalled('blocklayered'))
|
||||
die;
|
||||
|
||||
if(Tools::getValue('full'))
|
||||
echo BlockLayered::fullindexProcess((int)Tools::getValue('cursor'), (int)Tools::getValue('ajax'), true);
|
||||
else
|
||||
echo BlockLayered::indexProcess((int)Tools::getValue('cursor'), (int)Tools::getValue('ajax'));
|
||||
@@ -104,7 +104,7 @@ class DateOfDelivery extends Module
|
||||
|
||||
$oos = false; // For out of stock management
|
||||
foreach ($params['cart']->getProducts() as $product)
|
||||
if ($product['quantity'] <= 0 OR ($product['quantity_attribute'] <= 0 AND $product['id_product_attribute']))
|
||||
if ($product['stock_quantity'] <= 0 OR ($product['quantity_attribute'] <= 0 AND $product['id_product_attribute']))
|
||||
$oos = true;
|
||||
|
||||
$datesDelivery = array();
|
||||
|
||||
@@ -4,6 +4,7 @@ $configPath = '../../../config/config.inc.php';
|
||||
if (file_exists($configPath))
|
||||
{
|
||||
include('../../../config/config.inc.php');
|
||||
include('../../../init.php');
|
||||
include('../../../modules/ebay/ebay.php');
|
||||
if (!Tools::getValue('token') || Tools::getValue('token') != Configuration::get('EBAY_SECURITY_TOKEN'))
|
||||
die('ERROR : Invalid Token');
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
<module>
|
||||
<name>ebay</name>
|
||||
<displayName><![CDATA[eBay]]></displayName>
|
||||
<<<<<<< .working
|
||||
<version><![CDATA[1.2.1]]></version>
|
||||
=======
|
||||
<version><![CDATA[1.2.3]]></version>
|
||||
>>>>>>> .merge-right.r8342
|
||||
<description><![CDATA[Open your shop on the eBay market place !]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[market_place]]></tab>
|
||||
|
||||
@@ -59,7 +59,7 @@ class Ebay extends Module
|
||||
{
|
||||
$this->name = 'ebay';
|
||||
$this->tab = 'market_place';
|
||||
$this->version = '1.2.2';
|
||||
$this->version = '1.2.3';
|
||||
$this->author = 'PrestaShop';
|
||||
parent::__construct ();
|
||||
$this->displayName = $this->l('eBay');
|
||||
@@ -1292,6 +1292,8 @@ class Ebay extends Module
|
||||
}
|
||||
}
|
||||
$html .= '</tbody></table>';
|
||||
if (Tools::getValue('section') == 'sync')
|
||||
$html .= '<script>$(document).ready(function() { eBaySync(); });</script>';
|
||||
|
||||
if (Configuration::get('EBAY_SYNC_MODE') == 'B')
|
||||
{
|
||||
@@ -1299,10 +1301,7 @@ class Ebay extends Module
|
||||
$(document).ready(function() {
|
||||
$("#catSync").show("slow");
|
||||
$("#ebay_sync_mode2").attr("checked", true);
|
||||
';
|
||||
if (Tools::getValue('section') == 'sync')
|
||||
$html .= 'eBaySync();';
|
||||
$html .= '});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>ekomi</name>
|
||||
<displayName><![CDATA[eKomi]]></displayName>
|
||||
<version><![CDATA[1]]></version>
|
||||
<version><![CDATA[1.1]]></version>
|
||||
<description><![CDATA[Adds an eKomi block]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[advertising_marketing]]></tab>
|
||||
|
||||
@@ -37,7 +37,7 @@ class Ekomi extends Module
|
||||
{
|
||||
$this->name = 'ekomi';
|
||||
$this->tab = 'advertising_marketing';
|
||||
$this->version = 1.0;
|
||||
$this->version = 1.1;
|
||||
$this->need_instance = 0;
|
||||
|
||||
parent::__construct();
|
||||
@@ -83,9 +83,9 @@ class Ekomi extends Module
|
||||
<br class="clear"/><br />
|
||||
<label>Display block</label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_on" value="1" />
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_on" value="1" '.(Configuration::get('PS_EKOMI_DISPLAY') == 1 ? 'checked="checked"' : '').' />
|
||||
<label class="t" for="ekomi_display_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_off" value="0" checked="checked" />
|
||||
<input type="radio" name="ekomi_display" id="ekomi_display_off" value="0" '.(Configuration::get('PS_EKOMI_DISPLAY') == 0 ? 'checked="checked"' : '').' />
|
||||
<label class="t" for="ekomi_display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
|
||||
<p class="clear">'.$this->l('Show or don\'t show the block (orders will be sent to eKomi whether you choose to hide or display the block).').'</p>
|
||||
</div>
|
||||
|
||||
@@ -307,7 +307,6 @@ class importerosc extends ImportModule
|
||||
{
|
||||
$combination['association'] = array('product_attribute_combination' => array($combination['options_values_id'] => $combination['id_product_attribute']));
|
||||
unset($combination['options_values_price']);
|
||||
unset($combination['options_values_id']);
|
||||
}
|
||||
return $this->autoFormat($combinations, $identifier);
|
||||
}
|
||||
@@ -454,6 +453,34 @@ class importerosc extends ImportModule
|
||||
|
||||
}
|
||||
|
||||
public function displayConfigConnector()
|
||||
{
|
||||
$content = '<label>'.$this->l('Server').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="server" id="server" value="">
|
||||
<p>'.$this->l('(eg : mysql.mydomain.com)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('User').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="user" id="user" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Password').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="password" name="password" id="password" value="">
|
||||
<p>'.$this->l('(password can be empty)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Database').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="database" id="database" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Database prefix').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="prefix" id="prefix" value="">
|
||||
<p>'.$this->l('(The prefix is optional. If all of your database tables start with "pref_", your prefix is "pref_")').'</p>
|
||||
</div>';
|
||||
return $content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -275,7 +275,6 @@ class MRCreateTickets implements IMondialRelayWSMethod
|
||||
|
||||
$this->_fields['list']['Enseigne']['value'] = Configuration::get('MR_ENSEIGNE_WEBSERVICE');
|
||||
$this->_fields['list']['Expe_Langage']['value'] = Configuration::get('MR_LANGUAGE');
|
||||
var_dump(Configuration::get('MR_LANGUAGE'));
|
||||
$this->_fields['list']['Expe_Ad1']['value'] = Configuration::get('PS_MR_SHOP_NAME');
|
||||
$this->_fields['list']['Expe_Ad3']['value'] = Configuration::get('PS_SHOP_ADDR1');
|
||||
// Deleted, cause to many failed for the process
|
||||
|
||||
@@ -32,10 +32,17 @@ class MRTools
|
||||
{
|
||||
static public function replaceAccentedCharacters($string)
|
||||
{
|
||||
if (function_exists('iconv'))
|
||||
{
|
||||
$currentLocale = setlocale(LC_ALL, NULL);
|
||||
setlocale(LC_ALL, 'en_US.UTF8');
|
||||
$cleanedString = iconv('UTF-8','ASCII//TRANSLIT', $string);
|
||||
setLocale(LC_ALL, $currentLocale);
|
||||
}
|
||||
else
|
||||
$cleanedString = strtr($string,
|
||||
'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ',
|
||||
'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY');
|
||||
return $cleanedString;
|
||||
}
|
||||
|
||||
@@ -48,8 +55,9 @@ class MRTools
|
||||
FROM `'._DB_PREFIX_.'country`
|
||||
WHERE `id_country` = '.(int)$id_country);
|
||||
|
||||
// Skip the cheking format if doesn't exist
|
||||
if (!$zipcodeFormat)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
$regxMask = str_replace(
|
||||
array('N', 'C', 'L'),
|
||||
@@ -64,4 +72,4 @@ class MRTools
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -277,11 +277,12 @@ tr.PS_MRSelectedCarrier > td
|
||||
|
||||
.PS_MRFloatRelayPointSelected a.PS_MRSelectRelayPointButton
|
||||
{
|
||||
font-size: 10px;
|
||||
float:right;
|
||||
display: block;
|
||||
width: 60px;
|
||||
height: 20px;
|
||||
padding: 6px 20px 0px 25px;
|
||||
padding: 7px 20px 0px 25px;
|
||||
text-decoration: none;
|
||||
margin-top: 8px;
|
||||
color:#333333;
|
||||
@@ -313,4 +314,15 @@ div.PS_MRGmapStyle
|
||||
div#PS_MRPersonalizedFields
|
||||
{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
.clearfix:before,
|
||||
.clearfix:after
|
||||
{
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
overflow: hidden
|
||||
}
|
||||
.clearfix:after {clear: both}
|
||||
.clearfix {zoom: 1}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>paypal</name>
|
||||
<displayName><![CDATA[PayPal]]></displayName>
|
||||
<version><![CDATA[2.8]]></version>
|
||||
<version><![CDATA[2.8.1]]></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>
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<input type="hidden" name="paymentaction" value="{$paymentaction}" />
|
||||
{if $header != NULL}
|
||||
<input type="hidden" name="cpp_header_image" value="{$header}" />
|
||||
<input type="hidden" name="logoImage" value="{$header}" />
|
||||
{/if}
|
||||
<input type="hidden" name="template" value="{$template}" />
|
||||
<input type="hidden" name="rm" value="2" />
|
||||
|
||||
@@ -40,7 +40,7 @@ class PayPal extends PaymentModule
|
||||
{
|
||||
$this->name = 'paypal';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '2.8';
|
||||
$this->version = '2.8.1';
|
||||
|
||||
$this->currencies = true;
|
||||
$this->currencies_mode = 'radio';
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{if count($categoryProducts) > 0}
|
||||
{if count($categoryProducts) > 0 && $categoryProducts !== false}
|
||||
<h2 class="productscategory_h2">{$categoryProducts|@count} {l s='other products in the same category:' mod='productscategory'}</h2>
|
||||
<div id="{if count($categoryProducts) > 5}productscategory{else}productscategory_noscroll{/if}">
|
||||
{if count($categoryProducts) > 5}<a id="productscategory_scroll_left" title="{l s='Previous' mod='productscategory'}" href="javascript:{ldelim}{rdelim}">{l s='Previous' mod='productscategory'}</a>{/if}
|
||||
|
||||
@@ -20,6 +20,10 @@ $database = Tools::getValue('database');
|
||||
$prefix = Tools::getValue('prefix');
|
||||
$save = Tools::getValue('save');
|
||||
|
||||
$url = Tools::getValue('url');
|
||||
$loginws = Tools::getValue('loginws');
|
||||
$apikey = Tools::getValue('apikey');
|
||||
|
||||
if (Tools::isSubmit('checkAndSaveConfig'))
|
||||
{
|
||||
//cleans the database if an import has already been done
|
||||
@@ -69,6 +73,35 @@ if (Tools::isSubmit('getData') || Tools::isSubmit('syncLang') || Tools::isSubmit
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('getDataWS') || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrencyWS'))
|
||||
{
|
||||
if (Tools::isSubmit('syncLangWS'))
|
||||
$save = true;
|
||||
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
|
||||
try
|
||||
{
|
||||
$importModule = new $moduleName();
|
||||
$importModule->connect($url,$loginws,$apikey);
|
||||
|
||||
if (!method_exists($importModule, $getMethod))
|
||||
die('{"hasError" : true, "error" : ["not_exist"], "datas" : []}');
|
||||
else
|
||||
{
|
||||
$return = call_user_func_array(array($importModule, $getMethod), array($limit, $nbr_import));
|
||||
$shopImporter = new shopImporter();
|
||||
$shopImporter->generiqueImport($className, $return, (bool)$save);
|
||||
}
|
||||
die('{"hasError" : false, "error" : []}');
|
||||
} catch (Exception $e)
|
||||
{
|
||||
die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('truncatTable'))
|
||||
{
|
||||
@@ -114,6 +147,43 @@ if (Tools::isSubmit('displaySpecificOptions'))
|
||||
die(Tools::displayError('Link to database cannot be established.'));
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('displaySpecificOptionsWsdl'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$importModule = new $moduleName();
|
||||
|
||||
try
|
||||
{
|
||||
if (method_exists($importModule, 'displaySpecificOptions'))
|
||||
die($importModule->displaySpecificOptions());
|
||||
else
|
||||
die('not_exist');
|
||||
} catch (Exception $e)
|
||||
{
|
||||
die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('connexionWs'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
try
|
||||
{
|
||||
|
||||
$importModule = new $moduleName();
|
||||
$importModule->connect($url,$loginws,$apikey);
|
||||
die('{"hasError" : false, "error" : []}');
|
||||
} catch (Exception $e)
|
||||
{
|
||||
die('{"hasError" : true, "error" : ['.json_encode($e->getMessage()).'], "datas" : []}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('validateSpecificOptions'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
@@ -126,5 +196,16 @@ if (Tools::isSubmit('validateSpecificOptions'))
|
||||
die($importModule->validateSpecificOptions());
|
||||
}
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('displayConfigConnector'))
|
||||
{
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$importModule = new $moduleName();
|
||||
if (!method_exists($importModule, 'displayConfigConnector'))
|
||||
die('{"hasError" : true, "error" : ["not_exist"]}');
|
||||
else
|
||||
die($importModule->displayConfigConnector());
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -6,6 +6,9 @@ var shopImporter = {
|
||||
password: $('#password').val(),
|
||||
database: $('#database').val(),
|
||||
prefix: $('#prefix').val(),
|
||||
url: $('#url').val(),
|
||||
loginws: $('#loginws').val(),
|
||||
apikey: $('#apikey').val(),
|
||||
specificOptions : '',
|
||||
imagesOptions : '',
|
||||
output : 1,
|
||||
@@ -22,6 +25,37 @@ var shopImporter = {
|
||||
srcDelete : '../modules/shopimporter/img/delete.gif',
|
||||
|
||||
|
||||
syncLangWS : function (onComplete)
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'ajax=true&syncLangWS&getMethod=getLangagues&token='+this.token+'&className=Language&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&nbr_import='+this.nbr_import ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#steps').html('<div id="lang_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">'+jsonData.error+'</div>');
|
||||
$('#lang_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
else
|
||||
onComplete(true);
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<div id="technical_error_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">TECHNICAL ERROR<br><br>Details: '+XMLHttpRequest.responseText+'</div>');
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
syncLang : function (onComplete)
|
||||
{
|
||||
$.ajax({
|
||||
@@ -51,6 +85,36 @@ var shopImporter = {
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
syncCurrencyWS : function (onComplete)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'ajax=true&token='+this.token+'&syncCurrencyWS&getMethod=getCurrencies&className=Currency&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&nbr_import='+this.nbr_import ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#steps').html('<div id="currency_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">'+jsonData.error+'</div>');
|
||||
$('#currency_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
else
|
||||
onComplete(true);
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<div id="technical_error_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">TECHNICAL ERROR<br><br>Details: '+XMLHttpRequest.responseText+'</div>');
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
onComplete(false);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
syncCurrency : function (onComplete)
|
||||
{
|
||||
@@ -81,6 +145,78 @@ var shopImporter = {
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
checkAndSaveConfigWSDL : function (onComplete)
|
||||
{
|
||||
$('#checkAndSaveConfig').fadeOut('slow');
|
||||
$('#steps').html($('#steps').html()+'<div id="database_feedback" style="display:none;" class="conf"><img src="'+shopImporter.srcConf+'">'+wsOk+'</div>');
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="submit" name="next" id="next" class="button" value="'+testImport+'">');
|
||||
$('#next').fadeIn('slow', function () {
|
||||
$('#next').unbind('click').click(function(){
|
||||
$('#next').fadeOut('fast', function() {
|
||||
shopImporter.nbrMethod = conf.length;
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
$('#database_feedback').fadeIn('slow');
|
||||
|
||||
},
|
||||
checkAndSaveConfigWS : function (save)
|
||||
{
|
||||
|
||||
//sync languages and currency
|
||||
this.syncLangWS(function(isOk) {
|
||||
if (isOk)
|
||||
{
|
||||
shopImporter.syncCurrencyWS(function(isOk) {
|
||||
if (isOk)
|
||||
{
|
||||
|
||||
if ($('#technical_error_feedback').length)
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
|
||||
|
||||
$('#checkAndSaveConfig').fadeOut('slow');
|
||||
$('#steps').html($('#steps').html()+'<div id="database_feedback" style="display:none;" class="conf"><img src="'+shopImporter.srcConf+'">'+databaseOk+'</div>');
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="submit" name="next" id="next" class="button" value="'+testImport+'">');
|
||||
$('#database_feedback').fadeIn('slow', function() {
|
||||
if (save)
|
||||
{
|
||||
shopImporter.idMethod = 0;
|
||||
shopImporter.limit = 0;
|
||||
shopImporter.nbrMethod = conf.length;
|
||||
$('.truncateTable:checked').each(function (){
|
||||
shopImporter.truncatTable(this.id, 'add');
|
||||
});
|
||||
|
||||
if($('#truncat_feedback').length != 0)
|
||||
$('#truncat_feedback').removeClass('import').addClass('conf');
|
||||
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#next').fadeIn('slow', function () {
|
||||
$('#next').unbind('click').click(function(){
|
||||
$('#next').fadeOut('fast', function() {
|
||||
shopImporter.nbrMethod = conf.length;
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
checkAndSaveConfig : function (save)
|
||||
{
|
||||
@@ -158,6 +294,123 @@ var shopImporter = {
|
||||
|
||||
},
|
||||
|
||||
getDatasWS : function (methodName)
|
||||
{
|
||||
//check if method have to be call
|
||||
if (shopImporter.idMethod >= shopImporter.nbrMethod)
|
||||
shopImporter.displayEnd(false);
|
||||
else if ($('input[name='+methodName[0]+']:radio:checked').val() == 0)
|
||||
{
|
||||
shopImporter.idMethod ++;
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
return;
|
||||
}
|
||||
if (typeof(methodName) != 'undefined')
|
||||
{
|
||||
|
||||
$('#steps').html($('#steps').html()+'<div id="ok_feedback_'+methodName[0]+'" style="display:none;" class="import"><img src="'+this.srcImport+'">'+methodName[1]+'<span id="display_error_'+methodName[0]+'" style="display:none"><span><div id="feedback_'+methodName[0]+'_errors_list"></div></div>');
|
||||
$('#ok_feedback_'+methodName[0]).css('display', '');
|
||||
|
||||
$('#checkAndSaveConfig').fadeIn('slow');
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: true,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
//data: 'ajax=true&token='+this.token+'&getData&className='+methodName[2]+'&getMethod='+methodName[0]+'&moduleName='+this.moduleName+'&server='+this.server+'&user='+this.user+'&password='+this.password+'&database='+this.database+'&prefix='+prefix+'&limit='+this.limit+'&nbr_import='+this.nbr_import+'&save='+this.save+'&errors='+this.errors+'&hasErrors='+this.hasErrors+this.specificOptions+this.imagesOptions ,
|
||||
|
||||
|
||||
data: 'ajax=true&token='+this.token+'&getDataWS&className='+methodName[2]+'&getMethod='+methodName[0]+'&moduleName='+this.moduleName+'&url='+this.url+'&loginws='+this.loginws+'&apikey='+this.apikey+'&limit='+this.limit+'&nbr_import='+this.nbr_import+'&save='+this.save+'&errors='+this.errors+'&hasErrors='+this.hasErrors+this.specificOptions+this.imagesOptions ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
var jsonError;
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
jsonError = '';
|
||||
if (jsonData.error == 'not_exist')
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('conf').addClass(function() {
|
||||
$('#ok_feedback_'+methodName[0]).html('<img src="'+shopImporter.srcWarn+'">'+methodName[1]+' '+notExist);
|
||||
return 'warn';
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0;i<jsonData.error.length;i++)
|
||||
jsonError = jsonError+'<li>Id : '+jsonData.error[i]+'</li>';
|
||||
|
||||
if ($('#display_error_'+methodName[0]+'_link').length == 0)
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).html($('#ok_feedback_'+methodName[0]).html()+'<span id="display_error_'+methodName[0]+'" style="float:right;"><a id="display_error_'+methodName[0]+'_link" class="display_error_link" rel="'+methodName[0]+'" href="#" onclick="enableShowErrors(\''+methodName[0]+'\'); return false;">'+showErrors+'(<span id="nbr_errors_'+methodName[0]+'">'+jsonData.error.length+'</span>)'+'</a></span><div style="display:none;" id="feedback_'+methodName[0]+'_errors_list"><ul>'+jsonError+'</ul></div>');
|
||||
}
|
||||
else
|
||||
{
|
||||
var nbrErrors = $('#nbr_errors_'+methodName[0]).html();
|
||||
var newNbrError = parseInt(jsonData.error.length) + parseInt(nbrErrors);
|
||||
$('#nbr_errors_'+methodName[0]).html(newNbrError);
|
||||
$('#feedback_'+methodName[0]+'_errors_list > ul').html($('#feedback_'+methodName[0]+'_errors_list > ul').html() + jsonError);
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonData.datas.length != parseInt(shopImporter.nbr_import))
|
||||
{
|
||||
if ($('#display_error_'+methodName[0]+'_link').length != 0)
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() {
|
||||
$('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError);
|
||||
return 'error';
|
||||
});
|
||||
shopImporter.idMethod ++;
|
||||
shopImporter.limit = 0;
|
||||
}
|
||||
else
|
||||
shopImporter.limit += parseInt(shopImporter.nbr_import);
|
||||
if ((shopImporter.idMethod < shopImporter.nbrMethod))
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
else
|
||||
shopImporter.displayEnd(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (jsonData.datas.length != parseInt(shopImporter.nbr_import))
|
||||
{
|
||||
if ($('#display_error_'+methodName[0]+'_link').length != 0)
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('import').addClass( function() {
|
||||
$('#ok_feedback_'+methodName[0]+' >img:first').attr('src', shopImporter.srcError);
|
||||
return 'error';
|
||||
});
|
||||
}else
|
||||
{
|
||||
$('#ok_feedback_'+methodName[0]).removeClass('import').addClass('conf');
|
||||
$('#ok_feedback_'+methodName[0]+'>img:first').attr('src', shopImporter.srcConf);
|
||||
}
|
||||
shopImporter.idMethod ++;
|
||||
shopImporter.limit = 0;
|
||||
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shopImporter.idMethod < shopImporter.nbrMethod)
|
||||
{
|
||||
shopImporter.limit += parseInt(shopImporter.nbr_import);
|
||||
shopImporter.getDatasWS(conf[shopImporter.idMethod]);
|
||||
}
|
||||
else
|
||||
shopImporter.displayEnd(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<div id="technical_error_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">TECHNICAL ERROR<br><br>Details: '+XMLHttpRequest.responseText+'</div>');
|
||||
$('#technical_error_feedback').fadeIn('slow');
|
||||
$('#checkAndSaveConfig').fadeIn('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
getDatas : function (methodName)
|
||||
{
|
||||
//check if method have to be call
|
||||
@@ -336,13 +589,17 @@ var shopImporter = {
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="submit" name="submitImport" id="submitImport" class="button" value="'+runImport+'">');
|
||||
|
||||
$('#steps').html($('#steps').html()+'<input style="display:none" type="button" name="submitImport" id="submitImport" class="button" value="'+runImport+'">');
|
||||
$('#submitImport').fadeIn('slow', function() {
|
||||
$(this).unbind('click').click(function() {
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
onAfter:function(){
|
||||
$('#steps').html('');
|
||||
shopImporter.save = 1;
|
||||
if($('#import_module_name').attr('value') == 'importermagento')
|
||||
shopImporter.checkAndSaveConfigWS(shopImporter.save);
|
||||
else if ($('#import_module_name').attr('value') == 'importerosc')
|
||||
shopImporter.checkAndSaveConfig(shopImporter.save);
|
||||
}
|
||||
});
|
||||
@@ -388,6 +645,7 @@ function displaySpecificOptions(moduleName, server, user, password, database, pr
|
||||
{
|
||||
$('#specificOptionsContent').html(htmlData);
|
||||
$('#specificOptions').show();
|
||||
$('#importOptions').show();
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
@@ -396,6 +654,69 @@ function displaySpecificOptions(moduleName, server, user, password, database, pr
|
||||
}
|
||||
});
|
||||
}
|
||||
function initConnexion (moduleName, url, loginws, apikey, token)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'ajax=true&token='+token+'&connexionWs&moduleName='+moduleName+'&url='+ url+'&loginws='+loginws+'&apikey='+apikey ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
var jsonError = '';
|
||||
$('#connectionInformation').removeAttr('style');
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#connectionInformation').attr("style","width: 400px;background-color: #FAE2E3;border: 1px solid #EC9B9B");
|
||||
for (i=0;i<jsonData.error.length;i++)
|
||||
jsonError = jsonError+'<li>'+jsonData.error[i]+'</li>';
|
||||
$('#connectionInformation').slideDown('slow');
|
||||
$('#connectionInformation').html('<ul>'+jsonError+'</ul>');
|
||||
$('#connectionInformation').show();
|
||||
}else
|
||||
{
|
||||
|
||||
$('#connectionInformation').attr("style","width: 400px;background-color: #DFFAD3;border: 1px solid #72CB67");
|
||||
$('#connectionInformation').slideDown('slow');
|
||||
$('#connectionInformation').html('<ul>Connection successful</ul>');
|
||||
$('#connectionInformation').show();
|
||||
$('#importOptions').show();
|
||||
displaySpecificOptionsWsdl(moduleName, token);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function displaySpecificOptionsWsdl(moduleName,token)
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "html",
|
||||
data: 'ajax=true&token='+token+'&displaySpecificOptionsWsdl&moduleName='+moduleName ,
|
||||
success: function(htmlData)
|
||||
{
|
||||
$('#specificOptionsContent').html(htmlData);
|
||||
$('#specificOptions').show();
|
||||
$('#displayOptions').hide();
|
||||
$('#importOptions').show();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
function validateSpecificOptions(moduleName, specificOptions)
|
||||
{
|
||||
$.ajax({
|
||||
@@ -428,9 +749,51 @@ function validateSpecificOptions(moduleName, specificOptions)
|
||||
return true;
|
||||
}
|
||||
|
||||
//init configuration connector (database or webservice)
|
||||
function initConfigConnector()
|
||||
{
|
||||
if($('#choose_module_name').attr('value'))
|
||||
{
|
||||
$('#db_config').hide();
|
||||
$('#importOptions').hide();
|
||||
$('#steps').html('');
|
||||
|
||||
if ($('#import_module_name').attr('value') != 0)
|
||||
{
|
||||
$('#displayOptions').show();
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "html",
|
||||
|
||||
data: 'ajax=true&token='+globalAjaxShopImporterToken+'&displayConfigConnector&moduleName='+$('#import_module_name').val() ,
|
||||
success: function(html)
|
||||
{
|
||||
$('#config_connector').html(html);
|
||||
$('#config_connector').show();
|
||||
$('#db_config').slideDown('slow');
|
||||
$('#displayOptions').show();
|
||||
$('#checkAndSaveConfig').show();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#db_config').slideUp('slow');
|
||||
$('#checkAndSaveConfig').show();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#displayOptions').hide();
|
||||
$('#db_input input').each(function () {
|
||||
$(this).keyup(function () {
|
||||
$('#steps').fadeOut(200, function () {
|
||||
@@ -454,26 +817,31 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
$('#choose_module_name').unbind('click').click(function(){
|
||||
$('#db_config').hide();
|
||||
$('#importOptions').hide();
|
||||
$('#steps').html('');
|
||||
if ($('#import_module_name').attr('value') != 0)
|
||||
{
|
||||
$('#db_config').slideDown('slow');
|
||||
$('#displayOptions').show();
|
||||
$('#checkAndSaveConfig').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#db_config').slideUp('slow');
|
||||
$('#checkAndSaveConfig').show();
|
||||
}
|
||||
return false;
|
||||
initConfigConnector();
|
||||
});
|
||||
|
||||
$('#displayOptions').unbind('click').click(function(){
|
||||
$(this).fadeOut('slow');
|
||||
$('#importOptions').slideDown('slow');
|
||||
$('#displayOptions').show();
|
||||
if($('#import_module_name').attr('value') == 'importermagento')
|
||||
{
|
||||
if($('#loginws').val() == '' || $('#apikey').val() == '' || $('#url').val() == '')
|
||||
{
|
||||
$('#connectionInformation').slideDown('slow');
|
||||
$('#connectionInformation').html('Url wsdl, User name,API key are required fields');
|
||||
$('#connectionInformation').show();
|
||||
return false;
|
||||
}else{
|
||||
$('#connectionInformation').hide();
|
||||
|
||||
|
||||
}
|
||||
token = globalAjaxShopImporterToken;
|
||||
initConnexion($('#import_module_name').val(), $('#url').val(), $('#loginws').val(), $('#apikey').val(), token);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if ($('#import_module_name').attr('value') == 'importerosc')
|
||||
{
|
||||
moduleName = $('#import_module_name').val();
|
||||
server = $('#server').val();
|
||||
user = $('#user').val();
|
||||
@@ -482,6 +850,10 @@ $(document).ready(function(){
|
||||
prefix = $('#prefix').val();
|
||||
token = globalAjaxShopImporterToken;
|
||||
displaySpecificOptions(moduleName, server, user, password, database, prefix, token);
|
||||
}
|
||||
$(this).fadeOut('slow');
|
||||
$('#importOptions').slideDown('slow');
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -499,6 +871,8 @@ $(document).ready(function(){
|
||||
moduleName = $('#import_module_name').val();
|
||||
if (validateSpecificOptions(moduleName, shopImporter.specificOptions) == true)
|
||||
{
|
||||
if($('#import_module_name').attr('value') == 'importermagento')
|
||||
{
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
onAfter:function(){
|
||||
shopImporter.specificOptions = '';
|
||||
@@ -509,7 +883,33 @@ $(document).ready(function(){
|
||||
shopImporter.limit = 0;
|
||||
shopImporter.nbr_import = parseInt($('#nbr_import').val());
|
||||
shopImporter.save = 0;
|
||||
|
||||
shopImporter.moduleName = $('#import_module_name').val();
|
||||
shopImporter.url = $('#url').val();
|
||||
shopImporter.loginws = $('#loginws').val();
|
||||
shopImporter.apikey = $('#apikey').val();
|
||||
|
||||
shopImporter.token = globalAjaxShopImporterToken;
|
||||
shopImporter.hasErrors = $('input[name=hasErrors]:radio:checked').val();
|
||||
|
||||
shopImporter.checkAndSaveConfigWS(shopImporter.save);
|
||||
shopImporter.checkAndSaveConfigWSDL();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}else if ($('#import_module_name').attr('value') == 'importerosc')
|
||||
{
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
onAfter:function(){
|
||||
shopImporter.specificOptions = '';
|
||||
$('#specificOptionsContent :input').each(function (){
|
||||
shopImporter.specificOptions = shopImporter.specificOptions+'&'+$(this).attr('name')+'='+$(this).attr('value');
|
||||
});
|
||||
shopImporter.idMethod = 0;
|
||||
shopImporter.limit = 0;
|
||||
shopImporter.nbr_import = parseInt($('#nbr_import').val());
|
||||
shopImporter.save = 0;
|
||||
shopImporter.moduleName = $('#import_module_name').val();
|
||||
shopImporter.server = $('#server').val();
|
||||
shopImporter.user = $('#user').val();
|
||||
shopImporter.password = $('#password').val();
|
||||
@@ -522,6 +922,7 @@ $(document).ready(function(){
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ class shopimporter extends ImportModule
|
||||
'table' => 'product',
|
||||
'identifier' => 'id_product',
|
||||
'alterTable' => array('id_product' => 'int(10)'),
|
||||
'foreign_key' => array('id_category'),
|
||||
'foreign_key' => array('id_category', 'id_manufacturer'),
|
||||
'delete' => true,
|
||||
'association' => array(
|
||||
array(
|
||||
@@ -306,6 +306,7 @@ class shopimporter extends ImportModule
|
||||
|
||||
$html .= ' var notExist = "'.$this->l('is not available in this module').'";
|
||||
var databaseOk = "'.$this->l('Connection to the database OK').'";
|
||||
var wsOk = "'.$this->l('Connection to the web service OK').'";
|
||||
var showErrors = "'.$this->l('Show errors').'";
|
||||
var testImport = "'.$this->l('Test import process').'";
|
||||
var runImport = "'.$this->l('Run Import').'";
|
||||
@@ -343,33 +344,9 @@ class shopimporter extends ImportModule
|
||||
else
|
||||
$html .= '<div class="warn" ><img src="../img/admin/warn2.png">'.$this->l('No import module installed').'</div>';
|
||||
$html .= '
|
||||
<div id="db_config" style="display:none;width:420px;padding-right:20px">
|
||||
<div id="db_input">
|
||||
<label>'.$this->l('Server').' : </label>
|
||||
<div style="display:none;" class="error" id="connectionInformation"></div>
|
||||
<div id="config_connector"></div>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="server" id="server" value="">
|
||||
<p>'.$this->l('(eg : mysql.mydomain.com)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('User').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="text" name="user" id="user" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Password').' : </label>
|
||||
<div class="margin-form">
|
||||
<input type="password" name="password" id="password" value="">
|
||||
<p>'.$this->l('(password can be empty)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Database').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="database" id="database" value="">
|
||||
</div>
|
||||
<label>'.$this->l('Database prefix').' : </label>
|
||||
<div class="margin-form" style="">
|
||||
<input type="text" name="prefix" id="prefix" value="">
|
||||
<p>'.$this->l('(The prefix is optional. If all of your database tables start with "pref_", your prefix is "pref_")').'</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" name="displayOptions" id="displayOptions" class="button" value="'.$this->l('Next Step').'">
|
||||
</div>
|
||||
<hr>
|
||||
@@ -469,7 +446,7 @@ class shopimporter extends ImportModule
|
||||
$importModule->prefix = Tools::getValue('prefix');
|
||||
$defaultLanguage = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
$languages = $importModule->getLangagues(0);
|
||||
if (Tools::isSubmit('syncLang'))
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
$defaultIdLand = $importModule->getDefaultIdLang();
|
||||
$defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code']));
|
||||
@@ -478,7 +455,7 @@ class shopimporter extends ImportModule
|
||||
'.$importModule->displayName.' : '.$defaultLanguageImport->name.'<br>'.$this->l('Please change default language in your configuration');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('syncCurrency'))
|
||||
if (Tools::isSubmit('syncCurrency') OR Tools::isSubmit('syncCurrencyWS'))
|
||||
{
|
||||
$defaultIdCurrency = $importModule->getDefaultIdCurrency();
|
||||
$currencies = $importModule->getCurrencies(0);
|
||||
@@ -522,12 +499,15 @@ class shopimporter extends ImportModule
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
if ($save OR Tools::isSubmit('syncLang'))
|
||||
//die('');
|
||||
if ($save OR Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
|
||||
//add language if not exist in prestashop
|
||||
if ($className == 'Language')
|
||||
{
|
||||
if (Tools::isSubmit('syncLang'))
|
||||
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
$add = true;
|
||||
else
|
||||
$add = false;
|
||||
@@ -560,7 +540,134 @@ class shopimporter extends ImportModule
|
||||
}
|
||||
die(Tools::jsonEncode($json));
|
||||
}
|
||||
public function generiqueImportWS($className, $fields, $save = false)
|
||||
{
|
||||
|
||||
$return = '';
|
||||
$json = array();
|
||||
$errors = array();
|
||||
$json['hasError'] = false;
|
||||
$json['datas'] = array_values($fields);
|
||||
$languages = array();
|
||||
$defaultLanguage = '';
|
||||
$table = $this->supportedImports[strtolower($className)]['table'];
|
||||
|
||||
$object = new $className();
|
||||
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
|
||||
|
||||
if ((sizeof($rules['requiredLang']) OR sizeof($rules['sizeLang']) OR sizeof($rules['validateLang']) OR Tools::isSubmit('syncLangWS') OR Tools::isSubmit('syncCurrency')))
|
||||
{
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
{
|
||||
|
||||
require_once('../../modules/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$importModule = new $moduleName();
|
||||
/* $importModule->server = Tools::getValue('server');
|
||||
$importModule->user = Tools::getValue('user');
|
||||
$importModule->passwd = Tools::getValue('password');
|
||||
$importModule->database = Tools::getValue('database');
|
||||
$importModule->prefix = Tools::getValue('prefix');
|
||||
*/
|
||||
|
||||
$defaultLanguage = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
||||
|
||||
$languages = $importModule->getLangagues();
|
||||
|
||||
if (Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
$defaultIdLand = $importModule->getDefaultIdLang();
|
||||
$defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code']));
|
||||
if ($defaultLanguage->iso_code != $defaultLanguageImport->iso_code)
|
||||
$errors[] = $this->l('Default language doesn\'t match : ').'<br>'.Configuration::get('PS_SHOP_NAME').' : '.$defaultLanguage->name.' ≠
|
||||
'.$importModule->displayName.' : '.$defaultLanguageImport->name.'<br>'.$this->l('Please change default language in your configuration');
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('syncCurrency'))
|
||||
{
|
||||
$defaultIdCurrency = $importModule->getDefaultIdCurrency();
|
||||
$currencies = $importModule->getCurrencies();
|
||||
if (!empty($currencies[$defaultIdCurrency]['iso_code']))
|
||||
$defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCode($currencies[$defaultIdCurrency]['iso_code']));
|
||||
else
|
||||
$defaultCurrencyImport = new Currency((int)Currency::getIdByIsoCodeNum($currencies[$defaultIdCurrency]['iso_code_num']));
|
||||
|
||||
$defaultCurrency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
|
||||
if ($defaultCurrency->iso_code != $defaultCurrencyImport->iso_code)
|
||||
$errors[] = $this->l('Default currency doesn\'t match : ').'<br>'.Configuration::get('PS_SHOP_NAME').' : '.$defaultCurrency->name.' ≠ '.$importModule->displayName.' : '.$defaultCurrencyImport->name.'<br>'.$this->l('Please change default currency in your configuration');
|
||||
}
|
||||
if (!empty($errors))
|
||||
die('{"hasError" : true, "error" : '.Tools::jsonEncode($errors).'}');
|
||||
}
|
||||
else
|
||||
die('{"hasError" : true, "error" : ["FATAL ERROR"], "datas" : []}');
|
||||
}
|
||||
|
||||
foreach($fields as $key => $field)
|
||||
{
|
||||
$id = $this->supportedImports[strtolower($className)]['identifier'];
|
||||
//remove wrong fields (ex : id_toto in Customer)
|
||||
foreach($field as $name => $value)
|
||||
if (!array_key_exists($name, get_object_vars($object)) AND ($name != $id) AND ($name != 'association') AND ($name != 'images') AND (strtolower($className) != 'cart'))
|
||||
unset($field[$name]);
|
||||
$return = $this->validateRules($rules, $field, $className, $languages, $defaultLanguage);
|
||||
$fields[$key] = $field;
|
||||
if (!empty($return))
|
||||
{
|
||||
//skip mode
|
||||
if (Tools::getValue('hasErrors') == 1)
|
||||
unset($fields[$key]);
|
||||
|
||||
$errors[] = $return;
|
||||
array_unshift($errors[sizeof($errors)-1], $field[$id]);
|
||||
}
|
||||
}
|
||||
if (sizeof($errors) > 0)
|
||||
{
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
if ($save OR Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
//add language if not exist in prestashop
|
||||
if ($className == 'Language')
|
||||
{
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
$add = true;
|
||||
else
|
||||
$add = false;
|
||||
$errors = $this->checkAndAddLang($fields, $add);
|
||||
}
|
||||
elseif ($className == 'Cart')
|
||||
{
|
||||
$this->saveOrders($fields);
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = $this->saveObject($className, $fields);
|
||||
$this->cleanPositions($table);
|
||||
//insert association
|
||||
if (array_key_exists('association', $this->supportedImports[strtolower($className)]))
|
||||
$this->insertAssociation(strtolower($className), $fields);
|
||||
if (!empty($return))
|
||||
{
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $return;
|
||||
}
|
||||
}
|
||||
if ($className == 'Category' AND (sizeof($fields) != (int)Tools::getValue('nbr_import')))
|
||||
$this->updateCat();
|
||||
}
|
||||
if (sizeof($errors) > 0 AND is_array($errors))
|
||||
{
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
die(Tools::jsonEncode($json));
|
||||
}
|
||||
|
||||
private function saveObject($className, $items)
|
||||
{
|
||||
$return = array();
|
||||
@@ -586,7 +693,7 @@ class shopimporter extends ImportModule
|
||||
{
|
||||
|
||||
foreach($matchIdLang as $k => $v)
|
||||
if ($k != $v)
|
||||
if (($k != $v) AND array_key_exists($k, $val))
|
||||
{
|
||||
$item[$key][$v] = $val[$k];
|
||||
unset($item[$key][$k]);
|
||||
@@ -831,7 +938,8 @@ class shopimporter extends ImportModule
|
||||
foreach ($this->supportedImports[$className]['alterTable'] AS $name => $type)
|
||||
{
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
if (!array_key_exists($name.'_'.$moduleName, $result))
|
||||
Db::getInstance()->ExecuteS("SHOW COLUMNS FROM `"._DB_PREFIX_.pSQL($from)."` LIKE '".$name.'_'.$moduleName."'");
|
||||
if (!Db::getInstance()->numRows() AND !array_key_exists($name.'_'.$moduleName, $result))
|
||||
$queryTmp .= ' ADD `'.$name.'_'.$moduleName.'` '.$type.' NOT NULL,';
|
||||
}
|
||||
if (!empty($queryTmp))
|
||||
@@ -1006,6 +1114,52 @@ class shopimporter extends ImportModule
|
||||
return $returnErrors;
|
||||
}
|
||||
|
||||
private function validateRulesWS($rules, &$fields, $className, $languages, $defaultLanguage)
|
||||
{
|
||||
$returnErrors = array();
|
||||
$hasErrors = Tools::getValue('hasErrors');
|
||||
/* Checking for required fields */
|
||||
foreach ($rules['required'] AS $field)
|
||||
if (($value = $fields[$field]) == false AND (string)$value != '0')
|
||||
if ($hasErrors == 2)
|
||||
{
|
||||
if (array_key_exists($field, $rules['size']))
|
||||
$size = $rules['size'][$field];
|
||||
else
|
||||
$size = 1;
|
||||
$fields[$field] = $this->generateData($size, $rules['validate'][$field]);
|
||||
}
|
||||
else
|
||||
$returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is required');
|
||||
|
||||
/* Checking for maximum fields sizes */
|
||||
foreach ($rules['size'] AS $field => $maxLength)
|
||||
if (array_key_exists($field, $fields) AND $field != 'passwd')
|
||||
if ($fields[$field] !== false AND Tools::strlen($fields[$field]) > $maxLength)
|
||||
if ($hasErrors == 2)
|
||||
$fields[$field] = substr($fields[$field], 0, $maxLength);
|
||||
else
|
||||
$returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b>'.$this->l('is too long').' ('.$maxLength.' '.$this->l('chars max').')';
|
||||
|
||||
/* Checking for fields validity */
|
||||
foreach ($rules['validate'] AS $field => $function)
|
||||
if (array_key_exists($field, $fields))
|
||||
if (($value = $fields[$field]) !== false AND ($field != 'passwd'))
|
||||
if (!Validate::$function($value))
|
||||
if ($hasErrors == 2)
|
||||
{
|
||||
if (array_key_exists($field, $rules['size']))
|
||||
$size = $rules['size'][$field];
|
||||
else
|
||||
$size = 1;
|
||||
$fields[$field] = $this->generateData($size, $rules['validate'][$field]);
|
||||
}
|
||||
else
|
||||
$returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
|
||||
|
||||
return $returnErrors;
|
||||
}
|
||||
public function checkAndAddLang ($languages, $add = true)
|
||||
{
|
||||
$errors = '';
|
||||
@@ -1077,6 +1231,20 @@ class shopimporter extends ImportModule
|
||||
case 'address' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'address');
|
||||
break;
|
||||
case 'country' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'state');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'country');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'country_lang');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'country');
|
||||
case 'group' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'customer_group');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'ps_group_lang');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'group');
|
||||
break;
|
||||
case 'combination' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute');
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.'product_attribute_combination');
|
||||
break;
|
||||
case 'category' :
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category` WHERE id_category != 1');
|
||||
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'category_lang` WHERE id_category != 1');
|
||||
@@ -1130,7 +1298,6 @@ class shopimporter extends ImportModule
|
||||
case 'customer' :
|
||||
case 'zone' :
|
||||
case 'state' :
|
||||
case 'group' :
|
||||
Db::getInstance()->Execute('TRUNCATE TABLE `'._DB_PREFIX_.pSQL($table));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ class ThemeInstallator extends Module
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_time_limit(0);
|
||||
ini_set('memory_limit', '2G');
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', '2G');
|
||||
|
||||
$this->name = 'themeinstallator';
|
||||
$this->version = '1.4';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>treepodia</name>
|
||||
<displayName><![CDATA[Treepodia]]></displayName>
|
||||
<version><![CDATA[1.6]]></version>
|
||||
<version><![CDATA[1.6.1]]></version>
|
||||
<description><![CDATA[Cover your entire catalog with product videos in 24 hours.]]></description>
|
||||
<author><![CDATA[]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
|
||||
@@ -47,7 +47,7 @@ class Treepodia extends Module
|
||||
{
|
||||
$this->name = 'treepodia';
|
||||
$this->tab = 'front_office_features';
|
||||
$this->version = '1.6';
|
||||
$this->version = '1.6.1';
|
||||
$this->displayName = 'Treepodia';
|
||||
|
||||
parent::__construct();
|
||||
@@ -86,7 +86,7 @@ class Treepodia extends Module
|
||||
if (!($domain = Configuration::get('PS_SHOP_DOMAIN')))
|
||||
$domain = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$host = ((Configuration::get('PS_SSL_ENABLED') OR Tools::usingSecureMode()) ? 'https://'.$domain : 'http://'.$domain).__PS_BASE_URI__;
|
||||
$host = ((Configuration::get('PS_SSL_ENABLED') || (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://'.$domain : 'http://'.$domain).__PS_BASE_URI__;
|
||||
|
||||
return $host;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,8 @@ function updateCarrierList(json)
|
||||
var extraHtml = 'disabled="disabled"';
|
||||
else if (checkedCarrier == carriers[i].id_carrier)
|
||||
var extraHtml = 'checked="checked"';
|
||||
else
|
||||
var extraHtml = '';
|
||||
|
||||
html = html +
|
||||
'<tr class="'+itemType+'">'+
|
||||
|
||||
Reference in New Issue
Block a user