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>
Thu, 15 Oct 2015 20:27:56 +0000 (20:27 +0000)
jshint fixes

ang/crmUi.js

index b5c76b2c3de065a3c4d3e33ac79a13daeb58a1bb..ac2fc74aa36d0067d90d0154ee2be6f4b140d985 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')
+               });
+              }
             });
         }
       };