From 6d4fd75a970cdee20aafca4de0fcad7afa2ecc3f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 13 Oct 2014 21:22:54 +0100 Subject: [PATCH] detect repeat configuration changes --- templates/CRM/Core/Form/RecurringEntity.tpl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/templates/CRM/Core/Form/RecurringEntity.tpl b/templates/CRM/Core/Form/RecurringEntity.tpl index 0c742e42c1..985f2b39e3 100644 --- a/templates/CRM/Core/Form/RecurringEntity.tpl +++ b/templates/CRM/Core/Form/RecurringEntity.tpl @@ -215,10 +215,18 @@ } }); - + + //Detect changes in Repeat configuration field + var unsavedChanges = false; + cj('div.crm-core-form-recurringentity-block').on('change', function() { + unsavedChanges = true; + }); + + //If there are changes in repeat configuration enable save button //Dialog for preview repeat Configuration dates cj('#preview-dialog').dialog({ autoOpen: false }); cj('#_qf_Repeat_submit-top, #_qf_Repeat_submit-bottom, #_qf_Activity_upload-top, #_qf_Activity_upload-bottom').click( function (e) { + if (unsavedChanges) { e.preventDefault(); cj('#exclude_date_list option').attr('selected',true); //Copy exclude dates @@ -322,7 +330,12 @@ } }); return false; - }); + } + else { + alert("No changes to save"); + return false; + } + }); //Build Summary var finalSummary = ''; -- 2.25.1