Skip to content

Commit

Permalink
Update condition checks on variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Codencode committed Sep 20, 2024
1 parent 6aedfc7 commit d9c8f68
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions controllers/admin/AdminBlockListingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ public function displayAjaxSaveBlockContent()
}

if (strpos($picto, $this->module->img_path_perso) !== false) {
if ($picto) {
if ($picto != '') {
$picto = basename($picto);
}
$blockPsr->setIcon('');
$blockPsr->setCustomIcon($picto);
} else {
if ($picto) {
if ($picto != '') {
$parts = explode('/', $picto);
$parts = array_slice($parts , -3);
$picto = implode('/', $parts);
Expand All @@ -197,7 +197,7 @@ public function displayAjaxSaveBlockContent()

if (is_bool($validUpload) && $validUpload === false) {
// Remove Custom icon
if ($blockPsr->getCustomIcon()) {
if ($blockPsr->getCustomIcon() != '') {
$filePath = blockreassurance::$static_folder_file_upload . '/' . basename($blockPsr->getCustomIcon());
if (file_exists($filePath)) {
unlink($filePath);
Expand Down
4 changes: 2 additions & 2 deletions src/Repository/PsreassuranceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ public function getAllBlockByStatus($id_lang = 1)
$item['is_svg'] = !empty($item['custom_icon'])
&& in_array(\ImageManager::getMimeType(\blockreassurance::$static_folder_file_upload . $item['custom_icon']), $xmlMimes);

if ($item['custom_icon']) {
if ($item['custom_icon'] != '') {
$item['custom_icon'] = \blockreassurance::$static_img_path_perso . '/' . $item['custom_icon'];
} elseif ($item['icon']) {
} elseif ($item['icon'] != '') {
$item['icon'] = \blockreassurance::$static_img_path . $item['icon'];
}
}
Expand Down

0 comments on commit d9c8f68

Please sign in to comment.