[Vtigercrm-developers] r9397 svn version not installable

Jens Hamisch jens at Strawberry.COM
Tue Sep 12 23:51:58 PDT 2006


Fathi,


there's another issue, I've fixed with my postgres patches:

    In DefaultDataPopulator.php there were some user2group records
    introduced. This is a problem, because there's a layout con-
    straint in the database which requires a user record to be
    existing before a groups records relates to it.

    However users are populated into the database *AFTER* Default-
    DataPopulater has completed.

I don't know if this would also be an issue for mysql. Using PostgreSQL
results in the installation failing at this step.


I've attached my patches to this mail again. Please have a look at 
the diffs for DefaultDataPopulator.php and 5createtables.inc.php. Those
contain the according patches.


Jens



On Tue, Sep 12, 2006 at 06:14:27PM +0200, Fathi Boudra wrote:
> Le mardi 12 septembre 2006 11:26, Jens Hamisch a écrit :
> > there's a syntax error in modules/Users/User.php in all revisions
> > up to 9426 ('-' in the first column of line 925). It is fixes with
> > the postgres patches I've posted yesterday.
> 
> tested, not better. I have:
> * apache v2.0.55
> * mysql 5.0.24a
> * php v5.1.6
> 
> tested with 2 browsers:
> * firefox
> * konqueror
> 
> under Debian Sid.
> 
> i use "Populate database with demo data" option. Someone can confirm, this is 
> a local issue ?
> 
> cheers,
> 
> Fathi

-- 

--------------------------------------------------------------------------------
     /
 +##+|##+   STRAWBERRY                     Jens Hamisch
+v#+v v##+  EDV-Systeme GmbH               Managing director
/ v    v\v
| . .  . |  Waldeckstr. 9a                 Car (Voice):  (+49 172) 81 04 162
|     .  |  D-82515 Wolfratshausen         Voice:        (+49 8171) 41805-0
 | .     |                                 Fax:          (+49 8171) 41805-59
 \   .  /   Tel.: (+49 8171) 41805-0       Email:        jens at Strawberry.COM
  \____/    Strawberry at Strawberry.COM      

-------------- next part --------------
*** /home/vtigsvn/tmp/vtiger_crm/include/database/PearDatabase.php	Mon Sep 11 21:19:04 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/include/database/PearDatabase.php	Tue Sep  5 06:50:43 2006
***************
*** 930,949 ****
  
      function getUniqueID($seqname)
      {
- 	global $log;
  	$this->checkConnection();
- 	if( $this->dbType == "pgsql") {
- 	    $keytab = $this->database->MetaPrimaryKeys($seqname);
- 	    if( count( $keytab) > 0) {
- 		$log->info("PearDatabase: Postgres getUniqueID hack: ".$seqname."_".$keytab[0]."_seq");
- 		return $this->database->GenID($seqname."_".$keytab[0]."_seq",1);
- 	    } else {
- 		$log->info("PearDatabase: Problem: getUniqueID but no key for '$seqname'");
- 	    }
- 	}
  	return $this->database->GenID($seqname."_seq",1);
      }
- 
      function get_tables()
      {
  	$this->checkConnection();
--- 930,938 ----
*** /home/vtigsvn/tmp/vtiger_crm/include/database/Postgres8.php	Mon Sep 11 21:20:25 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/include/database/Postgres8.php	Wed Aug 30 06:50:43 2006
***************
*** 124,133 ****
  //return an expanded table field list
  function expandRecord($table,$log)
  {
!     global $adb;
!     $result = "";
!     $subfields = $adb->getColumnNames($table);
  
      //construct an entity string
      for( $i=0; $i<count($subfields); $i++)
      {
--- 124,165 ----
  //return an expanded table field list
  function expandRecord($table,$log)
  {
!     $result = "";
!     $log->info( "Debug: expandRecord");
!     $subfields = array();
  
+     //vtiger_products table
+     if( $table == "vtiger_products" )
+ 	$subfields = array ( "productid", "productname", "productcode", "productcategory", "manufacturer", "product_description", "qty_per_unit", "unit_price", "weight", "pack_size", "sales_start_date", "sales_end_date", "start_date", "expiry_date", "cost_factor", "commissionrate", "commissionmethod", "discontinued", "usageunit", "handler", "contactid", "currency", "reorderlevel", "website", "taxclass", "mfr_part_no", "vendor_part_no", "serialno", "qtyinstock", "productsheet", "qtyindemand", "glacct", "vendor_id", "imagename" );
+ 
+     //vtiger_activity table
+     elseif( $table == "vtiger_activity") 
+ 	$subfields = array ( "activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "time_end", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility" );
+ 
+     //vtiger_notes table
+     elseif( $table == "vtiger_notes")
+ 	$subfields = array ( "notesid", "contact_id", "title", "filename", "notecontent");
+ 
+     //vtiger_faq table
+     elseif( $table == "vtiger_faq")
+ 	$subfields = array ( "id", "product_id", "question", "answer", "category", "status");
+ 
+     //vtiger_profile2field 
+     elseif( $table == "vtiger_profile2field")
+ 	$subfields = array ( "profileid", "tabid", "fieldid", "visible", "readonly");
+ 
+     //vtiger_field 
+     elseif( $table == "vtiger_field")
+ 	$subfields = array ( "tabid", "fieldid", "columnname", "tablename", "generatedtype", "uitype", "fieldname", "fieldlabel", "readonly", "presence", "selected", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quickcreatesequence", "info_type");
+ 
+     //vtiger_activity
+     elseif( $table == "vtiger_activity")
+ 	$subfields = array ( "activityid", "subject", "semodule", "activitytype", "date_start", "due_date", "time_start", "sendnotification", "duration_hours", "duration_minutes", "status", "eventstatus", "priority", "location", "notime", "visibility");
+ 
+     //fields of the requested array still undefined
+     else
+ 	$log->info("function expandRecord: please add structural information for table '".$table."'");
+ 
      //construct an entity string
      for( $i=0; $i<count($subfields); $i++)
      {
--- 372,374 ----
*** /home/vtigsvn/tmp/vtiger_crm/install/5createTables.inc.php	Mon Sep 11 21:20:25 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/install/5createTables.inc.php	Wed Aug 30 06:50:43 2006
***************
*** 1,265 ****
! <?php
! /*********************************************************************************
!  * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
!  * ("License"); You may not use this file except in compliance with the
!  * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
!  * Software distributed under the License is distributed on an  "AS IS"  basis,
!  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
!  * the specific language governing rights and limitations under the License.
!  * The Original Code is: SugarCRM Open Source
!  * The Initial Developer of the Original Code is SugarCRM, Inc.
!  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
!  * All Rights Reserved.
!  * Contributor(s): ______________________________________.
!  ********************************************************************************/
! /*********************************************************************************
!  * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/5createTables.php,v 1.58 2005/04/19 16:57:08 ray Exp $
!  * Description:  Executes a step in the installation process.
!  ********************************************************************************/
! 
! $new_tables = 0;
! 
! require_once('config.php');
! require_once('include/database/PearDatabase.php');
! require_once('include/logging.php');
! require_once('modules/Leads/Lead.php');
! require_once('modules/Contacts/Contact.php');
! require_once('modules/Accounts/Account.php');
! require_once('modules/Potentials/Opportunity.php');
! require_once('modules/Calendar/Activity.php');
! require_once('modules/Notes/Note.php');
! require_once('modules/Emails/Email.php');
! require_once('modules/Users/User.php');
! require_once('modules/Import/ImportMap.php');
! require_once('modules/Import/UsersLastImport.php');
! require_once('modules/Users/LoginHistory.php');
! require_once('data/Tracker.php');
! require_once('include/utils/utils.php');
! require_once('modules/Users/DefaultDataPopulator.php');
! require_once('modules/Users/CreateUserPrivilegeFile.php');
! 
! // load the config_override.php file to provide default user settings
! if (is_file("config_override.php")) {
! 	require_once("config_override.php");
! }
! 
! $db = new PearDatabase();
! 
! $log =& LoggerManager::getLogger('INSTALL');
! 
! function eecho($msg = FALSE) {
! 	if ($useHtmlEntities) {
! 		echo htmlentities(nl2br($msg));
! 	}
! 	else {
! 		echo $msg;
! 	}
! }
! 
! function create_default_users() {
!         global $log, $db;
!         global $admin_email;
!         global $admin_password;
!         global $create_default_user;
!         global $default_user_name;
!         global $default_password;
!         global $default_user_is_admin;
! 
!         // create default admin user
!     	$user = new User();
!         $user->column_fields["last_name"] = 'Administrator';
!         $user->column_fields["user_name"] = 'admin';
!         $user->column_fields["status"] = 'Active';
!         $user->column_fields["is_admin"] = 'on';
!         $user->column_fields["user_password"] = $admin_password;
!         $user->column_fields["tz"] = 'Europe/Berlin';
!         $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
!         $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
!         $user->column_fields["weekstart"] = '1';
!         $user->column_fields["namedays"] = '';
!         $user->column_fields["currency_id"] = 1;
! 	$user->column_fields["date_format"] = 'yyyy-mm-dd';
! 	$user->column_fields["hour_format"] = 'am/pm';
! 	$user->column_fields["start_hour"] = '08:00';
! 	$user->column_fields["end_hour"] = '23:00';
! 	// added by jeri to populate default image and tagcloud for admin	
! 	$user->column_fields["imagename"] = 'shanky.jpg';
!         $user->column_fields["tagcloud"] = '';	
!         $user->column_fields["activity_view"] = 'This Year';	
! 	$user->column_fields["lead_view"] = 'Today';
! 	$user->column_fields["defhomeview"] = 'home_metrics';
!         //added by philip for default default admin emailid
! 	if($admin_email == '')
! 	$admin_email ="admin at vtigeruser.com";
!         $user->column_fields["email1"] = $admin_email;
! 	//to get the role id for standard_user	
! 	$role_query = "select roleid from vtiger_role where rolename='CEO'";
! 	$db->checkConnection();
! 	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
! 	$role_result = $db->query($role_query);
! 	$role_id = $db->query_result($role_result,0,"roleid");
! 	$user->column_fields["roleid"] = $role_id;
! 
!         $user->save("Users");
! 
!         // we need to change the admin user to a fixed id of 1.
!         //$query = "update vtiger_users set id='1' where user_name='$user->user_name'";
!         //$result = $db->query($query, true, "Error updating admin user ID: ");
! 
!         $log->info("Created ".$user->table_name." vtiger_table. for user $user->id");
! 
! 	//Creating the flat files
! 	createUserPrivilegesfile($user->id);
!         createUserSharingPrivilegesfile($user->id);
! 
! 
! 	//Creating the Standard User
!     	$user = new User();
!         $user->column_fields["last_name"] = 'StandardUser';
!         $user->column_fields["user_name"] = 'standarduser';
!         $user->column_fields["is_admin"] = 'off';
!         $user->column_fields["status"] = 'Active';
!         $user->column_fields["user_password"] = 'standarduser';
!         $user->column_fields["tz"] = 'Europe/Berlin';
!         $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
!         $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
!         $user->column_fields["weekstart"] = '1';
!         $user->column_fields["namedays"] = '';
!         $user->column_fields["currency_id"] = 1;
! 	$user->column_fields["date_format"] = 'yyyy-mm-dd';
! 	// added by jeri to populate default image and tagcloud for admin	
! 	$user->column_fields["imagename"] = 'ela.jpg';
!         $user->column_fields["activity_view"] = 'This Year';	
! 	$user->column_fields["lead_view"] = 'Today';
!         $user->column_fields["tagcloud"] = '';	
! 	$user->column_fields["defhomeview"] = 'home_metrics';
!         //added by philip for default default admin emailid
! 	if($admin_email == '')
! 	$std_email ="standarduser at vtigeruser.com";
!         $user->column_fields["email1"] = $std_email;
! 	//to get the role id for standard_user	
! 	$role_query = "select roleid from vtiger_role where rolename='Vice President'";
! 	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
! 	$role_result = $db->query($role_query);
! 	$role_id = $db->query_result($role_result,0,"roleid");
! 	$user->column_fields["roleid"] = $role_id;
! 
! 	$user->save('Users');
! 
! 	//Creating the flat vtiger_files
! 	createUserPrivilegesfile($user->id);
!         createUserSharingPrivilegesfile($user->id);
! 
! 	//Inserting into vtiger_groups table
! 	$db->startTransaction();
! 	$result = $db->query("select groupid from vtiger_groups where groupname='Team Selling';");
! 	$group1_id = $db->query_result($result,0,"groupid");
! 	$result = $db->query("select groupid from vtiger_groups where groupname='Marketing Group';");
! 	$group2_id = $db->query_result($result,0,"groupid");
! 	$result = $db->query("select groupid from vtiger_groups where groupname='Support Group';");
! 	$group3_id = $db->query_result($result,0,"groupid");
! 
! 	$db->query("insert into vtiger_users2group values ('".$group1_id."',2)");
! 	$db->query("insert into vtiger_users2group values ('".$group2_id."',1)");
! 	$db->query("insert into vtiger_users2group values ('".$group2_id."',2)");
! 	$db->query("insert into vtiger_users2group values ('".$group3_id."',2)");
! 	$db->completeTransaction();
! }
! 
! //$startTime = microtime();
! $modules = array("DefaultDataPopulator");
! $focus=0;				
! // tables creation
! //eecho("Creating Core tables: ");
! //$adb->setDebug(true);
! $success = $adb->createTables("schema/DatabaseSchema.xml");
! 
! //Postgres8 fix - create sequences. 
! //   This should be a part of "createTables" however ...
!  if( $adb->dbType == "pgsql" ) {
!      $sequences = array(
! 	"vtiger_role_roleid_seq",
! 	"vtiger_audit_trial_auditid_seq",
! 	"vtiger_datashare_relatedmodules_datashare_relatedmodule_id_seq",
! 	"vtiger_relatedlists_relation_id_seq",
! 	"vtiger_inventory_tandc_id_seq",
! 	"vtiger_customview_cvid_seq",
! 	"vtiger_crmentity_crmid_seq",
! 	"vtiger_seactivityrel_crmid_seq",
! 	"vtiger_selectquery_queryid_seq",
! 	"vtiger_systems_id_seq",
! 	"vtiger_freetags_id_seq",
! 	"vtiger_inventorytaxinfo_taxid_seq",
! 	"vtiger_shippingtaxinfo_taxid_seq",
! 	"vtiger_groups_groupid_seq"
!     );
!  
!      foreach ($sequences as $sequence ) {
!  	$log->info( "Creating sequence ".$sequence);
!  	$adb->query( "CREATE SEQUENCE ".$sequence." INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1;");
!      }
!  }
! 
! 
! // TODO HTML
! if($success==0)
! 	die("Error: Tables not created.  Table creation failed.\n");
! elseif ($success==1)
! 	die("Error: Tables partially created.  Table creation failed.\n");
! 	//eecho("Tables Successfully created.\n");
! 
! // Populate default data
! foreach ($modules as $module ) 
! {
! 	$focus = new $module();
! 	$focus->create_tables();
! }
! 			
! 
! // create and populate combo tables
! require_once('include/PopulateComboValues.php');
! $combo = new PopulateComboValues();
! $combo->create_tables();
! 
! //Writing tab data in flat file
! create_tab_data_file();
! create_parenttab_data_file();
! 
! // Create the default users
! create_default_users();
! 
! // default report population
! require_once('modules/Reports/PopulateReports.php');
! 
! // default customview population
! require_once('modules/CustomView/PopulateCustomView.php');
! 
! 
! // ensure required sequences are created (adodb creates them as needed, but if
! // creation occurs within a transaction we get problems
! $db->getUniqueID("vtiger_crmentity");
! $db->getUniqueID("vtiger_seactivityrel");
! $db->getUniqueID("vtiger_freetags");
! 
! //Master currency population
! //Insert into vtiger_currency vtiger_table
!                $db->query("insert into vtiger_currency_info values(".$db->getUniqueID("vtiger_currency_info").",'$currency_name','$currency_code','$currency_symbol',1,'Active','-11')");
! 
! // populate the db with seed data
! if ($db_populate) {
!         //eecho ("Populate seed data into $db_name");
!         include("install/populateSeedData.php");
!         //eecho ("...<font color=\"00CC00\">done</font><BR><P>\n");
! }
! 
! // populate forums data
! global $log, $db;
! 
! //$endTime = microtime();
! //$deltaTime = microtime_diff($startTime, $endTime);
! 
! 
! // populate calendar data
! 
! //eecho ("total time: $deltaTime seconds.\n");
! ?>
--- 1,294 ----
! <?php
! /*********************************************************************************
!  * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
!  * ("License"); You may not use this file except in compliance with the
!  * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
!  * Software distributed under the License is distributed on an  "AS IS"  basis,
!  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
!  * the specific language governing rights and limitations under the License.
!  * The Original Code is: SugarCRM Open Source
!  * The Initial Developer of the Original Code is SugarCRM, Inc.
!  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
!  * All Rights Reserved.
!  * Contributor(s): ______________________________________.
!  ********************************************************************************/
! /*********************************************************************************
!  * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/5createTables.php,v 1.58 2005/04/19 16:57:08 ray Exp $
!  * Description:  Executes a step in the installation process.
!  ********************************************************************************/
! 
! $new_tables = 0;
! 
! require_once('config.php');
! require_once('include/database/PearDatabase.php');
! require_once('include/logging.php');
! require_once('modules/Leads/Lead.php');
! require_once('modules/Contacts/Contact.php');
! require_once('modules/Accounts/Account.php');
! require_once('modules/Potentials/Opportunity.php');
! require_once('modules/Calendar/Activity.php');
! require_once('modules/Notes/Note.php');
! require_once('modules/Emails/Email.php');
! require_once('modules/Users/User.php');
! require_once('modules/Import/ImportMap.php');
! require_once('modules/Import/UsersLastImport.php');
! require_once('modules/Users/LoginHistory.php');
! require_once('data/Tracker.php');
! require_once('include/utils/utils.php');
! require_once('modules/Users/DefaultDataPopulator.php');
! require_once('modules/Users/CreateUserPrivilegeFile.php');
! 
! // load the config_override.php file to provide default user settings
! if (is_file("config_override.php")) {
! 	require_once("config_override.php");
! }
! 
! $db = new PearDatabase();
! 
! $log =& LoggerManager::getLogger('INSTALL');
! 
! function eecho($msg = FALSE) {
! 	if ($useHtmlEntities) {
! 		echo htmlentities(nl2br($msg));
! 	}
! 	else {
! 		echo $msg;
! 	}
! }
! 
! function create_default_users() {
!         global $log, $db;
!         global $admin_email;
!         global $admin_password;
!         global $create_default_user;
!         global $default_user_name;
!         global $default_password;
!         global $default_user_is_admin;
! 
!         // create default admin user
!     	$user = new User();
!         $user->column_fields["last_name"] = 'Administrator';
!         $user->column_fields["user_name"] = 'admin';
!         $user->column_fields["status"] = 'Active';
!         $user->column_fields["is_admin"] = 'on';
!         $user->column_fields["user_password"] = $admin_password;
!         $user->column_fields["tz"] = 'Europe/Berlin';
!         $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
!         $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
!         $user->column_fields["weekstart"] = '1';
!         $user->column_fields["namedays"] = '';
!         $user->column_fields["currency_id"] = 1;
! 	$user->column_fields["date_format"] = 'yyyy-mm-dd';
! 	$user->column_fields["hour_format"] = 'am/pm';
! 	$user->column_fields["start_hour"] = '08:00';
! 	$user->column_fields["end_hour"] = '23:00';
! 	// added by jeri to populate default image and tagcloud for admin	
! 	$user->column_fields["imagename"] = 'shanky.jpg';
!         $user->column_fields["tagcloud"] = '';	
!         $user->column_fields["activity_view"] = 'This Year';	
! 	$user->column_fields["lead_view"] = 'Today';
! 	$user->column_fields["defhomeview"] = 'home_metrics';
!         //added by philip for default default admin emailid
! 	if($admin_email == '')
! 	$admin_email ="admin at vtigeruser.com";
!         $user->column_fields["email1"] = $admin_email;
! 	//to get the role id for standard_user	
! 	$role_query = "select roleid from vtiger_role where rolename='CEO'";
! 	$db->checkConnection();
! 	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
! 	$role_result = $db->query($role_query);
! 	$role_id = $db->query_result($role_result,0,"roleid");
! 	$user->column_fields["roleid"] = $role_id;
! 
!         $user->save("Users");
! 
!         // we need to change the admin user to a fixed id of 1.
!         //$query = "update vtiger_users set id='1' where user_name='$user->user_name'";
!         //$result = $db->query($query, true, "Error updating admin user ID: ");
! 
!         $log->info("Created ".$user->table_name." vtiger_table. for user $user->id");
! 
! 	//Creating the flat files
! 	createUserPrivilegesfile($user->id);
!         createUserSharingPrivilegesfile($user->id);
! 
! 
! 	//Creating the Standard User
!     	$user = new User();
!         $user->column_fields["last_name"] = 'StandardUser';
!         $user->column_fields["user_name"] = 'standarduser';
!         $user->column_fields["is_admin"] = 'off';
!         $user->column_fields["status"] = 'Active';
!         $user->column_fields["user_password"] = 'standarduser';
!         $user->column_fields["tz"] = 'Europe/Berlin';
!         $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
!         $user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
!         $user->column_fields["weekstart"] = '1';
!         $user->column_fields["namedays"] = '';
!         $user->column_fields["currency_id"] = 1;
! 	$user->column_fields["date_format"] = 'yyyy-mm-dd';
! 	// added by jeri to populate default image and tagcloud for admin	
! 	$user->column_fields["imagename"] = 'ela.jpg';
!         $user->column_fields["activity_view"] = 'This Year';	
! 	$user->column_fields["lead_view"] = 'Today';
!         $user->column_fields["tagcloud"] = '';	
! 	$user->column_fields["defhomeview"] = 'home_metrics';
!         //added by philip for default default admin emailid
! 	if($admin_email == '')
! 	$std_email ="standarduser at vtigeruser.com";
!         $user->column_fields["email1"] = $std_email;
! 	//to get the role id for standard_user	
! 	$role_query = "select roleid from vtiger_role where rolename='Vice President'";
! 	$db->database->SetFetchMode(ADODB_FETCH_ASSOC);
! 	$role_result = $db->query($role_query);
! 	$role_id = $db->query_result($role_result,0,"roleid");
! 	$user->column_fields["roleid"] = $role_id;
! 
!     $user->save('Users');
! 
! 	//Creating the flat vtiger_files
! 	createUserPrivilegesfile($user->id);
!         createUserSharingPrivilegesfile($user->id);
! 
! }
! 
! //$startTime = microtime();
! $modules = array("DefaultDataPopulator");
! $focus=0;				
! // tables creation
! //eecho("Creating Core tables: ");
! //$adb->setDebug(true);
! $success = $adb->createTables("schema/DatabaseSchema.xml");
! 
! //Postgres8 fix - create sequences. 
! //   This should be a part of "createTables" however ...
!  if( $adb->dbType == "pgsql" ) {
!      $sequences = array(
!  	"vtiger_leadsource_seq",
!  	"vtiger_accounttype_seq",
!  	"vtiger_industry_seq",
!  	"vtiger_leadstatus_seq",
!  	"vtiger_rating_seq",
!  	"vtiger_licencekeystatus_seq",
!  	"vtiger_opportunity_type_seq",
!  	"vtiger_salutationtype_seq",
!  	"vtiger_sales_stage_seq",
!  	"vtiger_ticketstatus_seq",
!  	"vtiger_ticketpriorities_seq",
!  	"vtiger_ticketseverities_seq",
!  	"vtiger_ticketcategories_seq",
!  	"vtiger_duration_minutes_seq",
!  	"vtiger_eventstatus_seq",
!  	"vtiger_taskstatus_seq",
!  	"vtiger_taskpriority_seq",
!  	"vtiger_manufacturer_seq",
!  	"vtiger_productcategory_seq",
!  	"vtiger_activitytype_seq",
!  	"vtiger_currency_seq",
!  	"vtiger_faqcategories_seq",
!  	"vtiger_usageunit_seq",
!  	"vtiger_glacct_seq",
!  	"vtiger_quotestage_seq",
!  	"vtiger_carrier_seq",
!  	"vtiger_taxclass_seq",
!  	"vtiger_recurringtype_seq",
!  	"vtiger_faqstatus_seq",
!  	"vtiger_invoicestatus_seq",
!  	"vtiger_postatus_seq",
!  	"vtiger_sostatus_seq",
!  	"vtiger_visibility_seq",
!  	"vtiger_campaigntype_seq",
!  	"vtiger_campaignstatus_seq",
!  	"vtiger_expectedresponse_seq",
!  	"vtiger_status_seq",
!  	"vtiger_activity_view_seq",
!  	"vtiger_lead_view_seq",
!  	"vtiger_date_format_seq",
!  	"vtiger_users_seq",
!  	"vtiger_role_seq",
!  	"vtiger_profile_seq",
!  	"vtiger_field_seq",
!  	"vtiger_def_org_share_seq",
!  	"vtiger_datashare_relatedmodules_seq",
!  	"vtiger_relatedlists_seq",
!  	"vtiger_notificationscheduler_seq",
!  	"vtiger_inventorynotification_seq",
!  	"vtiger_currency_info_seq",
!  	"vtiger_emailtemplates_seq",
!  	"vtiger_inventory_tandc_seq",
!  	"vtiger_selectquery_seq",
!  	"vtiger_customview_seq",
!  	"vtiger_crmentity_seq",
!  	"vtiger_seactivityrel_seq",
!  	"vtiger_freetags_seq",
!  	"vtiger_shippingtaxinfo_seq",
!  	"vtiger_inventorytaxinfo_seq"
!  	);
!  
!      foreach ($sequences as $sequence ) {
!  	$log->info( "Creating sequence ".$sequence);
!  	$adb->query( "CREATE SEQUENCE ".$sequence." INCREMENT BY 1 NO MAXVALUE NO MINVALUE CACHE 1;");
!      }
!  }
! 
! 
! // TODO HTML
! if($success==0)
! 	die("Error: Tables not created.  Table creation failed.\n");
! elseif ($success==1)
! 	die("Error: Tables partially created.  Table creation failed.\n");
! 	//eecho("Tables Successfully created.\n");
! 
! foreach ($modules as $module ) 
! {
! 	$focus = new $module();
! 	$focus->create_tables();
! }
! 			
! 
! // create and populate combo tables
! require_once('include/PopulateComboValues.php');
! $combo = new PopulateComboValues();
! $combo->create_tables();
! 
! //Writing tab data in flat file
! create_tab_data_file();
! create_parenttab_data_file();
! 
! create_default_users();
! 
! // default report population
! require_once('modules/Reports/PopulateReports.php');
! 
! // default customview population
! require_once('modules/CustomView/PopulateCustomView.php');
! 
! 
! // ensure required sequences are created (adodb creates them as needed, but if
! // creation occurs within a transaction we get problems
! $db->getUniqueID("vtiger_crmentity");
! $db->getUniqueID("vtiger_seactivityrel");
! $db->getUniqueID("vtiger_freetags");
! 
! //Master currency population
! //Insert into vtiger_currency vtiger_table
!                $db->query("insert into vtiger_currency_info values(".$db->getUniqueID("vtiger_currency_info").",'$currency_name','$currency_code','$currency_symbol',1,'Active','-11')");
! 
! // populate the db with seed data
! if ($db_populate) {
!         //eecho ("Populate seed data into $db_name");
!         include("install/populateSeedData.php");
!         //eecho ("...<font color=\"00CC00\">done</font><BR><P>\n");
! }
! 
! // populate forums data
! global $log, $db;
! 
! //$endTime = microtime();
! //$deltaTime = microtime_diff($startTime, $endTime);
! 
! 
! // populate calendar data
! 
! //eecho ("total time: $deltaTime seconds.\n");
! ?>
*** /home/vtigsvn/tmp/vtiger_crm/install/4createConfigFile.php	Mon Sep 11 21:20:25 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/install/4createConfigFile.php	Sun Sep 10 06:51:37 2006
***************
*** 49,56 ****
  $release_date = "31 March 2006";
  
  
- if (isset($_REQUEST['db_type'])) $db_type = $_REQUEST['db_type'];
- 
  if (isset($_REQUEST['db_hostname']))
  {
  	if(strpos($_REQUEST['db_hostname'], ":"))
--- 49,54 ----
***************
*** 72,77 ****
--- 70,77 ----
  
  if (isset($_REQUEST['db_name']))$db_name = $_REQUEST['db_name'];
  
+ if (isset($_REQUEST['db_type'])) $db_type = $_REQUEST['db_type'];
+ 
  if (isset($_REQUEST['db_drop_tables'])) $db_drop_tables = $_REQUEST['db_drop_tables'];
  
  if (isset($_REQUEST['db_create'])) $db_create = $_REQUEST['db_create'];
*** /home/vtigsvn/tmp/vtiger_crm/modules/Potentials/Opportunity.php	Fri Aug 25 21:00:49 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Potentials/Opportunity.php	Fri Aug 25 06:50:46 2006
***************
*** 276,282 ****
  		else
  			$returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name, vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_potential on vtiger_potential.potentialid=vtiger_seactivityrel.crmid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid where vtiger_seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and vtiger_crment!
 ity.deleted=0 and ((vtiger_activity.status is not NULL AND vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Deferred') or (vtiger_activity.eventstatus != '' AND  vtiger_activity.eventstatus != 'Held'))";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('Potentials','Calendar',$focus,$query,$button,$returnset);
  
--- 276,282 ----
  		else
  			$returnset = '&return_module=Potentials&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name, vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_potential on vtiger_potential.potentialid=vtiger_seactivityrel.crmid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid where vtiger_seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and vtiger_crment!
 ity.deleted=0 and ((vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Deferred') or (vtiger_activity.eventstatus != '' &&  vtiger_activity.eventstatus != 'Held'))";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('Potentials','Calendar',$focus,$query,$button,$returnset);
  
*** /home/vtigsvn/tmp/vtiger_crm/modules/Leads/Lead.php	Fri Aug 25 21:00:49 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Leads/Lead.php	Fri Aug 25 06:50:46 2006
***************
*** 24,29 ****
--- 24,30 ----
  require_once('modules/Emails/Email.php');
  require_once('include/ComboUtil.php');
  require_once('include/utils/utils.php');
+ require_once('user_privileges/default_module_view.php');
  
  class Lead extends CRMEntity {
  	var $log;
***************
*** 193,199 ****
  	*/
  function get_activities($id)
  {
! 	global $log;
  	$log->debug("Entering get_activities(".$id.") method ...");
  	global $app_strings;
  
--- 194,200 ----
  	*/
  function get_activities($id)
  {
! 	global $log, $singlepane_view;
  	$log->debug("Entering get_activities(".$id.") method ...");
  	global $app_strings;
  
***************
*** 205,215 ****
  		$button .= '<input title="New Task" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';i;this.form.return_module.value=\'Leads\';this.form.activity_mode.value=\'Task\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_TASK'].'">&nbsp;';
  		$button .= '<input title="New Event" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.return_module.value=\'Leads\';this.form.activity_mode.value=\'Events\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_EVENT'].'">&nbsp;</td>';
  	}
! 	$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
  
  
  	// First, get the list of IDs.
! 	$query = "SELECT vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name,vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and ((vtiger_activity.status is not NULL AND vtiger_activity.status != 'Completed') and (vtiger_activity.s!
 tatus is not NULL AND vtiger_activity.status != 'Deferred') or (vtiger_activity.eventstatus !='' AND vtiger_activity.eventstatus != 'Held'))";
  	$log->debug("Exiting get_activities method ...");
  	return  GetRelatedList('Leads','Calendar',$focus,$query,$button,$returnset);
  }
--- 206,219 ----
  		$button .= '<input title="New Task" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';i;this.form.return_module.value=\'Leads\';this.form.activity_mode.value=\'Task\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_TASK'].'">&nbsp;';
  		$button .= '<input title="New Event" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Calendar\';this.form.return_module.value=\'Leads\';this.form.activity_mode.value=\'Events\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_EVENT'].'">&nbsp;</td>';
  	}
! 	if($singlepane_view == 'true')
! 		$returnset = '&return_module=Leads&return_action=DetailView&return_id='.$id;
! 	else
! 		$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
  
  
  	// First, get the list of IDs.
! 	$query = "SELECT vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name,vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and (activitytype='Task' or activitytype='Call' or activitytype='Meeting') and ((vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.st!
 atus is not NULL && vtiger_activity.status != 'Deferred') or (vtiger_activity.eventstatus !='' && vtiger_activity.eventstatus != 'Held'))";
  	$log->debug("Exiting get_activities method ...");
  	return  GetRelatedList('Leads','Calendar',$focus,$query,$button,$returnset);
  }
***************
*** 220,232 ****
    */
  function get_campaigns($id)
  {
! 	global $log;
  	$log->debug("Entering get_campaigns(".$id.") method ...");
  	global $mod_strings;
  	$focus = new Campaign();
  	$button = '';
  
! 	$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
  	$log->info("Campaign Related List for Lead Displayed");
  	$query = "SELECT vtiger_users.user_name, vtiger_campaign.campaignid, vtiger_campaign.campaignname, vtiger_campaign.campaigntype, vtiger_campaign.campaignstatus, vtiger_campaign.expectedrevenue, vtiger_campaign.closingdate, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_campaign inner join vtiger_campaignleadrel on vtiger_campaignleadrel.campaignid=vtiger_campaign.campaignid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_campaign.campaignid left join vtiger_campaigngrouprelation on vtiger_campaign.campaignid=vtiger_campaigngrouprelation.campaignid left join vtiger_groups on vtiger_groups.groupname=vtiger_campaigngrouprelation.groupname left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid where vtiger_campaignleadrel.leadid=".$id." and vtiger_crmentity.deleted=0";
  
--- 224,240 ----
    */
  function get_campaigns($id)
  {
! 	global $log, $singlepane_view;
  	$log->debug("Entering get_campaigns(".$id.") method ...");
  	global $mod_strings;
  	$focus = new Campaign();
  	$button = '';
  
! 	if($singlepane_view == 'true')
! 		$returnset = '&return_module=Leads&return_action=DetailView&return_id='.$id;
! 	else
! 		$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
! 
  	$log->info("Campaign Related List for Lead Displayed");
  	$query = "SELECT vtiger_users.user_name, vtiger_campaign.campaignid, vtiger_campaign.campaignname, vtiger_campaign.campaigntype, vtiger_campaign.campaignstatus, vtiger_campaign.expectedrevenue, vtiger_campaign.closingdate, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime from vtiger_campaign inner join vtiger_campaignleadrel on vtiger_campaignleadrel.campaignid=vtiger_campaign.campaignid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_campaign.campaignid left join vtiger_campaigngrouprelation on vtiger_campaign.campaignid=vtiger_campaigngrouprelation.campaignid left join vtiger_groups on vtiger_groups.groupname=vtiger_campaigngrouprelation.groupname left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid where vtiger_campaignleadrel.leadid=".$id." and vtiger_crmentity.deleted=0";
  
***************
*** 242,248 ****
  	*/
  function get_emails($id)
  {
! 	global $log;	
  	$log->debug("Entering get_emails(".$id.") method ...");
  	global $mod_strings;
  	require_once('include/RelatedListView.php');
--- 250,256 ----
  	*/
  function get_emails($id)
  {
! 	global $log, $singlepane_view;	
  	$log->debug("Entering get_emails(".$id.") method ...");
  	global $mod_strings;
  	require_once('include/RelatedListView.php');
***************
*** 256,262 ****
  
  		$button .= '<input title="New Email" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Emails\';this.form.email_directing_module.value=\'leads\';this.form.record.value='.$id.';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_EMAIL'].'">&nbsp;';
  	}
! 	$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
  
  	$query ="select vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.semodule, vtiger_activity.activitytype, vtiger_activity.date_start, vtiger_activity.status, vtiger_activity.priority, vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_users on  vtiger_users.id=vtiger_crmentity.smownerid where vtiger_activity.activitytype='Emails' and vtiger_crmentity.deleted=0 and vtiger_seactivityrel.crmid=".$id;
  	$log->debug("Exiting get_emails method ...");
--- 264,273 ----
  
  		$button .= '<input title="New Email" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.return_action.value=\'DetailView\';this.form.module.value=\'Emails\';this.form.email_directing_module.value=\'leads\';this.form.record.value='.$id.';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$mod_strings['LBL_NEW_EMAIL'].'">&nbsp;';
  	}
! 	if($singlepane_view == 'true')
! 		$returnset = '&return_module=Leads&return_action=DetailView&return_id='.$id;
! 	else
! 		$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
  
  	$query ="select vtiger_activity.activityid, vtiger_activity.subject, vtiger_activity.semodule, vtiger_activity.activitytype, vtiger_activity.date_start, vtiger_activity.status, vtiger_activity.priority, vtiger_crmentity.crmid,vtiger_crmentity.smownerid,vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid inner join vtiger_users on  vtiger_users.id=vtiger_crmentity.smownerid where vtiger_activity.activitytype='Emails' and vtiger_crmentity.deleted=0 and vtiger_seactivityrel.crmid=".$id;
  	$log->debug("Exiting get_emails method ...");
***************
*** 342,348 ****
  */
  function get_products($id)
  {
! 	global $log;
  	$log->debug("Entering get_products(".$id.") method ...");
  	require_once('modules/Products/Product.php');
  	global $mod_strings;
--- 353,359 ----
  */
  function get_products($id)
  {
! 	global $log, $singlepane_view;
  	$log->debug("Entering get_products(".$id.") method ...");
  	require_once('modules/Products/Product.php');
  	global $mod_strings;
***************
*** 356,362 ****
  	{
  		$button .= '<input title="New Product" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Leads\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_PRODUCT'].'">&nbsp;';
  	}
! 	$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
  
  	$query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid from vtiger_products inner join vtiger_seproductsrel on vtiger_products.productid = vtiger_seproductsrel.productid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid inner join vtiger_leaddetails on vtiger_leaddetails.leadid = vtiger_seproductsrel.crmid  where vtiger_leaddetails.leadid = '.$id.' and vtiger_crmentity.deleted = 0';
  	$log->debug("Exiting get_products method ...");
--- 367,376 ----
  	{
  		$button .= '<input title="New Product" accessyKey="F" class="button" onclick="this.form.action.value=\'EditView\';this.form.module.value=\'Products\';this.form.return_module.value=\'Leads\';this.form.return_action.value=\'DetailView\'" type="submit" name="button" value="'.$app_strings['LBL_NEW_PRODUCT'].'">&nbsp;';
  	}
! 	if($singlepane_view == 'true')
! 		$returnset = '&return_module=Leads&return_action=DetailView&return_id='.$id;
! 	else
! 		$returnset = '&return_module=Leads&return_action=CallRelatedList&return_id='.$id;
  
  	$query = 'select vtiger_products.productid, vtiger_products.productname, vtiger_products.productcode, vtiger_products.commissionrate, vtiger_products.qty_per_unit, vtiger_products.unit_price, vtiger_crmentity.crmid, vtiger_crmentity.smownerid from vtiger_products inner join vtiger_seproductsrel on vtiger_products.productid = vtiger_seproductsrel.productid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_products.productid inner join vtiger_leaddetails on vtiger_leaddetails.leadid = vtiger_seproductsrel.crmid  where vtiger_leaddetails.leadid = '.$id.' and vtiger_crmentity.deleted = 0';
  	$log->debug("Exiting get_products method ...");
*** /home/vtigsvn/tmp/vtiger_crm/modules/Invoice/Invoice.php	Mon Sep 11 21:20:25 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Invoice/Invoice.php	Sun Sep 10 06:51:37 2006
***************
*** 165,171 ****
  		else
  			$returnset = '&return_module=Invoice&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' a!
 nd vtiger_crmentity.deleted=0 and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Deferred')";
  		$log->debug("Exiting get_activities method ...");
  		return  GetRelatedList('Invoice','Calendar',$focus,$query,$button,$returnset);
  	}
--- 165,171 ----
  		else
  			$returnset = '&return_module=Invoice&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' a!
 nd vtiger_crmentity.deleted=0 and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Deferred')";
  		$log->debug("Exiting get_activities method ...");
  		return  GetRelatedList('Invoice','Calendar',$focus,$query,$button,$returnset);
  	}
*** /home/vtigsvn/tmp/vtiger_crm/modules/Campaigns/ListView.php	Mon Sep 11 21:20:25 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Campaigns/ListView.php	Tue Aug 29 06:50:44 2006
***************
*** 191,196 ****
--- 191,198 ----
       $list_result = $adb->query($list_query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
   else
       $list_result = $adb->query($list_query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);	
+ 	
+ $list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
  
  //mass merge for word templates -- *Raj*17/11
  while($row = $adb->fetch_array($list_result))
*** /home/vtigsvn/tmp/vtiger_crm/modules/SalesOrder/SalesOrder.php	Mon Sep 11 21:20:24 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/SalesOrder/SalesOrder.php	Sun Sep 10 06:51:37 2006
***************
*** 156,162 ****
  		else
  			$returnset = '&return_module=SalesOrder&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' a!
 nd vtiger_crmentity.deleted=0 and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL AND vtiger_activity.status !='Deferred')";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('SalesOrder','Calendar',$focus,$query,$button,$returnset);
  	}
--- 156,162 ----
  		else
  			$returnset = '&return_module=SalesOrder&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' a!
 nd vtiger_crmentity.deleted=0 and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL && vtiger_activity.status !='Deferred')";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('SalesOrder','Calendar',$focus,$query,$button,$returnset);
  	}
*** /home/vtigsvn/tmp/vtiger_crm/modules/Products/ListView.php	Mon Jul 24 19:51:15 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Products/ListView.php	Tue Jul  4 16:33:51 2006
***************
*** 9,15 ****
  *
   ********************************************************************************/
  require_once('include/database/PearDatabase.php');
- require_once('include/database/Postgres8.php');
  require_once('Smarty_setup.php');
  require_once('modules/Products/Product.php');
  require_once('include/ListView/ListView.php');
--- 9,14 ----
***************
*** 16,22 ****
  require_once('include/ComboUtil.php');
  require_once('include/utils/utils.php');
  require_once('modules/CustomView/CustomView.php');
- require_once('include/DatabaseUtil.php');
  
  global $app_strings;
  global $mod_strings;
--- 15,20 ----
***************
*** 120,132 ****
  	$tablename = getTableNameForField('Products',$order_by);
  	$tablename = (($tablename != '')?($tablename."."):'');
  
- 	if( $adb->dbType == "pgsql")
- 	    $list_query .= ' GROUP BY '.$tablename.$order_by;
          $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
  }
  
  //Retreiving the no of rows
! $count_result = $adb->query( mkCountQuery( $list_query));
  $noofrows = $adb->query_result($count_result,0,"count");
  
  //Storing Listview session object
--- 118,128 ----
  	$tablename = getTableNameForField('Products',$order_by);
  	$tablename = (($tablename != '')?($tablename."."):'');
  
          $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
  }
  
  //Retreiving the no of rows
! $count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
  $noofrows = $adb->query_result($count_result,0,"count");
  
  //Storing Listview session object
***************
*** 140,149 ****
  //Retreive the Navigation array
  $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
  
- //Postgres 8 fixes
- if( $adb->dbType == "pgsql")
-     $list_query = fixPostgresQuery( $list_query, $log, 0);
- 
  //modified by rdhital
  $start_rec = $navigation_array['start'];
  $end_rec = $navigation_array['end_val']; 
--- 136,141 ----
***************
*** 155,164 ****
  else
  	$limit_start_rec = $start_rec -1;
  	
! if( $adb->dbType == "pgsql")
!     $list_result = $adb->query($list_query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
! else
!     $list_result = $adb->query($list_query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);
  
  $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
  
--- 147,153 ----
  else
  	$limit_start_rec = $start_rec -1;
  	
! $list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
  
  $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
  
*** /home/vtigsvn/tmp/vtiger_crm/modules/Activities/ListView.php	Sat Jul 29 10:41:25 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Activities/ListView.php	Fri Jul 28 06:50:36 2006
***************
*** 29,35 ****
  require_once('include/utils/utils.php');
  require_once('modules/CustomView/CustomView.php');
  require_once('include/database/PearDatabase.php');
- require_once('include/database/Postgres8.php');
  
  global $app_strings;
  global $list_max_entries_per_page;
--- 29,34 ----
***************
*** 126,139 ****
  	$list_query .= " AND " .$where;
  }
  
! $list_query .= ' GROUP BY vtiger_activity.activityid';
  
  if(isset($order_by) && $order_by != '')
  {
  	if($order_by == 'smownerid')
          {
- 		if( $adb->dbType == "pgsql")
- 		    $list_query .= ',user_name';
                  $list_query .= ' ORDER BY user_name '.$sorder;
          }
          else
--- 125,136 ----
  	$list_query .= " AND " .$where;
  }
  
! $list_query .= ' group by vtiger_activity.activityid';
  
  if(isset($order_by) && $order_by != '')
  {
  	if($order_by == 'smownerid')
          {
                  $list_query .= ' ORDER BY user_name '.$sorder;
          }
          else
***************
*** 141,149 ****
  		$tablename = getTableNameForField('Activities',$order_by);
  		$tablename = (($tablename != '')?($tablename."."):'');
  
! 		if( $adb->dbType == "pgsql")
! 		    $list_query .= ','.$tablename.$order_by;
! 		$list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
  	}
  }
  
--- 138,144 ----
  		$tablename = getTableNameForField('Activities',$order_by);
  		$tablename = (($tablename != '')?($tablename."."):'');
  
!         	$list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
  	}
  }
  
***************
*** 161,169 ****
  
  
  //Retreiving the no of rows
! $count_result = $adb->query("select count(*) as count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
  $noofrows = $adb->num_rows($count_result);
! 										
  //Storing Listview session object
  if($_SESSION['lvs'][$currentModule])
  {
--- 156,164 ----
  
  
  //Retreiving the no of rows
! $count_result = $adb->query("select count(*) count ".substr($list_query, strpos($list_query,'FROM'),strlen($list_query)));
  $noofrows = $adb->num_rows($count_result);
! 
  //Storing Listview session object
  if($_SESSION['lvs'][$currentModule])
  {
***************
*** 175,184 ****
  //Retreive the Navigation array
  $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
  
- //Postgres 8 fixes
- if( $adb->dbType == "pgsql")
-     $list_query = fixPostgresQuery( $list_query, $log, 0);
- 
  // Setting the record count string
  //modified by rdhital
  $start_rec = $navigation_array['start'];
--- 170,175 ----
***************
*** 191,200 ****
  else
  	$limit_start_rec = $start_rec -1;
  	
! if( $adb->dbType == "pgsql")
!     $list_result = $adb->query($list_query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
! else
!     $list_result = $adb->query($list_query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);
  
  $record_string= $app_strings['LBL_SHOWING']." " .$start_rec." - ".$end_rec." " .$app_strings['LBL_LIST_OF'] ." ".$noofrows;
  
--- 182,188 ----
  else
  	$limit_start_rec = $start_rec -1;
  	
! $list_result = $adb->query($list_query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
  
  $record_string= $app_strings['LBL_SHOWING']." " .$start_rec." - ".$end_rec." " .$app_strings['LBL_LIST_OF'] ." ".$noofrows;
  
*** /home/vtigsvn/tmp/vtiger_crm/modules/PurchaseOrder/PurchaseOrder.php	Fri Aug 25 21:00:50 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/PurchaseOrder/PurchaseOrder.php	Fri Aug 25 06:50:46 2006
***************
*** 149,155 ****
  		else
  			$returnset = '&return_module=PurchaseOrder&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid,vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' an!
 d vtiger_crmentity.deleted=0 and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Deferred') ";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('PurchaseOrder','Calendar',$focus,$query,$button,$returnset);
  	}
--- 149,155 ----
  		else
  			$returnset = '&return_module=PurchaseOrder&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.contactid,vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger_groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' an!
 d vtiger_crmentity.deleted=0 and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Deferred') ";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('PurchaseOrder','Calendar',$focus,$query,$button,$returnset);
  	}
*** /home/vtigsvn/tmp/vtiger_crm/modules/Calendar/Appointment.php	Mon Sep 11 22:16:22 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Calendar/Appointment.php	Thu Sep  7 06:50:43 2006
***************
*** 11,17 ****
  require_once('modules/Calendar/CalendarCommon.php');
  require_once('include/utils/CommonUtils.php');
  require_once('include/database/PearDatabase.php');
- require_once('include/database/Postgres8.php');
  require_once('modules/Calendar/Activity.php');
  class Appointment
  {
--- 11,16 ----
***************
*** 56,66 ****
  	
  	function readAppointment($userid, &$from_datetime, &$to_datetime, $view)
  	{
! 		global $current_user,$adb,$log;
  		$shared_ids = getSharedCalendarId($current_user->id);		
  		if(empty($shared_ids))
  			$shared_ids = $current_user->id;
!                 $q= "SELECT vtiger_activity.*, vtiger_crmentity.*, vtiger_activitygrouprelation.groupname FROM vtiger_activity INNER JOIN vtiger_crmentity ON vtiger_activity.activityid = vtiger_crmentity.crmid LEFT JOIN vtiger_recurringevents ON vtiger_activity.activityid=vtiger_recurringevents.activityid LEFT OUTER JOIN vtiger_activitygrouprelation ON vtiger_activitygrouprelation.activityid=vtiger_activity.activityid INNER JOIN vtiger_salesmanactivityrel ON vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_activity.activitytype IN ('Call','Meeting') AND ";
  
                  if(!is_admin($current_user))
                  {
--- 55,65 ----
  	
  	function readAppointment($userid, &$from_datetime, &$to_datetime, $view)
  	{
! 		global $current_user,$adb;
  		$shared_ids = getSharedCalendarId($current_user->id);		
  		if(empty($shared_ids))
  			$shared_ids = $current_user->id;
!                 $q= "select vtiger_activity.*, vtiger_crmentity.*, vtiger_activitygrouprelation.groupname FROM vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid left join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left outer join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid inner join vtiger_salesmanactivityrel on vtiger_salesmanactivityrel.activityid=vtiger_activity.activityid WHERE vtiger_activity.activitytype in ('Call','Meeting') AND ";
  
                  if(!is_admin($current_user))
                  {
***************
*** 73,83 ****
                          $q .= "  ) AND ((vtiger_crmentity.smownerid ='".$current_user->id."' or vtiger_salesmanactivityrel.smid = '".$current_user->id."') or (vtiger_crmentity.smownerid in (".$shared_ids.") or vtiger_salesmanactivityrel.smid in (".$shared_ids.")))";
                  }
                  $q .= " AND vtiger_crmentity.deleted = 0) AND vtiger_recurringevents.activityid is NULL ";
!                 $q .= " GROUP BY vtiger_activity.activityid ORDER by vtiger_activity.date_start,vtiger_activity.time_start";
  		//echo $q;
- 		//Postgres 8 fixes
- 		if( $adb->dbType == "pgsql")
- 		    $q = fixPostgresQuery( $q, $log, 0);
  		$r = $adb->query($q);
                  $n = $adb->getRowCount($r);
                  $a = 0;
--- 72,79 ----
                          $q .= "  ) AND ((vtiger_crmentity.smownerid ='".$current_user->id."' or vtiger_salesmanactivityrel.smid = '".$current_user->id."') or (vtiger_crmentity.smownerid in (".$shared_ids.") or vtiger_salesmanactivityrel.smid in (".$shared_ids.")))";
                  }
                  $q .= " AND vtiger_crmentity.deleted = 0) AND vtiger_recurringevents.activityid is NULL ";
!                 $q .= " group by vtiger_activity.activityid ORDER by vtiger_activity.date_start,vtiger_activity.time_start";
  		//echo $q;
  		$r = $adb->query($q);
                  $n = $adb->getRowCount($r);
                  $a = 0;
*** /home/vtigsvn/tmp/vtiger_crm/modules/Calendar/calendarLayout.php	Mon Sep 11 21:20:24 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Calendar/calendarLayout.php	Fri Sep  8 06:51:27 2006
***************
*** 1334,1341 ****
  			AND vtiger_crmentity.smownerid = ".$current_user->id." 
  		GROUP BY vtiger_activity.activityid 
  		ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
- 		if( $adb->dbType == "pgsql")
- 		    $pending_query = fixPostgresQuery( $pending_query, $log, 0);
  		$res = $adb->query($pending_query);
  		$pending_rows = $adb->num_rows($res);
  	}
--- 1334,1339 ----
***************
*** 1425,1431 ****
   */
  function getTodoList(& $calendar,$start_date,$end_date,$info='')
  {
! 	global $log;
          $Entries = Array();
  	$category = getParentTab();
  	global $adb,$current_user,$mod_strings,$cal_log;
--- 1423,1429 ----
   */
  function getTodoList(& $calendar,$start_date,$end_date,$info='')
  {
! 	global $log;
          $Entries = Array();
  	$category = getParentTab();
  	global $adb,$current_user,$mod_strings,$cal_log;
***************
*** 1453,1460 ****
                  $pending_query = $query." AND (vtiger_activity.status != 'Completed')
                          AND vtiger_crmentity.smownerid = ".$current_user->id."
                  ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
! 		if( $adb->dbType == "pgsql")
! 		    $pending_query = fixPostgresQuery( $pending_query, $log, 0);
                  $res = $adb->query($pending_query);
                  $pending_rows = $adb->num_rows($res);
          }
--- 1451,1458 ----
                  $pending_query = $query." AND (vtiger_activity.status != 'Completed')
                          AND vtiger_crmentity.smownerid = ".$current_user->id."
                  ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
! 		if( $adb->dbType == "pgsql")
!  		    $pending_query = fixPostgresQuery( $pending_query, $log, 0);
                  $res = $adb->query($pending_query);
                  $pending_rows = $adb->num_rows($res);
          }
***************
*** 1462,1469 ****
  	if(!is_admin($current_user))
                  $query .= " AND vtiger_crmentity.smownerid in (".$shared_ids.")";
          $query .= " ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
! 	if( $adb->dbType == "pgsql")
! 	    $query = fixPostgresQuery( $query, $log, 0);
  
          $result = $adb->query($query);
          $rows = $adb->num_rows($result);
--- 1460,1467 ----
  	if(!is_admin($current_user))
                  $query .= " AND vtiger_crmentity.smownerid in (".$shared_ids.")";
          $query .= " ORDER BY vtiger_activity.date_start,vtiger_activity.time_start ASC";
! 	if( $adb->dbType == "pgsql")
!  	    $query = fixPostgresQuery( $query, $log, 0);
  
          $result = $adb->query($query);
          $rows = $adb->num_rows($result);
*** /home/vtigsvn/tmp/vtiger_crm/modules/Quotes/Quote.php	Fri Aug 25 21:00:50 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Quotes/Quote.php	Fri Aug 25 06:50:46 2006
***************
*** 179,185 ****
  		else
  			$returnset = '&return_module=Quotes&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.contactid, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name,vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger!
 _groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL AND vtiger_activity.status != 'Deferred')";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('Quotes','Calendar',$focus,$query,$button,$returnset);
  	}
--- 179,185 ----
  		else
  			$returnset = '&return_module=Quotes&return_action=CallRelatedList&return_id='.$id;
  
! 		$query = "SELECT vtiger_contactdetails.contactid, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_activity.*,vtiger_seactivityrel.*,vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime, vtiger_users.user_name,vtiger_recurringevents.recurringtype from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid= vtiger_activity.activityid left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid left join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_crmentity.crmid left join vtiger!
 _groups on vtiger_groups.groupname=vtiger_activitygrouprelation.groupname where vtiger_seactivityrel.crmid=".$id." and activitytype='Task' and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Completed') and (vtiger_activity.status is not NULL && vtiger_activity.status != 'Deferred')";
  		$log->debug("Exiting get_activities method ...");
  		return GetRelatedList('Quotes','Calendar',$focus,$query,$button,$returnset);
  	}
*** /home/vtigsvn/tmp/vtiger_crm/modules/Quotes/ListView.php	Mon Jul 24 19:51:15 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Quotes/ListView.php	Tue Jul  4 16:33:52 2006
***************
*** 20,30 ****
  require_once('include/logging.php');
  require_once('include/ListView/ListView.php');
  require_once('include/database/PearDatabase.php');
- require_once('include/database/Postgres8.php');
  require_once('include/ComboUtil.php');
  require_once('include/utils/utils.php');
  require_once('modules/CustomView/CustomView.php');
- require_once('include/DatabaseUtil.php');
  
  
  global $app_strings,$list_max_entries_per_page,$currentModule,$theme;
--- 20,28 ----
***************
*** 129,136 ****
  {
  	if($order_by == 'smownerid')
          {
- 		if( $adb->dbType == "pgsql")
- 		    $query .= ' GROUP BY user_name';
                  $query .= ' ORDER BY user_name '.$sorder;
          }
          else
--- 127,132 ----
***************
*** 138,151 ****
  		$tablename = getTableNameForField('Quotes',$order_by);
  		$tablename = (($tablename != '')?($tablename."."):'');
  
- 		if( $adb->dbType == "pgsql")
- 		    $query .= ' GROUP BY '.$tablename.$order_by;
                  $query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
          }
  }
  
  //Retreiving the no of rows
! $count_result = $adb->query( mkCountQuery( $query));
  $noofrows = $adb->query_result($count_result,0,"count");
  
  //Storing Listview session object
--- 134,145 ----
  		$tablename = getTableNameForField('Quotes',$order_by);
  		$tablename = (($tablename != '')?($tablename."."):'');
  
                  $query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
          }
  }
  
  //Retreiving the no of rows
! $count_result = $adb->query("select count(*) count ".substr($query, strpos($query,'FROM'),strlen($query)));
  $noofrows = $adb->query_result($count_result,0,"count");
  
  //Storing Listview session object
***************
*** 159,167 ****
  //Retreive the Navigation array
  $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
  
- //Postgres 8 fixes
- if( $adb->dbType == "pgsql")
-     $query = fixPostgresQuery( $query, $log, 0);
  
  // Setting the record count string
  //modified by rdhital
--- 153,158 ----
***************
*** 175,184 ****
  else
  	$limit_start_rec = $start_rec -1;
  	
! if( $adb->dbType == "pgsql")
!     $list_result = $adb->query($query. " OFFSET ".$limit_start_rec." LIMIT ".$list_max_entries_per_page);
! else
!     $list_result = $adb->query($query. " LIMIT ".$limit_start_rec.",".$list_max_entries_per_page);
  
  $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
  
--- 166,172 ----
  else
  	$limit_start_rec = $start_rec -1;
  	
! $list_result = $adb->query($query. " limit ".$limit_start_rec.",".$list_max_entries_per_page);
  
  $record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$noofrows;
  
*** /home/vtigsvn/tmp/vtiger_crm/modules/Home/index.php	Mon Sep 11 21:20:24 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Home/index.php	Tue Aug 15 06:50:35 2006
***************
*** 249,255 ****
  			if($query !='')
  			$query .= " union all ";
  			//Get the activities assigned to group
! 			$query .= "select vtiger_activity.activityid as id,vtiger_activity.subject as name,vtiger_activitygrouprelation.groupname,'Activities' as Type from vtiger_activity inner join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_activity.activityid inner join vtiger_groups on vtiger_activitygrouprelation.groupname=vtiger_groups.groupname where  vtiger_crmentity.deleted=0 and ((vtiger_activity.eventstatus !='held'and (vtiger_activity.status is null or vtiger_activity.status ='')) or (vtiger_activity.status !='completed' and (vtiger_activity.eventstatus is null or vtiger_activity.eventstatus=''))) and vtiger_activitygrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
  		}
  		if(isPermitted('HelpDesk','index') == "yes")
                  {
--- 249,255 ----
  			if($query !='')
  			$query .= " union all ";
  			//Get the activities assigned to group
! 			$query .= "select vtiger_activity.activityid id,vtiger_activity.subject as name,vtiger_activitygrouprelation.groupname,'Activities' as Type from vtiger_activity inner join vtiger_activitygrouprelation on vtiger_activitygrouprelation.activityid=vtiger_activity.activityid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_activity.activityid inner join vtiger_groups on vtiger_activitygrouprelation.groupname=vtiger_groups.groupname where  vtiger_crmentity.deleted=0 and ((vtiger_activity.eventstatus !='held'and (vtiger_activity.status is null or vtiger_activity.status ='')) or (vtiger_activity.status !='completed' and (vtiger_activity.eventstatus is null or vtiger_activity.eventstatus=''))) and vtiger_activitygrouprelation.groupname is not null and vtiger_groups.groupid in (".$groupids.")";
  		}
  		if(isPermitted('HelpDesk','index') == "yes")
                  {
*** /home/vtigsvn/tmp/vtiger_crm/modules/HelpDesk/Save.php	Mon Sep 11 21:18:50 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/HelpDesk/Save.php	Thu Aug 31 06:50:43 2006
***************
*** 54,60 ****
  		$filepath = $adb->query_result($result,0,'path');
  
  		$new_attachmentid = $adb->getUniqueID("vtiger_crmentity");
! 		$date_var = $adb->formatDate(date('YmdHis'));
  
  		$upload_filepath = decideFilePath();
  
--- 54,60 ----
  		$filepath = $adb->query_result($result,0,'path');
  
  		$new_attachmentid = $adb->getUniqueID("vtiger_crmentity");
! 		$date_var = date('YmdHis');
  
  		$upload_filepath = decideFilePath();
  
***************
*** 64,70 ****
  		fclose($handle);	
  
  		$adb->query("update vtiger_troubletickets set filename=\"$filename\" where ticketid=$focus->id");	
! 		$adb->query("insert into vtiger_crmentity (crmid,setype,createdtime) values('".$new_attachmentid."','HelpDesk Attachment',".$date_var.")");
  
  		$adb->query("insert into vtiger_attachments values(".$new_attachmentid.",'".$filename."','','".$filetype."','".$upload_filepath."')");
  
--- 64,70 ----
  		fclose($handle);	
  
  		$adb->query("update vtiger_troubletickets set filename=\"$filename\" where ticketid=$focus->id");	
! 		$adb->query("insert into vtiger_crmentity (crmid,setype,createdtime) values('".$new_attachmentid."','HelpDesk Attachment','".$date_var."')");
  
  		$adb->query("insert into vtiger_attachments values(".$new_attachmentid.",'".$filename."','','".$filetype."','".$upload_filepath."')");
  
*** /home/vtigsvn/tmp/vtiger_crm/modules/Users/User.php	Mon Sep 11 21:20:24 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Users/User.php	Sun Sep 10 06:51:37 2006
***************
*** 618,624 ****
   	 */
  	function saveentity($module)
  	{
! 		global $current_user;
  		$insertion_mode = $this->mode;
  
  		$this->db->println("TRANS saveentity starts $module");
--- 618,624 ----
   	 */
  	function saveentity($module)
  	{
! 		global $current_user;//$adb added by raju for mass mailing
  		$insertion_mode = $this->mode;
  
  		$this->db->println("TRANS saveentity starts $module");
***************
*** 648,653 ****
--- 648,654 ----
  	{
  		global $log;	
  		$log->info("function insertIntoEntityTable ".$module.' vtiger_table name ' .$table_name);
+ 		global $adb;
  		$insertion_mode = $this->mode;
  
  		//Checkin whether an entry is already is present in the vtiger_table to update
***************
*** 904,910 ****
  		$filesize = $file_details['size'];
  		$filetmp_name = $file_details['tmp_name'];
  		
!  		$current_id = $this->db->getUniqueID("vtiger_crmentity");
  		
  		//get the file path inwhich folder we want to upload the file
  		$upload_file_path = decideFilePath();
--- 905,911 ----
  		$filesize = $file_details['size'];
  		$filetmp_name = $file_details['tmp_name'];
  		
! 		$current_id = $this->db->getUniqueID("vtiger_crmentity");
  		
  		//get the file path inwhich folder we want to upload the file
  		$upload_file_path = decideFilePath();
***************
*** 919,926 ****
  		}
  		if($save_file == 'true')
  		{
  			$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','".$this->column_fields['description']."',".$this->db->formatString("vtiger_crmentity","createdtime",$date_var).",".$this->db->formatString("vtiger_crmentity","modifiedtime",$date_var).")";
! 			$this->db->query($sql1);
  
  			$sql2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(".$current_id.",'".$filename."','".$this->column_fields['description']."','".$filetype."','".$upload_file_path."')";
  			$result=$this->db->query($sql2);
--- 920,928 ----
  		}
  		if($save_file == 'true')
  		{
+ 
  			$sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(".$current_id.",".$current_user->id.",".$ownerid.",'".$module." Attachment','".$this->column_fields['description']."',".$this->db->formatString("vtiger_crmentity","createdtime",$date_var).",".$this->db->formatString("vtiger_crmentity","modifiedtime",$date_var).")";
! - 			$this->db->query($sql1);
  
  			$sql2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(".$current_id.",'".$filename."','".$this->column_fields['description']."','".$filetype."','".$upload_file_path."')";
  			$result=$this->db->query($sql2);
*** /home/vtigsvn/tmp/vtiger_crm/modules/Users/DefaultDataPopulator.php	Mon Sep 11 21:20:24 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Users/DefaultDataPopulator.php	Thu Sep  7 06:50:43 2006
***************
*** 34,40 ****
  	function create_tables () {
  		global $app_strings;
  
- 		$this->db->startTransaction();
  		$role1_id = $this->db->getUniqueID("vtiger_role");
  		$role2_id = $this->db->getUniqueID("vtiger_role");
  		$role3_id = $this->db->getUniqueID("vtiger_role");
--- 34,39 ----
***************
*** 46,51 ****
--- 45,54 ----
  		$profile3_id = $this->db->getUniqueID("vtiger_profile");
  		$profile4_id = $this->db->getUniqueID("vtiger_profile");
  
+ 		$group1_id = $this->db->getUniqueID("vtiger_groups");
+ 		$group2_id = $this->db->getUniqueID("vtiger_groups");
+ 		$group3_id = $this->db->getUniqueID("vtiger_groups");
+ 
                  $this->db->query("insert into vtiger_role values('H".$role1_id."','Organisation','H".$role1_id."',0)");
                  $this->db->query("insert into vtiger_role values('H".$role2_id."','CEO','H".$role1_id."::H".$role2_id."',1)");
                  $this->db->query("insert into vtiger_role values('H".$role3_id."','Vice President','H".$role1_id."::H".$role2_id."::H".$role3_id."',2)");
***************
*** 52,60 ****
                  $this->db->query("insert into vtiger_role values('H".$role4_id."','Sales Manager','H".$role1_id."::H".$role2_id."::H".$role3_id."::H".$role4_id."',3)");
                  $this->db->query("insert into vtiger_role values('H".$role5_id."','Sales Man','H".$role1_id."::H".$role2_id."::H".$role3_id."::H".$role4_id."::H".$role5_id."',4)");
                  
! 		$this->db->completeTransaction();
! 
! 		$this->db->startTransaction();
   $this->db->query("INSERT INTO vtiger_tab VALUES (3,'Home',0,1,'Home',null,null,1)");
   $this->db->query("INSERT INTO vtiger_tab VALUES (7,'Leads',0,4,'Leads',null,null,1)");
   $this->db->query("INSERT INTO vtiger_tab VALUES (6,'Accounts',0,5,'Accounts',null,null,1)");
--- 55,61 ----
                  $this->db->query("insert into vtiger_role values('H".$role4_id."','Sales Manager','H".$role1_id."::H".$role2_id."::H".$role3_id."::H".$role4_id."',3)");
                  $this->db->query("insert into vtiger_role values('H".$role5_id."','Sales Man','H".$role1_id."::H".$role2_id."::H".$role3_id."::H".$role4_id."::H".$role5_id."',4)");
                  
! 
   $this->db->query("INSERT INTO vtiger_tab VALUES (3,'Home',0,1,'Home',null,null,1)");
   $this->db->query("INSERT INTO vtiger_tab VALUES (7,'Leads',0,4,'Leads',null,null,1)");
   $this->db->query("INSERT INTO vtiger_tab VALUES (6,'Accounts',0,5,'Accounts',null,null,1)");
***************
*** 80,89 ****
   $this->db->query("INSERT INTO vtiger_tab VALUES (27,'Portal',0,24,'Portal',null,null,1)");
   $this->db->query("INSERT INTO vtiger_tab VALUES (28,'Webmails',0,25,'Webmails',null,null,1)");
   $this->db->query("insert into vtiger_tab values (29,'Users',0,26,'Users',null,null,1)");
- 	$this->db->completeTransaction();
  
  // Populate the vtiger_blocks vtiger_table
- 		$this->db->startTransaction();
  $this->db->query("insert into vtiger_blocks values (1,2,'LBL_OPPORTUNITY_INFORMATION',1,0,0,0,0,0)");
  $this->db->query("insert into vtiger_blocks values (2,2,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0)");
  $this->db->query("insert into vtiger_blocks values (3,2,'LBL_DESCRIPTION_INFORMATION',3,0,0,0,0,0)");
--- 81,88 ----
***************
*** 168,174 ****
  //Added an extra block for new UI Settings in Campaigns module 
  $this->db->query("insert into vtiger_blocks values (82,26,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0)");
  $this->db->query("insert into vtiger_blocks values (83,29,'LBL_USER_IMAGE_INFORMATION',4,0,0,0,0,0)"); //Added a New Block User Image Info in Users Module
- 	$this->db->completeTransaction();
  
  //
  
--- 167,172 ----
***************
*** 175,181 ****
  //Account Details -- START
   //Block9
  
- 		$this->db->startTransaction();
  $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'accountname','vtiger_account',1,'2','accountname','Account Name',1,0,0,100,1,9,1,'V~M',0,1,'BAS')");	
   $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'phone','vtiger_account',1,'11','phone','Phone',1,0,0,100,2,9,1,'V~O',0,2,'BAS')");	
   $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'website','vtiger_account',1,'17','website','Website',1,0,0,100,3,9,1,'V~O',0,3,'BAS')");	
--- 173,178 ----
***************
*** 914,952 ****
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_state','vtiger_users',1,'1','address_state','State',1,0,0,100,5,81,1,'V~O',1,null,'BAS')");
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_postalcode','vtiger_users',1,'1','address_postalcode','Postal Code',1,0,0,100,4,81,1,'V~O',1,null,'BAS')");
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_country','vtiger_users',1,'1','address_country','Country',1,0,0,100,2,81,1,'V~O',1,null,'BAS')");
  //User Image Information
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'imagename','vtiger_users',1,'105','imagename','User Image',1,0,0,250,10,83,1,'V~O',1,null,'BAS')");
- 	$this->db->completeTransaction();
- 
   //user Details End
  
  
  
                  // Insert End
!                 
  
  		//New Security Start
- 		//Inserting into vtiger_groups table
- 		$this->db->startTransaction();
- 		$group1_id = $this->db->getUniqueID("vtiger_groups");
- 		$group2_id = $this->db->getUniqueID("vtiger_groups");
- 		$group3_id = $this->db->getUniqueID("vtiger_groups");
- 
- 		$this->db->query("insert into vtiger_groups values ('".$group1_id."','Team Selling','Group Related to Sales')");
- 		$this->db->query("insert into vtiger_group2role values ('".$group1_id."','H".$role4_id."')");
- 		$this->db->query("insert into vtiger_group2rs values ('".$group1_id."','H".$role5_id."')");
- 
- 		$this->db->query("insert into vtiger_groups values ('".$group2_id."','Marketing Group','Group Related to Marketing Activities')");
- 		$this->db->query("insert into vtiger_group2role values ('".$group2_id."','H".$role2_id."')");
- 		$this->db->query("insert into vtiger_group2rs values ('".$group2_id."','H".$role3_id."')");
- 
- 		$this->db->query("insert into vtiger_groups values ('".$group3_id."','Support Group','Group Related to providing Support to Customers')");
- 		$this->db->query("insert into vtiger_group2role values ('".$group3_id."','H".$role3_id."')");
- 		$this->db->query("insert into vtiger_group2rs values ('".$group3_id."','H".$role3_id."')");
- 		$this->db->completeTransaction();
- 
  		//Inserting into vtiger_profile vtiger_table
- 		$this->db->startTransaction();
  		$this->db->query("insert into vtiger_profile values ('".$profile1_id."','Administrator','Admin Profile')");	
  		$this->db->query("insert into vtiger_profile values ('".$profile2_id."','Sales Profile','Profile Related to Sales')");
  		$this->db->query("insert into vtiger_profile values ('".$profile3_id."','Support Profile','Profile Related to Support')");
--- 911,944 ----
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_state','vtiger_users',1,'1','address_state','State',1,0,0,100,5,81,1,'V~O',1,null,'BAS')");
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_postalcode','vtiger_users',1,'1','address_postalcode','Postal Code',1,0,0,100,4,81,1,'V~O',1,null,'BAS')");
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_country','vtiger_users',1,'1','address_country','Country',1,0,0,100,2,81,1,'V~O',1,null,'BAS')");
+ 
  //User Image Information
  $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'imagename','vtiger_users',1,'105','imagename','User Image',1,0,0,250,10,83,1,'V~O',1,null,'BAS')");
   //user Details End
  
  
  
                  // Insert End
! 		
! 		//Inserting into vtiger_groups table
! 		$this->db->query("insert into vtiger_groups values ('".$group1_id."','Team Selling','Group Related to Sales')");	
! 		$this->db->query("insert into vtiger_group2role values ('".$group1_id."','H".$role4_id."')");	
! 		$this->db->query("insert into vtiger_group2rs values ('".$group1_id."','H".$role5_id."')");	
! 		$this->db->query("insert into vtiger_users2group values ('".$group1_id."',2)");	
  
+ 		$this->db->query("insert into vtiger_groups values ('".$group2_id."','Marketing Group','Group Related to Marketing Activities')");	
+ 		$this->db->query("insert into vtiger_group2role values ('".$group2_id."','H".$role2_id."')");	
+ 		$this->db->query("insert into vtiger_group2rs values ('".$group2_id."','H".$role3_id."')");	
+ 		$this->db->query("insert into vtiger_users2group values ('".$group2_id."',1)");	
+ 		$this->db->query("insert into vtiger_users2group values ('".$group2_id."',2)");	
+ 
+ 		$this->db->query("insert into vtiger_groups values ('".$group3_id."','Support Group','Group Related to providing Support to Customers')");
+ 		$this->db->query("insert into vtiger_group2role values ('".$group3_id."','H".$role3_id."')");
+ 		$this->db->query("insert into vtiger_group2rs values ('".$group3_id."','H".$role3_id."')");
+ 		$this->db->query("insert into vtiger_users2group values ('".$group3_id."',2)");	
+ 
  		//New Security Start
  		//Inserting into vtiger_profile vtiger_table
  		$this->db->query("insert into vtiger_profile values ('".$profile1_id."','Administrator','Admin Profile')");	
  		$this->db->query("insert into vtiger_profile values ('".$profile2_id."','Sales Profile','Profile Related to Sales')");
  		$this->db->query("insert into vtiger_profile values ('".$profile3_id."','Support Profile','Profile Related to Support')");
***************
*** 1608,1617 ****
  		$this->db->query("insert into vtiger_profile2utility values (".$profile4_id.",14,5,1)");
                  $this->db->query("insert into vtiger_profile2utility values (".$profile4_id.",14,6,1)");
                  $this->db->query("insert into vtiger_profile2utility values (".$profile4_id.",7,9,0)");
- 	$this->db->completeTransaction();
  
  		//Inserting values into org share action mapping
- 		$this->db->startTransaction();
                  $this->db->query("insert into vtiger_org_share_action_mapping values(0,'Public: Read Only')");
                  $this->db->query("insert into vtiger_org_share_action_mapping values(1,'Public: Read, Create/Edit')");
                  $this->db->query("insert into vtiger_org_share_action_mapping values(2,'Public: Read, Create/Edit, Delete')");
--- 1600,1607 ----
***************
*** 1651,1657 ****
                 $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",22,2,0)");
                 $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",23,2,0)");
                 $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",26,2,0)");
- 	$this->db->completeTransaction();
  
  		//Populating the DataShare Related Modules
  
--- 1641,1646 ----
***************
*** 1658,1664 ****
  		//Lead Related Module
  
  		//Account Related Module
- 		$this->db->startTransaction();
  		$this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,2)");
  		$this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,13)");
  		$this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,20)");
--- 1647,1652 ----
***************
*** 1674,1680 ****
  
  		//SO Related Module
  		$this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",22,23)");	
- 	$this->db->completeTransaction();
  
  
  			
--- 1662,1667 ----
***************
*** 1686,1692 ****
  
  	//insert into related list vtiger_table
  	//Inserting for vtiger_account related lists
- 		$this->db->startTransaction();
  	$this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Potentials").",'get_opportunities',1,'Potentials',0)");	
  		
  	$this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Contacts").",'get_contacts',2,'Contacts',0)");
--- 1673,1678 ----
***************
*** 1867,1875 ****
           $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Campaigns").",".getTabid("Leads").",'get_leads',2,'Leads',0)");
  	 $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Campaigns").",".getTabid("Potentials").",'get_opportunities',3,'Potentials',0)");
  	 $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Campaigns").",9,'get_activities',4,'Activities',0)");
- 	$this->db->completeTransaction();
  
- 		$this->db->startTransaction();
                 $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_TASK_NOTIFICATION_DESCRITPION',1,'Task Delay Notification','Tasks delayed beyond 24 hrs ','LBL_TASK_NOTIFICATION')");
  
  
--- 1853,1859 ----
***************
*** 2100,2109 ****
  
  	       
                 $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Thanks Note','Thanks Note','Note of thanks','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")");
- 	$this->db->completeTransaction();
  
  		
- 		$this->db->startTransaction();
  	       //Insert into vtiger_organizationdetails vtiger_table 
  	       $this->db->query("insert into vtiger_organizationdetails(organizationname,address,city,state,country,code,phone,fax,website,logoname) values ('vtiger',' 40-41-42, Sivasundar Apartments, Flat D-II, Shastri Street, Velachery','Chennai','Tamil Nadu','India','600 042','+91-44-5202-1990','+91-44-5202-1990','www.vtiger.com','vtiger-crm-logo.jpg')");
  
--- 2084,2091 ----
***************
*** 2190,2199 ****
  	$this->db->query("insert into vtiger_parenttabrel values (4,9,8)");
  	$this->db->query("insert into vtiger_parenttabrel values (2,8,8)");
  	$this->db->query("insert into vtiger_parenttabrel values (3,9,11)");
- 	$this->db->completeTransaction();
  		
  	//Added to populate the default inventory tax informations
- 	$this->db->startTransaction();
  	$vatid = $this->db->getUniqueID("vtiger_inventorytaxinfo");
  	$salesid = $this->db->getUniqueID("vtiger_inventorytaxinfo");
  	$serviceid = $this->db->getUniqueID("vtiger_inventorytaxinfo");
--- 2172,2179 ----
***************
*** 2218,2224 ****
  	$this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shsalesid decimal(7,3) default NULL");
  	$this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shserviceid decimal(7,3) default NULL");
  
! 	$this->db->completeTransaction();
  	}
  }
  ?>
--- 2198,2204 ----
  	$this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shsalesid decimal(7,3) default NULL");
  	$this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shserviceid decimal(7,3) default NULL");
  
! 
  	}
  }
  ?>
*** /home/vtigsvn/tmp/vtiger_crm/modules/Faq/ListView.php	Mon Sep 11 21:20:24 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/modules/Faq/ListView.php	Tue Aug 29 06:50:44 2006
***************
*** 151,158 ****
  $smarty->assign("BUTTONS",$other_text);
  $smarty->assign("CATEGORY",$category);
  $smarty->assign("SINGLE_MOD",'Note');
- 
  //Retreiving the no of rows
  $count_result = $adb->query( mkCountQuery( $list_query));
  $noofrows = $adb->query_result($count_result,0,"count");
  
--- 151,158 ----
  $smarty->assign("BUTTONS",$other_text);
  $smarty->assign("CATEGORY",$category);
  $smarty->assign("SINGLE_MOD",'Note');
  //Retreiving the no of rows
+ //Retreiving the no of rows
  $count_result = $adb->query( mkCountQuery( $list_query));
  $noofrows = $adb->query_result($count_result,0,"count");
  
*** /home/vtigsvn/tmp/vtiger_crm/themes/blue/style.css	Sat Aug 12 18:15:06 2006
--- /home/vtigsvn/tmp/vtiger_crm_dist/themes/blue/style.css	Sat Aug 12 06:50:57 2006
***************
*** 165,188 ****
  	font-size: 11px;
  }
  
- .level2SelTab{
- 	font-weight:bold;
- 	color:#000000;
- 	padding-left:20px;
- 	padding-right:20px;
- 	padding-top:5px;
- 	padding-bottom:5px;
- 	
- }
- 
- .level2UnSelTab{
- 	color:#000000;
- 	padding-left:20px;
- 	padding-right:20px;
- 	padding-top:5px;
- 	padding-bottom:5px;
- }
- 
  .level2textSel{
  	font-weight:bold;
  	color:#000000;
--- 165,170 ----


More information about the vtigercrm-developers mailing list