本文整理汇总了PHP中GlobalVariable类的典型用法代码示例。如果您正苦于以下问题:PHP GlobalVariable类的具体用法?PHP GlobalVariable怎么用?PHP GlobalVariable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GlobalVariable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_module
function save_module($module)
{
global $updateInventoryProductRel_deduct_stock;
if ($this->HasDirectImageField) {
$this->insertIntoAttachment($this->id, $module);
}
$updateInventoryProductRel_deduct_stock = true;
//Checking if quote_id is present and updating the quote status
if ($this->column_fields['quote_id'] != '') {
$newStatus = GlobalVariable::getVariable('QuoteStatusOnSalesOrderSave', 'Accepted');
if ($newStatus != 'DoNotChange') {
$qt_id = $this->column_fields['quote_id'];
$query1 = 'update vtiger_quotes set quotestage=? where quoteid=?';
$this->db->pquery($query1, array($newStatus, $qt_id));
}
}
//in ajax save we should not call this function, because this will delete all the existing product values
if ($_REQUEST['action'] != 'SalesOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') {
//Based on the total Number of rows we will save the product relationship with this entity
saveInventoryProductDetails($this, 'SalesOrder');
if (vtlib_isModuleActive("InventoryDetails")) {
InventoryDetails::createInventoryDetails($this, 'SalesOrder');
}
} else {
if ($_REQUEST['action'] == 'SalesOrderAjax' || $_REQUEST['action'] == 'MassEditSave') {
$updateInventoryProductRel_deduct_stock = false;
}
}
// Update the currency id and the conversion rate for the sales order
$update_query = "update vtiger_salesorder set currency_id=?, conversion_rate=? where salesorderid=?";
$update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
$this->db->pquery($update_query, $update_params);
}
示例2: duplicaterec
function duplicaterec($currentModule, $record_id, $bmapname)
{
global $adb, $current_user;
$focus = CRMEntity::getInstance($currentModule);
$focus->retrieve_entity_info($record_id, $currentModule);
// Retrieve relations map
//$bmapname = 'BusinessMapping_'.$currentModule.'_DuplicateRelations';
$cbMapid = GlobalVariable::getVariable('BusinessMapping_' . $bmapname, cbMap::getMapIdByName($bmapname));
if ($cbMapid) {
$cbMap = cbMap::getMapByID($cbMapid);
$maped_relations = $cbMap->DuplicateRelations()->getRelatedModules();
}
// Duplicate Records that this Record is dependent of
if ($cbMapid && $cbMap->DuplicateRelations()->DuplicateDirectRelations()) {
$invmods = getInventoryModules();
foreach ($focus->column_fields as $fieldname => $value) {
$sql = 'SELECT * FROM vtiger_field WHERE columnname = ? AND uitype IN (10,50,51,57,58,59,73,68,76,75,81,78,80)';
$result = $adb->pquery($sql, array($fieldname));
if ($adb->num_rows($result) == 1 && !empty($value)) {
$module = getSalesEntityType($value);
if (in_array($module, $invmods)) {
continue;
}
// we can't duplicate these
$handler = vtws_getModuleHandlerFromName($module, $current_user);
$meta = $handler->getMeta();
$entity = CRMEntity::getInstance($module);
$entity->mode = '';
$entity->retrieve_entity_info($value, $module);
$entity->column_fields = DataTransform::sanitizeRetrieveEntityInfo($entity->column_fields, $meta);
$entity->save($module);
$focus->column_fields[$fieldname] = $entity->id;
}
}
}
$handler = vtws_getModuleHandlerFromName($currentModule, $current_user);
$meta = $handler->getMeta();
$focus->column_fields = DataTransform::sanitizeRetrieveEntityInfo($focus->column_fields, $meta);
$focus->saveentity($currentModule);
// no workflows for this one => so we don't reenter this process
$new_record_id = $focus->id;
$curr_tab_id = gettabid($currentModule);
$related_list = get_related_lists($curr_tab_id, $maped_relations);
dup_related_lists($new_record_id, $currentModule, $related_list, $record_id, $maped_relations);
$dependents_list = get_dependent_lists($curr_tab_id);
$dependent_tables = get_dependent_tables($dependents_list, $currentModule);
dup_dependent_rec($record_id, $currentModule, $new_record_id, $dependent_tables, $maped_relations);
return $new_record_id;
}
示例3: cbws_SearchGlobalVar
function cbws_SearchGlobalVar($gvname, $defaultvalue, $gvmodule, $user)
{
global $log, $adb, $current_user;
$entityName = 'GlobalVariable';
$webserviceObject = VtigerWebserviceObject::fromName($adb, $entityName);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
if ($meta->hasReadAccess() !== true) {
return $defaultvalue;
}
require_once 'modules/GlobalVariable/GlobalVariable.php';
$rdo = GlobalVariable::getVariable($gvname, $defaultvalue, $gvmodule, $user->id);
VTWS_PreserveGlobal::flush();
return $rdo;
}
示例4: save_module
function save_module($module)
{
global $updateInventoryProductRel_deduct_stock;
$updateInventoryProductRel_deduct_stock = true;
//Checking if salesorderid is present and updating the SO status
if (!empty($this->column_fields['salesorder_id'])) {
$newStatus = GlobalVariable::getVariable('SalesOrderStatusOnInvoiceSave', 'Approved');
if ($newStatus != 'DoNotChange') {
$so_id = $this->column_fields['salesorder_id'];
$query1 = 'update vtiger_salesorder set sostatus=? where salesorderid=?';
$this->db->pquery($query1, array($newStatus, $so_id));
}
}
//in ajax save we should not call this function, because this will delete all the existing product values
if (isset($this->_recurring_mode) && $this->_recurring_mode == 'recurringinvoice_from_so' && isset($this->_salesorderid) && $this->_salesorderid != '') {
// We are getting called from the RecurringInvoice cron service!
$this->createRecurringInvoiceFromSO();
if (vtlib_isModuleActive("InventoryDetails")) {
InventoryDetails::createInventoryDetails($this, 'Invoice');
}
} else {
if (isset($_REQUEST)) {
if ($_REQUEST['action'] != 'InvoiceAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') {
//Based on the total Number of rows we will save the product relationship with this entity
saveInventoryProductDetails($this, 'Invoice');
if (vtlib_isModuleActive("InventoryDetails")) {
InventoryDetails::createInventoryDetails($this, 'Invoice');
}
} else {
if ($_REQUEST['action'] == 'InvoiceAjax' || $_REQUEST['action'] == 'MassEditSave') {
$updateInventoryProductRel_deduct_stock = false;
}
}
}
}
// Update the currency id and the conversion rate for the invoice
$update_query = "update vtiger_invoice set currency_id=?, conversion_rate=? where invoiceid=?";
$update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id);
$this->db->pquery($update_query, $update_params);
}
示例5: checkFileAccess
}
// Mark the status - running
$cronTask->markRunning();
checkFileAccess($cronTask->getHandlerFile());
$logbg->info('Execute: ' . $cronTask->getHandlerFile());
require_once $cronTask->getHandlerFile();
// Mark the status - finished
$cronTask->markFinished();
} catch (Exception $e) {
$msg = sprintf("[ERROR]: %s - cron task execution throwed exception.\n", $cronTask->getName());
$msg .= $e->getMessage();
$msg .= "\n";
echo $msg;
$logbg->info($msg);
//Send email with error.
$mailto = GlobalVariable::getVariable('Debug_Send_VtigerCron_Error', '');
if ($mailto != '') {
require_once 'modules/Emails/mail.php';
require_once 'modules/Emails/Emails.php';
global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
$from_name = $HELPDESK_SUPPORT_NAME;
$form_mail = $HELPDESK_SUPPORT_EMAIL_ID;
$mailsubject = "[ERROR]: " . $cronTask->getName() . " - cron task execution throwed exception.";
$mailcontent = '<pre>' . $e . '</pre>';
send_mail('Emails', $mailto, $from_name, $form_mail, $mailsubject, $mailcontent);
}
}
}
} else {
echo "Access denied!";
}
示例6: sendEmail
public function sendEmail()
{
require_once 'modules/Emails/mail.php';
require_once 'modules/Emails/Emails.php';
global $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $currentModule;
$recipientEmails = $this->getRecipientEmails();
$emails_to = '';
foreach ($recipientEmails as $name => $email) {
$emails_to .= $email . ',';
}
$emails_to = trim($emails_to, ',');
$currentTime = date('Y-m-d H:i:s');
$subject = $this->reportname . ' - ' . $currentTime . ' (' . DateTimeField::getDBTimeZone() . ')';
$contents = getTranslatedString('LBL_AUTO_GENERATED_REPORT_EMAIL', $currentModule) . '<br/><br/>';
$contents .= '<b>' . getTranslatedString('LBL_REPORT_NAME', $currentModule) . ' :</b> ' . $this->reportname . '<br/>';
$contents .= '<b>' . getTranslatedString('LBL_DESCRIPTION', $currentModule) . ' :</b><br/>' . $this->reportdescription . '<br/><br/>';
$baseFileName = utf8_decode(preg_replace('/[^a-zA-Z0-9_-\\s]/', '', $this->reportname) . '_' . preg_replace('/[^a-zA-Z0-9_-\\s]/', '', date('YmdHis')));
$oReportRun = new ReportRun($this->id);
$reportFormat = $this->scheduledFormat;
$attachments = array();
if ($reportFormat == 'pdf' || $reportFormat == 'both') {
$fileName = $baseFileName . '.pdf';
$filePath = 'storage/' . $fileName;
$attachments[$fileName] = $filePath;
$_REQUEST['filename_hidden_pdf'] = $filePath;
$pdf = $oReportRun->getReportPDF(NULL);
$pdf->Output($filePath, 'F');
}
if ($reportFormat == 'excel' || $reportFormat == 'both') {
$fileName = $baseFileName . '.xls';
$filePath = 'storage/' . $fileName;
$attachments[$fileName] = $filePath;
$_REQUEST['filename_hidden_xls'] = $filePath;
$oReportRun->writeReportToExcelFile($filePath, NULL);
}
$sendifempty = GlobalVariable::getVariable('Report_Send_Scheduled_ifEmpty', 1);
if ($sendifempty or $oReportRun->number_of_rows > 0) {
$mail_status = send_mail('Emails', $emails_to, $HELPDESK_SUPPORT_NAME, $HELPDESK_SUPPORT_EMAIL_ID, $subject, $contents, '', '', 'attReports');
foreach ($attachments as $attachmentName => $path) {
unlink($path);
}
}
}
示例7: saveInventoryProductDetails
/** Function used to save the Inventory product details for the passed entity
* @param object reference $focus - object reference to which we want to save the product details from REQUEST values where as the entity will be Purchase Order, Sales Order, Quotes or Invoice
* @param string $module - module name
* @param $update_prod_stock - true or false (default), if true we have to update the stock for PO only
* @return void
*/
function saveInventoryProductDetails(&$focus, $module, $update_prod_stock = 'false', $updateDemand = '')
{
global $log, $adb;
$id = $focus->id;
$log->debug("Entering into function saveInventoryProductDetails({$module}).");
//Added to get the convertid
if (isset($_REQUEST['convert_from']) && $_REQUEST['convert_from'] != '') {
$id = vtlib_purify($_REQUEST['return_id']);
} else {
if (isset($_REQUEST['duplicate_from']) && $_REQUEST['duplicate_from'] != '') {
$id = vtlib_purify($_REQUEST['duplicate_from']);
}
}
$ipr_cols = $adb->getColumnNames('vtiger_inventoryproductrel');
$ext_prod_arr = array();
if ($focus->mode == 'edit') {
if ($_REQUEST['taxtype'] == 'group') {
$all_available_taxes = getAllTaxes('available', '', 'edit', $id);
}
$return_old_values = '';
if ($module != 'PurchaseOrder') {
$return_old_values = 'return_old_values';
}
//we will retrieve the existing product details and store it in a array and then delete all the existing product details and save new values, retrieve the old value and update stock only for SO, Quotes and Invoice not for PO
//$ext_prod_arr = deleteInventoryProductDetails($focus->id,$return_old_values);
deleteInventoryProductDetails($focus);
} else {
if ($_REQUEST['taxtype'] == 'group') {
$all_available_taxes = getAllTaxes('available', '', 'edit', $id);
}
}
$tot_no_prod = $_REQUEST['totalProductCount'];
if ($module != 'PurchaseOrder') {
if (GlobalVariable::getVariable('B2B', '1') == '1') {
$acvid = $focus->column_fields['account_id'];
} else {
$acvid = $focus->column_fields['contact_id'];
}
} else {
$acvid = $focus->column_fields['vendor_id'];
}
//If the taxtype is group then retrieve all available taxes, else retrive associated taxes for each product inside loop
$prod_seq = 1;
for ($i = 1; $i <= $tot_no_prod; $i++) {
//if the product is deleted then we should avoid saving the deleted products
if ($_REQUEST["deleted" . $i] == 1) {
continue;
}
$prod_id = vtlib_purify($_REQUEST['hdnProductId' . $i]);
if (isset($_REQUEST['productDescription' . $i])) {
$description = vtlib_purify($_REQUEST['productDescription' . $i]);
}
/*else{
$desc_duery = "select vtiger_crmentity.description AS product_description from vtiger_crmentity where vtiger_crmentity.crmid=?";
$desc_res = $adb->pquery($desc_duery,array($prod_id));
$description = $adb->query_result($desc_res,0,"product_description");
} */
$qty = vtlib_purify($_REQUEST['qty' . $i]);
$listprice = vtlib_purify($_REQUEST['listPrice' . $i]);
$comment = vtlib_purify($_REQUEST['comment' . $i]);
//we have to update the Product stock for PurchaseOrder if $update_prod_stock is true
if ($module == 'PurchaseOrder' && $update_prod_stock == 'true') {
addToProductStock($prod_id, $qty);
}
if ($module == 'SalesOrder') {
if ($updateDemand == '-') {
deductFromProductDemand($prod_id, $qty);
} elseif ($updateDemand == '+') {
addToProductDemand($prod_id, $qty);
}
}
$query = "insert into vtiger_inventoryproductrel(id, productid, sequence_no, quantity, listprice, comment, description) values(?,?,?,?,?,?,?)";
$qparams = array($focus->id, $prod_id, $prod_seq, $qty, $listprice, $comment, $description);
$adb->pquery($query, $qparams);
$lineitem_id = $adb->getLastInsertID();
$sub_prod_str = $_REQUEST['subproduct_ids' . $i];
if (!empty($sub_prod_str)) {
$sub_prod = explode(":", $sub_prod_str);
for ($j = 0; $j < count($sub_prod); $j++) {
$query = "insert into vtiger_inventorysubproductrel(id, sequence_no, productid) values(?,?,?)";
$qparams = array($focus->id, $prod_seq, $sub_prod[$j]);
$adb->pquery($query, $qparams);
}
}
$prod_seq++;
if ($module != 'PurchaseOrder') {
//update the stock with existing details
updateStk($prod_id, $qty, $focus->mode, $ext_prod_arr, $module);
}
//we should update discount and tax details
$updatequery = "update vtiger_inventoryproductrel set ";
$updateparams = array();
//set the discount percentage or discount amount in update query, then set the tax values
if ($_REQUEST['discount_type' . $i] == 'percentage') {
//.........这里部分代码省略.........
示例8: AlphabeticalSearch
$smarty->assign("RETURN_MODULE", 'Emails');
}
if (isset($_REQUEST['select'])) {
$smarty->assign("SELECT", 'enable');
}
$alphabetical = AlphabeticalSearch($currentModule, 'Popup', 'notes_title', 'true', 'basic', $popuptype, "", "", $url);
break;
// Special case handling (for curr_row value) for Services module
// Special case handling (for curr_row value) for Services module
case 'Services':
if (isset($_REQUEST['curr_row'])) {
$curr_row = vtlib_purify($_REQUEST['curr_row']);
$smarty->assign("CURR_ROW", $curr_row);
$url_string .= "&curr_row=" . vtlib_purify($_REQUEST['curr_row']);
}
$smarty->assign('Service_Default_Units', GlobalVariable::getVariable('Service_Default_Units', ''));
// vtlib customization: Generic hook for Popup selection
// vtlib customization: Generic hook for Popup selection
default:
$smarty->assign("SINGLE_MOD", $currentModule);
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != '') {
$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
}
$alphabetical = AlphabeticalSearch($currentModule, 'Popup', $focus->def_basicsearch_col, 'true', 'basic', $popuptype, "", "", $url);
if (isset($_REQUEST['select'])) {
$smarty->assign("SELECT", 'enable');
}
break;
// END
}
// vtlib customization: Initialize focus to get generic popup
示例9: load_user
/**
* Load a user based on the user_name in $this
* @return -- this if load was successul and null if load failed.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
* All Rights Reserved.
*/
function load_user($user_password)
{
$usr_name = $this->column_fields["user_name"];
$maxFailedLoginAttempts = GlobalVariable::getVariable('Application_MaxFailedLoginAttempts', 5, 'Users');
if (isset($_SESSION['loginattempts'])) {
$_SESSION['loginattempts'] += 1;
} else {
$_SESSION['loginattempts'] = 1;
}
if ($_SESSION['loginattempts'] > $maxFailedLoginAttempts) {
$this->log->warn("SECURITY: " . $usr_name . " has attempted to login " . $_SESSION['loginattempts'] . " times.");
}
$this->log->debug("Starting user load for {$usr_name}");
if (!isset($this->column_fields["user_name"]) || $this->column_fields["user_name"] == "" || !isset($user_password) || $user_password == "") {
return null;
}
$authCheck = false;
$authCheck = $this->doLogin($user_password);
if (!$authCheck) {
$this->log->warn("User authentication for {$usr_name} failed");
return null;
}
// Get the fields for the user
$query = "SELECT * from {$this->table_name} where user_name='{$usr_name}'";
$result = $this->db->requireSingleResult($query, false);
$row = $this->db->fetchByAssoc($result);
$this->column_fields = $row;
$this->id = $row['id'];
$this->loadPreferencesFromDB($row['user_preferences']);
// Make sure admin is logging in from authorized IPs
if ($row['is_admin'] == 'on' or $row['is_admin'] == '1') {
$AdminLoginIPs = GlobalVariable::getVariable('Application_AdminLoginIPs', '', 'Users');
if ($AdminLoginIPs != '') {
$admin_ip_addresses = explode(',', $AdminLoginIPs);
if (!in_array($_SERVER['REMOTE_ADDR'], $admin_ip_addresses)) {
$row['status'] = 'Inactive';
$this->authenticated = false;
$_SESSION['login_error'] = getTranslatedString('ERR_INVALID_ADMINIPLOGIN', 'Users');
$mailsubject = "[Security Alert]: Admin login attempt rejected for login: {$usr_name} from external IP: " . $_SERVER['REMOTE_ADDR'];
$this->log->warn($mailsubject);
// Send email with authentification error.
$mailto = GlobalVariable::getVariable('Debug_Send_AdminLoginIPAuth_Error', '', 'Users');
if ($mailto != '') {
require_once 'modules/Emails/mail.php';
require_once 'modules/Emails/Emails.php';
global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
$from_name = $HELPDESK_SUPPORT_NAME;
$form_mail = $HELPDESK_SUPPORT_EMAIL_ID;
$mailcontent = $mailsubject . "\n";
send_mail('Emails', $mailto, $from_name, $form_mail, $mailsubject, $mailcontent);
}
}
}
}
if ($row['status'] != 'Inactive') {
$this->authenticated = true;
}
unset($_SESSION['loginattempts']);
return $this;
}
示例10: createPotentialRelatedTo
public static function createPotentialRelatedTo($relatedto, $campaignid)
{
global $adb, $current_user;
$checkrs = $adb->pquery('select 1
from vtiger_potential
inner join vtiger_crmentity on crmid=potentialid
where deleted=0 and related_to=? and campaignid=?', array($relatedto, $campaignid));
if ($adb->num_rows($checkrs) == 0) {
require_once 'modules/Potentials/Potentials.php';
$entity = new Potentials();
$entity->mode = '';
$cname = getEntityName('Campaigns', $campaignid);
$cname = $cname[$campaignid] . ' - ';
$setype = getSalesEntityType($relatedto);
$rname = getEntityName($setype, $relatedto);
$rname = $rname[$relatedto];
$cbMapid = GlobalVariable::getVariable('BusinessMapping_PotentialOnCampaignRelation', cbMap::getMapIdByName('PotentialOnCampaignRelation'));
if ($cbMapid) {
$cmp = CRMEntity::getInstance('Campaigns');
$cmp->retrieve_entity_info($campaignid, 'Campaigns');
if ($setype == 'Accounts') {
$cmp->column_fields['AccountName'] = $rname;
$cmp->column_fields['ContactName'] = '';
} else {
$cmp->column_fields['AccountName'] = '';
$cmp->column_fields['ContactName'] = $rname;
}
$cbMap = cbMap::getMapByID($cbMapid);
$entity->column_fields = $cbMap->Mapping($cmp->column_fields, array());
}
if (empty($entity->column_fields['assigned_user_id'])) {
$entity->column_fields['assigned_user_id'] = $current_user->id;
}
$entity->column_fields['related_to'] = $relatedto;
$entity->column_fields['campaignid'] = $campaignid;
if (empty($entity->column_fields['closingdate'])) {
$dt = new DateTimeField();
$entity->column_fields['closingdate'] = $dt->getDisplayDate();
}
if (empty($entity->column_fields['potentialname'])) {
$entity->column_fields['potentialname'] = $cname . $rname;
}
if (empty($entity->column_fields['sales_stage'])) {
$entity->column_fields['sales_stage'] = 'Prospecting';
}
$_REQUEST['assigntype'] = 'U';
$_REQUEST['assigned_user_id'] = $entity->column_fields['assigned_user_id'];
$entity->save('Potentials');
}
}
示例11: send_mail
/** Function used to send email
* $module -- current module
* $to_email -- to email address
* $from_name -- currently loggedin user name
* $from_email -- currently loggedin users's email id. you can give as '' if you are not in HelpDesk module
* $subject -- subject of the email you want to send
* $contents -- body of the email you want to send
* $cc -- add email ids with comma seperated. - optional
* $bcc -- add email ids with comma seperated. - optional.
* $attachment -- whether we want to attach the currently selected file or all files.[values = current,all] - optional
* $emailid -- id of the email object which will be used to get the vtiger_attachments
*/
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '', $replyto = '')
{
global $adb, $log, $root_directory, $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
$uploaddir = $root_directory . "/test/upload/";
$adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
$femail = '';
if (substr($from_email, 0, 8) == 'FROM:::>') {
$femail = substr($from_email, 8);
$from_email = '';
}
if (empty($from_name) and !empty($from_email)) {
$sql = "select user_name from vtiger_users where status='Active' and (email1=? or email2=? or secondaryemail=?)";
$result = $adb->pquery($sql, array($from_email, $from_email, $from_email));
if ($result and $adb->num_rows($result) > 0) {
$from_name = $adb->query_result($result, 0, 0);
}
}
//if module is HelpDesk then from_email will come based on support email id
if ($from_email == '') {
//if from email is not defined, then use the useremailid as the from address
$from_email = getUserEmailId('user_name', $from_name);
}
if (empty($from_email)) {
$from_email = $HELPDESK_SUPPORT_EMAIL_ID;
}
//if the newly defined from email field is set, then use this email address as the from address
//and use the username as the reply-to address
$query = "select * from vtiger_systems where server_type=?";
$params = array('email');
$result = $adb->pquery($query, $params);
$from_email_field = $adb->query_result($result, 0, 'from_email_field');
if (empty($replyto)) {
if (isUserInitiated()) {
global $current_user;
$reply_to_secondary = GlobalVariable::getVariable('Users_ReplyTo_SecondEmail', 0, $module, $current_user->id);
if ($reply_to_secondary == 1) {
$sql = "select secondaryemail from vtiger_users where id=?";
$result = $adb->pquery($sql, array($current_user->id));
$second_email = '';
if ($result and $adb->num_rows($result) > 0) {
$second_email = $adb->query_result($result, 0, 'secondaryemail');
}
}
if (!empty($second_email)) {
$replyToEmail = $second_email;
} else {
$replyToEmail = $from_email;
}
} else {
$replyToEmail = $from_email_field;
}
} else {
$replyToEmail = $replyto;
}
if (isset($from_email_field) && $from_email_field != '') {
//setting from _email to the defined email address in the outgoing server configuration
$from_email = $from_email_field;
}
if ($femail != '') {
$from_email = $femail;
}
if ($module != "Calendar") {
$contents = addSignature($contents, $from_name);
}
$mail = new PHPMailer();
setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
setCCAddress($mail, 'cc', $cc);
setCCAddress($mail, 'bcc', $bcc);
if (!empty($replyToEmail)) {
$mail->AddReplyTo($replyToEmail);
}
// vtmailscanner customization: If Support Reply to is defined use it.
global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
$mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
}
// END
// Fix: Return immediately if Outgoing server not configured
if (empty($mail->Host)) {
return 0;
}
$mail_status = MailSend($mail);
if ($mail_status != 1) {
$mail_error = getMailError($mail, $mail_status, $mailto);
} else {
$mail_error = $mail_status;
}
return $mail_error;
//.........这里部分代码省略.........
示例12:
* Copyright 2014 JPL TSolucio, S.L. -- This file is a part of TSOLUCIO coreBOS Customizations.
* Licensed under the vtiger CRM Public License Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You can redistribute it and/or modify it
* under the terms of the License. JPL TSolucio, S.L. reserves all rights not expressly
* granted by the License. coreBOS distributed by JPL TSolucio S.L. 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. Unless required by
* applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT ANY WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing
* permissions and limitations under the License. You may obtain a copy of the License
* at <http://corebos.org/documentation/doku.php?id=en:devel:vpl11>
*************************************************************************************************/
// Product line support
if ($elementType != 'PurchaseOrder') {
if (GlobalVariable::getVariable('B2B', '1') == '1') {
$acvid = $element['account_id'];
} else {
$acvid = $element['contact_id'];
}
} else {
$acvid = $element['vendor_id'];
}
$taxtype = $element['taxtype'];
if (empty($taxtype)) {
$taxtype = 'group';
}
// Individual
$_REQUEST['taxtype'] = $taxtype;
$subtotal = 0;
$totalwithtax = 0;
示例13: ismember_check
/** Function to check if the product is member of other product
*/
function ismember_check()
{
global $adb;
$SubProductBeParent = GlobalVariable::getVariable('Product_Permit_Subproduct_Be_Parent', 'no');
$ismember = 0;
if ($SubProductBeParent == 'no') {
$ismember_query = $adb->pquery(getListQuery("Products") . " AND (vtiger_products.productid IN (SELECT crmid from vtiger_seproductsrel WHERE vtiger_seproductsrel.crmid = ? AND vtiger_seproductsrel.setype='Products'))", array($this->id));
$ismember = $adb->num_rows($ismember_query);
}
return $ismember;
}
示例14:
} else {
if ($errormessage == 3) {
$msg = $mod_strings['LBL_UPLOAD_ERROR'];
$errormessage = "<B><font color='red'>" . $msg . "</font></B> <br><br>";
} else {
if ($errormessage == "image") {
$msg = $mod_strings['LBL_IMAGE_ERROR'];
$errormessage = "<B><font color='red'>" . $msg . "</font></B> <br><br>";
} else {
if ($errormessage == "invalid") {
$msg = $mod_strings['LBL_INVALID_IMAGE'];
$errormessage = "<B><font color='red'>" . $msg . "</font></B> <br><br>";
} else {
$errormessage = "";
}
}
}
}
if ($errormessage != "") {
$smarty->assign("ERROR_MESSAGE", $errormessage);
}
$smarty->assign('Product_Maximum_Number_Images', GlobalVariable::getVariable('Product_Maximum_Number_Images', 6));
// Gather the help information associated with fields
$smarty->assign('FIELDHELPINFO', vtlib_getFieldHelpInfo($currentModule));
$picklistDependencyDatasource = Vtiger_DependencyPicklist::getPicklistDependencyDatasource($currentModule);
$smarty->assign("PICKIST_DEPENDENCY_DATASOURCE", Zend_Json::encode($picklistDependencyDatasource));
if ($focus->mode == 'edit') {
$smarty->display('Inventory/InventoryEditView.tpl');
} else {
$smarty->display('Inventory/InventoryCreateView.tpl');
}
示例15: explode
$timeValue = $dateTimeField->getDisplayTime();
$dbDateValue = DateTimeField::convertToDBFormat($dateValue);
$dateValueArray = explode('-', $dbDateValue);
$timeValueArray = explode(':', $timeValue);
$date_data = array('day' => $dateValueArray[2], 'month' => $dateValueArray[1], 'fc_month' => $dateValueArray[1] - 1, 'year' => $dateValueArray[0], 'hour' => $timeValueArray[0], 'min' => $timeValueArray[1]);
}
$smarty->assign('DATE_DATA', $date_data);
$calendar_arr['calendar'] = new Calendar($mysel, $date_data);
$add_to_url = "view=" . $calendar_arr['calendar']->view . "" . $calendar_arr['calendar']->date_time->get_date_str() . "&parenttab=" . $category;
$smarty->assign('CALENDAR_TO_URL', $add_to_url);
if (getFieldVisibilityPermission('Events', $current_user->id, 'eventstatus', 'readwrite') == '0') {
$Events_Status = $Calendar4You->getActStatusFieldValues('eventstatus', 'vtiger_eventstatus');
}
$smarty->assign('EVENT_STATUS', $Events_Status);
if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus', 'readwrite') == '0') {
$Task_Status = $Calendar4You->getActStatusFieldValues('taskstatus', 'vtiger_taskstatus');
}
$smarty->assign('TASK_STATUS', $Task_Status);
if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskpriority', 'readwrite') == '0') {
$Task_Status = $Calendar4You->getActStatusFieldValues('taskpriority', 'vtiger_taskpriority');
}
$smarty->assign('TASK_PRIORITY', $Task_Status);
$dat_fmt = $current_user->date_format;
if ($dat_fmt == '') {
$dat_fmt = 'dd-mm-yyyy';
}
$dat_fmt = str_replace("mm", "MM", $dat_fmt);
$smarty->assign('USER_DATE_FORMAT', $dat_fmt);
$smarty->assign('Calendar_Modules_Panel_Visible', GlobalVariable::getVariable('Calendar_Modules_Panel_Visible', 1));
$smarty->display('modules/Calendar4You/CalendarView.tpl');
include_once 'modules/Calendar4You/addEventUI.php';