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

#99 fix redirect url after fill communication preferences #106

Merged
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
8 changes: 6 additions & 2 deletions CRM/Gdpr/Form/UpdatePreference.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,12 @@ public function postProcess() {
//Get the destination url from settings and redirect if we found one.
if (!empty($this->commPrefSettings['completion_redirect'])) {
$destinationURL = !empty($this->commPrefSettings['completion_url']) ? $this->commPrefSettings['completion_url'] : NULL;
$destinationURL = CRM_Utils_System::url($destinationURL, NULL, TRUE);
CRM_Core_Error::debug_var('destinationURL', $destinationURL );
//MV: commenting this line, We have already restriceted the setting to get only absoulte URl.
//check URL is not absolute and no leading slash then add leading slash before redirect.
$parseURL = parse_url($destinationURL);
if (empty($parseURL['host']) && (strpos($destinationURL, '/') !== 0)) {
$destinationURL = '/'.$destinationURL;
}
CRM_Utils_System::redirect($destinationURL);
}
parent::postProcess();
Expand Down
4 changes: 4 additions & 0 deletions CRM/Gdpr/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public static function getCustomSearchDetails($name) {
'name' => $name,
));

//MV: Returns lot of notice message when there is no result found.
if (empty($result['count'])) {
return array('id' => NULL, 'label' => NULL);
}
return array('id' => $result['values'][0]['value'], 'label' => $result['values'][0]['description']);
}

Expand Down
30 changes: 14 additions & 16 deletions templates/CRM/Gdpr/TermsConditionsField.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,34 @@
{$terms_conditions.intro}
</div>
</div>
</div>{* end crm-section *}
</div>{* end crm-section *}
<div class="clear"></div>
{if $terms_conditions.links.global}
<div class="crm-section">
{if $terms_conditions.links.global}
{assign var="link" value=$terms_conditions.links.global}
<div class="label"><label></label></div>
{assign var="link" value=$terms_conditions.links.global}
<div class="label"><label></label></div>
<div class="content terms-conditions-item">
<a href="{$link.url}" class="terms-conditions-link" target="blank">{$link.label}</a>
<div class="terms-conditions-checkbox">
{$form.accept_tc.html}
{$form.accept_tc.html}
</div>
</div>
</div> {* end .crm-section *}
<div class="clear"></div>
{/if}
{if $terms_conditions.links.entity}
{assign var="link" value=$terms_conditions.links.entity}
<div class="clear"></div>
{/if}
{if $terms_conditions.links.entity}
{assign var="link" value=$terms_conditions.links.entity}
<div class="crm-section">
<div class="label"><label></label></div>
<div class="label"><label></label></div>
<div class="content terms-conditions-item">
<a href="{$link.url}" class="terms-conditions-link" target="blank">{$link.label}</a>
<a href="{$link.url}" class="terms-conditions-link" target="blank">{$link.label}</a>
<div class="terms-conditions-checkbox">
{$form.accept_entity_tc.html}
</div>
</div>
{/if}

</div>{* end .content *}
</div>{* end .crm-section *}
<div class="clear"></div>
</div>{* end .crm-section *}
<div class="clear"></div>
{/if}
</fieldset>
<script type="text/javascript">
{literal}
Expand Down