Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undeclared javascript variables #22879

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions ang/crmMailing/RadioDate.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,23 @@
if (context === 'userInput' && $(this).val() === '' && $(this).siblings('.crm-form-date').val().length) {
schedule.mode = 'at';
schedule.datetime = '?';
} else {
} else {
var d = new Date(),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear(),
hours = '' + d.getHours(),
minutes = '' + d.getMinutes();
var submittedDate = $(this).val();
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear(),
hours = '' + d.getHours(),
minutes = '' + d.getMinutes(),
submittedDate = $(this).val();
if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;
if (hours.length < 2) hours = '0' + hours;
if (minutes.length < 2) minutes = '0' + minutes;
date = [year, month, day].join('-');
time = [hours, minutes, "00"].join(':');
currentDate = date + ' ' + time;
var isInPast = (submittedDate.length && submittedDate.match(/^[0-9\-]+ [0-9\:]+$/) && isDateBefore(submittedDate, currentDate, 4*60*60*1000));
var
date = [year, month, day].join('-'),
time = [hours, minutes, "00"].join(':'),
currentDate = date + ' ' + time,
isInPast = (submittedDate.length && submittedDate.match(/^[0-9\-]+ [0-9\:]+$/) && isDateBefore(submittedDate, currentDate, 4*60*60*1000));
ngModel.$setValidity('dateTimeInThePast', !isInPast);
if (lastAlert && lastAlert.isOpen) {
lastAlert.close();
Expand Down
4 changes: 2 additions & 2 deletions ang/crmMailing/Recipients.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
}
},
results: function(data) {
results = {
var results = {
children: $.map(data.values, function(obj) {
if('civicrm_mailing' === rcpAjaxState.entity) {
return obj["api.MailingRecipients.getcount"] > 0 ? { id: obj.id + ' ' + rcpAjaxState.entity + ' ' + rcpAjaxState.type,
Expand All @@ -271,7 +271,7 @@
(rcpAjaxState.entity == 'civicrm_group'? 'Group' : 'Mailing'));
}

more = data.more_results || !(rcpAjaxState.entity == 'civicrm_mailing' && rcpAjaxState.type == 'exclude');
var more = data.more_results || !(rcpAjaxState.entity == 'civicrm_mailing' && rcpAjaxState.type == 'exclude');

if (more && !data.more_results) {
if (rcpAjaxState.type == 'include') {
Expand Down
4 changes: 2 additions & 2 deletions ang/crmMailing/Templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
},
results: function(data) {

results = {
var results = {
children: $.map(data.values, function(obj) {
return { id: obj.id, text: obj.label };
})
Expand All @@ -98,7 +98,7 @@
results.text = ts('Message Templates');
}

more = data.more_results;
var more = data.more_results;

if (more && !data.more_results) {
Comment on lines +101 to 103
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe out-of-scope for this PR, but I just did a double take at the logic of these 2 lines. What the 💩???
😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes it: #23188

rcpAjaxState.page_n += rcpAjaxState.page_i;
Expand Down