Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix employee avatar not showing at back office #434

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions admin/themes/default/sass/controllers/_customer-thread.sass
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
//Avatar

.employee_avatar_small
@extend .avatar-sm
vertical-align: middle
img
padding: 0
border: none

.employee_avatar
@extend .avatar-lg
display: block!important
margin: 10px auto!important
text-align: center

.avatar-xs
@include avatar(16px, 16px)
.avatar-sm
Expand Down
13 changes: 0 additions & 13 deletions admin/themes/default/sass/partials/_header.sass
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,6 @@
padding: 9px 0
color: $brand-warning
#employee_infos
.employee_name
position: relative
@include ltr
padding-right: 40px !important
@include rtl
padding-left: 40px !important
.employee_avatar_small
.img-thumbnail
@include border-radius(0)
@include avatar(36px, 0px)
position: absolute
top: 0px
@include right(0)
img
border: none
padding: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<span class="employee_avatar_small">
<img class="imgm img-thumbnail" alt="" src="{$employee_image}" width="32" height="32" />
</span>
{$employee_name}

{$employee_name|escape:'html':'UTF-8'}
<br />
({$employee_email|escape:'html':'UTF-8'})
15 changes: 1 addition & 14 deletions admin/themes/default/template/header.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -318,29 +318,16 @@
</li>
{/if}
<li id="employee_infos" class="dropdown">
<a href="{$link->getAdminLink('AdminEmployees')|escape:'html':'UTF-8'}&amp;id_employee={$employee->id|intval}&amp;updateemployee" class="employee_name dropdown-toggle" data-toggle="dropdown">
<span class="employee_avatar_small">
{if isset($employee)}
<img class="imgm img-thumbnail" alt="" src="{$employee->getImage()}" width="32" height="32" />
{/if}
</span>
<a href="{$link->getAdminLink('AdminEmployees')|escape:'html':'UTF-8'}&amp;id_employee={$employee->id|intval}&amp;updateemployee" class="dropdown-toggle" data-toggle="dropdown">
<span class="string-long">{$employee->firstname}&nbsp;{$employee->lastname}</span>
<span class="string-short">{l s='Me'}</span>
<i class="caret"></i>
</a>
<ul id="employee_links" class="dropdown-menu">
<li>
<span class="employee_avatar">
<img class="imgm img-thumbnail" alt="" src="{$employee->getImage()}" width="96" height="96" />
</span>
</li>
<li class="text-center text-nowrap">{$employee->firstname} {$employee->lastname}</li>
<li class="divider"></li>
<li><a href="{$link->getAdminLink('AdminEmployees')|escape:'html':'UTF-8'}&amp;id_employee={$employee->id|intval}&amp;updateemployee"><i class="icon-wrench"></i> {l s='My preferences'}</a></li>
{if $host_mode}
<li><a href="https://www.prestashop.com/cloud/" class="_blank"><i class="icon-wrench"></i> {l s='My PrestaShop account'}</a></li>
{/if}
<li class="divider"></li>
<li><a id="header_logout" href="{$login_link|escape:'html':'UTF-8'}&amp;logout"><i class="icon-signout"></i> {l s='Sign out'}</a></li>
</ul>
</li>
Expand Down
5 changes: 1 addition & 4 deletions classes/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,7 @@ public function isSuperAdmin()

public function getImage()
{
if (!Validate::isLoadedObject($this)) {
return Tools::getAdminImageUrl('prestashop-avatar.png');
}
return Tools::getShopProtocol().'profile.prestashop.com/'.urlencode($this->email).'.jpg';
return Context::getContext()->link->getMediaLink(_PS_IMG_.Configuration::get('PS_LOGO'));
}

public function getLastElementsForNotify($element)
Expand Down
6 changes: 3 additions & 3 deletions controllers/admin/AdminLogsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function __construct()
)
);
$this->list_no_link = true;
$this->_select .= 'CONCAT(LEFT(e.firstname, 1), \'. \', e.lastname) employee';
$this->_select .= 'CONCAT(e.firstname, \' \', e.lastname) employee';
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'employee e ON (a.id_employee = e.id_employee)';
$this->_use_found_rows = false;
parent::__construct();
Expand Down Expand Up @@ -124,8 +124,8 @@ public function displayEmployee($value, $tr)
$template = $this->context->smarty->createTemplate('controllers/logs/employee_field.tpl', $this->context->smarty);
$employee = new Employee((int)$tr['id_employee']);
$template->assign(array(
'employee_image' => $employee->getImage(),
'employee_name' => $value
'employee_name' => $value,
'employee_email' => $employee->email,
));
return $template->fetch();
}
Expand Down