[Vtigercrm-commits] [vtiger-commits] r4331 - in /vtigercrm/branches/4.2_postgresql_integration: ./ data/ include/ include/database/ modules/Accounts/ modules/Activities/ modules/Calendar/ modules/Contacts/ modules/CustomView/ modules/Emails/ modules/Faq/ modules/HelpDesk/ modules/Home/ modules/Invoice/ modules/Leads/ modules/Meetings/ modules/Notes/ modules/Orders/ modules/Potentials/ modules/Products/ modules/Quotes/ modules/Reports/ modules/Settings/ modules/Users/ schema/
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon Mar 20 06:01:22 EST 2006
Author: allanbush
Date: Mon Mar 20 04:00:52 2006
New Revision: 4331
Log:
Merged postgres patch created against 4.2.1 (see http://forums.vtiger.com/viewtopic.php?t=2597).
Also added a few fixes for some obvious errors on the first couple pages.
References ticket:17.
Modified:
vtigercrm/branches/4.2_postgresql_integration/contactserialize.php
vtigercrm/branches/4.2_postgresql_integration/data/CRMEntity.php
vtigercrm/branches/4.2_postgresql_integration/data/SugarBean.php
vtigercrm/branches/4.2_postgresql_integration/include/PopulateComboValues.php
vtigercrm/branches/4.2_postgresql_integration/include/RelatedListView.php
vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php
vtigercrm/branches/4.2_postgresql_integration/include/utils.php
vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Account.php
vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/AccountFormBase.php
vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListViewTop.php
vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup.php
vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup_picker.php
vtigercrm/branches/4.2_postgresql_integration/modules/Activities/Activity.php
vtigercrm/branches/4.2_postgresql_integration/modules/Activities/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Activities/OpenListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Activities/RenderRelatedListUI.php
vtigercrm/branches/4.2_postgresql_integration/modules/Calendar/appointment.pinc
vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Contact.php
vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Popup.php
vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/CustomView.php
vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/Save.php
vtigercrm/branches/4.2_postgresql_integration/modules/Emails/Email.php
vtigercrm/branches/4.2_postgresql_integration/modules/Emails/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Faq/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/FaqList.php
vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/HelpDesk.php
vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Home/UnifiedSearch.php
vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/Invoice.php
vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Lead.php
vtigercrm/branches/4.2_postgresql_integration/modules/Leads/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Popup.php
vtigercrm/branches/4.2_postgresql_integration/modules/Meetings/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Notes/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Orders/DeleteSalesOrder.php
vtigercrm/branches/4.2_postgresql_integration/modules/Orders/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Orders/Order.php
vtigercrm/branches/4.2_postgresql_integration/modules/Orders/PopupSalesOrder.php
vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrder.php
vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrderListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Opportunity.php
vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Popup.php
vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/updateRelations.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/AddProductsToPriceBook.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/Popup.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/PriceBookListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorPopup.php
vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/CreatePDF.php
vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Delete.php
vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Popup.php
vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Quote.php
vtigercrm/branches/4.2_postgresql_integration/modules/Reports/PopulateReports.php
vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php
vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Reports.php
vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php
vtigercrm/branches/4.2_postgresql_integration/modules/Settings/DeleteCustomField.php
vtigercrm/branches/4.2_postgresql_integration/modules/Settings/UpdateComboValues.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/ListView.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/LoginHistory.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveProfile.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveRole.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/Security.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/User.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/UserInfoUtil.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/massdelete.php
vtigercrm/branches/4.2_postgresql_integration/modules/Users/saveemailtemplate.php
vtigercrm/branches/4.2_postgresql_integration/schema/DatabaseSchema.xml
vtigercrm/branches/4.2_postgresql_integration/soap.php
Modified: vtigercrm/branches/4.2_postgresql_integration/contactserialize.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/contactserialize.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/contactserialize.php Mon Mar 20 04:00:52 2006
@@ -1189,9 +1189,10 @@
function add_contacts_matching_email_address(&$output_list, $email_address, &$seed_contact)
{
//global $log;
+ global $adb;
$safe_email_address = addslashes($email_address);
- $where = "email1 like '$safe_email_address' OR email2 like '$safe_email_address'";
+ $where = "email1 ".$adb->getLike()." '$safe_email_address' OR email2 ".$adb->getLike()." '$safe_email_address'";
$response = $seed_contact->get_list("first_name,last_name,primary_address_city", $where, 0);
$contactList = $response['list'];
@@ -1306,8 +1307,9 @@
function contact_by_search($name)
{
// global $log;
+ global $adb;
$seed_contact = new Contact();
- $where = "first_name like '$name%' OR last_name like '$name%' OR email1 like '$name%' OR email2 like '$name%'";
+ $where = "first_name ".$adb->getLike()." '$name%' OR last_name ".$adb->getLike()." '$name%' OR email1 ".$adb->getLike()." '$name%' OR email2 ".$adb->getLike()." '$name%'";
$response = $seed_contact->get_list("first_name, last_name", $where, 0);
$contactList = $response['list'];
//$row_count = $response['row_count'];
@@ -1661,6 +1663,7 @@
function retrievereportsto($reports_to,$user_id,$account_id)
{
+ global $adb;
if($reports_to=="")
{
return null;
@@ -1695,7 +1698,7 @@
// to do handle smartly handle the manager name
- $query = "select contactdetails.contactid as contactid from contactdetails inner join crmentity on crmentity.crmid=contactdetails.contactid where crmentity.deleted=0 and contactdetails.firstname like '".$first_name ."' and contactdetails.lastname like '" .$last_name ."'";
+ $query = "select contactdetails.contactid as contactid from contactdetails inner join crmentity on crmentity.crmid=contactdetails.contactid where crmentity.deleted=0 and contactdetails.firstname ".$adb->getLike()." '".$first_name ."' and contactdetails.lastname ".$adb->getLike()." '" .$last_name ."'";
@@ -1972,8 +1975,9 @@
function retrieve_task($name)
{
// global $log;
+ global $adb;
$task = new Task();
- $where = "name like '$name%'";
+ $where = "name ".$adb->getLike()." '$name%'";
$response = $task->get_list("name", $where, 0);
$taskList = $response['list'];
$output_list = Array();
@@ -2218,8 +2222,9 @@
function retrieve_calendar($name)
{
+ global $adb;
$task = new Task();
- $where = "name like '$name%'";
+ $where = "name ".$adb->getLike()." '$name%'";
$response = $task->get_list("name", $where, 0);
$taskList = $response['list'];
$output_list = Array();
Modified: vtigercrm/branches/4.2_postgresql_integration/data/CRMEntity.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/data/CRMEntity.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/data/CRMEntity.php Mon Mar 20 04:00:52 2006
@@ -130,11 +130,11 @@
function insertIntoAttachment1($id,$module,$filedata,$filename,$filesize,$filetype,$user_id)
{
- $date_var = date('YmdHis');
// global $current_user;
global $adb;
//global $root_directory;
global $vtlog;
+ $date_var = $adb->database->DBTimeStamp(date('YmdHis'));
$ownerid = $user_id;
@@ -156,7 +156,7 @@
$sql="update ".$tablename." set filename='".$filename."' where ".$idname."=".$id;
$adb->query($sql);
- $sql1 = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','"."',".$adb->formatString("crmentity","createdtime",$date_var).",".$adb->formatString("crmentity","modifiedtime",$date_var).")";
+ $sql1 = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','"."',".$date_var.",".$date_var.")";
$adb->query($sql1);
//$this->id = $current_id;
@@ -176,7 +176,7 @@
function insertIntoAttachment($id,$module)
{
- $date_var = date('YmdHis');
+ $date_var = $adb->database->DBTimeStamp(date('YmdHis'));
global $current_user;
global $adb;
global $root_directory;
@@ -226,7 +226,7 @@
$sql="update ".$tablename." set filename='".$filename."' where ".$idname."=".$id;
$adb->query($sql);
- $sql1 = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','".$this->column_fields['description']."',".$adb->formatString("crmentity","createdtime",$date_var).",".$adb->formatString("crmentity","modifiedtime",$date_var).")";
+ $sql1 = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','".$this->column_fields['description']."',".$date_var.",".$date_var.")";
$adb->query($sql1);
//$this->id = $current_id;
@@ -261,7 +261,7 @@
global $current_user;
global $vtlog;
- $date_var = date('YmdHis');
+ $date_var = $adb->database->DBTimeStamp(date('YmdHis'));
if($_REQUEST['assigntype'] == 'T')
{
$ownerid= 0;
@@ -272,7 +272,7 @@
}
//This check is done for products.
- if($module == 'Products' || $module == 'Notes' || $module =='Faq')
+ if($module == 'Products' || $module == 'Notes' || $module =='Faq' || $module == 'PriceBook' || $module == 'Vendor' || $module == 'Emails')
{
$vtlog->logthis("module is =".$module,'info');
$ownerid = $current_user->id;
@@ -284,7 +284,7 @@
if($this->mode == 'edit')
{
$description_val = from_html($adb->formatString("crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
- $sql = "update crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.",description=".$description_val.", modifiedtime=".$adb->formatString("crmentity","modifiedtime",$date_var)." where crmid=".$this->id;
+ $sql = "update crmentity set smownerid=".$ownerid.",modifiedby=".$current_user->id.",description=".$description_val.", modifiedtime=".$date_var." where crmid=".$this->id;
$adb->query($sql);
}
@@ -325,7 +325,7 @@
else
{
$description_val = from_html($adb->formatString("crmentity","description",$this->column_fields['description']),($insertion_mode == 'edit')?true:false);
- $sql = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values('".$current_id."','".$current_user->id."','".$ownerid."','".$module."',".$description_val.",'".$date_var."','".$date_var."')";
+ $sql = "insert into crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values('".$current_id."','".$current_user->id."','".$ownerid."','".$module."',".$description_val.",".$date_var.",".$date_var.")";
$adb->query($sql);
$this->id = $current_id;
}
@@ -486,7 +486,7 @@
{
$fldvalue = '';
}
- if($fldvalue=='') $fldvalue ="''";
+ if($fldvalue=='') $fldvalue ="null";
if($insertion_mode == 'edit')
{
//code by shankar starts
@@ -611,9 +611,10 @@
$sales_stage = $adb->query_result($adb->query($dbquery),0,'sales_stage');
if($sales_stage != $_REQUEST['sales_stage'])
{
- $date_var = date('YmdHis');
+ $date_var = $adb->database->DBTimeStamp(date('YmdHis'));
//$sql = "insert into potstagehistory values('',".$this->id.",".$_REQUEST['amount'].",'".$_REQUEST['sales_stage']."',".$_REQUEST['probability'].",".$_REQUEST['expectedrevenue'].",".$adb->formatString("potstagehistory","closedate",$_REQUEST['closingdate']).",".$adb->formatString("potstagehistory","lastmodified",$date_var).")";
- $sql = "insert into potstagehistory values('',".$this->id.",'".$_REQUEST['amount']."','".$sales_stage."','".$_REQUEST['probability']."',0,".$adb->formatString("potstagehistory","closedate",$_REQUEST['closingdate']).",".$adb->formatString("potstagehistory","lastmodified",$date_var).")";
+ $id = $adb->getUniqueID('potstagehistory');
+ $sql = "insert into potstagehistory values($id,".$this->id.",'".$_REQUEST['amount']."','".$sales_stage."','".$_REQUEST['probability']."',0,".$adb->formatString("potstagehistory","closedate",$_REQUEST['closingdate']).",".$date_var.")";
$adb->query($sql);
}
}
@@ -814,7 +815,7 @@
{
$activity_id=$this->id;
- $sql='select min(recurringdate) min_date,max(recurringdate) max_date,recurringtype from recurringevents where activityid='. $activity_id.' group by activityid';
+ $sql='select min(recurringdate) AS min_date, max(recurringdate) AS max_date, recurringtype from recurringevents where activityid='. $activity_id.' group by activityid, recurringtype';
$result = $adb->query($sql);
$noofrows = $adb->num_rows($result);
@@ -883,7 +884,7 @@
$tdate=$date_array[$k];
if($tdate <= $end_date)
{
- $max_recurid_qry = 'select max(recurringid) recurid from recurringevents;';
+ $max_recurid_qry = 'select max(recurringid) AS recurid from recurringevents;';
$result = $adb->query($max_recurid_qry);
$noofrows = $adb->num_rows($result);
for($i=0; $i<$noofrows; $i++)
@@ -891,7 +892,7 @@
$recur_id = $adb->query_result($result,$i,"recurid");
}
$current_id =$recur_id+1;
- $recurring_insert = 'insert into recurringevents values ("'.$current_id.'","'.$this->id.'","'.$tdate.'","'.$type.'")';
+ $recurring_insert = "insert into recurringevents values (".$adb->quote($current_id).','.$adb->quote($this->id).','.$adb->quote($tdate).','.$adb->quote($type).')';
$adb->query($recurring_insert);
if($_REQUEST['set_reminder'] == 'Yes')
{
Modified: vtigercrm/branches/4.2_postgresql_integration/data/SugarBean.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/data/SugarBean.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/data/SugarBean.php Mon Mar 20 04:00:52 2006
@@ -185,6 +185,7 @@
if ($id == -1) {
$id = $this->id;
}
+ if('' == $id) return null;
// GS porting crmentity
$query = "SELECT * FROM $this->table_name WHERE $this->module_id = '$id'";
// $query = "SELECT * FROM $this->table_name WHERE ID = '$id'";
Modified: vtigercrm/branches/4.2_postgresql_integration/include/PopulateComboValues.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/include/PopulateComboValues.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/include/PopulateComboValues.php Mon Mar 20 04:00:52 2006
@@ -28,13 +28,14 @@
$i=0;
foreach ($values as $val => $cal)
{
+ $id = $adb->getUniqueID($tableName); // horrible assumption on the name of the sequence for this table
if($val != '')
{
- $adb->query("insert into ".$tableName. " values('','".$val."',".$i.",1)");
+ $adb->query("insert into ".$tableName. " values($id,'".$val."',".$i.",1)");
}
else
{
- $adb->query("insert into ".$tableName. " values('','--None--',".$i.",1)");
+ $adb->query("insert into ".$tableName. " values($id,'--None--',".$i.",1)");
}
$i++;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/include/RelatedListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/include/RelatedListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/include/RelatedListView.php Mon Mar 20 04:00:52 2006
@@ -78,7 +78,8 @@
}
//Appending the group by for Jaguar/Don
-if($relatedmodule == 'Activities')
+// group by won't work this way in postgres
+if($relatedmodule == 'Activities' && !$adb->isPostgres())
{
$query .= ' group by crmentity.crmid';
}
Modified: vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/include/database/PearDatabase.php Mon Mar 20 04:00:52 2006
@@ -35,8 +35,9 @@
var $lastmysqlrow = -1;
var $enableSQLlog = false;
- function isMySQL() { return dbType=='mysql'; }
- function isOracle() { return dbType=='oci8'; }
+ function isMySQL() { return $this->dbType=='mysql'; }
+ function isOracle() { return $this->dbType=='oci8'; }
+ function isPostgres() { return $this->dbType=='pgsql'; }
function println($msg)
{
@@ -59,8 +60,9 @@
function setDatabaseType($type){
$this->dbType = $type;
- }
-
+ $this->like = $this->isPostgres() ? 'ilike' : 'like';
+ }
+
function setUserName($name){
$this->userName = $name;
}
@@ -86,6 +88,10 @@
function getDataSourceName(){
return $this->dbType. "://".$this->userName.":".$this->userPassword."@". $this->dbHostName . "/". $this->dbName;
+ }
+
+ function getLike(){
+ return $this->like;
}
function startTransaction()
@@ -663,9 +669,9 @@
}
$this->database = ADONewConnection($this->dbType);
- //$this->database->debug = true;
-
- $this->database->PConnect($this->dbHostName, $this->userName, $this->userPassword, $this->dbName);
+ $this->database->debug = true;
+
+ $this->database->Connect($this->dbHostName, $this->userName, $this->userPassword, $this->dbName);
$this->database->LogSQL($this->enableSQLlog);
//$this->database->SetFetchMode(ADODB_FETCH_ASSOC);
//$this->println("ADODB type=".$this->dbType." host=".$this->dbHostName." dbname=".$this->dbName." user=".$this->userName." password=".$this->userPassword);
Modified: vtigercrm/branches/4.2_postgresql_integration/include/utils.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/include/utils.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/include/utils.php Mon Mar 20 04:00:52 2006
@@ -397,6 +397,8 @@
*/
function append_where_clause(&$where_clauses, $variable_name, $SQL_name = null)
{
+ global $adb;
+
if($SQL_name == null)
{
$SQL_name = $variable_name;
@@ -404,7 +406,7 @@
if(isset($_REQUEST[$variable_name]) && $_REQUEST[$variable_name] != "")
{
- array_push($where_clauses, "$SQL_name like '$_REQUEST[$variable_name]%'");
+ array_push($where_clauses, "$SQL_name ".$adb->getLike()." '$_REQUEST[$variable_name]%'");
}
}
@@ -2412,13 +2414,15 @@
global $adb;
$column_fld = Array();
$tabid = getTabid($module);
- $sql = "select * from field where tabid=".$tabid;
- $result = $adb->query($sql);
- $noofrows = $adb->num_rows($result);
- for($i=0; $i<$noofrows; $i++)
- {
- $fieldname = $adb->query_result($result,$i,"fieldname");
- $column_fld[$fieldname] = '';
+ if($tabid) {
+ $sql = "select * from field where tabid=".$tabid;
+ $result = $adb->query($sql);
+ $noofrows = $adb->num_rows($result);
+ for($i=0; $i<$noofrows; $i++)
+ {
+ $fieldname = $adb->query_result($result,$i,"fieldname");
+ $column_fld[$fieldname] = '';
+ }
}
return $column_fld;
}
@@ -3146,8 +3150,10 @@
elseif($module == 'Quotes' && $name == 'Potential Name')
{
$potential_id = $adb->query_result($list_result,$i-1,"potentialid");
- $potential_name = getPotentialName($potential_id);
- $value = '<a href="index.php?module=Potentials&action=DetailView&record='.$potential_id.'">'.$potential_name.'</a>';
+ if('' != $potential_id) {
+ $potential_name = getPotentialName($potential_id);
+ $value = '<a href="index.php?module=Potentials&action=DetailView&record='.$potential_id.'">'.$potential_name.'</a>';
+ }
}
elseif($owner_id == 0 && $name == 'Assigned To')
{
@@ -3748,8 +3754,12 @@
}
-function getListQuery($module,$where='')
-{
+function getListQuery($module,$where='',$distincton='')
+{
+ if($distincton) {
+ $distincton = "DISTINCT ON ($distincton)";
+ }
+
if($module == "HelpDesk")
{
$query = "select crmentity.crmid,troubletickets.title,troubletickets.status,troubletickets.priority,crmentity.smownerid, contactdetails.contactid, troubletickets.parent_id, contactdetails.firstname, contactdetails.lastname, account.accountid, account.accountname, ticketcf.* from troubletickets inner join ticketcf on ticketcf.ticketid = troubletickets.ticketid inner join crmentity on crmentity.crmid=troubletickets.ticketid left join contactdetails on troubletickets.parent_id=contactdetails.contactid left join account on account.accountid=troubletickets.parent_id left join users on crmentity.smownerid=users.id and troubletickets.ticketid = ticketcf.ticketid where crmentity.deleted=0";
@@ -3777,7 +3787,7 @@
}
if($module == "Notes")
{
- $query="select crmentity.crmid, notes.title, notes.contact_id, notes.filename, crmentity.modifiedtime,senotesrel.crmid as relatedto, contactdetails.firstname, contactdetails.lastname, notes.* from notes inner join crmentity on crmentity.crmid=notes.notesid left join senotesrel on senotesrel.notesid=notes.notesid left join contactdetails on contactdetails.contactid = notes.contact_id where crmentity.deleted=0";
+ $query="select $distincton crmentity.crmid, notes.title, notes.contact_id, notes.filename, crmentity.modifiedtime,senotesrel.crmid as relatedto, contactdetails.firstname, contactdetails.lastname, notes.* from notes inner join crmentity on crmentity.crmid=notes.notesid left join senotesrel on senotesrel.notesid=notes.notesid left join contactdetails on contactdetails.contactid = notes.contact_id where crmentity.deleted=0";
}
if($module == "Calls")
{
@@ -3785,7 +3795,22 @@
}
if($module == "Contacts")
{
- $query = "select crmentity.crmid, crmentity.smownerid, contactdetails.*, contactaddress.*, contactsubdetails.*, contactscf.*, account.accountname from contactdetails, contactaddress, contactsubdetails, contactscf inner join crmentity on crmentity.crmid=contactdetails.contactid and contactdetails.contactid=contactaddress.contactaddressid and contactdetails.contactid = contactscf.contactid and contactaddress.contactaddressid=contactsubdetails.contactsubscriptionid left join account on account.accountid = contactdetails.accountid where crmentity.deleted=0";
+ $query = "SELECT crmentity.crmid, crmentity.smownerid,
+ contactdetails.*, contactaddress.*,
+ contactsubdetails.*, contactscf.*,
+ account.accountname
+ from contactdetails
+ INNER JOIN contactaddress
+ ON contactdetails.contactid=contactaddress.contactaddressid
+ INNER JOIN contactsubdetails
+ ON contactaddress.contactaddressid=contactsubdetails.contactsubscriptionid
+ INNER JOIN contactscf
+ ON contactdetails.contactid = contactscf.contactid
+ INNER JOIN crmentity
+ ON crmentity.crmid=contactdetails.contactid
+ LEFT JOIN account
+ ON account.accountid = contactdetails.accountid
+ WHERE crmentity.deleted=0";
//$query = "select crmentity.crmid, crmentity.smownerid, contactdetails.*, contactaddress.*, contactsubdetails.*, contactscf.*, account.accountname from contactdetails, contactaddress, contactsubdetails, contactscf,crmentity,account where crmentity.crmid=contactdetails.contactid and contactdetails.contactid=contactaddress.contactaddressid and contactdetails.contactid = contactscf.contactid and contactaddress.contactaddressid=contactsubdetails.contactsubscriptionid and account.accountid = contactdetails.accountid and crmentity.deleted=0";
}
if($module == "Meetings")
@@ -3794,7 +3819,7 @@
}
if($module == "Activities")
{
- $query = " select crmentity.crmid,crmentity.smownerid,crmentity.setype, activity.*, contactdetails.lastname, contactdetails.firstname, contactdetails.contactid, account.accountid, account.accountname, recurringevents.recurringtype from activity inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid= cntactivityrel.contactid left join seactivityrel on seactivityrel.activityid = activity.activityid left outer join account on account.accountid = contactdetails.accountid left outer join recurringevents on recurringevents.activityid=activity.activityid WHERE crmentity.deleted=0 and (activity.activitytype = 'Meeting' or activity.activitytype='Call' or activity.activitytype='Task') ".$where ;
+ $query = " select $distincton crmentity.crmid,crmentity.smownerid,crmentity.setype, activity.*, contactdetails.lastname, contactdetails.firstname, contactdetails.contactid, account.accountid, account.accountname, recurringevents.recurringtype from activity inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid= cntactivityrel.contactid left join seactivityrel on seactivityrel.activityid = activity.activityid left outer join account on account.accountid = contactdetails.accountid left outer join recurringevents on recurringevents.activityid=activity.activityid WHERE crmentity.deleted=0 and (activity.activitytype = 'Meeting' or activity.activitytype='Call' or activity.activitytype='Task') ".$where ;
//included by Jaguar
}
if($module == "Emails")
@@ -4201,7 +4226,11 @@
}
//echo $display_date;
- $insert_date=$y.'-'.$m.'-'.$d;
+ if(!$y && !$m && !$d) {
+ $insert_date = '';
+ } else {
+ $insert_date=$y.'-'.$m.'-'.$d;
+ }
return $insert_date;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Account.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Account.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Account.php Mon Mar 20 04:00:52 2006
@@ -230,7 +230,7 @@
{
// First, get the list of IDs.
// $query = "SELECT activity.subject,semodule,activitytype,date_start,status,priority from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid where seactivityrel.crmid=".$id;
- $query = "SELECT activity.*,seactivityrel.*, contactdetails.contactid,contactdetails.lastname, contactdetails.firstname, crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name,recurringevents.recurringtype from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid= cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and crmentity.deleted=0 and ( activity.status is NULL || activity.status != 'Completed' ) and ( activity.eventstatus is NULL || activity.eventstatus != 'Held')";
+ $query = "SELECT activity.*,seactivityrel.*, contactdetails.contactid,contactdetails.lastname, contactdetails.firstname, crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name,recurringevents.recurringtype from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid= cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and crmentity.deleted=0 and ( activity.status is NULL OR activity.status != 'Completed' ) and ( activity.eventstatus is NULL OR activity.eventstatus != 'Held')";
renderRelatedTasks($query,$id); //Query Changed by Jaguar
//return $this->build_related_list($query, new Task());
@@ -293,9 +293,9 @@
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType, crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType, crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
function get_quotes($id)
@@ -547,14 +547,15 @@
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause ($the_query_string) {
+ global $adb;
$where_clauses = Array();
$the_query_string = addslashes($the_query_string);
- array_push($where_clauses, "accountname like '$the_query_string%'");
+ array_push($where_clauses, "accountname ".$adb->getLike()." '$the_query_string%'");
if (is_numeric($the_query_string)) {
- array_push($where_clauses, "otherphone like '%$the_query_string%'");
- array_push($where_clauses, "fax like '%$the_query_string%'");
- array_push($where_clauses, "phone like '%$the_query_string%'");
+ array_push($where_clauses, "otherphone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "fax ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "phone ".$adb->getLike()." '%$the_query_string%'");
}
$the_where = "";
@@ -623,8 +624,8 @@
{
$query = $this->constructCustomQueryAddendum() . ",
- account.*, ".$this->entity_table.".*, accountbillads.city billing_city, accountbillads.country billing_country, accountbillads.code billing_code, accountbillads.state billing_state, accountbillads.street billing_street, accountshipads.city shipping_city, accountshipads.country shipping_country, accountshipads.code shipping_code, accountshipads.state shipping_state, accountshipads.street shipping_street,
- users.user_name, users.status user_status
+ account.*, ".$this->entity_table.".*, accountbillads.city AS billing_city, accountbillads.country AS billing_country, accountbillads.code AS billing_code, accountbillads.state AS billing_state, accountbillads.street AS billing_street, accountshipads.city AS shipping_city, accountshipads.country AS shipping_country, accountshipads.code AS shipping_code, accountshipads.state AS shipping_state, AS accountshipads.street AS shipping_street,
+ users.user_name, users.status AS user_status
FROM ".$this->entity_table."
INNER JOIN account
ON crmentity.crmid=account.accountid
@@ -641,8 +642,8 @@
else
{
$query = "SELECT
- account.*, ".$this->entity_table.".*, accountbillads.city billing_city, accountbillads.country billing_country, accountbillads.code billing_code, accountbillads.state billing_state, accountbillads.street billing_street, accountshipads.city shipping_city, accountshipads.country shipping_country, accountshipads.code shipping_code, accountshipads.state shipping_state, accountshipads.street shipping_street,
- users.user_name, users.status user_status
+ account.*, ".$this->entity_table.".*, accountbillads.city AS billing_city, accountbillads.country AS billing_country, accountbillads.code AS billing_code, accountbillads.state AS billing_state, accountbillads.street AS billing_street, accountshipads.city AS shipping_city, accountshipads.country AS shipping_country, accountshipads.code AS shipping_code, accountshipads.state AS shipping_state, accountshipads.street AS shipping_street,
+ users.user_name, users.status AS user_status
FROM ".$this->entity_table."
INNER JOIN account
ON crmentity.crmid=account.accountid
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/AccountFormBase.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/AccountFormBase.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/AccountFormBase.php Mon Mar 20 04:00:52 2006
@@ -26,6 +26,7 @@
function checkForDuplicates($prefix){
require_once('include/formbase.php');
require_once('modules/Accounts/Account.php');
+ global $adb;
$focus = new Account();
if(!checkRequired($prefix, array_keys($focus->required_fields))){
return null;
@@ -33,15 +34,15 @@
$query = '';
$baseQuery = 'select id, name, website, billing_address_city from accounts where deleted!=1 and (';
if(isset($_POST[$prefix.'name']) && !empty($_POST[$prefix.'name'])){
- $query = $baseQuery ." name like ".PearDatabase::quote('%'.$_POST[$prefix.'name'].'%');
- //$query = $baseQuery ." name like '%".PearDatabase::quote($_POST[$prefix.'name'])."%'";
+ $query = $baseQuery ." name ".$adb->getLike()." ".PearDatabase::quote('%'.$_POST[$prefix.'name'].'%');
+ //$query = $baseQuery ." name ".$adb->getLike()." '%".PearDatabase::quote($_POST[$prefix.'name'])."%'";
}
if(isset($_POST[$prefix.'website']) && !empty($_POST[$prefix.'website'])){
if(empty($query)){
- // $query = $baseQuery ." website like '".PearDatabase::quote($_POST[$prefix.'website'])."%'";
- $query = $baseQuery ." website like ".PearDatabase::quote($_POST[$prefix.'website'].'%');
+ // $query = $baseQuery ." website ".$adb->getLike()." '".PearDatabase::quote($_POST[$prefix.'website'])."%'";
+ $query = $baseQuery ." website ".$adb->getLike()." ".PearDatabase::quote($_POST[$prefix.'website'].'%');
}else {
- $query .= "or website like '".$_POST[$prefix.'website']."%'";
+ $query .= "or website ".$adb->getLike()." '".$_POST[$prefix.'website']."%'";
}
}
if(!empty($query)){
@@ -201,4 +202,4 @@
}
}
-?>
+?>
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListView.php Mon Mar 20 04:00:52 2006
@@ -95,7 +95,7 @@
if($uitype[$i] == 56)
$str=" accountscf.".$column[$i]." = 1";
else
- $str=" accountscf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" accountscf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -104,57 +104,57 @@
if(isset($name) && $name != "")
{
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote($name."%"));
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote($name."%"));
$url_string .= "&accountname=".$name;
}
if(isset($website) && $website != "")
{
- array_push($where_clauses, "account.website like ".PearDatabase::quote("%".$website."%"));
+ array_push($where_clauses, "account.website ".$adb->getLike()." ".PearDatabase::quote("%".$website."%"));
$url_string .= "&website=".$website;
}
if(isset($phone) && $phone != "")
{
- array_push($where_clauses, "(account.phone like ".PearDatabase::quote("%".$phone."%")." OR account.otherphone like ".PearDatabase::quote("%".$phone."%")." OR account.fax like ".PearDatabase::quote("%".$phone."%").")");
+ array_push($where_clauses, "(account.phone ".$adb->getLike()." ".PearDatabase::quote("%".$phone."%")." OR account.otherphone ".$adb->getLike()." ".PearDatabase::quote("%".$phone."%")." OR account.fax ".$adb->getLike()." ".PearDatabase::quote("%".$phone."%").")");
$url_string .= "&phone=".$phone;
}
if(isset($annual_revenue) && $annual_revenue != "")
{
- array_push($where_clauses, "account.annualrevenue like ".PearDatabase::quote($annual_revenue."%"));
+ array_push($where_clauses, "account.annualrevenue ".$adb->getLike()." ".PearDatabase::quote($annual_revenue."%"));
$url_string .= "&annual_revenue=".$annual_revenue;
}
if(isset($employees) && $employees != "")
{
- array_push($where_clauses, "account.employees like ".PearDatabase::quote($employees."%"));
+ array_push($where_clauses, "account.employees ".$adb->getLike()." ".PearDatabase::quote($employees."%"));
$url_string .= "&employees=".$employees;
}
if(isset($address_street) && $address_street != "")
{
- array_push($where_clauses, "(accountbillads.street like ".PearDatabase::quote($address_street."%")." OR accountshipads.street like ".PearDatabase::quote($address_street."%").")");
+ array_push($where_clauses, "(accountbillads.street ".$adb->getLike()." ".PearDatabase::quote($address_street."%")." OR accountshipads.street ".$adb->getLike()." ".PearDatabase::quote($address_street."%").")");
$url_string .= "&address_street=".$address_street;
}
if(isset($address_city) && $address_city != "")
{
- array_push($where_clauses, "(accountbillads.city like ".PearDatabase::quote($address_city."%")." OR accountshipads.city like ".PearDatabase::quote($address_city."%").")");
+ array_push($where_clauses, "(accountbillads.city ".$adb->getLike()." ".PearDatabase::quote($address_city."%")." OR accountshipads.city ".$adb->getLike()." ".PearDatabase::quote($address_city."%").")");
$url_string .= "&bill_city=".$address_city;
}
if(isset($address_state) && $address_state != "")
{
- array_push($where_clauses, "(accountbillads.state like ".PearDatabase::quote($address_state."%")." OR accountshipads.state like ".PearDatabase::quote($address_state."%").")");
+ array_push($where_clauses, "(accountbillads.state ".$adb->getLike()." ".PearDatabase::quote($address_state."%")." OR accountshipads.state ".$adb->getLike()." ".PearDatabase::quote($address_state."%").")");
$url_string .= "&bill_state=".$address_state;
}
if(isset($address_postalcode) && $address_postalcode != "")
{
- array_push($where_clauses, "(accountbillads.code like ".PearDatabase::quote($address_postalcode."%")." OR accountshipads.code like ".PearDatabase::quote($address_postalcode."%").")");
+ array_push($where_clauses, "(accountbillads.code ".$adb->getLike()." ".PearDatabase::quote($address_postalcode."%")." OR accountshipads.code ".$adb->getLike()." ".PearDatabase::quote($address_postalcode."%").")");
$url_string .= "&bill_code=".$address_postalcode;
}
if(isset($address_country) && $address_country != "")
{
- array_push($where_clauses, "(accountbillads.country like ".PearDatabase::quote($address_country."%")." OR accountshipads.country like ".PearDatabase::quote($address_country."%").")");
+ array_push($where_clauses, "(accountbillads.country ".$adb->getLike()." ".PearDatabase::quote($address_country."%")." OR accountshipads.country ".$adb->getLike()." ".PearDatabase::quote($address_country."%").")");
$url_string .= "&bill_country=".$address_country;
}
if(isset($email) && $email != "")
{
- array_push($where_clauses, "(account.email1 like ".PearDatabase::quote($email."%")." OR account.email2 like ".PearDatabase::quote($email."%").")");
+ array_push($where_clauses, "(account.email1 ".$adb->getLike()." ".PearDatabase::quote($email."%")." OR account.email2 ".$adb->getLike()." ".PearDatabase::quote($email."%").")");
$url_string .= "&email=".$email;
}
if(isset($industry) && $industry != "")
@@ -164,18 +164,18 @@
}
if(isset($ownership) && $ownership != "")
{
- array_push($where_clauses, "account.ownership like ".PearDatabase::quote($ownership."%"));
+ array_push($where_clauses, "account.ownership ".$adb->getLike()." ".PearDatabase::quote($ownership."%"));
$url_string .= "&ownership=".$ownership;
}
- if(isset($rating) && $rating != "") array_push($where_clauses, "account.rating like ".PearDatabase::quote($rating."%"));
+ if(isset($rating) && $rating != "") array_push($where_clauses, "account.rating ".$adb->getLike()." ".PearDatabase::quote($rating."%"));
if(isset($sic_code) && $sic_code != "")
{
- array_push($where_clauses, "account.siccode like ".PearDatabase::quote($sic_code."%"));
+ array_push($where_clauses, "account.siccode ".$adb->getLike()." ".PearDatabase::quote($sic_code."%"));
$url_string .= "&siccode=".$sic_code;
}
if(isset($ticker_symbol) && $ticker_symbol != "")
{
- array_push($where_clauses, "account.tickersymbol like ".PearDatabase::quote($ticker_symbol."%"));
+ array_push($where_clauses, "account.tickersymbol ".$adb->getLike()." ".PearDatabase::quote($ticker_symbol."%"));
$url_string .= "&tickersymbol=".$ticker_symbol;
}
if(isset($account_type) && $account_type != "")
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListViewTop.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListViewTop.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/ListViewTop.php Mon Mar 20 04:00:52 2006
@@ -29,7 +29,7 @@
$current_module_strings = return_module_language($current_language, "Accounts");
$log = LoggerManager::getLogger('top accounts_list');
-$list_query = 'select account.accountid, account.accountname, sum(potential.amount) as amount from potential inner join crmentity on (potential.potentialid=crmentity.crmid) inner join account on (potential.accountid=account.accountid) where crmentity.deleted=0 AND crmentity.smownerid="'.$current_user->id.'" and potential.sales_stage <> "'.$app_strings['LBL_CLOSE_WON'].'" and potential.sales_stage <> "'.$app_strings['LBL_CLOSE_LOST'].'" group by account.accountname order by 3 desc;';
+$list_query = "select account.accountid, account.accountname, sum(potential.amount) as amount from potential inner join crmentity on (potential.potentialid=crmentity.crmid) inner join account on (potential.accountid=account.accountid) where crmentity.deleted=0 AND crmentity.smownerid='".$current_user->id."' and potential.sales_stage <> '".$app_strings['LBL_CLOSE_WON']."' and potential.sales_stage <> '".$app_strings['LBL_CLOSE_LOST']."' group by account.accountname, account.accountid order by 3 desc;";
$list_result=$adb->query($list_query);
$open_accounts_list = array();
$noofrows = min($adb->num_rows($list_result),7);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup.php Mon Mar 20 04:00:52 2006
@@ -82,23 +82,23 @@
if(isset($customfield[$i]) && $customfield[$i] != '')
{
- $str=" accountcf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" accountcf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
}
}
//upto this added for Custom Field
*/
if(isset($name) && $name != ""){
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote($name."%"));
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote($name."%"));
$url_string .= "&name=".$name;
}
- if(isset($website) && $website != "") array_push($where_clauses, "account.website like ".PearDatabase::quote("%".$website."%"));
- if(isset($phone) && $phone != "") array_push($where_clauses, "(account.phone like ".PearDatabase::quote("%".$phone."%")." OR account.otherphone like ".PearDatabase::quote("%".$phone."%")." OR account.fax like ".PearDatabase::quote("%".$phone."%").")");
+ if(isset($website) && $website != "") array_push($where_clauses, "account.website ".$adb->getLike()." ".PearDatabase::quote("%".$website."%"));
+ if(isset($phone) && $phone != "") array_push($where_clauses, "(account.phone ".$adb->getLike()." ".PearDatabase::quote("%".$phone."%")." OR account.otherphone ".$adb->getLike()." ".PearDatabase::quote("%".$phone."%")." OR account.fax ".$adb->getLike()." ".PearDatabase::quote("%".$phone."%").")");
if(isset($address_city) && $address_city != ""){
- array_push($where_clauses, "(accountbillads.city like ".PearDatabase::quote("%".$address_city."%")." OR accountshipads.city like ".PearDatabase::quote($address_city."%").")");
+ array_push($where_clauses, "(accountbillads.city ".$adb->getLike()." ".PearDatabase::quote("%".$address_city."%")." OR accountshipads.city ".$adb->getLike()." ".PearDatabase::quote($address_city."%").")");
$url_string .= "&address_city=".$address_city;
}
- if(isset($ownership) && $ownership != "") array_push($where_clauses, "account.ownership like ".PearDatabase::quote($ownership."%"));
+ if(isset($ownership) && $ownership != "") array_push($where_clauses, "account.ownership ".$adb->getLike()." ".PearDatabase::quote($ownership."%"));
if(isset($current_user_only) && $current_user_only != ""){
array_push($where_clauses, "crmentity.smownerid='$current_user->id'");
$url_string .= "¤t_user_only=".$current_user_only;
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup_picker.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup_picker.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Accounts/Popup_picker.php Mon Mar 20 04:00:52 2006
@@ -51,11 +51,11 @@
if(isset($name))
{
- array_push($where_clauses, "name like '$name%'");
+ array_push($where_clauses, "name ".$adb->getLike()." '$name%'");
}
if(isset($billing_address_city))
{
- array_push($where_clauses, "billing_address_city like '$billing_address_city%'");
+ array_push($where_clauses, "billing_address_city ".$adb->getLike()." '$billing_address_city%'");
}
$where = "";
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Activities/Activity.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Activities/Activity.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Activities/Activity.php Mon Mar 20 04:00:52 2006
@@ -438,6 +438,7 @@
function activity_reminder($activity_id,$reminder_time,$reminder_sent=0,$recurid,$remindermode='')
{
+ if($recurid == '') $recurid = $this->db->getUniqueID($this->reminder_table);
//Check for activityid already present in the reminder_table
$query_exist = "SELECT activity_id FROM ".$this->reminder_table." WHERE activity_id = ".$activity_id;
$result_exist = $this->db->query($query_exist);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Activities/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Activities/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Activities/ListView.php Mon Mar 20 04:00:52 2006
@@ -123,20 +123,20 @@
}
if(isset($name) && $name != '')
{
- array_push($where_clauses, "activity.subject like ".PearDatabase::quote($name.'%')."");
+ array_push($where_clauses, "activity.subject ".$adb->getLike()." ".PearDatabase::quote($name.'%')."");
$url_string .= "&name=".$name;
}
if(isset($contactname) && $contactname != '')
{
//$contactnames = explode(" ", $contactname);
//foreach ($contactnames as $name) {
- array_push($where_clauses, "(contactdetails.firstname like ".PearDatabase::quote($contactname.'%')." OR contactdetails.lastname like ".PearDatabase::quote($contactname.'%').")");
+ array_push($where_clauses, "(contactdetails.firstname ".$adb->getLike()." ".PearDatabase::quote($contactname.'%')." OR contactdetails.lastname ".$adb->getLike()." ".PearDatabase::quote($contactname.'%').")");
$url_string .= "&contactname=".$contactname;
//}
}
if(isset($duedate) && $duedate != '')
{
- array_push($where_clauses, "activity.duedate like ".PearDatabase::quote($datedue.'%')."");
+ array_push($where_clauses, "activity.duedate ".$adb->getLike()." ".PearDatabase::quote($datedue.'%')."");
}
if(isset($status) && $status != '')
{
@@ -236,13 +236,14 @@
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
+$distincton = $adb->isPostgres() ? 'crmid' : '';
if($viewid != "0")
{
- $listquery = getListQuery("Activities");
+ $listquery = getListQuery("Activities", '', $distincton);
$list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Activities");
}else
{
- $list_query = getListQuery("Activities");
+ $list_query = getListQuery("Activities", '', $distincton);
}
//<<<<<<<<customview>>>>>>>>>
@@ -290,7 +291,9 @@
set_selected();
</script>";
+ if(!$adb->isPostgres()) { // postgres wont group if all members of the select list aren't in the group by, use distinct on instead
$list_query .= ' GROUP BY crmentity.crmid'; //Appeding for the recurring event by jaguar
+ }
if(isset($order_by) && $order_by != '')
{
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Activities/OpenListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Activities/OpenListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Activities/OpenListView.php Mon Mar 20 04:00:52 2006
@@ -55,24 +55,22 @@
account.accountid,
account.accountname,
recurringevents.recurringtype,
- recurringevents.recurringdate,
- GREATEST(recurringevents.recurringdate,activity.date_start) as sort_date
+ recurringevents.recurringdate
FROM activity
INNER JOIN crmentity ON crmentity.crmid = activity.activityid
LEFT JOIN cntactivityrel ON cntactivityrel.activityid = activity.activityid
LEFT JOIN contactdetails ON contactdetails.contactid = cntactivityrel.contactid
LEFT JOIN seactivityrel ON seactivityrel.activityid = activity.activityid
LEFT OUTER JOIN account ON account.accountid = contactdetails.accountid
- LEFT OUTER JOIN recurringevents ON recurringevents.activityid = activity.activityid
+ LEFT OUTER JOIN recurringevents ON recurringevents.activityid = activity.activityid AND recurringevents.recurringdate <= '$later'
INNER JOIN salesmanactivityrel ON salesmanactivityrel.activityid = activity.activityid
WHERE crmentity.deleted=0
- AND ( activity.status is NULL || activity.status != 'Completed' )
- AND ( activity.eventstatus is NULL || activity.eventstatus != 'Held')
- AND ( activity.eventstatus is NULL || activity.eventstatus != 'Not Held' )
+ AND ( activity.status is NULL OR activity.status != 'Completed' )
+ AND ( activity.eventstatus is NULL OR activity.eventstatus != 'Held')
+ AND ( activity.eventstatus is NULL OR activity.eventstatus != 'Not Held' )
AND ( date_start <= '$later' OR recurringevents.recurringdate <= '$later' )
AND salesmanactivityrel.smid ='{$current_user->id}'
- HAVING sort_date <= '$later'
- ORDER BY sort_date, activity.time_start";
+ ORDER BY GREATEST(recurringevents.recurringdate,activity.date_start), activity.time_start";
//$list_query = getListQuery("Activities",$where);
//echo $list_query."<h3>END</h3>";
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Activities/RenderRelatedListUI.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Activities/RenderRelatedListUI.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Activities/RenderRelatedListUI.php Mon Mar 20 04:00:52 2006
@@ -113,14 +113,16 @@
global $adb,$image_path,$vtlog;
$avail_flag="false";
$avail_date=getDBInsertDateValue($avail_date);
+ $distincton = $adb->isPostgres() ? 'DISTINCT ON (crmid)' : '';
+ $groupby = $adb->isPostgres() ? '' : 'GROUP BY crmid';
if( $owner != $userid)
{
- $usr_query="select activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' like date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0 group by crmid;";
+ $usr_query="select $distincton activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' ".$adb->getLike()." date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0 $groupby;";
}
else
{
- $usr_query="select activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' like date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0 group by crmid;";
+ $usr_query="select $distincton activityid,activity.date_start,activity.due_date, activity.time_start,activity.duration_hours,activity.duration_minutes,crmentity.smownerid from activity,crmentity where crmentity.crmid=activity.activityid and ('".$avail_date."' ".$adb->getLike()." date_start) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0 $groupby;";
}
$result_cal=$adb->query($usr_query);
$noofrows_cal = $adb->num_rows($result_cal);
@@ -149,7 +151,7 @@
}
if($avail_flag!="true")
{
- $recur_query="SELECT activity.activityid, activity.time_start, activity.duration_hours, activity.duration_minutes , crmentity.smownerid, recurringevents.recurringid, recurringevents.recurringdate as date_start from activity inner join crmentity on activity.activityid = crmentity.crmid inner join recurringevents on activity.activityid=recurringevents.activityid where ('".$avail_date."' like recurringevents.recurringdate) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0 group by crmid";
+ $recur_query="SELECT activity.activityid, activity.time_start, activity.duration_hours, activity.duration_minutes , crmentity.smownerid, recurringevents.recurringid, recurringevents.recurringdate as date_start from activity inner join crmentity on activity.activityid = crmentity.crmid inner join recurringevents on activity.activityid=recurringevents.activityid where ('".$avail_date."' ".$adb->getLike()." recurringevents.recurringdate) and crmentity.smownerid=".$userid." and activity.activityid !=".$activity_id." and crmentity.deleted=0";
$result_cal=$adb->query($recur_query);
$noofrows_cal = $adb->num_rows($result_cal);
@@ -266,7 +268,8 @@
$noofrows_recur = $adb->num_rows($recur_result);
if($noofrows_recur==0)
{
- $recur_dates_qry='select activity.date_start,recurringevents.* from activity left outer join recurringevents on activity.activityid=recurringevents.activityid where recurringevents.activityid is NULL and activity.activityid='.$activity_id .' group by activity.activityid';
+ $recur_dates_qry='select activity.date_start,recurringevents.* from activity left outer join recurringevents on activity.activityid=recurringevents.activityid where recurringevents.activityid is NULL and activity.activityid='.$activity_id;
+ if(!$adb->isPostgres()) $recur_dates_qry .= ' group by activity.activityid';
$recur_result=$adb->query($recur_dates_qry);
$noofrows_recur = $adb->num_rows($recur_result);
@@ -386,7 +389,7 @@
$activity_start_time=time_to_number($act_time_start);
$activity_end_time=get_duration($act_time_start,$act_hour_dur,$act_mins_dur);
- $activity_owner_qry='select users.user_name,users.id userid from users,crmentity where users.id=crmentity.smownerid and crmentity.crmid='.$id;
+ $activity_owner_qry='select users.user_name,users.id AS userid from users,crmentity where users.id=crmentity.smownerid and crmentity.crmid='.$id;
$result_owner=$adb->query($activity_owner_qry);
while($row_owner = $adb->fetch_array($result_owner))
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Calendar/appointment.pinc
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Calendar/appointment.pinc (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Calendar/appointment.pinc Mon Mar 20 04:00:52 2006
@@ -1933,7 +1933,7 @@
}
$q.=" ((activity.date_start < '". $sx2 ."' AND activity.date_start >= '". $sx1."')";
- $q.=" and (activity.date_start like (activity.due_date) or (activity.date_start != '0000-00-00' ))";//query modified by Jag
+ $q.=" and (activity.date_start like (activity.due_date) or (activity.date_start != null ))";//query modified by Jag
#$q .= " OR (a_end < ". $x2 ." AND a_end >= ". $x1 .")";
#$q .= " OR (a_start < ". $x1 ." AND a_end >= ". $x2 .")";
#$q .= " OR (date_start < ". $sx1 .")";
@@ -2026,7 +2026,7 @@
$q.=" activity.activitytype in ('Call','Meeting') AND ";
$q.=" ((activity.date_start < '". $sx2 ."' AND activity.date_start >= '". $sx1."')";
- $q.=" and (activity.date_start like (activity.due_date) or (activity.date_start != '0000-00-00' ))";//query modified by Jag
+ $q.=" and (activity.date_start like (activity.due_date) or (activity.date_start != null ))";//query modified by Jag
$q .= " AND crmentity.deleted = 0)";
$q .= " and crmentity.smownerid=0 and users2group.userid=".$current_user->id;
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Contact.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Contact.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Contact.php Mon Mar 20 04:00:52 2006
@@ -235,7 +235,8 @@
function get_contacts1($user_name,$email_address)
{
- $query = "select contactdetails.lastname last_name,contactdetails.firstname first_name,contactdetails.contactid as id, contactdetails.salutation as salutation, contactdetails.email as email1,contactdetails.title as title,contactdetails.mobile as phone_mobile,account.accountname as account_name,account.accountid as account_id from contactdetails inner join crmentity on crmentity.crmid=contactdetails.contactid inner join users on users.id=crmentity.smownerid left join account on account.accountid=contactdetails.accountid left join contactaddress on contactaddress.contactaddressid=contactdetails.contactid where user_name='" .$user_name ."' and crmentity.deleted=0 and contactdetails.email like '%" .$email_address ."%' limit 50";
+ global $adb;
+ $query = "select contactdetails.lastname last_name,contactdetails.firstname first_name,contactdetails.contactid as id, contactdetails.salutation as salutation, contactdetails.email as email1,contactdetails.title as title,contactdetails.mobile as phone_mobile,account.accountname as account_name,account.accountid as account_id from contactdetails inner join crmentity on crmentity.crmid=contactdetails.contactid inner join users on users.id=crmentity.smownerid left join account on account.accountid=contactdetails.accountid left join contactaddress on contactaddress.contactaddressid=contactdetails.contactid where user_name='" .$user_name ."' and crmentity.deleted=0 and contactdetails.email ".$adb->getLike()." '%" .$email_address ."%' limit 50";
//echo $query;
return $this->process_list_query1($query);
}
@@ -350,7 +351,7 @@
// First, get the list of IDs.
//$query = 'SELECT contactdetails.lastname, contactdetails.firstname, activity.activityid , activity.subject, activity.activitytype, activity.date_start, cntactivityrel.contactid, crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime from contactdetails inner join cntactivityrel on cntactivityrel.contactid = contactdetails.contactid inner join activity on cntactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid = cntactivityrel.activityid where contactdetails.contactid = '.$id.' and (activitytype="Task" or activitytype="Call" or activitytype="Meeting") and crmentity.deleted=0';
- $query = "SELECT contactdetails.lastname, contactdetails.firstname, activity.activityid , activity.subject, activity.activitytype, activity.date_start, activity.due_date, cntactivityrel.contactid, crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, recurringevents.recurringtype from contactdetails inner join cntactivityrel on cntactivityrel.contactid = contactdetails.contactid inner join activity on cntactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid = cntactivityrel.activityid left outer join recurringevents on recurringevents.activityid=activity.activityid where contactdetails.contactid = ".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and crmentity.deleted=0 and ( activity.status is NULL || activity.status != 'Completed' ) and ( activity.eventstatus is NULL || activity.eventstatus != 'Held')"; //recurring type is added in Query -Jaguar
+ $query = "SELECT contactdetails.lastname, contactdetails.firstname, activity.activityid , activity.subject, activity.activitytype, activity.date_start, activity.due_date, cntactivityrel.contactid, crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, recurringevents.recurringtype from contactdetails inner join cntactivityrel on cntactivityrel.contactid = contactdetails.contactid inner join activity on cntactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid = cntactivityrel.activityid left outer join recurringevents on recurringevents.activityid=activity.activityid where contactdetails.contactid = ".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and crmentity.deleted=0 and ( activity.status is NULL OR activity.status != 'Completed' ) and ( activity.eventstatus is NULL OR activity.eventstatus != 'Held')"; //recurring type is added in Query -Jaguar
renderRelatedTasks($query,$id);
//return $this->build_related_list($query, new Task());
@@ -370,9 +371,9 @@
function get_attachments($id)
{
//$query = 'select notes.title,"Notes " as ActivityType, notes.filename, attachments.type as "FileType",crm2.modifiedtime as "lastmodified", notes.notesid as noteattachmentid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid='.$id;
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join crmentity on crmentity.crmid= notes.contact_id inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join crmentity on crmentity.crmid= notes.contact_id inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType,crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
function get_quotes($id)
@@ -492,8 +493,8 @@
{
$query = $this->constructCustomQueryAddendum() .",
contactdetails.*, contactaddress.*,
- account.accountname account_name,
- users.user_name assigned_user_name
+ account.accountname AS account_name,
+ users.user_name AS assigned_user_name
FROM contactdetails
inner join crmentity on crmentity.crmid=contactdetails.contactid
LEFT JOIN users ON crmentity.smcreatorid=users.id
@@ -506,8 +507,8 @@
{
$query = "SELECT
contactdetails.*, contactaddress.*,
- account.accountname account_name,
- users.user_name assigned_user_name
+ account.accountname AS account_name,
+ users.user_name AS assigned_user_name
FROM contactdetails
inner join crmentity on crmentity.crmid=contactdetails.contactid
LEFT JOIN users ON crmentity.smcreatorid=users.id
@@ -754,21 +755,22 @@
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause ($the_query_string) {
+ global $adb;
$where_clauses = Array();
$the_query_string = addslashes($the_query_string);
- array_push($where_clauses, "lastname like '$the_query_string%'");
- array_push($where_clauses, "firstname like '$the_query_string%'");
- array_push($where_clauses, "contactsubdetails.assistant like '$the_query_string%'");
- array_push($where_clauses, "email like '$the_query_string%'");
- array_push($where_clauses, "otheremail like '$the_query_string%'");
- array_push($where_clauses, "yahooid like '$the_query_string%'");
+ array_push($where_clauses, "lastname ".$adb->getLike()." '$the_query_string%'");
+ array_push($where_clauses, "firstname ".$adb->getLike()." '$the_query_string%'");
+ array_push($where_clauses, "contactsubdetails.assistant ".$adb->getLike()." '$the_query_string%'");
+ array_push($where_clauses, "email ".$adb->getLike()." '$the_query_string%'");
+ array_push($where_clauses, "otheremail ".$adb->getLike()." '$the_query_string%'");
+ array_push($where_clauses, "yahooid ".$adb->getLike()." '$the_query_string%'");
if (is_numeric($the_query_string)) {
- array_push($where_clauses, "phone like '%$the_query_string%'");
- array_push($where_clauses, "mobile like '%$the_query_string%'");
- array_push($where_clauses, "contactsubdetails.homephone like '%$the_query_string%'");
- array_push($where_clauses, "contactsubdetails.otherphone like '%$the_query_string%'");
- array_push($where_clauses, "fax like '%$the_query_string%'");
- array_push($where_clauses, "contactsubdetails.assistantphone like '%$the_query_string%'");
+ array_push($where_clauses, "phone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "mobile ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "contactsubdetails.homephone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "contactsubdetails.otherphone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "fax ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "contactsubdetails.assistantphone ".$adb->getLike()." '%$the_query_string%'");
}
$the_where = "";
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/ListView.php Mon Mar 20 04:00:52 2006
@@ -96,7 +96,7 @@
if($uitype[$i] == 56)
$str=" contactscf.".$column[$i]." = 1";
else
- $str=" contactscf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" contactscf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -105,15 +105,15 @@
if(isset($lastname) && $lastname != "") {
- array_push($where_clauses, "contactdetails.lastname like ".PearDatabase::quote($lastname.'%')."");
+ array_push($where_clauses, "contactdetails.lastname ".$adb->getLike()." ".PearDatabase::quote($lastname.'%')."");
$url_string .= "&lastname=".$lastname;
}
if(isset($firstname) && $firstname != "") {
- array_push($where_clauses, "contactdetails.firstname like ".PearDatabase::quote($firstname.'%')."");
+ array_push($where_clauses, "contactdetails.firstname ".$adb->getLike()." ".PearDatabase::quote($firstname.'%')."");
$url_string .= "&firstname=".$firstname;
}
if(isset($accountname) && $accountname != "") {
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote($accountname.'%')."");
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote($accountname.'%')."");
$url_string .= "&accountname=".$accountname;
}
if(isset($leadsource) && $leadsource != "") {
@@ -125,39 +125,39 @@
$url_string .= "&donotcall=".$donotcall;
}
if(isset($phone) && $phone != "") {
- array_push($where_clauses, "(contactdetails.phone like ".PearDatabase::quote('%'.$phone.'%')." OR contactdetails.mobile like ".PearDatabase::quote('%'.$phone.'%')." OR contactdetails.fax like ".PearDatabase::quote('%'.$phone.'%').")");
+ array_push($where_clauses, "(contactdetails.phone ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%')." OR contactdetails.mobile ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%')." OR contactdetails.fax ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%').")");
$url_string .= "&phone=".$phone;
}
if(isset($email) && $email != "") {
- array_push($where_clauses, "(contactdetails.email like ".PearDatabase::quote($email.'%').")");
+ array_push($where_clauses, "(contactdetails.email ".$adb->getLike()." ".PearDatabase::quote($email.'%').")");
$url_string .= "&email=".$email;
}
if(isset($yahooid) && $yahooid != "") {
- array_push($where_clauses, "contactdetails.yahooid like ".PearDatabase::quote($yahooid.'%')."");
+ array_push($where_clauses, "contactdetails.yahooid ".$adb->getLike()." ".PearDatabase::quote($yahooid.'%')."");
$url_string .= "&yahooid=".$yahooid;
}
if(isset($assistant) && $assistant != "") {
- array_push($where_clauses, "contactsubdetails.assistant like ".PearDatabase::quote($assistant.'%')."");
+ array_push($where_clauses, "contactsubdetails.assistant ".$adb->getLike()." ".PearDatabase::quote($assistant.'%')."");
$url_string .= "&yahooid=".$yahooid;
}
if(isset($mailingstreet) && $mailingstreet != "") {
- array_push($where_clauses, "(contactaddress.mailingstreet like ".PearDatabase::quote($mailingstreet.'%')." OR contactaddress.otherstreet like ".PearDatabase::quote($mailingstreet.'%').")");
+ array_push($where_clauses, "(contactaddress.mailingstreet ".$adb->getLike()." ".PearDatabase::quote($mailingstreet.'%')." OR contactaddress.otherstreet ".$adb->getLike()." ".PearDatabase::quote($mailingstreet.'%').")");
$url_string .= "&mailingstreet=".$mailingstreet;
}
if(isset($mailingcity) && $mailingcity != "") {
- array_push($where_clauses, "(contactaddress.mailingcity like ".PearDatabase::quote($mailingcity.'%')." OR contactaddress.othercity like ".PearDatabase::quote($mailingcity.'%').")");
+ array_push($where_clauses, "(contactaddress.mailingcity ".$adb->getLike()." ".PearDatabase::quote($mailingcity.'%')." OR contactaddress.othercity ".$adb->getLike()." ".PearDatabase::quote($mailingcity.'%').")");
$url_string .= "&mailingcity=".$mailingcity;
}
if(isset($mailingstate) && $mailingstate != "") {
- array_push($where_clauses, "(contactaddress.mailingstate like ".PearDatabase::quote($mailingstate.'%')." OR contactaddress.otherstate like ".PearDatabase::quote($mailingstate.'%').")");
+ array_push($where_clauses, "(contactaddress.mailingstate ".$adb->getLike()." ".PearDatabase::quote($mailingstate.'%')." OR contactaddress.otherstate ".$adb->getLike()." ".PearDatabase::quote($mailingstate.'%').")");
$url_string .= "&mailingstate=".$mailingstate;
}
if(isset($mailingzip) && $mailingzip != "") {
- array_push($where_clauses, "(contactaddress.mailingzip like ".PearDatabase::quote($mailingzip.'%')." OR contactaddress.otherzip like ".PearDatabase::quote($mailingzip.'%').")");
+ array_push($where_clauses, "(contactaddress.mailingzip ".$adb->getLike()." ".PearDatabase::quote($mailingzip.'%')." OR contactaddress.otherzip ".$adb->getLike()." ".PearDatabase::quote($mailingzip.'%').")");
$url_string .= "&mailingzip=".$mailingzip;
}
if(isset($mailingcountry) && $mailingcountry != "") {
- array_push($where_clauses, "(contactaddress.mailingcountry like ".PearDatabase::quote($mailingcountry.'%')." OR contactaddress.othercountry like ".PearDatabase::quote($mailingcountry.'%').")");
+ array_push($where_clauses, "(contactaddress.mailingcountry ".$adb->getLike()." ".PearDatabase::quote($mailingcountry.'%')." OR contactaddress.othercountry ".$adb->getLike()." ".PearDatabase::quote($mailingcountry.'%').")");
$url_string .= "&mailingcountry=".$mailingcountry;
}
if(isset($current_user_only) && $current_user_only != "") {
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Popup.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Popup.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Contacts/Popup.php Mon Mar 20 04:00:52 2006
@@ -86,15 +86,15 @@
$where_clauses = Array();
if(isset($lastname) && $lastname != "") {
- array_push($where_clauses, "contactdetails.lastname like ".PearDatabase::quote($lastname.'%')."");
+ array_push($where_clauses, "contactdetails.lastname ".$adb->getLike()." ".PearDatabase::quote($lastname.'%')."");
$url_string .= "&lastname=".$lastname;
}
if(isset($firstname) && $firstname != "") {
- array_push($where_clauses, "contactdetails.firstname like ".PearDatabase::quote($firstname.'%')."");
+ array_push($where_clauses, "contactdetails.firstname ".$adb->getLike()." ".PearDatabase::quote($firstname.'%')."");
$url_string .= "&firstname=".$firstname;
}
if(isset($title) && $title != "") {
- array_push($where_clauses, "contactdetails.title like ".PearDatabase::quote("%".$title.'%')."");
+ array_push($where_clauses, "contactdetails.title ".$adb->getLike()." ".PearDatabase::quote("%".$title.'%')."");
$url_string .= "&title=".$title;
}
if(isset($current_user_only) && $current_user_only != "") {
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/CustomView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/CustomView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/CustomView.php Mon Mar 20 04:00:52 2006
@@ -795,6 +795,7 @@
function getAdvComparator($comparator,$value)
{
+ global $adb;
/* fLabels['e'] = 'equals';
fLabels['n'] = 'not equal to';
fLabels['s'] = 'starts with';
@@ -828,15 +829,15 @@
}
if($comparator == "s")
{
- $rtvalue = " like ".PearDatabase::quote($value."%");
+ $rtvalue = " ".$adb->getLike()." ".PearDatabase::quote($value."%");
}
if($comparator == "c")
{
- $rtvalue = " like ".PearDatabase::quote("%".$value."%");
+ $rtvalue = " ".$adb->getLike()." ".PearDatabase::quote("%".$value."%");
}
if($comparator == "k")
{
- $rtvalue = " not like ".PearDatabase::quote("%".$value."%");
+ $rtvalue = " not ".$adb->getLike()." ".PearDatabase::quote("%".$value."%");
}
if($comparator == "l")
{
@@ -1104,7 +1105,7 @@
{
$listviewquery = substr($listquery, strpos($listquery,'from'),strlen($listquery));
- $query = "select count(*) count ".$listviewquery;
+ $query = "select count(*) as count ".$listviewquery;
$stdfiltersql = $this->getCVStdFilterSQL($viewid);
$advfiltersql = $this->getCVAdvFilterSQL($viewid);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/Save.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/Save.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/CustomView/Save.php Mon Mar 20 04:00:52 2006
@@ -122,8 +122,10 @@
$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"]."')";
+ if($std_filter_list["startdate"]) $stdfiltersql .= "'".$std_filter_list["startdate"]."',";
+ else $stdfiltersql .= "null,";
+ if($std_filter_list["enddate"]) $stdfiltersql .= "'".$std_filter_list["enddate"]."')";
+ else $stdfiltersql .= "null)";
//echo $stdfiltersql;
$stdfilterresult = $adb->query($stdfiltersql);
$vtlog->logthis("CustomView :: Save :: cvstdfilter created successfully","info");
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Emails/Email.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Emails/Email.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Emails/Email.php Mon Mar 20 04:00:52 2006
@@ -139,9 +139,9 @@
}
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType,crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Emails/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Emails/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Emails/ListView.php Mon Mar 20 04:00:52 2006
@@ -64,7 +64,7 @@
$listView = $filename;
$classname = "tabOff";
}
- elseif(stristr($label,$_REQUEST['smodule']))
+ elseif($_REQUEST['smodule'] && stristr($label,$_REQUEST['smodule']))
{
echo '<td class="tabOn" nowrap><a href="index.php?module=squirrelmail-1.4.4&action=redirect&smodule='.$_REQUEST['smodule'].'" class="tabLink">'.$mod_strings[$label].'</a></td>';
$listView = $filename;
@@ -218,19 +218,19 @@
}
if(isset($name) && $name != '')
{
- array_push($where_clauses, "activity.subject like ".PearDatabase::quote($name.'%')."");
+ array_push($where_clauses, "activity.subject ".$adb->getLike()." ".PearDatabase::quote($name.'%')."");
$url_string .= "&subject=".$name;
}
if(isset($contactname) && $contactname != '')
{
- array_push($where_clauses, "(contactdetails.firstname like ".PearDatabase::quote($contactname.'%')." OR contactdetails.lastname like ".PearDatabase::quote($contactname.'%').")");
+ array_push($where_clauses, "(contactdetails.firstname ".$adb->getLike()." ".PearDatabase::quote($contactname.'%')." OR contactdetails.lastname ".$adb->getLike()." ".PearDatabase::quote($contactname.'%').")");
$url_string .= "&contactname=".$contactname;
}
if(isset($date_start) && $date_start != '')
{
- array_push($where_clauses, "events.eventdatestart like ".PearDatabase::quote($date_start.'%')."");
+ array_push($where_clauses, "events.eventdatestart ".$adb->getLike()." ".PearDatabase::quote($date_start.'%')."");
}
if(isset($location) && $location != '')
{
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Faq/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Faq/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Faq/ListView.php Mon Mar 20 04:00:52 2006
@@ -65,14 +65,14 @@
if(isset($question) && $question != "")
{
- array_push($where_clauses, "faq.question like '%".$question."%'");
+ array_push($where_clauses, "faq.question ".$adb->getLike()." '%".$question."%'");
$url_string .= "&question=".$question;
$search_form->assign("QUESTION", $question);
}
if(isset($faqcategories) && $faqcategories != "")
{
- array_push($where_clauses, "faq.category like '%".$faqcategories."%'");
+ array_push($where_clauses, "faq.category ".$adb->getLike()." '%".$faqcategories."%'");
$url_string .= "&faqcategories=".$faqcategories;
$search_form->assign("FAQCATEGORIES", $faqcategories);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/FaqList.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/FaqList.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/FaqList.php Mon Mar 20 04:00:52 2006
@@ -41,14 +41,14 @@
if (isset($category) && $category !='')
{
- $search_query .= " and faq.category like '".$category."%'";
+ $search_query .= " and faq.category ".$adb->getLike()." '".$category."%'";
$query_val .= "&category=".$category;
$xtpl->assign("CATEGORY", $category);
}
if (isset($question) && $question !='')
{
- $search_query .= " and faq.question like '".$question."%'";
+ $search_query .= " and faq.question ".$adb->getLike()." '".$question."%'";
$query_val .= "&question=".$question;
$xtpl->assign("QUESTION", $question);
}
@@ -58,12 +58,12 @@
$date_criteria = $_REQUEST['date_crit'];
if($date_criteria == 'is')
{
- $search_query .= " and faq.date_created like '".$date."%'";
+ $search_query .= " and faq.date_created ".$adb->getLike()." '".$date."%'";
$xtpl->assign("IS", 'selected');
}
if($date_criteria == 'isnot')
{
- $search_query .= " and faq.date_created not like '".$date."%'";
+ $search_query .= " and faq.date_created not ".$adb->getLike()." '".$date."%'";
$xtpl->assign("ISNOT", 'selected');
}
if($date_criteria == 'before')
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/HelpDesk.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/HelpDesk.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/HelpDesk.php Mon Mar 20 04:00:52 2006
@@ -85,9 +85,9 @@
function get_attachments($id)
{
//Done for Merge -- Don
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType,crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/HelpDesk/ListView.php Mon Mar 20 04:00:52 2006
@@ -81,7 +81,7 @@
if($uitype[$i] == 56)
$str=" ticketcf.".$column[$i]." = 1";
else
- $str=" ticketcf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" ticketcf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -92,14 +92,14 @@
if(isset($name) && $name != "")
{
if($_REQUEST['button'] == 'Search')
- array_push($where_clauses, "troubletickets.title like '%".$name."%'");
+ array_push($where_clauses, "troubletickets.title ".$adb->getLike()." '%".$name."%'");
else
- array_push($where_clauses, "troubletickets.title like '".$name."%'");
+ array_push($where_clauses, "troubletickets.title ".$adb->getLike()." '".$name."%'");
$url_string .= "&ticket_title=".$name;
}
if(isset($contact_name) && $contact_name != "")
{
- array_push($where_clauses, "(contactdetails.firstname like".PearDatabase::quote($contact_name.'%')." OR contactdetails.lastname like ".PearDatabase::quote($contact_name.'%').")");
+ array_push($where_clauses, "(contactdetails.firstname ".$adb->getLike()."".PearDatabase::quote($contact_name.'%')." OR contactdetails.lastname ".$adb->getLike()." ".PearDatabase::quote($contact_name.'%').")");
$url_string .= "&contact_name=".$contact_name;
}
@@ -124,11 +124,11 @@
$format_date = getDBInsertDateValue($date);
if($date_criteria == 'is')
{
- array_push($where_clauses, "crmentity.createdtime like '%".$format_date."%'");
+ array_push($where_clauses, "crmentity.createdtime ".$adb->getLike()." '%".$format_date."%'");
}
if($date_criteria == 'isnot')
{
- array_push($where_clauses, "crmentity.createdtime not like '".$format_date."%'");
+ array_push($where_clauses, "crmentity.createdtime not ".$adb->getLike()." '".$format_date."%'");
}
if($date_criteria == 'before')
{
@@ -358,7 +358,7 @@
$defaultcv_criteria = $_REQUEST['viewname'];
}
- $list_query .= " and priority like "."'%" .$defaultcv_criteria ."%'";
+ $list_query .= " and priority ".$adb->getLike()." "."'%" .$defaultcv_criteria ."%'";
$viewname = $_REQUEST['viewname'];
$view_script = "<script language='javascript'>
function set_selected()
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Home/UnifiedSearch.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Home/UnifiedSearch.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Home/UnifiedSearch.php Mon Mar 20 04:00:52 2006
@@ -29,13 +29,14 @@
global $mod_strings;
function build_account_where_clause ($the_query_string) {
+ global $adb;
$where_clauses = Array();
- array_push($where_clauses, "accountname like '$the_query_string%'");
+ array_push($where_clauses, "accountname ".$adb->getLike()." '$the_query_string%'");
if (is_numeric($the_query_string)) {
- array_push($where_clauses, "otherphone like '%$the_query_string%'");
- array_push($where_clauses, "fax like '%$the_query_string%'");
- array_push($where_clauses, "phone like '%$the_query_string%'");
+ array_push($where_clauses, "otherphone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "fax ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "phone ".$adb->getLike()." '%$the_query_string%'");
}
$the_where = "";
@@ -51,18 +52,19 @@
}
function build_contact_where_clause ($the_query_string) {
+ global $adb;
$where_clauses = Array();
- array_push($where_clauses, "lastname like '$the_query_string%'");
- array_push($where_clauses, "firstname like '$the_query_string%'");
- array_push($where_clauses, "contactsubdetails.assistant like '$the_query_string%'");
+ array_push($where_clauses, "lastname ".$adb->getLike()." '$the_query_string%'");
+ array_push($where_clauses, "firstname ".$adb->getLike()." '$the_query_string%'");
+ array_push($where_clauses, "contactsubdetails.assistant ".$adb->getLike()." '$the_query_string%'");
if (is_numeric($the_query_string)) {
- array_push($where_clauses, "phone like '%$the_query_string%'");
- array_push($where_clauses, "mobile like '%$the_query_string%'");
- array_push($where_clauses, "homephone like '%$the_query_string%'");
- array_push($where_clauses, "otherphone like '%$the_query_string%'");
- array_push($where_clauses, "phone_fax like '%$the_query_string%'");
- array_push($where_clauses, "assistant_phone like '%$the_query_string%'");
+ array_push($where_clauses, "phone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "mobile ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "homephone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "otherphone ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "phone_fax ".$adb->getLike()." '%$the_query_string%'");
+ array_push($where_clauses, "assistant_phone ".$adb->getLike()." '%$the_query_string%'");
}
$the_where = "";
@@ -78,9 +80,10 @@
}
function build_opportunity_where_clause ($the_query_string) {
+ global $adb;
$where_clauses = Array();
- array_push($where_clauses, "potentialname like '$the_query_string%'");
+ array_push($where_clauses, "potentialname ".$adb->getLike()." '$the_query_string%'");
$the_where = "";
foreach($where_clauses as $clause)
@@ -95,10 +98,11 @@
}
/*
function build_case_where_clause ($the_query_string) {
+ global $adb;
$where_clauses = Array();
- array_push($where_clauses, "cases.name like '$the_query_string%'");
- if (is_numeric($the_query_string)) array_push($where_clauses, "cases.number like '$the_query_string%'");
+ array_push($where_clauses, "cases.name ".$adb->getLike()." '$the_query_string%'");
+ if (is_numeric($the_query_string)) array_push($where_clauses, "cases.number ".$adb->getLike()." '$the_query_string%'");
$the_where = "";
foreach($where_clauses as $clause)
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/Invoice.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/Invoice.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/Invoice.php Mon Mar 20 04:00:52 2006
@@ -176,9 +176,9 @@
}
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType, crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType, crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Invoice/ListView.php Mon Mar 20 04:00:52 2006
@@ -78,7 +78,7 @@
if($uitype[$i] == 56)
$str=" invoicecf.".$column[$i]." = 1";
else
- $str=" invoicecf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" invoicecf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -87,12 +87,12 @@
if(isset($subject) && $subject != "")
{
- array_push($where_clauses, "invoice.subject like ".PearDatabase::quote($subject."%"));
+ array_push($where_clauses, "invoice.subject ".$adb->getLike()." ".PearDatabase::quote($subject."%"));
$url_string .= "&subject=".$subject;
}
if(isset($salesorder) && $salesorder != "")
{
- array_push($where_clauses, "salesorder.subject like ".PearDatabase::quote("%".$salesorder."%"));
+ array_push($where_clauses, "salesorder.subject ".$adb->getLike()." ".PearDatabase::quote("%".$salesorder."%"));
$url_string .= "&salesorder=".$salesorder;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Lead.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Lead.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Lead.php Mon Mar 20 04:00:52 2006
@@ -260,7 +260,7 @@
function get_activities($id)
{
// First, get the list of IDs.
- $query = "SELECT contactdetails.lastname, contactdetails.firstname, contactdetails.contactid, activity.*,seactivityrel.*,crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name,recurringevents.recurringtype from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid = cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') AND ( activity.status is NULL || activity.status != 'Completed' ) and ( activity.eventstatus is NULL || activity.eventstatus != 'Held')";
+ $query = "SELECT contactdetails.lastname, contactdetails.firstname, contactdetails.contactid, activity.*,seactivityrel.*,crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name,recurringevents.recurringtype from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid = cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') AND ( activity.status is NULL or activity.status != 'Completed' ) and ( activity.eventstatus is NULL or activity.eventstatus != 'Held')";
//include('modules/Leads/RenderRelatedListUI.php');
renderRelatedTasks($query,$id);
}
@@ -309,9 +309,9 @@
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType,crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Leads/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Leads/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Leads/ListView.php Mon Mar 20 04:00:52 2006
@@ -97,7 +97,7 @@
if($uitype[$i] == 56)
$str=" leadscf.".$column[$i]." = 1";
else
- $str=" leadscf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" leadscf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -106,15 +106,15 @@
if(isset($lastname) && $lastname != ""){
- array_push($where_clauses, "leaddetails.lastname like '$lastname%'");
+ array_push($where_clauses, "leaddetails.lastname ".$adb->getLike()." '$lastname%'");
$url_string .= "&lastname=".$lastname;
}
if(isset($firstname) && $firstname != ""){
- array_push($where_clauses, "leaddetails.firstname like '$firstname%'");
+ array_push($where_clauses, "leaddetails.firstname ".$adb->getLike()." '$firstname%'");
$url_string .= "&firstname=".$firstname;
}
if(isset($company) && $company != ""){
- array_push($where_clauses, "leaddetails.company like '$company%'");
+ array_push($where_clauses, "leaddetails.company ".$adb->getLike()." '$company%'");
$url_string .= "&company=".$company;
}
if(isset($leadsource) && $leadsource != ""){
@@ -126,19 +126,19 @@
$url_string .= "&industry=".$industry;
}
if(isset($phone) && $phone != ""){
- array_push($where_clauses, "leadaddress.phone like '%$phone%'");
+ array_push($where_clauses, "leadaddress.phone ".$adb->getLike()." '%$phone%'");
$url_string .= "&phone=".$phone;
}
if(isset($fax) && $fax != ""){
- array_push($where_clauses, "leadaddress.fax like '%$fax%'");
+ array_push($where_clauses, "leadaddress.fax ".$adb->getLike()." '%$fax%'");
$url_string .= "&fax=".$fax;
}
if(isset($email) && $email != ""){
- array_push($where_clauses, "leaddetails.email like '$email%'");
+ array_push($where_clauses, "leaddetails.email ".$adb->getLike()." '$email%'");
$url_string .= "&email=".$email;
}
if(isset($mobile) && $mobile != ""){
- array_push($where_clauses, "leadaddress.mobile like '%$mobile%'");
+ array_push($where_clauses, "leadaddress.mobile ".$adb->getLike()." '%$mobile%'");
$url_string .= "&mobile=".$mobile;
}
if(isset($leadstatus) && $leadstatus != ""){
@@ -150,23 +150,23 @@
$url_string .= "&rating=".$rating;
}
if(isset($address_street) && $address_street != ""){
- array_push($where_clauses, "leadaddress.lane like '$address_street%'");
+ array_push($where_clauses, "leadaddress.lane ".$adb->getLike()." '$address_street%'");
$url_string .= "&address_street=".$address_street;
}
if(isset($address_city) && $address_city != ""){
- array_push($where_clauses, "leadaddress.city like '$address_city%'");
+ array_push($where_clauses, "leadaddress.city ".$adb->getLike()." '$address_city%'");
$url_string .= "&address_city=".$address_city;
}
if(isset($address_state) && $address_state != ""){
- array_push($where_clauses, "leadaddress.state like '$address_state%'");
+ array_push($where_clauses, "leadaddress.state ".$adb->getLike()." '$address_state%'");
$url_string .= "&address_state=".$address_state;
}
if(isset($address_postalcode) && $address_postalcode != ""){
- array_push($where_clauses, "leadaddress.code like '$address_postalcode%'");
+ array_push($where_clauses, "leadaddress.code ".$adb->getLike()." '$address_postalcode%'");
$url_string .= "&address_postalcode=".$address_postalcode;
}
if(isset($address_country) && $address_country != ""){
- array_push($where_clauses, "leadaddress.country like '$address_country%'");
+ array_push($where_clauses, "leadaddress.country ".$adb->getLike()." '$address_country%'");
$url_string .= "&address_country=".$address_country;
}
if(isset($current_user_only) && $current_user_only != ""){
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Popup.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Popup.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Leads/Popup.php Mon Mar 20 04:00:52 2006
@@ -75,15 +75,15 @@
$where_clauses = Array();
if(isset($last_name) && $last_name != ""){
- array_push($where_clauses, "leaddetails.lastname like '$last_name%'");
+ array_push($where_clauses, "leaddetails.lastname ".$adb->getLike()." '$last_name%'");
$url_string .= "&last_name=".$last_name;
}
if(isset($first_name) && $first_name != ""){
- array_push($where_clauses, "leaddetails.firstname like '%$first_name%'");
+ array_push($where_clauses, "leaddetails.firstname ".$adb->getLike()." '%$first_name%'");
$url_string .= "&first_name=".$first_name;
}
if(isset($company) && $company != ""){
- array_push($where_clauses, "leaddetails.company like '%$company%'");
+ array_push($where_clauses, "leaddetails.company ".$adb->getLike()." '%$company%'");
$url_string .= "&company=".$company;
}
if(isset($current_user_only) && $current_user_only != ""){
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Meetings/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Meetings/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Meetings/ListView.php Mon Mar 20 04:00:52 2006
@@ -81,18 +81,18 @@
if(isset($current_user_only) && $current_user_only != "") array_push($where_clauses, "meetings.assigned_user_id='$current_user->id'");
if(isset($name) && $name != '')
{
- array_push($where_clauses, "meetings.name like '".PearDatabase::quote($name)."%'");
+ array_push($where_clauses, "meetings.name ".$adb->getLike()." '".PearDatabase::quote($name)."%'");
}
if(isset($contact_name) && $contact_name != '')
{
$contact_names = explode(" ", $contact_name);
foreach ($contact_names as $name) {
- array_push($where_clauses, "(contacts.first_name like '".PearDatabase::quote($name)."%' OR contacts.last_name like '".PearDatabase::quote($name)."%')");
+ array_push($where_clauses, "(contacts.first_name ".$adb->getLike()." '".PearDatabase::quote($name)."%' OR contacts.last_name ".$adb->getLike()." '".PearDatabase::quote($name)."%')");
}
}
if(isset($date_start) && $date_start != '')
{
- array_push($where_clauses, "meetings.date_start like '".PearDatabase::quote($date_start)."%'");
+ array_push($where_clauses, "meetings.date_start ".$adb->getLike()." '".PearDatabase::quote($date_start)."%'");
}
if(isset($location) && $location != '')
{
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Notes/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Notes/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Notes/ListView.php Mon Mar 20 04:00:52 2006
@@ -111,14 +111,14 @@
if(isset($name) && $name != '')
{
- array_push($where_clauses, "notes.title like ".PearDatabase::quote($name.'%')."");
+ array_push($where_clauses, "notes.title ".$adb->getLike()." ".PearDatabase::quote($name.'%')."");
$url_string .= "&title=".$name;
}
if(isset($contact_name) && $contact_name != '')
{
$contact_names = explode(" ", $contact_name);
foreach ($contact_names as $name) {
- array_push($where_clauses, "(contactdetails.firstname like ".PearDatabase::quote($name.'%')." OR contactdetails.lastname like ".PearDatabase::quote($name.'%').")");
+ array_push($where_clauses, "(contactdetails.firstname ".$adb->getLike()." ".PearDatabase::quote($name.'%')." OR contactdetails.lastname ".$adb->getLike()." ".PearDatabase::quote($name.'%').")");
}
$url_string .= "&contact_name=".$contact_name;
}
@@ -212,7 +212,9 @@
$query .= ' and '.$where;
}
-$query .= ' group by notes.notesid';
+if(!$adb->isPostgres()) { // postgres wont group if all members of the select list aren't in the group by, use distinct on instead
+ $query .= ' group by notes.notesid';
+}
if(isset($order_by) && $order_by != '')
{
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Orders/DeleteSalesOrder.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Orders/DeleteSalesOrder.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Orders/DeleteSalesOrder.php Mon Mar 20 04:00:52 2006
@@ -37,17 +37,17 @@
}
elseif($_REQUEST['return_module'] == "Quotes")
{
- $relation_query = "UPDATE salesorder set quoteid='' where salesorderid=".$_REQUEST['record'];
+ $relation_query = "UPDATE salesorder set quoteid=null where salesorderid=".$_REQUEST['record'];
$adb->query($relation_query);
}
elseif($_REQUEST['return_module'] == "Potentials")
{
- $relation_query = "UPDATE salesorder set potentialid='' where salesorderid=".$_REQUEST['record'];
+ $relation_query = "UPDATE salesorder set potentialid=null where salesorderid=".$_REQUEST['record'];
$adb->query($relation_query);
}
elseif($_REQUEST['return_module'] == "Contacts")
{
- $relation_query = "UPDATE salesorder set contactid='' where salesorderid=".$_REQUEST['record'];
+ $relation_query = "UPDATE salesorder set contactid=null where salesorderid=".$_REQUEST['record'];
$adb->query($relation_query);
}
elseif($_REQUEST['return_module'] == "Products")
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Orders/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Orders/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Orders/ListView.php Mon Mar 20 04:00:52 2006
@@ -79,7 +79,7 @@
if($uitype[$i] == 56)
$str=" purchaseordercf.".$column[$i]." = 1";
else
- $str=" purchaseordercf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" purchaseordercf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -88,17 +88,17 @@
if(isset($subject) && $subject != "")
{
- array_push($where_clauses, "purchaseorder.subject like ".PearDatabase::quote($subject."%"));
+ array_push($where_clauses, "purchaseorder.subject ".$adb->getLike()." ".PearDatabase::quote($subject."%"));
$url_string .= "&subject=".$subject;
}
if(isset($vendorname) && $vendorname != "")
{
- array_push($where_clauses, "vendor.vendorname like ".PearDatabase::quote("%".$vendorname."%"));
+ array_push($where_clauses, "vendor.vendorname ".$adb->getLike()." ".PearDatabase::quote("%".$vendorname."%"));
$url_string .= "&vendorname=".$vendorname;
}
if(isset($trackingno) && $trackingno != "")
{
- array_push($where_clauses, "purchaseorder.tracking_no like ".PearDatabase::quote("%".$trackingno."%"));
+ array_push($where_clauses, "purchaseorder.tracking_no ".$adb->getLike()." ".PearDatabase::quote("%".$trackingno."%"));
$url_string .= "&trackingno=".$trackingno;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Orders/Order.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Orders/Order.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Orders/Order.php Mon Mar 20 04:00:52 2006
@@ -176,9 +176,9 @@
}
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType, crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType, crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Orders/PopupSalesOrder.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Orders/PopupSalesOrder.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Orders/PopupSalesOrder.php Mon Mar 20 04:00:52 2006
@@ -61,22 +61,22 @@
if (isset($subject) && $subject !='')
{
- array_push($where_clauses, "salesorder.subject like ".PearDatabase::quote($subject.'%'));
- //$search_query .= " and productname like '".$productname."%'";
+ array_push($where_clauses, "salesorder.subject ".$adb->getLike()." ".PearDatabase::quote($subject.'%'));
+ //$search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&subject=".$subject;
}
if (isset($accountname) && $accountname !='')
{
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote($accountname.'%'));
- //$search_query .= " and productcode like '".$productcode."%'";
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote($accountname.'%'));
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&accountname=".$accountname;
}
if (isset($quotename) && $quotename !='')
{
- array_push($where_clauses, "quotes.subject like ".PearDatabase::quote($quotename.'%'));
- //$search_query .= " and commissionrate like '".$commissionrate."%'";
+ array_push($where_clauses, "quotes.subject ".$adb->getLike()." ".PearDatabase::quote($quotename.'%'));
+ //$search_query .= " and commissionrate ".$adb->getLike()." '".$commissionrate."%'";
$url_string .= ""ename=".$quotename;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrder.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrder.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrder.php Mon Mar 20 04:00:52 2006
@@ -182,9 +182,9 @@
}
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType, crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType, crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id,$sid='salesorderid');
}
function get_invoices($id)
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrderListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrderListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Orders/SalesOrderListView.php Mon Mar 20 04:00:52 2006
@@ -77,7 +77,7 @@
if($uitype[$i] == 56)
$str=" salesordercf.".$column[$i]." = 1";
else
- $str=" salesordercf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" salesordercf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
// $search_query .= ' and '.$str;
$url_string .="&".$column[$i]."=".$customfield[$i];
@@ -87,22 +87,22 @@
if (isset($subject) && $subject !='')
{
- array_push($where_clauses, "salesorder.subject like ".PearDatabase::quote($subject.'%'));
- //$search_query .= " and productname like '".$productname."%'";
+ array_push($where_clauses, "salesorder.subject ".$adb->getLike()." ".PearDatabase::quote($subject.'%'));
+ //$search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&subject=".$subject;
}
if (isset($accountname) && $accountname !='')
{
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote($accountname.'%'));
- //$search_query .= " and productcode like '".$productcode."%'";
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote($accountname.'%'));
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&accountname=".$accountname;
}
if (isset($quotename) && $quotename !='')
{
- array_push($where_clauses, "quotes.subject like ".PearDatabase::quote($quotename.'%'));
- //$search_query .= " and commissionrate like '".$commissionrate."%'";
+ array_push($where_clauses, "quotes.subject ".$adb->getLike()." ".PearDatabase::quote($quotename.'%'));
+ //$search_query .= " and commissionrate ".$adb->getLike()." '".$commissionrate."%'";
$url_string .= ""ename=".$quotename;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/ListView.php Mon Mar 20 04:00:52 2006
@@ -90,7 +90,7 @@
if($uitype[$i] == 56)
$str=" potentialscf.".$column[$i]." = 1";
else
- $str=" potentialscf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" potentialscf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -98,11 +98,11 @@
//upto this added for Custom Field
if(isset($name) && $name != "") {
- array_push($where_clauses, "potential.potentialname like ".PearDatabase::quote($name.'%')."");
+ array_push($where_clauses, "potential.potentialname ".$adb->getLike()." ".PearDatabase::quote($name.'%')."");
$url_string .= "&potentialname=".$name;
}
if(isset($accountname) && $accountname != "") {
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote($accountname.'%')."");
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote($accountname.'%')."");
$url_string .= "&accountname=".$accountname;
@@ -121,11 +121,11 @@
$url_string .= "&opportunity_type=".$opportunity_type;
}
if(isset($amount) && $amount != "") {
- array_push($where_clauses, "potential.amount like ".PearDatabase::quote($amount.'%')."");
+ array_push($where_clauses, "potential.amount ".$adb->getLike()." ".PearDatabase::quote($amount.'%')."");
$url_string .= "&amount=".$amount;
}
if(isset($nextstep) && $nextstep != "") {
- array_push($where_clauses, "potential.nextstep like ".PearDatabase::quote($nextstep.'%')."");
+ array_push($where_clauses, "potential.nextstep ".$adb->getLike()." ".PearDatabase::quote($nextstep.'%')."");
$url_string .= "&nextstep=".$nextstep;
}
if(isset($sales_stage) && $sales_stage != "") {
@@ -136,7 +136,7 @@
$url_string .= "&sales_stage=".$sales_stage;
}
if(isset($probability) && $probability != "") {
- array_push($where_clauses, "potential.probability like ".PearDatabase::quote($probability.'%')."");
+ array_push($where_clauses, "potential.probability ".$adb->getLike()." ".PearDatabase::quote($probability.'%')."");
$url_string .= "&probability=".$probability;
}
@@ -145,7 +145,7 @@
$url_string .= "¤t_user_only=".$current_user_only;
}
if(isset($date_closed) && $date_closed != "") {
- array_push($where_clauses, $adb->getDBDateString("potential.closingdate")." like ".PearDatabase::quote($date_closed.'%')."");
+ array_push($where_clauses, $adb->getDBDateString("potential.closingdate")." ".$adb->getLike()." ".PearDatabase::quote($date_closed.'%')."");
$url_string .= "&closingdate=".$date_closed;
}
if(isset($date_closed_start) && $date_closed_start != "" && isset($date_closed_end) && $date_closed_end != "")
@@ -357,7 +357,7 @@
$defaultcv_criteria = $_REQUEST['viewname'];
}
- $list_query .= " and sales_stage like "."'%" .$defaultcv_criteria ."%'";
+ $list_query .= " and sales_stage ".$adb->getLike()." "."'%" .$defaultcv_criteria ."%'";
$viewname = $_REQUEST['viewname'];
$view_script = "<script language='javascript'>
function set_selected()
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Opportunity.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Opportunity.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Opportunity.php Mon Mar 20 04:00:52 2006
@@ -612,7 +612,7 @@
function get_activities($id)
{
//$query = "SELECT activity.subject,semodule,activitytype,date_start,status,priority from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid where seactivityrel.crmid=".$id;
- $query = "SELECT activity.*,seactivityrel.*,crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name, recurringevents.recurringtype, contactdetails.contactid, contactdetails.lastname, contactdetails.firstname from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid= cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and crmentity.deleted=0 and ( activity.status is NULL || activity.status != 'Completed' ) and ( activity.eventstatus is NULL || activity.eventstatus != 'Held')";
+ $query = "SELECT activity.*,seactivityrel.*,crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name, recurringevents.recurringtype, contactdetails.contactid, contactdetails.lastname, contactdetails.firstname from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid= cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and crmentity.deleted=0 and ( activity.status is NULL or activity.status != 'Completed' ) and ( activity.eventstatus is NULL or activity.eventstatus != 'Held')";
//include('modules/Potentials/RenderRelatedListUI.php');
renderRelatedActivities($query,$id);
}
@@ -648,9 +648,9 @@
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType,crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
@@ -690,9 +690,10 @@
do not include any $this-> because this is called on without having the class instantiated
*/
function build_generic_where_clause ($the_query_string) {
+ global $adb;
$where_clauses = Array();
$the_query_string = addslashes($the_query_string);
- array_push($where_clauses, "potentialname like '$the_query_string%'");
+ array_push($where_clauses, "potentialname ".$adb->getLike()." '$the_query_string%'");
$the_where = "";
foreach($where_clauses as $clause)
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Popup.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Popup.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/Popup.php Mon Mar 20 04:00:52 2006
@@ -73,11 +73,11 @@
$where_clauses = array();
if(isset($name) && $name != "") {
- array_push($where_clauses, "potential.potentialname like ".PearDatabase::quote($name.'%')."");
+ array_push($where_clauses, "potential.potentialname ".$adb->getLike()." ".PearDatabase::quote($name.'%')."");
$url_string .= "&name=".$name;
}
if(isset($accountname) && $accountname != "") {
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote('%'.$accountname.'%')."");
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote('%'.$accountname.'%')."");
$url_string .= "&account_name=".$accountname;
}
if(isset($current_user_only) && $current_user_only != "") {
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/updateRelations.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/updateRelations.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Potentials/updateRelations.php Mon Mar 20 04:00:52 2006
@@ -15,8 +15,9 @@
//if($_REQUEST['module']=='Users')
// $sql = "insert into salesmanactivityrel values (". $_REQUEST["entityid"] .",".$_REQUEST["parid"] .")";
//else
+if($_REQUEST['module']=='Potentials')
$sql = "insert into contpotentialrel values (". $_REQUEST["entityid"] .",".$_REQUEST["parid"] .")";
-$adb->query($sql);
+else
$sql = "insert into seproductsrel values (". $_REQUEST["parid"] .",".$_REQUEST["entityid"] .")";
$adb->query($sql);
header("Location: index.php?action=DetailView&module=Potentials&record=".$_REQUEST["parid"]);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/AddProductsToPriceBook.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/AddProductsToPriceBook.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/AddProductsToPriceBook.php Mon Mar 20 04:00:52 2006
@@ -86,7 +86,7 @@
if($uitype[$i] == 56)
$str=" productcf.".$column[$i]." = 1";
else
- $str=" productcf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" productcf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
// $search_query .= ' and '.$str;
$url_string .="&".$column[$i]."=".$customfield[$i];
@@ -96,65 +96,65 @@
if (isset($productname) && $productname !='')
{
- array_push($where_clauses, "productname like ".PearDatabase::quote($productname.'%'));
- //$search_query .= " and productname like '".$productname."%'";
+ array_push($where_clauses, "productname ".$adb->getLike()." ".PearDatabase::quote($productname.'%'));
+ //$search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&productname=".$productname;
}
if (isset($productcode) && $productcode !='')
{
- array_push($where_clauses, "productcode like ".PearDatabase::quote($productcode.'%'));
- //$search_query .= " and productcode like '".$productcode."%'";
+ array_push($where_clauses, "productcode ".$adb->getLike()." ".PearDatabase::quote($productcode.'%'));
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&productcode=".$productcode;
}
if (isset($commissionrate) && $commissionrate !='')
{
- array_push($where_clauses, "commissionrate like ".PearDatabase::quote($commissionrate.'%'));
- //$search_query .= " and commissionrate like '".$commissionrate."%'";
+ array_push($where_clauses, "commissionrate ".$adb->getLike()." ".PearDatabase::quote($commissionrate.'%'));
+ //$search_query .= " and commissionrate ".$adb->getLike()." '".$commissionrate."%'";
$url_string .= "&commissionrate=".$commissionrate;
}
if (isset($qtyperunit) && $qtyperunit !='')
{
- array_push($where_clauses, "qty_per_unit like ".PearDatabase::quote($qtyperunit.'%'));
- //$search_query .= " and qty_per_unit like '".$qtyperunit."%'";
+ array_push($where_clauses, "qty_per_unit ".$adb->getLike()." ".PearDatabase::quote($qtyperunit.'%'));
+ //$search_query .= " and qty_per_unit ".$adb->getLike()." '".$qtyperunit."%'";
$url_string .= "&qtyperunit=".$qtyperunit;
}
if (isset($unitprice) && $unitprice !='')
{
- array_push($where_clauses, "unit_price like ".PearDatabase::quote($unitprice.'%'));
- // $search_query .= " and unit_price like '".$unitprice."%'";
+ array_push($where_clauses, "unit_price ".$adb->getLike()." ".PearDatabase::quote($unitprice.'%'));
+ // $search_query .= " and unit_price ".$adb->getLike()." '".$unitprice."%'";
$url_string .= "&unitprice=".$unitprice;
}
if (isset($manufacturer) && $manufacturer !='' && $manufacturer !='--None--')
{
- array_push($where_clauses, "manufacturer like ".PearDatabase::quote($manufacturer.'%'));
- //$search_query .= " and manufacturer like '".$manufacturer."%'";
+ array_push($where_clauses, "manufacturer ".$adb->getLike()." ".PearDatabase::quote($manufacturer.'%'));
+ //$search_query .= " and manufacturer ".$adb->getLike()." '".$manufacturer."%'";
$url_string .= "&manufacturer=".$manufacturer;
}
if (isset($productcategory) && $productcategory !='' && $productcategory !='--None--')
{
- array_push($where_clauses, "productcategory like ".PearDatabase::quote($productcategory.'%'));
- //$search_query .= " and productcategory like '".$productcategory."%'";
+ array_push($where_clauses, "productcategory ".$adb->getLike()." ".PearDatabase::quote($productcategory.'%'));
+ //$search_query .= " and productcategory ".$adb->getLike()." '".$productcategory."%'";
$url_string .= "&productcategory=".$productcategory;
}
if (isset($start_date) && $start_date !='')
{
- array_push($where_clauses, "start_date like ".PearDatabase::quote($start_date.'%'));
+ array_push($where_clauses, "start_date ".$adb->getLike()." ".PearDatabase::quote($start_date.'%'));
//$search_query .= " and start_date = '".$start_date."%'";
$url_string .= "&start_date=".$start_date;
}
if (isset($expiry_date) && $expiry_date !='')
{
- array_push($where_clauses, "expiry_date like ".PearDatabase::quote($expiry_date.'%'));
+ array_push($where_clauses, "expiry_date ".$adb->getLike()." ".PearDatabase::quote($expiry_date.'%'));
//$search_query .= " and expiry_date = '".$expiry_date."%'";
$url_string .= "&expiry_date=".$expiry_date;
}
if (isset($purchase_date) && $purchase_date !='')
{
- array_push($where_clauses, "purchase_date like ".PearDatabase::quote($purchase_date.'%'));
+ array_push($where_clauses, "purchase_date ".$adb->getLike()." ".PearDatabase::quote($purchase_date.'%'));
//$search_query .= " and purchase_date = '".$purchase_date."%'";
$url_string .= "&purchase_date=".$purchase_date;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/ListView.php Mon Mar 20 04:00:52 2006
@@ -84,7 +84,7 @@
if($uitype[$i] == 56)
$str=" productcf.".$column[$i]." = 1";
else
- $str=" productcf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" productcf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
// $search_query .= ' and '.$str;
$url_string .="&".$column[$i]."=".$customfield[$i];
@@ -94,65 +94,65 @@
if (isset($productname) && $productname !='')
{
- array_push($where_clauses, "productname like ".PearDatabase::quote($productname.'%'));
- //$search_query .= " and productname like '".$productname."%'";
+ array_push($where_clauses, "productname ".$adb->getLike()." ".PearDatabase::quote($productname.'%'));
+ //$search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&productname=".$productname;
}
if (isset($productcode) && $productcode !='')
{
- array_push($where_clauses, "productcode like ".PearDatabase::quote($productcode.'%'));
- //$search_query .= " and productcode like '".$productcode."%'";
+ array_push($where_clauses, "productcode ".$adb->getLike()." ".PearDatabase::quote($productcode.'%'));
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&productcode=".$productcode;
}
if (isset($commissionrate) && $commissionrate !='')
{
- array_push($where_clauses, "commissionrate like ".PearDatabase::quote($commissionrate.'%'));
- //$search_query .= " and commissionrate like '".$commissionrate."%'";
+ array_push($where_clauses, "commissionrate ".$adb->getLike()." ".PearDatabase::quote($commissionrate.'%'));
+ //$search_query .= " and commissionrate ".$adb->getLike()." '".$commissionrate."%'";
$url_string .= "&commissionrate=".$commissionrate;
}
if (isset($qtyperunit) && $qtyperunit !='')
{
- array_push($where_clauses, "qty_per_unit like ".PearDatabase::quote($qtyperunit.'%'));
- //$search_query .= " and qty_per_unit like '".$qtyperunit."%'";
+ array_push($where_clauses, "qty_per_unit ".$adb->getLike()." ".PearDatabase::quote($qtyperunit.'%'));
+ //$search_query .= " and qty_per_unit ".$adb->getLike()." '".$qtyperunit."%'";
$url_string .= "&qtyperunit=".$qtyperunit;
}
if (isset($unitprice) && $unitprice !='')
{
- array_push($where_clauses, "unit_price like ".PearDatabase::quote($unitprice.'%'));
- // $search_query .= " and unit_price like '".$unitprice."%'";
+ array_push($where_clauses, "unit_price ".$adb->getLike()." ".PearDatabase::quote($unitprice.'%'));
+ // $search_query .= " and unit_price ".$adb->getLike()." '".$unitprice."%'";
$url_string .= "&unitprice=".$unitprice;
}
if (isset($manufacturer) && $manufacturer !='' && $manufacturer !='--None--')
{
- array_push($where_clauses, "manufacturer like ".PearDatabase::quote($manufacturer.'%'));
- //$search_query .= " and manufacturer like '".$manufacturer."%'";
+ array_push($where_clauses, "manufacturer ".$adb->getLike()." ".PearDatabase::quote($manufacturer.'%'));
+ //$search_query .= " and manufacturer ".$adb->getLike()." '".$manufacturer."%'";
$url_string .= "&manufacturer=".$manufacturer;
}
if (isset($productcategory) && $productcategory !='' && $productcategory !='--None--')
{
- array_push($where_clauses, "productcategory like ".PearDatabase::quote($productcategory.'%'));
- //$search_query .= " and productcategory like '".$productcategory."%'";
+ array_push($where_clauses, "productcategory ".$adb->getLike()." ".PearDatabase::quote($productcategory.'%'));
+ //$search_query .= " and productcategory ".$adb->getLike()." '".$productcategory."%'";
$url_string .= "&productcategory=".$productcategory;
}
if (isset($start_date) && $start_date !='')
{
- array_push($where_clauses, "start_date like ".PearDatabase::quote($start_date.'%'));
+ array_push($where_clauses, "start_date ".$adb->getLike()." ".PearDatabase::quote($start_date.'%'));
//$search_query .= " and start_date = '".$start_date."%'";
$url_string .= "&start_date=".$start_date;
}
if (isset($expiry_date) && $expiry_date !='')
{
- array_push($where_clauses, "expiry_date like ".PearDatabase::quote($expiry_date.'%'));
+ array_push($where_clauses, "expiry_date ".$adb->getLike()." ".PearDatabase::quote($expiry_date.'%'));
//$search_query .= " and expiry_date = '".$expiry_date."%'";
$url_string .= "&expiry_date=".$expiry_date;
}
if (isset($purchase_date) && $purchase_date !='')
{
- array_push($where_clauses, "purchase_date like ".PearDatabase::quote($purchase_date.'%'));
+ array_push($where_clauses, "purchase_date ".$adb->getLike()." ".PearDatabase::quote($purchase_date.'%'));
//$search_query .= " and purchase_date = '".$purchase_date."%'";
$url_string .= "&purchase_date=".$purchase_date;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/Popup.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/Popup.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/Popup.php Mon Mar 20 04:00:52 2006
@@ -68,20 +68,20 @@
if (isset($productname) && $productname !='')
{
- $search_query .= " and productname like '".$productname."%'";
+ $search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&productname=".$productname;
$xtpl->assign("PRODUCT_NAME", $productname);
}
if (isset($productcode) && $productcode !='')
{
- $search_query .= " and productcode like '%".$productcode."%'";
+ $search_query .= " and productcode ".$adb->getLike()." '%".$productcode."%'";
$url_string .= "&productcode=".$productcode;
$xtpl->assign("PRODUCT_CODE", $productcode);
}
if (isset($unitprice) && $unitprice !='')
{
- $search_query .= " and unit_price like '%".$unitprice."%'";
+ $search_query .= " and unit_price ".$adb->getLike()." '%".$unitprice."%'";
$url_string .= "&unitprice=".$unitprice;
$xtpl->assign("UNITPRICE", $unitprice);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/PriceBookListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/PriceBookListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/PriceBookListView.php Mon Mar 20 04:00:52 2006
@@ -78,7 +78,7 @@
if($uitype[$i] == 56)
$str=" pricebookcf.".$column[$i]." = 1";
else
- $str=" pricebookcf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" pricebookcf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
// $search_query .= ' and '.$str;
$url_string .="&".$column[$i]."=".$customfield[$i];
@@ -88,15 +88,15 @@
if (isset($bookname) && $bookname !='')
{
- array_push($where_clauses, "bookname like ".PearDatabase::quote($bookname.'%'));
- //$search_query .= " and productname like '".$productname."%'";
+ array_push($where_clauses, "bookname ".$adb->getLike()." ".PearDatabase::quote($bookname.'%'));
+ //$search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&bookname=".$bookname;
}
if (isset($active) && $active !='')
{
array_push($where_clauses, "active = 1");
- //$search_query .= " and productcode like '".$productcode."%'";
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&active=".$active;
}
$where = "";
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/Product.php Mon Mar 20 04:00:52 2006
@@ -99,9 +99,9 @@
function get_attachments($id)
{
- $query = "select notes.title,'Notes ' ActivityType, notes.filename, attachments.type FileType,crm2.modifiedtime lastmodified, seattachmentsrel.attachmentsid attachmentsid, notes.notesid crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
+ $query = "select notes.title,'Notes ' AS ActivityType, notes.filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, seattachmentsrel.attachmentsid AS attachmentsid, notes.notesid AS crmid from notes inner join senotesrel on senotesrel.notesid= notes.notesid inner join crmentity on crmentity.crmid= senotesrel.crmid inner join crmentity crm2 on crm2.crmid=notes.notesid and crm2.deleted=0 left join seattachmentsrel on seattachmentsrel.crmid =notes.notesid left join attachments on seattachmentsrel.attachmentsid = attachments.attachmentsid where crmentity.crmid=".$id;
$query .= ' union all ';
- $query .= "select attachments.description title ,'Attachments' ActivityType, attachments.name filename, attachments.type FileType,crm2.modifiedtime lastmodified, attachments.attachmentsid attachmentsid, seattachmentsrel.attachmentsid crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
+ $query .= "select attachments.description AS title ,'Attachments' AS ActivityType, attachments.name AS filename, attachments.type AS FileType,crm2.modifiedtime AS lastmodified, attachments.attachmentsid AS attachmentsid, seattachmentsrel.attachmentsid AS crmid from attachments inner join seattachmentsrel on seattachmentsrel.attachmentsid= attachments.attachmentsid inner join crmentity on crmentity.crmid= seattachmentsrel.crmid inner join crmentity crm2 on crm2.crmid=attachments.attachmentsid where crmentity.crmid=".$id;
renderRelatedAttachments($query,$id);
}
@@ -158,7 +158,7 @@
}
function product_novendor()
{
- $query = "SELECT products.productname,crmentity.deleted from products inner join crmentity on crmentity.crmid=products.productid where crmentity.deleted=0 and products.vendor_id=''";
+ $query = "SELECT products.productname,crmentity.deleted from products inner join crmentity on crmentity.crmid=products.productid where crmentity.deleted=0 and products.vendor_id is null";
$result=$this->db->query($query);
return $this->db->num_rows($result);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorListView.php Mon Mar 20 04:00:52 2006
@@ -79,7 +79,7 @@
if($uitype[$i] == 56)
$str=" vendorcf.".$column[$i]." = 1";
else
- $str="vendorcf.".$column[$i]." like '$customfield[$i]%'";
+ $str="vendorcf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
// $search_query .= ' and '.$str;
$url_string .="&".$column[$i]."=".$customfield[$i];
@@ -89,72 +89,72 @@
if (isset($vendorname) && $vendorname !='')
{
- array_push($where_clauses, "vendorname like ".PearDatabase::quote($vendorname.'%'));
- //$search_query .= " and productname like '".$productname."%'";
+ array_push($where_clauses, "vendorname ".$adb->getLike()." ".PearDatabase::quote($vendorname.'%'));
+ //$search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&vendorname=".$vendorname;
}
if (isset($email) && $email !='')
{
array_push($where_clauses, "email =".PearDatabase::quote($email));
- //$search_query .= " and productcode like '".$productcode."%'";
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&email=".$email;
}
if (isset($category) && $category !='')
{
- array_push($where_clauses, "category like ".PearDatabase::quote($category.'%'));
- //$search_query .= " and productcode like '".$productcode."%'";
+ array_push($where_clauses, "category ".$adb->getLike()." ".PearDatabase::quote($category.'%'));
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&category=".$category;
}
/* if (isset($commissionrate) && $commissionrate !='')
{
- array_push($where_clauses, "commissionrate like ".PearDatabase::quote($commissionrate.'%'));
- //$search_query .= " and commissionrate like '".$commissionrate."%'";
+ array_push($where_clauses, "commissionrate ".$adb->getLike()." ".PearDatabase::quote($commissionrate.'%'));
+ //$search_query .= " and commissionrate ".$adb->getLike()." '".$commissionrate."%'";
$url_string .= "&commissionrate=".$commissionrate;
}
if (isset($qtyperunit) && $qtyperunit !='')
{
- array_push($where_clauses, "qty_per_unit like ".PearDatabase::quote($qtyperunit.'%'));
- //$search_query .= " and qty_per_unit like '".$qtyperunit."%'";
+ array_push($where_clauses, "qty_per_unit ".$adb->getLike()." ".PearDatabase::quote($qtyperunit.'%'));
+ //$search_query .= " and qty_per_unit ".$adb->getLike()." '".$qtyperunit."%'";
$url_string .= "&qtyperunit=".$qtyperunit;
}
if (isset($unitprice) && $unitprice !='')
{
- array_push($where_clauses, "unit_price like ".PearDatabase::quote($unitprice.'%'));
- // $search_query .= " and unit_price like '".$unitprice."%'";
+ array_push($where_clauses, "unit_price ".$adb->getLike()." ".PearDatabase::quote($unitprice.'%'));
+ // $search_query .= " and unit_price ".$adb->getLike()." '".$unitprice."%'";
$url_string .= "&unitprice=".$unitprice;
}
if (isset($manufacturer) && $manufacturer !='' && $manufacturer !='--None--')
{
- array_push($where_clauses, "manufacturer like ".PearDatabase::quote($manufacturer.'%'));
- //$search_query .= " and manufacturer like '".$manufacturer."%'";
+ array_push($where_clauses, "manufacturer ".$adb->getLike()." ".PearDatabase::quote($manufacturer.'%'));
+ //$search_query .= " and manufacturer ".$adb->getLike()." '".$manufacturer."%'";
$url_string .= "&manufacturer=".$manufacturer;
}
if (isset($productcategory) && $productcategory !='' && $productcategory !='--None--')
{
- array_push($where_clauses, "productcategory like ".PearDatabase::quote($productcategory.'%'));
- //$search_query .= " and productcategory like '".$productcategory."%'";
+ array_push($where_clauses, "productcategory ".$adb->getLike()." ".PearDatabase::quote($productcategory.'%'));
+ //$search_query .= " and productcategory ".$adb->getLike()." '".$productcategory."%'";
$url_string .= "&productcategory=".$productcategory;
}
if (isset($start_date) && $start_date !='')
{
- array_push($where_clauses, "start_date like ".PearDatabase::quote($start_date.'%'));
+ array_push($where_clauses, "start_date ".$adb->getLike()." ".PearDatabase::quote($start_date.'%'));
//$search_query .= " and start_date = '".$start_date."%'";
$url_string .= "&start_date=".$start_date;
}
if (isset($expiry_date) && $expiry_date !='')
{
- array_push($where_clauses, "expiry_date like ".PearDatabase::quote($expiry_date.'%'));
+ array_push($where_clauses, "expiry_date ".$adb->getLike()." ".PearDatabase::quote($expiry_date.'%'));
//$search_query .= " and expiry_date = '".$expiry_date."%'";
$url_string .= "&expiry_date=".$expiry_date;
}
if (isset($purchase_date) && $purchase_date !='')
{
- array_push($where_clauses, "purchase_date like ".PearDatabase::quote($purchase_date.'%'));
+ array_push($where_clauses, "purchase_date ".$adb->getLike()." ".PearDatabase::quote($purchase_date.'%'));
//$search_query .= " and purchase_date = '".$purchase_date."%'";
$url_string .= "&purchase_date=".$purchase_date;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorPopup.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorPopup.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Products/VendorPopup.php Mon Mar 20 04:00:52 2006
@@ -81,7 +81,7 @@
if($uitype[$i] == 56)
$str=" vendorcf.".$column[$i]." = 1";
else
- $str="vendorcf.".$column[$i]." like '$customfield[$i]%'";
+ $str="vendorcf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
// $search_query .= ' and '.$str;
$url_string .="&".$column[$i]."=".$customfield[$i];
@@ -91,22 +91,22 @@
if (isset($vendorname) && $vendorname !='')
{
- array_push($where_clauses, "vendorname like ".PearDatabase::quote($vendorname.'%'));
- //$search_query .= " and productname like '".$productname."%'";
+ array_push($where_clauses, "vendorname ".$adb->getLike()." ".PearDatabase::quote($vendorname.'%'));
+ //$search_query .= " and productname ".$adb->getLike()." '".$productname."%'";
$url_string .= "&vendorname=".$vendorname;
}
if (isset($companyname) && $companyname !='')
{
- array_push($where_clauses, "company_name like ".PearDatabase::quote($companyname.'%'));
- //$search_query .= " and productcode like '".$productcode."%'";
+ array_push($where_clauses, "company_name ".$adb->getLike()." ".PearDatabase::quote($companyname.'%'));
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&companyname=".$companyname;
}
if (isset($category) && $category !='')
{
- array_push($where_clauses, "category like ".PearDatabase::quote($category.'%'));
- //$search_query .= " and productcode like '".$productcode."%'";
+ array_push($where_clauses, "category ".$adb->getLike()." ".PearDatabase::quote($category.'%'));
+ //$search_query .= " and productcode ".$adb->getLike()." '".$productcode."%'";
$url_string .= "&category=".$category;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/CreatePDF.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/CreatePDF.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/CreatePDF.php Mon Mar 20 04:00:52 2006
@@ -350,7 +350,7 @@
$this->SetFont('');
//Data
$fill=0;
- foreach($ivData as $key=>$value)
+ if($ivData) foreach($ivData as $key=>$value)
{
$this->Cell(38,6,$value['productname'],0,0,'L',0);
$this->Cell(38,6,$value['qty'],0,0,'L',0);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Delete.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Delete.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Delete.php Mon Mar 20 04:00:52 2006
@@ -37,12 +37,12 @@
}
elseif($_REQUEST['return_module'] == "Potentials")
{
- $relation_query = "UPDATE quotes set potentialid='' where quoteid=".$_REQUEST['record'];
+ $relation_query = "UPDATE quotes set potentialid=null where quoteid=".$_REQUEST['record'];
$adb->query($relation_query);
}
elseif($_REQUEST['return_module'] == "Contacts")
{
- $relation_query = "UPDATE quotes set contactid='' where quoteid=".$_REQUEST['record'];
+ $relation_query = "UPDATE quotes set contactid=null where quoteid=".$_REQUEST['record'];
$adb->query($relation_query);
}
elseif($_REQUEST['return_module'] == "Products")
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/ListView.php Mon Mar 20 04:00:52 2006
@@ -79,7 +79,7 @@
if($uitype[$i] == 56)
$str=" quotescf.".$column[$i]." = 1";
else
- $str=" quotescf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" quotescf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -88,23 +88,23 @@
if(isset($subject) && $subject != "")
{
- array_push($where_clauses, "quotes.subject like ".PearDatabase::quote($subject."%"));
+ array_push($where_clauses, "quotes.subject ".$adb->getLike()." ".PearDatabase::quote($subject."%"));
$url_string .= "&subject=".$subject;
}
if(isset($potentialname) && $potentialname != "")
{
- array_push($where_clauses, "potential.potentialname like ".PearDatabase::quote("%".$potentialname."%"));
+ array_push($where_clauses, "potential.potentialname ".$adb->getLike()." ".PearDatabase::quote("%".$potentialname."%"));
$url_string .= "&potentialname=".$potentialname;
}
if(isset($accountname) && $accountname != "")
{
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote("%".$accountname."%"));
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote("%".$accountname."%"));
$url_string .= "&accountname=".$accountname;
}
if(isset($quotestage) && $quotestage != "")
{
- array_push($where_clauses, "quotes.quotestage like ".PearDatabase::quote("%".$quotestage."%"));
+ array_push($where_clauses, "quotes.quotestage ".$adb->getLike()." ".PearDatabase::quote("%".$quotestage."%"));
$url_string .= ""estage=".$quotestage;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Popup.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Popup.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Popup.php Mon Mar 20 04:00:52 2006
@@ -88,7 +88,7 @@
if($uitype[$i] == 56)
$str=" quotescf.".$column[$i]." = 1";
else
- $str=" quotescf.".$column[$i]." like '$customfield[$i]%'";
+ $str=" quotescf.".$column[$i]." ".$adb->getLike()." '$customfield[$i]%'";
array_push($where_clauses, $str);
$url_string .="&".$column[$i]."=".$customfield[$i];
}
@@ -97,18 +97,18 @@
if(isset($subject) && $subject != "")
{
- array_push($where_clauses, "quotes.subject like ".PearDatabase::quote($subject."%"));
+ array_push($where_clauses, "quotes.subject ".$adb->getLike()." ".PearDatabase::quote($subject."%"));
$url_string .= "&subject=".$subject;
}
if(isset($accountname) && $accountname != "")
{
- array_push($where_clauses, "account.accountname like ".PearDatabase::quote("%".$accountname."%"));
+ array_push($where_clauses, "account.accountname ".$adb->getLike()." ".PearDatabase::quote("%".$accountname."%"));
$url_string .= "&accountname=".$accountname;
}
if(isset($quotestage) && $quotestage != "")
{
- array_push($where_clauses, "quotes.quotestage like ".PearDatabase::quote("%".$quotestage."%"));
+ array_push($where_clauses, "quotes.quotestage ".$adb->getLike()." ".PearDatabase::quote("%".$quotestage."%"));
$url_string .= ""estage=".$quotestage;
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Quote.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Quote.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Quotes/Quote.php Mon Mar 20 04:00:52 2006
@@ -179,7 +179,7 @@
}
function get_activities($id)
{
- $query = "SELECT contactdetails.contactid, contactdetails.lastname, contactdetails.firstname, activity.*,seactivityrel.*,crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name,recurringevents.recurringtype from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid = cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and ( activity.status is NULL || activity.status != 'Completed' ) and ( activity.eventstatus is NULL || activity.eventstatus != 'Held')";
+ $query = "SELECT contactdetails.contactid, contactdetails.lastname, contactdetails.firstname, activity.*,seactivityrel.*,crmentity.crmid, crmentity.smownerid, crmentity.modifiedtime, users.user_name,recurringevents.recurringtype from activity inner join seactivityrel on seactivityrel.activityid=activity.activityid inner join crmentity on crmentity.crmid=activity.activityid left join cntactivityrel on cntactivityrel.activityid= activity.activityid left join contactdetails on contactdetails.contactid = cntactivityrel.contactid left join users on users.id=crmentity.smownerid left outer join recurringevents on recurringevents.activityid=activity.activityid where seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and ( activity.status is NULL OR activity.status != 'Completed' ) and ( activity.eventstatus is NULL OR activity.eventstatus != 'Held')";
renderRelatedActivities($query,$id);
}
function get_history($id)
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Reports/PopulateReports.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Reports/PopulateReports.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Reports/PopulateReports.php Mon Mar 20 04:00:52 2006
@@ -413,8 +413,8 @@
{
global $adb;
$sql = "INSERT INTO reportfolder ";
- $sql .= "(FOLDERID,FOLDERNAME,DESCRIPTION,STATE) ";
- $sql .= "VALUES ('','".$fldrname."','".$fldrdescription."','SAVED')";
+ $sql .= "(FOLDERNAME,DESCRIPTION,STATE) ";
+ $sql .= "VALUES ('".$fldrname."','".$fldrdescription."','SAVED')";
$result = $adb->query($sql);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Reports/ReportRun.php Mon Mar 20 04:00:52 2006
@@ -65,7 +65,9 @@
$querycolumns = $this->getEscapedColumns($selectedfields);
if($querycolumns == "")
{
- $columnslist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." '".$selectedfields[2]."'";
+ // mysql my need quotes around the alias I'm not sure
+ // $columnslist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." as '".$selectedfields[2]."'";
+ $columnslist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." as ".$selectedfields[2]."";
}else
{
$columnslist[$fieldcolname] = $querycolumns;
@@ -173,7 +175,7 @@
function getAdvComparator($comparator,$value)
{
- global $vtlog;
+ global $adb, $vtlog;
if($comparator == "e")
{
@@ -197,15 +199,15 @@
}
if($comparator == "s")
{
- $rtvalue = " like ".PearDatabase::quote($value."%");
+ $rtvalue = " ".$adb->getLike()." ".PearDatabase::quote($value."%");
}
if($comparator == "c")
{
- $rtvalue = " like ".PearDatabase::quote("%".$value."%");
+ $rtvalue = " ".$adb->getLike()." ".PearDatabase::quote("%".$value."%");
}
if($comparator == "k")
{
- $rtvalue = " not like ".PearDatabase::quote("%".$value."%");
+ $rtvalue = " not ".$adb->getLike()." ".PearDatabase::quote("%".$value."%");
}
if($comparator == "l")
{
@@ -296,7 +298,7 @@
{
if($datefilter == "custom")
{
- if($startdate != "0000-00-00" && $enddate != "0000-00-00")
+ if($startdate && $startdate != "0000-00-00" && $enddate && $enddate != "0000-00-00")
{
$selectedfields = explode(":",$fieldcolname);
$stdfilterlist[$fieldcolname] = $selectedfields[0].".".$selectedfields[1]." between '".$startdate."' and '".$enddate."'";
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Reports.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Reports.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Reports.php Mon Mar 20 04:00:52 2006
@@ -963,8 +963,8 @@
global $modules;
global $vtlog;
- $ssql = "select relcriteria.* from report inner join selectquery on relcriteria.queryid = report.queryid";
- $ssql.= " left join relcriteria on relcriteria.queryid = selectquery.queryid";
+ $ssql = "select relcriteria.* from report inner join selectquery on selectquery.queryid = report.queryid";
+ $ssql.= " left join relcriteria on relcriteria.queryid = report.queryid";
$ssql.= " where report.reportid =".$reportid." order by relcriteria.columnindex";
$result = $adb->query($ssql);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Reports/Save.php Mon Mar 20 04:00:52 2006
@@ -36,17 +36,17 @@
//<<<<<<<reportmodules>>>>>>>>>
//<<<<<<<report>>>>>>>>>
-$reportname = $_REQUEST["reportName"];
-$reportdescription = $_REQUEST["reportDesc"];
-$reporttype = $_REQUEST["reportType"];
-$folderid = $_REQUEST["folder"];
+$reportname = $adb->database->qstr($_REQUEST["reportName"]);
+$reportdescription = $adb->database->qstr($_REQUEST["reportDesc"]);
+$reporttype = $adb->database->qstr($_REQUEST["reportType"]);
+$folderid = $adb->database->qstr($_REQUEST["folder"]);
//<<<<<<<report>>>>>>>>>
//<<<<<<<standarfilters>>>>>>>>>
$stdDateFilterField = $_REQUEST["stdDateFilterField"];
$stdDateFilter = $_REQUEST["stdDateFilter"];
-$startdate = $_REQUEST["startdate"];
-$enddate = $_REQUEST["enddate"];
+$startdate = $adb->database->DBTimeStamp($_REQUEST["startdate"]);
+$enddate = $adb->database->DBTimeStamp($_REQUEST["enddate"]);
//<<<<<<<standardfilters>>>>>>>>>
//<<<<<<<columnstototal>>>>>>>>>>
@@ -117,7 +117,7 @@
if($genQueryId != "")
{
$ireportsql = "insert into report (REPORTID,FOLDERID,REPORTNAME,DESCRIPTION,REPORTTYPE,QUERYID,STATE)";
- $ireportsql .= " values (".$genQueryId.",".$folderid.",'".$reportname."','".$reportdescription."','".$reporttype."',".$genQueryId.",'CUSTOM')";
+ $ireportsql .= " values (".$genQueryId.",".$folderid.",".$reportname.",".$reportdescription.",".$reporttype.",".$genQueryId.",'CUSTOM')";
$ireportresult = $adb->query($ireportsql);
$vtlog->logthis("Reports :: Save->Successfully saved report","info");
if($ireportresult!=false)
@@ -148,7 +148,7 @@
//<<<<step3 reportsortcol>>>>>>>
//<<<<step5 standarfilder>>>>>>>
- $ireportmodulesql = "insert into reportdatefilter (DATEFILTERID,DATECOLUMNNAME,DATEFILTER,STARTDATE,ENDDATE) values (".$genQueryId.",'".$stdDateFilterField."','".$stdDateFilter."','".$startdate."','".$enddate."')";
+ $ireportmodulesql = "insert into reportdatefilter (DATEFILTERID,DATECOLUMNNAME,DATEFILTER,STARTDATE,ENDDATE) values (".$genQueryId.",'".$stdDateFilterField."','".$stdDateFilter."',".$startdate.",".$enddate.")";
$ireportmoduleresult = $adb->query($ireportmodulesql);
$vtlog->logthis("Reports :: Save->Successfully saved reportdatefilter","info");
//<<<<step5 standarfilder>>>>>>>
@@ -254,7 +254,7 @@
//echo $idelreportsortcolsql;
//<<<<step5 standarfilder>>>>>>>
- $ireportmodulesql = "insert into reportdatefilter (DATEFILTERID,DATECOLUMNNAME,DATEFILTER,STARTDATE,ENDDATE) values (".$reportid.",'".$stdDateFilterField."','".$stdDateFilter."','".$startdate."','".$enddate."')";
+ $ireportmodulesql = "insert into reportdatefilter (DATEFILTERID,DATECOLUMNNAME,DATEFILTER,STARTDATE,ENDDATE) values (".$reportid.",'".$stdDateFilterField."','".$stdDateFilter."',".$startdate.",".$enddate.")";
$ireportmoduleresult = $adb->query($ireportmodulesql);
$vtlog->logthis("Reports :: Save->Successfully saved reportdatefilter","info");
//<<<<step5 standarfilder>>>>>>>
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Settings/DeleteCustomField.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Settings/DeleteCustomField.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Settings/DeleteCustomField.php Mon Mar 20 04:00:52 2006
@@ -19,15 +19,15 @@
$uitype = $_REQUEST["uitype"];
//Deleting the CustomField from the Custom Field Table
-$query='delete from field where fieldid="'.$id.'"';
+$query="delete from field where fieldid='".$id."'";
$adb->query($query);
//Deleting from profile2field table
-$query='delete from profile2field where fieldid="'.$id.'"';
+$query="delete from profile2field where fieldid='".$id."'";
$adb->query($query);
//Deleting from def_org_field table
-$query='delete from def_org_field where fieldid="'.$id.'"';
+$query="delete from def_org_field where fieldid='".$id."'";
$adb->query($query);
//Dropping the column in the module table
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Settings/UpdateComboValues.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Settings/UpdateComboValues.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Settings/UpdateComboValues.php Mon Mar 20 04:00:52 2006
@@ -34,8 +34,10 @@
{
if($custom)
$query = "insert into ".$tableName." values('".$pickArray[$i]."')";
- else
- $query = "insert into ".$tableName." values('','".$pickArray[$i]."',".$i.",1)";
+ else {
+ $id = $adb->getUniqueID($tableName);
+ $query = "insert into ".$tableName." values($id,'".$pickArray[$i]."',".$i.",1)";
+ }
$adb->query($query);
}
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/ListView.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/ListView.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/ListView.php Mon Mar 20 04:00:52 2006
@@ -66,21 +66,22 @@
$where_clauses = Array();
- if(isset($last_name) && $last_name != "") array_push($where_clauses, "last_name like ".PearDatabase::quote($last_name.'%')."");
- if(isset($first_name) && $first_name != "") array_push($where_clauses, "first_name like ".PearDatabase::quote($first_name.'%')."");
- if(isset($user_name) && $user_name != "") array_push($where_clauses, "user_name like ".PearDatabase::quote($user_name.'%')."");
+ $adb->checkConnection();
+ if(isset($last_name) && $last_name != "") array_push($where_clauses, "last_name ".$adb->getLike()." ".PearDatabase::quote($last_name.'%')."");
+ if(isset($first_name) && $first_name != "") array_push($where_clauses, "first_name ".$adb->getLike()." ".PearDatabase::quote($first_name.'%')."");
+ if(isset($user_name) && $user_name != "") array_push($where_clauses, "user_name ".$adb->getLike()." ".PearDatabase::quote($user_name.'%')."");
if(isset($status) && $status != "") array_push($where_clauses, "status = ".PearDatabase::quote($status)."");
if(isset($is_admin) && $is_admin != "") array_push($where_clauses, "is_admin = ".PearDatabase::quote($is_admin)."");
- if(isset($phone) && $phone != "") array_push($where_clauses, "(phone_home like ".PearDatabase::quote('%'.$phone.'%')." OR phone_mobile like ".PearDatabase::quote('%'.$phone.'%')." OR phone_work like ".PearDatabase::quote('%'.$phone.'%')." OR phone_other like ".PearDatabase::quote('%'.$phone.'%')." OR phone_fax like ".PearDatabase::quote('%'.$phone.'%').")");
- if(isset($email) && $email != "") array_push($where_clauses, "(users.email1 like ".PearDatabase::quote($email.'%')." OR users.email2 like ".PearDatabase::quote($email.'%').")");
- if(isset($yahoo_id) && $yahoo_id != "") array_push($where_clauses, "yahoo_id like ".PearDatabase::quote($yahoo_id.'%')."");
- if(isset($department) && $department != "") array_push($where_clauses, "department like ".PearDatabase::quote($department.'%')."");
- if(isset($title) && $title != "") array_push($where_clauses, "title like ".PearDatabase::quote($title.'%')."");
- if(isset($address_street) && $address_street != "") array_push($where_clauses, "address_street like ".PearDatabase::quote($address_street.'%')."");
- if(isset($address_city) && $address_city != "") array_push($where_clauses, "address_city like ".PearDatabase::quote($address_city.'%')."");
- if(isset($address_state) && $address_state != "") array_push($where_clauses, "address_state like ".PearDatabase::quote($address_state.'%')."");
- if(isset($address_postalcode) && $address_postalcode != "") array_push($where_clauses, "address_postalcode like ".PearDatabase::quote($address_postalcode.'%')."");
- if(isset($address_country) && $address_country != "") array_push($where_clauses, "address_country like ".PearDatabase::quote($address_country.'%')."");
+ if(isset($phone) && $phone != "") array_push($where_clauses, "(phone_home ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%')." OR phone_mobile ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%')." OR phone_work ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%')." OR phone_other ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%')." OR phone_fax ".$adb->getLike()." ".PearDatabase::quote('%'.$phone.'%').")");
+ if(isset($email) && $email != "") array_push($where_clauses, "(users.email1 ".$adb->getLike()." ".PearDatabase::quote($email.'%')." OR users.email2 ".$adb->getLike()." ".PearDatabase::quote($email.'%').")");
+ if(isset($yahoo_id) && $yahoo_id != "") array_push($where_clauses, "yahoo_id ".$adb->getLike()." ".PearDatabase::quote($yahoo_id.'%')."");
+ if(isset($department) && $department != "") array_push($where_clauses, "department ".$adb->getLike()." ".PearDatabase::quote($department.'%')."");
+ if(isset($title) && $title != "") array_push($where_clauses, "title ".$adb->getLike()." ".PearDatabase::quote($title.'%')."");
+ if(isset($address_street) && $address_street != "") array_push($where_clauses, "address_street ".$adb->getLike()." ".PearDatabase::quote($address_street.'%')."");
+ if(isset($address_city) && $address_city != "") array_push($where_clauses, "address_city ".$adb->getLike()." ".PearDatabase::quote($address_city.'%')."");
+ if(isset($address_state) && $address_state != "") array_push($where_clauses, "address_state ".$adb->getLike()." ".PearDatabase::quote($address_state.'%')."");
+ if(isset($address_postalcode) && $address_postalcode != "") array_push($where_clauses, "address_postalcode ".$adb->getLike()." ".PearDatabase::quote($address_postalcode.'%')."");
+ if(isset($address_country) && $address_country != "") array_push($where_clauses, "address_country ".$adb->getLike()." ".PearDatabase::quote($address_country.'%')."");
$where = "";
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/LoginHistory.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/LoginHistory.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/LoginHistory.php Mon Mar 20 04:00:52 2006
@@ -98,16 +98,16 @@
function user_login(&$usname,&$usip,&$intime)
{
//print("GS --> intime=".$intime);
- $query = "Insert into loginhistory values ('','$usname','$usip','',".$this->db->formatDate($intime).",'Signedin')";
+ $query = "Insert into loginhistory (user_name, user_ip, logout_time, login_time, status) values ('$usname','$usip',null,".$this->db->formatDate($intime).",'Signedin')";
$result = $this->db->query($query)
- or die("MySQL error: ".mysql_error());
+ or die("SQL error: ".$this->db->database->ErrorMsg());
return $result;
}
function user_logout(&$usname,&$usip,&$outtime)
{
- $logid_qry = "SELECT max(login_id) login_id from loginhistory where user_name='$usname' and user_ip='$usip'";
+ $logid_qry = "SELECT max(login_id) as login_id from loginhistory where user_name='$usname' and user_ip='$usip'";
$result = $this->db->query($logid_qry);
//if($this->db->num_rows($result) !=1 ) return;
$loginid = $this->db->query_result($result,0,"login_id");
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveProfile.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveProfile.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveProfile.php Mon Mar 20 04:00:52 2006
@@ -15,7 +15,8 @@
$profilename = $_REQUEST['profileName'];
$parentProfileId= $_REQUEST['parentProfileId'];
//Inserting values into Profile Table
-$sql1 = "insert into profile values('','".$profilename."')";
+$id = $adb->getUniqueID('profile');
+$sql1 = "insert into profile (profileid, profilename) values($id,'".$profilename."')";
$adb->query($sql1);
//Retreiving the profileid
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveRole.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveRole.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/SaveRole.php Mon Mar 20 04:00:52 2006
@@ -25,7 +25,7 @@
}
else
{
- $sql1 = "insert into role values('','".$rolename."','')";
+ $sql1 = "insert into role (name) values('".$rolename."')";
$adb->query($sql1);
//Retreiving the profileid
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/Security.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/Security.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/Security.php Mon Mar 20 04:00:52 2006
@@ -43,28 +43,28 @@
$table_name="user2role";
$table_name="role2tab";
- $this->db->query("INSERT INTO tab VALUES (3,'Home',0,1,'Home','','',1)");
- $this->db->query("INSERT INTO tab VALUES (7,'Leads',0,4,'Leads','','',1)");
- $this->db->query("INSERT INTO tab VALUES (6,'Accounts',0,5,'Accounts','','',1)");
- $this->db->query("INSERT INTO tab VALUES (4,'Contacts',0,6,'Contacts','','',1)");
- $this->db->query("INSERT INTO tab VALUES (2,'Potentials',0,7,'Potentials','','',1)");
- $this->db->query("INSERT INTO tab VALUES (8,'Notes',0,9,'Notes','','',1)");
- $this->db->query("INSERT INTO tab VALUES (9,'Activities',0,3,'Activities','','',1)");
- $this->db->query("INSERT INTO tab VALUES (10,'Emails',0,10,'Emails','','',1)");
- $this->db->query("INSERT INTO tab VALUES (13,'HelpDesk',0,11,'HelpDesk','','',1)");
- $this->db->query("INSERT INTO tab VALUES (14,'Products',0,8,'Products','','',1)");
- $this->db->query("INSERT INTO tab VALUES (1,'Dashboard',0,12,'Dashboards','','',1)");
- $this->db->query("INSERT INTO tab VALUES (15,'Faq',2,14,'Faq','','',1)");
- $this->db->query("INSERT INTO tab VALUES (16,'Events',2,13,'Events','','',1)");
- $this->db->query("INSERT INTO tab VALUES (17,'Calendar',0,2,'Calendar','','',1)");
- $this->db->query("INSERT INTO tab VALUES (18,'Vendor',2,15,'Vendor','','',1)");
- $this->db->query("INSERT INTO tab VALUES (19,'PriceBook',2,16,'PriceBook','','',1)");
- $this->db->query("INSERT INTO tab VALUES (20,'Quotes',0,17,'Quotes','','',1)");
- $this->db->query("INSERT INTO tab VALUES (21,'Orders',0,18,'Orders','','',1)");
- $this->db->query("INSERT INTO tab VALUES (22,'SalesOrder',2,19,'SalesOrder','','',1)");
- $this->db->query("INSERT INTO tab VALUES (23,'Invoice',0,20,'Invoice','','',1)");
- $this->db->query("INSERT INTO tab VALUES (24,'Rss',0,21,'Rss','','',1)");
- $this->db->query("INSERT INTO tab VALUES (25,'Reports',0,22,'Reports','','',1)");
+ $this->db->query("INSERT INTO tab VALUES (3,'Home',0,1,'Home',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (7,'Leads',0,4,'Leads',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (6,'Accounts',0,5,'Accounts',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (4,'Contacts',0,6,'Contacts',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (2,'Potentials',0,7,'Potentials',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (8,'Notes',0,9,'Notes',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (9,'Activities',0,3,'Activities',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (10,'Emails',0,10,'Emails',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (13,'HelpDesk',0,11,'HelpDesk',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (14,'Products',0,8,'Products',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (1,'Dashboard',0,12,'Dashboards',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (15,'Faq',2,14,'Faq',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (16,'Events',2,13,'Events',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (17,'Calendar',0,2,'Calendar',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (18,'Vendor',2,15,'Vendor',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (19,'PriceBook',2,16,'PriceBook',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (20,'Quotes',0,17,'Quotes',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (21,'Orders',0,18,'Orders',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (22,'SalesOrder',2,19,'SalesOrder',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (23,'Invoice',0,20,'Invoice',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (24,'Rss',0,21,'Rss',null,null,1)");
+ $this->db->query("INSERT INTO tab VALUES (25,'Reports',0,22,'Reports',null,null,1)");
//Account Details -- START
//Block1
$this->db->query("insert into field values (6,".$this->db->getUniqueID("field").",'accountname','account',1,'2','accountname','Account Name',1,0,0,100,1,1,1,'V~M')");
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/User.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/User.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/User.php Mon Mar 20 04:00:52 2006
@@ -478,7 +478,11 @@
{
global $mod_strings;
- $query = "SELECT user_name from users where user_name='$this->user_name' AND id<>'$this->id' AND deleted=0";
+ if('' == $this->id) {
+ $query = "SELECT user_name from users where user_name='$this->user_name' AND deleted=0";
+ } else {
+ $query = "SELECT user_name from users where user_name='$this->user_name' AND id<>'$this->id' AND deleted=0";
+ }
$result =$this->db->query($query, true, "Error selecting possible duplicate users: ");
$dup_users = $this->db->fetchByAssoc($result);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/UserInfoUtil.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/UserInfoUtil.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/UserInfoUtil.php Mon Mar 20 04:00:52 2006
@@ -571,6 +571,7 @@
global $adb;
$sqldelete = "delete from activitygrouprelation where activityid=".$activityid;
$adb->query($sqldelete);
+ if($groupname == '') return;
$sql = "insert into activitygrouprelation values (".$activityid .",'" .$groupname ."')";
$adb->query($sql);
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/massdelete.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/massdelete.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/massdelete.php Mon Mar 20 04:00:52 2006
@@ -25,7 +25,8 @@
$storearray = explode(";",$idlist);
foreach($storearray as $id)
{
- $sql="update crmentity set crmentity.deleted=1 where crmentity.crmid='" .$id ."'";
+ if('' == $id) continue;
+ $sql="update crmentity set deleted=1 where crmid='" .$id ."'";
$result = $adb->query($sql);
}
if(isset($_REQUEST['smodule']) && ($_REQUEST['smodule']!=''))
Modified: vtigercrm/branches/4.2_postgresql_integration/modules/Users/saveemailtemplate.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/modules/Users/saveemailtemplate.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/modules/Users/saveemailtemplate.php Mon Mar 20 04:00:52 2006
@@ -27,13 +27,14 @@
$vtlog->logthis("the body is ".$body,'debug');
if ($body !='')
{
- $body = to_html($body);
+ $body = $adb->database->qstr(to_html($body));
+ $description = $adb->database->qstr($description);
$vtlog->logthis("the body value is set ",'info');
}
if(isset($templateid) && $templateid !='')
{
$vtlog->logthis("the templateid is set",'info');
- $sql = "update emailtemplates set foldername = '".$folderName."', templatename ='".$templateName."', subject ='".$subject."', description ='".$description."', body ='".$body."' where templateid =".$templateid;
+ $sql = "update emailtemplates set foldername = '".$folderName."', templatename ='".$templateName."', subject ='".$subject."', description =".$description.", body =".$body." where templateid =".$templateid;
$adb->query($sql);
$vtlog->logthis("about to invoke the detailviewemailtemplate file",'info');
@@ -41,7 +42,7 @@
}
else
{
- $sql = "insert into emailtemplates values ('". $folderName. "','".$templateName."','".$subject."','".$description."','".$body."',0,".$db->getUniqueID('emailtemplates').")";
+ $sql = "insert into emailtemplates values ('". $folderName. "','".$templateName."','".$subject."',".$description.".$body.",0,".$db->getUniqueID('emailtemplates').")";
$adb->query($sql);
$vtlog->logthis("added to the db the emailtemplate",'info');
Modified: vtigercrm/branches/4.2_postgresql_integration/schema/DatabaseSchema.xml
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/schema/DatabaseSchema.xml (original)
+++ vtigercrm/branches/4.2_postgresql_integration/schema/DatabaseSchema.xml Mon Mar 20 04:00:52 2006
@@ -160,7 +160,7 @@
<opt>Type=InnoDB</opt> <index name="Tab_IDX0">
<col>modifiedby</col>
</index>
- <index name="tabid">
+ <index name="tab_tabid">
<col>tabid</col>
</index>
<data>
@@ -225,7 +225,7 @@
<index name="fieldname">
<col>fieldname</col>
</index>
- <index name="tabid">
+ <index name="field_tabid">
<col>tabid</col>
<col>block</col>
<col>displaytype</col>
@@ -726,7 +726,6 @@
<DEFAULT value="0"/>
</field>
<field name="contact_id" type="I" size="19">
- <KEY/>
<DEFAULT value="0"/>
</field>
@@ -808,10 +807,10 @@
<opt>Type=InnoDB</opt> <index name="Potential_IDX0">
<col>accountid</col>
</index>
- <index name="potentialid">
+ <index name="potential_potentialid">
<col>potentialid</col>
</index>
- <index name="sales_stage">
+ <index name="potentail_sales_stage">
<col>sales_stage</col>
</index>
<opt>Type=InnoDB</opt>
@@ -845,7 +844,7 @@
<field name="amount" type="N"></field>
<field name="stage" type="C" size="100"></field>
- <field name="probability" type="N" size="2.3"></field>
+ <field name="probability" type="N" size="7.3"></field>
<field name="expectedrevenue" type="N"></field>
<field name="closedate" type="D"></field>
<field name="lastmodified" type="T">
@@ -916,7 +915,6 @@
</field>
<field name="date_start" type="D">
- <NOTNULL/>
</field>
<field name="due_date" type="D">
</field>
@@ -945,7 +943,7 @@
<col>activityid</col>
<col>subject</col>
</index>
- <index name="activitytype">
+ <index name="activity_activitytype">
<col>activitytype</col>
<col>date_start</col>
</index>
@@ -957,10 +955,10 @@
<col>date_start</col>
<col>time_start</col>
</index>
- <index name="eventstatus">
+ <index name="activity_eventstatus">
<col>eventstatus</col>
</index>
- <index name="status">
+ <index name="activity_status">
<col>status</col>
<col>eventstatus</col>
</index>
@@ -1003,7 +1001,7 @@
</field>
<opt>Type=InnoDB</opt>
- <index name="attachmentsid">
+ <index name="attachments_attachmentsid">
<col>attachmentsid</col>
</index>
<index name="description">
@@ -1044,7 +1042,7 @@
<opt>Type=InnoDB</opt> <index name="SeAttachmentsRel_IDX1">
<col>crmid</col>
</index>
- <index name="attachmentsid">
+ <index name="seattachmentsrel_attachmentsid">
<col>attachmentsid</col>
<col>crmid</col>
</index>
@@ -1180,7 +1178,7 @@
<field name="start_date" type="D"></field>
<field name="expiry_date" type="D"></field>
<field name="cost_factor" type="I" size="11"></field>
- <field name="commissionrate" type="N" size="3.3"></field>
+ <field name="commissionrate" type="N" size="7.3"></field>
<field name="commissionmethod" type="C" size="50"></field>
<field name="discontinued" type="I" size="1"></field>
<field name="usageunit" type="C" size="200"></field>
@@ -1582,7 +1580,7 @@
<DEFAULT value="0"/>
</field>
- <field name="dealprobability" type="N" size="2.3">
+ <field name="dealprobability" type="N" size="7.3">
<NOTNULL/>
<DEFAULT value="0"/>
</field>
@@ -1757,7 +1755,7 @@
<index name="troubletickets_IDX0">
<col>ticketid</col>
</index>
- <index name="status">
+ <index name="troubletickets_status">
<col>status</col>
</index>
@@ -1788,6 +1786,7 @@
</field>
<field name="ownertype" type="C" size="10"></field>
<field name="createdtime" type="T" >
+ <DEFTIMESTAMP/>
<NOTNULL/>
</field>
@@ -2034,18 +2033,6 @@
</table>
-
- <table name="seticketsrel" alter="true">
-
- <constraint>ADD CONSTRAINT fk_SeTicketsRel1 FOREIGN KEY (crmid) REFERENCES crmentity(crmid) ON DELETE CASCADE</constraint>
-
- <opt>Type=InnoDB</opt>
-
- <data>
- </data>
- </table>
-
-
<table name="seticketsrel" alter="true">
<constraint>ADD CONSTRAINT fk_SeTicketsRel2 FOREIGN KEY (ticketid) REFERENCES troubletickets(ticketid) ON DELETE CASCADE</constraint>
@@ -2381,6 +2368,7 @@
<field name="faqid" type="I" size="19"></field>
<field name="comments" type="X"></field>
<field name="createdtime" type="T" >
+ <DEFTIMESTAMP/>
<NOTNULL/>
</field>
@@ -3033,7 +3021,7 @@
<DEFAULT value="1"/>
</field>
- <field name="probability" type="N" size="2.3">
+ <field name="probability" type="N" size="7.3">
<DEFAULT value="0"/>
</field>
<opt>Type=InnoDB</opt> <index name="OpportunityStage_UK0">
@@ -3572,7 +3560,7 @@
<NOTNULL/>
<DEFAULT value="0"/>
</field>
- <index name="idx_profile2tab">
+ <index name="profile2tab_profile2tab">
<col>profileid</col>
<col>tabid</col>
</index>
@@ -3607,11 +3595,11 @@
<col>tabid</col>
<col>fieldname</col>
</index>
- <index name="tabid">
+ <index name="profile2field_tabid">
<col>tabid</col>
<col>profileid</col>
</index>
- <index name="visible">
+ <index name="profile2field_visible">
<col>visible</col>
<col>profileid</col>
</index>
@@ -3657,10 +3645,10 @@
<col>tabid</col>
<col>fieldid</col>
</index>
- <index name="tabid">
+ <index name="def_org_field_tabid">
<col>tabid</col>
</index>
- <index name="visible">
+ <index name="def_org_field_visible">
<col>visible</col>
<col>fieldid</col>
</index>
@@ -3793,7 +3781,7 @@
<NOTNULL/>
<DEFAULT value="0"/>
</field>
- <index name="idx_profile2tab">
+ <index name="relatedlists_profile2tab">
<col>relation_id</col>
</index>
@@ -4050,10 +4038,10 @@
<field name="total" type="N" size="11.3"></field>
<field name="accountid" type="I" size="19"></field>
<field name="terms_conditions" type="X"></field>
- <index name="quotestage">
+ <index name="quote_quotestage">
<col>quotestage</col>
</index>
- <index name="potentialid">
+ <index name="quotes_potentialid">
<col>potentialid</col>
</index>
<index name="contactid">
@@ -4076,13 +4064,6 @@
<table name="quotes" alter="true">
<constraint>ADD CONSTRAINT fk_Quotes2 FOREIGN KEY (potentialid) REFERENCES potential(potentialid) ON DELETE CASCADE</constraint>
- <opt>Type=InnoDB</opt>
- <data>
- </data>
- </table>
-
- <table name="quotes" alter="true">
- <constraint>ADD CONSTRAINT fk_Quotes3 FOREIGN KEY (contactid) REFERENCES contactdetails(contactid) ON DELETE CASCADE</constraint>
<opt>Type=InnoDB</opt>
<data>
</data>
@@ -4799,10 +4780,10 @@
<DEFAULT value=""/>
</field>
<field name="startdate" type="D">
- <DEFAULT value=""/>
+ <DEFAULT value="NULL"/>
</field>
<field name="enddate" type="D">
- <DEFAULT value=""/>
+ <DEFAULT value="NULL"/>
</field>
<index name="cvstdfilter_IDX0">
<col>cvid</col>
@@ -4873,6 +4854,7 @@
<table name="selectquery">
<field name="queryid" type="I" size="19">
+ <KEY />
<NOTNULL/>
</field>
<field name="startindex" type="I" size="19">
@@ -5070,10 +5052,10 @@
<DEFAULT value=""/>
</field>
<field name="startdate" type="D">
- <DEFAULT value=""/>
+ <DEFAULT value="NULL"/>
</field>
<field name="enddate" type="D">
- <DEFAULT value=""/>
+ <DEFAULT value="NULL"/>
</field>
<index name="reportdatefilter_IDX0">
<col>datefilterid</col>
Modified: vtigercrm/branches/4.2_postgresql_integration/soap.php
==============================================================================
--- vtigercrm/branches/4.2_postgresql_integration/soap.php (original)
+++ vtigercrm/branches/4.2_postgresql_integration/soap.php Mon Mar 20 04:00:52 2006
@@ -153,10 +153,10 @@
}
function add_contacts_matching_email_address(&$output_list, $email_address, &$seed_contact, &$msi_id)
{
- global $log;
+ global $adb, $log;
$safe_email_address = addslashes($email_address);
- $where = "email1 like '$safe_email_address' OR email2 like '$safe_email_address'";
+ $where = "email1 ".$adb->getLike()." '$safe_email_address' OR email2 ".$adb->getLike()." '$safe_email_address'";
$response = $seed_contact->get_list("first_name, last_name", $where, 0);
$contactList = $response['list'];
More information about the vtigercrm-commits
mailing list