grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/
/**
* Remainers handling
* Use Calls/Meatings module EditView.
* The Remainders need a Scheduler table.
*/
var Reminders = {
// override this by user preferences on reminder init
defaultValues: {
popup: true,
email: true,
timer_popup: 1800,
timer_email: 3600
},
// we have to disabled the reminders on details view - override this on initialization
disabled: false,
errors: [],
addDefaultReminderInterval: null,
defaultInvitees: [],
getInviteeView: function(id, module, moduleId, relatedValue) {
if(!id) id = '';
// TODO: add a template for this
if(!Reminders.disabled) {
var inviteeView = '
';
}
else {
var inviteeView = '';
}
return inviteeView;
},
addAllInvitees: function(e) {
var inviteesList = '';
var alreadyInvited = new Array();
// add all default invitees
$.each(Reminders.defaultInvitees, function(i,e){
var dataModule = e.personModule;
var dataId = e.personModuleId;
var relatedValue = e.personName;
// Fix for issue #1161: dont add duplicate invitees
var associativeArray = new Array();
associativeArray['dataModule'] = dataModule;
associativeArray['dataId'] = dataId;
associativeArray['relatedValue'] = relatedValue;
alreadyInvited.push(associativeArray);
inviteesList += Reminders.getInviteeView(false, dataModule, dataId, relatedValue);
});
// this function need a scheduler table!
$('table#schedulerTable tr.schedulerAttendeeRow').each(function(i,e){
var dataModule = $(e).attr('data-module');
var dataId = $(e).attr('data-id');
var relatedValue = $(e).find('td[scope="row"]').first().text();
// Fix for issue #1161: dont add duplicate invitees
var result = new Array();
for( var i = 0, len = alreadyInvited.length; i < len; i++ ) {
if(alreadyInvited[i]['dataModule'] === dataModule) {
if(alreadyInvited[i]['dataId'] === dataId) {
if(alreadyInvited[i]['relatedValue'].trim() === relatedValue.trim()) {
result = alreadyInvited[i];
break;
}
}
}
}
if(typeof result.dataModule == 'undefined') {
inviteesList += Reminders.getInviteeView(false, dataModule, dataId, relatedValue);
}
});
$(e).find('.invitees_list').first().html(inviteesList);
},
addInvitees: function(e, invitees) {
if(!e) e = document.getElementById('reminder_template');
var inviteesList = '';
$.each(invitees, function(i,e){
inviteesList += Reminders.getInviteeView(e.id, e.module, e.module_id, e.value);
});
$(e).find('.invitees_list').first().html(inviteesList);
},
getBool: function(value) {
if(!value || value === false || value === 0 || value === '0' || value === '' || (typeof value == 'string' && value.toLowerCase() === 'false') ) {
value = false;
}
else {
value = true;
}
return value;
},
setCheckboxValue: function(sel, value) {
value = Reminders.getBool(value);
sel.prop('checked', value);
sel.attr('checked', value);
},
setSelectValue: function(sel, value) {
sel.val(value);
sel.find('option').prop('selected', false);
sel.find('option[value="' + value + '"]').attr('selected', 'selected');
sel.find('option[value="' + value + '"]').prop('selected', true);
},
setReminderPopupChkbox: function(e, value) {
Reminders.setCheckboxValue($(e).find('.popup_chkbox'), value);
},
setReminderEmailChkbox: function(e, value) {
Reminders.setCheckboxValue($(e).find('.email_chkbox'), value);
},
setPopupTimerSelectValue: function(e, value) {
Reminders.setSelectValue($(e).find('.timer_sel_popup'), value);
},
setEmailTimerSelectValue: function(e, value) {
Reminders.setSelectValue($(e).find('.timer_sel_email'), value);
},
addReminder: function(e, popup, email, timer_popup, timer_email, reminderId, invitees) {
if(!reminderId) reminderId = '';
Reminders.setReminderPopupChkbox($('#reminder_template'), popup);
Reminders.setReminderEmailChkbox($('#reminder_template'), email);
Reminders.setPopupTimerSelectValue($('#reminder_template'), timer_popup);
Reminders.setEmailTimerSelectValue($('#reminder_template'), timer_email);
if(!invitees) {
Reminders.addAllInvitees($('#reminder_template'));
}
else {
Reminders.addInvitees(e, invitees);
}
$('#reminder_view').append('