N°2323.4 Fix regression introduced in previous commit

Current user picture was no longer displayed in the portal
This commit is contained in:
Molkobain
2019-06-20 10:34:10 +02:00
parent db20244212
commit 56b9eb6cf3
3 changed files with 8 additions and 2 deletions

View File

@@ -126,6 +126,7 @@ class ormDocument
*/
public function GetDisplayURL($sClass, $Id, $sAttCode)
{
// TODO: When refactoring this with the URLMaker system, mind to also change calls in the portal (look for the "p_object_document_display" route)
return utils::GetAbsoluteUrlAppRoot() . "pages/ajax.render.php?operation=display_document&class=$sClass&id=$Id&field=$sAttCode";
}
@@ -137,6 +138,7 @@ class ormDocument
{
// Compute a signature to reset the cache anytime the data changes (this is acceptable if used only with icon files)
$sSignature = md5($this->GetData());
// TODO: When refactoring this with the URLMaker system, mind to also change calls in the portal (look for the "p_object_document_display" route)
return utils::GetAbsoluteUrlAppRoot() . "pages/ajax.document.php?operation=download_document&class=$sClass&id=$Id&field=$sAttCode&s=$sSignature&cache=86400";
}

View File

@@ -331,7 +331,8 @@ class UserProfileBrickController extends BrickController
$aFormData['error'] = $e->GetMessage();
}
$aFormData['picture_url'] = $oImage->GetDownloadURL(get_class($oCurContact), $oCurContact->GetKey(), $sPictureAttCode);
// TODO: This should be changed when refactoring the ormDocument GetDisplayUrl() and GetDownloadUrl() in iTop 2.8
$aFormData['picture_url'] = $oApp['url_generator']->generate('p_object_document_display', array('sObjectClass' => get_class($oCurContact), 'sObjectId' => $oCurContact->GetKey(), 'sObjectField' => $sPictureAttCode, 'cache' => 86400, 't' => time()));
$aFormData['validation'] = array(
'valid' => true,
'messages' => array()

View File

@@ -648,7 +648,10 @@ class ApplicationHelper
$oImage = $oContact->Get('picture');
if (is_object($oImage) && !$oImage->IsEmpty())
{
$sContactPhotoUrl = $oImage->GetDownloadURL(get_class($oContact), $oContact->GetKey(), 'picture');
// Note: At this stage of runtime, the UrlGenerator context is not properly initialized (lacks the baseurl among other things).
// The Context is set later by the RouterListener during an event, so we manually put the base url with utils::GetAbsoluteUrlExecPage()
// TODO: This should be changed when refactoring the ormDocument GetDisplayUrl() and GetDownloadUrl() in iTop 2.8
$sContactPhotoUrl = utils::GetAbsoluteUrlExecPage().$oApp['url_generator']->generate('p_object_document_display', array('sObjectClass' => get_class($oContact), 'sObjectId' => $oContact->GetKey(), 'sObjectField' => 'picture', 'cache' => 86400));
}
else
{