Skip to content

Commit

Permalink
Merge pull request #16 from lemniscus/smarty-notices-profile-dynamic
Browse files Browse the repository at this point in the history
fix notice in non-dialog mode too, make var name clearer, fix another notice
  • Loading branch information
eileenmcnaughton authored Mar 11, 2023
2 parents 5ae6078 + 81648fb commit b0d2a00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions CRM/Profile/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ protected static function handleDuplicateChecking(&$errors, $fields, $form) {
// The button 'Save Matching Contact' is added in buildForm
// but we only decide here whether ot not to show it - ie
// if validation failed due to there being duplicates.
CRM_Core_Smarty::singleton()->assign('isDuplicate', 1);
CRM_Core_Smarty::singleton()->assign('showSaveDuplicateButton', 1);
}
else {
$errors['_qf_default'] = ts('A record already exists with the same information.');
Expand Down Expand Up @@ -904,10 +904,11 @@ public function buildQuickForm(): void {
$this->freeze();
}

// Assign FALSE, here - this is overwritten during form validation
// if duplicates are found during submit.
CRM_Core_Smarty::singleton()->assign('showSaveDuplicateButton', FALSE);

if ($this->isEntityReferenceContactCreateMode()) {
// Assign FALSE, here - this is overwritten during form validation
// if duplicates are found during submit.
CRM_Core_Smarty::singleton()->assign('isDuplicate', FALSE);
$this->addElement(
'xbutton',
$this->getButtonName('upload', 'duplicate'),
Expand Down
8 changes: 4 additions & 4 deletions templates/CRM/Profile/Form/Dynamic.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div id="crm-container" class="crm-container crm-public" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}">
{/if}

{if array_key_exists('_qf_Edit_upload_duplicate', $form) && $isDuplicate}
{if $showSaveDuplicateButton}
<div class="crm-submit-buttons">
{$form._qf_Edit_upload_duplicate.html}
</div>
Expand All @@ -50,7 +50,7 @@
{if $action eq 2 and $multiRecordFieldListing}
<h1>{ts}Edit Details{/ts}</h1>
<div class="crm-submit-buttons" style='float:right'>
{include file="CRM/common/formButtons.tpl" location=''}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if}
{include file="CRM/common/formButtons.tpl" location=''}{if $showSaveDuplicateButton}{$form._qf_Edit_upload_duplicate.html}{/if}
</div>
{/if}

Expand Down Expand Up @@ -94,7 +94,7 @@
<div class="content description">{$field.help_pre}</div>
</div>
{/if}
{if $field.options_per_line}
{if array_key_exists('options_per_line', $field) && $field.options_per_line}
<div class="crm-section editrow_{$n}-section form-item" id="editrow-{$n}">
<div class="label">{$form.$n.label}</div>
<div class="content edit-value">
Expand Down Expand Up @@ -201,7 +201,7 @@
</div>
{/if}
<div class="crm-submit-buttons" style='{$floatStyle}'>
{include file="CRM/common/formButtons.tpl" location=''}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if}
{include file="CRM/common/formButtons.tpl" location=''}{if $showSaveDuplicateButton}{$form._qf_Edit_upload_duplicate.html}{/if}
{if $includeCancelButton}
<a class="button cancel" href="{$cancelURL}">
<span>
Expand Down

0 comments on commit b0d2a00

Please sign in to comment.