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

Ensure imageUrl is always set #22031

Merged
merged 1 commit into from
Nov 11, 2021
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
4 changes: 1 addition & 3 deletions CRM/Contact/Form/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,7 @@ public function setDefaultValues() {
//set address block defaults
CRM_Contact_Form_Edit_Address::setDefaultValues($defaults, $this);

if (!empty($defaults['image_URL'])) {
$this->assign("imageURL", CRM_Utils_File::getImageURL($defaults['image_URL']));
}
$this->assign('imageURL', !empty($defaults['image_URL']) ? CRM_Utils_File::getImageURL($defaults['image_URL']) : '');

//set location type and country to default for each block
$this->blockSetDefaults($defaults);
Expand Down
5 changes: 2 additions & 3 deletions CRM/Contact/Page/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ public function preProcess() {
$path = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $this->_contactId);
CRM_Utils_System::appendBreadCrumb([['title' => ts('View Contact'), 'url' => $path]]);

if ($image_URL = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'image_URL')) {
$this->assign("imageURL", CRM_Utils_File::getImageURL($image_URL));
}
$image_URL = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactId, 'image_URL');
$this->assign('imageURL', $image_URL ? CRM_Utils_File::getImageURL($image_URL) : '');

// also store in session for future use
$session = CRM_Core_Session::singleton();
Expand Down
4 changes: 2 additions & 2 deletions templates/CRM/Contact/Page/View/Summary-tab.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
</div>
<div class="contactCardRight">
{crmRegion name="contact-basic-info-right"}
{if !empty($imageURL)}
{if $imageURL}
<div id="crm-contact-thumbnail">
{include file="CRM/Contact/Page/ContactImage.tpl"}
</div>
{/if}
<div class="{if !empty($imageURL)} float-left{/if}">
<div class="{if $imageURL} float-left{/if}">
<div class="crm-summary-basic-block crm-summary-block">
{include file="CRM/Contact/Page/Inline/Basic.tpl"}
</div>
Expand Down