// Merge -> revision 8720
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8722 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -5,10 +5,12 @@ include_once('../../init.php');
|
||||
include_once('../../modules/shopimporter/shopimporter.php');
|
||||
ini_set('display_errors', 'off');
|
||||
|
||||
if (!Tools::getValue('ajax') OR Tools::getValue('token') != sha1(_COOKIE_KEY_.'ajaxShopImporter'))
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
|
||||
if (!Tools::getValue('ajax') || Tools::getValue('token') != sha1(_COOKIE_KEY_.'ajaxShopImporter') || !ctype_alnum($moduleName))
|
||||
die;
|
||||
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
|
||||
$className = Tools::getValue('className');
|
||||
$getMethod = Tools::getValue('getMethod');
|
||||
$limit = Tools::getValue('limit');
|
||||
@@ -69,7 +71,7 @@ if (Tools::isSubmit('getData') || Tools::isSubmit('syncLang') || Tools::isSubmit
|
||||
{
|
||||
$return = call_user_func_array(array($importModule, $getMethod), array($limit, $nbr_import));
|
||||
$shopImporter = new shopImporter();
|
||||
$shopImporter->generiqueImport($className, $return, (bool)$save);
|
||||
$shopImporter->genericImport($className, $return, (bool)$save);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,7 +95,7 @@ if (Tools::isSubmit('getDataWS') || Tools::isSubmit('syncLangWS') || Tools::isSu
|
||||
{
|
||||
$return = call_user_func_array(array($importModule, $getMethod), array($limit, $nbr_import));
|
||||
$shopImporter = new shopImporter();
|
||||
$shopImporter->generiqueImport($className, $return, (bool)$save);
|
||||
$shopImporter->genericImport($className, $return, (bool)$save);
|
||||
}
|
||||
die('{"hasError" : false, "error" : []}');
|
||||
} catch (Exception $e)
|
||||
|
||||
@@ -47,6 +47,7 @@ $_MODULE['<{shopimporter}prestashop>shopimporter_782c8b38bce4f2f6975ca7f33ac8189
|
||||
$_MODULE['<{shopimporter}prestashop>shopimporter_f2931b8b1622867fcc461d7de388e319'] = 'Import des historique de commande';
|
||||
$_MODULE['<{shopimporter}prestashop>shopimporter_32a6deec3cca312a54d6b8769c9b8dd7'] = 'n\'est pas disponible dans ce module';
|
||||
$_MODULE['<{shopimporter}prestashop>shopimporter_1e411d25230ba738b9ae583bcb9b0b57'] = 'Connexion à la base de données OK ';
|
||||
$_MODULE['<{shopimporter}prestashop>shopimporter_472f0b8c78cc382302e094c94856c951'] = 'La connexion au service Web est OK';
|
||||
$_MODULE['<{shopimporter}prestashop>shopimporter_3596c777cbc8b72d678f34daabc9148b'] = 'Afficher les erreurs';
|
||||
$_MODULE['<{shopimporter}prestashop>shopimporter_89a399eee52b2a6daaea92eba3e14cad'] = 'Lancer le test d\'import';
|
||||
$_MODULE['<{shopimporter}prestashop>shopimporter_bf79359f8edda6f7df97ef57a4ee09b6'] = 'Lancer l\'import';
|
||||
|
||||
@@ -27,7 +27,6 @@ var shopImporter = {
|
||||
|
||||
syncLangWS : function (onComplete)
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
@@ -45,7 +44,6 @@ var shopImporter = {
|
||||
}
|
||||
else
|
||||
onComplete(true);
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
@@ -75,7 +73,6 @@ var shopImporter = {
|
||||
}
|
||||
else
|
||||
onComplete(true);
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
@@ -99,13 +96,12 @@ var shopImporter = {
|
||||
{
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#steps').html('<div id="currency_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">'+jsonData.error+'</div>');
|
||||
$('#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)
|
||||
{
|
||||
@@ -114,7 +110,6 @@ var shopImporter = {
|
||||
onComplete(false);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
syncCurrency : function (onComplete)
|
||||
{
|
||||
@@ -135,7 +130,6 @@ var shopImporter = {
|
||||
}
|
||||
else
|
||||
onComplete(true);
|
||||
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
@@ -149,8 +143,8 @@ 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+'">');
|
||||
$('#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() {
|
||||
@@ -165,22 +159,18 @@ var shopImporter = {
|
||||
},
|
||||
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+'">');
|
||||
$('#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)
|
||||
{
|
||||
@@ -209,14 +199,9 @@ var shopImporter = {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
checkAndSaveConfig : function (save)
|
||||
{
|
||||
@@ -225,8 +210,6 @@ var shopImporter = {
|
||||
if (isOk)
|
||||
{
|
||||
shopImporter.syncCurrency(function(isOk) {
|
||||
if (isOk)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
@@ -281,17 +264,13 @@ var shopImporter = {
|
||||
},
|
||||
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>');
|
||||
$('#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');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
getDatasWS : function (methodName)
|
||||
@@ -308,7 +287,7 @@ var shopImporter = {
|
||||
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>');
|
||||
$('#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');
|
||||
@@ -318,9 +297,6 @@ var shopImporter = {
|
||||
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)
|
||||
{
|
||||
@@ -404,7 +380,6 @@ var shopImporter = {
|
||||
},
|
||||
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');
|
||||
}
|
||||
@@ -562,10 +537,6 @@ var shopImporter = {
|
||||
$('#feedback_'+methodName[0]+'_errors_list > ul').html($('#feedback_'+methodName[0]+'_errors_list > ul').html() + jsonError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
@@ -584,12 +555,11 @@ var shopImporter = {
|
||||
{
|
||||
if (this.save)
|
||||
{
|
||||
$('#steps').html($('#steps').html()+'<div id="ok_feedback_end" style="display:none;" class="conf"><img src="'+shopImporter.srcConf+'">'+importFinish+'</div>');
|
||||
$('#steps').html($('#steps').html()+'<div id=\'ok_feedback_end\' style=\'display:none;\' class=\'conf\'><img src=\''+shopImporter.srcConf+'\'>'+importFinish+'</div>');
|
||||
$('#ok_feedback_end').fadeIn('slow');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$('#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() {
|
||||
@@ -617,7 +587,6 @@ var shopImporter = {
|
||||
|
||||
};
|
||||
|
||||
|
||||
function enableShowErrors(methodName)
|
||||
{
|
||||
$(document).find('#feedback_'+methodName+'_errors_list').slideToggle();
|
||||
@@ -669,7 +638,7 @@ function initConnexion (moduleName, url, loginws, apikey, token)
|
||||
$('#connectionInformation').removeAttr('style');
|
||||
if (jsonData.hasError)
|
||||
{
|
||||
$('#connectionInformation').attr("style","width: 400px;background-color: #FAE2E3;border: 1px solid #EC9B9B");
|
||||
$('#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');
|
||||
@@ -678,7 +647,7 @@ function initConnexion (moduleName, url, loginws, apikey, token)
|
||||
}else
|
||||
{
|
||||
|
||||
$('#connectionInformation').attr("style","width: 400px;background-color: #DFFAD3;border: 1px solid #72CB67");
|
||||
$('#connectionInformation').attr('style','width: 400px;background-color: #DFFAD3;border: 1px solid #72CB67');
|
||||
$('#connectionInformation').slideDown('slow');
|
||||
$('#connectionInformation').html('<ul>Connection successful</ul>');
|
||||
$('#connectionInformation').show();
|
||||
@@ -689,7 +658,6 @@ function initConnexion (moduleName, url, loginws, apikey, token)
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR\nDetails:\nError thrown: ' + XMLHttpRequest + '\n' + 'Text status: ' + textStatus);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -702,7 +670,7 @@ function displaySpecificOptionsWsdl(moduleName,token)
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "html",
|
||||
dataType : 'html',
|
||||
data: 'ajax=true&token='+token+'&displaySpecificOptionsWsdl&moduleName='+moduleName ,
|
||||
success: function(htmlData)
|
||||
{
|
||||
@@ -724,7 +692,7 @@ function validateSpecificOptions(moduleName, specificOptions)
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
dataType : 'json',
|
||||
data: 'ajax=true&token='+this.token+'&validateSpecificOptions&moduleName='+moduleName+specificOptions ,
|
||||
success: function(jsonData)
|
||||
{
|
||||
@@ -766,7 +734,7 @@ function initConfigConnector()
|
||||
url: '../modules/shopimporter/ajax.php',
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "html",
|
||||
dataType : 'html',
|
||||
|
||||
data: 'ajax=true&token='+globalAjaxShopImporterToken+'&displayConfigConnector&moduleName='+$('#import_module_name').val() ,
|
||||
success: function(html)
|
||||
@@ -800,9 +768,6 @@ $(document).ready(function(){
|
||||
$(this).html('');
|
||||
$('#steps').fadeIn();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#importOptions').fadeOut('slow');
|
||||
$('#displayOptions').show();
|
||||
$('#checkAndSaveConfig').show();
|
||||
@@ -832,8 +797,6 @@ $(document).ready(function(){
|
||||
return false;
|
||||
}else{
|
||||
$('#connectionInformation').hide();
|
||||
|
||||
|
||||
}
|
||||
token = globalAjaxShopImporterToken;
|
||||
initConnexion($('#import_module_name').val(), $('#url').val(), $('#loginws').val(), $('#apikey').val(), token);
|
||||
@@ -873,7 +836,7 @@ $(document).ready(function(){
|
||||
{
|
||||
if($('#import_module_name').attr('value') == 'importermagento')
|
||||
{
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
$.scrollTo($('#steps'), 300 , {
|
||||
onAfter:function(){
|
||||
shopImporter.specificOptions = '';
|
||||
$('#specificOptionsContent :input').each(function (){
|
||||
@@ -899,7 +862,7 @@ $(document).ready(function(){
|
||||
});
|
||||
}else if ($('#import_module_name').attr('value') == 'importerosc')
|
||||
{
|
||||
$.scrollTo($("#steps"), 300 , {
|
||||
$.scrollTo($('#steps'), 300 , {
|
||||
onAfter:function(){
|
||||
shopImporter.specificOptions = '';
|
||||
$('#specificOptionsContent :input').each(function (){
|
||||
@@ -923,7 +886,6 @@ $(document).ready(function(){
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#importOptionsYesNo :radio').change( function () {
|
||||
@@ -939,7 +901,7 @@ $(document).ready(function(){
|
||||
else
|
||||
{
|
||||
$('#checkAndSaveConfig').fadeOut();
|
||||
$('#steps').html('<div id="one_thing_error_feedback" style="display:none;" class="error"><img src="'+shopImporter.srcError+'">'+oneThing+'</div>');
|
||||
$('#steps').html('<div id=\'one_thing_error_feedback\' style=\'display:none;\' class=\'error\'><img src=\''+shopImporter.srcError+'\'>'+oneThing+'</div>');
|
||||
$('#one_thing_error_feedback').fadeIn('slow');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -289,7 +289,7 @@ class shopimporter extends ImportModule
|
||||
$exportModules = parent::getImportModulesOnDisk();
|
||||
//get installed module only
|
||||
foreach($exportModules as $key => $module)
|
||||
if ($module->name == $this->name OR !(bool)$module->id)
|
||||
if ($module->name == $this->name || !(bool)$module->id)
|
||||
unset($exportModules[$key]);
|
||||
$html = '<script type="text/javascript">var globalAjaxShopImporterToken = "'.sha1(_COOKIE_KEY_.'ajaxShopImporter').'";</script>
|
||||
<script type="text/javascript" src="../modules/shopimporter/shopimporter.js"></script>
|
||||
@@ -418,7 +418,7 @@ class shopimporter extends ImportModule
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function generiqueImport($className, $fields, $save = false)
|
||||
public function genericImport($className, $fields, $save = false)
|
||||
{
|
||||
$return = '';
|
||||
$json = array();
|
||||
@@ -432,7 +432,7 @@ class shopimporter extends ImportModule
|
||||
$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('syncLang') OR Tools::isSubmit('syncCurrency')))
|
||||
if ((sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']) || Tools::isSubmit('syncLang') || Tools::isSubmit('syncCurrency')))
|
||||
{
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
@@ -446,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') OR Tools::isSubmit('syncLangWS'))
|
||||
if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
$defaultIdLand = $importModule->getDefaultIdLang();
|
||||
$defaultLanguageImport = new Language(Language::getIdByIso($languages[$defaultIdLand]['iso_code']));
|
||||
@@ -455,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') OR Tools::isSubmit('syncCurrencyWS'))
|
||||
if (Tools::isSubmit('syncCurrency') || Tools::isSubmit('syncCurrencyWS'))
|
||||
{
|
||||
$defaultIdCurrency = $importModule->getDefaultIdCurrency();
|
||||
$currencies = $importModule->getCurrencies(0);
|
||||
@@ -499,15 +499,13 @@ class shopimporter extends ImportModule
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
//die('');
|
||||
if ($save OR Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
|
||||
if ($save || Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
//add language if not exist in prestashop
|
||||
if ($className == 'Language')
|
||||
{
|
||||
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS'))
|
||||
$add = true;
|
||||
else
|
||||
$add = false;
|
||||
@@ -540,7 +538,7 @@ class shopimporter extends ImportModule
|
||||
}
|
||||
die(Tools::jsonEncode($json));
|
||||
}
|
||||
public function generiqueImportWS($className, $fields, $save = false)
|
||||
public function genericImportWS($className, $fields, $save = false)
|
||||
{
|
||||
|
||||
$return = '';
|
||||
@@ -557,7 +555,7 @@ class shopimporter extends ImportModule
|
||||
$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')))
|
||||
if ((sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang']) || Tools::isSubmit('syncLangWS') || Tools::isSubmit('syncCurrency')))
|
||||
{
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
if (file_exists('../../modules/'.$moduleName.'/'.$moduleName.'.php'))
|
||||
@@ -565,12 +563,6 @@ class shopimporter extends ImportModule
|
||||
|
||||
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'));
|
||||
|
||||
@@ -629,12 +621,12 @@ class shopimporter extends ImportModule
|
||||
$json['hasError'] = true;
|
||||
$json['error'] = $errors;
|
||||
}
|
||||
if ($save OR Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
if ($save || Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS'))
|
||||
{
|
||||
//add language if not exist in prestashop
|
||||
if ($className == 'Language')
|
||||
{
|
||||
if (Tools::isSubmit('syncLang') OR Tools::isSubmit('syncLangWS'))
|
||||
if (Tools::isSubmit('syncLang') || Tools::isSubmit('syncLangWS'))
|
||||
$add = true;
|
||||
else
|
||||
$add = false;
|
||||
@@ -938,7 +930,7 @@ class shopimporter extends ImportModule
|
||||
foreach ($this->supportedImports[$className]['alterTable'] AS $name => $type)
|
||||
{
|
||||
$moduleName = Tools::getValue('moduleName');
|
||||
Db::getInstance()->ExecuteS("SHOW COLUMNS FROM `"._DB_PREFIX_.pSQL($from)."` LIKE '".$name.'_'.$moduleName."'");
|
||||
Db::getInstance()->ExecuteS("SHOW COLUMNS FROM `"._DB_PREFIX_.pSQL($from)."` LIKE '".pSQL($name).'_'.pSQL($moduleName)."'");
|
||||
if (!Db::getInstance()->numRows() AND !array_key_exists($name.'_'.$moduleName, $result))
|
||||
$queryTmp .= ' ADD `'.$name.'_'.$moduleName.'` '.$type.' NOT NULL,';
|
||||
}
|
||||
@@ -1065,13 +1057,13 @@ class shopimporter extends ImportModule
|
||||
else
|
||||
$returnErrors[] = $this->l('the field').' <b>'.call_user_func(array($className, 'displayFieldName'), $field, $className).'</b> '.$this->l('is invalid');
|
||||
|
||||
if ((sizeof($rules['requiredLang']) OR sizeof($rules['sizeLang']) OR sizeof($rules['validateLang'])))
|
||||
if ((sizeof($rules['requiredLang']) || sizeof($rules['sizeLang']) || sizeof($rules['validateLang'])))
|
||||
{
|
||||
$matchIdLang = $this->getMatchIdLang(0);
|
||||
/* Checking for multilingual required fields */
|
||||
foreach ($rules['requiredLang'] AS $fieldLang)
|
||||
{
|
||||
if (($empty = $fields[$fieldLang][$matchIdLang[$defaultLanguage->id]]) === false OR empty($empty))
|
||||
if (($empty = $fields[$fieldLang][$matchIdLang[$defaultLanguage->id]]) === false || empty($empty))
|
||||
if ($hasErrors == 2)
|
||||
{
|
||||
if (array_key_exists($fieldLang, $rules['sizeLang']))
|
||||
|
||||
Reference in New Issue
Block a user