diff --git a/classes/ImageType.php b/classes/ImageType.php
index 10798c3f6..e1b6f8fdf 100644
--- a/classes/ImageType.php
+++ b/classes/ImageType.php
@@ -28,9 +28,6 @@
class ImageTypeCore extends ObjectModel
{
public $id;
-
- /** @var string id_theme */
- public $id_theme;
/** @var string Name */
public $name;
@@ -66,7 +63,6 @@ class ImageTypeCore extends ObjectModel
'table' => 'image_type',
'primary' => 'id_image_type',
'fields' => array(
- 'id_theme' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isImageTypeName', 'required' => true, 'size' => 16),
'width' => array('type' => self::TYPE_INT, 'validate' => 'isImageSize', 'required' => true),
'height' => array('type' => self::TYPE_INT, 'validate' => 'isImageSize', 'required' => true),
diff --git a/classes/Module.php b/classes/Module.php
index c3a7e356b..4c7ef3e50 100644
--- a/classes/Module.php
+++ b/classes/Module.php
@@ -1342,7 +1342,7 @@ abstract class ModuleCore
{
$output = '
-

'.$error.'
+ '.$error.'
';
$this->error = true;
return $output;
@@ -1352,7 +1352,7 @@ abstract class ModuleCore
{
$output = '
-

'.$string.'
+ '.$string.'
';
return $output;
}
diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php
index dcbae81df..5e22549dd 100644
--- a/controllers/admin/AdminImagesController.php
+++ b/controllers/admin/AdminImagesController.php
@@ -76,17 +76,6 @@ class AdminImagesControllerCore extends AdminController
'required' => true,
'desc' => $this->l('Letters only (e.g., small, medium, large, extra-large)')
),
- array(
- 'type' => 'select',
- 'label' => $this->l('Theme:'),
- 'name' => 'id_theme',
- 'required' => true,
- 'options' => array(
- 'query' => Theme::getThemes(),
- 'id' => 'id_theme',
- 'name' => 'name'
- )
- ),
array(
'type' => 'text',
'label' => $this->l('Width:'),
@@ -373,8 +362,6 @@ class AdminImagesControllerCore extends AdminController
if (preg_match('/^[0-9]*\.jpg$/', $image))
foreach ($type AS $k => $imageType)
{
-
- $theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
// Customizable writing dir
$newDir = $dir;
if ($imageType['name'] == 'thumb_scene')
@@ -382,7 +369,7 @@ class AdminImagesControllerCore extends AdminController
if (!file_exists($newDir))
continue;
if (!file_exists($newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg'))
- if (!imageResize($dir.$image, $newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
+ if (!imageResize($dir.$image, $newDir.substr($image, 0, -4).'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
$errors = true;
if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server
return 'timeout';
@@ -397,9 +384,8 @@ class AdminImagesControllerCore extends AdminController
if (file_exists($dir.$imageObj->getExistingImgPath().'.jpg'))
foreach ($type AS $k => $imageType)
{
- $theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
if (!file_exists($dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg'))
- if (!imageResize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
+ if (!imageResize($dir.$imageObj->getExistingImgPath().'.jpg', $dir.$imageObj->getExistingImgPath().'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
$errors = true;
if (time() - $this->start_time > $this->max_execution_time - 4) // stop 4 seconds before the tiemout, just enough time to process the end of the page on a slow server
return 'timeout';
@@ -416,14 +402,13 @@ class AdminImagesControllerCore extends AdminController
$errors = false;
foreach ($type AS $k => $imageType)
{
- $theme = (Shop::isFeatureActive() ? '-'.$imageType['id_theme'] : '');
foreach ($languages AS $language)
{
$file = $dir.$language['iso_code'].'.jpg';
if (!file_exists($file))
$file = _PS_PROD_IMG_DIR_.Language::getIsoById((int)(Configuration::get('PS_LANG_DEFAULT'))).'.jpg';
if (!file_exists($dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg'))
- if (!imageResize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).$theme.'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
+ if (!imageResize($file, $dir.$language['iso_code'].'-default-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height'])))
$errors = true;
}
}
diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql
index d0569354e..2d0f1c611 100644
--- a/install-dev/sql/db.sql
+++ b/install-dev/sql/db.sql
@@ -867,7 +867,6 @@ CREATE TABLE `PREFIX_image_lang` (
CREATE TABLE `PREFIX_image_type` (
`id_image_type` int(10) unsigned NOT NULL auto_increment,
- `id_theme` INT(11) unsigned NOT NULL,
`name` varchar(16) NOT NULL,
`width` int(10) unsigned NOT NULL,
`height` int(10) unsigned NOT NULL,
@@ -878,7 +877,7 @@ CREATE TABLE `PREFIX_image_type` (
`scenes` tinyint(1) NOT NULL default '1',
`stores` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id_image_type`),
- UNIQUE KEY `image_type_name` (`id_theme`, `name`)
+ KEY `image_type_name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_lang` (
diff --git a/install-dev/sql/db_settings_lite.sql b/install-dev/sql/db_settings_lite.sql
index f8e35fb2d..5f4bf2314 100644
--- a/install-dev/sql/db_settings_lite.sql
+++ b/install-dev/sql/db_settings_lite.sql
@@ -907,15 +907,15 @@ INSERT INTO `PREFIX_currency` (`name`, `iso_code`, `iso_code_num`, `sign`, `blan
('Singapour Dollar', 'SGD', '702', '$', 1, 1.77, 2, 0, 0), ('Baht', 'THB', '764', '฿', 1, 40.96, 2, 0, 0), ('Rand', 'ZAR', '710', 'R', 1, 9.38, 2, 0, 0);*/
INSERT INTO `PREFIX_currency_shop` (`id_currency`, `id_shop`) VALUES (1,1), (2,1), (3,1);
-INSERT INTO `PREFIX_image_type` (`id_image_type`, `id_theme`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`, `stores`) VALUES
-(1, 1, 'small', 45, 45, 1, 1, 1, 1, 0, 0),
-(2, 1, 'medium', 58, 58, 1, 1, 1, 1, 0, 1),
-(3, 1, 'large', 264, 264, 1, 1, 1, 1, 0, 0),
-(4, 1, 'thickbox', 600, 600, 1, 0, 0, 0, 0, 0),
-(5, 1, 'category', 500, 150, 0, 1, 0, 0, 0, 0),
-(6, 1, 'home', 124, 124, 1, 0, 0, 0, 0, 0),
-(7, 1, 'large_scene', 556, 200, 0, 0, 0, 0, 1, 0),
-(8, 1, 'thumb_scene', 161, 58, 0, 0, 0, 0, 1, 0);
+INSERT INTO `PREFIX_image_type` (`id_image_type`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`, `stores`) VALUES
+(1, 'small', 45, 45, 1, 1, 1, 1, 0, 0),
+(2, 'medium', 58, 58, 1, 1, 1, 1, 0, 1),
+(3, 'large', 264, 264, 1, 1, 1, 1, 0, 0),
+(4, 'thickbox', 600, 600, 1, 0, 0, 0, 0, 0),
+(5, 'category', 500, 150, 0, 1, 0, 0, 0, 0),
+(6, 'home', 124, 124, 1, 0, 0, 0, 0, 0),
+(7, 'large_scene', 556, 200, 0, 0, 0, 0, 1, 0),
+(8, 'thumb_scene', 161, 58, 0, 0, 0, 0, 1, 0);
INSERT INTO `PREFIX_contact_shop` (`id_contact`, `id_shop`) VALUES (1,1), (2,1);
diff --git a/install-dev/sql/upgrade/1.5.0.4.sql b/install-dev/sql/upgrade/1.5.0.4.sql
index a5cbb7a45..c1a42393d 100644
--- a/install-dev/sql/upgrade/1.5.0.4.sql
+++ b/install-dev/sql/upgrade/1.5.0.4.sql
@@ -6,3 +6,5 @@ ALTER TABLE `PREFIX_order_state` ADD COLUMN `deleted` tinyint(1) UNSIGNED NOT NU
ALTER TABLE `PREFIX_category` ADD COLUMN `is_root_category` tinyint(1) NOT NULL default '0' AFTER `position`;
UPDATE `PREFIX_category` SET `is_root_category` = 1 WHERE `id_category` = 1;
+
+ALTER TABLE `PREFIX_image_type` DROP `id_theme`;
diff --git a/install-new/data/db_structure.sql b/install-new/data/db_structure.sql
index 609d31293..ae957b0e0 100644
--- a/install-new/data/db_structure.sql
+++ b/install-new/data/db_structure.sql
@@ -867,7 +867,6 @@ CREATE TABLE `PREFIX_image_lang` (
CREATE TABLE `PREFIX_image_type` (
`id_image_type` int(10) unsigned NOT NULL auto_increment,
- `id_theme` INT(11) unsigned NOT NULL,
`name` varchar(16) NOT NULL,
`width` int(10) unsigned NOT NULL,
`height` int(10) unsigned NOT NULL,
@@ -878,7 +877,7 @@ CREATE TABLE `PREFIX_image_type` (
`scenes` tinyint(1) NOT NULL default '1',
`stores` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id_image_type`),
- UNIQUE KEY `image_type_name` (`id_theme`, `name`)
+ KEY `image_type_name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE `PREFIX_lang` (
diff --git a/install-new/data/xml/image_type.xml b/install-new/data/xml/image_type.xml
index 0c72134bf..7bd466a78 100644
--- a/install-new/data/xml/image_type.xml
+++ b/install-new/data/xml/image_type.xml
@@ -1,7 +1,6 @@
-
@@ -13,13 +12,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/modules/themeinstallator/fr.php b/modules/themeinstallator/fr.php
index fa7916e67..cde2b7e1f 100644
--- a/modules/themeinstallator/fr.php
+++ b/modules/themeinstallator/fr.php
@@ -18,6 +18,11 @@ $_MODULE['<{themeinstallator}prestashop>themeinstallator_b857ef1f431c5f3290dc5b5
$_MODULE['<{themeinstallator}prestashop>themeinstallator_22c765d777eb4ca6b4292bcbb596872e'] = 'Les modules suivants ont été désactivés';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_e501dc865768ac08d49c129a23c3ae09'] = 'Les modules suivants ont été activés';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_0dfbf4744524c8573235d60589d8b66e'] = 'Les images ont bien été mises à jour dans la base de données';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_a525cd013f76b049acb0320987c0d325'] = 'Attention : Copier / Coller vos erreurs si vous souhaitez définir manuellement ces images types (Dans l\'onglet Préférences > Images) :';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_203c5dff06c7565ffd6713a914c62d16'] = 'Certain type d\'image n’ont pu être ajouté, car ils existent. Voici la liste :';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_3b90370ac32dead2af37eabe3bdbb97f'] = 'Nom de l\'image type :';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_48ccf48dcf2218a413ce473262f21a0c'] = 'Largeur :';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_e933dc24fb245d863a43b4fefe9b45f5'] = 'Hauteur :';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_dd1f775e443ff3b9a89270713580a51b'] = 'Précédent';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_a20ddccbb6f808ec42cd66323e6c6061'] = 'Terminer';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_33167fe8de7517798cf2e95c7680d6a4'] = 'Les thèmes suivants ont correctement été importés';
@@ -27,10 +32,6 @@ $_MODULE['<{themeinstallator}prestashop>themeinstallator_7651cc4a979c5e21ee50de9
$_MODULE['<{themeinstallator}prestashop>themeinstallator_8ab378b3ad05e14cbe61bff60c50afa6'] = 'Configuration actuelle';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_f94545e00cff9d0395194458b2245702'] = 'Configuration du thème';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_130c5b3473c57faa76e2a1c54e26f88e'] = 'Les deux';
-$_MODULE['<{themeinstallator}prestashop>themeinstallator_c90ba3aaed0a2bafed18233111062cf0'] = 'Configuration des images du thème';
-$_MODULE['<{themeinstallator}prestashop>themeinstallator_2a84d9915b12fcb0c1436709a77a8dd0'] = 'Ajouter la nouvelle configuration';
-$_MODULE['<{themeinstallator}prestashop>themeinstallator_dd3acd810b479275ce68d69e78ed7a95'] = 'Tout ajouter (vous risquez de perdre votre configuration actuelle)';
-$_MODULE['<{themeinstallator}prestashop>themeinstallator_332efbbfb2c4bd5a37fd7a55659b821a'] = 'Ne rien changer';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Suivant';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_5138a89d1b730dacf446855e15c24496'] = 'Vous êtes sur le point d\'installer les thèmes suivants';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_f364da141450380ae79d7a45528f4c06'] = 'Ce thème est pour Prestashop';
@@ -40,7 +41,10 @@ $_MODULE['<{themeinstallator}prestashop>themeinstallator_caeedb303068f9915e8e5ce
$_MODULE['<{themeinstallator}prestashop>themeinstallator_2dd99d7426b4fe6dd04d7a98f5e32a62'] = 'Choisissez la déclinaison que vous souhaitez importer';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_f956917da1716add289f33a8869b85d4'] = 'Thème principal';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_1e3de51d693cd0c7e903bcf3769a0cdb'] = 'Décochez ce champs si vous ne souhaitez pas installer le thème principal';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_d0594793a76c7e694f6bf7d4fea06a99'] = 'Nom du thème';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_0205578268437a2c18d438b434b6d4cf'] = 'Répertoire du thème';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_c49fbf2b822fd14929fd1fd76cdb0c96'] = 'Sélectionnez les variations que vous souhaitez importer';
+$_MODULE['<{themeinstallator}prestashop>themeinstallator_dc87369c7dd7d760c8076a4e1a3805d0'] = 'Sélectionner le thème à exporter';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_d1baba351b02042982a133c4df5d4924'] = 'Exporter un thème';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_5092965125a28a17f49ee460fbc1f62c'] = 'Selectionner un thème';
$_MODULE['<{themeinstallator}prestashop>themeinstallator_0557cae4cf5b379e665910d701210f69'] = 'Exporter ce thème';
diff --git a/modules/themeinstallator/themeinstallator.php b/modules/themeinstallator/themeinstallator.php
index de60a2637..753a355cc 100644
--- a/modules/themeinstallator/themeinstallator.php
+++ b/modules/themeinstallator/themeinstallator.php
@@ -395,24 +395,40 @@ class ThemeInstallator extends Module
}
}
- private function updateImages($id_theme)
+ private function updateImages()
{
+ $return = array();
foreach ($this->xml->images->image as $row)
{
-
- Db::getInstance()->execute('
- INSERT INTO `'._DB_PREFIX_.'image_type` (`id_theme`, `name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`)
- VALUES ('.(int)$id_theme.',
- \''.pSQL($row['name']).'\',
- '.(int)($row['width']).',
- '.(int)($row['height']).',
+ if ($result = (bool)Db::getInstance()->executes(sprintf('SELECT * FROM `'._DB_PREFIX_.'image_type` WHERE `name` = \'%s\' ', pSQL($row['name']))))
+ {
+ $return['error'][] = array(
+ 'name' => $row['name'],
+ 'width' => (int)$row['width'],
+ 'height' => (int)$row['height']
+ );
+ }
+ else
+ {
+ Db::getInstance()->execute('
+ INSERT INTO `'._DB_PREFIX_.'image_type` (`name`, `width`, `height`, `products`, `categories`, `manufacturers`, `suppliers`, `scenes`)
+ VALUES (\''.pSQL($row['name']).'\',
+ '.(int)$row['width'].',
+ '.(int)$row['height'].',
'.($row['products'] == 'true' ? 1 : 0).',
'.($row['categories'] == 'true' ? 1 : 0).',
'.($row['manufacturers'] == 'true' ? 1 : 0).',
'.($row['suppliers'] == 'true' ? 1 : 0).',
'.($row['scenes'] == 'true' ? 1 : 0).')');
+
+ $return['ok'][] = array(
+ 'name' => $row['name'],
+ 'width' => (int)$row['width'],
+ 'height' => (int)$row['height']
+ );
+ }
}
- return true;
+ return $return;
}
private function _displayForm4()
@@ -527,13 +543,28 @@ class ThemeInstallator extends Module
}
}
}
- // note : theme was previously created at this point.
+
+ // note : theme was previously created at this point.
// It is now created during displayForm3
- // @todo : imageType generation should be handled in a better way
- if ((int)(Tools::getValue('imagesConfig')) != 3 AND self::updateImages((int)$theme->id))
- $msg .= '
'.$this->l('Images have been correctly updated in database').'
';
-
- $this->_msg .= parent::displayConfirmation($msg);
+ $result = $this->updateImages();
+ if (!isset($result['error']))
+ $msg .= $this->l('Images have been correctly updated in database');
+ else
+ {
+ $errors = ''.$this->l('Warning: Copy/Paste your errors if you want to manually set the image type (in the tab Preferences > Images):').'
';
+ $errors .= $this->l('Some kind of image could not be added because they exists. Here\'s the list:');
+ $errors .= '';
+ foreach ($result['error'] as $error)
+ $errors .= '- '.$this->l('Name image type:').' '.$error['name'].' ('.$this->l('Width:').' '.$error['width'].'px, '.$this->l('Height:').' '.$error['height'].'px)
';
+ $errors .= '
';
+ }
+
+ if (!empty($msg))
+ $this->_msg .= parent::displayConfirmation($msg);
+
+ if (isset($error))
+ $this->_msg .= parent::displayError($errors);
+
$this->_html .= '
@@ -612,15 +643,6 @@ class ThemeInstallator extends Module
';
- $this->_html .= '
- ';
$this->_html .= '