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

CRM-20564 custom date fields in on-behalf-of forms broken #10354

Merged
merged 1 commit into from
May 17, 2017
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
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/ContributionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function preProcess() {
}

// this was used prior to the cleverer this_>getContactID - unsure now
$this->_userID = CRM_Core_Session::singleton()->get('userID');
$this->_userID = CRM_Core_Session::singleton()->getLoggedInContactID();

$this->_contactID = $this->_membershipContactID = $this->getContactID();
$this->_mid = NULL;
Expand Down
32 changes: 17 additions & 15 deletions templates/CRM/UF/Form/Fields.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
{if $field.skipDisplay}
{continue}
{/if}

{assign var=profileFieldName value=$field.name}
{if $prefix}
{assign var="formElement" value=$form.$prefix.$profileFieldName}
{else}
{assign var="formElement" value=$form.$profileFieldName}
{/if}

{if $field.groupTitle != $fieldset}
{if $fieldset != $zeroField}
{if $groupHelpPost && $action neq 4}
Expand All @@ -26,8 +34,6 @@
{/if}
{/if}

{assign var=profileFieldName value=$field.name}

{if $field.field_type eq "Formatting"}
{if $action neq 4 && $action neq 1028}
{$field.help_pre}
Expand All @@ -41,19 +47,15 @@
{/if}
{if $field.options_per_line != 0}
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$profileFieldName}">
<div class="label option-label">{if $prefix}{$form.$prefix.$profileFieldName.label}{else}{$form.$profileFieldName.label}{/if}</div>
<div class="label option-label">{$formElement.label}</div>
<div class="content 3">

{assign var="count" value="1"}
{strip}
<table class="form-layout-compressed">
<tr>
{* sort by fails for option per line. Added a variable to iterate through the element array*}
{assign var="index" value="1"}
{if $prefix}
{assign var="formElement" value=$form.$prefix.$profileFieldName}
{else}
{assign var="formElement" value=$form.$profileFieldName}
{/if}
{foreach name=outer key=key item=item from=$formElement}
{if $index < 10}
{assign var="index" value=`$index+1`}
Expand All @@ -77,7 +79,7 @@
{else}
<div class="crm-section editrow_{$profileFieldName}-section form-item" id="editrow-{$profileFieldName}">
<div class="label">
{if $prefix}{$form.$prefix.$profileFieldName.label}{else}{$form.$profileFieldName.label}{/if}
{$formElement.label}
</div>
<div class="content">
{if $profileFieldName|substr:0:3 eq 'im-'}
Expand All @@ -91,15 +93,15 @@
{include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$profileFieldName title=null context="profile"}
{elseif $field.is_datetime_field && $action & 4}
<span class="crm-frozen-field">
{$form.$profileFieldName.value|crmDate:$field.smarty_view_format}
{$formElement.value|crmDate:$field.smarty_view_format}
<input type="hidden"
name="{$form.$profileFieldName.name}"
value="{$form.$profileFieldName.value}" id="{$form.$profileFieldName.name}"
name="{$formElement.name}"
value="{$formElement.value}" id="{$formElement.name}"
>
</span>
{elseif $profileFieldName|substr:0:5 eq 'phone'}
{assign var="phone_ext_field" value=$profileFieldName|replace:'phone':'phone_ext'}
{if $prefix}{$form.$prefix.$profileFieldName.html}{else}{$form.$profileFieldName.html}{/if}
{$formElement.html}
{if $form.$phone_ext_field.html}
&nbsp;{$form.$phone_ext_field.html}
{/if}
Expand All @@ -111,12 +113,12 @@
{if $field.html_type eq 'File' && $viewOnlyPrefixFileValues}
{$viewOnlyPrefixFileValues.$prefix.$profileFieldName}
{else}
{$form.$prefix.$profileFieldName.html}
{$formElement.html}
{/if}
{elseif $field.html_type eq 'File' && $viewOnlyFileValues}
{$viewOnlyFileValues.$profileFieldName}
{else}
{$form.$profileFieldName.html}
{$formElement.html}
{/if}
{/if}

Expand Down