function whomToSendMail($module, $insertion_mode, $assigntype) { global $adb; if ($insertion_mode != "edit") { if ($assigntype == 'U') { sendNotificationToOwner($module, $this); } elseif ($assigntype == 'T') { $groupid = vtlib_purify($_REQUEST['assigned_group_id']); sendNotificationToGroups($groupid, $this->id, $module); } } }
global $adb; $local_log =& LoggerManager::getLogger('AccountsAjax'); global $currentModule; $acntObj = CRMEntity::getInstance($currentModule); $ajaxaction = $_REQUEST["ajxaction"]; if ($ajaxaction == "DETAILVIEW") { $crmid = $_REQUEST["recordid"]; $tablename = $_REQUEST["tableName"]; $fieldname = $_REQUEST["fldName"]; $fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]); if ($crmid != "") { $acntObj->retrieve_entity_info($crmid, "Accounts"); $acntObj->column_fields[$fieldname] = $fieldvalue; if ($fieldname == 'annual_revenue') { $acntObj->column_fields[$fieldname] = getConvertedPrice($fieldvalue); } $acntObj->id = $crmid; $acntObj->mode = "edit"; $acntObj->save("Accounts"); if ($acntObj->column_fields['notify_owner'] == 1) { sendNotificationToOwner('Accounts', &$acntObj); } if ($acntObj->id != "") { echo ":#:SUCCESS"; } else { echo ":#:FAILURE"; } } else { echo ":#:FAILURE"; } }
$return_action = "DetailView"; } if (isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") { $return_id = vtlib_purify($_REQUEST['return_id']); } $local_log->debug("Saved record with id of " . $return_id); //code added for returning back to the current view after edit from list view if ($_REQUEST['return_viewname'] == '') { $return_viewname = '0'; } if ($_REQUEST['return_viewname'] != '') { $return_viewname = vtlib_purify($_REQUEST['return_viewname']); } //Send notification mail to the assigned to owner about the vtiger_account creation if ($focus->column_fields['notify_owner'] == 1 || $focus->column_fields['notify_owner'] == 'on') { $status = sendNotificationToOwner('Accounts', $focus); } header("Location: index.php?action={$return_action}&module={$return_module}&parenttab={$parenttab}&record={$return_id}&viewname={$return_viewname}&start=" . vtlib_purify($_REQUEST['pagenumber']) . $search); /** Function to save Accounts custom field info into database * @param integer $entity_id - accountid */ function save_customfields($entity_id) { global $log; $log->debug("Entering save_customfields(" . $entity_id . ") method ..."); $log->info("save customfields invoked"); global $adb; $dbquery = "SELECT * FROM customfields WHERE module = 'Accounts'"; $result = $adb->pquery($dbquery, array()); $custquery = "SELECT * FROM vtiger_accountcf WHERE vtiger_accountid = ?"; $cust_result = $adb->pquery($custquery, array($entity_id));
} $focus->save("Potentials"); $pot_id = $return_id = $focus->id; $parenttab = getParentTab(); if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") { $return_module = vtlib_purify($_REQUEST['return_module']); } else { $return_module = "Potentials"; } if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") { $return_action = vtlib_purify($_REQUEST['return_action']); } else { $return_action = "DetailView"; } if (isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") { $return_id = vtlib_purify($_REQUEST['return_id']); } $local_log->debug("Saved record with id of " . $return_id); //code added for returning back to the current view after edit from list view if ($_REQUEST['return_viewname'] == '') { $return_viewname = '0'; } if ($_REQUEST['return_viewname'] != '') { $return_viewname = vtlib_purify($_REQUEST['return_viewname']); } //Added to send mail to the vtiger_potential-owner about the Potential if ($focus->mode == 'edit') { // For non-edit mode sending mail is handled during Save $status = sendNotificationToOwner('Potentials', $focus); } header("Location: index.php?action={$return_action}&module={$return_module}&parenttab={$parenttab}&record={$return_id}&pot_id={$pot_id}&viewname={$return_viewname}&start=" . vtlib_purify($_REQUEST['pagenumber']) . $search);
global $currentModule; $cntObj = CRMEntity::getInstance($currentModule); $ajaxaction = $_REQUEST["ajxaction"]; if ($ajaxaction == "DETAILVIEW") { $crmid = $_REQUEST["recordid"]; $tablename = $_REQUEST["tableName"]; $fieldname = $_REQUEST["fldName"]; $fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]); if ($crmid != "") { $cntObj->retrieve_entity_info($crmid, "Contacts"); $cntObj->column_fields[$fieldname] = $fieldvalue; $cntObj->id = $crmid; $cntObj->mode = "edit"; $cntObj->save("Contacts"); if ($cntObj->column_fields['notify_owner'] == 1) { sendNotificationToOwner('Contacts', &$cntObj); } $email_res = $adb->pquery("select email from vtiger_contactdetails where contactid=?", array($cntObj->id)); $email = $adb->query_result($email_res, 0, 'email'); $check_available = $adb->pquery("select * from vtiger_portalinfo where id=?", array($cntObj->id)); $update = ''; if ($fieldname == 'email') { $active = $adb->query_result($check_available, 0, 'isactive'); $update = false; if ($active != '' && $active == 1) { $sql = "update vtiger_portalinfo set user_name=?,isactive=? where id=?"; $adb->pquery($sql, array($fieldvalue, $active, $crmid)); $email = $fieldvalue; $result = $adb->pquery("select user_password from vtiger_portalinfo where id=?", array($cntObj->id)); $password = $adb->query_result($result, 0, 'user_password'); $update = true;
//changes made to send mail to portal user when we use ajax edit $data_array = array(); $data_array['first_name'] = $_REQUEST['firstname']; $data_array['last_name'] = $_REQUEST['lastname']; $data_array['email'] = $_REQUEST['email']; $data_array['portal_url'] = '<a href="' . $PORTAL_URL . '" style="font-family:Arial, Helvetica, sans-serif;font-size:12px; font-weight:bolder;text-decoration:none;color: #4242FD;">' . $mod_strings['Please Login Here'] . '</a>'; $value = getmail_contents_portalUser($data_array, $password, "LoginDetails"); $contents = $value["body"]; $subject = $value["subject"]; $log->info("Customer Portal Information Updated in database and details are going to send => '" . $_REQUEST['email'] . "'"); if ($insert == 'true' || $update == 'true') { $mail_status = send_mail('Support', $_REQUEST['email'], $current_user->user_name, '', $subject, $contents); } $log->info("After return from the SendMailToCustomer function. Now control will go to the header."); } //END -- Code for Create Customer Portal Users password and Send Mail $log->info("This Page is redirected to : " . $return_module . " / " . $return_action . "& return id =" . $return_id); //code added for returning back to the current view after edit from list view if ($_REQUEST['return_viewname'] == '') { $return_viewname = '0'; } if ($_REQUEST['return_viewname'] != '') { $return_viewname = vtlib_purify($_REQUEST['return_viewname']); } $parenttab = getParentTab(); //Send notification mail to the assigned to owner about the contact creation if ($focus->column_fields['notify_owner'] == 1 || $focus->column_fields['notify_owner'] == 'on') { $status = sendNotificationToOwner('Contacts', $focus); } header("Location: index.php?action={$return_action}&module={$return_module}&parenttab={$parenttab}&record={$return_id}&activity_mode={$activitymode}&viewname={$return_viewname}&start=" . vtlib_purify($_REQUEST['pagenumber'])); }
require_once 'include/database/PearDatabase.php'; global $adb; $local_log =& LoggerManager::getLogger('PotentialsAjax'); global $currentModule; $modObj = CRMEntity::getInstance($currentModule); $ajaxaction = $_REQUEST["ajxaction"]; if ($ajaxaction == "DETAILVIEW") { $crmid = $_REQUEST["recordid"]; $tablename = $_REQUEST["tableName"]; $fieldname = $_REQUEST["fldName"]; $fieldvalue = utf8RawUrlDecode($_REQUEST["fieldValue"]); if ($crmid != "") { $modObj->retrieve_entity_info($crmid, "Potentials"); $modObj->column_fields[$fieldname] = $fieldvalue; $_REQUEST[$fieldname] = $fieldvalue; if ($fieldname == 'amount') { $modObj->column_fields[$fieldname] = getConvertedPrice($fieldvalue); } $modObj->id = $crmid; $modObj->mode = "edit"; $modObj->save("Potentials"); sendNotificationToOwner('Potentials', &$modObj); if ($modObj->id != "") { echo ":#:SUCCESS"; } else { echo ":#:FAILURE"; } } else { echo ":#:FAILURE"; } }