mirror of
https://github.com/salesagility/SuiteCRM.git
synced 2025-02-11 00:42:27 +00:00
2c48735fbe
# Conflicts: # README.md # composer.lock # data/BeanFactory.php # files.md5 # modules/AOD_Index/AOD_Index.php # modules/AOR_Conditions/conditionLines.php # modules/AOW_Conditions/conditionLines.php # modules/Activities/SetAcceptStatus.php # modules/Administration/views/view.backups.php # modules/Calendar/controller.php # modules/Campaigns/WizardCampaignSave.php # modules/Contacts/AcceptDecline.php # modules/Emails/Compose.php # modules/Opportunities/OpportunityFormBase.php # modules/Project/chart.php # modules/SavedSearch/index.php # service/v3_1/SugarWebServiceUtilv3_1.php # soap/SoapPortalHelper.php # suitecrm_version.php # tests/unit/phpunit/data/SugarBeanTest.php # tests/unit/phpunit/include/SugarFolders/SugarFolderTest.php # tests/unit/phpunit/modules/AOS_Products/AOS_ProductsTest.php # themes/SuiteP/css/Dawn/style.css # themes/SuiteP/css/Day/style.css # themes/SuiteP/css/Dusk/style.css # themes/SuiteP/css/Night/style.css
142 lines
7.7 KiB
PHP
Executable file
142 lines
7.7 KiB
PHP
Executable file
<?php
|
|
if (!defined('sugarEntry') || !sugarEntry) {
|
|
die('Not A Valid Entry Point');
|
|
}
|
|
|
|
$db = DBManagerFactory::getInstance();
|
|
|
|
$even_id = $_GET['event'];
|
|
$delegate_id = $_GET['delegate'];
|
|
$type = $_GET['type'];
|
|
$response = $_GET['response'];
|
|
|
|
//get event
|
|
$event = BeanFactory::newBean('FP_events');
|
|
$event->retrieve($even_id);
|
|
|
|
if ($type == 'c') {
|
|
$event->load_relationship('fp_events_contacts'); // get related contacts
|
|
|
|
if ($response == 'accept') {
|
|
|
|
//check to see if they have already responded to the email
|
|
$check_q = 'SELECT email_responded FROM fp_events_contacts_c WHERE fp_events_contactsfp_events_ida="'.$event->id.'" AND fp_events_contactscontacts_idb="'.$delegate_id.'"';
|
|
$check = $db->getOne($check_q);
|
|
//update contact to accepted
|
|
$query = 'UPDATE fp_events_contacts_c SET accept_status="Accepted", email_responded="1" WHERE fp_events_contactsfp_events_ida="'.$event->id.'" AND fp_events_contactscontacts_idb="'.$delegate_id.'" AND email_responded="0"';
|
|
if ($db->query($query) && $check != '1') {
|
|
if (!IsNullOrEmptyString($event->accept_redirect)) {
|
|
$url = $event->accept_redirect;
|
|
header('Location: ' . $url);
|
|
} else {
|
|
echo 'Thank you for accepting';
|
|
}
|
|
} else {
|
|
echo 'You have already responded to the invitation or there was a problem with the link. Please contact the sender of the invite for help.';
|
|
}
|
|
} else {
|
|
if ($response == 'decline') {
|
|
//check to see if they have already responded to the email
|
|
$check_q = 'SELECT email_responded FROM fp_events_contacts_c WHERE fp_events_contactsfp_events_ida="'.$event->id.'" AND fp_events_contactscontacts_idb="'.$delegate_id.'"';
|
|
$check = $db->getOne($check_q);
|
|
//update contact to accepted
|
|
$query = 'UPDATE fp_events_contacts_c SET accept_status="Declined", email_responded="1" WHERE fp_events_contactsfp_events_ida="'.$event->id.'" AND fp_events_contactscontacts_idb="'.$delegate_id.'" AND email_responded="0"';
|
|
|
|
if ($db->query($query) && $check != '1') {
|
|
if (!IsNullOrEmptyString($event->decline_redirect)) {
|
|
$url = $event->decline_redirect;
|
|
header('Location: ' . $url);
|
|
} else {
|
|
echo 'Thank you for declining';
|
|
}
|
|
} else {
|
|
echo 'You have already responded to the invitation or there was a problem with the link. Please contact the sender of the invite for help.';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($type == 't') {
|
|
$event->load_relationship('fp_events_prospects_1'); //get related targets
|
|
|
|
if ($response == 'accept') {
|
|
//check to see if they have already responded to the email
|
|
$check_q = 'SELECT email_responded FROM fp_events_prospects_1_c WHERE fp_events_prospects_1fp_events_ida="'.$event->id.'" AND fp_events_prospects_1prospects_idb="'.$delegate_id.'"';
|
|
$check = $db->getOne($check_q);
|
|
|
|
//update contact to accepted
|
|
$query = 'UPDATE fp_events_prospects_1_c SET accept_status="Accepted", email_responded="1" WHERE fp_events_prospects_1fp_events_ida="'.$event->id.'" AND fp_events_prospects_1prospects_idb="'.$delegate_id.'" AND email_responded="0"';
|
|
if ($db->query($query) && $check != '1') {
|
|
if (!IsNullOrEmptyString($event->accept_redirect)) {
|
|
$url = $event->accept_redirect;
|
|
header('Location: ' . $url);
|
|
} else {
|
|
echo 'Thank you for accepting';
|
|
}
|
|
} else {
|
|
echo 'You have already responded to the invitation or there was a problem with the link. Please contact the sender of the invite for help.';
|
|
}
|
|
} else {
|
|
if ($response == 'decline') {
|
|
//check to see if they have already responded to the email
|
|
$check_q = 'SELECT email_responded FROM fp_events_prospects_1_c WHERE fp_events_prospects_1fp_events_ida="'.$event->id.'" AND fp_events_prospects_1prospects_idb="'.$delegate_id.'"';
|
|
$check = $db->getOne($check_q);
|
|
//update contact to accepted
|
|
$query = 'UPDATE fp_events_prospects_1_c SET accept_status="Declined", email_responded="1" WHERE fp_events_prospects_1fp_events_ida="'.$event->id.'" AND fp_events_prospects_1prospects_idb="'.$delegate_id.'" AND email_responded="0"';
|
|
if ($db->query($query) && $check != '1') {
|
|
if (!IsNullOrEmptyString($event->decline_redirect)) {
|
|
$url = $event->decline_redirect;
|
|
header('Location: ' . $url);
|
|
} else {
|
|
echo 'Thank you for declining';
|
|
}
|
|
} else {
|
|
echo 'You have already responded to the invitation or there was a problem with the link. Please contact the sender of the invite for help.';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($type == 'l') {
|
|
$event->load_relationship('fp_events_leads_1'); //get related leads
|
|
|
|
if ($response == 'accept') {
|
|
//check to see if they have already responded to the email
|
|
$check_q = 'SELECT email_responded FROM fp_events_leads_1_c WHERE ffp_events_leads_1fp_events_ida="'.$event->id.'" AND fp_events_leads_1leads_idb="'.$delegate_id.'"';
|
|
$check = $db->getOne($check_q);
|
|
//update contact to accepted
|
|
$query = 'UPDATE fp_events_leads_1_c SET accept_status="Accepted", email_responded="1" WHERE fp_events_leads_1fp_events_ida="'.$event->id.'" AND fp_events_leads_1leads_idb="'.$delegate_id.'" AND email_responded="0"';
|
|
if ($db->query($query) && $check != '1') {
|
|
if (!IsNullOrEmptyString($event->accept_redirect)) {
|
|
$url = $event->accept_redirect;
|
|
header('Location: ' . $url);
|
|
} else {
|
|
echo 'Thank you for accepting';
|
|
}
|
|
} else {
|
|
echo 'There was a problem with the link please contact the sender of the invite';
|
|
}
|
|
} else {
|
|
if ($response == 'decline') {
|
|
//check to see if they have already responded to the email
|
|
$check_q = 'SELECT email_responded FROM fp_events_leads_1_c WHERE fp_events_leads_1fp_events_ida="'.$event->id.'" AND fp_events_leads_1leads_idb="'.$delegate_id.'"';
|
|
$check = $db->getOne($check_q);
|
|
//update contact to accepted
|
|
$query = 'UPDATE fp_events_leads_1_c SET accept_status="Declined", email_responded="1" WHERE fp_events_leads_1fp_events_ida="'.$event->id.'" AND fp_events_leads_1leads_idb="'.$delegate_id.'" AND email_responded="0"';
|
|
|
|
if ($db->query($query) && $check != '1') {
|
|
if (!IsNullOrEmptyString($event->decline_redirect)) {
|
|
$url = $event->decline_redirect;
|
|
header('Location: ' . $url);
|
|
} else {
|
|
echo 'Thank you for declining';
|
|
}
|
|
} else {
|
|
echo 'There was a problem with the link please contact the sender of the invite';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Function for basic field validation (present and neither empty nor only white space nor just 'http://')
|
|
function IsNullOrEmptyString($question)
|
|
{
|
|
return (!isset($question) || trim($question)==='' || $question =='http://');
|
|
}
|