diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index ee0a0dad3..d649fa7d0 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -535,8 +535,11 @@ if (Tools::isSubmit('loadImportMatchs')) if (Tools::isSubmit('toggleScreencast')) { - $context->employee->show_screencast = (int)(!(bool)$context->employee->show_screencast); - $context->employee->save(); + if (Validate::isLoadedObject($context->employee)) + { + $context->employee->bo_show_screencast = !$context->employee->bo_show_screencast; + $context->employee->update(); + } } if (Tools::isSubmit('helpAccess')) diff --git a/admin-dev/ajax_send_mail_test.php b/admin-dev/ajax_send_mail_test.php index bb040e80f..704269824 100644 --- a/admin-dev/ajax_send_mail_test.php +++ b/admin-dev/ajax_send_mail_test.php @@ -43,5 +43,5 @@ $smtpPort = $_GET['smtpPort']; $smtpEncryption = $_GET['smtpEnc']; $result = Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), Tools::htmlentitiesUTF8($subject), Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), Tools::htmlentitiesUTF8($smtpPassword), Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption)); -die($result ? 'ok' : 'fail'); +die($result === true ? 'ok' : $result); diff --git a/admin-dev/tabs/AdminCarts.php b/admin-dev/tabs/AdminCarts.php index 27c398fc0..c5f167d71 100644 --- a/admin-dev/tabs/AdminCarts.php +++ b/admin-dev/tabs/AdminCarts.php @@ -167,9 +167,9 @@ class AdminCarts extends AdminTab SELECT id_image FROM '._DB_PREFIX_.'image WHERE id_product = '.(int)($product['id_product']).' AND cover = 1'); - + $productObj = new Product($product['id_product']); - + /* Customization display */ $this->displayCustomizedDatas($customizedDatas, $product, $currency, $image, $tokenCatalog, $stock); if ($product['cart_quantity'] > $product['customizationQuantityTotal']) @@ -257,10 +257,7 @@ class AdminCarts extends AdminTab if (is_array($customizedDatas) AND isset($customizedDatas[(int)($product['id_product'])][(int)($product['id_product_attribute'])])) { - if (isset($image['id_image'])) - $image = new Image($image['id_image']); - else - $image = new Image(); + if ($image = new Image($image['id_image'])) echo ' '.($image->id ? cacheImage(_PS_IMG_DIR_.'p/'.$image->getExistingImgPath().'.jpg', @@ -319,17 +316,17 @@ class AdminCarts extends AdminTab $this->displayList(); } } - + protected function _displayDeleteLink($token = NULL, $id) - { + { foreach ($this->_list as $cart) if ($id == $cart['id_cart']) if ($cart['id_order']) return; - + $_cacheLang['Delete'] = $this->l('Delete', __CLASS__, true, false); $_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, true, false).$id.' ?)'; - + echo ' '.$_cacheLang['Delete'].' diff --git a/admin-dev/tabs/AdminEmployees.php b/admin-dev/tabs/AdminEmployees.php index fe492ded6..22cf33826 100644 --- a/admin-dev/tabs/AdminEmployees.php +++ b/admin-dev/tabs/AdminEmployees.php @@ -152,6 +152,14 @@ class AdminEmployees extends AdminTab getFieldValue($obj, 'bo_uimode') == 'click' ? 'checked="checked" ' : '').'/>
 
+ +
+ getFieldValue($obj, 'bo_show_screencast') ? 'checked="checked" ' : '').'/> + + getFieldValue($obj, 'bo_show_screencast') ? 'checked="checked" ' : '').'/> + +

'.$this->l('Show the welcome video on the dashbord of the back office').'

+
getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/> diff --git a/admin-dev/tabs/AdminImport.php b/admin-dev/tabs/AdminImport.php index 46afaecef..7ae252432 100644 --- a/admin-dev/tabs/AdminImport.php +++ b/admin-dev/tabs/AdminImport.php @@ -101,6 +101,9 @@ class AdminImport extends AdminTab 'image_position' => array('label' => $this->l('Image position'), 'help' => $this->l('Position of the product image to use for this combination. If you use this field, leave image URL empty.')), 'image_url' => array('label' => $this->l('Image URL')), + 'delete_existing_images' => array( + 'label' => $this->l('Delete existing images (0 = no, 1 = yes)'), + 'help' => $this->l('If you do not specify this column and you specify the column images, all images of the product will be replaced by those specified in the import file')), ); self::$default_values = array( @@ -475,8 +478,7 @@ class AdminImport extends AdminTab $path = _PS_CAT_IMG_DIR_.(int)($id_entity); break; } - - if (copy(trim($url), $tmpfile)) + if (copy(str_replace(' ', '%20', trim($url)), $tmpfile)) { imageResize($tmpfile, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); @@ -938,6 +940,11 @@ class AdminImport extends AdminTab $product = new Product((int)($info['id_product']), false, $defaultLanguage); $id_image = null; + //delete existing images if "delete_existing_images" is set to 1 + if (array_key_exists('delete_existing_images', $info) && $info['delete_existing_images']) + $product->deleteImages(); + elseif (array_key_exists('image_url', $info)) + $product->deleteImages(); if (isset($info['image_url']) && $info['image_url']) { diff --git a/admin-dev/tabs/AdminPerformance.php b/admin-dev/tabs/AdminPerformance.php index ee5b7e18c..7e260a497 100644 --- a/admin-dev/tabs/AdminPerformance.php +++ b/admin-dev/tabs/AdminPerformance.php @@ -446,6 +446,7 @@ class AdminPerformance extends AdminTab
+
'.$this->l('The system CacheFS should be used only when the infrastructure contain only one front-end server. Ask your hosting company if you don\'t know.').'
diff --git a/admin-dev/tabs/AdminScenes.php b/admin-dev/tabs/AdminScenes.php index ddb043d6e..93e0adc45 100644 --- a/admin-dev/tabs/AdminScenes.php +++ b/admin-dev/tabs/AdminScenes.php @@ -1,6 +1,6 @@ lang = true; $this->edit = true; $this->delete = true; - + $this->fieldImageSettings = array( array('name' => 'image', 'dir' => 'scenes'), array('name' => 'thumb', 'dir' => 'scenes/thumbs') ); - + $this->fieldsDisplay = array( 'id_scene' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'name' => array('title' => $this->l('Image Maps'), 'width' => 150, 'filter_key' => 'b!name'), 'active' => array('title' => $this->l('Activated'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false) ); - + parent::__construct(); } - + public function afterImageUpload() { /* Generate image with differents size */ @@ -73,64 +73,17 @@ class AdminScenes extends AdminTab } return true; } - - /** - * Build a categories tree - * - * @param array $indexedCategories Array with categories where product is indexed (in order to check checkbox) - * @param array $categories Categories to list - * @param array $current Current category - * @param integer $id_category Current category id - */ - public function recurseCategoryForInclude($indexedCategories, $categories, $current, $id_category = 1, $id_category_default = NULL, $has_suite = array()) - { - global $done; - static $irow; - - $id_obj = (int)(Tools::getValue($this->id)); - if (!isset($done[$current['infos']['id_parent']])) - $done[$current['infos']['id_parent']] = 0; - $done[$current['infos']['id_parent']] += 1; - - $todo = sizeof($categories[$current['infos']['id_parent']]); - $doneC = $done[$current['infos']['id_parent']]; - - $level = $current['infos']['level_depth'] + 1; - - echo ' - - - - - - '.$id_category.' - - '; - for ($i = 2; $i < $level; $i++) - echo ''; - echo '   - - '; - - if ($level > 1) - $has_suite[] = ($todo == $doneC ? 0 : 1); - if (isset($categories[$id_category])) - foreach ($categories[$id_category] AS $key => $row) - if ($key != 'infos') - $this->recurseCategoryForInclude($indexedCategories, $categories, $categories[$id_category][$key], $key, $id_category_default, $has_suite); - } - public function displayForm($isMainTab = true) { parent::displayForm(); - + if (!($obj = $this->loadObject(true))) return; - + $langtags = 'name'; $active = $this->getFieldValue($obj, 'active'); - + echo '
@@ -151,7 +104,7 @@ class AdminScenes extends AdminTab '.$this->l('When a customer hovers over the image with the mouse, a pop-up appears displaying a brief description of the product. The customer can then click to open the product\'s full product page. To achieve this, please define the \'mapping zone\' that, when hovered over, will display the pop-up. Left-click with your mouse to draw the four-sided mapping zone, then release. Then, begin typing the name of the associated product. A list of products appears. Click the appropriate product, then click OK. Repeat these steps for each mapping zone you wish to create. When you have finished mapping zones, click Save Image Map.').'
'; - + echo '
'; foreach ($this->_languages as $language) @@ -162,8 +115,8 @@ class AdminScenes extends AdminTab $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'name'); echo '
'; - - + + echo '
id OR Tools::getValue('active', $obj->active)) ? 'checked="checked" ' : '').'/> @@ -172,8 +125,8 @@ class AdminScenes extends AdminTab

'.$this->l('Activate or deactivate the image map').'

'; - - + + $sceneImageTypes = ImageType::getImagesTypes('scenes'); $largeSceneImageType = NULL; $thumbSceneImageType = NULL; @@ -184,14 +137,14 @@ class AdminScenes extends AdminTab if ($sceneImageType['name'] == 'thumb_scene') $thumbSceneImageType = $sceneImageType; } - - + + echo '

'.$this->l('Format:').' JPG, GIF, PNG. '.$this->l('File size:').' '.(Tools::getMaxUploadSize() / 1024).''.$this->l('KB max.').' '.$this->l('If larger than the image size setting, the image will be reduced to ').' '.$largeSceneImageType['width'].'x'.$largeSceneImageType['height'].'px '.$this->l('(width x height). If smaller than the image-size setting, a white background will be added in order to achieve the correct image size.').'.
'.$this->l('Note: To change image dimensions, please change the \'large_scene\' image type settings to the desired size (in Back Office > Preferences > Images).').'

'; - + if ($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg')) { echo '
'; @@ -223,29 +176,23 @@ class AdminScenes extends AdminTab echo '
'; - echo ' -
-
- - - - - - '; - $categories = Category::getCategories($this->context->language->id, false); - $done = array(); - $index = array(); - if (Tools::isSubmit('categories')) - foreach (Tools::getValue('categories') AS $k => $row) - $index[] = $row; - elseif ($obj->id) - foreach (Scene::getIndexedCategories($obj->id) AS $k => $row) - $index[] = $row['id_category']; - $this->recurseCategoryForInclude($index, $categories, $categories[0][1], 1, null); - echo '
'.$this->l('ID').''.$this->l('Image map name:').'
-

'.$this->l('Mark all checkbox(es) of the categories for which the image map is to appear.').' *

-
-
'; + $selectedCat = array(); + if (Tools::isSubmit('categories')) + foreach (Tools::getValue('categories') as $k => $row) + $selectedCat[] = $row; + else if ($obj->id) + foreach (Scene::getIndexedCategories($obj->id) as $k => $row) + $selectedCat[] = $row['id_category']; + + $trads = array( + 'Home' => $this->l('Home'), + 'selected' => $this->l('selected'), + 'Collapse All' => $this->l('Collapse All'), + 'Expand All' => $this->l('Expand All'), + 'Check All' => $this->l('Check All'), + 'Uncheck All' => $this->l('Uncheck All') + ); + if (Shop::isMultiShopActivated()) { echo '
'; @@ -253,9 +200,16 @@ class AdminScenes extends AdminTab echo '
'; } echo ' + +
+ '; + echo Helper::renderAdminCategorieTree($trads, $selectedCat, 'categories'); + echo ' +
id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg')) ? '' : 'style="display:none;"') .'> -
'; +
+ '; } else { @@ -267,7 +221,7 @@ class AdminScenes extends AdminTab $this->displayAssoShop(); echo ''; } - + } echo '
* '.$this->l('Required field').'
@@ -275,7 +229,7 @@ class AdminScenes extends AdminTab '; } - + public function postProcess() { if (Tools::isSubmit('save_image_map')) diff --git a/admin-dev/themes/template/adminHome.tpl b/admin-dev/themes/template/adminHome.tpl index 6f4ff26d9..f4da1ba25 100644 --- a/admin-dev/themes/template/adminHome.tpl +++ b/admin-dev/themes/template/adminHome.tpl @@ -9,7 +9,7 @@

{l s ='To receive PrestaShop update warnings, you need to activate the allow_url_fopen command in your php.ini config file.'} [{l s ='more info'}]

{l s ='If you don\'t know how to do that, please contact your host administrator !'}


{/if} -{if $show_screencast} +{if $employee->bo_show_screencast}