[-] BO : fixed bug #PSCFV-3439 part2
This commit is contained in:
@@ -25,6 +25,29 @@
|
||||
*}
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
|
||||
{block name="input"}
|
||||
{if $input.type == 'file'}
|
||||
{if isset($input.display_image) && $input.display_image}
|
||||
{if isset($fields_value.image) && $fields_value.image}
|
||||
<div id="image">
|
||||
{$fields_value.image}
|
||||
<p align="center">{l s='File size'} {$fields_value.size}kb</p>
|
||||
{if $shared_category}
|
||||
<p class="warn">{l s='If you delete this picture it\'s will be deleted for all shared shop'}</p>
|
||||
{/if}
|
||||
<br>
|
||||
<a href="{$current}&{$identifier}={$form_id}&token={$token}&{if $shared_category}forcedeleteImage=1{else}deleteImage=1{/if}">
|
||||
<img src="../img/admin/delete.gif" alt="{l s='Delete'}" /> {l s='Delete'}
|
||||
</a>
|
||||
</div><br />
|
||||
{/if}
|
||||
{/if}
|
||||
<input type="file" name="{$input.name}" {if isset($input.id)}id="{$input.id}"{/if} />
|
||||
{if !empty($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
{block name="description"}
|
||||
{$smarty.block.parent}
|
||||
{if ($input.name == 'groupBox')}
|
||||
@@ -35,4 +58,4 @@
|
||||
<span>{$input.customer}</span><br />
|
||||
</p>
|
||||
{/if}
|
||||
{/block}
|
||||
{/block}
|
||||
|
||||
@@ -1220,12 +1220,12 @@ abstract class ObjectModelCore
|
||||
*
|
||||
* @return bool success
|
||||
*/
|
||||
public function deleteImage()
|
||||
public function deleteImage($force_delete = false)
|
||||
{
|
||||
if (!$this->id)
|
||||
return false;
|
||||
|
||||
if (!$this->hasMultishopEntries())
|
||||
if ($force_delete || !$this->hasMultishopEntries())
|
||||
{
|
||||
/* Deleting object images and thumbnails (cache) */
|
||||
if ($this->image_dir)
|
||||
|
||||
@@ -453,6 +453,9 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
$this->tpl_form_vars['shared_category'] = Validate::isLoadedObject($obj) && $obj->hasMultishopEntries();
|
||||
|
||||
if (Shop::isFeatureActive())
|
||||
$this->fields_form['input'][] = array(
|
||||
'type' => 'shop',
|
||||
@@ -493,7 +496,25 @@ class AdminCategoriesControllerCore extends AdminController
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('forcedeleteImage'))
|
||||
{
|
||||
$this->processForceDeleteImage();
|
||||
Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminCategories').'&conf=7');
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
|
||||
public function processForceDeleteImage()
|
||||
{
|
||||
$category = $this->loadObject();
|
||||
if (Validate::isLoadedObject($category))
|
||||
$category->deleteImage(true);
|
||||
}
|
||||
|
||||
public function processAdd()
|
||||
{
|
||||
$id_category = (int)Tools::getValue('id_category');
|
||||
|
||||
Reference in New Issue
Block a user