本文整理汇总了PHP中DateTimeField::getDBInsertDateValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeField::getDBInsertDateValue方法的具体用法?PHP DateTimeField::getDBInsertDateValue怎么用?PHP DateTimeField::getDBInsertDateValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeField
的用法示例。
在下文中一共展示了DateTimeField::getDBInsertDateValue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAuditTrailEntries
/**
* Function to get the Audit Trail Information values of the actions performed by a particular User.
* @param integer $userid - User's ID
* @param $navigation_array - Array values to navigate through the number of entries.
* @param $sortorder - DESC
* @param $orderby - actiondate
* Returns the audit trail entries in an array format.
**/
function getAuditTrailEntries($userid, $navigation_array, $sorder = '', $orderby = '')
{
global $log;
$log->debug("Entering getAuditTrailEntries(" . $userid . ") method ...");
global $adb, $current_user;
if ($sorder != '' && $order_by != '') {
$list_query = "Select * from vtiger_audit_trial where userid =? order by " . $order_by . " " . $sorder;
} else {
$list_query = "Select * from vtiger_audit_trial where userid =? order by " . $this->default_order_by . " " . $this->default_sort_order;
}
$result = $adb->pquery($list_query, array($userid));
$entries_list = array();
if ($navigation_array['end_val'] != 0) {
for ($i = $navigation_array['start']; $i <= $navigation_array['end_val']; $i++) {
$entries = array();
$userid = $adb->query_result($result, $i - 1, 'userid');
$entries[] = getTranslatedString($adb->query_result($result, $i - 1, 'module'));
$entries[] = $adb->query_result($result, $i - 1, 'action');
$entries[] = $adb->query_result($result, $i - 1, 'recordid');
$date = new DateTimeField($adb->query_result($result, $i - 1, 'actiondate'));
$entries[] = $date->getDBInsertDateValue();
$entries_list[] = $entries;
}
$log->debug("Exiting getAuditTrailEntries() method ...");
return $entries_list;
}
}
示例2: replaceReport
function replaceReport($content, $reportid)
{
session_start();
require_once "modules/Reports/ReportRun.php";
require_once "modules/Reports/Reports.php";
require_once 'include/utils/utils.php';
$current_language = Users_Record_Model::getCurrentUserModel()->get('language');
include "modules/OSSPdf/language/" . $current_language . ".lang.php";
$language = $_SESSION['authenticated_user_language'] . '.lang.php';
require_once "include/language/{$language}";
$db = PearDatabase::getInstance();
$oReport = new Reports($reportid);
//Code given by Csar Rodrguez for Rwport Filter
$filtercolumn = $_REQUEST["stdDateFilterField"];
$filter = $_REQUEST["stdDateFilter"];
$oReportRun = new ReportRun($reportid);
$startdate = $_REQUEST['startdate'];
$enddate = $_REQUEST['enddate'];
if (!empty($startdate) && !empty($enddate) && $startdate != "0000-00-00" && $enddate != "0000-00-00") {
$date = new DateTimeField($_REQUEST['startdate']);
$endDate = new DateTimeField($_REQUEST['enddate']);
$startdate = $date->getDBInsertDateValue();
//Convert the user date format to DB date format
$enddate = $endDate->getDBInsertDateValue();
//Convert the user date format to DB date format
}
$filterlist = $oReportRun->RunTimeFilter($filtercolumn, $filter, $startdate, $enddate);
############///////////////////////////////#########################
$sql = $oReportRun->sGetSQLforReport($reportid, $filterlist);
$result = $db->query($sql, true);
$modules_selected = array();
$modules_selected[] = $oReportRun->primarymodule;
if (!empty($oReportRun->secondarymodule)) {
$sec_modules = split(":", $oReportRun->secondarymodule);
for ($i = 0; $i < count($sec_modules); $i++) {
$modules_selected[] = $sec_modules[$i];
}
}
$y = $db->num_fields($result);
$report = '<table border="1" cellpadding="2"><tr width="500px" bgcolor="lightgrey">';
$arrayHeaders = array();
for ($x = 0; $x < $y; $x++) {
$fld = $db->field_name($result, $x);
if (in_array($oReportRun->getLstringforReportHeaders($fld->name), $arrayHeaders)) {
$headerLabel = str_replace("_", " ", $fld->name);
$arrayHeaders[] = $headerLabel;
} else {
$headerLabel = str_replace($modules, " ", $oReportRun->getLstringforReportHeaders($fld->name));
$headerLabel = str_replace("_", " ", $oReportRun->getLstringforReportHeaders($fld->name));
$arrayHeaders[] = $headerLabel;
}
/*STRING TRANSLATION starts */
$mod_name = split(' ', $headerLabel, 2);
$moduleLabel = '';
if (in_array($mod_name[0], $modules_selected)) {
$moduleLabel = getTranslatedString($mod_name[0], $mod_name[0]);
}
if (!empty($oReportRun->secondarymodule)) {
if ($moduleLabel != '') {
$headerLabel_tmp = getTranslatedString($mod_name[1], $mod_name[0]);
} else {
$headerLabel_tmp = getTranslatedString($mod_name[0] . " " . $mod_name[1]);
}
} else {
if ($moduleLabel != '') {
$headerLabel_tmp = getTranslatedString($mod_name[1], $mod_name[0]);
} else {
$headerLabel_tmp = getTranslatedString($mod_name[0] . " " . $mod_name[1]);
}
}
if ($headerLabel == $headerLabel_tmp) {
$headerLabel = getTranslatedString($headerLabel_tmp);
} else {
$headerLabel = $headerLabel_tmp;
}
/*STRING TRANSLATION ends */
$report .= "<td class='rptCellLabel'><small><b>" . $headerLabel . "</b></small></td>";
// Performance Optimization: If direct output is required
// END
}
$report .= '</tr>';
// END
$noofrows = $db->num_rows($result);
$custom_field_values = $db->fetch_array($result);
$groupslist = $oReportRun->getGroupingList($oReportRun->reportid);
$column_definitions = $db->getFieldsDefinition($result);
do {
$arraylists = array();
if (count($groupslist) == 1) {
$newvalue = $custom_field_values[0];
} elseif (count($groupslist) == 2) {
$newvalue = $custom_field_values[0];
$snewvalue = $custom_field_values[1];
} elseif (count($groupslist) == 3) {
$newvalue = $custom_field_values[0];
$snewvalue = $custom_field_values[1];
$tnewvalue = $custom_field_values[2];
}
if ($newvalue == "") {
$newvalue = "-";
//.........这里部分代码省略.........
示例3: insertIntoEntityTable
//.........这里部分代码省略.........
} elseif ($uitype == 12) {
// Bulk Sae Mode: Consider the FROM email address as specified, if not lookup
$fldvalue = $this->column_fields[$fieldname];
if (empty($fldvalue)) {
$query = "SELECT email1 FROM vtiger_users WHERE id = ?";
$res = $adb->pquery($query, array($current_user->id));
$rows = $adb->num_rows($res);
if ($rows > 0) {
$fldvalue = $adb->query_result($res, 0, 'email1');
}
}
// END
} elseif ($uitype == 72 && !$ajaxSave) {
// Some of the currency fields like Unit Price, Totoal , Sub-total - doesn't need currency conversion during save
$fldvalue = CurrencyField::convertToDBFormat($this->column_fields[$fieldname], null, true);
} elseif ($uitype == 71 && !$ajaxSave) {
$fldvalue = CurrencyField::convertToDBFormat($this->column_fields[$fieldname]);
} else {
$fldvalue = $this->column_fields[$fieldname];
}
if ($uitype != 33 && $uitype != 8) {
$fldvalue = from_html($fldvalue, $insertion_mode == 'edit' ? true : false);
}
} else {
$fldvalue = '';
}
if ($fldvalue == '') {
$fldvalue = $this->get_column_value($columname, $fldvalue, $fieldname, $uitype, $datatype);
}
if ($insertion_mode == 'edit') {
if ($table_name != 'vtiger_ticketcomments' && $uitype != 4) {
array_push($update, $columname . "=?");
array_push($update_params, $fldvalue);
}
} else {
array_push($column, $columname);
array_push($value, $fldvalue);
}
}
if ($insertion_mode == 'edit') {
if ($module == 'Potentials') {
$dbquery = 'select sales_stage from vtiger_potential where potentialid = ?';
$sales_stage = $adb->query_result($adb->pquery($dbquery, array($this->id)), 0, 'sales_stage');
if ($sales_stage != $_REQUEST['sales_stage'] && $_REQUEST['sales_stage'] != '') {
$date_var = date("Y-m-d H:i:s");
$closingDateField = new DateTimeField($this->column_fields['closingdate']);
$closingdate = $_REQUEST['ajxaction'] == 'DETAILVIEW' ? $this->column_fields['closingdate'] : $closingDateField->getDBInsertDateValue();
$sql = "insert into vtiger_potstagehistory values(?,?,?,?,?,?,?,?)";
$params = array('', $this->id, $this->column_fields['amount'], decode_html($sales_stage), $this->column_fields['probability'], 0, $adb->formatDate($closingdate, true), $adb->formatDate($date_var, true));
$adb->pquery($sql, $params);
}
} elseif ($module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Quotes' || $module == 'Invoice' || $module == 'Act' || $module == 'Consignment') {
//elseif ($module == 'PurchaseOrder' || $module == 'SalesOrder' || $module == 'Quotes' || $module == 'Invoice') {
// SalesPlatform.ru end
//added to update the history for PO, SO, Quotes and Invoice
$history_field_array = array("Act" => "sp_actstatus", "Consignment" => "sp_consignmentstatus", "PurchaseOrder" => "postatus", "SalesOrder" => "sostatus", "Quotes" => "quotestage", "Invoice" => "invoicestatus");
$inventory_module = $module;
if ($_REQUEST['ajxaction'] == 'DETAILVIEW') {
//if we use ajax edit
if ($inventory_module == "PurchaseOrder") {
$relatedname = getVendorName($this->column_fields['vendor_id']);
} else {
$relatedname = getAccountName($this->column_fields['account_id']);
}
$total = $this->column_fields['hdnGrandTotal'];
} else {
//using edit button and save
if ($inventory_module == "PurchaseOrder") {
$relatedname = $_REQUEST["vendor_name"];
} else {
$relatedname = $_REQUEST["account_name"];
}
$total = $_REQUEST['total'];
}
if ($this->column_fields["{$history_field_array[$inventory_module]}"] == $app_strings['LBL_NOT_ACCESSIBLE']) {
//If the value in the request is Not Accessible for a picklist, the existing value will be replaced instead of Not Accessible value.
$his_col = $history_field_array[$inventory_module];
$his_sql = "select {$his_col} from {$this->table_name} where " . $this->table_index . "=?";
$his_res = $adb->pquery($his_sql, array($this->id));
$status_value = $adb->query_result($his_res, 0, $his_col);
$stat_value = $status_value;
} else {
$stat_value = $this->column_fields["{$history_field_array[$inventory_module]}"];
}
$oldvalue = getSingleFieldValue($this->table_name, $history_field_array[$inventory_module], $this->table_index, $this->id);
if ($this->column_fields["{$history_field_array[$inventory_module]}"] != '' && $oldvalue != $stat_value) {
addInventoryHistory($inventory_module, $this->id, $relatedname, $total, $stat_value);
}
}
//Check done by Don. If update is empty the the query fails
if (count($update) > 0) {
$sql1 = "update {$table_name} set " . implode(",", $update) . " where " . $this->tab_name_index[$table_name] . "=?";
array_push($update_params, $this->id);
$adb->pquery($sql1, $update_params);
}
} else {
$sql1 = "insert into {$table_name}(" . implode(",", $column) . ") values(" . generateQuestionMarks($value) . ")";
$adb->pquery($sql1, $value);
}
}
示例4: RunTimeAdvFilter
/** Function to get the RunTime Advanced filter conditions
* @ param $advft_criteria : Type Array
* @ param $advft_criteria_groups : Type Array
* This function returns $advfiltersql
*
*/
function RunTimeAdvFilter($advft_criteria, $advft_criteria_groups)
{
$adb = PearDatabase::getInstance();
$advfilterlist = array();
$advfiltersql = '';
if (!empty($advft_criteria)) {
foreach ($advft_criteria as $column_index => $column_condition) {
if (empty($column_condition)) {
continue;
}
$adv_filter_column = $column_condition["columnname"];
$adv_filter_comparator = $column_condition["comparator"];
$adv_filter_value = $column_condition["value"];
$adv_filter_column_condition = $column_condition["columncondition"];
$adv_filter_groupid = $column_condition["groupid"];
$column_info = explode(":", $adv_filter_column);
$moduleFieldLabel = $column_info[2];
$fieldName = $column_info[3];
list($module, $fieldLabel) = explode('__', $moduleFieldLabel, 2);
$fieldInfo = getFieldByReportLabel($module, $fieldLabel);
$fieldType = null;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($adb, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency') {
// Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
if ($field->getUIType() == '72') {
$adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value, null, true);
} else {
$adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value);
}
}
$temp_val = explode(",", $adv_filter_value);
if (($column_info[4] == 'D' || $column_info[4] == 'T' && $column_info[1] != 'time_start' && $column_info[1] != 'time_end' || $column_info[4] == 'DT') && ($column_info[4] != '' && $adv_filter_value != '')) {
$val = array();
for ($x = 0; $x < count($temp_val); $x++) {
if ($column_info[4] == 'D') {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDBInsertDateValue();
} elseif ($column_info[4] == 'DT') {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDBInsertDateTimeValue();
} else {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDBInsertTimeValue();
}
}
$adv_filter_value = implode(",", $val);
}
$criteria = array();
$criteria['columnname'] = $adv_filter_column;
$criteria['comparator'] = $adv_filter_comparator;
$criteria['value'] = $adv_filter_value;
$criteria['column_condition'] = $adv_filter_column_condition;
$advfilterlist[$adv_filter_groupid]['columns'][] = $criteria;
}
foreach ($advft_criteria_groups as $group_index => $group_condition_info) {
if (empty($group_condition_info)) {
continue;
}
if (empty($advfilterlist[$group_index])) {
continue;
}
$advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"];
$noOfGroupColumns = count($advfilterlist[$group_index]['columns']);
if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) {
$advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'] = '';
}
}
$noOfGroups = count($advfilterlist);
if (!empty($advfilterlist[$noOfGroups]['condition'])) {
$advfilterlist[$noOfGroups]['condition'] = '';
}
$advfiltersql = $this->generateAdvFilterSql($advfilterlist);
}
return $advfiltersql;
}
示例5: DateTimeField
echo $app_strings['LBL_SELECT_BUTTON_TITLE'];
?>
" accessKey="<?php
echo $app_strings['LBL_SELECT_BUTTON_KEY'];
?>
" value="<?php
echo $app_strings['LBL_SELECT_BUTTON_LABEL'];
?>
" /></td>
</tr></table>
</form>
<?php
} else {
if (file_exists($tmp_dir . $cache_file_name)) {
$date = new DateTimeField(date('Y-m-d H:i', filemtime($tmp_dir . $cache_file_name)));
$file_date = $date->getDBInsertDateValue();
} else {
$file_date = '';
}
?>
<div align=right><FONT size='1'>
<em><?php
echo $current_module_strings['LBL_CREATED_ON'] . ' ' . $file_date;
?>
</em>[<a href="javascript:void(0)" onClick="changeView('<?php
echo vtlib_purify($_REQUEST['display_view']);
?>
');"><?php
echo $current_module_strings['LBL_REFRESH'];
?>
示例6: RunTimeAdvFilter
/** Function to get the RunTime Advanced filter conditions
* @ param $advft_criteria : Type Array
* @ param $advft_criteria_groups : Type Array
* This function returns $advfiltersql
*/
function RunTimeAdvFilter($advft_criteria, $advft_criteria_groups)
{
$adb = PearDatabase::getInstance();
$advfilterlist = array();
if (!empty($advft_criteria)) {
foreach ($advft_criteria as $column_index => $column_condition) {
if (empty($column_condition)) {
continue;
}
$adv_filter_column = $column_condition["columnname"];
$adv_filter_comparator = $column_condition["comparator"];
$adv_filter_value = $column_condition["value"];
$adv_filter_column_condition = $column_condition["columncondition"];
$adv_filter_groupid = $column_condition["groupid"];
$column_info = explode(":", $adv_filter_column);
$moduleFieldLabel = $column_info[2];
$fieldName = $column_info[3];
list($module, $fieldLabel) = explode('_', $moduleFieldLabel, 2);
$fieldInfo = getFieldByReportLabel($module, $fieldLabel);
$fieldType = null;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($adb, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency' or $fieldType == 'double') {
$flduitype = $fieldInfo['uitype'];
if ($flduitype == '72' or $flduitype == 9 or $flduitype == 7) {
$adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value, null, true);
} else {
$adv_filter_value = CurrencyField::convertToDBFormat($adv_filter_value);
}
}
$temp_val = explode(",", $adv_filter_value);
if (($column_info[4] == 'D' || $column_info[4] == 'T' && $column_info[1] != 'time_start' && $column_info[1] != 'time_end' || $column_info[4] == 'DT') && ($column_info[4] != '' && $adv_filter_value != '')) {
$val = array();
for ($x = 0; $x < count($temp_val); $x++) {
if ($column_info[4] == 'D') {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDBInsertDateValue();
} elseif ($column_info[4] == 'DT') {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDBInsertDateTimeValue();
} else {
$date = new DateTimeField(trim($temp_val[$x]));
$val[$x] = $date->getDBInsertTimeValue();
}
}
$adv_filter_value = implode(",", $val);
}
if ($fieldType == 'picklist' || $fieldType == 'multipicklist') {
if (!isValueInPicklist($adv_filter_value, $fieldName)) {
$adv_filter_value = getTranslationKeyFromTranslatedValue($module, $adv_filter_value);
}
}
$criteria = array();
$criteria['columnname'] = $adv_filter_column;
$criteria['comparator'] = $adv_filter_comparator;
$criteria['value'] = $adv_filter_value;
$criteria['column_condition'] = $adv_filter_column_condition;
$advfilterlist[$adv_filter_groupid]['columns'][] = $criteria;
}
foreach ($advft_criteria_groups as $group_index => $group_condition_info) {
if (empty($group_condition_info)) {
continue;
}
if (empty($advfilterlist[$group_index])) {
continue;
}
$advfilterlist[$group_index]['condition'] = $group_condition_info["groupcondition"];
$noOfGroupColumns = count($advfilterlist[$group_index]['columns']);
if (!empty($advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'])) {
$advfilterlist[$group_index]['columns'][$noOfGroupColumns - 1]['column_condition'] = '';
}
}
$noOfGroups = count($advfilterlist);
if (!empty($advfilterlist[$noOfGroups]['condition'])) {
$advfilterlist[$noOfGroups]['condition'] = '';
}
$advfiltersql = $this->generateAdvFilterSql($advfilterlist);
}
return $advfiltersql;
}
示例7: getRequestedToData
$focus->save($tab_type);
function getRequestedToData()
{
$mail_data = array();
$mail_data['user_id'] = $_REQUEST["task_assigned_user_id"];
$mail_data['subject'] = $_REQUEST['task_subject'];
$mail_data['status'] = $_REQUEST['activity_mode'] == 'Task' ? $_REQUEST['taskstatus'] : $_REQUEST['eventstatus'];
$mail_data['activity_mode'] = $_REQUEST['activity_mode'];
$mail_data['taskpriority'] = $_REQUEST['taskpriority'];
$mail_data['relatedto'] = $_REQUEST['task_parent_name'];
$mail_data['contact_name'] = $_REQUEST['task_contact_name'];
$mail_data['description'] = $_REQUEST['task_description'];
$mail_data['assign_type'] = $_REQUEST['task_assigntype'];
$mail_data['group_name'] = getGroupName($_REQUEST['task_assigned_group_id']);
$mail_data['mode'] = $_REQUEST['task_mode'];
$startTime = $_REQUEST['task_time_start'];
$date = new DateTimeField($_REQUEST['task_date_start'] . " " . $startTime);
$endTime = $_REQUEST['task_time_end'];
$endDate = new DateTimeField($_REQUEST['task_due_date'] . " " . $startTime);
$startTime = $date->getDisplayTime();
$endTime = $endDate->getDisplayTime();
$value = getaddEventPopupTime($startTime, $endTime, '24');
$start_hour = $value['starthour'] . ':' . $value['startmin'] . '' . $value['startfmt'];
$mail_data['st_date_time'] = $date->getDisplayDateTimeValue();
$mail_data['end_date_time'] = $endDate->getDisplayDate();
return $mail_data;
}
$date = new DateTimeField($_REQUEST["task_date_start"]);
echo $date->getDBInsertDateValue();
echo "-" . getTranslatedString("LBL_SUCCESSFULY_CREATED", "Calendar4You");
exit;
示例8: tempnam
require_once "modules/Reports/Reports.php";
global $tmp_dir, $root_directory;
$fname = tempnam($root_directory . $tmp_dir, "merge2.xls");
# Write out the data
$reportid = vtlib_purify($_REQUEST["record"]);
$oReport = new Reports($reportid);
$filtercolumn = $_REQUEST['stdDateFilterField'];
$startdate = $_REQUEST['startdate'];
$enddate = $_REQUEST['enddate'];
if (!empty($startdate) && !empty($enddate) && $startdate != "0000-00-00" && $enddate != "0000-00-00") {
$filter = $_REQUEST['stdDateFilter'];
$date = new DateTimeField($_REQUEST['startdate']);
$endDate = new DateTimeField($_REQUEST['enddate']);
$startdate = $date->getDBInsertDateValue();
//Convert the user date format to DB date format
$enddate = $endDate->getDBInsertDateValue();
//Convert the user date format to DB date format
}
$oReportRun = new ReportRun($reportid);
$filterlist = $oReportRun->RunTimeFilter($filtercolumn, $filter, $startdate, $enddate);
$oReportRun->writeReportToExcelFile($fname, $filterlist);
if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
}
header("Content-Type: application/x-msexcel");
header("Content-Length: " . @filesize($fname));
header('Content-disposition: attachment; filename="Reports.xls"');
$fh = fopen($fname, "rb");
fpassthru($fh);
//unlink($fname);
示例9: saveAdvancedFilters
/**
* Function saves Reports Filter information
*/
function saveAdvancedFilters()
{
$db = PearDatabase::getInstance();
$reportId = $this->getId();
$advancedFilter = $this->get('advancedFilter');
if (!empty($advancedFilter)) {
$db->pquery('DELETE FROM vtiger_relcriteria WHERE queryid = ?', array($reportId));
$db->pquery('DELETE FROM vtiger_relcriteria_grouping WHERE queryid = ?', array($reportId));
foreach ($advancedFilter as $groupIndex => $groupInfo) {
if (empty($groupInfo)) {
continue;
}
$groupColumns = $groupInfo['columns'];
$groupCondition = $groupInfo['condition'];
foreach ($groupColumns as $columnIndex => $columnCondition) {
if (empty($columnCondition)) {
continue;
}
$advFilterColumn = $columnCondition["columnname"];
$advFilterComparator = $columnCondition["comparator"];
$advFilterValue = $columnCondition["value"];
$advFilterColumnCondition = $columnCondition["column_condition"];
$columnInfo = explode(":", $advFilterColumn);
$moduleFieldLabel = $columnInfo[2];
list($module, $fieldLabel) = explode('__', $moduleFieldLabel, 2);
$fieldInfo = getFieldByReportLabel($module, $fieldLabel);
$fieldType = null;
if (!empty($fieldInfo)) {
$field = WebserviceField::fromArray($db, $fieldInfo);
$fieldType = $field->getFieldDataType();
}
if ($fieldType == 'currency') {
if ($field->getUIType() == '72') {
// Some of the currency fields like Unit Price, Totoal , Sub-total - doesn't need currency conversion during save
$advFilterValue = Vtiger_Currency_UIType::convertToDBFormat($advFilterValue, null, true);
} else {
$advFilterValue = Vtiger_Currency_UIType::convertToDBFormat($advFilterValue);
}
}
$tempVal = explode(",", $advFilterValue);
if (($columnInfo[4] == 'D' || $columnInfo[4] == 'T' && $columnInfo[1] != 'time_start' && $columnInfo[1] != 'time_end' || $columnInfo[4] == 'DT') && ($columnInfo[4] != '' && $advFilterValue != '')) {
$val = array();
for ($i = 0; $i < count($tempVal); $i++) {
if (trim($tempVal[$i]) != '') {
$date = new DateTimeField(trim($tempVal[$i]));
if ($columnInfo[4] == 'D') {
$val[$i] = DateTimeField::convertToDBFormat(trim($tempVal[$i]));
} elseif ($columnInfo[4] == 'DT') {
/**
* While generating query to retrieve report, for date time fields we are only taking
* date field and appending '00:00:00' for correct results depending on time zone.
* If you save the time also here by converting to db format, while showing in edit
* view it was changing the date selected.
*/
$values = explode(' ', $tempVal[$i]);
$date = new DateTimeField($values[0]);
$val[$i] = $date->getDBInsertDateValue();
} else {
$val[$i] = $date->getDBInsertTimeValue();
}
}
}
$advFilterValue = implode(",", $val);
}
$db->pquery('INSERT INTO vtiger_relcriteria (queryid, columnindex, columnname, comparator, value,
groupid, column_condition) VALUES (?,?,?,?,?,?,?)', array($reportId, $columnIndex, $advFilterColumn, $advFilterComparator, $advFilterValue, $groupIndex, $advFilterColumnCondition));
// Update the condition expression for the group to which the condition column belongs
$groupConditionExpression = '';
if (!empty($advancedFilter[$groupIndex]["conditionexpression"])) {
$groupConditionExpression = $advancedFilter[$groupIndex]["conditionexpression"];
}
$groupConditionExpression = $groupConditionExpression . ' ' . $columnIndex . ' ' . $advFilterColumnCondition;
$advancedFilter[$groupIndex]["conditionexpression"] = $groupConditionExpression;
}
$groupConditionExpression = $advancedFilter[$groupIndex]["conditionexpression"];
if (empty($groupConditionExpression)) {
continue;
}
// Case when the group doesn't have any column criteria
$db->pquery("INSERT INTO vtiger_relcriteria_grouping(groupid, queryid, group_condition, condition_expression) VALUES (?,?,?,?)", array($groupIndex, $reportId, $groupCondition, $groupConditionExpression));
}
}
}
示例10: getActivityMailInfo
function getActivityMailInfo($return_id, $status, $activity_type)
{
$mail_data = array();
global $adb;
$qry = "select * from vtiger_activity where activityid=?";
$ary_res = $adb->pquery($qry, array($return_id));
$send_notification = $adb->query_result($ary_res, 0, "sendnotification");
$subject = $adb->query_result($ary_res, 0, "subject");
$priority = $adb->query_result($ary_res, 0, "priority");
$st_date = $adb->query_result($ary_res, 0, "date_start");
$st_time = $adb->query_result($ary_res, 0, "time_start");
$end_date = $adb->query_result($ary_res, 0, "due_date");
$end_time = $adb->query_result($ary_res, 0, "time_end");
$location = $adb->query_result($ary_res, 0, "location");
if (!empty($st_time)) {
$date = new DateTimeField($st_date . ' ' . $st_time);
$st_date = $date->getDisplayDate();
$st_time = $date->getDisplayTime();
}
if (!empty($end_time)) {
$date = new DateTimeField($end_date . ' ' . $end_time);
$end_date = $date->getDisplayDate();
$end_time = $date->getDisplayTime();
}
$owner_qry = "select smownerid from vtiger_crmentity where crmid=?";
$res = $adb->pquery($owner_qry, array($return_id));
$owner_id = $adb->query_result($res, 0, "smownerid");
$usr_res = $adb->pquery("select count(*) as count from vtiger_users where id=?", array($owner_id));
if ($adb->query_result($usr_res, 0, 'count') > 0) {
$assignType = "U";
$usr_id = $owner_id;
} else {
$assignType = "T";
$group_qry = "select groupname from vtiger_groups where groupid=?";
$grp_res = $adb->pquery($group_qry, array($owner_id));
$grp_name = $adb->query_result($grp_res, 0, "groupname");
}
$desc_qry = "select description from vtiger_crmentity where crmid=?";
$des_res = $adb->pquery($desc_qry, array($return_id));
$description = $adb->query_result($des_res, 0, "description");
$rel_qry = "select case vtiger_crmentity.setype when 'Leads' then vtiger_leaddetails.lastname when 'Accounts' then vtiger_account.accountname when 'Potentials' then vtiger_potential.potentialname when 'Quotes' then vtiger_quotes.subject when 'PurchaseOrder' then vtiger_purchaseorder.subject when 'SalesOrder' then vtiger_salesorder.subject when 'Invoice' then vtiger_invoice.subject when 'Campaigns' then vtiger_campaign.campaignname when 'HelpDesk' then vtiger_troubletickets.title end as relname from vtiger_seactivityrel inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_seactivityrel.crmid left join vtiger_leaddetails on vtiger_leaddetails.leadid = vtiger_seactivityrel.crmid left join vtiger_account on vtiger_account.accountid=vtiger_seactivityrel.crmid left join vtiger_potential on vtiger_potential.potentialid=vtiger_seactivityrel.crmid left join vtiger_quotes on vtiger_quotes.quoteid= vtiger_seactivityrel.crmid left join vtiger_purchaseorder on vtiger_purchaseorder.purchaseorderid = vtiger_seactivityrel.crmid left join vtiger_salesorder on vtiger_salesorder.salesorderid = vtiger_seactivityrel.crmid left join vtiger_invoice on vtiger_invoice.invoiceid = vtiger_seactivityrel.crmid left join vtiger_campaign on vtiger_campaign.campaignid = vtiger_seactivityrel.crmid left join vtiger_troubletickets on vtiger_troubletickets.ticketid = vtiger_seactivityrel.crmid where vtiger_seactivityrel.activityid=?";
$rel_res = $adb->pquery($rel_qry, array($return_id));
$rel_name = $adb->query_result($rel_res, 0, "relname");
$relatedContacts = getActivityRelatedContacts($return_id);
$mail_data['mode'] = "edit";
$mail_data['activity_mode'] = $activity_type;
$mail_data['sendnotification'] = $send_notification;
$mail_data['user_id'] = $usr_id;
$mail_data['subject'] = $subject;
$mail_data['status'] = $status;
$mail_data['taskpriority'] = $priority;
$mail_data['relatedto'] = $rel_name;
$mail_data['contact_name'] = implode(',', $relatedContacts);
$mail_data['description'] = $description;
$mail_data['assign_type'] = $assignType;
$mail_data['group_name'] = $grp_name;
$value = getaddEventPopupTime($st_time, $end_time, '24');
$start_hour = $value['starthour'] . ':' . $value['startmin'] . '' . $value['startfmt'];
if ($activity_type != 'Task') {
$end_hour = $value['endhour'] . ':' . $value['endmin'] . '' . $value['endfmt'];
}
$date = new DateTimeField($st_date . " " . $start_hour);
$endDate = new DateTimeField($end_date . " " . $end_hour);
$mail_data['st_date_time'] = $date->getDBInsertDateTimeValue();
$mail_data['end_date_time'] = $endDate->getDBInsertDateValue() . ' ' . $endDate->getDBInsertTimeValue();
$mail_data['location'] = $location;
return $mail_data;
}
示例11: date
$_REQUEST['time_end'] = date('H:i', strtotime('+10 minutes', strtotime($focus->column_fields['date_start'] . ' ' . $_REQUEST['time_start'])));
}
$dateField = 'due_date';
$fieldname = 'time_end';
$date = new DateTimeField($_REQUEST[$dateField] . ' ' . $_REQUEST[$fieldname]);
$focus->column_fields[$dateField] = $date->getDBInsertDateValue();
$focus->column_fields[$fieldname] = $date->getDBInsertTimeValue();
$focus->save($tab_type);
/* For Followup START -- by Minnie */
if (isset($_REQUEST['followup']) && $_REQUEST['followup'] == 'on' && $activity_mode == 'Events' && isset($_REQUEST['followup_time_start']) && $_REQUEST['followup_time_start'] != '') {
$heldevent_id = $focus->id;
$focus->column_fields['subject'] = '[Followup] ' . $focus->column_fields['subject'];
$startDate = new DateTimeField($_REQUEST['followup_date'] . ' ' . $_REQUEST['followup_time_start']);
$endDate = new DateTimeField($_REQUEST['followup_due_date'] . ' ' . $_REQUEST['followup_time_end']);
$focus->column_fields['date_start'] = $startDate->getDBInsertDateValue();
$focus->column_fields['due_date'] = $endDate->getDBInsertDateValue();
$focus->column_fields['time_start'] = $startDate->getDBInsertTimeValue();
$focus->column_fields['time_end'] = $endDate->getDBInsertTimeValue();
$focus->column_fields['eventstatus'] = 'Planned';
$focus->mode = 'create';
$focus->save($tab_type);
}
/* For Followup END -- by Minnie */
$return_id = $focus->id;
}
if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") {
$return_module = vtlib_purify($_REQUEST['return_module']);
} else {
$return_module = "Calendar4You";
}
if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") {
示例12: array
//<<<<<<<standardfilters>>>>>>>>>
$std_filter_list = array();
$stdfiltercolumn = $_REQUEST["stdDateFilterField"];
$std_filter_list["columnname"] = $stdfiltercolumn;
$stdcriteria = $_REQUEST["stdDateFilter"];
$std_filter_list["stdfilter"] = $stdcriteria;
$startdate = $_REQUEST["startdate"];
$enddate = $_REQUEST["enddate"];
if (empty($startdate) && empty($enddate)) {
unset($std_filter_list);
} else {
$dbCurrentDateTime = new DateTimeField(date('Y-m-d H:i:s'));
$startDateTime = new DateTimeField($startdate . ' ' . $dbCurrentDateTime->getDisplayTime());
$endDateTime = new DateTimeField($enddate . ' ' . $dbCurrentDateTime->getDisplayTime());
$std_filter_list["startdate"] = $startDateTime->getDBInsertDateValue();
$std_filter_list["enddate"] = $endDateTime->getDBInsertDateValue();
}
//<<<<<<<standardfilters>>>>>>>>>
//<<<<<<<advancedfilter>>>>>>>>>
$json = new Zend_Json();
$advft_criteria = $_REQUEST['advft_criteria'];
$advft_criteria = $json->decode($advft_criteria);
$advft_criteria_groups = $_REQUEST['advft_criteria_groups'];
$advft_criteria_groups = $json->decode($advft_criteria_groups);
//<<<<<<<advancedfilter>>>>>>>>
$moduleHandler = vtws_getModuleHandlerFromName($cvmodule, $current_user);
$moduleMeta = $moduleHandler->getMeta();
$moduleFields = $moduleMeta->getModuleFields();
if (!$cvid) {
$genCVid = $adb->getUniqueID("vtiger_customview");
if ($genCVid != "") {
示例13: getValidDBInsertDateTimeValue
function getValidDBInsertDateTimeValue($value)
{
$valueList = explode(' ', $value);
$date = new DateTimeField($value);
if (count($valueList) == 2) {
$value = $date->getDBInsertDateTimeValue();
} elseif (count($valueList == 1)) {
$value = $date->getDBInsertDateValue();
}
return $value;
}
示例14: date
function save_module($module)
{
global $adb;
if ($this->HasDirectImageField) {
$this->insertIntoAttachment($this->id, $module);
}
if ($this->mode == 'edit' and !empty($this->sales_stage) and $this->sales_stage != $this->column_fields['sales_stage'] && $this->column_fields['sales_stage'] != '') {
$date_var = date("Y-m-d H:i:s");
$closingDateField = new DateTimeField($this->column_fields['closingdate']);
$closingdate = $_REQUEST['ajxaction'] == 'DETAILVIEW' ? $this->column_fields['closingdate'] : $closingDateField->getDBInsertDateValue();
$sql = "insert into vtiger_potstagehistory values(?,?,?,?,?,?,?,?)";
$params = array('', $this->id, $this->column_fields['amount'], decode_html($this->sales_stage), $this->column_fields['probability'], 0, $adb->formatDate($closingdate, true), $adb->formatDate($date_var, true));
$adb->pquery($sql, $params);
}
}