Exclude dates js fix, do not add same date multiple times
authorunknown <priyanka.karan26@gmail.com>
Fri, 19 Sep 2014 16:14:30 +0000 (17:14 +0100)
committerdeepak-srivastava <deepak.srivastava.0303@gmail.com>
Fri, 3 Oct 2014 09:08:27 +0000 (10:08 +0100)
templates/CRM/Core/Form/RecurringEntity.tpl

index 6253698d8c6942dcfd0269f3fdcdffd586c37c49..e9ad71d2aaa87e2bd1de86b25b79e56553e16c20 100644 (file)
     //Exclude list function
     function addToExcludeList(val) {
       if(val !== ""){
-        cj('#exclude_date_list').append('<option>'+val+'</option>');
+        var exists = false;
+        for(var i = 0, opts = document.getElementById('exclude_date_list').options; i < opts.length; ++i){
+          if(opts[i].text == val){
+            exists = true;
+            break;
+          }
+        }
+        if (exists == false){
+          cj('#exclude_date_list').append('<option>'+val+'</option>');
+        }
       }
     }