CRM-17303 Fix to ensure you cannot schedule Mailings for in the past
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 30 Sep 2015 04:12:16 +0000 (04:12 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 16 Oct 2015 23:04:54 +0000 (23:04 +0000)
jshint fixes

ang/crmUi.js

index 448e8809195eb9a387d0bc94debbf13e9e8a0b5e..2c223886df2c54d7a4cbd470dae4aabd2c052e07 100644 (file)
                 requiredLength = 8;
               }
               ngModel.$setValidity('incompleteDateTime', !($(this).val().length && $(this).val().length !== requiredLength));
+              var d = new Date(),
+                month = '' + (d.getMonth() + 1),
+                day = '' + d.getDate(),
+                year = d.getFullYear();
+              if (month.length < 2) month = '0' + month;
+              if (day.length < 2) day = '0' + day;
+              currentDate = [year, month, day].join('-');
+              ngModel.$setValidity('dateTimeInThePast', !($(this).val().length && $(this).val() < currentDate));
+              if ($(this).val().length && $(this).val() < currentDate){
+               crmUiAlert({
+                 text: ts('The Scheulded date and time is in the past'),
+                 title: ts('Error')
+               });
+              }
             });
         }
       };