From babf3591bc13017f95f33e2c31e76fce66438aa8 Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Thu, 11 May 2023 00:13:34 -0600 Subject: [PATCH] Allow deletion of primary email inline on contact --- templates/CRM/Contact/Form/Inline/Email.tpl | 7 +------ templates/CRM/Contact/Page/View/Summary.js | 7 ++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/CRM/Contact/Form/Inline/Email.tpl b/templates/CRM/Contact/Form/Inline/Email.tpl index e84a752511..bcd1447ee0 100644 --- a/templates/CRM/Contact/Form/Inline/Email.tpl +++ b/templates/CRM/Contact/Form/Inline/Email.tpl @@ -37,12 +37,7 @@ {$form.email.$blockId.on_hold.html} {$form.email.$blockId.is_bulkmail.html} {$form.email.$blockId.is_primary.1.html} - - {if $blockId gt 1} - - {/if} - + {/section} diff --git a/templates/CRM/Contact/Page/View/Summary.js b/templates/CRM/Contact/Page/View/Summary.js index 71c5ca47c5..e07de3e7f0 100644 --- a/templates/CRM/Contact/Page/View/Summary.js +++ b/templates/CRM/Contact/Page/View/Summary.js @@ -259,9 +259,14 @@ //unset and set first as primary if ($('[class$=is_primary] input:checked', row).length > 0) { $('[class$=is_primary] input', row).prop('checked', false); - $('[class$=is_primary] input:first', form).prop('checked', true ); + $('[class$=is_primary] input:visible:first', form).prop('checked', true ); } $('.add-more-inline', form).show(); + if ($('[class$=is_primary] input:visible', form).length == 0) { + $('.add-more-inline', form).click(); + $('[class$=is_primary] input:visible:first', form).prop('checked', true ); + } + e.preventDefault(); }) // Delete an address -- 2.25.1