Skip to content

Commit

Permalink
Merge pull request #22031 from eileenmcnaughton/image
Browse files Browse the repository at this point in the history
Ensure imageUrl is always set
  • Loading branch information
demeritcowboy authored Nov 11, 2021
2 parents 06cc0f4 + ccf2c88 commit 7f45a47
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
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

0 comments on commit 7f45a47

Please sign in to comment.