[Vtigercrm-commits] [vtiger-commits] r4511 - in /vtigercrm/trunk/modules/CustomView: CustomView.php EditView.php Forms.php ListViewTop.php PopulateCustomView.php Save.php SaveAction.php SendMailAction.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue Mar 28 00:22:44 EST 2006
Author: saraj
Date: Mon Mar 27 22:22:35 2006
New Revision: 4511
Log:
junk code removed in customview
Modified:
vtigercrm/trunk/modules/CustomView/CustomView.php
vtigercrm/trunk/modules/CustomView/EditView.php
vtigercrm/trunk/modules/CustomView/Forms.php
vtigercrm/trunk/modules/CustomView/ListViewTop.php
vtigercrm/trunk/modules/CustomView/PopulateCustomView.php
vtigercrm/trunk/modules/CustomView/Save.php
vtigercrm/trunk/modules/CustomView/SaveAction.php
vtigercrm/trunk/modules/CustomView/SendMailAction.php
Modified: vtigercrm/trunk/modules/CustomView/CustomView.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/CustomView.php (original)
+++ vtigercrm/trunk/modules/CustomView/CustomView.php Mon Mar 27 22:22:35 2006
@@ -154,14 +154,13 @@
function getCustomViewCombo($viewid='')
{
global $adb;
- $tabid = getTabid($this->customviewmodule);
- $ssql = "select customview.* from customview inner join tab on tab.name = customview.entitytype";
- $ssql .= " where tab.tabid=".$tabid;
- //echo $ssql;
- $result = $adb->query($ssql);
- while($cvrow=$adb->fetch_array($result))
- {
- if($cvrow['cvid'] == $viewid)
+ $tabid = getTabid($this->customviewmodule);
+ $ssql = "select customview.* from customview inner join tab on tab.name = customview.entitytype";
+ $ssql .= " where tab.tabid=".$tabid;
+ $result = $adb->query($ssql);
+ while($cvrow=$adb->fetch_array($result))
+ {
+ if($cvrow['cvid'] == $viewid)
{
$shtml .= "<option selected value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
$this->setdefaultviewid = $cvrow['cvid'];
@@ -170,84 +169,78 @@
{
$shtml .= "<option value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
}
- }
- //echo $shtml;
- return $shtml;
+ }
+ return $shtml;
}
function getColumnsListbyBlock($module,$block)
- {
- global $adb;
- $tabid = getTabid($module);
- global $profile_id;
-
- $sql = "select * from field inner join profile2field on profile2field.fieldid=field.fieldid";
+ {
+ global $adb;
+ $tabid = getTabid($module);
+ global $profile_id;
+
+ $sql = "select * from field inner join profile2field on profile2field.fieldid=field.fieldid";
$sql.= " where field.tabid=".$tabid." and field.block in (".$block.") and";
$sql.= " field.displaytype in (1,2) and profile2field.visible=0";
$sql.= " and profile2field.profileid=".$profile_id." order by sequence";
$result = $adb->query($sql);
- $noofrows = $adb->num_rows($result);
+ $noofrows = $adb->num_rows($result);
//Added on 14-10-2005 -- added ticket id in list
- if($module == 'HelpDesk' && $block == 25)
- {
- $module_columnlist['crmentity:crmid::HelpDesk_Ticket ID:I'] = 'Ticket ID';
- }
+ if($module == 'HelpDesk' && $block == 25)
+ {
+ $module_columnlist['crmentity:crmid::HelpDesk_Ticket ID:I'] = 'Ticket ID';
+ }
//Added to include activity type in activity customview list
- if($module == 'Activities' && $block == 19)
- {
- $module_columnlist['activity:activitytype::Activities_Activity Type:C'] = 'Activity Type';
- }
-
- for($i=0; $i<$noofrows; $i++)
- {
- $fieldtablename = $adb->query_result($result,$i,"tablename");
- $fieldcolname = $adb->query_result($result,$i,"columnname");
+ if($module == 'Activities' && $block == 19)
+ {
+ $module_columnlist['activity:activitytype::Activities_Activity Type:C'] = 'Activity Type';
+ }
+
+ for($i=0; $i<$noofrows; $i++)
+ {
+ $fieldtablename = $adb->query_result($result,$i,"tablename");
+ $fieldcolname = $adb->query_result($result,$i,"columnname");
$fieldname = $adb->query_result($result,$i,"fieldname");
$fieldtype = $adb->query_result($result,$i,"typeofdata");
$fieldtype = explode("~",$fieldtype);
$fieldtypeofdata = $fieldtype[0];
- /*if($fieldcolname == "crmid" || $fieldcolname == "parent_id")
- {
- $fieldtablename = "crmentity";
- $fieldcolname = "setype";
- }*/
- $fieldlabel = $adb->query_result($result,$i,"fieldlabel");
- if($fieldlabel == "Related To")
- {
- $fieldlabel = "Related to";
- }
- if($fieldlabel == "Start Date & Time")
- {
- $fieldlabel = "Start Date";
- if($module == 'Activities' && $block == 19)
- $module_columnlist['activity:time_start::Activities_Start Time:I'] = 'Start Time';
-
- }
- $fieldlabel1 = str_replace(" ","_",$fieldlabel);
- $optionvalue = $fieldtablename.":".$fieldcolname.":".$fieldname.":".$module."_".$fieldlabel1.":".$fieldtypeofdata;
- $module_columnlist[$optionvalue] = $fieldlabel;
+ $fieldlabel = $adb->query_result($result,$i,"fieldlabel");
+ if($fieldlabel == "Related To")
+ {
+ $fieldlabel = "Related to";
+ }
+ if($fieldlabel == "Start Date & Time")
+ {
+ $fieldlabel = "Start Date";
+ if($module == 'Activities' && $block == 19)
+ $module_columnlist['activity:time_start::Activities_Start Time:I'] = 'Start Time';
+
+ }
+ $fieldlabel1 = str_replace(" ","_",$fieldlabel);
+ $optionvalue = $fieldtablename.":".$fieldcolname.":".$fieldname.":".$module."_".$fieldlabel1.":".$fieldtypeofdata;
+ $module_columnlist[$optionvalue] = $fieldlabel;
if($fieldtype[1] == "M")
{
$this->mandatoryvalues[] = "'".$optionvalue."'";
$this->showvalues[] = $fieldlabel;
}
- }
- return $module_columnlist;
- }
+ }
+ return $module_columnlist;
+ }
function getModuleColumnsList($module)
- {
- foreach($this->module_list[$module] as $key=>$value)
- {
- $columnlist = $this->getColumnsListbyBlock($module,$value);
+ {
+ foreach($this->module_list[$module] as $key=>$value)
+ {
+ $columnlist = $this->getColumnsListbyBlock($module,$value);
if(isset($columnlist))
{
$ret_module_list[$module][$key] = $columnlist;
}
- }
- return $ret_module_list;
- }
-
+ }
+ return $ret_module_list;
+ }
+
function getColumnsListByCvid($cvid)
{
global $adb;
@@ -255,7 +248,6 @@
$sSQL = "select cvcolumnlist.* from cvcolumnlist";
$sSQL .= " inner join customview on customview.cvid = cvcolumnlist.cvid";
$sSQL .= " where customview.cvid =".$cvid." order by cvcolumnlist.columnindex";
- //echo $sSQL;
$result = $adb->query($sSQL);
while($columnrow = $adb->fetch_array($result))
@@ -267,345 +259,339 @@
}
function getStdCriteriaByModule($module)
- {
- global $adb;
- $tabid = getTabid($module);
- global $profile_id;
-
+ {
+ global $adb;
+ $tabid = getTabid($module);
+ global $profile_id;
+
foreach($this->module_list[$module] as $key=>$blockid)
- {
- $blockids[] = $blockid;
- }
- $blockids = implode(",",$blockids);
-
- $sql = "select * from field inner join tab on tab.tabid = field.tabid
- inner join profile2field on profile2field.fieldid=field.fieldid
- where field.tabid=".$tabid." and field.block in (".$blockids.")
+ {
+ $blockids[] = $blockid;
+ }
+ $blockids = implode(",",$blockids);
+
+ $sql = "select * from field inner join tab on tab.tabid = field.tabid
+ inner join profile2field on profile2field.fieldid=field.fieldid
+ where field.tabid=".$tabid." and field.block in (".$blockids.")
and (field.uitype =5 or field.displaytype=2)
and profile2field.visible=0 and profile2field.profileid=".$profile_id." order by field.sequence";
- $result = $adb->query($sql);
-
- while($criteriatyperow = $adb->fetch_array($result))
- {
- $fieldtablename = $criteriatyperow["tablename"];
- $fieldcolname = $criteriatyperow["columnname"];
- $fieldlabel = $criteriatyperow["fieldlabel"];
+ $result = $adb->query($sql);
+
+ while($criteriatyperow = $adb->fetch_array($result))
+ {
+ $fieldtablename = $criteriatyperow["tablename"];
+ $fieldcolname = $criteriatyperow["columnname"];
+ $fieldlabel = $criteriatyperow["fieldlabel"];
$fieldname = $criteriatyperow["fieldname"];
- /*if($fieldtablename == "crmentity")
- {
- $fieldtablename = $fieldtablename.$module;
- }*/
- $fieldlabel1 = str_replace(" ","_",$fieldlabel);
- $optionvalue = $fieldtablename.":".$fieldcolname.":".$fieldname.":".$module."_".$fieldlabel1;
- $stdcriteria_list[$optionvalue] = $fieldlabel;
- }
-
- return $stdcriteria_list;
-
- }
+ $fieldlabel1 = str_replace(" ","_",$fieldlabel);
+ $optionvalue = $fieldtablename.":".$fieldcolname.":".$fieldname.":".$module."_".$fieldlabel1;
+ $stdcriteria_list[$optionvalue] = $fieldlabel;
+ }
+
+ return $stdcriteria_list;
+
+ }
function getStdFilterCriteria($selcriteria = "")
- {
+ {
$filter = array();
- $stdfilter = Array("custom"=>"Custom",
- "prevfy"=>"Previous FY",
- "thisfy"=>"Current FY",
- "nextfy"=>"Next FY",
- "prevfq"=>"Previous FQ",
- "thisfq"=>"Current FQ",
- "nextfq"=>"Next FQ",
- "yesterday"=>"Yesterday",
- "today"=>"Today",
- "tomorrow"=>"Tomorrow",
- "lastweek"=>"Last Week",
- "thisweek"=>"Current Week",
- "nextweek"=>"Next Week",
- "lastmonth"=>"Last Month",
- "thismonth"=>"Current Month",
- "nextmonth"=>"Next Month",
- "last7days"=>"Last 7 Days",
- "last30days"=>"Last 30 Days",
- "last60days"=>"Last 60 Days",
- "last90days"=>"Last 90 Days",
- "last120days"=>"Last 120 Days",
- "next30days"=>"Next 30 Days",
- "next60days"=>"Next 60 Days",
- "next90days"=>"Next 90 Days",
- "next120days"=>"Next 120 Days"
- );
-
- foreach($stdfilter as $FilterKey=>$FilterValue)
- {
- if($FilterKey == $selcriteria)
- {
- $shtml['value'] = $FilterKey;
- $shtml['text'] = $FilterValue;
- $shtml['selected'] = "selected";
- }else
- {
- $shtml['value'] = $FilterKey;
- $shtml['text'] = $FilterValue;
- $shtml['selected'] = "";
- }
- $filter[] = $shtml;
- }
- return $filter;
-
- }
+ $stdfilter = Array("custom"=>"Custom",
+ "prevfy"=>"Previous FY",
+ "thisfy"=>"Current FY",
+ "nextfy"=>"Next FY",
+ "prevfq"=>"Previous FQ",
+ "thisfq"=>"Current FQ",
+ "nextfq"=>"Next FQ",
+ "yesterday"=>"Yesterday",
+ "today"=>"Today",
+ "tomorrow"=>"Tomorrow",
+ "lastweek"=>"Last Week",
+ "thisweek"=>"Current Week",
+ "nextweek"=>"Next Week",
+ "lastmonth"=>"Last Month",
+ "thismonth"=>"Current Month",
+ "nextmonth"=>"Next Month",
+ "last7days"=>"Last 7 Days",
+ "last30days"=>"Last 30 Days",
+ "last60days"=>"Last 60 Days",
+ "last90days"=>"Last 90 Days",
+ "last120days"=>"Last 120 Days",
+ "next30days"=>"Next 30 Days",
+ "next60days"=>"Next 60 Days",
+ "next90days"=>"Next 90 Days",
+ "next120days"=>"Next 120 Days"
+ );
+
+ foreach($stdfilter as $FilterKey=>$FilterValue)
+ {
+ if($FilterKey == $selcriteria)
+ {
+ $shtml['value'] = $FilterKey;
+ $shtml['text'] = $FilterValue;
+ $shtml['selected'] = "selected";
+ }else
+ {
+ $shtml['value'] = $FilterKey;
+ $shtml['text'] = $FilterValue;
+ $shtml['selected'] = "";
+ }
+ $filter[] = $shtml;
+ }
+ return $filter;
+
+ }
function getCriteriaJS()
- {
- $today = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d"), date("Y")));
- $tomorrow = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+1, date("Y")));
- $yesterday = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-1, date("Y")));
-
- $currentmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m"), "01", date("Y")));
- $currentmonth1 = date("Y-m-t");
- $lastmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")-1, "01", date("Y")));
- $lastmonth1 = date("Y-m-t", strtotime("-1 Month"));
- $nextmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")+1, "01", date("Y")));
- $nextmonth1 = date("Y-m-t", strtotime("+1 Month"));
-
- $lastweek0 = date("Y-m-d",strtotime("-2 week Sunday"));
- $lastweek1 = date("Y-m-d",strtotime("-1 week Saturday"));
-
- $thisweek0 = date("Y-m-d",strtotime("-1 week Sunday"));
- $thisweek1 = date("Y-m-d",strtotime("this Saturday"));
-
- $nextweek0 = date("Y-m-d",strtotime("this Sunday"));
- $nextweek1 = date("Y-m-d",strtotime("+1 week Saturday"));
-
- $next7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+6, date("Y")));
- $next30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+29, date("Y")));
- $next60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+59, date("Y")));
- $next90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+89, date("Y")));
- $next120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+119, date("Y")));
-
- $last7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-6, date("Y")));
- $last30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-29, date("Y")));
- $last60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-59, date("Y")));
- $last90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-89, date("Y")));
- $last120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-119, date("Y")));
-
- $currentFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")));
- $currentFY1 = date("Y-m-t",mktime(0, 0, 0, "12", date("d"), date("Y")));
- $lastFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")-1));
- $lastFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")-1));
+ {
+ $today = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d"), date("Y")));
+ $tomorrow = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+1, date("Y")));
+ $yesterday = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-1, date("Y")));
+
+ $currentmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m"), "01", date("Y")));
+ $currentmonth1 = date("Y-m-t");
+ $lastmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")-1, "01", date("Y")));
+ $lastmonth1 = date("Y-m-t", strtotime("-1 Month"));
+ $nextmonth0 = date("Y-m-d",mktime(0, 0, 0, date("m")+1, "01", date("Y")));
+ $nextmonth1 = date("Y-m-t", strtotime("+1 Month"));
+
+ $lastweek0 = date("Y-m-d",strtotime("-2 week Sunday"));
+ $lastweek1 = date("Y-m-d",strtotime("-1 week Saturday"));
+
+ $thisweek0 = date("Y-m-d",strtotime("-1 week Sunday"));
+ $thisweek1 = date("Y-m-d",strtotime("this Saturday"));
+
+ $nextweek0 = date("Y-m-d",strtotime("this Sunday"));
+ $nextweek1 = date("Y-m-d",strtotime("+1 week Saturday"));
+
+ $next7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+6, date("Y")));
+ $next30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+29, date("Y")));
+ $next60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+59, date("Y")));
+ $next90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+89, date("Y")));
+ $next120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")+119, date("Y")));
+
+ $last7days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-6, date("Y")));
+ $last30days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-29, date("Y")));
+ $last60days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-59, date("Y")));
+ $last90days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-89, date("Y")));
+ $last120days = date("Y-m-d",mktime(0, 0, 0, date("m") , date("d")-119, date("Y")));
+
+ $currentFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")));
+ $currentFY1 = date("Y-m-t",mktime(0, 0, 0, "12", date("d"), date("Y")));
+ $lastFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")-1));
+ $lastFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")-1));
$nextFY0 = date("Y-m-d",mktime(0, 0, 0, "01", "01", date("Y")+1));
- $nextFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")+1));
-
- $sjsStr = '<script language="JavaScript" type="text/javaScript">
- function showDateRange( type )
- {
- if (type!="custom")
- {
- document.CustomView.startdate.readOnly=true
- document.CustomView.enddate.readOnly=true
- getObj("jscal_trigger_date_start").style.visibility="hidden"
- getObj("jscal_trigger_date_end").style.visibility="hidden"
- }
- else
- {
- document.CustomView.startdate.readOnly=false
- document.CustomView.enddate.readOnly=false
- getObj("jscal_trigger_date_start").style.visibility="visible"
- getObj("jscal_trigger_date_end").style.visibility="visible"
- }
- if( type == "today" )
- {
- document.CustomView.startdate.value = "'.$today.'";
- document.CustomView.enddate.value = "'.$today.'";
- }
- else if( type == "yesterday" )
- {
- document.CustomView.startdate.value = "'.$yesterday.'";
- document.CustomView.enddate.value = "'.$yesterday.'";
- }
- else if( type == "tomorrow" )
- {
-
- document.CustomView.startdate.value = "'.$tomorrow.'";
- document.CustomView.enddate.value = "'.$tomorrow.'";
- }
- else if( type == "thisweek" )
- {
- document.CustomView.startdate.value = "'.$thisweek0.'";
- document.CustomView.enddate.value = "'.$thisweek1.'";
- }
- else if( type == "lastweek" )
- {
- document.CustomView.startdate.value = "'.$lastweek0.'";
- document.CustomView.enddate.value = "'.$lastweek1.'";
- }
- else if( type == "nextweek" )
- {
- document.CustomView.startdate.value = "'.$nextweek0.'";
- document.CustomView.enddate.value = "'.$nextweek1.'";
- }
- else if( type == "thismonth" )
- {
- document.CustomView.startdate.value = "'.$currentmonth0.'";
- document.CustomView.enddate.value = "'.$currentmonth1.'";
- }
- else if( type == "lastmonth" )
- {
- document.CustomView.startdate.value = "'.$lastmonth0.'";
- document.CustomView.enddate.value = "'.$lastmonth1.'";
- }
- else if( type == "nextmonth" )
- {
- document.CustomView.startdate.value = "'.$nextmonth0.'";
- document.CustomView.enddate.value = "'.$nextmonth1.'";
- }
- else if( type == "next7days" )
- {
- document.CustomView.startdate.value = "'.$today.'";
- document.CustomView.enddate.value = "'.$next7days.'";
- }
- else if( type == "next30days" )
- {
- document.CustomView.startdate.value = "'.$today.'";
- document.CustomView.enddate.value = "'.$next30days.'";
- }
- else if( type == "next60days" )
- {
- document.CustomView.startdate.value = "'.$today.'";
- document.CustomView.enddate.value = "'.$next60days.'";
- }
- else if( type == "next90days" )
- {
- document.CustomView.startdate.value = "'.$today.'";
- document.CustomView.enddate.value = "'.$next90days.'";
- }
- else if( type == "next120days" )
- {
- document.CustomView.startdate.value = "'.$today.'";
- document.CustomView.enddate.value = "'.$next120days.'";
- }
- else if( type == "last7days" )
- {
- document.CustomView.startdate.value = "'.$last7days.'";
- document.CustomView.enddate.value = "'.$today.'";
- }
- else if( type == "last30days" )
- {
- document.CustomView.startdate.value = "'.$last30days.'";
- document.CustomView.enddate.value = "'.$today.'";
- }
- else if( type == "last60days" )
- {
- document.CustomView.startdate.value = "'.$last60days.'";
- document.CustomView.enddate.value = "'.$today.'";
- }
- else if( type == "last90days" )
- {
- document.CustomView.startdate.value = "'.$last90days.'";
- document.CustomView.enddate.value = "'.$today.'";
- }
- else if( type == "last120days" )
- {
- document.CustomView.startdate.value = "'.$last120days.'";
- document.CustomView.enddate.value = "'.$today.'";
- }
- else if( type == "thisfy" )
- {
- document.CustomView.startdate.value = "'.$currentFY0.'";
- document.CustomView.enddate.value = "'.$currentFY1.'";
- }
- else if( type == "prevfy" )
- {
- document.CustomView.startdate.value = "'.$lastFY0.'";
- document.CustomView.enddate.value = "'.$lastFY1.'";
- }
- else if( type == "nextfy" )
- {
- document.CustomView.startdate.value = "'.$nextFY0.'";
- document.CustomView.enddate.value = "'.$nextFY1.'";
- }
- else if( type == "nextfq" )
- {
- document.CustomView.startdate.value = "2005-07-01";
- document.CustomView.enddate.value = "2005-09-30";
- }
- else if( type == "prevfq" )
- {
- document.CustomView.startdate.value = "2005-01-01";
- document.CustomView.enddate.value = "2005-03-31";
- }
- else if( type == "thisfq" )
- {
- document.CustomView.startdate.value = "2005-04-01";
- document.CustomView.enddate.value = "2005-06-30";
- }
- else
- {
- document.CustomView.startdate.value = "";
- document.CustomView.enddate.value = "";
- }
- }
- </script>';
-
- return $sjsStr;
- }
+ $nextFY1 = date("Y-m-t", mktime(0, 0, 0, "12", date("d"), date("Y")+1));
+
+ $sjsStr = '<script language="JavaScript" type="text/javaScript">
+ function showDateRange( type )
+ {
+ if (type!="custom")
+ {
+ document.CustomView.startdate.readOnly=true
+ document.CustomView.enddate.readOnly=true
+ getObj("jscal_trigger_date_start").style.visibility="hidden"
+ getObj("jscal_trigger_date_end").style.visibility="hidden"
+ }
+ else
+ {
+ document.CustomView.startdate.readOnly=false
+ document.CustomView.enddate.readOnly=false
+ getObj("jscal_trigger_date_start").style.visibility="visible"
+ getObj("jscal_trigger_date_end").style.visibility="visible"
+ }
+ if( type == "today" )
+ {
+ document.CustomView.startdate.value = "'.$today.'";
+ document.CustomView.enddate.value = "'.$today.'";
+ }
+ else if( type == "yesterday" )
+ {
+ document.CustomView.startdate.value = "'.$yesterday.'";
+ document.CustomView.enddate.value = "'.$yesterday.'";
+ }
+ else if( type == "tomorrow" )
+ {
+
+ document.CustomView.startdate.value = "'.$tomorrow.'";
+ document.CustomView.enddate.value = "'.$tomorrow.'";
+ }
+ else if( type == "thisweek" )
+ {
+ document.CustomView.startdate.value = "'.$thisweek0.'";
+ document.CustomView.enddate.value = "'.$thisweek1.'";
+ }
+ else if( type == "lastweek" )
+ {
+ document.CustomView.startdate.value = "'.$lastweek0.'";
+ document.CustomView.enddate.value = "'.$lastweek1.'";
+ }
+ else if( type == "nextweek" )
+ {
+ document.CustomView.startdate.value = "'.$nextweek0.'";
+ document.CustomView.enddate.value = "'.$nextweek1.'";
+ }
+ else if( type == "thismonth" )
+ {
+ document.CustomView.startdate.value = "'.$currentmonth0.'";
+ document.CustomView.enddate.value = "'.$currentmonth1.'";
+ }
+ else if( type == "lastmonth" )
+ {
+ document.CustomView.startdate.value = "'.$lastmonth0.'";
+ document.CustomView.enddate.value = "'.$lastmonth1.'";
+ }
+ else if( type == "nextmonth" )
+ {
+ document.CustomView.startdate.value = "'.$nextmonth0.'";
+ document.CustomView.enddate.value = "'.$nextmonth1.'";
+ }
+ else if( type == "next7days" )
+ {
+ document.CustomView.startdate.value = "'.$today.'";
+ document.CustomView.enddate.value = "'.$next7days.'";
+ }
+ else if( type == "next30days" )
+ {
+ document.CustomView.startdate.value = "'.$today.'";
+ document.CustomView.enddate.value = "'.$next30days.'";
+ }
+ else if( type == "next60days" )
+ {
+ document.CustomView.startdate.value = "'.$today.'";
+ document.CustomView.enddate.value = "'.$next60days.'";
+ }
+ else if( type == "next90days" )
+ {
+ document.CustomView.startdate.value = "'.$today.'";
+ document.CustomView.enddate.value = "'.$next90days.'";
+ }
+ else if( type == "next120days" )
+ {
+ document.CustomView.startdate.value = "'.$today.'";
+ document.CustomView.enddate.value = "'.$next120days.'";
+ }
+ else if( type == "last7days" )
+ {
+ document.CustomView.startdate.value = "'.$last7days.'";
+ document.CustomView.enddate.value = "'.$today.'";
+ }
+ else if( type == "last30days" )
+ {
+ document.CustomView.startdate.value = "'.$last30days.'";
+ document.CustomView.enddate.value = "'.$today.'";
+ }
+ else if( type == "last60days" )
+ {
+ document.CustomView.startdate.value = "'.$last60days.'";
+ document.CustomView.enddate.value = "'.$today.'";
+ }
+ else if( type == "last90days" )
+ {
+ document.CustomView.startdate.value = "'.$last90days.'";
+ document.CustomView.enddate.value = "'.$today.'";
+ }
+ else if( type == "last120days" )
+ {
+ document.CustomView.startdate.value = "'.$last120days.'";
+ document.CustomView.enddate.value = "'.$today.'";
+ }
+ else if( type == "thisfy" )
+ {
+ document.CustomView.startdate.value = "'.$currentFY0.'";
+ document.CustomView.enddate.value = "'.$currentFY1.'";
+ }
+ else if( type == "prevfy" )
+ {
+ document.CustomView.startdate.value = "'.$lastFY0.'";
+ document.CustomView.enddate.value = "'.$lastFY1.'";
+ }
+ else if( type == "nextfy" )
+ {
+ document.CustomView.startdate.value = "'.$nextFY0.'";
+ document.CustomView.enddate.value = "'.$nextFY1.'";
+ }
+ else if( type == "nextfq" )
+ {
+ document.CustomView.startdate.value = "2005-07-01";
+ document.CustomView.enddate.value = "2005-09-30";
+ }
+ else if( type == "prevfq" )
+ {
+ document.CustomView.startdate.value = "2005-01-01";
+ document.CustomView.enddate.value = "2005-03-31";
+ }
+ else if( type == "thisfq" )
+ {
+ document.CustomView.startdate.value = "2005-04-01";
+ document.CustomView.enddate.value = "2005-06-30";
+ }
+ else
+ {
+ document.CustomView.startdate.value = "";
+ document.CustomView.enddate.value = "";
+ }
+ }
+ </script>';
+
+ return $sjsStr;
+ }
function getStdFilterByCvid($cvid)
- {
- global $adb;
-
+ {
+ global $adb;
+
$sSQL = "select cvstdfilter.* from cvstdfilter inner join customview on customview.cvid = cvstdfilter.cvid";
$sSQL .= " where cvstdfilter.cvid=".$cvid;
- $result = $adb->query($sSQL);
- $stdfilterrow = $adb->fetch_array($result);
-
- $stdfilterlist["columnname"] = $stdfilterrow["columnname"];
- $stdfilterlist["stdfilter"] = $stdfilterrow["stdfilter"];
-
- if($stdfilterrow["stdfilter"] == "custom")
- {
- if($stdfilterrow["startdate"] != "0000-00-00")
- {
- $stdfilterlist["startdate"] = $stdfilterrow["startdate"];
- }
- if($stdfilterrow["enddate"] != "0000-00-00")
- {
- $stdfilterlist["enddate"] = $stdfilterrow["enddate"];
- }
- }
-
+ $result = $adb->query($sSQL);
+ $stdfilterrow = $adb->fetch_array($result);
+
+ $stdfilterlist["columnname"] = $stdfilterrow["columnname"];
+ $stdfilterlist["stdfilter"] = $stdfilterrow["stdfilter"];
+
+ if($stdfilterrow["stdfilter"] == "custom")
+ {
+ if($stdfilterrow["startdate"] != "0000-00-00")
+ {
+ $stdfilterlist["startdate"] = $stdfilterrow["startdate"];
+ }
+ if($stdfilterrow["enddate"] != "0000-00-00")
+ {
+ $stdfilterlist["enddate"] = $stdfilterrow["enddate"];
+ }
+ }
+
return $stdfilterlist;
- }
+ }
//<<<<<<<<advanced filter>>>>>>>>>>>>>>
- function getAdvFilterByCvid($cvid)
- {
- global $adb;
- global $modules;
-
+ function getAdvFilterByCvid($cvid)
+ {
+ global $adb;
+ global $modules;
+
$sSQL = "select cvadvfilter.* from cvadvfilter inner join customview on cvadvfilter.cvid = customview.cvid";
$sSQL .= " where cvadvfilter.cvid=".$cvid;
- //echo $sSQL;
- $result = $adb->query($sSQL);
-
- while($advfilterrow = $adb->fetch_array($result))
- {
- $advft["columnname"] = $advfilterrow["columnname"];
- $advft["comparator"] = $advfilterrow["comparator"];
- $advft["value"] = $advfilterrow["value"];
+ $result = $adb->query($sSQL);
+
+ while($advfilterrow = $adb->fetch_array($result))
+ {
+ $advft["columnname"] = $advfilterrow["columnname"];
+ $advft["comparator"] = $advfilterrow["comparator"];
+ $advft["value"] = $advfilterrow["value"];
$advfilterlist[] = $advft;
- }
-
- return $advfilterlist;
- }
- //<<<<<<<<advanced filter>>>>>>>>>>>>>>
+ }
+
+ return $advfilterlist;
+ }
+ //<<<<<<<<advanced filter>>>>>>>>>>>>>>
function getCvColumnListSQL($cvid)
{
$columnslist = $this->getColumnsListByCvid($cvid);
- //print_r($columnslist);
if(isset($columnslist))
{
foreach($columnslist as $columnname=>$value)
@@ -614,19 +600,19 @@
if($value != "")
{
$list = explode(":",$value);
- //$sqllist[] = $list[0].".".$list[1];
+
//Added For getting status for Activities -Jaguar
$sqllist_column = $list[0].".".$list[1];
- if($this->customviewmodule == "Activities")
- {
- if($list[1] == "status")
- {
- $sqllist_column = "case when (activity.status not like '') then activity.status else activity.eventstatus end as activitystatus";
- }
- }
- $sqllist[] = $sqllist_column;
-
+ if($this->customviewmodule == "Activities")
+ {
+ if($list[1] == "status")
+ {
+ $sqllist_column = "case when (activity.status not like '') then activity.status else activity.eventstatus end as activitystatus";
+ }
+ }
+ $sqllist[] = $sqllist_column;
//Ends
+
$tablefield[$list[0]] = $list[1];
$fieldlabel = trim(str_replace($this->escapemodule," ",$list[3]));
$this->list_fields[$fieldlabel] = $tablefield;
@@ -641,9 +627,7 @@
function getCVStdFilterSQL($cvid)
{
global $adb;
-
$stdfilterlist = $this->getStdFilterByCvid($cvid);
- //print_r($stdfilterlist);
if(isset($stdfilterlist))
{
foreach($stdfilterlist as $columnname=>$value)
@@ -668,14 +652,12 @@
$startdate = $datearray[0];
$enddate = $datearray[1];
}
-
if($startdate != "" && $enddate != "")
{
$columns = explode(":",$filtercolumn);
$stdfiltersql = $columns[0].".".$columns[1]." between '".$startdate." 00:00:00' and '".$enddate." 23:59:00'";
}
}
- //echo $stdfiltersql;
return $stdfiltersql;
}
function getCVAdvFilterSQL($cvid)
@@ -687,11 +669,10 @@
{
if(isset($advfltrow))
{
- //echo $advfltrow["columnname"];
$columns = explode(":",$advfltrow["columnname"]);
if($advfltrow["columnname"] != "" && $advfltrow["comparator"] != "" && $advfltrow["value"] != "")
{
-
+
$valuearray = explode(",",trim($advfltrow["value"]));
if(isset($valuearray) && count($valuearray) > 1)
{
@@ -705,11 +686,11 @@
}else
{
//Added for getting activity Status -Jaguar
- if($this->customviewmodule == "Activities" && $columns[1] == "status")
- {
- $advfiltersql[] = "case when (activity.status not like '') then activity.status else activity.eventstatus end".$this->getAdvComparator($advfltrow["comparator"],trim($advfltrow["value"]));
- }
- else
+ if($this->customviewmodule == "Activities" && $columns[1] == "status")
+ {
+ $advfiltersql[] = "case when (activity.status not like '') then activity.status else activity.eventstatus end".$this->getAdvComparator($advfltrow["comparator"],trim($advfltrow["value"]));
+ }
+ else
{
$advfiltersql[] = $this->getRealValues($columns[0],$columns[1],$advfltrow["comparator"],trim($advfltrow["value"]));
}
@@ -720,7 +701,7 @@
}
if(isset($advfiltersql))
{
- $advfsql = implode(" and ",$advfiltersql);
+ $advfsql = implode(" and ",$advfiltersql);
}
return $advfsql;
}
@@ -896,36 +877,25 @@
function getAdvComparator($comparator,$value)
{
-/* fLabels['e'] = 'equals';
- fLabels['n'] = 'not equal to';
- fLabels['s'] = 'starts with';
- fLabels['c'] = 'contains';
- fLabels['k'] = 'does not contain';
- fLabels['l'] = 'less than';
- fLabels['g'] = 'greater than';
- fLabels['m'] = 'less or equal';
- fLabels['h'] = 'greater or equal';*/
- //require_once('include/database/PearDatabase.php');
-
if($comparator == "e")
{
if(trim($value) != "")
- {
- $rtvalue = " = ".PearDatabase::quote($value);
- }else
- {
- $rtvalue = " is NULL";
- }
+ {
+ $rtvalue = " = ".PearDatabase::quote($value);
+ }else
+ {
+ $rtvalue = " is NULL";
+ }
}
if($comparator == "n")
{
if(trim($value) != "")
- {
- $rtvalue = " <> ".PearDatabase::quote($value);
- }else
- {
- $rtvalue = "is NOT NULL";
- }
+ {
+ $rtvalue = " <> ".PearDatabase::quote($value);
+ }else
+ {
+ $rtvalue = "is NOT NULL";
+ }
}
if($comparator == "s")
{
@@ -955,7 +925,7 @@
{
$rtvalue = " >= ".PearDatabase::quote($value);
}
-
+
return $rtvalue;
}
function getDateforStdFilterBytype($type)
@@ -1163,12 +1133,6 @@
if($viewid != "" && $listquery != "")
{
$listviewquery = substr($listquery, strpos($listquery,'from'),strlen($listquery));
- //$listviewquery = substr($listviewquery,strpos($listviewquery,'from'),strpos($listviewquery,'where'));
-
- //$wherequery = substr($listquery, strpos($listquery,'where'),strlen($listquery));
-
-
- //echo $listviewquery." ".$wherequery;
if($module == "Activities" || $module == "Emails")
{
$query = "select ".$this->getCvColumnListSQL($viewid)." ,crmentity.crmid,activity.* ".$listviewquery;
@@ -1195,7 +1159,6 @@
}
}
- //echo $query;
return $query;
}
@@ -1223,46 +1186,22 @@
return $query;
}
- /*function getMetricsCustomView($viewnames)
- {
- global $adb;
- $tabid = getTabid($this->customviewmodule);
- $ssql = "select customview.* from customview inner join tab on tab.name = customview.entitytype";
- $ssql .= " where ;
- //echo $ssql;
- $result = $adb->query($ssql);
- while($cvrow=$adb->fetch_array($result))
- {
- if($cvrow['setdefault'] == 1)
- {
- $shtml .= "<option selected value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
- $this->setdefaultviewid = $cvrow['cvid'];
- }
- else
- {
- $shtml .= "<option value=\"".$cvrow['cvid']."\">".$cvrow['viewname']."</option>";
- }
- }
- //echo $shtml;
- return $shtml;
- }*/
function getCustomActionDetails($cvid)
{
global $adb;
$sSQL = "select customaction.* from customaction inner join customview on customaction.cvid = customview.cvid";
- $sSQL .= " where customaction.cvid=".$cvid;
- //echo $sSQL;
- $result = $adb->query($sSQL);
-
- while($carow = $adb->fetch_array($result))
- {
- $calist["subject"] = $carow["subject"];
- $calist["module"] = $carow["module"];
- $calist["content"] = $carow["content"];
+ $sSQL .= " where customaction.cvid=".$cvid;
+ $result = $adb->query($sSQL);
+
+ while($carow = $adb->fetch_array($result))
+ {
+ $calist["subject"] = $carow["subject"];
+ $calist["module"] = $carow["module"];
+ $calist["content"] = $carow["content"];
$calist["cvid"] = $carow["cvid"];
- }
- return $calist;
+ }
+ return $calist;
}
function getParentId($fields,$values)
Modified: vtigercrm/trunk/modules/CustomView/EditView.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/EditView.php (original)
+++ vtigercrm/trunk/modules/CustomView/EditView.php Mon Mar 27 22:22:35 2006
@@ -41,31 +41,31 @@
$smarty->assign("DATAFORMAT",$current_user->date_format);
if($recordid == "")
{
- $oCustomView = new CustomView();
- $modulecollist = $oCustomView->getModuleColumnsList($cv_module);
- $log->info('CustomView :: Successfully got ColumnsList for the module'.$cv_module);
+ $oCustomView = new CustomView();
+ $modulecollist = $oCustomView->getModuleColumnsList($cv_module);
+ $log->info('CustomView :: Successfully got ColumnsList for the module'.$cv_module);
if(isset($modulecollist))
{
- $choosecolhtml = getByModule_ColumnsHTML($cv_module,$modulecollist);
+ $choosecolhtml = getByModule_ColumnsHTML($cv_module,$modulecollist);
}
//step2
- $stdfilterhtml = $oCustomView->getStdFilterCriteria();
- $log->info('CustomView :: Successfully got StandardFilter for the module'.$cv_module);
+ $stdfilterhtml = $oCustomView->getStdFilterCriteria();
+ $log->info('CustomView :: Successfully got StandardFilter for the module'.$cv_module);
$stdfiltercolhtml = getStdFilterHTML($cv_module);
- $stdfilterjs = $oCustomView->getCriteriaJS();
+ $stdfilterjs = $oCustomView->getCriteriaJS();
//step4
- $advfilterhtml = getAdvCriteriaHTML();
+ $advfilterhtml = getAdvCriteriaHTML();
for($i=1;$i<10;$i++)
- {
- $smarty->assign("CHOOSECOLUMN".$i,$choosecolhtml);
- }
+ {
+ $smarty->assign("CHOOSECOLUMN".$i,$choosecolhtml);
+ }
$log->info('CustomView :: Successfully got AdvancedFilter for the module'.$cv_module);
for($i=1;$i<6;$i++)
- {
- $smarty->assign("FOPTION".$i,$advfilterhtml);
- $smarty->assign("BLOCK".$i,$choosecolhtml);
- }
+ {
+ $smarty->assign("FOPTION".$i,$advfilterhtml);
+ $smarty->assign("BLOCK".$i,$choosecolhtml);
+ }
$smarty->assign("STDFILTERCOLUMNS",$stdfiltercolhtml);
$smarty->assign("STDFILTERCRITERIA",$stdfilterhtml);
@@ -82,7 +82,7 @@
$log->info('CustomView :: Successfully got ViewDetails for the Viewid'.$recordid);
$modulecollist = $oCustomView->getModuleColumnsList($cv_module);
$selectedcolumnslist = $oCustomView->getColumnsListByCvid($recordid);
- $log->info('CustomView :: Successfully got ColumnsList for the Viewid'.$recordid);
+ $log->info('CustomView :: Successfully got ColumnsList for the Viewid'.$recordid);
$smarty->assign("VIEWNAME",$customviewdtls["viewname"]);
@@ -91,20 +91,20 @@
$smarty->assign("CHECKED","checked");
}
if($customviewdtls["setmetrics"] == 1)
- {
- $smarty->assign("MCHECKED","checked");
- }
+ {
+ $smarty->assign("MCHECKED","checked");
+ }
for($i=1;$i<10;$i++)
- {
- $choosecolhtml = getByModule_ColumnsHTML($cv_module,$modulecollist,$selectedcolumnslist[$i-1]);
- $smarty->assign("CHOOSECOLUMN".$i,$choosecolhtml);
- }
+ {
+ $choosecolhtml = getByModule_ColumnsHTML($cv_module,$modulecollist,$selectedcolumnslist[$i-1]);
+ $smarty->assign("CHOOSECOLUMN".$i,$choosecolhtml);
+ }
$stdfilterlist = $oCustomView->getStdFilterByCvid($recordid);
$log->info('CustomView :: Successfully got Standard Filter for the Viewid'.$recordid);
$stdfilterhtml = $oCustomView->getStdFilterCriteria($stdfilterlist["stdfilter"]);
- $stdfiltercolhtml = getStdFilterHTML($cv_module,$stdfilterlist["columnname"]);
- $stdfilterjs = $oCustomView->getCriteriaJS();
+ $stdfiltercolhtml = getStdFilterHTML($cv_module,$stdfilterlist["columnname"]);
+ $stdfilterjs = $oCustomView->getCriteriaJS();
if(isset($stdfilterlist["startdate"]) && isset($stdfilterlist["enddate"]))
{
@@ -113,24 +113,23 @@
}
$advfilterlist = $oCustomView->getAdvFilterByCvid($recordid);
- $log->info('CustomView :: Successfully got Advanced Filter for the Viewid'.$recordid,'info');
+ $log->info('CustomView :: Successfully got Advanced Filter for the Viewid'.$recordid,'info');
for($i=1;$i<6;$i++)
- {
- $advfilterhtml = getAdvCriteriaHTML($advfilterlist[$i-1]["comparator"]);
+ {
+ $advfilterhtml = getAdvCriteriaHTML($advfilterlist[$i-1]["comparator"]);
$advcolumnhtml = getByModule_ColumnsHTML($cv_module,$modulecollist,$advfilterlist[$i-1]["columnname"]);
$smarty->assign("FOPTION".$i,$advfilterhtml);
- $smarty->assign("BLOCK".$i,$advcolumnhtml);
- //echo '<pre>';print_r($advcolumnhtml);echo '</pre>';
+ $smarty->assign("BLOCK".$i,$advcolumnhtml);
$smarty->assign("VALUE".$i,$advfilterlist[$i-1]["value"]);
- }
+ }
$smarty->assign("STDFILTERCOLUMNS",$stdfiltercolhtml);
- $smarty->assign("STDFILTERCRITERIA",$stdfilterhtml);
- $smarty->assign("STDFILTER_JAVASCRIPT",$stdfilterjs);
+ $smarty->assign("STDFILTERCRITERIA",$stdfilterhtml);
+ $smarty->assign("STDFILTER_JAVASCRIPT",$stdfilterjs);
$smarty->assign("MANDATORYCHECK",implode(",",$oCustomView->mandatoryvalues));
$smarty->assign("SHOWVALUES",implode(",",$oCustomView->showvalues));
-
+
$cactionhtml = "<input name='customaction' class='button' type='button' value='Create Custom Action' onclick=goto_CustomAction('".$cv_module."');>";
if($cv_module == "Leads" || $cv_module == "Accounts" || $cv_module == "Contacts")
@@ -153,120 +152,120 @@
$mod_strings = return_module_language($current_language,$module);
foreach($oCustomView->module_list[$module] as $key=>$value)
- {
- $advfilter = array();
- $label = $app_list_strings['moduleList'][$module]." ".$key;
- if(isset($columnslist[$module][$key]))
- {
- foreach($columnslist[$module][$key] as $field=>$fieldlabel)
- {
- if(isset($mod_strings[$fieldlabel]))
- {
- if($selected == $field)
- {
- $advfilter_option['value'] = $field;
- $advfilter_option['text'] = $mod_strings[$fieldlabel];
- $advfilter_option['selected'] = "selected";
- }else
- {
- $advfilter_option['value'] = $field;
- $advfilter_option['text'] = $mod_strings[$fieldlabel];
- $advfilter_option['selected'] = "";
- }
- }else
- {
- if($selected == $field)
- {
- $advfilter_option['value'] = $field;
- $advfilter_option['text'] = $fieldlabel;
- $advfilter_option['selected'] = "selected";
- }else
- {
- $advfilter_option['value'] = $field;
- $advfilter_option['text'] = $fieldlabel;
- $advfilter_option['selected'] = "";
- }
- }
- $advfilter[] = $advfilter_option;
- }
- $advfilter_out[$label]= $advfilter;
- }
- }
- return $advfilter_out;
+ {
+ $advfilter = array();
+ $label = $app_list_strings['moduleList'][$module]." ".$key;
+ if(isset($columnslist[$module][$key]))
+ {
+ foreach($columnslist[$module][$key] as $field=>$fieldlabel)
+ {
+ if(isset($mod_strings[$fieldlabel]))
+ {
+ if($selected == $field)
+ {
+ $advfilter_option['value'] = $field;
+ $advfilter_option['text'] = $mod_strings[$fieldlabel];
+ $advfilter_option['selected'] = "selected";
+ }else
+ {
+ $advfilter_option['value'] = $field;
+ $advfilter_option['text'] = $mod_strings[$fieldlabel];
+ $advfilter_option['selected'] = "";
+ }
+ }else
+ {
+ if($selected == $field)
+ {
+ $advfilter_option['value'] = $field;
+ $advfilter_option['text'] = $fieldlabel;
+ $advfilter_option['selected'] = "selected";
+ }else
+ {
+ $advfilter_option['value'] = $field;
+ $advfilter_option['text'] = $fieldlabel;
+ $advfilter_option['selected'] = "";
+ }
+ }
+ $advfilter[] = $advfilter_option;
+ }
+ $advfilter_out[$label]= $advfilter;
+ }
+ }
+ return $advfilter_out;
}
//step2
//step3
function getStdFilterHTML($module,$selected="")
{
- global $app_list_strings;
- global $oCustomView;
+ global $app_list_strings;
+ global $oCustomView;
$stdfilter = array();
- $result = $oCustomView->getStdCriteriaByModule($module);
+ $result = $oCustomView->getStdCriteriaByModule($module);
$mod_strings = return_module_language($current_language,$module);
- if(isset($result))
- {
- foreach($result as $key=>$value)
- {
- if(isset($mod_strings[$value]))
+ if(isset($result))
+ {
+ foreach($result as $key=>$value)
+ {
+ if(isset($mod_strings[$value]))
{
- if($key == $selected)
- {
- $filter['value'] = $key;
- $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$mod_strings[$value];
- $filter['selected'] = "selected";
- }else
- {
- $filter['value'] = $key;
- $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$mod_strings[$value];
- $filter['selected'] ="";
- }
+ if($key == $selected)
+ {
+ $filter['value'] = $key;
+ $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$mod_strings[$value];
+ $filter['selected'] = "selected";
+ }else
+ {
+ $filter['value'] = $key;
+ $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$mod_strings[$value];
+ $filter['selected'] ="";
+ }
}else
{
- if($key == $selected)
- {
- $filter['value'] = $key;
- $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$value;
- $filter['selected'] = 'selected';
- }else
- {
- $filter['value'] = $key;
- $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$value;
- $filter['selected'] ='';
- }
+ if($key == $selected)
+ {
+ $filter['value'] = $key;
+ $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$value;
+ $filter['selected'] = 'selected';
+ }else
+ {
+ $filter['value'] = $key;
+ $filter['text'] = $app_list_strings['moduleList'][$module]." - ".$value;
+ $filter['selected'] ='';
+ }
}
$stdfilter[]=$filter;
- }
- }
-
- return $stdfilter;
+ }
+ }
+
+ return $stdfilter;
}
//step3
//step4
function getAdvCriteriaHTML($selected="")
{
- global $adv_filter_options;
- global $app_list_strings;
- $AdvCriteria = array();
- foreach($adv_filter_options as $key=>$value)
- {
- if($selected == $key)
- {
+ global $adv_filter_options;
+ global $app_list_strings;
+ $AdvCriteria = array();
+ foreach($adv_filter_options as $key=>$value)
+ {
+ if($selected == $key)
+ {
$advfilter_criteria['value'] = $key;
$advfilter_criteria['text'] = $value;
$advfilter_criteria['selected'] = "selected";
- }else
- {
+ }else
+ {
$advfilter_criteria['value'] = $key;
- $advfilter_criteria['text'] = $value;
- $advfilter_criteria['selected'] = "";
- }
- $AdvCriteria[] = $advfilter_criteria;
- }
-
- return $AdvCriteria;
+ $advfilter_criteria['text'] = $value;
+ $advfilter_criteria['selected'] = "";
+ }
+ $AdvCriteria[] = $advfilter_criteria;
+ }
+
+ return $AdvCriteria;
}
//step4
Modified: vtigercrm/trunk/modules/CustomView/Forms.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/Forms.php (original)
+++ vtigercrm/trunk/modules/CustomView/Forms.php Mon Mar 27 22:22:35 2006
@@ -162,13 +162,7 @@
function getFieldSelect(&$column_fields,$colnum,&$required_fields,$suggest_field,$translated_fields,$module)
{
-/*
-echo '<br> column fields : ';print_r($column_fields);
-echo '<br> column : '.$colnum;
-echo '<br> required fields : ';print_r($required_fields);
-echo '<br> suggest fields : '.$suggest_field;
-echo '<br> translated fields : ';print_r($translated_fields);
-*/ global $mod_strings;
+ global $mod_strings;
global $app_strings;
global $outlook_contacts_field_map;
require_once('include/database/PearDatabase.php');
@@ -195,7 +189,6 @@
{
continue;
}
-//echo '<br> : '.$field;
$output .= "<option value=\"".$field;
if ( isset( $suggest_field) &&
@@ -220,17 +213,6 @@
$count ++;
}
- /*if($module == 'Contacts')
- {
- $module ='contactdetails';
- }
- $custquery = "select * from field where tablename='".$module."'";
- $cust_result = $adb->query($custquery);
- while($row = $adb->fetch_array($cust_result))
- {
- $output .= "<option value='".$row['columnname']."'>". $row['fieldlabel'] . "</option>\n";
- }*/
-
$output .= "</select>\n";
return $output;
Modified: vtigercrm/trunk/modules/CustomView/ListViewTop.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/ListViewTop.php (original)
+++ vtigercrm/trunk/modules/CustomView/ListViewTop.php Mon Mar 27 22:22:35 2006
@@ -80,7 +80,7 @@
$value[]='<a href="index.php?action=index&module='.$metriclist['module'].'&viewname='.$metriclist['id'].'">'.$metriclist['name'].'</a>';
$value[]='<a href="index.php?action=index&module='.$metriclist['module'].'&viewname='.$metriclist['id'].'">'.$metriclist['count'].'</a>';
- $entries[$metriclist['id']]=$value;
+ $entries[$metriclist['id']]=$value;
}
}
@@ -94,7 +94,6 @@
global $adb;
$ssql = "select customview.* from customview inner join tab on tab.name = customview.entitytype";
$ssql .= " where customview.setmetrics = 1 order by customview.entitytype";
- //echo $ssql;
$result = $adb->query($ssql);
while($cvrow=$adb->fetch_array($result))
{
Modified: vtigercrm/trunk/modules/CustomView/PopulateCustomView.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/PopulateCustomView.php (original)
+++ vtigercrm/trunk/modules/CustomView/PopulateCustomView.php Mon Mar 27 22:22:35 2006
@@ -341,54 +341,53 @@
);
$cvadvfilters = Array(
- Array(
- Array('columnname'=>'leaddetails:leadstatus:leadstatus:Leads_Lead_Status:V',
- 'comparator'=>'e',
- 'value'=>'Hot'
- )
- ),
-
- Array(
- Array('columnname'=>'account:account_type:accounttype:Accounts_Type:V',
- 'comparator'=>'e',
- 'value'=>'Prospect'
- )
- ),
- Array(
+ Array(
+ Array('columnname'=>'leaddetails:leadstatus:leadstatus:Leads_Lead_Status:V',
+ 'comparator'=>'e',
+ 'value'=>'Hot'
+ )
+ ),
+ Array(
+ Array('columnname'=>'account:account_type:accounttype:Accounts_Type:V',
+ 'comparator'=>'e',
+ 'value'=>'Prospect'
+ )
+ ),
+ Array(
Array('columnname'=>'potential:sales_stage:sales_stage:Potentials_Sales_Stage:V',
'comparator'=>'e',
'value'=>'Closed Won'
)
),
- Array(
+ Array(
Array('columnname'=>'potential:sales_stage:sales_stage:Potentials_Sales_Stage:V',
'comparator'=>'e',
'value'=>'Prospecting'
)
),
- Array(
+ Array(
Array('columnname'=>'troubletickets:status:ticketstatus:HelpDesk_Status:V',
'comparator'=>'n',
'value'=>'Closed'
)
),
- Array(
+ Array(
Array('columnname'=>'troubletickets:priority:ticketpriorities:HelpDesk_Priority:V',
'comparator'=>'e',
'value'=>'High'
)
),
- Array(
- Array('columnname'=>'quotes:quotestage:quotestage:Quotes_Quote_Stage:V',
+ Array(
+ Array('columnname'=>'quotes:quotestage:quotestage:Quotes_Quote_Stage:V',
'comparator'=>'n',
'value'=>'Accepted'
),
- Array('columnname'=>'quotes:quotestage:quotestage:Quotes_Quote_Stage:V',
+ Array('columnname'=>'quotes:quotestage:quotestage:Quotes_Quote_Stage:V',
'comparator'=>'n',
'value'=>'Rejected'
)
),
- Array(
+ Array(
Array('columnname'=>'quotes:quotestage:quotestage:Quotes_Quote_Stage:V',
'comparator'=>'e',
'value'=>'Rejected'
@@ -398,9 +397,9 @@
foreach($customviews as $key=>$customview)
{
- $queryid = insertCustomView($customview['viewname'],$customview['setdefault'],$customview['setmetrics'],$customview['cvmodule']);
- insertCvColumns($queryid,$cvcolumns[$key]);
-
+ $queryid = insertCustomView($customview['viewname'],$customview['setdefault'],$customview['setmetrics'],$customview['cvmodule']);
+ insertCvColumns($queryid,$cvcolumns[$key]);
+
if(isset($cvstdfilters[$customview['stdfilterid']]))
{
$i = $customview['stdfilterid'];
@@ -408,7 +407,7 @@
}
if(isset($cvadvfilters[$customview['advfilterid']]))
{
- insertCvAdvFilter($queryid,$cvadvfilters[$customview['advfilterid']]);
+ insertCvAdvFilter($queryid,$cvadvfilters[$customview['advfilterid']]);
}
}
@@ -423,10 +422,8 @@
$customviewsql = "insert into customview(cvid,viewname,setdefault,setmetrics,entitytype)";
$customviewsql .= " values(".$genCVid.",'".$viewname."',".$setdefault.",".$setmetrics.",'".$cvmodule."')";
- //echo $customviewsql;
$customviewresult = $adb->query($customviewsql);
}
-
return $genCVid;
}
@@ -439,7 +436,6 @@
{
$columnsql = "insert into cvcolumnlist (cvid,columnindex,columnname)";
$columnsql .= " values (".$CVid.",".$i.",'".$columnslist[$i]."')";
- //echo $columnsql;
$columnresult = $adb->query($columnsql);
}
}
@@ -455,7 +451,6 @@
$stdfiltersql .= "'".$filtercriteria."',";
$stdfiltersql .= "'".$startdate."',";
$stdfiltersql .= "'".$enddate."')";
- //echo $stdfiltersql;
$stdfilterresult = $adb->query($stdfiltersql);
}
}
@@ -468,23 +463,11 @@
foreach($filters as $i=>$filter)
{
$advfiltersql = "insert into cvadvfilter(cvid,columnindex,columnname,comparator,value)";
- $advfiltersql .= " values (".$CVid.",".$i.",'".$filter['columnname']."',";
- $advfiltersql .= "'".$filter['comparator']."',";
- $advfiltersql .= "'".$filter['value']."')";
- //echo $advfiltersql;
- $advfilterresult = $adb->query($advfiltersql);
+ $advfiltersql .= " values (".$CVid.",".$i.",'".$filter['columnname']."',";
+ $advfiltersql .= "'".$filter['comparator']."',";
+ $advfiltersql .= "'".$filter['value']."')";
+ $advfilterresult = $adb->query($advfiltersql);
}
-
- /*for($i=0;$i<count($filtercolumns);$i++)
- {
- $advfiltersql = "insert into cvadvfilter(cvid,columnindex,columnname,comparator,value)";
- $advfiltersql .= " values (".$CVid.",".$i.",'".$filtercolumns[$i]."',";
- $advfiltersql .= "'".$filteroption[$i]."',";
- $advfiltersql .= "'".$filtervalue[$i]."')";
- //echo $advfiltersql;
- $advfilterresult = $adb->query($advfiltersql);
- }*/
-
}
}
?>
Modified: vtigercrm/trunk/modules/CustomView/Save.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/Save.php (original)
+++ vtigercrm/trunk/modules/CustomView/Save.php Mon Mar 27 22:22:35 2006
@@ -35,7 +35,6 @@
$setmetrics = 0;
}
- //echo $viewname.$setdefault;
$allKeys = array_keys($HTTP_POST_VARS);
//<<<<<<<columns>>>>>>>>>>
@@ -94,108 +93,101 @@
if($genCVid != "")
{
- if($setdefault == 1)
- {
- $updatedefaultsql = "update customview set setdefault=0 where entitytype='".$cvmodule."'";
- $updatedefaultresult = $adb->query($updatedefaultsql);
- }
- $log->info("CustomView :: Save :: setdefault upated successfully");
+ if($setdefault == 1)
+ {
+ $updatedefaultsql = "update customview set setdefault=0 where entitytype='".$cvmodule."'";
+ $updatedefaultresult = $adb->query($updatedefaultsql);
+ }
+ $log->info("CustomView :: Save :: setdefault upated successfully");
- $customviewsql = "insert into customview(cvid,viewname,setdefault,setmetrics,entitytype)";
- $customviewsql .= " values(".$genCVid.",'".$viewname."',".$setdefault.",".$setmetrics.",'".$cvmodule."')";
- //echo $customviewsql;
- $customviewresult = $adb->query($customviewsql);
- $log->info("CustomView :: Save :: customview created successfully");
- if($customviewresult)
- {
- if(isset($columnslist))
+ $customviewsql = "insert into customview(cvid,viewname,setdefault,setmetrics,entitytype)";
+ $customviewsql .= " values(".$genCVid.",'".$viewname."',".$setdefault.",".$setmetrics.",'".$cvmodule."')";
+ $customviewresult = $adb->query($customviewsql);
+ $log->info("CustomView :: Save :: customview created successfully");
+ if($customviewresult)
{
- for($i=0;$i<count($columnslist);$i++)
- {
- $columnsql = "insert into cvcolumnlist (cvid,columnindex,columnname)";
- $columnsql .= " values (".$genCVid.",".$i.",'".$columnslist[$i]."')";
- //echo $columnsql;
- $columnresult = $adb->query($columnsql);
- }
- $log->info("CustomView :: Save :: cvcolumnlist created successfully");
-
- $stdfiltersql = "insert into cvstdfilter(cvid,columnname,stdfilter,startdate,enddate)";
- $stdfiltersql .= " values (".$genCVid.",'".$std_filter_list["columnname"]."',";
- $stdfiltersql .= "'".$std_filter_list["stdfilter"]."',";
- $stdfiltersql .= "'".$std_filter_list["startdate"]."',";
- $stdfiltersql .= "'".$std_filter_list["enddate"]."')";
- //echo $stdfiltersql;
- $stdfilterresult = $adb->query($stdfiltersql);
- $log->info("CustomView :: Save :: cvstdfilter created successfully");
- for($i=0;$i<count($adv_filter_col);$i++)
- {
- $advfiltersql = "insert into cvadvfilter(cvid,columnindex,columnname,comparator,value)";
- $advfiltersql .= " values (".$genCVid.",".$i.",'".$adv_filter_col[$i]."',";
- $advfiltersql .= "'".$adv_filter_option[$i]."',";
- $advfiltersql .= "'".$adv_filter_value[$i]."')";
- //echo $advfiltersql;
- $advfilterresult = $adb->query($advfiltersql);
- }
- $log->info("CustomView :: Save :: cvadvfilter created successfully");
+ if(isset($columnslist))
+ {
+ for($i=0;$i<count($columnslist);$i++)
+ {
+ $columnsql = "insert into cvcolumnlist (cvid,columnindex,columnname)";
+ $columnsql .= " values (".$genCVid.",".$i.",'".$columnslist[$i]."')";
+ $columnresult = $adb->query($columnsql);
+ }
+ $log->info("CustomView :: Save :: cvcolumnlist created successfully");
+
+ $stdfiltersql = "insert into cvstdfilter(cvid,columnname,stdfilter,startdate,enddate)";
+ $stdfiltersql .= " values (".$genCVid.",'".$std_filter_list["columnname"]."',";
+ $stdfiltersql .= "'".$std_filter_list["stdfilter"]."',";
+ $stdfiltersql .= "'".$std_filter_list["startdate"]."',";
+ $stdfiltersql .= "'".$std_filter_list["enddate"]."')";
+ $stdfilterresult = $adb->query($stdfiltersql);
+ $log->info("CustomView :: Save :: cvstdfilter created successfully");
+ for($i=0;$i<count($adv_filter_col);$i++)
+ {
+ $advfiltersql = "insert into cvadvfilter(cvid,columnindex,columnname,comparator,value)";
+ $advfiltersql .= " values (".$genCVid.",".$i.",'".$adv_filter_col[$i]."',";
+ $advfiltersql .= "'".$adv_filter_option[$i]."',";
+ $advfiltersql .= "'".$adv_filter_value[$i]."')";
+ $advfilterresult = $adb->query($advfiltersql);
+ }
+ $log->info("CustomView :: Save :: cvadvfilter created successfully");
+ }
}
- }
- $cvid = $genCVid;
+ $cvid = $genCVid;
}
}else
{
- if($setdefault == 1)
- {
+ if($setdefault == 1)
+ {
$updatedefaultsql = "update customview set setdefault=0 where entitytype='".$cvmodule."'";
$updatedefaultresult = $adb->query($updatedefaultsql);
- }
- $log->info("CustomView :: Save :: setdefault upated successfully".$genCVid);
- $updatecvsql = "update customview set viewname='".$viewname."',setdefault=".$setdefault.",setmetrics=".$setmetrics." where cvid=".$cvid;
- $updatecvresult = $adb->query($updatecvsql);
- $log->info("CustomView :: Save :: customview upated successfully".$genCVid);
- $deletesql = "delete from cvcolumnlist where cvid=".$cvid;
- $deleteresult = $adb->query($deletesql);
+ }
+ $log->info("CustomView :: Save :: setdefault upated successfully".$genCVid);
+ $updatecvsql = "update customview set viewname='".$viewname."',setdefault=".$setdefault.",setmetrics=".$setmetrics." where cvid=".$cvid;
+ $updatecvresult = $adb->query($updatecvsql);
+ $log->info("CustomView :: Save :: customview upated successfully".$genCVid);
+ $deletesql = "delete from cvcolumnlist where cvid=".$cvid;
+ $deleteresult = $adb->query($deletesql);
- $deletesql = "delete from cvstdfilter where cvid=".$cvid;
- $deleteresult = $adb->query($deletesql);
+ $deletesql = "delete from cvstdfilter where cvid=".$cvid;
+ $deleteresult = $adb->query($deletesql);
- $deletesql = "delete from cvadvfilter where cvid=".$cvid;
- $deleteresult = $adb->query($deletesql);
- $log->info("CustomView :: Save :: cvcolumnlist,cvstdfilter,cvadvfilter deleted successfully before update".$genCVid);
+ $deletesql = "delete from cvadvfilter where cvid=".$cvid;
+ $deleteresult = $adb->query($deletesql);
+ $log->info("CustomView :: Save :: cvcolumnlist,cvstdfilter,cvadvfilter deleted successfully before update".$genCVid);
- $genCVid = $cvid;
- if($updatecvresult)
- {
- if(isset($columnslist))
- {
- for($i=0;$i<count($columnslist);$i++)
- {
- $columnsql = "insert into cvcolumnlist (cvid,columnindex,columnname)";
- $columnsql .= " values (".$genCVid.",".$i.",'".$columnslist[$i]."')";
- //echo $columnsql;
- $columnresult = $adb->query($columnsql);
- }
- $log->info("CustomView :: Save :: cvcolumnlist update successfully".$genCVid);
- $stdfiltersql = "insert into cvstdfilter(cvid,columnname,stdfilter,startdate,enddate)";
- $stdfiltersql .= " values (".$genCVid.",'".$std_filter_list["columnname"]."',";
- $stdfiltersql .= "'".$std_filter_list["stdfilter"]."',";
- $stdfiltersql .= "'".$std_filter_list["startdate"]."',";
- $stdfiltersql .= "'".$std_filter_list["enddate"]."')";
- //echo $stdfiltersql;
- $stdfilterresult = $adb->query($stdfiltersql);
- $log->info("CustomView :: Save :: cvstdfilter update successfully".$genCVid);
- for($i=0;$i<count($adv_filter_col);$i++)
- {
- $advfiltersql = "insert into cvadvfilter(cvid,columnindex,columnname,comparator,value)";
- $advfiltersql .= " values (".$genCVid.",".$i.",'".$adv_filter_col[$i]."',";
- $advfiltersql .= "'".$adv_filter_option[$i]."',";
- $advfiltersql .= "'".$adv_filter_value[$i]."')";
- // echo $advfiltersql;
- $advfilterresult = $adb->query($advfiltersql);
- }
- $log->info("CustomView :: Save :: cvadvfilter update successfully".$genCVid);
- }
- }
+ $genCVid = $cvid;
+ if($updatecvresult)
+ {
+ if(isset($columnslist))
+ {
+ for($i=0;$i<count($columnslist);$i++)
+ {
+ $columnsql = "insert into cvcolumnlist (cvid,columnindex,columnname)";
+ $columnsql .= " values (".$genCVid.",".$i.",'".$columnslist[$i]."')";
+ $columnresult = $adb->query($columnsql);
+ }
+ $log->info("CustomView :: Save :: cvcolumnlist update successfully".$genCVid);
+ $stdfiltersql = "insert into cvstdfilter(cvid,columnname,stdfilter,startdate,enddate)";
+ $stdfiltersql .= " values (".$genCVid.",'".$std_filter_list["columnname"]."',";
+ $stdfiltersql .= "'".$std_filter_list["stdfilter"]."',";
+ $stdfiltersql .= "'".$std_filter_list["startdate"]."',";
+ $stdfiltersql .= "'".$std_filter_list["enddate"]."')";
+ $stdfilterresult = $adb->query($stdfiltersql);
+ $log->info("CustomView :: Save :: cvstdfilter update successfully".$genCVid);
+ for($i=0;$i<count($adv_filter_col);$i++)
+ {
+ $advfiltersql = "insert into cvadvfilter(cvid,columnindex,columnname,comparator,value)";
+ $advfiltersql .= " values (".$genCVid.",".$i.",'".$adv_filter_col[$i]."',";
+ $advfiltersql .= "'".$adv_filter_option[$i]."',";
+ $advfiltersql .= "'".$adv_filter_value[$i]."')";
+ $advfilterresult = $adb->query($advfiltersql);
+ }
+ $log->info("CustomView :: Save :: cvadvfilter update successfully".$genCVid);
+ }
+ }
}
}
Modified: vtigercrm/trunk/modules/CustomView/SaveAction.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/SaveAction.php (original)
+++ vtigercrm/trunk/modules/CustomView/SaveAction.php Mon Mar 27 22:22:35 2006
@@ -23,7 +23,7 @@
if($mode == "new")
{
$customactionsql = "insert into customaction(cvid,subject,module,content)";
- $customactionsql .= " values(".$cvid.",'".$subject."','".$cvmodule."','".$body."')";
+ $customactionsql .= " values(".$cvid.",'".$subject."','".$cvmodule."','".$body."')";
$customactionresult = $adb->query($customactionsql);
if($customactionresult == false)
{
@@ -34,21 +34,19 @@
echo $errormessage;
}
- //print_r($customactionsql);
}elseif($mode == "edit")
{
$updatecasql = "update customaction set subject='".$subject."',content='".$body."' where cvid=".$cvid;
$updatecaresult = $adb->query($updatecasql);
- if($updatecaresult == false)
+ if($updatecaresult == false)
{
include('themes/'.$theme.'/header.php');
- $errormessage = "<font color='red'><B>Error Message<ul>
- <li><font color='red'>Error while inserting the record</font>
- </ul></B></font> <br>" ;
- echo $errormessage;
+ $errormessage = "<font color='red'><B>Error Message<ul>
+ <li><font color='red'>Error while inserting the record</font>
+ </ul></B></font> <br>" ;
+ echo $errormessage;
}
- //print_r($updatecasql);
}
}
header("Location: index.php?action=index&module=$cvmodule&viewname=$cvid");
Modified: vtigercrm/trunk/modules/CustomView/SendMailAction.php
==============================================================================
--- vtigercrm/trunk/modules/CustomView/SendMailAction.php (original)
+++ vtigercrm/trunk/modules/CustomView/SendMailAction.php Mon Mar 27 22:22:35 2006
@@ -31,87 +31,86 @@
if(trim($subject) != "")
{
-if(isset($storearray) && $camodule != "")
-{
- foreach($storearray as $id)
+ if(isset($storearray) && $camodule != "")
{
- if($camodule == "Contacts")
+ foreach($storearray as $id)
{
- $sql="select * from contactdetails inner join crmentity on crmentity.crmid = contactdetails.contactid where crmentity.deleted =0 and contactdetails.contactid='" .$id ."'";
- $result = $adb->query($sql);
- $camodulerow = $adb->fetch_array($result);
- if(isset($camodulerow))
+ if($camodule == "Contacts")
{
- $emailid = $camodulerow["email"];
- $otheremailid = $camodulerow["otheremail"];
- $yahooid = $camodulerow["yahooid"];
+ $sql="select * from contactdetails inner join crmentity on crmentity.crmid = contactdetails.contactid where crmentity.deleted =0 and contactdetails.contactid='" .$id ."'";
+ $result = $adb->query($sql);
+ $camodulerow = $adb->fetch_array($result);
+ if(isset($camodulerow))
+ {
+ $emailid = $camodulerow["email"];
+ $otheremailid = $camodulerow["otheremail"];
+ $yahooid = $camodulerow["yahooid"];
- if(trim($emailid) != "")
+ if(trim($emailid) != "")
+ {
+ SendMailtoCustomView($camodule,$id,$emailid,$current_user->id,$subject,$contents);
+ }elseif(trim($otheremailid) != "")
+ {
+ SendMailtoCustomView($camodule,$id,$otheremailid,$current_user->id,$subject,$contents);
+ }elseif(trim($yahooid) != "")
+ {
+ SendMailtoCustomView($camodule,$id,$yahooid,$current_user->id,$subject,$contents);
+ }
+ else
+ {
+ $adb->println("There is no email id for this Contact. Please give any email id.");
+ }
+ }
+
+ }elseif($camodule == "Leads")
+ {
+ $sql="select * from leaddetails inner join crmentity on crmentity.crmid = leaddetails.leadid where crmentity.deleted =0 and leaddetails.leadid='" .$id ."'";
+ $result = $adb->query($sql);
+ $camodulerow = $adb->fetch_array($result);
+ if(isset($camodulerow))
{
- SendMailtoCustomView($camodule,$id,$emailid,$current_user->id,$subject,$contents);
- }elseif(trim($otheremailid) != "")
+ $emailid = $camodulerow["email"];
+ $yahooid = $camodulerow["yahooid"];
+
+ if(trim($emailid) != "")
+ {
+ SendMailtoCustomView($camodule,$id,$emailid,$current_user->id,$subject,$contents);
+ }
+ elseif($trim($yahooid) != "")
+ {
+ SendMailtoCustomView($camodule,$id,$yahooid,$current_user->id,$subject,$contents);
+ }
+ else
+ {
+ $adb->println("There is no email id for this Lead. Please give any email id.");
+ }
+ }
+ }elseif($camodule == "Accounts")
+ {
+ $sql="select * from account inner join crmentity on crmentity.crmid = account.accountid where crmentity.deleted =0 and account.accountid='" .$id ."'";
+ $result = $adb->query($sql);
+ $camodulerow = $adb->fetch_array($result);
+ if(isset($camodulerow))
{
- SendMailtoCustomView($camodule,$id,$otheremailid,$current_user->id,$subject,$contents);
- }elseif(trim($yahooid) != "")
- {
- SendMailtoCustomView($camodule,$id,$yahooid,$current_user->id,$subject,$contents);
- }
- else
- {
- $adb->println("There is no email id for this Contact. Please give any email id.");
- }
+ $emailid = $camodulerow["email1"];
+ $otheremailid = $camodulerow["email2"];
+
+ if(trim($emailid) != "")
+ {
+ SendMailtoCustomView($camodule,$id,$emailid,$current_user->id,$subject,$contents);
+ }
+ elseif(trim($otheremailid) != "")
+ {
+ SendMailtoCustomView($camodule,$id,$otheremailid,$current_user->id,$subject,$contents);
+ }
+ else
+ {
+ $adb->println("There is no email id for this Account. Please give any email id.");
+ }
+ }
}
-
- }elseif($camodule == "Leads")
- {
- $sql="select * from leaddetails inner join crmentity on crmentity.crmid = leaddetails.leadid where crmentity.deleted =0 and leaddetails.leadid='" .$id ."'";
- //echo $sql;
- $result = $adb->query($sql);
- $camodulerow = $adb->fetch_array($result);
- if(isset($camodulerow))
- {
- $emailid = $camodulerow["email"];
- $yahooid = $camodulerow["yahooid"];
-
- if(trim($emailid) != "")
- {
- SendMailtoCustomView($camodule,$id,$emailid,$current_user->id,$subject,$contents);
- }
- elseif($trim($yahooid) != "")
- {
- SendMailtoCustomView($camodule,$id,$yahooid,$current_user->id,$subject,$contents);
- }
- else
- {
- $adb->println("There is no email id for this Lead. Please give any email id.");
- }
- }
- }elseif($camodule == "Accounts")
- {
- $sql="select * from account inner join crmentity on crmentity.crmid = account.accountid where crmentity.deleted =0 and account.accountid='" .$id ."'";
- $result = $adb->query($sql);
- $camodulerow = $adb->fetch_array($result);
- if(isset($camodulerow))
- {
- $emailid = $camodulerow["email1"];
- $otheremailid = $camodulerow["email2"];
-
- if(trim($emailid) != "")
- {
- SendMailtoCustomView($camodule,$id,$emailid,$current_user->id,$subject,$contents);
- }
- elseif(trim($otheremailid) != "")
- {
- SendMailtoCustomView($camodule,$id,$otheremailid,$current_user->id,$subject,$contents);
- }
- else
- {
- $adb->println("There is no email id for this Account. Please give any email id.");
- }
- }
}
}
-}
}
function SendMailtoCustomView($module,$id,$to,$current_user_id,$subject,$contents)
@@ -119,57 +118,57 @@
require_once("modules/Emails/class.phpmailer.php");
- $mail = new PHPMailer();
+ $mail = new PHPMailer();
- $mail->Subject = $subject;
- $mail->Body = nl2br($contents);
- $mail->IsSMTP();
+ $mail->Subject = $subject;
+ $mail->Body = nl2br($contents);
+ $mail->IsSMTP();
- if($current_user_id != '')
- {
- global $adb;
- $sql = "select * from users where id= ".$current_user_id;
- $result = $adb->query($sql);
- $from = $adb->query_result($result,0,'email1');
- $initialfrom = $adb->query_result($result,0,'user_name');
- }
- if($mail_server=='')
- {
- global $adb;
- $mailserverresult=$adb->query("select * from systems where server_type='email'");
- $mail_server = $adb->query_result($mailserverresult,0,'server');
- $mail_server_username = $adb->query_result($mailserverresult,0,'server_username');
- $mail_server_password = $adb->query_result($mailserverresult,0,'server_password');
- $smtp_auth = $adb->query_result($mailserverresult,0,'smtp_auth');
+ if($current_user_id != '')
+ {
+ global $adb;
+ $sql = "select * from users where id= ".$current_user_id;
+ $result = $adb->query($sql);
+ $from = $adb->query_result($result,0,'email1');
+ $initialfrom = $adb->query_result($result,0,'user_name');
+ }
+ if($mail_server=='')
+ {
+ global $adb;
+ $mailserverresult=$adb->query("select * from systems where server_type='email'");
+ $mail_server = $adb->query_result($mailserverresult,0,'server');
+ $mail_server_username = $adb->query_result($mailserverresult,0,'server_username');
+ $mail_server_password = $adb->query_result($mailserverresult,0,'server_password');
+ $smtp_auth = $adb->query_result($mailserverresult,0,'smtp_auth');
$adb->println("Mail Server Details : '".$mail_server."','".$mail_server_username."','".$mail_server_password."'");
- $_REQUEST['server']=$mail_server;
- }
- $mail->Host = $mail_server;
- $mail->SMTPAuth = $smtp_auth;
- $mail->Username = $mail_server_username;
- $mail->Password = $mail_server_password;
- $mail->From = $from;
- $mail->FromName = $initialfrom;
+ $_REQUEST['server']=$mail_server;
+ }
+ $mail->Host = $mail_server;
+ $mail->SMTPAuth = $smtp_auth;
+ $mail->Username = $mail_server_username;
+ $mail->Password = $mail_server_password;
+ $mail->From = $from;
+ $mail->FromName = $initialfrom;
- $mail->AddAddress($to);
- $mail->AddReplyTo($from);
- $mail->WordWrap = 50;
+ $mail->AddAddress($to);
+ $mail->AddReplyTo($from);
+ $mail->WordWrap = 50;
- $mail->IsHTML(true);
+ $mail->IsHTML(true);
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
$adb->println("Mail sending process : To => '".$to."', From => '".$from."'");
- if(!$mail->Send())
- {
+ if(!$mail->Send())
+ {
$adb->println("(CustomView/SendMailAction.php) Error in Mail Sending : ".$mail->ErrorInfo);
- $errormsg = "Mail Could not be sent...";
- }
+ $errormsg = "Mail Could not be sent...";
+ }
else
{
$adb->println("(CustomView/SendMailAction.php) Mail has been Sent to => ".$to);
}
-
+
}
header("Location: index.php?action=index&module=$camodule&viewname=$viewid");
?>
More information about the vtigercrm-commits
mailing list