示例#1
0
    function getEmailContent($reportRecordModel)
    {
        $site_URL = vglobal('site_URL');
        $currentModule = vglobal('currentModule');
        $companydetails = getCompanyDetails();
        $logo = $site_URL . '/storage/Logo/' . $companydetails['logoname'];
        $body = '<table width="700" cellspacing="0" cellpadding="0" border="0" align="center" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; text-decoration: none; ">
			<tr>
				<td> </td>
			</tr>
			<tr>
				<td>
				<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tr>
							<td>
							<table width="100%" cellspacing="0" cellpadding="0" border="0">
									<tr>
										<td rowspan="4" ><img height="30" src=' . $logo . '></td>
									</tr>
							</table>
							</td>
						</tr>
						<tr>
							<td>
							<table width="100%" cellspacing="0" cellpadding="0" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
									<tr>
										<td valign="top">
										<table width="100%" cellspacing="0" cellpadding="5" border="0">
												<tr>
													<td align="right" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(66, 66, 253);"> </td>
												</tr>
												<tr>
													<td> </td>
												</tr>
												<tr>
													<td style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; text-align: justify; line-height: 20px;"> ' . vtranslate('LBL_AUTO_GENERATED_REPORT_EMAIL', $currentModule) . '</td>
												</tr>
												<tr>
													<td align="center">
													<table width="75%" cellspacing="0" cellpadding="10" border="0" style="border: 2px solid rgb(180, 180, 179); background-color: rgb(226, 226, 225); font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal;">
															<tr>
																<td><b>' . vtranslate('LBL_REPORT_NAME', $currentModule) . ' </b> : <font color="#990000"><strong> <a href=' . $site_URL . '/' . $reportRecordModel->getDetailViewUrl() . '>' . $reportRecordModel->getName() . '</a></strong></font> </td>
															</tr>
															<tr>
																<td><b>' . vtranslate('LBL_DESCRIPTION', $currentModule) . ' :</b> <font color="#990000"><strong>' . $reportRecordModel->get('description') . '</strong></font> </td>
															</tr>
													</table>
													</td>
												</tr>
										</table>
										</td>
										<td width="1%" valign="top"> </td>
									</tr>
							</table>
							</td>
						</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td> </td>
			</tr>
			<tr>
				<td> </td>
			</tr>
			<tr>
				<td> </td>
			</tr>
	</table>';
        return $body;
    }
示例#2
0
    public static function getPortalEmailContents($entityData, $password, $type = '')
    {
        require_once 'config.inc.php';
        global $PORTAL_URL, $HELPDESK_SUPPORT_EMAIL_ID;
        $adb = PearDatabase::getInstance();
        $moduleName = $entityData->getModuleName();
        $companyDetails = getCompanyDetails();
        $portalURL = '<a href="' . $PORTAL_URL . '" style="font-family:Arial, Helvetica, sans-serif;font-size:12px; font-weight:bolder;text-decoration:none;color: #4242FD;">' . getTranslatedString('Please Login Here', $moduleName) . '</a>';
        //here id is hardcoded with 5. it is for support start notification in vtiger_notificationscheduler
        $query = 'SELECT vtiger_emailtemplates.subject,vtiger_emailtemplates.body
					FROM vtiger_notificationscheduler
						INNER JOIN vtiger_emailtemplates ON vtiger_emailtemplates.templateid=vtiger_notificationscheduler.notificationbody
					WHERE schedulednotificationid=5';
        $result = $adb->pquery($query, array());
        $body = decode_html($adb->query_result($result, 0, 'body'));
        $contents = $body;
        $contents = str_replace('$contact_name$', $entityData->get('firstname') . " " . $entityData->get('lastname'), $contents);
        $contents = str_replace('$login_name$', $entityData->get('email'), $contents);
        $contents = str_replace('$password$', $password, $contents);
        $contents = str_replace('$URL$', $portalURL, $contents);
        $contents = str_replace('$support_team$', getTranslatedString('Support Team', $moduleName), $contents);
        $contents = str_replace('$logo$', '<img src="cid:logo" />', $contents);
        //Company Details
        $contents = str_replace('$address$', $companyDetails['address'], $contents);
        $contents = str_replace('$companyname$', $companyDetails['companyname'], $contents);
        $contents = str_replace('$phone$', $companyDetails['phone'], $contents);
        $contents = str_replace('$companywebsite$', $companyDetails['website'], $contents);
        $contents = str_replace('$supportemail$', $HELPDESK_SUPPORT_EMAIL_ID, $contents);
        if ($type == "LoginDetails") {
            $temp = $contents;
            $value["subject"] = decode_html($adb->query_result($result, 0, 'subject'));
            $value["body"] = $temp;
            return $value;
        }
        return $contents;
    }
示例#3
0
/**	Function to set all the Mailer properties
  *	$mail 		-- reference of the mail object
  *	$subject	-- subject of the email you want to send
  *	$contents	-- body of the email you want to send
  *	$from_email	-- from email id which will be displayed in the mail
  *	$from_name	-- from name which will be displayed in the mail
  *	$to_email 	-- to email address  -- This can be an email in a single string, a comma separated
  *			   list of emails or an array of email addresses
  *	$attachment	-- whether we want to attach the currently selected file or all vtiger_files.
  				[values = current,all] - optional
  *	$emailid	-- id of the email object which will be used to get the vtiger_attachments - optional
  */
function setMailerProperties($mail, $subject, $contents, $from_email, $from_name, $to_email, $attachment = '', $emailid = '', $module = '', $logo = '')
{
    $adb = PearDatabase::getInstance();
    $adb->println("Inside the function setMailerProperties");
    $CompanyDetails = getCompanyDetails();
    $logourl = 'storage/Logo/' . $CompanyDetails['logoname'];
    if ($logo == 1) {
        $image = getimagesize($logourl);
        $mail->AddEmbeddedImage($logourl, 'logo', $CompanyDetails['logoname'], "base64", $image['mime']);
    }
    $mail->Subject = $subject;
    //Added back as we have changed php mailer library, older library was using html_entity_decode before sending mail
    $mail->Body = decode_html($contents);
    //$mail->Body = html_entity_decode(nl2br($contents));	//if we get html tags in mail then we will use this line
    $mail->AltBody = strip_tags(preg_replace(array("/<p>/i", "/<br>/i", "/<br \\/>/i"), array("\n", "\n", "\n"), $contents));
    $mail->IsSMTP();
    //set mailer to use SMTP
    //$mail->Host = "smtp1.example.com;smtp2.example.com";  // specify main and backup server
    setMailServerProperties($mail);
    //Handle the from name and email for HelpDesk
    $mail->From = $from_email;
    $userFullName = trim(VTCacheUtils::getUserFullName($from_name));
    if (empty($userFullName)) {
        $rs = $adb->pquery("select first_name,last_name from vtiger_users where user_name=?", array($from_name));
        $num_rows = $adb->num_rows($rs);
        if ($num_rows > 0) {
            $fullName = getFullNameFromQResult($rs, 0, 'Users');
            VTCacheUtils::setUserFullName($from_name, $fullName);
        }
    } else {
        $from_name = $userFullName;
    }
    $mail->FromName = decode_html($from_name);
    if ($to_email != '') {
        if (is_array($to_email)) {
            for ($j = 0, $num = count($to_email); $j < $num; $j++) {
                $mail->addAddress($to_email[$j]);
            }
        } else {
            $_tmp = explode(",", $to_email);
            for ($j = 0, $num = count($_tmp); $j < $num; $j++) {
                $mail->addAddress($_tmp[$j]);
            }
        }
    }
    //commented so that it does not add from_email in reply to
    //$mail->AddReplyTo($from_email);
    $mail->WordWrap = 50;
    //If we want to add the currently selected file only then we will use the following function
    if ($attachment == 'current' && $emailid != '') {
        if (isset($_REQUEST['filename_hidden'])) {
            $file_name = $_REQUEST['filename_hidden'];
        } else {
            $file_name = $_FILES['filename']['name'];
        }
        addAttachment($mail, $file_name, $emailid);
    }
    //This will add all the vtiger_files which are related to this record or email
    if ($attachment == 'all' && $emailid != '') {
        addAllAttachments($mail, $emailid);
    }
    $mail->IsHTML(true);
    // set email format to HTML
    return;
}
示例#4
0
 /**
  * Replaces Company details variables with values
  * @param string $content - text
  * @return string text with replaced values
  */
 public function replaceCompanyFields(&$content)
 {
     if (empty($content)) {
         return $content;
     }
     $companyDetails = getCompanyDetails();
     foreach ($companyDetails as $name => $value) {
         if ($name === 'logoname') {
             $value = 'storage/Logo/' . $value;
         }
         $content = str_replace('$Company+' . $name . '$', $value, $content);
         $newLabel = Vtiger_Language_Handler::getLanguageTranslatedString($this->get('language'), $name, 'Settings:Vtiger');
         $content = str_replace('%Company+' . $name . '%', $newLabel, $content);
     }
     return $content;
 }
示例#5
0
 /**
  * Returns array containing company fields array - [fieldname => translatedname]
  * @return array company fields with translated names
  */
 public static function getCompanyFields()
 {
     $company = [];
     $companyDetails = getCompanyDetails();
     foreach ($companyDetails as $key => $value) {
         if ($key == 'organization_id') {
             continue;
         }
         $company[$key] = vtranslate($key, 'Settings:Vtiger');
     }
     return $company;
 }
function getCompanyDetails()
{
    if (isset($_REQUEST['loginID '])) {
        $loginID = $_REQUEST['loginID'];
    }
    $rm = new Response_Methods();
    $companyDetailsArray = array();
    //$dataResultSet=$rm->getSpecificDetails($companyID,'company_details_t','company_id');
    $dataResultSet = $rm->getAllDetails('company_details_t');
    if (mysql_num_rows($dataResultSet) > 0) {
        while ($row = mysql_fetch_array($dataResultSet)) {
            $getCompanyFields['companyID'] = $row['company_id'];
            $pending_requests_count = $rm->getPendingRequest($row['company_id']);
            $getCompanyFields['companyName'] = $row['company_name'];
            $getCompanyFields['companyTanNo'] = $row['company_tan_no'];
            $getCompanyFields['companyPanNo'] = $row['company_pan_no'];
            $getCompanyFields['companyAddress'] = $row['company_address'];
            $getCompanyFields['pendingRequest'] = $pending_requests_count;
            $cdate = $row['company_created_date'];
            $getCompanyFields['createdDate'] = date('Y/m/d', strtotime($cdate));
            array_push($companyDetailsArray, $getCompanyFields);
        }
        $result = $rm->get_anything_details_success($companyDetailsArray, 'Company');
        return $result;
    } else {
        $result = $rm->get_anything_details_fail('Company');
        return $result;
    }
}
echo getCompanyDetails();