[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Users/ -> DefaultDataPopulator.php (source)

   1  <?php
   2  
   3  /* * *******************************************************************************
   4   * * The contents of this file are subject to the vtiger CRM Public License Version 1.0
   5   * ("License"); You may not use this file except in compliance with the License
   6   * The Original Code is:  vtiger CRM Open Source
   7   * The Initial Developer of the Original Code is vtiger.
   8   * Portions created by vtiger are Copyright (C) vtiger.
   9   * All Rights Reserved.
  10   * ****************************************************************************** */
  11  
  12  include_once ('config.php');
  13  require_once ('include/logging.php');
  14  require_once ('include/utils/utils.php');
  15  
  16  /** Class to populate the default required data during installation
  17   */
  18  class DefaultDataPopulator extends CRMEntity {
  19  
  20  	function DefaultDataPopulator() {
  21          $this->log = LoggerManager::getLogger('DefaultDataPopulator');
  22          $this->db = PearDatabase::getInstance();
  23      }
  24  
  25      var $new_schema = true;
  26  
  27      /** Function to populate the default required data during installation
  28       */
  29  	function create_tables() {
  30          global $app_strings;
  31  
  32          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (3,'Home',0,1,'Home',0,1,0,null)");
  33          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (7,'Leads',0,4,'Leads',0,0,1,'Sales')");
  34          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (6,'Accounts',0,5,'Accounts',0,0,1,'Sales')");
  35          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (4,'Contacts',0,6,'Contacts',0,0,1,'Sales')");
  36          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (2,'Potentials',0,7,'Potentials',0,0,1,'Sales')");
  37          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (8,'Documents',0,9,'Documents',0,0,1,'Tools')");
  38          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (9,'Calendar',0,3,'Calendar',0,0,1,'Tools')");
  39          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (10,'Emails',0,10,'Emails',0,1,1,'Tools')");
  40          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (13,'HelpDesk',0,11,'HelpDesk',0,0,1,'Support')");
  41          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (14,'Products',0,8,'Products',0,0,1,'Inventory')");
  42          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (1,'Dashboard',0,12,'Dashboards',0,1,0,'Analytics')");
  43          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (15,'Faq',0,-1,'Faq',0,1,1,'Support')");
  44          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (16,'Events',2,-1,'Events',0,0,1,null)");
  45          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (18,'Vendors',0,-1,'Vendors',0,1,1,'Inventory')");
  46          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (19,'PriceBooks',0,-1,'PriceBooks',0,1,1,'Inventory')");
  47          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (20,'Quotes',0,-1,'Quotes',0,0,1,'Sales')");
  48          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (21,'PurchaseOrder',0,-1,'PurchaseOrder',0,0,1,'Inventory')");
  49          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (22,'SalesOrder',0,-1,'SalesOrder',0,0,1,'Sales')");
  50          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (23,'Invoice',0,-1,'Invoice',0,0,1,'Sales')");
  51          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (24,'Rss',0,-1,'Rss',0,1,0,'Tools')");
  52          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (25,'Reports',0,-1,'Reports',0,1,0,'Analytics')");
  53          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (26,'Campaigns',0,-1,'Campaigns',0,0,1,'Marketing')");
  54          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (27,'Portal',0,-1,'Portal',0,1,0,'Tools')");
  55          $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) VALUES (28,'Webmails',0,-1,'Webmails',0,1,1,null)");
  56          $this->db->query("insert into vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype,parent) values (29,'Users',0,-1,'Users',0,1,0,null)");
  57  
  58          // Populate the vtiger_blocks vtiger_table
  59          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",2,'LBL_OPPORTUNITY_INFORMATION',1,0,0,0,0,0,1,0)");
  60          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",2,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
  61          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",2,'LBL_DESCRIPTION_INFORMATION',3,0,0,0,0,0,1,0)");
  62          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",4,'LBL_CONTACT_INFORMATION',1,0,0,0,0,0,1,0)");
  63          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",4,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
  64          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",4,'LBL_CUSTOMER_PORTAL_INFORMATION',3,0,0,0,0,0,1,0)");
  65          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",4,'LBL_ADDRESS_INFORMATION',4,0,0,0,0,0,1,0)");
  66          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",4,'LBL_DESCRIPTION_INFORMATION',5,0,0,0,0,0,1,0)");
  67          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",6,'LBL_ACCOUNT_INFORMATION',1,0,0,0,0,0,1,0)");
  68          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",6,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
  69          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",6,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)");
  70          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",6,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)");
  71          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",7,'LBL_LEAD_INFORMATION',1,0,0,0,0,0,1,0)");
  72          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",7,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
  73          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",7,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)");
  74          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",7,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)");
  75          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",8,'LBL_NOTE_INFORMATION',1,0,0,0,0,0,1,0)");
  76          $fileblockid = $this->db->getUniqueID('vtiger_blocks');
  77          $this->db->query("insert into vtiger_blocks values (" . $fileblockid . ",8,'LBL_FILE_INFORMATION',3,1,0,0,0,0,1,0)");
  78          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",9,'LBL_TASK_INFORMATION',1,0,0,0,0,0,1,0)");
  79          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",9,'',2,1,0,0,0,0,1,0)");
  80          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",10,'LBL_EMAIL_INFORMATION',1,0,0,0,0,0,1,0)");
  81          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",10,'',2,1,0,0,0,0,1,0)");
  82          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",10,'',3,1,0,0,0,0,1,0)");
  83          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",10,'',4,1,0,0,0,0,1,0)");
  84          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",13,'LBL_TICKET_INFORMATION',1,0,0,0,0,0,1,0)");
  85          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",13,'',2,1,0,0,0,0,1,0)");
  86          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",13,'LBL_CUSTOM_INFORMATION',3,0,0,0,0,0,1,0)");
  87          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",13,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)");
  88          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",13,'LBL_TICKET_RESOLUTION',5,0,0,1,0,0,1,0)");
  89          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",13,'LBL_COMMENTS',6,0,0,1,0,0,1,0)");
  90          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",14,'LBL_PRODUCT_INFORMATION',1,0,0,0,0,0,1,0)");
  91          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",14,'LBL_PRICING_INFORMATION',2,0,0,0,0,0,1,0)");
  92          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",14,'LBL_STOCK_INFORMATION',3,0,0,0,0,0,1,0)");
  93          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",14,'LBL_CUSTOM_INFORMATION',4,0,0,0,0,0,1,0)");
  94          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",14,'LBL_IMAGE_INFORMATION',5,0,0,0,0,0,1,0)");
  95          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",14,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)");
  96          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",15,'LBL_FAQ_INFORMATION',1,0,0,0,0,0,1,0)");
  97          //$this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",15,'',2,1,0,0,0,0,1,0)");
  98          //$this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",15,'',3,1,0,0,0,0,1,0)");
  99          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",15,'LBL_COMMENT_INFORMATION',4,0,0,1,0,0,1,0)");
 100          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",16,'LBL_EVENT_INFORMATION',1,0,0,0,0,0,1,0)");
 101          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",16,'',2,1,0,0,0,0,1,0)");
 102          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",16,'',3,1,0,0,0,0,1,0)");
 103          $vendorbasicinfo = $this->db->getUniqueID('vtiger_blocks');
 104          $this->db->query("insert into vtiger_blocks values (" . $vendorbasicinfo . ",18,'LBL_VENDOR_INFORMATION',1,0,0,0,0,0,1,0)");
 105          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",18,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
 106          $vendoraddressblock = $this->db->getUniqueID('vtiger_blocks');
 107          $this->db->query("insert into vtiger_blocks values (" . $vendoraddressblock . ",18,'LBL_VENDOR_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)");
 108          $vendordescriptionblock = $this->db->getUniqueID('vtiger_blocks');
 109          $this->db->query("insert into vtiger_blocks values (" . $vendordescriptionblock . ",18,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)");
 110          $pricebookbasicblock = $this->db->getUniqueID('vtiger_blocks');
 111          $this->db->query("insert into vtiger_blocks values (" . $pricebookbasicblock . ",19,'LBL_PRICEBOOK_INFORMATION',1,0,0,0,0,0,1,0)");
 112          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",19,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
 113          $pricebookdescription = $this->db->getUniqueID('vtiger_blocks');
 114          $this->db->query("insert into vtiger_blocks values (" . $pricebookdescription . ",19,'LBL_DESCRIPTION_INFORMATION',3,0,0,0,0,0,1,0)");
 115          $quotesbasicblock = $this->db->getUniqueID('vtiger_blocks');
 116          $this->db->query("insert into vtiger_blocks values (" . $quotesbasicblock . ",20,'LBL_QUOTE_INFORMATION',1,0,0,0,0,0,1,0)");
 117          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",20,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
 118          $quotesaddressblock = $this->db->getUniqueID('vtiger_blocks');
 119          $this->db->query("insert into vtiger_blocks values (" . $quotesaddressblock . ",20,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)");
 120          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",20,'LBL_RELATED_PRODUCTS',4,0,0,0,0,0,1,0)");
 121          $quotetermsblock = $this->db->getUniqueID('vtiger_blocks');
 122          $this->db->query("insert into vtiger_blocks values (" . $quotetermsblock . ",20,'LBL_TERMS_INFORMATION',5,0,0,0,0,0,1,0)");
 123          $quotedescription = $this->db->getUniqueID('vtiger_blocks');
 124          $this->db->query("insert into vtiger_blocks values (" . $quotedescription . ",20,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)");
 125          $pobasicblock = $this->db->getUniqueID('vtiger_blocks');
 126          $this->db->query("insert into vtiger_blocks values (" . $pobasicblock . ",21,'LBL_PO_INFORMATION',1,0,0,0,0,0,1,0)");
 127          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",21,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
 128          $poaddressblock = $this->db->getUniqueID('vtiger_blocks');
 129          $this->db->query("insert into vtiger_blocks values (" . $poaddressblock . ",21,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)");
 130          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",21,'LBL_RELATED_PRODUCTS',4,0,0,0,0,0,1,0)");
 131          $potermsblock = $this->db->getUniqueID('vtiger_blocks');
 132          $this->db->query("insert into vtiger_blocks values (" . $potermsblock . ",21,'LBL_TERMS_INFORMATION',5,0,0,0,0,0,1,0)");
 133          $podescription = $this->db->getUniqueID('vtiger_blocks');
 134          $this->db->query("insert into vtiger_blocks values (" . $podescription . ",21,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)");
 135          $sobasicblock = $this->db->getUniqueID('vtiger_blocks');
 136          $this->db->query("insert into vtiger_blocks values (" . $sobasicblock . ",22,'LBL_SO_INFORMATION',1,0,0,0,0,0,1,0)");
 137          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",22,'LBL_CUSTOM_INFORMATION',3,0,0,0,0,0,1,0)");
 138          $soaddressblock = $this->db->getUniqueID('vtiger_blocks');
 139          $this->db->query("insert into vtiger_blocks values (" . $soaddressblock . ",22,'LBL_ADDRESS_INFORMATION',4,0,0,0,0,0,1,0)");
 140          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",22,'LBL_RELATED_PRODUCTS',5,0,0,0,0,0,1,0)");
 141          $sotermsblock = $this->db->getUniqueID('vtiger_blocks');
 142          $this->db->query("insert into vtiger_blocks values (" . $sotermsblock . ",22,'LBL_TERMS_INFORMATION',6,0,0,0,0,0,1,0)");
 143          $sodescription = $this->db->getUniqueID('vtiger_blocks');
 144          $this->db->query("insert into vtiger_blocks values (" . $sodescription . ",22,'LBL_DESCRIPTION_INFORMATION',7,0,0,0,0,0,1,0)");
 145          $invoicebasicblock = $this->db->getUniqueID('vtiger_blocks');
 146          $this->db->query("insert into vtiger_blocks values (" . $invoicebasicblock . ",23,'LBL_INVOICE_INFORMATION',1,0,0,0,0,0,1,0)");
 147          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",23,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
 148          $invoiceaddressblock = $this->db->getUniqueID('vtiger_blocks');
 149          $this->db->query("insert into vtiger_blocks values (" . $invoiceaddressblock . ",23,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)");
 150          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",23,'LBL_RELATED_PRODUCTS',4,0,0,0,0,0,1,0)");
 151          $invoicetermsblock = $this->db->getUniqueID('vtiger_blocks');
 152          $this->db->query("insert into vtiger_blocks values (" . $invoicetermsblock . ",23,'LBL_TERMS_INFORMATION',5,0,0,0,0,0,1,0)");
 153          $invoicedescription = $this->db->getUniqueID('vtiger_blocks');
 154          $this->db->query("insert into vtiger_blocks values (" . $invoicedescription . ",23,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)");
 155          $imageblockid = $this->db->getUniqueID('vtiger_blocks');
 156          $this->db->query("insert into vtiger_blocks values (" . $imageblockid . ",4,'LBL_IMAGE_INFORMATION',6,0,0,0,0,0,1,0)");
 157          $campaignbasicblockid = $this->db->getUniqueID('vtiger_blocks');
 158          $this->db->query("insert into vtiger_blocks values (" . $campaignbasicblockid . ",26,'LBL_CAMPAIGN_INFORMATION',1,0,0,0,0,0,1,0)");
 159          $campaigncustomblock = $this->db->getUniqueID('vtiger_blocks');
 160          $this->db->query("insert into vtiger_blocks values (" . $campaigncustomblock . ",26,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)");
 161          $campaignexpectedandactualsblock = $this->db->getUniqueID('vtiger_blocks');
 162          $this->db->query("insert into vtiger_blocks values (" . $campaignexpectedandactualsblock . ",26,'LBL_EXPECTATIONS_AND_ACTUALS',3,0,0,0,0,0,1,0)");
 163          $userloginandroleblockid = $this->db->getUniqueID('vtiger_blocks');
 164          $this->db->query("insert into vtiger_blocks values (" . $userloginandroleblockid . ",29,'LBL_USERLOGIN_ROLE',1,0,0,0,0,0,1,0)");
 165          $usercurrencyinfoblock = $this->db->getUniqueID('vtiger_blocks');
 166          $this->db->query("insert into vtiger_blocks values (" . $usercurrencyinfoblock . ",29,'LBL_CURRENCY_CONFIGURATION',2,0,0,0,0,0,1,0)");
 167          $usermoreinfoblock = $this->db->getUniqueID('vtiger_blocks');
 168          $this->db->query("insert into vtiger_blocks values (" . $usermoreinfoblock . ",29,'LBL_MORE_INFORMATION',3,0,0,0,0,0,1,0)");
 169          $useraddressblock = $this->db->getUniqueID('vtiger_blocks');
 170          $this->db->query("insert into vtiger_blocks values (" . $useraddressblock . ",29,'LBL_ADDRESS_INFORMATION',4,0,0,0,0,0,1,0)");
 171          //Added an extra block for new UI Settings in Campaigns module
 172          $campaidndescriptionblock = $this->db->getUniqueID('vtiger_blocks');
 173          $this->db->query("insert into vtiger_blocks values (" . $campaidndescriptionblock . ",26,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)");
 174          $userblockid = $this->db->getUniqueID('vtiger_blocks');
 175          $this->db->query("insert into vtiger_blocks values (" . $userblockid . ",29,'LBL_USER_IMAGE_INFORMATION',4,0,0,0,0,0,1,0)"); //Added a New Block User Image Info in Users Module
 176          $useradvanceblock = $this->db->getUniqueID('vtiger_blocks');
 177          $this->db->query("insert into vtiger_blocks values (" . $useradvanceblock . ",29,'LBL_USER_ADV_OPTIONS',5,0,0,0,0,0,1,0)"); //Added a New Block User Image Info in Users Module
 178          //Added block 'File Information' to Documents module
 179          $desc_blockid = $this->db->getUniqueID('vtiger_blocks');
 180          $this->db->query("insert into vtiger_blocks values (" . $desc_blockid . ",8,'LBL_DESCRIPTION',2,0,0,0,0,0,1,0)");
 181          //Added block for storing the Recurring Inovice Informaiton in SalesOrder
 182          $sorecurringinvoiceblock = $this->db->getUniqueID('vtiger_blocks');
 183          $this->db->query("insert into vtiger_blocks values (" . $sorecurringinvoiceblock . ",22,'Recurring Invoice Information',2,0,0,0,0,0,1,0)");
 184          //Added to support custom fields for Calendar
 185          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",9,'LBL_CUSTOM_INFORMATION',3,0,0,0,0,0,1,0)");
 186          $this->db->query("insert into vtiger_blocks values (" . $this->db->getUniqueID('vtiger_blocks') . ",16,'LBL_CUSTOM_INFORMATION',4,0,0,0,0,0,1,0)");
 187  
 188          //Account Details -- START
 189          //Block9
 190  
 191          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'accountname','vtiger_account',1,'2','accountname','Account Name',1,0,'',100,1,9,1,'V~M',0,1,'BAS',0)");
 192          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'account_no','vtiger_account',1,'4','account_no','Account No',1,0,'',100,2,9,1,'V~O',3,null,'BAS',0)");
 193          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'phone','vtiger_account',1,'11','phone','Phone',1,2,'',100,4,9,1,'V~O',2,2,'BAS',1)");
 194          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'website','vtiger_account',1,'17','website','Website',1,2,'',100,3,9,1,'V~O',2,3,'BAS',1)");
 195  
 196          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'fax','vtiger_account',1,'1','fax','Fax',1,2,'',100,6,9,1,'V~O',1,null,'BAS',1)");
 197          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'tickersymbol','vtiger_account',1,'1','tickersymbol','Ticker Symbol',1,2,'',100,5,9,1,'V~O',1,null,'BAS',1)");
 198          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'otherphone','vtiger_account',1,'11','otherphone','Other Phone',1,2,'',100,8,9,1,'V~O',1,null,'ADV',1)");
 199          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'parentid','vtiger_account',1,'51','account_id','Member Of',1,2,'',100,7,9,1,'I~O',1,null,'BAS',0)");
 200          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'email1','vtiger_account',1,'13','email1','Email',1,2,'',100,10,9,1,'E~O',1,null,'BAS',1)");
 201          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'employees','vtiger_account',1,'7','employees','Employees',1,2,'',100,9,9,1,'I~O',1,null,'ADV',1)");
 202          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'email2','vtiger_account',1,'13','email2','Other Email',1,2,'',100,11,9,1,'E~O',1,null,'ADV',1)");
 203  
 204          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'ownership','vtiger_account',1,'1','ownership','Ownership',1,2,'',100,12,9,1,'V~O',1,null,'ADV',1)");
 205          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'rating','vtiger_account',1,'15','rating','Rating',1,2,'',100,14,9,1,'V~O',1,null,'ADV',1)");
 206          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'industry','vtiger_account',1,'15','industry','industry',1,2,'',100,13,9,1,'V~O',1,null,'ADV',1)");
 207          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'siccode','vtiger_account',1,'1','siccode','SIC Code',1,2,'',100,16,9,1,'V~O',1,null,'ADV',1)");
 208          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'account_type','vtiger_account',1,'15','accounttype','Type',1,2,'',100,15,9,1,'V~O',1,null,'ADV',1)");
 209          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'annualrevenue','vtiger_account',1,'71','annual_revenue','Annual Revenue',1,2,'',100,18,9,1,'I~O',1,null,'ADV',1)");
 210          //Added vtiger_field emailoptout for vtiger_accounts -- after 4.2 patch2
 211          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'emailoptout','vtiger_account',1,'56','emailoptout','Email Opt Out',1,2,'',100,17,9,1,'C~O',1,null,'ADV',1)");
 212          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'notify_owner','vtiger_account',1,56,'notify_owner','Notify Owner',1,2,'',10,20,9,1,'C~O',1,NULL,'ADV',1)");
 213          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,19,9,1,'V~M',0,4,'BAS',1)");
 214          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,22,9,2,'DT~O',3,null,'BAS',0)");
 215          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,21,9,2,'DT~O',3,null,'BAS',0)");
 216          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,23,9,3,'V~O',3,null,'BAS',0)");
 217          //Block 11
 218          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'bill_street','vtiger_accountbillads',1,'21','bill_street','Billing Address',1,2,'',100,1,11,1,'V~O',1,null,'BAS',1)");
 219          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'ship_street','vtiger_accountshipads',1,'21','ship_street','Shipping Address',1,2,'',100,2,11,1,'V~O',1,null,'BAS',1)");
 220  
 221          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'bill_city','vtiger_accountbillads',1,'1','bill_city','Billing City',1,2,'',100,5,11,1,'V~O',1,null,'BAS',1)");
 222          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'ship_city','vtiger_accountshipads',1,'1','ship_city','Shipping City',1,2,'',100,6,11,1,'V~O',1,null,'BAS',1)");
 223  
 224          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'bill_state','vtiger_accountbillads',1,'1','bill_state','Billing State',1,2,'',100,7,11,1,'V~O',1,null,'BAS',1)");
 225          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'ship_state','vtiger_accountshipads',1,'1','ship_state','Shipping State',1,2,'',100,8,11,1,'V~O',1,null,'BAS',1)");
 226  
 227          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'bill_code','vtiger_accountbillads',1,'1','bill_code','Billing Code',1,2,'',100,9,11,1,'V~O',1,null,'BAS',1)");
 228          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'ship_code','vtiger_accountshipads',1,'1','ship_code','Shipping Code',1,2,'',100,10,11,1,'V~O',1,null,'BAS',1)");
 229  
 230          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'bill_country','vtiger_accountbillads',1,'1','bill_country','Billing Country',1,2,'',100,11,11,1,'V~O',1,null,'BAS',1)");
 231          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'ship_country','vtiger_accountshipads',1,'1','ship_country','Shipping Country',1,2,'',100,12,11,1,'V~O',1,null,'BAS',1)");
 232  
 233          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'bill_pobox','vtiger_accountbillads',1,'1','bill_pobox','Billing Po Box',1,2,'',100,3,11,1,'V~O',1,null,'BAS',1)");
 234          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'ship_pobox','vtiger_accountshipads',1,'1','ship_pobox','Shipping Po Box',1,2,'',100,4,11,1,'V~O',1,null,'BAS',1)");
 235  
 236          //Block12
 237          $this->db->query("insert into vtiger_field values (6," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,12,1,'V~O',1,null,'BAS',1)");
 238  
 239          //Account Details -- END
 240          //Lead Details --- START
 241          //Block13 -- Start
 242  
 243          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'salutation','vtiger_leaddetails',1,'55','salutationtype','Salutation',1,0,'',100,1,13,3,'V~O',1,null,'BAS',1)");
 244          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'firstname','vtiger_leaddetails',1,'55','firstname','First Name',1,0,'',100,2,13,1,'V~O',2,1,'BAS',1)");
 245          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'lead_no','vtiger_leaddetails',1,'4','lead_no','Lead No',1,0,'',100,3,13,1,'V~O',3,null,'BAS',0)");
 246          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'phone','vtiger_leadaddress',1,'11','phone','Phone',1,2,'',100,5,13,1,'V~O',2,4,'BAS',1)");
 247  
 248          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'lastname','vtiger_leaddetails',1,'255','lastname','Last Name',1,0,'',100,4,13,1,'V~M',0,2,'BAS',1)");
 249          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'mobile','vtiger_leadaddress',1,'1','mobile','Mobile',1,2,'',100,7,13,1,'V~O',1,null,'BAS',1)");
 250          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'company','vtiger_leaddetails',1,'2','company','Company',1,2,'',100,6,13,1,'V~M',2,3,'BAS',1)");
 251          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'fax','vtiger_leadaddress',1,'1','fax','Fax',1,2,'',100,9,13,1,'V~O',1,null,'BAS',1)");
 252          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'designation','vtiger_leaddetails',1,'1','designation','Designation',1,2,'',100,8,13,1,'V~O',1,null,'BAS',1)");
 253          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'email','vtiger_leaddetails',1,'13','email','Email',1,2,'',100,11,13,1,'E~O',2,5,'BAS',1)");
 254          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'leadsource','vtiger_leaddetails',1,'15','leadsource','Lead Source',1,2,'',100,10,13,1,'V~O',1,null,'BAS',1)");
 255          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'website','vtiger_leadsubdetails',1,'17','website','Website',1,2,'',100,13,13,1,'V~O',1,null,'ADV',1)");
 256          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'industry','vtiger_leaddetails',1,'15','industry','Industry',1,2,'',100,12,13,1,'V~O',1,null,'ADV',1)");
 257          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'leadstatus','vtiger_leaddetails',1,'15','leadstatus','Lead Status',1,2,'',100,15,13,1,'V~O',1,null,'BAS',1)");
 258          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'annualrevenue','vtiger_leaddetails',1,'71','annualrevenue','Annual Revenue',1,2,'',100,14,13,1,'I~O',1,null,'ADV',1)");
 259          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'rating','vtiger_leaddetails',1,'15','rating','Rating',1,2,'',100,17,13,1,'V~O',1,null,'ADV',1)");
 260          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'noofemployees','vtiger_leaddetails',1,'1','noofemployees','No Of Employees',1,2,'',100,16,13,1,'I~O',1,null,'ADV',1)");
 261          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,19,13,1,'V~M',0,6,'BAS',1)");
 262          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'secondaryemail','vtiger_leaddetails',1,'13','secondaryemail','Secondary Email',1,2,'',100,18,13,1,'E~O',1,null,'ADV',1)");
 263          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,21,13,2,'DT~O',3,null,'BAS',0)");
 264          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,20,13,2,'DT~O',3,null,'BAS',0)");
 265          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,23,13,3,'V~O',3,null,'BAS',0)");
 266          //Block13 -- End
 267          //Block15 -- Start
 268          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'lane','vtiger_leadaddress',1,'21','lane','Street',1,2,'',100,1,15,1,'V~O',1,null,'BAS',1)");
 269          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'code','vtiger_leadaddress',1,'1','code','Postal Code',1,2,'',100,3,15,1,'V~O',1,null,'BAS',1)");
 270          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'city','vtiger_leadaddress',1,'1','city','City',1,2,'',100,4,15,1,'V~O',1,null,'BAS',1)");
 271          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'country','vtiger_leadaddress',1,'1','country','Country',1,2,'',100,5,15,1,'V~O',1,null,'BAS',1)");
 272          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'state','vtiger_leadaddress',1,'1','state','State',1,2,'',100,6,15,1,'V~O',1,null,'BAS',1)");
 273          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'pobox','vtiger_leadaddress',1,'1','pobox','Po Box',1,2,'',100,2,15,1,'V~O',1,null,'BAS',1)");
 274          //Block15 --End
 275          //Block16 -- Start
 276          $this->db->query("insert into vtiger_field values (7," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,16,1,'V~O',1,null,'BAS',1)");
 277          //Block16 -- End
 278          //Lead Details -- END
 279          //Contact Details -- START
 280          //Block4 -- Start
 281  
 282          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'salutation','vtiger_contactdetails',1,'55','salutationtype','Salutation',1,0,'',100,1,4,3,'V~O',1,null,'BAS',1)");
 283          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'firstname','vtiger_contactdetails',1,'55','firstname','First Name',1,0,'',100,2,4,1,'V~O',2,1,'BAS',1)");
 284          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'contact_no','vtiger_contactdetails',1,'4','contact_no','Contact Id',1,0,'',100,3,4,1,'V~O',3,null,'BAS',0)");
 285          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'phone','vtiger_contactdetails',1,'11','phone','Office Phone',1,2,'',100,5,4,1,'V~O',2,4,'BAS',1)");
 286          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'lastname','vtiger_contactdetails',1,'255','lastname','Last Name',1,0,'',100,4,4,1,'V~M',0,2,'BAS',1)");
 287          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'mobile','vtiger_contactdetails',1,'1','mobile','Mobile',1,2,'',100,7,4,1,'V~O',1,null,'BAS',1)");
 288          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'accountid','vtiger_contactdetails',1,'51','account_id','Account Name',1,0,'',100,6,4,1,'I~O',2,3,'BAS',1)");
 289          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'homephone','vtiger_contactsubdetails',1,'11','homephone','Home Phone',1,2,'',100,9,4,1,'V~O',1,null,'ADV',1)");
 290          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'leadsource','vtiger_contactsubdetails',1,'15','leadsource','Lead Source',1,2,'',100,8,4,1,'V~O',1,null,'BAS',1)");
 291          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'otherphone','vtiger_contactsubdetails',1,'11','otherphone','Other Phone',1,2,'',100,11,4,1,'V~O',1,null,'ADV',1)");
 292          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'title','vtiger_contactdetails',1,'1','title','Title',1,2,'',100,10,4,1,'V~O',1,null,'BAS',1)");
 293          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'fax','vtiger_contactdetails',1,'1','fax','Fax',1,2,'',100,13,4,1,'V~O',1,null,'BAS',1)");
 294          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'department','vtiger_contactdetails',1,'1','department','Department',1,2,'',100,12,4,1,'V~O',1,null,'ADV',1)");
 295          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'birthday','vtiger_contactsubdetails',1,'5','birthday','Birthdate',1,2,'',100,16,4,1,'D~O',1,null,'ADV',1)");
 296          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'email','vtiger_contactdetails',1,'13','email','Email',1,2,'',100,15,4,1,'E~O',2,5,'BAS',1)");
 297          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'reportsto','vtiger_contactdetails',1,'57','contact_id','Reports To',1,2,'',100,18,4,1,'V~O',1,null,'ADV',0)");
 298          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'assistant','vtiger_contactsubdetails',1,'1','assistant','Assistant',1,2,'',100,17,4,1,'V~O',1,null,'ADV',1)");
 299          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'secondaryemail','vtiger_contactdetails',1,'13','secondaryemail','Secondary Email',1,2,'',100,20,4,1,'E~O',1,null,'ADV',1)");
 300          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'assistantphone','vtiger_contactsubdetails',1,'11','assistantphone','Assistant Phone',1,2,'',100,19,4,1,'V~O',1,null,'ADV',1)");
 301          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'donotcall','vtiger_contactdetails',1,'56','donotcall','Do Not Call',1,2,'',100,22,4,1,'C~O',1,null,'ADV',1)");
 302          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'emailoptout','vtiger_contactdetails',1,'56','emailoptout','Email Opt Out',1,2,'',100,21,4,1,'C~O',1,null,'ADV',1)");
 303          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,24,4,1,'V~M',0,6,'BAS',1)");
 304          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'reference','vtiger_contactdetails',1,'56','reference','Reference',1,2,'',10,23,4,1,'C~O',1,null,'ADV',1)");
 305          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'notify_owner','vtiger_contactdetails',1,'56','notify_owner','Notify Owner',1,2,'',10,26,4,1,'C~O',1,null,'ADV',1)");
 306          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,25,4,2,'DT~O',3,null,'BAS',0)");
 307          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,27,4,2,'DT~O',3,null,'BAS',0)");
 308          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,28,4,3,'V~O',3,null,'BAS',0)");
 309          //Block4 -- End
 310          //Block6 - Begin Customer Portal
 311  
 312          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'portal','vtiger_customerdetails',1,'56','portal','Portal User',1,2,'',100,1,6,1,'C~O',1,null,'ADV',0)");
 313          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'support_start_date','vtiger_customerdetails',1,'5','support_start_date','Support Start Date',1,2,'',100,2,6,1,'D~O',1,null,'ADV',1)");
 314          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'support_end_date','vtiger_customerdetails',1,'5','support_end_date','Support End Date',1,2,'',100,3,6,1,'D~O~OTH~GE~support_start_date~Support Start Date',1,null,'ADV',1)");
 315  
 316          //Block6 - End Customer Portal
 317          //Block 7 -- Start
 318  
 319          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'mailingstreet','vtiger_contactaddress',1,'21','mailingstreet','Mailing Street',1,2,'',100,1,7,1,'V~O',1,null,'BAS',1)");
 320          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'otherstreet','vtiger_contactaddress',1,'21','otherstreet','Other Street',1,2,'',100,2,7,1,'V~O',1,null,'BAS',1)");
 321          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'mailingcity','vtiger_contactaddress',1,'1','mailingcity','Mailing City',1,2,'',100,5,7,1,'V~O',1,null,'BAS',1)");
 322          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'othercity','vtiger_contactaddress',1,'1','othercity','Other City',1,2,'',100,6,7,1,'V~O',1,null,'BAS',1)");
 323          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'mailingstate','vtiger_contactaddress',1,'1','mailingstate','Mailing State',1,2,'',100,7,7,1,'V~O',1,null,'BAS',1)");
 324          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'otherstate','vtiger_contactaddress',1,'1','otherstate','Other State',1,2,'',100,8,7,1,'V~O',1,null,'BAS',1)");
 325          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'mailingzip','vtiger_contactaddress',1,'1','mailingzip','Mailing Zip',1,2,'',100,9,7,1,'V~O',1,null,'BAS',1)");
 326          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'otherzip','vtiger_contactaddress',1,'1','otherzip','Other Zip',1,2,'',100,10,7,1,'V~O',1,null,'BAS',1)");
 327          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'mailingcountry','vtiger_contactaddress',1,'1','mailingcountry','Mailing Country',1,2,'',100,11,7,1,'V~O',1,null,'BAS',1)");
 328          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'othercountry','vtiger_contactaddress',1,'1','othercountry','Other Country',1,2,'',100,12,7,1,'V~O',1,null,'BAS',1)");
 329          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'mailingpobox','vtiger_contactaddress',1,'1','mailingpobox','Mailing Po Box',1,2,'',100,3,7,1,'V~O',1,null,'BAS',1)");
 330          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'otherpobox','vtiger_contactaddress',1,'1','otherpobox','Other Po Box',1,2,'',100,4,7,1,'V~O',1,null,'BAS',1)");
 331          //Block7 -- End
 332          //ContactImageInformation
 333          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'imagename','vtiger_contactdetails',1,'69','imagename','Contact Image',1,2,'',100,1,$imageblockid,1,'V~O',3,null,'ADV',0)");
 334  
 335  
 336          //Block8 -- Start
 337          $this->db->query("insert into vtiger_field values (4," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,8,1,'V~O',1,null,'BAS',1)");
 338          //Block8 -- End
 339          //Contact Details -- END
 340          //Potential Details -- START
 341          //Block1 -- Start
 342          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'potentialname','vtiger_potential',1,'2','potentialname','Potential Name',1,0,'',100,1,1,1,'V~M',0,1,'BAS',1)");
 343          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'potential_no','vtiger_potential',1,'4','potential_no','Potential No',1,0,'',100,2,1,1,'V~O',3,null,'BAS',0)");
 344          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'amount','vtiger_potential',1,71,'amount','Amount',1,2,'',100,4,1,1,'N~O',2,5,'BAS',1)");
 345          //changed for b2c model
 346          $fieldid = $this->db->getUniqueID("vtiger_field");
 347          $this->db->query("insert into vtiger_field values (2,$fieldid,'related_to','vtiger_potential',1,'10','related_to','Related To',1,0,'',100,3,1,1,'V~M',0,2,'BAS',1)");
 348          $this->db->query("insert into vtiger_fieldmodulerel (fieldid, module, relmodule, status, sequence) values ($fieldid, 'Potentials', 'Accounts', NULL, 0), ($fieldid, 'Potentials', 'Contacts', NULL, 1)");
 349          //b2c model changes end
 350          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'closingdate','vtiger_potential',1,'23','closingdate','Expected Close Date',1,2,'',100,7,1,1,'D~M',2,3,'BAS',1)");
 351          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'potentialtype','vtiger_potential',1,'15','opportunity_type','Type',1,2,'',100,6,1,1,'V~O',1,null,'BAS',1)");
 352          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'nextstep','vtiger_potential',1,'1','nextstep','Next Step',1,2,'',100,9,1,1,'V~O',1,null,'BAS',1)");
 353          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'leadsource','vtiger_potential',1,'15','leadsource','Lead Source',1,2,'',100,8,1,1,'V~O',1,null,'BAS',1)");
 354          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'sales_stage','vtiger_potential',1,'15','sales_stage','Sales Stage',1,2,'',100,11,1,1,'V~M',2,4,'BAS',1)");
 355          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,2,'',100,10,1,1,'V~M',0,6,'BAS',1)");
 356          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'probability','vtiger_potential',1,'9','probability','Probability',1,2,'',100,13,1,1,'N~O',1,null,'BAS',1)");
 357          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'campaignid','vtiger_potential',1,'58','campaignid','Campaign Source',1,2,'',100,12,1,1,'N~O',1,null,'BAS',1)");
 358          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,15,1,2,'DT~O',3,null,'BAS',0)");
 359          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,14,1,2,'DT~O',3,null,'BAS',0)");
 360          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,16,1,3,'V~O',3,null,'BAS',0)");
 361          //Block1 -- End
 362          //Block3 -- Start
 363          $this->db->query("insert into vtiger_field values (2," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,3,1,'V~O',1,null,'BAS',1)");
 364          //Block3 -- End
 365          //Potential Details -- END
 366          //campaign entries being added
 367          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'campaignname','vtiger_campaign',1,'2','campaignname','Campaign Name',1,0,'',100,1,$campaignbasicblockid,1,'V~M',0,1,'BAS',1)");
 368          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'campaign_no','vtiger_campaign',1,'4','campaign_no','Campaign No',1,0,'',100,2,$campaignbasicblockid,1,'V~O',3,null,'BAS',0)");
 369          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'campaigntype','vtiger_campaign',1,15,'campaigntype','Campaign Type',1,2,'',100,5,$campaignbasicblockid,1,'V~O',2,3,'BAS',1)");
 370          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'product_id','vtiger_campaign',1,59,'product_id','Product',1,2,'',100,6,$campaignbasicblockid,1,'I~O',2,5,'BAS',1)");
 371          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'campaignstatus','vtiger_campaign',1,15,'campaignstatus','Campaign Status',1,2,'',100,4,$campaignbasicblockid,1,'V~O',2,6,'BAS',1)");
 372          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'closingdate','vtiger_campaign',1,'23','closingdate','Expected Close Date',1,2,'',100,8,$campaignbasicblockid,1,'D~M',2,2,'BAS',1)");
 373          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,3,$campaignbasicblockid,1,'V~M',0,7,'BAS',1)");
 374          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'numsent','vtiger_campaign',1,'9','numsent','Num Sent',1,2,'',100,12,$campaignbasicblockid,1,'N~O',1,null,'BAS',1)");
 375          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'sponsor','vtiger_campaign',1,'1','sponsor','Sponsor',1,2,'',100,9,$campaignbasicblockid,1,'V~O',1,null,'BAS',1)");
 376          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'targetaudience','vtiger_campaign',1,'1','targetaudience','Target Audience',1,2,'',100,7,$campaignbasicblockid,1,'V~O',1,null,'BAS',1)");
 377          $this->db->query("insert into vtiger_field values(26," . $this->db->getUniqueID("vtiger_field") . ",'targetsize','vtiger_campaign',1,'1','targetsize','TargetSize',1,2,'',100,10,$campaignbasicblockid,1,'I~O',1,null,'BAS',1)");
 378          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,11,$campaignbasicblockid,2,'DT~O',3,null,'BAS',0)");
 379          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,13,$campaignbasicblockid,2,'DT~O',3,null,'BAS',0)");
 380          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,16,$campaignbasicblockid,3,'V~O',3,null,'BAS',0)");
 381  
 382          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'expectedresponse','vtiger_campaign',1,'15','expectedresponse','Expected Response',1,2,'',100,3,$campaignexpectedandactualsblock,1,'V~O',2,4,'BAS',1)");
 383          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'expectedrevenue','vtiger_campaign',1,'71','expectedrevenue','Expected Revenue',1,2,'',100,4,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)");
 384          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'budgetcost','vtiger_campaign',1,'71','budgetcost','Budget Cost',1,2,'',100,1,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)");
 385          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'actualcost','vtiger_campaign',1,'71','actualcost','Actual Cost',1,2,'',100,2,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)");
 386          $this->db->query("insert into vtiger_field values(26," . $this->db->getUniqueID("vtiger_field") . ",'expectedresponsecount','vtiger_campaign',1,'1','expectedresponsecount','Expected Response Count',1,2,'',100,7,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)");
 387          $this->db->query("insert into vtiger_field values(26," . $this->db->getUniqueID("vtiger_field") . ",'expectedsalescount','vtiger_campaign',1,'1','expectedsalescount','Expected Sales Count',1,2,'',100,5,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)");
 388          $this->db->query("insert into vtiger_field values(26," . $this->db->getUniqueID("vtiger_field") . ",'expectedroi','vtiger_campaign',1,'71','expectedroi','Expected ROI',1,2,'',100,9,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)");
 389          $this->db->query("insert into vtiger_field values(26," . $this->db->getUniqueID("vtiger_field") . ",'actualresponsecount','vtiger_campaign',1,'1','actualresponsecount','Actual Response Count',1,2,'',100,8,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)");
 390          $this->db->query("insert into vtiger_field values(26," . $this->db->getUniqueID("vtiger_field") . ",'actualsalescount','vtiger_campaign',1,'1','actualsalescount','Actual Sales Count',1,2,'',100,6,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)");
 391          $this->db->query("insert into vtiger_field values(26," . $this->db->getUniqueID("vtiger_field") . ",'actualroi','vtiger_campaign',1,'71','actualroi','Actual ROI',1,2,'',100,10,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)");
 392  
 393          $this->db->query("insert into vtiger_field values (26," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,$campaidndescriptionblock,1,'V~O',1,null,'BAS',1)");
 394  
 395          //entry to vtiger_field to maintain account,contact,lead relationships
 396  
 397          $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, defaultvalue, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (" . getTabid('Contacts') . "," . $this->db->getUniqueID('vtiger_field') . ", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)");
 398          $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, defaultvalue, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (" . getTabid('Accounts') . "," . $this->db->getUniqueID('vtiger_field') . ", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)");
 399          $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, defaultvalue, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (" . getTabid('Leads') . "," . $this->db->getUniqueID('vtiger_field') . ", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)");
 400          $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, defaultvalue, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (" . getTabid('Campaigns') . "," . $this->db->getUniqueID('vtiger_field') . ", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)");
 401          //Campaign entries end
 402          //Ticket Details -- START
 403          //Block25 -- Start
 404  
 405          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'ticket_no','vtiger_troubletickets',1,'4','ticket_no','Ticket No',1,0,'',100,13,25,1,'V~O',3,null,'BAS',0)");
 406          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,4,25,1,'V~M',0,4,'BAS',1)");
 407          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'parent_id','vtiger_troubletickets',1,'68','parent_id','Related To',1,0,'',100,2,25,1,'I~O',1,null,'BAS',1)");
 408          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'priority','vtiger_troubletickets',1,'15','ticketpriorities','Priority',1,2,'',100,6,25,1,'V~O',2,3,'BAS',1)");
 409          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'product_id','vtiger_troubletickets',1,'59','product_id','Product Name',1,2,'',100,5,25,1,'I~O',1,null,'BAS',1)");
 410          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'severity','vtiger_troubletickets',1,'15','ticketseverities','Severity',1,2,'',100,8,25,1,'V~O',1,null,'BAS',1)");
 411          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'status','vtiger_troubletickets',1,'15','ticketstatus','Status',1,2,'',100,7,25,1,'V~M',1,2,'BAS',1)");
 412          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'category','vtiger_troubletickets',1,'15','ticketcategories','Category',1,2,'',100,10,25,1,'V~O',1,null,'BAS',1)");
 413          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'update_log','vtiger_troubletickets',1,'19','update_log','Update History',1,0,'',100,11,25,3,'V~O',1,null,'BAS',0)");
 414          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'hours','vtiger_troubletickets',1,'1','hours','Hours',1,2,'',100,9,25,1,'I~O',1,null,'BAS',1)");
 415          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'days','vtiger_troubletickets',1,'1','days','Days',1,2,'',100,10,25,1,'I~O',1,null,'BAS',1)");
 416          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,9,25,2,'DT~O',3,null,'BAS',0)");
 417          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,12,25,2,'DT~O',3,null,'BAS',0)");
 418          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,16,25,3,'V~O',3,null,'BAS',0)");
 419  
 420          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'title','vtiger_troubletickets',1,'22','ticket_title','Title',1,0,'',100,1,25,1,'V~M',0,1,'BAS',1)");
 421          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,28,1,'V~O',2,4,'BAS',1)");
 422          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'solution','vtiger_troubletickets',1,'19','solution','Solution',1,0,'',100,1,29,1,'V~O',3,null,'BAS',0)");
 423          $this->db->query("insert into vtiger_field values (13," . $this->db->getUniqueID("vtiger_field") . ",'comments','vtiger_ticketcomments',1,'19','comments','Add Comment',1,0,'',100,1,30,1,'V~O',3,null,'BAS',0)");
 424  
 425          //Block25-30 -- End
 426          //Ticket Details -- END
 427          //Product Details -- START
 428          //Block31-36 -- Start
 429  
 430          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'productname','vtiger_products',1,'2','productname','Product Name',1,0,'',100,1,31,1,'V~M',0,1,'BAS',1)");
 431          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'product_no','vtiger_products',1,'4','product_no','Product No',1,0,'',100,2,31,1,'V~O',3,null,'BAS',0)");
 432          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'productcode','vtiger_products',1,'1','productcode','Part Number',1,2,'',100,4,31,1,'V~O',1,null,'BAS',1)");
 433          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'discontinued','vtiger_products',1,'56','discontinued','Product Active',1,2,'',100,3,31,1,'V~O',2,2,'BAS',1)");
 434          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'manufacturer','vtiger_products',1,'15','manufacturer','Manufacturer',1,2,'',100,6,31,1,'V~O',1,null,'BAS',1)");
 435          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'productcategory','vtiger_products',1,'15','productcategory','Product Category',1,2,'',100,6,31,1,'V~O',1,null,'BAS',1)");
 436          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'sales_start_date','vtiger_products',1,'5','sales_start_date','Sales Start Date',1,2,'',100,5,31,1,'D~O',1,null,'BAS',1)");
 437          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'sales_end_date','vtiger_products',1,'5','sales_end_date','Sales End Date',1,2,'',100,8,31,1,'D~O~OTH~GE~sales_start_date~Sales Start Date',1,null,'BAS',1)");
 438          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'start_date','vtiger_products',1,'5','start_date','Support Start Date',1,2,'',100,7,31,1,'D~O',1,null,'BAS',1)");
 439          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'expiry_date','vtiger_products',1,'5','expiry_date','Support Expiry Date',1,2,'',100,10,31,1,'D~O~OTH~GE~start_date~Start Date',1,null,'BAS',1)");
 440  
 441  
 442          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'website','vtiger_products',1,'17','website','Website',1,2,'',100,14,31,1,'V~O',1,null,'BAS',1)");
 443          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'vendor_id','vtiger_products',1,'75','vendor_id','Vendor Name',1,2,'',100,13,31,1,'I~O',1,null,'BAS',1)");
 444          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'mfr_part_no','vtiger_products',1,'1','mfr_part_no','Mfr PartNo',1,2,'',100,16,31,1,'V~O',1,null,'BAS',1)");
 445          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'vendor_part_no','vtiger_products',1,'1','vendor_part_no','Vendor PartNo',1,2,'',100,15,31,1,'V~O',1,null,'BAS',1)");
 446          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'serialno','vtiger_products',1,'1','serial_no','Serial No',1,2,'',100,18,31,1,'V~O',1,null,'BAS',1)");
 447          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'productsheet','vtiger_products',1,'1','productsheet','Product Sheet',1,2,'',100,17,31,1,'V~O',1,null,'BAS',1)");
 448          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'glacct','vtiger_products',1,'15','glacct','GL Account',1,2,'',100,20,31,1,'V~O',1,null,'BAS',1)");
 449          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,19,31,2,'DT~O',3,null,'BAS',0)");
 450          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,21,31,2,'DT~O',3,null,'BAS',0)");
 451          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,22,31,3,'V~O',3,null,'BAS',0)");
 452  
 453          //Block32 Pricing Information
 454  
 455          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'unit_price','vtiger_products',1,'72','unit_price','Unit Price',1,2,'',100,1,32,1,'N~O',2,3,'BAS',0)");
 456          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'commissionrate','vtiger_products',1,'9','commissionrate','Commission Rate',1,2,'',100,2,32,1,'N~O',1,null,'BAS',1)");
 457          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'taxclass','vtiger_products',1,'83','taxclass','Tax Class',1,2,'',100,4,32,1,'V~O',3,null,'BAS',1)");
 458  
 459  
 460          //Block 33 stock info
 461  
 462          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'usageunit','vtiger_products',1,'15','usageunit','Usage Unit',1,2,'',100,1,33,1,'V~O',1,null,'ADV',1)");
 463          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'qty_per_unit','vtiger_products',1,'1','qty_per_unit','Qty/Unit',1,2,'',100,2,33,1,'N~O',1,null,'ADV',1)");
 464          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'qtyinstock','vtiger_products',1,'1','qtyinstock','Qty In Stock',1,2,'',100,3,33,1,'NN~O',0,4,'ADV',1)");
 465          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'reorderlevel','vtiger_products',1,'1','reorderlevel','Reorder Level',1,2,'',100,4,33,1,'I~O',1,null,'ADV',1)");
 466          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Handler',1,0,'',100,5,33,1,'V~M',0,5,'BAS',1)");
 467          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'qtyindemand','vtiger_products',1,'1','qtyindemand','Qty In Demand',1,2,'',100,6,33,1,'I~O',1,null,'ADV',1)");
 468  
 469          //ProductImageInformation
 470  
 471          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'imagename','vtiger_products',1,'69','imagename','Product Image',1,2,'',100,1,35,1,'V~O',3,null,'ADV',1)");
 472  
 473          //Block 36 Description Info
 474          $this->db->query("insert into vtiger_field values (14," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,36,1,'V~O',1,null,'BAS',1)");
 475  
 476          //Product Details -- END
 477          //Documents Details -- START
 478          //Block17 -- Start
 479  
 480          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'title','vtiger_notes',1,'2','notes_title','Title',1,0,'',100,1,17,1,'V~M',0,1,'BAS',1)");
 481          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,5,17,2,'DT~O',3,null,'BAS',0)");
 482          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,6,17,2,'DT~O',3,null,'BAS',0)");
 483          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'filename','vtiger_notes',1,'28','filename','File Name',1,2,'',100,3," . $fileblockid . ",1,'V~O',3,null,'BAS',0)");
 484          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,4,17,1,'V~M',0,3,'BAS',1)");
 485          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'notecontent','vtiger_notes',1,'19','notecontent','Note',1,2,'',100,1,$desc_blockid,1,'V~O',1,null,'BAS',1)");
 486          $this->db->query("insert into vtiger_field values(8," . $this->db->getUniqueID("vtiger_field") . ",'filetype','vtiger_notes',1,1,'filetype','File Type',1,2,'',100,5," . $fileblockid . ",2,'V~O',3,'','BAS',0)");
 487          $this->db->query("insert into vtiger_field values(8," . $this->db->getUniqueID("vtiger_field") . ",'filesize','vtiger_notes',1,1,'filesize','File Size',1,2,'',100,4," . $fileblockid . ",2,'I~O',3,'','BAS',0)");
 488          $this->db->query("insert into vtiger_field values(8," . $this->db->getUniqueID("vtiger_field") . ",'filelocationtype','vtiger_notes',1,27,'filelocationtype','Download Type',1,0,'',100,1," . $fileblockid . ",1,'V~O',3,'','BAS',0)");
 489          $this->db->query("insert into vtiger_field values(8," . $this->db->getUniqueID("vtiger_field") . ",'fileversion','vtiger_notes',1,1,'fileversion','Version',1,2,'',100,6,$fileblockid,1,'V~O',1,'','BAS',1)");
 490          $this->db->query("insert into vtiger_field values(8," . $this->db->getUniqueID("vtiger_field") . ",'filestatus','vtiger_notes',1,56,'filestatus','Active',1,2,'',100,2," . $fileblockid . ",1,'V~O',1,'','BAS',1)");
 491          $this->db->query("insert into vtiger_field values(8," . $this->db->getUniqueID("vtiger_field") . ",'filedownloadcount','vtiger_notes',1,1,'filedownloadcount','Download Count',1,2,'',100,7," . $fileblockid . ",2,'I~O',3,'','BAS',0)");
 492          $this->db->query("insert into vtiger_field values(8," . $this->db->getUniqueID("vtiger_field") . ",'folderid','vtiger_notes',1,26,'folderid','Folder Name',1,2,'',100,2,17,1,'V~O',2,2,'BAS',1)");
 493  
 494          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'note_no','vtiger_notes',1,'4','note_no','Document No',1,0,'',100,3,17,1,'V~O',3,null,'BAS',0)");
 495          $this->db->query("insert into vtiger_field values (8," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,12,17,3,'V~O',3,null,'BAS',0)");
 496  
 497          //Block17 -- End
 498          //Documents Details -- END
 499          //Email Details -- START
 500          //Block21 -- Start
 501  
 502          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'date_start','vtiger_activity',1,'6','date_start','Date & Time Sent',1,0,'',100,1,21,1,'DT~M~time_start~Time Start',1,null,'BAS',1)");
 503          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'semodule','vtiger_activity',1,'2','parent_type','Sales Enity Module',1,0,'',100,2,21,3,'',1,null,'BAS',1)");
 504          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'activitytype','vtiger_activity',1,'2','activitytype','Activtiy Type',1,0,'',100,3,21,3,'V~O',1,null,'BAS',1)");
 505          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,5,21,1,'V~M',1,null,'BAS',1)");
 506          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'subject','vtiger_activity',1,'2','subject','Subject',1,0,'',100,1,23,1,'V~M',1,null,'BAS',1)");
 507          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'name','vtiger_attachments',1,'61','filename','Attachment',1,0,'',100,2,23,1,'V~O',1,null,'BAS',1)");
 508          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,0,'',100,1,24,1,'V~O',1,null,'BAS',1)");
 509          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'time_start','vtiger_activity',1,'2','time_start','Time Start',1,0,'',100,9,23,1,'T~O',1,null,'BAS',1)");
 510          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,10,22,1,'DT~O',3,null,'BAS',0)");
 511          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,11,21,2,'DT~O',3,null,'BAS',0)");
 512          $this->db->query("INSERT INTO vtiger_field VALUES (10," . $this->db->getUniqueID("vtiger_field") . ", 'access_count', 'vtiger_email_track', '1', '25', 'access_count', 'Access Count', '1', '0', '0', '100', '6', '21', '3', 'V~O', '1', NULL, 'BAS', 0)");
 513          $this->db->query("insert into vtiger_field values (10," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,12,21,3,'V~O',3,null,'BAS',0)");
 514  
 515          //Block21 -- End
 516          //Email Details -- END
 517          //Task Details --START
 518          //Block19 -- Start
 519          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'subject','vtiger_activity',1,'2','subject','Subject',1,0,'',100,1,19,1,'V~M',0,1,'BAS',1)");
 520          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,2,19,1,'V~M',0,4,'BAS',1)");
 521          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'date_start','vtiger_activity',1,'6','date_start','Start Date & Time',1,0,'',100,3,19,1,'DT~M~time_start',0,2,'BAS',1)");
 522          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'time_start','vtiger_activity',1,'2','time_start','Time Start',1,0,'',100,4,19,3,'T~O',1,null,'BAS',1)");
 523          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'time_end','vtiger_activity',1,'2','time_end','End Time',1,0,'',100,4,19,3,'T~O',1,null,'BAS',1)");
 524          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'due_date','vtiger_activity',1,'23','due_date','Due Date',1,0,'',100,5,19,1,'D~M~OTH~GE~date_start~Start Date & Time',1,null,'BAS',1)");
 525          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'crmid','vtiger_seactivityrel',1,'66','parent_id','Related To',1,0,'',100,7,19,1,'I~O',1,null,'BAS',1)");
 526          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'contactid','vtiger_cntactivityrel',1,'57','contact_id','Contact Name',1,0,'',100,8,19,1,'I~O',1,null,'BAS',1)");
 527          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'status','vtiger_activity',1,'15','taskstatus','Status',1,0,'',100,8,19,1,'V~M',0,3,'BAS',1)");
 528          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'eventstatus','vtiger_activity',1,'15','eventstatus','Status',1,0,'',100,9,19,3,'V~O',1,null,'BAS',1)");
 529          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'priority','vtiger_activity',1,'15','taskpriority','Priority',1,0,'',100,10,19,1,'V~O',1,null,'BAS',1)");
 530          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'sendnotification','vtiger_activity',1,'56','sendnotification','Send Notification',1,0,'',100,11,19,1,'C~O',1,null,'BAS',1)");
 531          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,14,19,2,'DT~O',3,null,'BAS',0)");
 532          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,15,19,2,'DT~O',3,null,'BAS',0)");
 533          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'activitytype','vtiger_activity',1,'15','activitytype','Activity Type',1,0,'',100,16,19,3,'V~O',1,null,'BAS',1)");
 534          $this->db->query("Insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'visibility','vtiger_activity',1,'16','visibility','Visibility',1,0,'',100,17,19,3,'V~O',1,null,'BAS',1)");
 535  
 536          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,0,'',100,1,20,1,'V~O',1,null,'BAS',1)");
 537  
 538  
 539          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'duration_hours','vtiger_activity',1,'63','duration_hours','Duration',1,0,'',100,17,19,3,'T~O',1,null,'BAS',1)");
 540          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'duration_minutes','vtiger_activity',1,'16','duration_minutes','Duration Minutes',1,0,'',100,18,19,3,'T~O',1,null,'BAS',1)");
 541          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'location','vtiger_activity',1,'1','location','Location',1,0,'',100,19,19,3,'V~O',1,null,'BAS',1)");
 542          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'reminder_time','vtiger_activity_reminder',1,'30','reminder_time','Send Reminder',1,0,'',100,1,19,3,'I~O',1,null,'BAS',1)");
 543  
 544          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'recurringtype','vtiger_activity',1,'16','recurringtype','Recurrence',1,0,'',100,6,19,3,'O~O',1,null,'BAS',1)");
 545  
 546          $this->db->query("Insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'notime','vtiger_activity',1,56,'notime','No Time',1,0,'',100,20,19,3,'C~O',1,null,'BAS',1)");
 547          $this->db->query("insert into vtiger_field values (9," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,22,19,3,'V~O',3,null,'BAS',0)");
 548          //Block19 -- End
 549          //Task Details -- END
 550          //Event Details --START
 551          //Block41-43-- Start
 552          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'subject','vtiger_activity',1,'2','subject','Subject',1,0,'',100,1,41,1,'V~M',0,1,'BAS',1)");
 553          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,2,41,1,'V~M',0,6,'BAS',1)");
 554          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'date_start','vtiger_activity',1,'6','date_start','Start Date & Time',1,0,'',100,3,41,1,'DT~M~time_start',0,2,'BAS',1)");
 555          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'time_start','vtiger_activity',1,'2','time_start','Time Start',1,0,'',100,4,41,3,'T~M',1,null,'BAS',1)");
 556  
 557          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'due_date','vtiger_activity',1,'23','due_date','End Date',1,0,'',100,5,41,1,'D~M~OTH~GE~date_start~Start Date & Time',0,5,'BAS',1)");
 558          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'time_end','vtiger_activity',1,'2','time_end','End Time',1,0,'',100,5,41,3,'T~M',1,null,'BAS',1)");
 559          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'recurringtype','vtiger_activity',1,'16','recurringtype','Recurrence',1,0,'',100,6,41,1,'O~O',1,null,'BAS',1)");
 560  
 561          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'duration_hours','vtiger_activity',1,'63','duration_hours','Duration',1,0,'',100,7,41,1,'I~M',1,null,'BAS',1)");
 562          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'duration_minutes','vtiger_activity',1,'16','duration_minutes','Duration Minutes',1,0,'',100,8,41,3,'O~O',1,null,'BAS',1)");
 563          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'crmid','vtiger_seactivityrel',1,'66','parent_id','Related To',1,0,'',100,9,41,1,'I~O',1,null,'BAS',1)");
 564          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'eventstatus','vtiger_activity',1,'15','eventstatus','Status',1,0,'',100,10,41,1,'V~M',0,3,'BAS',1)");
 565          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'sendnotification','vtiger_activity',1,'56','sendnotification','Send Notification',1,0,'',100,11,41,1,'C~O',1,null,'BAS',1)");
 566          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'activitytype','vtiger_activity',1,'15','activitytype','Activity Type',1,0,'',100,12,41,1,'V~M',0,4,'BAS',1)");
 567          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'location','vtiger_activity',1,'1','location','Location',1,0,'',100,13,41,1,'V~O',1,null,'BAS',1)");
 568          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,14,41,2,'DT~O',3,null,'BAS',0)");
 569          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,15,41,2,'DT~O',3,null,'BAS',0)");
 570          $this->db->query("Insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'priority','vtiger_activity',1,15,'taskpriority','Priority',1,0,'',100,16,41,1,'V~O',1,null,'BAS',1)");
 571          $this->db->query("Insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'notime','vtiger_activity',1,56,'notime','No Time',1,0,'',100,17,41,1,'C~O',1,null,'BAS',1)");
 572          $this->db->query("Insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'visibility','vtiger_activity',1,'16','visibility','Visibility',1,0,'',100,18,41,1,'V~O',1,null,'BAS',1)");
 573          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,22,41,3,'V~O',3,null,'BAS',0)");
 574  
 575          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,0,'',100,1,41,1,'V~O',1,null,'BAS',1)");
 576          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'reminder_time','vtiger_activity_reminder',1,'30','reminder_time','Send Reminder',1,0,'',100,1,40,1,'I~O',1,null,'BAS',1)");
 577          $this->db->query("insert into vtiger_field values (16," . $this->db->getUniqueID("vtiger_field") . ",'contactid','vtiger_cntactivityrel',1,'57','contact_id','Contact Name',1,0,'',100,1,19,1,'I~O',1,null,'BAS',1)");
 578  
 579          //Block41-43 -- End
 580          //Event Details -- END
 581          //Faq Details -- START
 582          //Block37-40 -- Start
 583  
 584          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'product_id','vtiger_faq',1,'59','product_id','Product Name',1,2,'',100,1,37,1,'I~O',3,null,'BAS',1)");
 585          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'faq_no','vtiger_faq',1,'4','faq_no','Faq No',1,0,'',100,2,37,1,'V~O',3,null,'BAS',0)");
 586          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'category','vtiger_faq',1,'15','faqcategories','Category',1,2,'',100,4,37,1,'V~O',3,null,'BAS',1)");
 587          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'status','vtiger_faq',1,'15','faqstatus','Status',1,2,'',100,3,37,1,'V~M',3,null,'BAS',1)");
 588          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'question','vtiger_faq',1,'20','question','Question',1,2,'',100,7,37,1,'V~M',3,null,'BAS',1)");
 589          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'answer','vtiger_faq',1,'20','faq_answer','Answer',1,2,'',100,8,37,1,'V~M',3,null,'BAS',1)");
 590          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'comments','vtiger_faqcomments',1,'19','comments','Add Comment',1,0,'',100,1,38,1,'V~O',3,null,'BAS',0)");
 591          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,5,37,2,'DT~O',3,null,'BAS',0)");
 592          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,6,37,2,'DT~O',3,null,'BAS',0)");
 593          $this->db->query("insert into vtiger_field values (15," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,7,37,3,'V~O',3,null,'BAS',0)");
 594  
 595          //Block37-40 -- End
 596          //Ticket Details -- END
 597          //Vendor Details --START
 598          //Block44-47
 599  
 600          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'vendorname','vtiger_vendor',1,'2','vendorname','Vendor Name',1,0,'',100,1,$vendorbasicinfo,1,'V~M',0,1,'BAS',1)");
 601          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'vendor_no','vtiger_vendor',1,'4','vendor_no','Vendor No',1,0,'',100,2,$vendorbasicinfo,1,'V~O',3,null,'BAS',0)");
 602          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'phone','vtiger_vendor',1,'1','phone','Phone',1,2,'',100,4,$vendorbasicinfo,1,'V~O',2,2,'BAS',1)");
 603          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'email','vtiger_vendor',1,'13','email','Email',1,2,'',100,3,$vendorbasicinfo,1,'E~O',2,3,'BAS',1)");
 604          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'website','vtiger_vendor',1,'17','website','Website',1,2,'',100,6,$vendorbasicinfo,1,'V~O',1,null,'BAS',1)");
 605          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'glacct','vtiger_vendor',1,'15','glacct','GL Account',1,2,'',100,5,$vendorbasicinfo,1,'V~O',1,null,'BAS',1)");
 606          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'category','vtiger_vendor',1,'1','category','Category',1,2,'',100,8,$vendorbasicinfo,1,'V~O',1,null,'BAS',1)");
 607          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,7,$vendorbasicinfo,2,'DT~O',3,null,'BAS',0)");
 608          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,9,$vendorbasicinfo,2,'DT~O',3,null,'BAS',0)");
 609          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,12,$vendorbasicinfo,3,'V~O',3,null,'BAS',0)");
 610          //Block 46
 611  
 612          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'street','vtiger_vendor',1,'21','street','Street',1,2,'',100,1,$vendoraddressblock,1,'V~O',1,null,'ADV',1)");
 613          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'pobox','vtiger_vendor',1,'1','pobox','Po Box',1,2,'',100,2,$vendoraddressblock,1,'V~O',1,null,'ADV',1)");
 614          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'city','vtiger_vendor',1,'1','city','City',1,2,'',100,3,$vendoraddressblock,1,'V~O',1,null,'ADV',1)");
 615          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'state','vtiger_vendor',1,'1','state','State',1,2,'',100,4,$vendoraddressblock,1,'V~O',1,null,'ADV',1)");
 616          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'postalcode','vtiger_vendor',1,'1','postalcode','Postal Code',1,2,'',100,5,$vendoraddressblock,1,'V~O',1,null,'ADV',1)");
 617          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'country','vtiger_vendor',1,'1','country','Country',1,2,'',100,6,$vendoraddressblock,1,'V~O',1,null,'ADV',1)");
 618  
 619          //Block 47
 620  
 621          $this->db->query("insert into vtiger_field values (18," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,$vendordescriptionblock,1,'V~O',1,null,'ADV',1)");
 622  
 623          //Vendor Details -- END
 624          //PriceBook Details Start
 625          //Block48
 626  
 627          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'bookname','vtiger_pricebook',1,'2','bookname','Price Book Name',1,0,'',100,1,$pricebookbasicblock,1,'V~M',0,1,'BAS',1)");
 628          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'pricebook_no','vtiger_pricebook',1,'4','pricebook_no','PriceBook No',1,0,'',100,3,$pricebookbasicblock,1,'V~O',3,null,'BAS',0)");
 629          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'active','vtiger_pricebook',1,'56','active','Active',1,2,'',100,2,$pricebookbasicblock,1,'C~O',2,2,'BAS',1)");
 630          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,4,$pricebookbasicblock,2,'DT~O',3,null,'BAS',0)");
 631          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,5,$pricebookbasicblock,2,'DT~O',3,null,'BAS',0)");
 632          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'currency_id','vtiger_pricebook',1,'117','currency_id','Currency',1,0,'',100,5,$pricebookbasicblock,1,'I~M',0,3,'BAS',0)");
 633          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,7,$pricebookbasicblock,3,'V~O',3,null,'BAS',0)");
 634          //Block50
 635  
 636          $this->db->query("insert into vtiger_field values (19," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,$pricebookdescription,1,'V~O',1,null,'BAS',1)");
 637  
 638          //PriceBook Details End
 639          //Quote Details -- START
 640          //Block51
 641  
 642          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'quote_no','vtiger_quotes',1,'4','quote_no','Quote No',1,0,'',100,3,$quotesbasicblock,1,'V~O',3,null,'BAS',0)");
 643          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'subject','vtiger_quotes',1,'2','subject','Subject',1,0,'',100,1,$quotesbasicblock,1,'V~M',1,null,'BAS',1)");
 644          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'potentialid','vtiger_quotes',1,'76','potential_id','Potential Name',1,2,'',100,2,$quotesbasicblock,1,'I~O',3,null,'BAS',1)");
 645          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'quotestage','vtiger_quotes',1,'15','quotestage','Quote Stage',1,2,'',100,4,$quotesbasicblock,1,'V~M',3,null,'BAS',1)");
 646  
 647          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'validtill','vtiger_quotes',1,'5','validtill','Valid Till',1,2,'',100,5,$quotesbasicblock,1,'D~O',3,null,'BAS',1)");
 648          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'contactid','vtiger_quotes',1,'57','contact_id','Contact Name',1,2,'',100,6,$quotesbasicblock,1,'V~O',3,null,'BAS',1)");
 649          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'carrier','vtiger_quotes',1,'15','carrier','Carrier',1,2,'',100,8,$quotesbasicblock,1,'V~O',3,null,'BAS',1)");
 650          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'subtotal','vtiger_quotes',1,'72','hdnSubTotal','Sub Total',1,2,'',100,9,$quotesbasicblock,3,'N~O',3,null,'BAS',1)");
 651          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'shipping','vtiger_quotes',1,'1','shipping','Shipping',1,2,'',100,10,$quotesbasicblock,1,'V~O',3,null,'BAS',1)");
 652  
 653          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'inventorymanager','vtiger_quotes',1,'77','assigned_user_id1','Inventory Manager',1,2,'',100,11,$quotesbasicblock,1,'I~O',3,null,'BAS',1)");
 654          //$this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'tax','vtiger_quotes',1,'1','txtTax','Sales Tax',1,0,'',100,13,51,3,'N~O',1,null,'BAS',1)");
 655          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'adjustment','vtiger_quotes',1,'72','txtAdjustment','Adjustment',1,2,'',100,20,$quotesbasicblock,3,'NN~O',3,null,'BAS',1)");
 656          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'total','vtiger_quotes',1,'72','hdnGrandTotal','Total',1,2,'',100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)");
 657          //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process
 658          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'taxtype','vtiger_quotes',1,'16','hdnTaxType','Tax Type',1,2,'',100,14,$quotesbasicblock,3,'V~O',3,null,'BAS',1)");
 659          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'discount_percent','vtiger_quotes',1,'1','hdnDiscountPercent','Discount Percent',1,2,'',100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)");
 660          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'discount_amount','vtiger_quotes',1,'72','hdnDiscountAmount','Discount Amount',1,2,'',100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)");
 661          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'s_h_amount','vtiger_quotes',1,'72','hdnS_H_Amount','S&H Amount',1,2,'',100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)");
 662  
 663          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'accountid','vtiger_quotes',1,'73','account_id','Account Name',1,2,'',100,16,$quotesbasicblock,1,'I~M',3,null,'BAS',1)");
 664          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,17,$quotesbasicblock,1,'V~M',3,null,'BAS',1)");
 665          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,18,$quotesbasicblock,2,'DT~O',3,null,'BAS',0)");
 666          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,19,$quotesbasicblock,2,'DT~O',3,null,'BAS',0)");
 667          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,22,$quotesbasicblock,3,'V~O',3,null,'BAS',0)");
 668  
 669          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'currency_id','vtiger_quotes',1,'117','currency_id','Currency',1,2,1,100,20,$quotesbasicblock,3,'I~O',3,null,'BAS',1)");
 670          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'conversion_rate','vtiger_quotes',1,'1','conversion_rate','Conversion Rate',1,2,1,100,21,$quotesbasicblock,3,'N~O',3,null,'BAS',1)");
 671  
 672          //Block 53
 673  
 674          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'bill_street','vtiger_quotesbillads',1,'24','bill_street','Billing Address',1,2,'',100,1,$quotesaddressblock,1,'V~M',3,null,'BAS',1)");
 675          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'ship_street','vtiger_quotesshipads',1,'24','ship_street','Shipping Address',1,2,'',100,2,$quotesaddressblock,1,'V~M',3,null,'BAS',1)");
 676  
 677          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'bill_city','vtiger_quotesbillads',1,'1','bill_city','Billing City',1,2,'',100,5,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 678          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'ship_city','vtiger_quotesshipads',1,'1','ship_city','Shipping City',1,2,'',100,6,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 679  
 680          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'bill_state','vtiger_quotesbillads',1,'1','bill_state','Billing State',1,2,'',100,7,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 681          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'ship_state','vtiger_quotesshipads',1,'1','ship_state','Shipping State',1,2,'',100,8,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 682  
 683          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'bill_code','vtiger_quotesbillads',1,'1','bill_code','Billing Code',1,2,'',100,9,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 684          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'ship_code','vtiger_quotesshipads',1,'1','ship_code','Shipping Code',1,2,'',100,10,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 685  
 686  
 687          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'bill_country','vtiger_quotesbillads',1,'1','bill_country','Billing Country',1,2,'',100,11,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 688          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'ship_country','vtiger_quotesshipads',1,'1','ship_country','Shipping Country',1,2,'',100,12,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 689  
 690          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'bill_pobox','vtiger_quotesbillads',1,'1','bill_pobox','Billing Po Box',1,2,'',100,3,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 691          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'ship_pobox','vtiger_quotesshipads',1,'1','ship_pobox','Shipping Po Box',1,2,'',100,4,$quotesaddressblock,1,'V~O',3,null,'BAS',1)");
 692          //Block55
 693  
 694          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,$quotedescription,1,'V~O',3,null,'ADV',1)");
 695  
 696          //Block 56
 697          $this->db->query("insert into vtiger_field values (20," . $this->db->getUniqueID("vtiger_field") . ",'terms_conditions','vtiger_quotes',1,'19','terms_conditions','Terms & Conditions',1,2,'',100,1,$quotetermsblock,1,'V~O',3,null,'ADV',1)");
 698  
 699  
 700          //Quote Details -- END
 701          //Purchase Order Details -- START
 702          //Block57
 703          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'purchaseorder_no','vtiger_purchaseorder',1,'4','purchaseorder_no','PurchaseOrder No',1,0,'',100,2,$pobasicblock,1,'V~O',3,null,'BAS',0)");
 704          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'subject','vtiger_purchaseorder',1,'2','subject','Subject',1,0,'',100,1,$pobasicblock,1,'V~M',3,null,'BAS',1)");
 705          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'vendorid','vtiger_purchaseorder',1,'81','vendor_id','Vendor Name',1,0,'',100,3,$pobasicblock,1,'I~M',3,null,'BAS',1)");
 706          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'requisition_no','vtiger_purchaseorder',1,'1','requisition_no','Requisition No',1,2,'',100,4,$pobasicblock,1,'V~O',3,null,'BAS',1)");
 707  
 708          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'tracking_no','vtiger_purchaseorder',1,'1','tracking_no','Tracking Number',1,2,'',100,5,$pobasicblock,1,'V~O',3,null,'BAS',1)");
 709          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'contactid','vtiger_purchaseorder',1,'57','contact_id','Contact Name',1,2,'',100,6,$pobasicblock,1,'I~O',3,null,'BAS',1)");
 710          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'duedate','vtiger_purchaseorder',1,'5','duedate','Due Date',1,2,'',100,7,$pobasicblock,1,'D~O',3,null,'BAS',1)");
 711          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'carrier','vtiger_purchaseorder',1,'15','carrier','Carrier',1,2,'',100,8,$pobasicblock,1,'V~O',3,null,'BAS',1)");
 712          //$this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'salestax','vtiger_purchaseorder',1,'1','txtTax','Sales Tax',1,0,'',100,10,57,3,'N~O',1,null,'BAS',1)");
 713          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'adjustment','vtiger_purchaseorder',1,'72','txtAdjustment','Adjustment',1,2,'',100,10,$pobasicblock,3,'NN~O',3,null,'BAS',1)");
 714          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'salescommission','vtiger_purchaseorder',1,'1','salescommission','Sales Commission',1,2,'',100,11,$pobasicblock,1,'N~O',3,null,'BAS',1)");
 715          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'exciseduty','vtiger_purchaseorder',1,'1','exciseduty','Excise Duty',1,2,'',100,12,$pobasicblock,1,'N~O',3,null,'BAS',1)");
 716          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'total','vtiger_purchaseorder',1,'72','hdnGrandTotal','Total',1,2,'',100,13,$pobasicblock,3,'N~O',3,null,'BAS',1)");
 717          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'subtotal','vtiger_purchaseorder',1,'72','hdnSubTotal','Sub Total',1,2,'',100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)");
 718          //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process
 719          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'taxtype','vtiger_purchaseorder',1,'16','hdnTaxType','Tax Type',1,2,'',100,14,$pobasicblock,3,'V~O',3,null,'BAS',1)");
 720          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'discount_percent','vtiger_purchaseorder',1,'1','hdnDiscountPercent','Discount Percent',1,2,'',100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)");
 721          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'discount_amount','vtiger_purchaseorder',1,'72','hdnDiscountAmount','Discount Amount',1,0,'',100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)");
 722          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'s_h_amount','vtiger_purchaseorder',1,'72','hdnS_H_Amount','S&H Amount',1,2,'',100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)");
 723  
 724          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'postatus','vtiger_purchaseorder',1,'15','postatus','Status',1,2,'',100,15,$pobasicblock,1,'V~M',3,null,'BAS',1)");
 725          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,16,$pobasicblock,1,'V~M',3,null,'BAS',1)");
 726          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,17,$pobasicblock,2,'DT~O',3,null,'BAS',0)");
 727          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,18,$pobasicblock,2,'DT~O',3,null,'BAS',0)");
 728          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,22,$pobasicblock,3,'V~O',3,null,'BAS',0)");
 729  
 730          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'currency_id','vtiger_purchaseorder',1,'117','currency_id','Currency',1,2,1,100,19,$pobasicblock,3,'I~O',3,null,'BAS',1)");
 731          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'conversion_rate','vtiger_purchaseorder',1,'1','conversion_rate','Conversion Rate',1,2,1,100,20,$pobasicblock,3,'N~O',3,null,'BAS',1)");
 732  
 733          //Block 59
 734  
 735          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'bill_street','vtiger_pobillads',1,'24','bill_street','Billing Address',1,2,'',100,1,$poaddressblock,1,'V~M',3,null,'BAS',1)");
 736          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'ship_street','vtiger_poshipads',1,'24','ship_street','Shipping Address',1,2,'',100,2,$poaddressblock,1,'V~M',3,null,'BAS',1)");
 737  
 738          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'bill_city','vtiger_pobillads',1,'1','bill_city','Billing City',1,2,'',100,5,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 739          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'ship_city','vtiger_poshipads',1,'1','ship_city','Shipping City',1,2,'',100,6,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 740  
 741          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'bill_state','vtiger_pobillads',1,'1','bill_state','Billing State',1,2,'',100,7,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 742          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'ship_state','vtiger_poshipads',1,'1','ship_state','Shipping State',1,2,'',100,8,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 743  
 744          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'bill_code','vtiger_pobillads',1,'1','bill_code','Billing Code',1,2,'',100,9,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 745          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'ship_code','vtiger_poshipads',1,'1','ship_code','Shipping Code',1,2,'',100,10,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 746  
 747  
 748          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'bill_country','vtiger_pobillads',1,'1','bill_country','Billing Country',1,2,'',100,11,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 749          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'ship_country','vtiger_poshipads',1,'1','ship_country','Shipping Country',1,2,'',100,12,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 750  
 751          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'bill_pobox','vtiger_pobillads',1,'1','bill_pobox','Billing Po Box',1,2,'',100,3,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 752          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'ship_pobox','vtiger_poshipads',1,'1','ship_pobox','Shipping Po Box',1,2,'',100,4,$poaddressblock,1,'V~O',3,null,'BAS',1)");
 753  
 754          //Block61
 755          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,$podescription,1,'V~O',3,null,'ADV',1)");
 756  
 757          //Block62
 758          $this->db->query("insert into vtiger_field values (21," . $this->db->getUniqueID("vtiger_field") . ",'terms_conditions','vtiger_purchaseorder',1,'19','terms_conditions','Terms & Conditions',1,2,'',100,1,$potermsblock,1,'V~O',3,null,'ADV',1)");
 759  
 760          //Purchase Order Details -- END
 761          //Sales Order Details -- START
 762          //Block63
 763          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'salesorder_no','vtiger_salesorder',1,'4','salesorder_no','SalesOrder No',1,0,'',100,4,$sobasicblock ,1,'V~O',3,null,'BAS',0)");
 764          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'subject','vtiger_salesorder',1,'2','subject','Subject',1,0,'',100,1,$sobasicblock ,1,'V~M',3,null,'BAS',1)");
 765          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'potentialid','vtiger_salesorder',1,'76','potential_id','Potential Name',1,2,'',100,2,$sobasicblock ,1,'I~O',3,null,'BAS',1)");
 766          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'customerno','vtiger_salesorder',1,'1','customerno','Customer No',1,2,'',100,3,$sobasicblock ,1,'V~O',3,null,'BAS',1)");
 767          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'quoteid','vtiger_salesorder',1,'78','quote_id','Quote Name',1,2,'',100,5,$sobasicblock ,1,'I~O',3,null,'BAS',1)");
 768          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'purchaseorder','vtiger_salesorder',1,'1','vtiger_purchaseorder','Purchase Order',1,2,'',100,5,$sobasicblock ,1,'V~O',3,null,'BAS',1)");
 769  
 770          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'contactid','vtiger_salesorder',1,'57','contact_id','Contact Name',1,2,'',100,6,$sobasicblock ,1,'I~O',3,null,'BAS',1)");
 771          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'duedate','vtiger_salesorder',1,'5','duedate','Due Date',1,2,'',100,8,$sobasicblock ,1,'D~O',3,null,'BAS',1)");
 772          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'carrier','vtiger_salesorder',1,'15','carrier','Carrier',1,2,'',100,9,$sobasicblock ,1,'V~O',3,null,'BAS',1)");
 773          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'pending','vtiger_salesorder',1,'1','pending','Pending',1,2,'',100,10,$sobasicblock ,1,'V~O',3,null,'BAS',1)");
 774          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'sostatus','vtiger_salesorder',1,'15','sostatus','Status',1,2,'',100,11,$sobasicblock ,1,'V~M',3,null,'BAS',1)");
 775          //$this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'salestax','vtiger_salesorder',1,'1','txtTax','Sales Tax',1,0,'',100,12,63,3,'N~O',1,null,'BAS',1)");
 776          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'adjustment','vtiger_salesorder',1,'72','txtAdjustment','Adjustment',1,2,'',100,12,$sobasicblock ,3,'NN~O',3,null,'BAS',1)");
 777          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'salescommission','vtiger_salesorder',1,'1','salescommission','Sales Commission',1,2,'',100,13,$sobasicblock ,1,'N~O',3,null,'BAS',1)");
 778          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'exciseduty','vtiger_salesorder',1,'1','exciseduty','Excise Duty',1,2,'',100,13,$sobasicblock ,1,'N~O',3,null,'BAS',1)");
 779          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'total','vtiger_salesorder',1,'72','hdnGrandTotal','Total',1,2,'',100,14,$sobasicblock ,3,'N~O',3,null,'BAS',1)");
 780          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'subtotal','vtiger_salesorder',1,'72','hdnSubTotal','Sub Total',1,2,'',100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)");
 781          //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process
 782          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'taxtype','vtiger_salesorder',1,'16','hdnTaxType','Tax Type',1,2,'',100,15,$sobasicblock ,3,'V~O',3,null,'BAS',1)");
 783          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'discount_percent','vtiger_salesorder',1,'1','hdnDiscountPercent','Discount Percent',1,2,'',100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)");
 784          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'discount_amount','vtiger_salesorder',1,'72','hdnDiscountAmount','Discount Amount',1,0,'',100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)");
 785          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'s_h_amount','vtiger_salesorder',1,'72','hdnS_H_Amount','S&H Amount',1,2,'',100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)");
 786  
 787          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'accountid','vtiger_salesorder',1,'73','account_id','Account Name',1,2,'',100,16,$sobasicblock ,1,'I~M',3,null,'BAS',1)");
 788          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,17,$sobasicblock ,1,'V~M',3,null,'BAS',1)");
 789          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,18,$sobasicblock ,2,'DT~O',3,null,'BAS',0)");
 790          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,19,$sobasicblock ,2,'DT~O',3,null,'BAS',0)");
 791          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,22,$sobasicblock,3,'V~O',3,null,'BAS',0)");
 792  
 793          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'currency_id','vtiger_salesorder',1,'117','currency_id','Currency',1,2,1,100,20,$sobasicblock ,3,'I~O',3,null,'BAS',1)");
 794          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'conversion_rate','vtiger_salesorder',1,'1','conversion_rate','Conversion Rate',1,2,1,100,21,$sobasicblock ,3,'N~O',3,null,'BAS',1)");
 795          //Block 65
 796  
 797          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'bill_street','vtiger_sobillads',1,'24','bill_street','Billing Address',1,2,'',100,1,$soaddressblock,1,'V~M',3,null,'BAS',1)");
 798          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'ship_street','vtiger_soshipads',1,'24','ship_street','Shipping Address',1,2,'',100,2,$soaddressblock,1,'V~M',3,null,'BAS',1)");
 799  
 800          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'bill_city','vtiger_sobillads',1,'1','bill_city','Billing City',1,2,'',100,5,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 801          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'ship_city','vtiger_soshipads',1,'1','ship_city','Shipping City',1,2,'',100,6,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 802  
 803          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'bill_state','vtiger_sobillads',1,'1','bill_state','Billing State',1,2,'',100,7,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 804          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'ship_state','vtiger_soshipads',1,'1','ship_state','Shipping State',1,2,'',100,8,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 805  
 806          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'bill_code','vtiger_sobillads',1,'1','bill_code','Billing Code',1,2,'',100,9,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 807          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'ship_code','vtiger_soshipads',1,'1','ship_code','Shipping Code',1,2,'',100,10,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 808  
 809  
 810          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'bill_country','vtiger_sobillads',1,'1','bill_country','Billing Country',1,2,'',100,11,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 811          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'ship_country','vtiger_soshipads',1,'1','ship_country','Shipping Country',1,2,'',100,12,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 812  
 813          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'bill_pobox','vtiger_sobillads',1,'1','bill_pobox','Billing Po Box',1,2,'',100,3,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 814          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'ship_pobox','vtiger_soshipads',1,'1','ship_pobox','Shipping Po Box',1,2,'',100,4,$soaddressblock,1,'V~O',3,null,'BAS',1)");
 815  
 816          //Block67
 817          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,$sodescription,1,'V~O',3,null,'ADV',1)");
 818  
 819          //Block68
 820          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID("vtiger_field") . ",'terms_conditions','vtiger_salesorder',1,'19','terms_conditions','Terms & Conditions',1,2,'',100,1,$sotermsblock,1,'V~O',3,null,'ADV',1)");
 821  
 822          // Add fields for the Recurring Information block - Block 86
 823          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID('vtiger_field') . ",'enable_recurring','vtiger_salesorder',1,'56','enable_recurring','Enable Recurring',1,0,'',100,1,$sorecurringinvoiceblock,1,'C~O',3,null,'BAS',0)");
 824          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID('vtiger_field') . ",'recurring_frequency','vtiger_invoice_recurring_info',1,'16','recurring_frequency','Frequency',1,0,'',100,2,$sorecurringinvoiceblock,1,'V~O',3,null,'BAS',0)");
 825          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID('vtiger_field') . ",'start_period','vtiger_invoice_recurring_info',1,'5','start_period','Start Period',1,0,'',100,3,$sorecurringinvoiceblock,1,'D~O',3,null,'BAS',0)");
 826          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID('vtiger_field') . ",'end_period','vtiger_invoice_recurring_info',1,'5','end_period','End Period',1,0,'',100,4,$sorecurringinvoiceblock,1,'D~O~OTH~G~start_period~Start Period',3,null,'BAS',0)");
 827          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID('vtiger_field') . ",'payment_duration','vtiger_invoice_recurring_info',1,'16','payment_duration','Payment Duration',1,0,'',100,5,$sorecurringinvoiceblock,1,'V~O',3,null,'BAS',0)");
 828          $this->db->query("insert into vtiger_field values (22," . $this->db->getUniqueID('vtiger_field') . ",'invoice_status','vtiger_invoice_recurring_info',1,'15','invoicestatus','Invoice Status',1,0,'',100,6,$sorecurringinvoiceblock,1,'V~M',3,null,'BAS',0)");
 829  
 830          //Sales Order Details -- END
 831          //Invoice Details -- START
 832          //Block69
 833  
 834          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'subject','vtiger_invoice',1,'2','subject','Subject',1,0,'',100,1,$invoicebasicblock,1,'V~M',3,null,'BAS',1)");
 835          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'salesorderid','vtiger_invoice',1,'80','salesorder_id','Sales Order',1,2,'',100,2,$invoicebasicblock,1,'I~O',3,null,'BAS',1)");
 836          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'customerno','vtiger_invoice',1,'1','customerno','Customer No',1,2,'',100,3,$invoicebasicblock,1,'V~O',3,null,'BAS',1)");
 837  
 838  
 839          //to include contact name vtiger_field in Invoice-start
 840          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'contactid','vtiger_invoice',1,'57','contact_id','Contact Name',1,2,'',100,4,$invoicebasicblock,1,'I~O',3,null,'BAS',1)");
 841          //end
 842  
 843          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'invoicedate','vtiger_invoice',1,'5','invoicedate','Invoice Date',1,2,'',100,5,$invoicebasicblock,1,'D~O',3,null,'BAS',1)");
 844          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'duedate','vtiger_invoice',1,'5','duedate','Due Date',1,2,'',100,6,$invoicebasicblock,1,'D~O',3,null,'BAS',1)");
 845          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'purchaseorder','vtiger_invoice',1,'1','vtiger_purchaseorder','Purchase Order',1,2,'',100,8,$invoicebasicblock,1,'V~O',3,null,'BAS',1)");
 846          //$this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'salestax','vtiger_invoice',1,'1','txtTax','Sales Tax',1,0,'',100,9,69,3,'N~O',1,null,'BAS',1)");
 847          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'adjustment','vtiger_invoice',1,'72','txtAdjustment','Adjustment',1,2,'',100,9,$invoicebasicblock,3,'NN~O',3,null,'BAS',1)");
 848          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'salescommission','vtiger_invoice',1,'1','salescommission','Sales Commission',1,2,'',10,13,$invoicebasicblock,1,'N~O',3,null,'BAS',1)");
 849          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'exciseduty','vtiger_invoice',1,'1','exciseduty','Excise Duty',1,2,'',100,11,$invoicebasicblock,1,'N~O',3,null,'BAS',1)");
 850          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'subtotal','vtiger_invoice',1,'72','hdnSubTotal','Sub Total',1,2,'',100,12,$invoicebasicblock,3,'N~O',3,null,'BAS',1)");
 851          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'total','vtiger_invoice',1,'72','hdnGrandTotal','Total',1,2,'',100,13,$invoicebasicblock,3,'N~O',3,null,'BAS',1)");
 852          //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process
 853          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'taxtype','vtiger_invoice',1,'16','hdnTaxType','Tax Type',1,2,'',100,13,$invoicebasicblock,3,'V~O',3,null,'BAS',1)");
 854          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'discount_percent','vtiger_invoice',1,'1','hdnDiscountPercent','Discount Percent',1,2,'',100,13,$invoicebasicblock,3,'N~O',3,null,'BAS',1)");
 855          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'discount_amount','vtiger_invoice',1,'72','hdnDiscountAmount','Discount Amount',1,2,'',100,13,$invoicebasicblock,3,'N~O',3,null,'BAS',1)");
 856          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'s_h_amount','vtiger_invoice',1,'72','hdnS_H_Amount','S&H Amount',1,2,'',100,14,67,3,'N~O',3,null,'BAS',1)");
 857  
 858          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'accountid','vtiger_invoice',1,'73','account_id','Account Name',1,2,'',100,14,$invoicebasicblock,1,'I~M',3,null,'BAS',1)");
 859          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'invoicestatus','vtiger_invoice',1,'15','invoicestatus','Status',1,2,'',100,15,$invoicebasicblock,1,'V~O',3,null,'BAS',1)");
 860          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,'',100,16,$invoicebasicblock,1,'V~M',3,null,'BAS',1)");
 861          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,'',100,17,$invoicebasicblock,2,'DT~O',3,null,'BAS',0)");
 862          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,'',100,18,$invoicebasicblock,2,'DT~O',3,null,'BAS',0)");
 863          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'modifiedby','vtiger_crmentity',1,'52','modifiedby','Last Modified By',1,0,'',100,22,$invoicebasicblock,3,'V~O',3,null,'BAS',0)");
 864  
 865          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'currency_id','vtiger_invoice',1,'117','currency_id','Currency',1,2,1,100,19,$invoicebasicblock,3,'I~O',3,null,'BAS',1)");
 866          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'conversion_rate','vtiger_invoice',1,'1','conversion_rate','Conversion Rate',1,2,1,100,20,$invoicebasicblock,3,'N~O',3,null,'BAS',1)");
 867  
 868          //Block 71
 869  
 870          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'bill_street','vtiger_invoicebillads',1,'24','bill_street','Billing Address',1,2,'',100,1,$invoiceaddressblock,1,'V~M',3,null,'BAS',1)");
 871          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'ship_street','vtiger_invoiceshipads',1,'24','ship_street','Shipping Address',1,2,'',100,2,$invoiceaddressblock,1,'V~M',3,null,'BAS',1)");
 872  
 873          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'bill_city','vtiger_invoicebillads',1,'1','bill_city','Billing City',1,2,'',100,5,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 874          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'ship_city','vtiger_invoiceshipads',1,'1','ship_city','Shipping City',1,2,'',100,6,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 875  
 876          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'bill_state','vtiger_invoicebillads',1,'1','bill_state','Billing State',1,2,'',100,7,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 877          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'ship_state','vtiger_invoiceshipads',1,'1','ship_state','Shipping State',1,2,'',100,8,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 878  
 879          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'bill_code','vtiger_invoicebillads',1,'1','bill_code','Billing Code',1,2,'',100,9,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 880          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'ship_code','vtiger_invoiceshipads',1,'1','ship_code','Shipping Code',1,2,'',100,10,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 881  
 882  
 883          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'bill_country','vtiger_invoicebillads',1,'1','bill_country','Billing Country',1,2,'',100,11,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 884          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'ship_country','vtiger_invoiceshipads',1,'1','ship_country','Shipping Country',1,2,'',100,12,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 885  
 886          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'bill_pobox','vtiger_invoicebillads',1,'1','bill_pobox','Billing Po Box',1,2,'',100,3,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 887          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'ship_pobox','vtiger_invoiceshipads',1,'1','ship_pobox','Shipping Po Box',1,2,'',100,4,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)");
 888  
 889          //Block73
 890          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_crmentity',1,'19','description','Description',1,2,'',100,1,$invoicedescription,1,'V~O',3,null,'ADV',1)");
 891          //Block74
 892          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'terms_conditions','vtiger_invoice',1,'19','terms_conditions','Terms & Conditions',1,2,'',100,1,$invoicetermsblock,1,'V~O',3,null,'ADV',1)");
 893          //Added for Custom invoice Number
 894          $this->db->query("insert into vtiger_field values (23," . $this->db->getUniqueID("vtiger_field") . ",'invoice_no','vtiger_invoice',1,'4','invoice_no','Invoice No',1,0,'',100,3,$invoicebasicblock,1,'V~O',3,null,'BAS',0)");
 895  
 896          //Invoice Details -- END
 897          //users Details Starts Block 79,80,81
 898          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'user_name','vtiger_users',1,'106','user_name','User Name',1,0,'',11,1,$userloginandroleblockid,1,'V~M',1,null,'BAS',1)");
 899          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'is_admin','vtiger_users',1,'156','is_admin','Admin',1,0,'',3,2,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)");
 900          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'user_password','vtiger_users',1,'99','user_password','Password',1,0,'',30,3,$userloginandroleblockid,4,'P~M',1,null,'BAS',1)");
 901          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'confirm_password','vtiger_users',1,'99','confirm_password','Confirm Password',1,0,'',30,5,$userloginandroleblockid,4,'P~M',1,null,'BAS',1)");
 902          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'first_name','vtiger_users',1,'1','first_name','First Name',1,0,'',30,7,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)");
 903          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'last_name','vtiger_users',1,'2','last_name','Last Name',1,0,'',30,9,$userloginandroleblockid,1,'V~M',1,null,'BAS',1)");
 904          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'roleid','vtiger_user2role',1,'98','roleid','Role',1,0,'',200,11,$userloginandroleblockid,1,'V~M',1,null,'BAS',1)");
 905          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'email1','vtiger_users',1,'104','email1','Email',1,0,'',100,4,$userloginandroleblockid,1,'E~M',1,null,'BAS',1)");
 906          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'status','vtiger_users',1,'115','status','Status',1,0,'',100,6,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)");
 907          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'activity_view','vtiger_users',1,'16','activity_view','Default Activity View',1,0,'',100,12,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)");
 908          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'lead_view','vtiger_users',1,'16','lead_view','Default Lead View',1,0,'',100,10,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)");
 909          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'hour_format','vtiger_users',1,'116','hour_format','Calendar Hour Format',1,0,'',100,13,$userloginandroleblockid,3,'V~O',1,null,'BAS',1)");
 910          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'end_hour','vtiger_users',1,'116','end_hour','Day ends at',1,0,'',100,15,$userloginandroleblockid,3,'V~O',1,null,'BAS',1)");
 911          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'start_hour','vtiger_users',1,'116','start_hour','Day starts at',1,0,'',100,14,$userloginandroleblockid,3,'V~O',1,null,'BAS',1)");
 912          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'title','vtiger_users',1,'1','title','Title',1,0,'',50,1,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 913          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'phone_work','vtiger_users',1,'11','phone_work','Office Phone',1,0,'',50,5,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 914          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'department','vtiger_users',1,'1','department','Department',1,0,'',50,3,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 915          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'phone_mobile','vtiger_users',1,'11','phone_mobile','Mobile',1,0,'',50,7,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 916          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'reports_to_id','vtiger_users',1,'101','reports_to_id','Reports To',1,0,'',50,8,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 917          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'phone_other','vtiger_users',1,'11','phone_other','Other Phone',1,0,'',50,11,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 918          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'email2','vtiger_users',1,'13','email2','Other Email',1,0,'',100,4,$usermoreinfoblock,1,'E~O',1,null,'BAS',1)");
 919          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'phone_fax','vtiger_users',1,'11','phone_fax','Fax',1,0,'',50,2,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 920          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'secondaryemail','vtiger_users',1,'13','secondaryemail','Secondary Email',1,0,'',100,6,$usermoreinfoblock,1,'E~O',1,null,'BAS',1)");
 921          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'phone_home','vtiger_users',1,'11','phone_home','Home Phone',1,0,'',50,9,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 922          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'date_format','vtiger_users',1,'16','date_format','Date Format',1,0,'',30,12,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 923          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'signature','vtiger_users',1,'21','signature','Signature',1,0,'',250,13,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 924          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'description','vtiger_users',1,'21','description','Documents',1,0,'',250,14,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 925          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'address_street','vtiger_users',1,'21','address_street','Street Address',1,0,'',250,1,$useraddressblock,1,'V~O',1,null,'BAS',1)");
 926          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'address_city','vtiger_users',1,'1','address_city','City',1,0,'',100,3,$useraddressblock,1,'V~O',1,null,'BAS',1)");
 927          $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,'',100,5,$useraddressblock,1,'V~O',1,null,'BAS',1)");
 928          $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,'',100,4,$useraddressblock,1,'V~O',1,null,'BAS',1)");
 929          $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,'',100,2,$useraddressblock,1,'V~O',1,null,'BAS',1)");
 930          $this->db->query("insert into vtiger_field values(29," . $this->db->getUniqueID("vtiger_field") . ",'accesskey','vtiger_users',1,3,'accesskey','Webservice Access Key',1,0,'',100,2,$useradvanceblock,2,'V~O',1,null,'BAS',1);");
 931          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'time_zone','vtiger_users',1,'16','time_zone','Time Zone',1,0,'',200,15,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 932          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'currency_id','vtiger_users',1,'117','currency_id','Currency',1,0,'',100,1,$usercurrencyinfoblock,1,'I~O',1,null,'BAS',1)");
 933          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'currency_grouping_pattern','vtiger_users',1,'16','currency_grouping_pattern','Digit Grouping Pattern',1,0,'',100,2,$usercurrencyinfoblock,1,'V~O',1,null,'BAS',1)");
 934          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'currency_decimal_separator','vtiger_users',1,'16','currency_decimal_separator','Decimal Separator',1,0,'',2,3,$usercurrencyinfoblock,1,'V~O',1,null,'BAS',1)");
 935          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'currency_grouping_separator','vtiger_users',1,'16','currency_grouping_separator','Digit Grouping Separator',1,0,'',2,4,$usercurrencyinfoblock,1,'V~O',1,null,'BAS',1)");
 936          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'currency_symbol_placement','vtiger_users',1,'16','currency_symbol_placement','Symbol Placement',1,0,'',20,5,$usercurrencyinfoblock,1,'V~O',1,null,'BAS',1)");
 937  
 938          //User Image Information
 939          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'imagename','vtiger_users',1,'105','imagename','User Image',1,0,'',250,10,$userblockid,1,'V~O',1,null,'BAS',1)");
 940          //added for internl_mailer
 941          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'internal_mailer','vtiger_users',1,'56','internal_mailer','INTERNAL_MAIL_COMPOSER',1,0,'',50,15,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 942          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'theme','vtiger_users',1,'31','theme','Theme',1,0,'',100,16,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 943          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'language','vtiger_users',1,'32','language','Language',1,0,'',100,17,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)");
 944          $this->db->query("insert into vtiger_field values (29," . $this->db->getUniqueID("vtiger_field") . ",'reminder_interval','vtiger_users',1,'16','reminder_interval','Reminder Interval',1,0,'',100,1,$useradvanceblock,1,'V~O',1,null,'BAS',1)");
 945          //user Details End
 946          // Updated Phone field uitype
 947          $this->db->query("update vtiger_field set uitype='11' where fieldname='mobile' and tabid=" . getTabid('Leads'));
 948          $this->db->query("update vtiger_field set uitype='11' where fieldname='mobile' and tabid=" . getTabid('Contacts'));
 949          $this->db->query("update vtiger_field set uitype='11' where fieldname='fax' and tabid=" . getTabid('Leads'));
 950          $this->db->query("update vtiger_field set uitype='11' where fieldname='fax' and tabid=" . getTabid('Contacts'));
 951          $this->db->query("update vtiger_field set uitype='11' where fieldname='fax' and tabid=" . getTabid('Accounts'));
 952  
 953          $tab_field_array = array(
 954              'Accounts' => array('accountname'),
 955              'Contacts' => array('imagename'),
 956              'Products' => array('imagename', 'product_id'),
 957              'Invoice' => array('invoice_no', 'salesorder_id'),
 958              'SalesOrder' => array('quote_id', 'salesorder_no'),
 959              'PurchaseOrder' => array('purchaseorder_no'),
 960              'Quotes' => array('quote_no'),
 961              'HelpDesk' => array('filename'),
 962          );
 963          foreach ($tab_field_array as $index => $value) {
 964              $tabid = getTabid($index);
 965              $this->db->pquery("UPDATE vtiger_field SET masseditable=0 WHERE tabid=? AND fieldname IN (" . generateQuestionMarks($value) . ")", array($tabid, $value));
 966          }
 967  
 968          //Emails field added here
 969          $email_Tabid = getTabid('Emails');
 970          $blockquery = "select blockid from vtiger_blocks where blocklabel = ?";
 971          $blockres = $this->db->pquery($blockquery, array('LBL_EMAIL_INFORMATION'));
 972          $blockid = $this->db->query_result($blockres, 0, 'blockid');
 973          $this->db->query("INSERT INTO vtiger_field values($email_Tabid," . $this->db->getUniqueID("vtiger_field") . ",'from_email','vtiger_emaildetails',1,12,'from_email','From',1,2,'',100,1,$blockid,3,'V~M',3,NULL,'BAS',0)");
 974          $this->db->query("INSERT INTO vtiger_field values($email_Tabid," . $this->db->getUniqueID("vtiger_field") . ",'to_email','vtiger_emaildetails',1,8,'saved_toid','To',1,2,'',100,2,$blockid,1,'V~M',3,NULL,'BAS',0)");
 975          $this->db->query("INSERT INTO vtiger_field values($email_Tabid," . $this->db->getUniqueID("vtiger_field") . ",'cc_email','vtiger_emaildetails',1,8,'ccmail','CC',1,2,'',1000,3,$blockid,1,'V~O',3,NULL,'BAS',0)");
 976          $this->db->query("INSERT INTO vtiger_field values($email_Tabid," . $this->db->getUniqueID("vtiger_field") . ",'bcc_email','vtiger_emaildetails',1,8,'bccmail','BCC' ,1,2,'',1000,4,$blockid,1,'V~O',3,NULL,'BAS',0)");
 977          $this->db->query("INSERT INTO vtiger_field values($email_Tabid," . $this->db->getUniqueID("vtiger_field") . ",'idlists','vtiger_emaildetails',1,357,'parent_id','Parent ID' ,1,2,'',1000,5,$blockid,1,'V~O',3,NULL,'BAS',0)");
 978          $this->db->query("INSERT INTO vtiger_field values($email_Tabid," . $this->db->getUniqueID("vtiger_field") . ",'email_flag','vtiger_emaildetails',1,16,'email_flag','Email Flag' ,1,2,'',1000,6,$blockid,3,'V~O',3,NULL,'BAS',0)");
 979          //Emails fields ends
 980          //The Entity Name for the modules are maintained in this table
 981          $this->db->query("insert into vtiger_entityname values(7,'Leads','vtiger_leaddetails','firstname,lastname','leadid','leadid')");
 982          $this->db->query("insert into vtiger_entityname values(6,'Accounts','vtiger_account','accountname','accountid','account_id')");
 983          $this->db->query("insert into vtiger_entityname values(4,'Contacts','vtiger_contactdetails','firstname,lastname','contactid','contact_id')");
 984          $this->db->query("insert into vtiger_entityname values(2,'Potentials','vtiger_potential','potentialname','potentialid','potential_id')");
 985          $this->db->query("insert into vtiger_entityname values(8,'Documents','vtiger_notes','title','notesid','notesid')");
 986          $this->db->query("insert into vtiger_entityname values(13,'HelpDesk','vtiger_troubletickets','title','ticketid','ticketid')");
 987          $this->db->query("insert into vtiger_entityname values(9,'Calendar','vtiger_activity','subject','activityid','activityid')");
 988          $this->db->query("insert into vtiger_entityname values(10,'Emails','vtiger_activity','subject','activityid','activityid')");
 989          $this->db->query("insert into vtiger_entityname values(14,'Products','vtiger_products','productname','productid','product_id')");
 990          $this->db->query("insert into vtiger_entityname values(29,'Users','vtiger_users','first_name,last_name','id','id')");
 991          $this->db->query("insert into vtiger_entityname values(23,'Invoice','vtiger_invoice','subject','invoiceid','invoiceid')");
 992          $this->db->query("insert into vtiger_entityname values(20,'Quotes','vtiger_quotes','subject','quoteid','quote_id')");
 993          $this->db->query("insert into vtiger_entityname values(21,'PurchaseOrder','vtiger_purchaseorder','subject','purchaseorderid','purchaseorderid')");
 994          $this->db->query("insert into vtiger_entityname values(22,'SalesOrder','vtiger_salesorder','subject','salesorderid','salesorder_id')");
 995          $this->db->query("insert into vtiger_entityname values(18,'Vendors','vtiger_vendor','vendorname','vendorid','vendor_id')");
 996          $this->db->query("insert into vtiger_entityname values(19,'PriceBooks','vtiger_pricebook','bookname','pricebookid','pricebookid')");
 997          $this->db->query("insert into vtiger_entityname values(26,'Campaigns','vtiger_campaign','campaignname','campaignid','campaignid')");
 998          $this->db->query("insert into vtiger_entityname values(15,'Faq','vtiger_faq','question','id','id')");
 999          // Insert End
1000          //Inserting values into org share action mapping
1001          $this->db->query("insert into vtiger_org_share_action_mapping values(0,'Public: Read Only')");
1002          $this->db->query("insert into vtiger_org_share_action_mapping values(1,'Public: Read, Create/Edit')");
1003          $this->db->query("insert into vtiger_org_share_action_mapping values(2,'Public: Read, Create/Edit, Delete')");
1004          $this->db->query("insert into vtiger_org_share_action_mapping values(3,'Private')");
1005  
1006          $this->db->query("insert into vtiger_org_share_action_mapping values(4,'Hide Details')");
1007          $this->db->query("insert into vtiger_org_share_action_mapping values(5,'Hide Details and Add Events')");
1008          $this->db->query("insert into vtiger_org_share_action_mapping values(6,'Show Details')");
1009          $this->db->query("insert into vtiger_org_share_action_mapping values(7,'Show Details and Add Events')");
1010  
1011          //Inserting for all vtiger_tabs
1012          $def_org_tabid = Array(2, 4, 6, 7, 8, 9, 10, 13, 14, 16, 20, 21, 22, 23, 26);
1013  
1014          foreach ($def_org_tabid as $def_tabid) {
1015              $this->db->query("insert into vtiger_org_share_action2tab values(0," . $def_tabid . ")");
1016              $this->db->query("insert into vtiger_org_share_action2tab values(1," . $def_tabid . ")");
1017              $this->db->query("insert into vtiger_org_share_action2tab values(2," . $def_tabid . ")");
1018              $this->db->query("insert into vtiger_org_share_action2tab values(3," . $def_tabid . ")");
1019          }
1020  
1021          //Insert into default_org_sharingrule
1022          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",2,2,0)");
1023  
1024          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",4,2,2)");
1025  
1026          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",6,2,0)");
1027  
1028          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",7,2,0)");
1029  
1030          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",9,3,1)");
1031          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",13,2,0)");
1032          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",16,3,2)");
1033          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",20,2,0)");
1034          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",21,2,0)");
1035          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",22,2,0)");
1036          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",23,2,0)");
1037          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",26,2,0)");
1038          $this->db->query("insert into vtiger_def_org_share values (" . $this->db->getUniqueID('vtiger_def_org_share') . ",8,2,0)");
1039          $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",14,2,0)");
1040  
1041          //Populating the DataShare Related Modules
1042          //Lead Related Module
1043          //Account Related Module
1044          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",6,2)");
1045          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",6,13)");
1046          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",6,20)");
1047          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",6,22)");
1048          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",6,23)");
1049  
1050          //Potential Related Module
1051          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",2,20)");
1052          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",2,22)");
1053  
1054          //Quote Related Module
1055          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",20,22)");
1056  
1057          //SO Related Module
1058          $this->db->query("insert into vtiger_datashare_relatedmodules values (" . $this->db->getUniqueID('vtiger_datashare_relatedmodules') . ",22,23)");
1059  
1060  
1061  
1062  
1063          // New Secutity End
1064          //insert into the vtiger_notificationscheduler vtiger_table
1065          //insert into related list vtiger_table
1066          //Inserting for vtiger_account related lists
1067  
1068          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Contacts") . ",'get_contacts',1,'Contacts',0,'add')");
1069  
1070          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Potentials") . ",'get_opportunities',2,'Potentials',0,'add')");
1071  
1072          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Quotes") . ",'get_quotes',3,'Quotes',0,'add')");
1073  
1074          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("SalesOrder") . ",'get_salesorder',4,'Sales Order',0,'add')");
1075  
1076          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Invoice") . ",'get_invoices',5,'Invoice',0,'add')");
1077  
1078          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Calendar") . ",'get_activities',6,'Activities',0,'add')");
1079  
1080          //added for the ticket4109
1081          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Emails") . ",'get_emails',7,'Emails',0,'add')");
1082  
1083          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Calendar") . ",'get_history',8,'Activity History',0,'add')");
1084  
1085          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Documents") . ",'get_attachments',9,'Documents',0,'add,select')");
1086  
1087          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("HelpDesk") . ",'get_tickets',10,'HelpDesk',0,'add')");
1088  
1089          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Accounts") . "," . getTabid("Products") . ",'get_products',11,'Products',0,'select')");
1090  
1091          //Inserting Lead Related Lists
1092  
1093          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Leads") . "," . getTabid("Calendar") . ",'get_activities',1,'Activities',0,'add')");
1094  
1095          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Leads") . "," . getTabid("Emails") . ",'get_emails',2,'Emails',0,'add')");
1096  
1097          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Leads") . "," . getTabid("Calendar") . ",'get_history',3,'Activity History',0,'add')");
1098  
1099          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Leads") . "," . getTabid("Documents") . ",'get_attachments',4,'Documents',0,'add,select')");
1100  
1101          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Leads") . "," . getTabid("Products") . ",'get_products',5,'Products',0,'select')");
1102  
1103          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Leads") . "," . getTabid("Campaigns") . ",'get_campaigns',6,'Campaigns',0,'select')");
1104  
1105          //Inserting for contact related lists
1106          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Potentials") . ",'get_opportunities',1,'Potentials',0,'add')");
1107  
1108          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Calendar") . ",'get_activities',2,'Activities',0,'add')");
1109  
1110  
1111          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Emails") . ",'get_emails',3,'Emails',0,'add')");
1112  
1113  
1114          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("HelpDesk") . ",'get_tickets',4,'HelpDesk',0,'add')");
1115  
1116          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Quotes") . ",'get_quotes',5,'Quotes',0,'add')");
1117  
1118          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("PurchaseOrder") . ",'get_purchase_orders',6,'Purchase Order',0,'add')");
1119  
1120          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("SalesOrder") . ",'get_salesorder',7,'Sales Order',0,'add')");
1121  
1122          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Products") . ",'get_products',8,'Products',0,'select')");
1123  
1124          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Calendar") . ",'get_history',9,'Activity History',0,'add')");
1125  
1126          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Documents") . ",'get_attachments',10,'Documents',0,'add,select')");
1127  
1128          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Contacts") . "," . getTabid("Campaigns") . ",'get_campaigns',11,'Campaigns',0,'select')");
1129  
1130          $this->db->query("INSERT INTO vtiger_relatedlists VALUES(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid('Contacts') . "," . getTabid('Invoice') . ",'get_invoices',12,'Invoice',0, 'add')");
1131  
1132          //Inserting Potential Related Lists
1133  
1134          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . "," . getTabid("Calendar") . ",'get_activities',1,'Activities',0,'add')");
1135  
1136  
1137          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . "," . getTabid("Contacts") . ",'get_contacts',2,'Contacts',0,'select')");
1138  
1139  
1140          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . "," . getTabid("Products") . ",'get_products',3,'Products',0,'select')");
1141  
1142          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . ",0,'get_stage_history',4,'Sales Stage History',0,'')");
1143  
1144          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . "," . getTabid("Documents") . ",'get_attachments',5,'Documents',0,'add,select')");
1145  
1146          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . "," . getTabid("Quotes") . ",'get_Quotes',6,'Quotes',0,'add')");
1147  
1148          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . "," . getTabid("SalesOrder") . ",'get_salesorder',7,'Sales Order',0,'add')");
1149  
1150          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Potentials") . "," . getTabid("Calendar") . ",'get_history',8,'Activity History',0,'')");
1151  
1152          //Inserting Product Related Lists
1153  
1154          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("HelpDesk") . ",'get_tickets',1,'HelpDesk',0,'add')");
1155  
1156          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Documents") . ",'get_attachments',3,'Documents',0,'add,select')");
1157  
1158          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Quotes") . ",'get_quotes',4,'Quotes',0,'add')");
1159  
1160          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("PurchaseOrder") . ",'get_purchase_orders',5,'Purchase Order',0,'add')");
1161  
1162          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("SalesOrder") . ",'get_salesorder',6,'Sales Order',0,'add')");
1163  
1164          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Invoice") . ",'get_invoices',7,'Invoice',0,'add')");
1165  
1166          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("PriceBooks") . ",'get_product_pricebooks',8,'PriceBooks',0,'add')");
1167  
1168          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Leads") . ",'get_leads',9,'Leads',0,'select')");
1169          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Accounts") . ",'get_accounts',10,'Accounts',0,'select')");
1170          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Contacts") . ",'get_contacts',11,'Contacts',0,'select')");
1171          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Potentials") . ",'get_opportunities',12,'Potentials',0,'select')");
1172          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Products") . ",'get_products',13,'Product Bundles',0,'add,select')");
1173          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Products") . "," . getTabid("Products") . ",'get_parent_products',14,'Parent Product',0,'')");
1174  
1175          //Inserting Emails Related Lists
1176  
1177          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Emails") . "," . getTabid("Contacts") . ",'get_contacts',1,'Contacts',0,'select,bulkmail')");
1178          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Emails") . ",0,'get_users',2,'Users',0,'')");
1179          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Emails") . "," . getTabid("Documents") . ",'get_attachments',3,'Documents',0,'add,select')");
1180  
1181          //Inserting HelpDesk Related Lists
1182  
1183          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("HelpDesk") . "," . getTabid("Calendar") . ",'get_activities',1,'Activities',0,'add,select')");
1184          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("HelpDesk") . "," . getTabid("Documents") . ",'get_attachments',2,'Documents',0,'add,select')");
1185          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("HelpDesk") . ",0,'get_ticket_history',3,'Ticket History',0,'')");
1186          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("HelpDesk") . "," . getTabid("Calendar") . ",'get_history',4,'Activity History',0,'')");
1187  
1188          //Inserting PriceBook Related Lists
1189          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("PriceBooks") . ",14,'get_pricebook_products',2,'Products',0,'select')");
1190  
1191          // Inserting Vendor Related Lists
1192          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Vendors") . ",14,'get_products',1,'Products',0,'add,select')");
1193          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Vendors") . ",21,'get_purchase_orders',2,'Purchase Order',0,'add')");
1194          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Vendors") . ",4,'get_contacts',3,'Contacts',0,'select')");
1195          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Vendors") . "," . getTabid("Emails") . ",'get_emails',4,'Emails',0,'add')");
1196  
1197          // Inserting Quotes Related Lists
1198  
1199          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Quotes") . "," . getTabid("SalesOrder") . ",'get_salesorder',1,'Sales Order',0,'')");
1200          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Quotes") . ",9,'get_activities',2,'Activities',0,'add')");
1201          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Quotes") . "," . getTabid("Documents") . ",'get_attachments',3,'Documents',0,'add,select')");
1202          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Quotes") . ",9,'get_history',4,'Activity History',0,'')");
1203          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Quotes") . ",0,'get_quotestagehistory',5,'Quote Stage History',0,'')");
1204  
1205          // Inserting Purchase order Related Lists
1206  
1207          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("PurchaseOrder") . ",9,'get_activities',1,'Activities',0,'add')");
1208          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("PurchaseOrder") . "," . getTabid("Documents") . ",'get_attachments',2,'Documents',0,'add,select')");
1209          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("PurchaseOrder") . "," . getTabid("Calendar") . ",'get_history',3,'Activity History',0,'')");
1210          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("PurchaseOrder") . ",0,'get_postatushistory',4,'PurchaseOrder Status History',0,'')");
1211  
1212          // Inserting Sales order Related Lists
1213  
1214          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("SalesOrder") . ",9,'get_activities',1,'Activities',0,'add')");
1215          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("SalesOrder") . "," . getTabid("Documents") . ",'get_attachments',2,'Documents',0,'add,select')");
1216          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("SalesOrder") . "," . getTabid("Invoice") . ",'get_invoices',3,'Invoice',0,'')");
1217          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("SalesOrder") . "," . getTabid("Calendar") . ",'get_history',4,'Activity History',0,'')");
1218          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("SalesOrder") . ",0,'get_sostatushistory',5,'SalesOrder Status History',0,'')");
1219  
1220          // Inserting Invoice Related Lists
1221  
1222          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Invoice") . ",9,'get_activities',1,'Activities',0,'add')");
1223          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Invoice") . "," . getTabid("Documents") . ",'get_attachments',2,'Documents',0,'add,select')");
1224          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Invoice") . "," . getTabid("Calendar") . ",'get_history',3,'Activity History',0,'')");
1225          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Invoice") . ",0,'get_invoicestatushistory',4,'Invoice Status History',0,'')");
1226  
1227          // Inserting Activities Related Lists
1228  
1229          $this->db->query("insert into vtiger_relatedlists values (" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Calendar") . ",0,'get_users',1,'Users',0,'')");
1230          $this->db->query("insert into vtiger_relatedlists values (" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Calendar") . ",4,'get_contacts',2,'Contacts',0,'')");
1231  
1232          // Inserting Campaigns Related Lists
1233  
1234          $this->db->query("insert into vtiger_relatedlists values (" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Campaigns") . "," . getTabid("Contacts") . ",'get_contacts',1,'Contacts',0,'add,select')");
1235          $this->db->query("insert into vtiger_relatedlists values (" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Campaigns") . "," . getTabid("Leads") . ",'get_leads',2,'Leads',0,'add,select')");
1236          $this->db->query("insert into vtiger_relatedlists values (" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Campaigns") . "," . getTabid("Potentials") . ",'get_opportunities',3,'Potentials',0,'add')");
1237          $this->db->query("insert into vtiger_relatedlists values(" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Campaigns") . ",9,'get_activities',4,'Activities',0,'add')");
1238          $this->db->query("INSERT INTO vtiger_relatedlists VALUES (" . $this->db->getUniqueID('vtiger_relatedlists') . ", " . getTabid("Accounts") . ", " . getTabid("Campaigns") . ", 'get_campaigns', 13, 'Campaigns', 0, 'select')");
1239          $this->db->query("INSERT INTO vtiger_relatedlists VALUES (" . $this->db->getUniqueID('vtiger_relatedlists') . ", " . getTabid("Campaigns") . ", " . getTabid("Accounts") . ", 'get_accounts', 5, 'Accounts', 0, 'add,select')");
1240  
1241          // Inserting Faq's Related Lists
1242          $this->db->query("insert into vtiger_relatedlists values (" . $this->db->getUniqueID('vtiger_relatedlists') . "," . getTabid("Faq") . "," . getTabid("Documents") . ",'get_attachments',1,'Documents',0,'add,select')");
1243  
1244          $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')");
1245          $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (" . $this->db->getUniqueID("vtiger_notificationscheduler") . ",'LBL_BIG_DEAL_DESCRIPTION' ,1,'Big Deal notification','Success! A big deal has been won! ','LBL_BIG_DEAL')");
1246          $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (" . $this->db->getUniqueID("vtiger_notificationscheduler") . ",'LBL_TICKETS_DESCRIPTION',1,'Pending Tickets notification','Ticket pending please ','LBL_PENDING_TICKETS')");
1247          $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (" . $this->db->getUniqueID("vtiger_notificationscheduler") . ",'LBL_MANY_TICKETS_DESCRIPTION',1,'Too many tickets Notification','Too many tickets pending against this entity ','LBL_MANY_TICKETS')");
1248          $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label,type) values (" . $this->db->getUniqueID("vtiger_notificationscheduler") . ",'LBL_START_DESCRIPTION' ,1,'Support Start Notification','10','LBL_START_NOTIFICATION','select')");
1249          $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label,type) values (" . $this->db->getUniqueID("vtiger_notificationscheduler") . ",'LBL_SUPPORT_DESCRIPTION',1,'Support ending please','11','LBL_SUPPORT_NOTICIATION','select')");
1250          $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label,type) values (" . $this->db->getUniqueID("vtiger_notificationscheduler") . ",'LBL_SUPPORT_DESCRIPTION_MONTH',1,'Support ending please','12','LBL_SUPPORT_NOTICIATION_MONTH','select')");
1251          $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (" . $this->db->getUniqueID("vtiger_notificationscheduler") . ",'LBL_ACTIVITY_REMINDER_DESCRIPTION' ,1,'Activity Reminder Notification','This is a reminder notification for the Activity','LBL_ACTIVITY_NOTIFICATION')");
1252  
1253          //inserting actions for get_attachments
1254          $folderid = $this->db->getUniqueID("vtiger_attachmentsfolder");
1255          $this->db->query("insert into vtiger_attachmentsfolder values(" . $folderid . ",'Default','This is a Default Folder',1,1)");
1256  
1257          //Inserting Inventory Notifications
1258          $invoice_body = 'Dear {HANDLER},
1259  
1260  The current stock of {PRODUCTNAME} in our warehouse is {CURRENTSTOCK}. Kindly procure required number of units as the stock level is below reorder level {REORDERLEVELVALUE}.
1261  
1262  Please treat this information as Urgent as the invoice is already sent  to the customer.
1263  
1264  Severity: Critical
1265  
1266  Thanks,
1267  {CURRENTUSER}';
1268  
1269  
1270          $this->db->query("insert into vtiger_inventorynotification(notificationid,notificationname,notificationsubject,notificationbody,label) values (" . $this->db->getUniqueID("vtiger_inventorynotification") . ",'InvoiceNotification','{PRODUCTNAME} Stock Level is Low','" . $invoice_body . " ','InvoiceNotificationDescription')");
1271  
1272          $quote_body = 'Dear {HANDLER},
1273  
1274  Quote is generated for {QUOTEQUANTITY} units of {PRODUCTNAME}. The current stock of {PRODUCTNAME} in our warehouse is {CURRENTSTOCK}.
1275  
1276  Severity: Minor
1277  
1278  Thanks,
1279  {CURRENTUSER}';
1280  
1281  
1282          $this->db->query("insert into vtiger_inventorynotification(notificationid,notificationname,notificationsubject,notificationbody,label) values (" . $this->db->getUniqueID("vtiger_inventorynotification") . ",'QuoteNotification','Quote given for {PRODUCTNAME}','" . $quote_body . " ','QuoteNotificationDescription')");
1283  
1284          $so_body = 'Dear {HANDLER},
1285  
1286  SalesOrder is generated for {SOQUANTITY} units of {PRODUCTNAME}. The current stock of {PRODUCTNAME} in our warehouse is {CURRENTSTOCK}.
1287  
1288  Please treat this information  with priority as the sales order is already generated.
1289  
1290  Severity: Major
1291  
1292  Thanks,
1293  {CURRENTUSER}';
1294  
1295  
1296          $this->db->query("insert into vtiger_inventorynotification(notificationid,notificationname,notificationsubject,notificationbody,label) values (" . $this->db->getUniqueID("vtiger_inventorynotification") . ",'SalesOrderNotification','Sales Order generated for {PRODUCTNAME}','" . $so_body . " ','SalesOrderNotificationDescription')");
1297  
1298  //insert into inventory terms and conditions table
1299  
1300          $inv_tandc_text = '
1301   - Unless otherwise agreed in writing by the supplier all invoices are payable within thirty (30) days of the date of invoice, in the currency of the invoice, drawn on a bank based in India or by such other method as is agreed in advance by the Supplier.
1302  
1303   - All prices are not inclusive of VAT which shall be payable in addition by the Customer at the applicable rate.';
1304  
1305          $this->db->query("insert into vtiger_inventory_tandc(id,type,tandc) values (" . $this->db->getUniqueID("vtiger_inventory_tandc") . ", 'Inventory', '" . $inv_tandc_text . "')");
1306  
1307  //insert into email template vtiger_table
1308  
1309          $body = 'Hello!   <br />
1310      <br />
1311      On behalf of the vtiger team,  I am pleased to announce the release of vtiger crm4.2 . This is a feature packed release including the mass email template handling, custom view feature, vtiger_reports feature and a host of other utilities. vtiger runs on all platforms.    <br />
1312          <br />
1313      Notable Features of vtiger are :   <br />
1314      <br />
1315      -Email Client Integration    <br />
1316      -Trouble Ticket Integration   <br />
1317      -Invoice Management Integration   <br />
1318      -Reports Integration   <br />
1319      -Portal Integration   <br />
1320      -Enhanced Word Plugin Support   <br />
1321      -Custom View Integration   <br />
1322      <br />
1323      Known Issues:   <br />
1324      -ABCD   <br />
1325      -EFGH   <br />
1326      -IJKL   <br />
1327      -MNOP   <br />
1328      -QRST';
1329  
1330          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Announcement for Release','Announcement for Release','Announcement of a release','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1331  
1332  
1333  
1334          $body = 'name <br />
1335  street, <br />
1336  city, <br />
1337  state, <br />
1338   zip) <br />
1339    <br />
1340   Dear <br />
1341   <br />
1342   Please check the following invoices that are yet to be paid by you: <br />
1343   <br />
1344   No. Date      Amount <br />
1345   1   1/1/01    $4000 <br />
1346   2   2/2//01   $5000 <br />
1347   3   3/3/01    $10000 <br />
1348   4   7/4/01    $23560 <br />
1349   <br />
1350   Kindly let us know if there are any issues that you feel are pending to be discussed. <br />
1351   We will be more than happy to give you a call. <br />
1352   We would like to continue our business with you.';
1353  
1354  
1355          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Pending Invoices','Invoices Pending','Payment Due','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1356  
1357  
1358  
1359  
1360  
1361          $body = ' Dear <br />
1362   <br />
1363  Your proposal on the project XYZW has been reviewed by us <br />
1364  and is acceptable in its entirety. <br />
1365   <br />
1366  We are eagerly looking forward to this project <br />
1367  and are pleased about having the opportunity to work <br />
1368  together. We look forward to a long standing relationship <br />
1369  with your esteemed firm. <br />
1370  <br />
1371  I would like to take this opportunity to invite you <br />
1372  to a game of golf on Wednesday morning 9am at the <br />
1373  Cuff Links Ground. We will be waiting for you in the <br />
1374  Executive Lounge. <br />
1375  <br />
1376  Looking forward to seeing you there.';
1377  
1378  
1379          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Acceptance Proposal','Acceptance Proposal','Acceptance of Proposal','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1380  
1381  
1382          $body = ' The undersigned hereby acknowledges receipt and delivery of the goods. <br />
1383  The undersigned will release the payment subject to the goods being discovered not satisfactory. <br />
1384  <br />
1385  Signed under seal this <date>';
1386  
1387  
1388          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Goods received acknowledgement','Goods received acknowledgement','Acknowledged Receipt of Goods','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1389  
1390  
1391          $body = ' Dear <br />
1392           We are in receipt of your order as contained in the <br />
1393     purchase order form.We consider this to be final and binding on both sides. <br />
1394  If there be any exceptions noted, we shall consider them <br />
1395  only if the objection is received within ten days of receipt of <br />
1396  this notice. <br />
1397   <br />
1398  Thank you for your patronage.';
1399  
1400  
1401  
1402  
1403          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Accept Order','Accept Order','Acknowledgement/Acceptance of Order','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1404  
1405  
1406  
1407  
1408          $body = 'Dear <br />
1409   <br />
1410  We are relocating our office to <br />
1411  11111,XYZDEF Cross, <br />
1412  UVWWX Circle <br />
1413  The telephone number for this new location is (101) 1212-1328. <br />
1414  <br />
1415  Our Manufacturing Division will continue operations <br />
1416  at 3250 Lovedale Square Avenue, in Frankfurt. <br />
1417  <br />
1418  We hope to keep in touch with you all. <br />
1419  Please update your addressbooks.';
1420  
1421  
1422          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Address Change','Change of Address','Address Change','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1423  
1424  
1425  
1426          $body = 'Dear <br />
1427  <br />
1428  Thank you for extending us the opportunity to meet with <br />
1429  you and members of your staff. <br />
1430  <br />
1431  I know that John Doe serviced your account <br />
1432  for many years and made many friends at your firm. He has personally <br />
1433  discussed with me the deep relationship that he had with your firm. <br />
1434  While his presence will be missed, I can promise that we will <br />
1435  continue to provide the fine service that was accorded by <br />
1436  John to your firm. <br />
1437  <br />
1438  I was genuinely touched to receive such fine hospitality. <br />
1439  <br />
1440  Thank you once again.';
1441  
1442  
1443  
1444          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Follow Up','Follow Up','Follow Up of meeting','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1445  
1446  
1447  
1448          $body = 'Congratulations! <br />
1449  <br />
1450  The numbers are in and I am proud to inform you that our <br />
1451  total sales for the previous quarter <br />
1452  amounts to $100,000,00.00!. This is the first time <br />
1453  we have exceeded the target by almost 30%. <br />
1454  We have also beat the previous quarter record by a <br />
1455  whopping 75%! <br />
1456  <br />
1457  Let us meet at Smoking Joe for a drink in the evening! <br />
1458  
1459  C you all there guys!';
1460  
1461  
1462  
1463          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Target Crossed!','Target Crossed!','Fantastic Sales Spree!','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1464  
1465          $body = 'Dear <br />
1466  <br />
1467  Thank you for your confidence in our ability to serve you. <br />
1468  We are glad to be given the chance to serve you.I look <br />
1469  forward to establishing a long term partnership with you. <br />
1470  Consider me as a friend. <br />
1471  Should any need arise,please do give us a call.';
1472  
1473  
1474  
1475          $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') . ")");
1476  
1477  //Added for HTML Eemail templates..
1478  //for Customer Portal Login details
1479          $body = '<table width="700" cellspacing="0" cellpadding="0" border="0" align="center" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; text-decoration: none; background-color: rgb(122, 122, 254);">
1480          <tr>
1481              <td> </td>
1482              <td> </td>
1483              <td> </td>
1484          </tr>
1485          <tr>
1486              <td> </td>
1487              <td> </td>
1488              <td> </td>
1489          </tr>
1490          <tr>
1491              <td> </td>
1492              <td> </td>
1493              <td> </td>
1494          </tr>
1495          <tr>
1496              <td width="50"> </td>
1497              <td>
1498              <table width="100%" cellspacing="0" cellpadding="0" border="0">
1499                      <tr>
1500                          <td>
1501                          <table width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: rgb(27, 77, 140); font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(255, 255, 255); font-weight: normal; line-height: 25px;">
1502                                  <tr>
1503                                      <td align="center" rowspan="4">$logo$</td>
1504                                      <td align="center"> </td>
1505                                  </tr>
1506                                  <tr>
1507                                      <td align="left" style="background-color: rgb(27, 77, 140); font-family: Arial,Helvetica,sans-serif; font-size: 24px; color: rgb(255, 255, 255); font-weight: bolder; line-height: 35px;">vtiger CRM<br /> </td>
1508                                  </tr>
1509                                  <tr>
1510                                      <td align="right" style="padding-right: 100px;">The honest Open Source CRM </td>
1511                                  </tr>
1512                                  <tr>
1513                                      <td> </td>
1514                                  </tr>
1515                          </table>
1516                          </td>
1517                      </tr>
1518                      <tr>
1519                          <td>
1520                          <table width="100%" cellspacing="0" cellpadding="0" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
1521                                  <tr>
1522                                      <td valign="top">
1523                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
1524                                              <tr>
1525                                                  <td align="right" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(66, 66, 253);"> </td>
1526                                              </tr>
1527                                              <tr>
1528                                                  <td> </td>
1529                                              </tr>
1530                                              <tr>
1531                                                  <td style="font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(22, 72, 134); font-weight: bolder; line-height: 15px;">Dear $contact_name$, </td>
1532                                              </tr>
1533                                              <tr>
1534                                                  <td style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; text-align: justify; line-height: 20px;"> Thank you very much for subscribing to the vtiger CRM - annual support service.<br />Here is your self service portal login details:</td>
1535                                              </tr>
1536                                              <tr>
1537                                                  <td align="center">
1538                                                  <table width="75%" cellspacing="0" cellpadding="10" border="0" style="border: 2px solid rgb(180, 180, 179); background-color: rgb(226, 226, 225); font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal;">
1539                                                          <tr>
1540                                                              <td><br />User ID     : <font color="#990000"><strong> $login_name$</strong></font> </td>
1541                                                          </tr>
1542                                                          <tr>
1543                                                              <td>Password: <font color="#990000"><strong> $password$</strong></font> </td>
1544                                                          </tr>
1545                                                          <tr>
1546                                                              <td align="center"> <strong>  $URL$<br /> </strong> </td>
1547                                                          </tr>
1548                                                  </table>
1549                                                  </td>
1550                                              </tr>
1551                                              <tr>
1552                                                  <td style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; text-align: justify; line-height: 20px;"><strong>NOTE:</strong> We suggest you to change your password after logging in first time. <br /><br /> <strong><u>Help Documentation</u></strong><br />  <br /> After logging in to vtiger Self-service Portal first time, you can access the vtiger CRM documents from the <strong>Documents</strong> tab. Following documents are available for your reference:<br />
1553                                                  <ul>
1554                                                      <li>Installation Manual (Windows &amp; Linux OS)<br /> </li>
1555                                                      <li>User &amp; Administrator Manual<br /> </li>
1556                                                      <li>vtiger Customer Portal - User Manual<br /> </li>
1557                                                      <li>vtiger Outlook Plugin - User Manual<br /> </li>
1558                                                      <li>vtiger Office Plug-in - User Manual<br /> </li>
1559                                                      <li>vtiger Thunderbird Extension - User Manual<br /> </li>
1560                                                      <li>vtiger Web Forms - User Manual<br /> </li>
1561                                                      <li>vtiger Firefox Tool bar - User Manual<br /> </li>
1562                                                  </ul>
1563                                                  <br />  <br /> <strong><u>Knowledge Base</u></strong><br /> <br /> Periodically we update frequently asked question based on our customer experiences. You can access the latest articles from the <strong>FAQ</strong> tab.<br /> <br /> <strong><u>vtiger CRM - Details</u></strong><br /> <br /> Kindly let us know your current vtiger CRM version and system specification so that we can provide you necessary guidelines to enhance your vtiger CRM system performance. Based on your system specification we alert you about the latest security &amp; upgrade patches.<br />  <br />             Thank you once again and wish you a wonderful experience with vtiger CRM.<br /> </td>
1564                                              </tr>
1565                                              <tr>
1566                                                  <td align="right"><strong style="padding: 2px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: bold;"><br /><br />Best Regards</strong></td>
1567                                              </tr>
1568                                              <tr>
1569                                                  <td align="right" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; line-height: 20px;">$support_team$ </td>
1570                                              </tr>
1571                                              <tr>
1572                                                  <td align="right"><a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(66, 66, 253);" href="http://www.vtiger.com">www.vtiger.com</a></td>
1573                                              </tr>
1574                                              <tr>
1575                                                  <td> </td>
1576                                              </tr>
1577                                      </table>
1578                                      </td>
1579                                      <td width="1%" valign="top"> </td>
1580                                  </tr>
1581                          </table>
1582                          </td>
1583                      </tr>
1584                      <tr>
1585                          <td>
1586                          <table width="100%" cellspacing="0" cellpadding="5" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(255, 255, 255); font-weight: normal; line-height: 15px; background-color: rgb(51, 51, 51);">
1587                                  <tr>
1588                                      <td align="center">Shree Narayana Complex, No 11 Sarathy Nagar, Vijaya Nagar , Velachery, Chennai - 600 042 India </td>
1589                                  </tr>
1590                                  <tr>
1591                                      <td align="center">Telephone No: +91 - 44 - 4202 - 1990     Toll Free No: +1 877 788 4437</td>
1592                                  </tr>
1593                                  <tr>
1594                                      <td align="center">Email Id: <a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(255, 255, 255);" href="mailto:[email protected]">[email protected]</a></td>
1595                                  </tr>
1596                          </table>
1597                          </td>
1598                      </tr>
1599              </table>
1600              </td>
1601              <td width="50"> </td>
1602          </tr>
1603          <tr>
1604              <td> </td>
1605              <td> </td>
1606              <td> </td>
1607          </tr>
1608          <tr>
1609              <td> </td>
1610              <td> </td>
1611              <td> </td>
1612          </tr>
1613          <tr>
1614              <td> </td>
1615              <td> </td>
1616              <td> </td>
1617          </tr>
1618  </table>';
1619  
1620          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Customer Login Details','Customer Portal Login Details','Send Portal login details to customer','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1621  
1622  
1623  //for Support end notification before a week
1624          $body = '<table width="700" cellspacing="0" cellpadding="0" border="0" align="center" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; text-decoration: none; background-color: rgb(122, 122, 254);">
1625          <tr>
1626              <td> </td>
1627              <td> </td>
1628              <td> </td>
1629          </tr>
1630          <tr>
1631              <td> </td>
1632              <td> </td>
1633              <td> </td>
1634          </tr>
1635          <tr>
1636              <td> </td>
1637              <td> </td>
1638              <td> </td>
1639          </tr>
1640          <tr>
1641              <td width="50"> </td>
1642              <td>
1643              <table width="100%" cellspacing="0" cellpadding="0" border="0">
1644                      <tr>
1645                          <td>
1646                          <table width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: rgb(27, 77, 140); font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(255, 255, 255); font-weight: normal; line-height: 25px;">
1647                                  <tr>
1648                                      <td align="center" rowspan="4">$logo$</td>
1649                                      <td align="center"> </td>
1650                                  </tr>
1651                                  <tr>
1652                                      <td align="left" style="background-color: rgb(27, 77, 140); font-family: Arial,Helvetica,sans-serif; font-size: 24px; color: rgb(255, 255, 255); font-weight: bolder; line-height: 35px;">vtiger CRM </td>
1653                                  </tr>
1654                                  <tr>
1655                                      <td align="right" style="padding-right: 100px;">The honest Open Source CRM </td>
1656                                  </tr>
1657                                  <tr>
1658                                      <td> </td>
1659                                  </tr>
1660                          </table>
1661                          </td>
1662                      </tr>
1663                      <tr>
1664                          <td>
1665                          <table width="100%" cellspacing="0" cellpadding="0" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
1666                                  <tr>
1667                                      <td valign="top">
1668                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
1669                                              <tr>
1670                                                  <td align="right" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(66, 66, 253);"> </td>
1671                                              </tr>
1672                                              <tr>
1673                                                  <td> </td>
1674                                              </tr>
1675                                              <tr>
1676                                                  <td style="font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(22, 72, 134); font-weight: bolder; line-height: 15px;">Dear $contacts-lastname$, </td>
1677                                              </tr>
1678                                              <tr>
1679                                                  <td style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; text-align: justify; line-height: 20px;">This is just a notification mail regarding your support end.<br /><span style="font-weight: bold;">Priority:</span> Urgent<br />Your Support is going to expire on next week<br />Please contact [email protected].<br /><br /><br /></td>
1680                                              </tr>
1681                                              <tr>
1682                                                  <td align="center"><br /></td>
1683                                              </tr>
1684                                              <tr>
1685                                                  <td align="right"><strong style="padding: 2px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: bold;"><br /><br />Sincerly</strong></td>
1686                                              </tr>
1687                                              <tr>
1688                                                  <td align="right" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; line-height: 20px;">Support Team </td>
1689                                              </tr>
1690                                              <tr>
1691                                                  <td align="right"><a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(66, 66, 253);" href="http://www.vtiger.com">www.vtiger.com</a></td>
1692                                              </tr>
1693                                              <tr>
1694                                                  <td> </td>
1695                                              </tr>
1696                                      </table>
1697                                      </td>
1698                                      <td width="1%" valign="top"> </td>
1699                                  </tr>
1700                          </table>
1701                          </td>
1702                      </tr>
1703                      <tr>
1704                          <td>
1705                          <table width="100%" cellspacing="0" cellpadding="5" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(255, 255, 255); font-weight: normal; line-height: 15px; background-color: rgb(51, 51, 51);">
1706                                  <tr>
1707                                      <td align="center">Shree Narayana Complex, No 11 Sarathy Nagar, Vijaya Nagar , Velachery, Chennai - 600 042 India </td>
1708                                  </tr>
1709                                  <tr>
1710                                      <td align="center">Telephone No: +91 - 44 - 4202 - 1990     Toll Free No: +1 877 788 4437</td>
1711                                  </tr>
1712                                  <tr>
1713                                      <td align="center">Email Id: <a style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(255, 255, 255);" href="mailto:[email protected]">[email protected]</a></td>
1714                                  </tr>
1715                          </table>
1716                          </td>
1717                      </tr>
1718              </table>
1719              </td>
1720              <td width="50"> </td>
1721          </tr>
1722          <tr>
1723              <td> </td>
1724              <td> </td>
1725              <td> </td>
1726          </tr>
1727          <tr>
1728              <td> </td>
1729              <td> </td>
1730              <td> </td>
1731          </tr>
1732          <tr>
1733              <td> </td>
1734              <td> </td>
1735              <td> </td>
1736          </tr>
1737  </table>';
1738          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Support end notification before a week','VtigerCRM Support Notification','Send Notification mail to customer before a week of support end date','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1739  
1740  
1741  //for Support end notification before a month
1742          $body = '<table width="700" cellspacing="0" cellpadding="0" border="0" align="center" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; text-decoration: none; background-color: rgb(122, 122, 254);">
1743          <tr>
1744              <td> </td>
1745              <td> </td>
1746              <td> </td>
1747          </tr>
1748          <tr>
1749              <td> </td>
1750              <td> </td>
1751              <td> </td>
1752          </tr>
1753          <tr>
1754              <td> </td>
1755              <td> </td>
1756              <td> </td>
1757          </tr>
1758          <tr>
1759              <td width="50"> </td>
1760              <td>
1761              <table width="100%" cellspacing="0" cellpadding="0" border="0">
1762                      <tr>
1763                          <td>
1764                          <table width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color: rgb(27, 77, 140); font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(255, 255, 255); font-weight: normal; line-height: 25px;">
1765                                  <tr>
1766                                      <td align="center" rowspan="4">$logo$</td>
1767                                      <td align="center"> </td>
1768                                  </tr>
1769                                  <tr>
1770                                      <td align="left" style="background-color: rgb(27, 77, 140); font-family: Arial,Helvetica,sans-serif; font-size: 24px; color: rgb(255, 255, 255); font-weight: bolder; line-height: 35px;">vtiger CRM </td>
1771                                  </tr>
1772                                  <tr>
1773                                      <td align="right" style="padding-right: 100px;">The honest Open Source CRM </td>
1774                                  </tr>
1775                                  <tr>
1776                                      <td> </td>
1777                                  </tr>
1778                          </table>
1779                          </td>
1780                      </tr>
1781                      <tr>
1782                          <td>
1783                          <table width="100%" cellspacing="0" cellpadding="0" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: normal; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
1784                                  <tr>
1785                                      <td valign="top">
1786                                      <table width="100%" cellspacing="0" cellpadding="5" border="0">
1787                                              <tr>
1788                                                  <td align="right" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(66, 66, 253);"> </td>
1789                                              </tr>
1790                                              <tr>
1791                                                  <td> </td>
1792                                              </tr>
1793                                              <tr>
1794                                                  <td style="font-family: Arial,Helvetica,sans-serif; font-size: 14px; color: rgb(22, 72, 134); font-weight: bolder; line-height: 15px;">Dear $contacts-lastname$, </td>
1795                                              </tr>
1796                                              <tr>
1797                                                  <td style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; text-align: justify; line-height: 20px;">This is just a notification mail regarding your support end.<br /><span style="font-weight: bold;">Priority:</span> Normal<br />Your Support is going to expire on next month.<br />Please contact [email protected]<br /><br /><br /></td>
1798                                              </tr>
1799                                              <tr>
1800                                                  <td align="center"><br /></td>
1801                                              </tr>
1802                                              <tr>
1803                                                  <td align="right"><strong style="padding: 2px; font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: bold;"><br /><br />Sincerly</strong></td>
1804                                              </tr>
1805                                              <tr>
1806                                                  <td align="right" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(0, 0, 0); font-weight: normal; line-height: 20px;">Support Team </td>
1807                                              </tr>
1808                                              <tr>
1809                                                  <td align="right"><a href="http://www.vtiger.com" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(66, 66, 253);">www.vtiger.com</a></td>
1810                                              </tr>
1811                                              <tr>
1812                                                  <td> </td>
1813                                              </tr>
1814                                      </table>
1815                                      </td>
1816                                      <td width="1%" valign="top"> </td>
1817                                  </tr>
1818                          </table>
1819                          </td>
1820                      </tr>
1821                      <tr>
1822                          <td>
1823                          <table width="100%" cellspacing="0" cellpadding="5" border="0" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; color: rgb(255, 255, 255); font-weight: normal; line-height: 15px; background-color: rgb(51, 51, 51);">
1824                                  <tr>
1825                                      <td align="center">Shree Narayana Complex, No 11 Sarathy Nagar, Vijaya Nagar , Velachery, Chennai - 600 042 India </td>
1826                                  </tr>
1827                                  <tr>
1828                                      <td align="center">Telephone No: +91 - 44 - 4202 - 1990     Toll Free No: +1 877 788 4437</td>
1829                                  </tr>
1830                                  <tr>
1831                                      <td align="center">Email Id: <a href="mailto:[email protected]" style="font-family: Arial,Helvetica,sans-serif; font-size: 12px; font-weight: bolder; text-decoration: none; color: rgb(255, 255, 255);">[email protected]</a></td>
1832                                  </tr>
1833                          </table>
1834                          </td>
1835                      </tr>
1836              </table>
1837              </td>
1838              <td width="50"> </td>
1839          </tr>
1840          <tr>
1841              <td> </td>
1842              <td> </td>
1843              <td> </td>
1844          </tr>
1845          <tr>
1846              <td> </td>
1847              <td> </td>
1848              <td> </td>
1849          </tr>
1850          <tr>
1851              <td> </td>
1852              <td> </td>
1853              <td> </td>
1854          </tr>
1855  </table>';
1856          $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Support end notification before a month','VtigerCRM Support Notification','Send Notification mail to customer before a month of support end date','" . $body . "',0," . $this->db->getUniqueID('vtiger_emailtemplates') . ")");
1857  
1858  
1859          //Insert into vtiger_organizationdetails vtiger_table
1860          $organizationId = $this->db->getUniqueID('vtiger_organizationdetails');
1861          $this->db->query("insert into vtiger_organizationdetails(organization_id,organizationname,address,city,state,country,code,phone,fax,website,logoname,vatid)
1862                                  values ($organizationId,'vtiger','95, 12th Main Road, 3rd Block, Rajajinagar','Bangalore',
1863                                          'Karnataka','India','560010','+91 9243602352','+91 9243602352','www.vtiger.com','vtiger-crm-logo.png','1234-5678-9012')");
1864  
1865  
1866          $this->db->query("insert into vtiger_actionmapping values(0,'Save',0)");
1867          $this->db->query("insert into vtiger_actionmapping values(1,'EditView',0)");
1868          $this->db->query("insert into vtiger_actionmapping values(2,'Delete',0)");
1869          $this->db->query("insert into vtiger_actionmapping values(3,'index',0)");
1870          $this->db->query("insert into vtiger_actionmapping values(4,'DetailView',0)");
1871          $this->db->query("insert into vtiger_actionmapping values(5,'Import',0)");
1872          $this->db->query("insert into vtiger_actionmapping values(6,'Export',0)");
1873          //$this->db->query("insert into vtiger_actionmapping values(7,'AddBusinessCard',0)");
1874          $this->db->query("insert into vtiger_actionmapping values(8,'Merge',0)");
1875          $this->db->query("insert into vtiger_actionmapping values(1,'VendorEditView',1)");
1876          $this->db->query("insert into vtiger_actionmapping values(4,'VendorDetailView',1)");
1877          $this->db->query("insert into vtiger_actionmapping values(0,'SaveVendor',1)");
1878          $this->db->query("insert into vtiger_actionmapping values(2,'DeleteVendor',1)");
1879          $this->db->query("insert into vtiger_actionmapping values(1,'PriceBookEditView',1)");
1880          $this->db->query("insert into vtiger_actionmapping values(4,'PriceBookDetailView',1)");
1881          $this->db->query("insert into vtiger_actionmapping values(0,'SavePriceBook',1)");
1882          $this->db->query("insert into vtiger_actionmapping values(2,'DeletePriceBook',1)");
1883          $this->db->query("insert into vtiger_actionmapping values(9,'ConvertLead',0)");
1884          $this->db->query("insert into vtiger_actionmapping values(1,'DetailViewAjax',1)");
1885          $this->db->query("insert into vtiger_actionmapping values(4,'TagCloud',1)");
1886          $this->db->query("insert into vtiger_actionmapping values(1,'QuickCreate',1)");
1887          $this->db->query("insert into vtiger_actionmapping values(3,'Popup',1)");
1888          $this->db->query("insert into vtiger_actionmapping values(10,'DuplicatesHandling',0)");
1889  
1890          //added by jeri for category view from db
1891          $this->db->query("insert into vtiger_parenttab values (1,'My Home Page',1,0)");
1892          $this->db->query("insert into vtiger_parenttab values (2,'Marketing',2,0)");
1893          $this->db->query("insert into vtiger_parenttab values (3,'Sales',3,0)");
1894          $this->db->query("insert into vtiger_parenttab values (4,'Support',4,0)");
1895          $this->db->query("insert into vtiger_parenttab values (5,'Analytics',5,0)");
1896          $this->db->query("insert into vtiger_parenttab values (6,'Inventory',6,0)");
1897          $this->db->query("insert into vtiger_parenttab values (7,'Tools',7,0)");
1898          $this->db->query("insert into vtiger_parenttab values (8,'Settings',8,0)");
1899  
1900          $this->db->query("insert into vtiger_parenttabrel values (1,9,2)");
1901          $this->db->query("insert into vtiger_parenttabrel values (1,28,4)");
1902          $this->db->query("insert into vtiger_parenttabrel values (1,3,1)");
1903          $this->db->query("insert into vtiger_parenttabrel values (3,7,1)");
1904          $this->db->query("insert into vtiger_parenttabrel values (3,6,2)");
1905          $this->db->query("insert into vtiger_parenttabrel values (3,4,3)");
1906          $this->db->query("insert into vtiger_parenttabrel values (3,2,4)");
1907          $this->db->query("insert into vtiger_parenttabrel values (3,20,5)");
1908          $this->db->query("insert into vtiger_parenttabrel values (3,22,6)");
1909          $this->db->query("insert into vtiger_parenttabrel values (3,23,7)");
1910          $this->db->query("insert into vtiger_parenttabrel values (3,19,8)");
1911          $this->db->query("insert into vtiger_parenttabrel values (3,8,9)");
1912          $this->db->query("insert into vtiger_parenttabrel values (4,13,1)");
1913          $this->db->query("insert into vtiger_parenttabrel values (4,15,2)");
1914          $this->db->query("insert into vtiger_parenttabrel values (4,6,3)");
1915          $this->db->query("insert into vtiger_parenttabrel values (4,4,4)");
1916          $this->db->query("insert into vtiger_parenttabrel values (4,8,5)");
1917          $this->db->query("insert into vtiger_parenttabrel values (5,1,2)");
1918          $this->db->query("insert into vtiger_parenttabrel values (5,25,1)");
1919          $this->db->query("insert into vtiger_parenttabrel values (6,14,1)");
1920          $this->db->query("insert into vtiger_parenttabrel values (6,18,2)");
1921          $this->db->query("insert into vtiger_parenttabrel values (6,19,3)");
1922          $this->db->query("insert into vtiger_parenttabrel values (6,21,4)");
1923          $this->db->query("insert into vtiger_parenttabrel values (6,22,5)");
1924          $this->db->query("insert into vtiger_parenttabrel values (6,20,6)");
1925          $this->db->query("insert into vtiger_parenttabrel values (6,23,7)");
1926          $this->db->query("insert into vtiger_parenttabrel values (7,24,1)");
1927          $this->db->query("insert into vtiger_parenttabrel values (7,27,2)");
1928          $this->db->query("insert into vtiger_parenttabrel values (7,8,3)");
1929          $this->db->query("insert into vtiger_parenttabrel values (2,26,1)");
1930          $this->db->query("insert into vtiger_parenttabrel values (2,6,2)");
1931          $this->db->query("insert into vtiger_parenttabrel values (2,4,3)");
1932          $this->db->query("insert into vtiger_parenttabrel values (2,28,4)");
1933          $this->db->query("insert into vtiger_parenttabrel values (4,28,7)");
1934          $this->db->query("insert into vtiger_parenttabrel values (2,7,5)");
1935          $this->db->query("insert into vtiger_parenttabrel values (2,9,6)");
1936          $this->db->query("insert into vtiger_parenttabrel values (4,9,8)");
1937          $this->db->query("insert into vtiger_parenttabrel values (2,8,8)");
1938          $this->db->query("insert into vtiger_parenttabrel values (3,9,11)");
1939  
1940          //add settings page to database starts
1941          $this->addEntriesForSettings();
1942          //add settings page to database end
1943          //Added to populate the default inventory tax informations
1944          $vatid = $this->db->getUniqueID("vtiger_inventorytaxinfo");
1945          $salesid = $this->db->getUniqueID("vtiger_inventorytaxinfo");
1946          $serviceid = $this->db->getUniqueID("vtiger_inventorytaxinfo");
1947          $this->db->query("insert into vtiger_inventorytaxinfo values($vatid,'tax" . $vatid . "','VAT','4.50','0')");
1948          $this->db->query("insert into vtiger_inventorytaxinfo values($salesid,'tax" . $salesid . "','Sales','10.00','0')");
1949          $this->db->query("insert into vtiger_inventorytaxinfo values($serviceid,'tax" . $serviceid . "','Service','12.50','0')");
1950          //After added these taxes we should add these taxes as columns in vtiger_inventoryproductrel table
1951          $this->db->query("alter table vtiger_inventoryproductrel add column tax$vatid decimal(7,3) default NULL");
1952          $this->db->query("alter table vtiger_inventoryproductrel add column tax$salesid decimal(7,3) default NULL");
1953          $this->db->query("alter table vtiger_inventoryproductrel add column tax$serviceid decimal(7,3) default NULL");
1954  
1955          //Added to handle picklist uniqueid for the picklist values
1956          //$this->db->query("insert into vtiger_picklistvalues_seq values(1)");
1957          //Added to populate the default Shipping & Hanlding tax informations
1958          $shvatid = $this->db->getUniqueID("vtiger_shippingtaxinfo");
1959          $shsalesid = $this->db->getUniqueID("vtiger_shippingtaxinfo");
1960          $shserviceid = $this->db->getUniqueID("vtiger_shippingtaxinfo");
1961          $this->db->query("insert into vtiger_shippingtaxinfo values($shvatid,'shtax" . $shvatid . "','VAT','4.50','0')");
1962          $this->db->query("insert into vtiger_shippingtaxinfo values($shsalesid,'shtax" . $shsalesid . "','Sales','10.00','0')");
1963          $this->db->query("insert into vtiger_shippingtaxinfo values($shserviceid,'shtax" . $shserviceid . "','Service','12.50','0')");
1964          //After added these taxes we should add these taxes as columns in vtiger_inventoryshippingrel table
1965          $this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shvatid decimal(7,3) default NULL");
1966          $this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shsalesid decimal(7,3) default NULL");
1967          $this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shserviceid decimal(7,3) default NULL");
1968  
1969          //version file is included here because without including this file version cannot be get
1970          include ('vtigerversion.php');
1971          $this->db->query("insert into vtiger_version values(" . $this->db->getUniqueID('vtiger_version') . ",'" . $vtiger_current_version . "','" . $vtiger_current_version . "')");
1972  
1973          //Register default language English
1974          require_once ('vtlib/Vtiger/Language.php');
1975          $vtlanguage = new Vtiger_Language();
1976          $vtlanguage->register('en_us', 'US English', 'English', true, true, true);
1977  
1978          $this->initWebservices();
1979  
1980          /**
1981           * Setup module sequence numbering.
1982           */
1983          $modseq = array(
1984              'Leads' => 'LEA',
1985              'Accounts' => 'ACC',
1986              'Campaigns' => 'CAM',
1987              'Contacts' => 'CON',
1988              'Potentials' => 'POT',
1989              'HelpDesk' => 'TT',
1990              'Quotes' => 'QUO',
1991              'SalesOrder' => 'SO',
1992              'PurchaseOrder' => 'PO',
1993              'Invoice' => 'INV',
1994              'Products' => 'PRO',
1995              'Vendors' => 'VEN',
1996              'PriceBooks' => 'PB',
1997              'Faq' => 'FAQ',
1998              'Documents' => 'DOC'
1999          );
2000          foreach ($modseq as $modname => $prefix) {
2001              $this->addInventoryRows(
2002                      array(
2003                          array('semodule' => $modname, 'active' => '1', 'prefix' => $prefix, 'startid' => '1', 'curid' => '1')
2004                      )
2005              );
2006          }
2007  
2008          // Adding Sharing Types for Reports
2009          $this->db->query("insert into vtiger_reportfilters values(1,'Private')");
2010          $this->db->query("insert into vtiger_reportfilters values(2,'Public')");
2011          $this->db->query("insert into vtiger_reportfilters values(3,'Shared')");
2012  
2013          require ('modules/Utilities/Currencies.php');
2014          foreach ($currencies as $key => $value) {
2015              $this->db->query("insert into vtiger_currencies values(" . $this->db->getUniqueID("vtiger_currencies") . ",'$key','" . $value[0] . "','" . $value[1] . "')");
2016          }
2017  
2018          $this->addDefaultLeadMapping();
2019      }
2020  
2021  	function initWebservices() {
2022          $this->vtws_addEntityInfo();
2023          $this->vtws_addOperationInfo();
2024          $this->vtws_addFieldTypeInformation();
2025          $this->vtws_addFieldInfo();
2026      }
2027  
2028  	function vtws_addOperationInfo() {
2029          $operationMeta = array(
2030              "login" => array(
2031                  "include" => array(
2032                      "include/Webservices/Login.php"
2033                  ),
2034                  "handler" => "vtws_login",
2035                  "params" => array(
2036                      "username" => "String",
2037                      "accessKey" => "String"
2038                  ),
2039                  "prelogin" => 1,
2040                  "type" => "POST"
2041              ),
2042              "retrieve" => array(
2043                  "include" => array(
2044                      "include/Webservices/Retrieve.php"
2045                  ),
2046                  "handler" => "vtws_retrieve",
2047                  "params" => array(
2048                      "id" => "String"
2049                  ),
2050                  "prelogin" => 0,
2051                  "type" => "GET"
2052              ),
2053              "create" => array(
2054                  "include" => array(
2055                      "include/Webservices/Create.php"
2056                  ),
2057                  "handler" => "vtws_create",
2058                  "params" => array(
2059                      "elementType" => "String",
2060                      "element" => "encoded"
2061                  ),
2062                  "prelogin" => 0,
2063                  "type" => "POST"
2064              ),
2065              "update" => array(
2066                  "include" => array(
2067                      "include/Webservices/Update.php"
2068                  ),
2069                  "handler" => "vtws_update",
2070                  "params" => array(
2071                      "element" => "encoded"
2072                  ),
2073                  "prelogin" => 0,
2074                  "type" => "POST"
2075              ),
2076              "delete" => array(
2077                  "include" => array(
2078                      "include/Webservices/Delete.php"
2079                  ),
2080                  "handler" => "vtws_delete",
2081                  "params" => array(
2082                      "id" => "String"
2083                  ),
2084                  "prelogin" => 0,
2085                  "type" => "POST"
2086              ),
2087              "sync" => array(
2088                  "include" => array(
2089                      "include/Webservices/GetUpdates.php"
2090                  ),
2091                  "handler" => "vtws_sync",
2092                  "params" => array(
2093                      "modifiedTime" => "DateTime",
2094                      "elementType" => "String"
2095                  ),
2096                  "prelogin" => 0,
2097                  "type" => "GET"
2098              ),
2099              "query" => array(
2100                  "include" => array(
2101                      "include/Webservices/Query.php"
2102                  ),
2103                  "handler" => "vtws_query",
2104                  "params" => array(
2105                      "query" => "String"
2106                  ),
2107                  "prelogin" => 0,
2108                  "type" => "GET"
2109              ),
2110              "logout" => array(
2111                  "include" => array(
2112                      "include/Webservices/Logout.php"
2113                  ),
2114                  "handler" => "vtws_logout",
2115                  "params" => array(
2116                      "sessionName" => "String"
2117                  ),
2118                  "prelogin" => 0,
2119                  "type" => "POST"
2120              ),
2121              "listtypes" => array(
2122                  "include" => array(
2123                      "include/Webservices/ModuleTypes.php"
2124                  ),
2125                  "handler" => "vtws_listtypes",
2126                  "params" => array(
2127                      "fieldTypeList" => "encoded"
2128                  ),
2129                  "prelogin" => 0,
2130                  "type" => "GET"
2131              ),
2132              "getchallenge" => array(
2133                  "include" => array(
2134                      "include/Webservices/AuthToken.php"
2135                  ),
2136                  "handler" => "vtws_getchallenge",
2137                  "params" => array(
2138                      "username" => "String"
2139                  ),
2140                  "prelogin" => 1,
2141                  "type" => "GET"
2142              ),
2143              "describe" => array(
2144                  "include" => array(
2145                      "include/Webservices/DescribeObject.php"
2146                  ),
2147                  "handler" => "vtws_describe",
2148                  "params" => array(
2149                      "elementType" => "String"
2150                  ),
2151                  "prelogin" => 0,
2152                  "type" => "GET"
2153              ),
2154              "extendsession" => array(
2155                  "include" => array(
2156                      "include/Webservices/ExtendSession.php"
2157                  ),
2158                  "handler" => "vtws_extendSession",
2159                  'params' => array(),
2160                  "prelogin" => 1,
2161                  "type" => "POST"
2162              ),
2163              'convertlead' => array(
2164                  "include" => array(
2165                      "include/Webservices/ConvertLead.php"
2166                  ),
2167                  "handler" => "vtws_convertlead",
2168                  "prelogin" => 0,
2169                  "type" => "POST",
2170                  'params' => array(
2171                      'leadId' => 'String',
2172                      'assignedTo' => 'String',
2173                      'accountName' => 'String',
2174                      'avoidPotential' => 'Boolean',
2175                      'potential' => 'Encoded'
2176                  )
2177              ),
2178              "revise" => array(
2179                  "include" => array(
2180                      "include/Webservices/Revise.php"
2181                  ),
2182                  "handler" => "vtws_revise",
2183                  "params" => array(
2184                      "element" => "Encoded"
2185                  ),
2186                  "prelogin" => 0,
2187                  "type" => "POST"
2188              ),
2189              "changePassword" => array(
2190                  "include" => array(
2191                      "include/Webservices/ChangePassword.php"
2192                  ),
2193                  "handler" => "vtws_changePassword",
2194                  "params" => array(
2195                      "id" => "String",
2196                      "oldPassword" => "String",
2197                      "newPassword" => "String",
2198                      'confirmPassword' => 'String'
2199                  ),
2200                  "prelogin" => 0,
2201                  "type" => "POST"
2202              ),
2203              "deleteUser" => array(
2204                  "include" => array(
2205                      "include/Webservices/DeleteUser.php"
2206                  ),
2207                  "handler" => "vtws_deleteUser",
2208                  "params" => array(
2209                      "id" => "String",
2210                      "newOwnerId" => "String"
2211                  ),
2212                  "prelogin" => 0,
2213                  "type" => "POST"
2214              )
2215          );
2216  
2217          foreach ($operationMeta as $operationName => $operationDetails) {
2218              $operationId = vtws_addWebserviceOperation($operationName, $operationDetails['include'], $operationDetails['handler'], $operationDetails['type'], $operationDetails['prelogin']);
2219              $params = $operationDetails['params'];
2220              $sequence = 1;
2221              foreach ($params as $paramName => $paramType) {
2222                  vtws_addWebserviceOperationParam($operationId, $paramName, $paramType, $sequence++);
2223              }
2224          }
2225      }
2226  
2227  	function vtws_addEntityInfo() {
2228          require_once  'include/Webservices/Utils.php';
2229          $names = vtws_getModuleNameList();
2230          $moduleHandler = array('file' => 'include/Webservices/VtigerModuleOperation.php',
2231              'class' => 'VtigerModuleOperation');
2232  
2233          foreach ($names as $tab) {
2234              if (in_array($tab, array('Rss', 'Webmails', 'Recyclebin'))) {
2235                  continue;
2236              }
2237              $entityId = $this->db->getUniqueID("vtiger_ws_entity");
2238              $this->db->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', array($entityId, $tab, $moduleHandler['file'], $moduleHandler['class'], 1));
2239          }
2240  
2241          $entityId = $this->db->getUniqueID("vtiger_ws_entity");
2242          $this->db->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', array($entityId, 'Events', $moduleHandler['file'], $moduleHandler['class'], 1));
2243  
2244  
2245          $entityId = $this->db->getUniqueID("vtiger_ws_entity");
2246          $this->db->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', array($entityId, 'Users', $moduleHandler['file'], $moduleHandler['class'], 1));
2247  
2248          vtws_addDefaultActorTypeEntity('Groups', array('fieldNames' => 'groupname',
2249              'indexField' => 'groupid', 'tableName' => 'vtiger_groups'));
2250  
2251          require_once ("include/Webservices/WebServiceError.php");
2252          require_once  'include/Webservices/VtigerWebserviceObject.php';
2253          $webserviceObject = VtigerWebserviceObject::fromName($this->db, 'Groups');
2254          $this->db->pquery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values
2255              (?,?)", array($webserviceObject->getEntityId(), 'vtiger_groups'));
2256  
2257          vtws_addDefaultActorTypeEntity('Currency', array('fieldNames' => 'currency_name',
2258              'indexField' => 'id', 'tableName' => 'vtiger_currency_info'));
2259  
2260          $webserviceObject = VtigerWebserviceObject::fromName($this->db, 'Currency');
2261          $this->db->pquery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values (?,?)", array($webserviceObject->getEntityId(), 'vtiger_currency_info'));
2262  
2263          vtws_addDefaultActorTypeEntity('DocumentFolders', array('fieldNames' => 'foldername',
2264              'indexField' => 'folderid', 'tableName' => 'vtiger_attachmentsfolder'));
2265          $webserviceObject = VtigerWebserviceObject::fromName($this->db, 'DocumentFolders');
2266          $this->db->pquery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values (?,?)", array($webserviceObject->getEntityId(), 'vtiger_attachmentsfolder'));
2267  
2268          vtws_addActorTypeWebserviceEntityWithName(
2269                  'CompanyDetails', 'include/Webservices/VtigerCompanyDetails.php', 'VtigerCompanyDetails', array('fieldNames' => 'organizationname', 'indexField' => 'groupid', 'tableName' => 'vtiger_organizationdetails'));
2270          $webserviceObject = VtigerWebserviceObject::fromName($this->db, 'CompanyDetails');
2271          $this->db->pquery('INSERT INTO vtiger_ws_entity_tables(webservice_entity_id,table_name) VALUES (?,?)', array($webserviceObject->getEntityId(), 'vtiger_organizationdetails'));
2272      }
2273  
2274  	function vtws_addFieldInfo() {
2275          $this->db->pquery('INSERT INTO vtiger_ws_fieldinfo(id,property_name,property_value) VALUES (?,?,?)', array('vtiger_organizationdetails.organization_id', 'upload.path', '1'));
2276      }
2277  
2278  	function vtws_addFieldTypeInformation() {
2279          $fieldTypeInfo = array('picklist' => array(15, 16), 'text' => array(19, 20, 21, 24), 'autogenerated' => array(3), 'phone' => array(11),
2280              'multipicklist' => array(33), 'url' => array(17), 'skype' => array(85), 'boolean' => array(56, 156), 'owner' => array(53),
2281              'file' => array(61, 28), 'email' => array(13), 'currency' => array(71, 72));
2282  
2283          foreach ($fieldTypeInfo as $type => $uitypes) {
2284              foreach ($uitypes as $uitype) {
2285                  $result = $this->db->pquery("insert into vtiger_ws_fieldtype(uitype,fieldtype) values(?,?)", array($uitype, $type));
2286                  if (!is_object($result)) {
2287                      echo "Query for fieldtype details($uitype:uitype,$type:fieldtype)";
2288                  }
2289              }
2290          }
2291  
2292          $this->vtws_addReferenceTypeInformation();
2293      }
2294  
2295  	function vtws_addReferenceTypeInformation() {
2296          $referenceMapping = array("50" => array("Accounts"), "51" => array("Accounts"), "57" => array("Contacts"),
2297              "58" => array("Campaigns"), "73" => array("Accounts"), "75" => array("Vendors"), "76" => array("Potentials"),
2298              "78" => array("Quotes"), "80" => array("SalesOrder"), "81" => array("Vendors"), "101" => array("Users"), "52" => array("Users"),
2299              "357" => array("Contacts", "Accounts", "Leads", "Users", "Vendors"), "59" => array("Products"),
2300              "66" => array("Leads", "Accounts", "Potentials", "HelpDesk", "Campaigns"), "77" => array("Users"), "68" => array("Contacts", "Accounts"),
2301              "117" => array('Currency'), '26' => array('DocumentFolders'), '10' => array());
2302  
2303          foreach ($referenceMapping as $uitype => $referenceArray) {
2304              $success = true;
2305              $result = $this->db->pquery("insert into vtiger_ws_fieldtype(uitype,fieldtype) values(?,?)", array($uitype, "reference"));
2306              if (!is_object($result)) {
2307                  $success = false;
2308              }
2309              $result = $this->db->pquery("select * from vtiger_ws_fieldtype where uitype=?", array($uitype));
2310              $rowCount = $this->db->num_rows($result);
2311              for ($i = 0; $i < $rowCount; $i++) {
2312                  $fieldTypeId = $this->db->query_result($result, $i, "fieldtypeid");
2313                  foreach ($referenceArray as $index => $referenceType) {
2314                      $result = $this->db->pquery("insert into vtiger_ws_referencetype(fieldtypeid,type) values(?,?)", array($fieldTypeId, $referenceType));
2315                      if (!is_object($result)) {
2316                          echo "failed for: $referenceType, uitype: $fieldTypeId";
2317                          $success = false;
2318                      }
2319                  }
2320              }
2321              if (!$success) {
2322                  echo "Migration Query Failed";
2323              }
2324          }
2325  
2326          $success = true;
2327          $fieldTypeId = $this->db->getUniqueID("vtiger_ws_entity_fieldtype");
2328          $result = $this->db->pquery("insert into vtiger_ws_entity_fieldtype(fieldtypeid,table_name,field_name,fieldtype) values(?,?,?,?);", array($fieldTypeId, 'vtiger_attachmentsfolder', 'createdby', "reference"));
2329          if (!is_object($result)) {
2330              echo "failed fo init<br>";
2331              $success = false;
2332          }
2333          $fieldTypeId = $this->db->getUniqueID('vtiger_ws_entity_fieldtype');
2334          $result = $this->db->pquery('INSERT INTO vtiger_ws_entity_fieldtype(fieldtypeid,table_name,field_name,fieldtype) VALUES (?,?,?,?);', array($fieldTypeId, 'vtiger_organizationdetails', 'logoname', 'file'));
2335          if (!is_object($result)) {
2336              echo "failed fo init<br>";
2337              $success = false;
2338          }
2339          $fieldTypeId = $this->db->getUniqueID('vtiger_ws_entity_fieldtype');
2340          $result = $this->db->pquery('INSERT INTO vtiger_ws_entity_fieldtype(fieldtypeid,table_name,field_name,fieldtype) VALUES (?,?,?,?);', array($fieldTypeId, 'vtiger_organizationdetails', 'phone', 'phone'));
2341          if (!is_object($result)) {
2342              echo "failed fo init<br>";
2343              $success = false;
2344          }
2345          $fieldTypeId = $this->db->getUniqueID('vtiger_ws_entity_fieldtype');
2346          $result = $this->db->pquery('INSERT INTO vtiger_ws_entity_fieldtype(fieldtypeid,table_name,field_name,fieldtype) VALUES (?,?,?,?);', array($fieldTypeId, 'vtiger_organizationdetails', 'fax', 'phone'));
2347          if (!is_object($result)) {
2348              echo "failed fo init<br>";
2349              $success = false;
2350          }
2351          $fieldTypeId = $this->db->getUniqueID('vtiger_ws_entity_fieldtype');
2352          $result = $this->db->pquery('INSERT INTO vtiger_ws_entity_fieldtype(fieldtypeid,table_name,field_name,fieldtype) VALUES (?,?,?,?);', array($fieldTypeId, 'vtiger_organizationdetails', 'website', 'url'));
2353          if (!is_object($result)) {
2354              echo "failed fo init<br>";
2355              $success = false;
2356          }
2357  
2358          $result = $this->db->pquery("insert into vtiger_ws_entity_referencetype(fieldtypeid,type) values(?,?)", array($fieldTypeId, 'Users'));
2359          if (!is_object($result)) {
2360              echo "failed for: Users, fieldtypeid: $fieldTypeId";
2361              $success = false;
2362          }
2363          if (!$success) {
2364              echo "Migration Query Failed";
2365          }
2366      }
2367  
2368  	function addInventoryRows($paramArray) {
2369          global $adb;
2370  
2371          $fieldCreateCount = 0;
2372  
2373          for ($index = 0; $index < count($paramArray); ++$index) {
2374              $criteria = $paramArray[$index];
2375  
2376              $semodule = $criteria['semodule'];
2377  
2378              $modfocus = CRMEntity::getInstance($semodule);
2379              $modfocus->setModuleSeqNumber('configure', $semodule, $criteria['prefix'], $criteria['startid']);
2380          }
2381      }
2382  
2383      /**
2384       * this function adds the entries for settings page
2385       * it assumes entries as were present on 10-12-208
2386       */
2387  	function addEntriesForSettings() {
2388          global $adb;
2389  
2390          //icons for all fields
2391          $icons = array("ico-users.gif",
2392              "ico-roles.gif",
2393              "ico-profile.gif",
2394              "ico-groups.gif",
2395              "shareaccess.gif",
2396              "orgshar.gif",
2397              "set-IcoLoginHistory.gif",
2398              "vtlib_modmng.gif",
2399              "picklist.gif",
2400              "picklistdependency.gif",
2401              "menueditor.png",
2402              "notification.gif",
2403              "inventory.gif",
2404              "company.gif",
2405              "ogmailserver.gif",
2406              "currency.gif",
2407              "taxConfiguration.gif",
2408              "system.gif",
2409              "announ.gif",
2410              "set-IcoTwoTabConfig.gif",
2411              "terms.gif",
2412              "settingsInvNumber.gif",
2413              "mailScanner.gif",
2414              "settingsWorkflow.png",
2415              "migrate.gif",
2416              "Cron.png");
2417  
2418          //labels for blocks
2419          $blocks = array(
2420              'LBL_USER_MANAGEMENT',
2421              'LBL_STUDIO',
2422              'LBL_COMMUNICATION_TEMPLATES',
2423              'LBL_OTHER_SETTINGS'
2424              );
2425  
2426          //field names
2427          $names = array('LBL_USERS',
2428              'LBL_ROLES',
2429              'LBL_PROFILES',
2430              'USERGROUPLIST',
2431              'LBL_SHARING_ACCESS',
2432              'LBL_FIELDS_ACCESS',
2433              'LBL_LOGIN_HISTORY_DETAILS',
2434              'VTLIB_LBL_MODULE_MANAGER',
2435              'LBL_PICKLIST_EDITOR',
2436              'LBL_PICKLIST_DEPENDENCY_SETUP',
2437              'LBL_MENU_EDITOR',
2438              'NOTIFICATIONSCHEDULERS',
2439              'INVENTORYNOTIFICATION',
2440              'LBL_COMPANY_DETAILS',
2441              'LBL_MAIL_SERVER_SETTINGS',
2442              'LBL_CURRENCY_SETTINGS',
2443              'LBL_TAX_SETTINGS',
2444              'LBL_SYSTEM_INFO',
2445              'LBL_ANNOUNCEMENT',
2446              'LBL_DEFAULT_MODULE_VIEW',
2447              'INVENTORYTERMSANDCONDITIONS',
2448              'LBL_CUSTOMIZE_MODENT_NUMBER',
2449              'LBL_MAIL_SCANNER',
2450              'LBL_LIST_WORKFLOWS',
2451              'LBL_CONFIG_EDITOR',
2452              'Scheduler'
2453              );
2454  
2455  
2456          $name_blocks = array('LBL_USERS' => 'LBL_USER_MANAGEMENT',
2457              'LBL_ROLES' => 'LBL_USER_MANAGEMENT',
2458              'LBL_PROFILES' => 'LBL_USER_MANAGEMENT',
2459              'USERGROUPLIST' => 'LBL_USER_MANAGEMENT',
2460              'LBL_SHARING_ACCESS' => 'LBL_USER_MANAGEMENT',
2461              'LBL_FIELDS_ACCESS' => 'LBL_USER_MANAGEMENT',
2462              'LBL_LOGIN_HISTORY_DETAILS' => 'LBL_USER_MANAGEMENT',
2463              'VTLIB_LBL_MODULE_MANAGER' => 'LBL_STUDIO',
2464              'LBL_PICKLIST_EDITOR' => 'LBL_STUDIO',
2465              'LBL_PICKLIST_DEPENDENCY_SETUP' => 'LBL_STUDIO',
2466              'LBL_MENU_EDITOR' => 'LBL_STUDIO',
2467              'NOTIFICATIONSCHEDULERS' => 'LBL_COMMUNICATION_TEMPLATES',
2468              'INVENTORYNOTIFICATION' => 'LBL_COMMUNICATION_TEMPLATES',
2469              'LBL_COMPANY_DETAILS' => 'LBL_COMMUNICATION_TEMPLATES',
2470              'LBL_MAIL_SERVER_SETTINGS' => 'LBL_OTHER_SETTINGS',
2471              'LBL_CURRENCY_SETTINGS' => 'LBL_OTHER_SETTINGS',
2472              'LBL_TAX_SETTINGS' => 'LBL_OTHER_SETTINGS',
2473              'LBL_SYSTEM_INFO' => 'LBL_OTHER_SETTINGS',
2474              'LBL_ANNOUNCEMENT' => 'LBL_OTHER_SETTINGS',
2475              'LBL_DEFAULT_MODULE_VIEW' => 'LBL_OTHER_SETTINGS',
2476              'INVENTORYTERMSANDCONDITIONS' => 'LBL_OTHER_SETTINGS',
2477              'LBL_CUSTOMIZE_MODENT_NUMBER' => 'LBL_OTHER_SETTINGS',
2478              'LBL_MAIL_SCANNER' => 'LBL_OTHER_SETTINGS',
2479              'LBL_LIST_WORKFLOWS' => 'LBL_OTHER_SETTINGS',
2480              'LBL_CONFIG_EDITOR'=> 'LBL_OTHER_SETTINGS',
2481              'Scheduler' => 'LBL_OTHER_SETTINGS'
2482              );
2483  
2484  
2485          //description for fields
2486          $description = array('LBL_USER_DESCRIPTION',
2487              'LBL_ROLE_DESCRIPTION',
2488              'LBL_PROFILE_DESCRIPTION',
2489              'LBL_GROUP_DESCRIPTION',
2490              'LBL_SHARING_ACCESS_DESCRIPTION',
2491              'LBL_SHARING_FIELDS_DESCRIPTION',
2492              'LBL_LOGIN_HISTORY_DESCRIPTION',
2493              'VTLIB_LBL_MODULE_MANAGER_DESCRIPTION',
2494              'LBL_PICKLIST_DESCRIPTION',
2495              'LBL_PICKLIST_DEPENDENCY_DESCRIPTION',
2496              'LBL_MENU_DESC',
2497              'LBL_NOTIF_SCHED_DESCRIPTION',
2498              'LBL_INV_NOTIF_DESCRIPTION',
2499              'LBL_COMPANY_DESCRIPTION',
2500              'LBL_MAIL_SERVER_DESCRIPTION',
2501              'LBL_CURRENCY_DESCRIPTION',
2502              'LBL_TAX_DESCRIPTION',
2503              'LBL_SYSTEM_DESCRIPTION',
2504              'LBL_ANNOUNCEMENT_DESCRIPTION',
2505              'LBL_DEFAULT_MODULE_VIEW_DESC',
2506              'LBL_INV_TANDC_DESCRIPTION',
2507              'LBL_CUSTOMIZE_MODENT_NUMBER_DESCRIPTION',
2508              'LBL_MAIL_SCANNER_DESCRIPTION',
2509              'LBL_LIST_WORKFLOWS_DESCRIPTION',
2510              'LBL_CONFIG_EDITOR_DESCRIPTION',
2511              'Allows you to Configure Cron Task');
2512  
2513          $links = array(
2514              'index.php?module=Users&parent=Settings&view=List',
2515              'index.php?module=Roles&parent=Settings&view=Index',
2516              'index.php?module=Profiles&parent=Settings&view=List',
2517              'index.php?module=Groups&parent=Settings&view=List',
2518              'index.php?module=SharingAccess&parent=Settings&view=Index',
2519              'index.php?module=FieldAccess&parent=Settings&view=Index',
2520              'index.php?module=LoginHistory&parent=Settings&view=List',
2521              'index.php?module=ModuleManager&parent=Settings&view=List',
2522              'index.php?parent=Settings&module=Picklist&view=Index',
2523              'index.php?parent=Settings&module=PickListDependency&view=List',
2524              'index.php?module=MenuEditor&parent=Settings&view=Index',
2525              'index.php?module=Settings&view=listnotificationschedulers&parenttab=Settings',
2526              'index.php?module=Settings&view=listinventorynotifications&parenttab=Settings',
2527              'index.php?parent=Settings&module=Vtiger&view=CompanyDetails',
2528              'index.php?parent=Settings&module=Vtiger&view=OutgoingServerDetail',
2529              'index.php?parent=Settings&module=Currency&view=List',
2530              'index.php?module=Vtiger&parent=Settings&view=TaxIndex',
2531              'index.php?module=Settings&submodule=Server&view=ProxyConfig',
2532              'index.php?parent=Settings&module=Vtiger&view=AnnouncementEdit',
2533              'index.php?module=Settings&action=DefModuleView&parenttab=Settings',
2534              'index.php?parent=Settings&module=Vtiger&view=TermsAndConditionsEdit',
2535              'index.php?module=Vtiger&parent=Settings&view=CustomRecordNumbering',
2536              'index.php?parent=Settings&module=MailConverter&view=List',
2537              'index.php?module=Workflows&parent=Settings&view=List',
2538              'index.php?module=Vtiger&parent=Settings&view=ConfigEditorDetail',
2539              'index.php?module=CronTasks&parent=Settings&view=List'
2540              );
2541  
2542          //insert settings blocks
2543          $count = count($blocks);
2544          for ($i = 0; $i < $count; $i++) {
2545              $adb->query("insert into vtiger_settings_blocks values (" . $adb->getUniqueID('vtiger_settings_blocks') . ", '$blocks[$i]', $i+1)");
2546          }
2547  
2548          $count = count($icons);
2549          //insert settings fields
2550          for ($i = 0, $seq = 1; $i < $count; $i++, $seq++) {
2551              if ($i == 8 || $i == 12 || $i == 18) {
2552                  $seq = 1;
2553              }
2554              $adb->query("insert into vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) values (" . $adb->getUniqueID('vtiger_settings_field') . ", " . getSettingsBlockId($name_blocks[$names[$i]]) . ", '$names[$i]', '$icons[$i]', '$description[$i]', '$links[$i]', $seq)");
2555          }
2556  
2557          // for Workflow in settings page of every module
2558          $module_manager_id = getSettingsBlockId('LBL_OTHER_SETTINGS');
2559          $result = $adb->pquery("SELECT max(sequence) AS maxseq FROM vtiger_settings_field WHERE blockid = ?", array($module_manager_id));
2560          $maxseq = $adb->query_result($result, 0, 'maxseq');
2561          if ($maxseq < 0 || $maxseq == NULL) {
2562              $maxseq = 1;
2563          }
2564          $adb->pquery("INSERT INTO vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) VALUES (?,?,?,?,?,?,?)", array($adb->getUniqueID('vtiger_settings_field'), $module_manager_id, 'LBL_WORKFLOW_LIST', 'settingsWorkflow.png', 'LBL_AVAILABLE_WORKLIST_LIST', 'index.php?module=com_vtiger_workflow&action=workflowlist', $maxseq));
2565  
2566          //hide the system details tab for now
2567          $adb->query("update vtiger_settings_field set active=1 where name='LBL_SYSTEM_INFO'");
2568      }
2569  
2570  	function addDefaultLeadMapping() {
2571          global $adb;
2572  
2573          $fieldMap = array(
2574              array('company', 'accountname', null, 'potentialname', 0),
2575              array('industry', 'industry', null, null, 1),
2576              array('phone', 'phone', 'phone', null), 1,
2577              array('fax', 'fax', 'fax', null, 1),
2578              array('rating', 'rating', null, null, 1),
2579              array('email', 'email1', 'email', null, 0),
2580              array('website', 'website', null, null, 1),
2581              array('city', 'bill_city', 'mailingcity', null, 1),
2582              array('code', 'bill_code', 'mailingcode', null, 1),
2583              array('country', 'bill_country', 'mailingcountry', null, 1),
2584              array('state', 'bill_state', 'mailingstate', null, 1),
2585              array('lane', 'bill_street', 'mailingstreet', null, 1),
2586              array('pobox', 'bill_pobox', 'mailingpobox', null, 1),
2587              array('city', 'ship_city', null, null, 1),
2588              array('code', 'ship_code', null, null, 1),
2589              array('country', 'ship_country', null, null, 1),
2590              array('state', 'ship_state', null, null, 1),
2591              array('lane', 'ship_street', null, null, 1),
2592              array('pobox', 'ship_pobox', null, null, 1),
2593              array('description', 'description', 'description', 'description', 1),
2594              array('salutationtype', null, 'salutationtype', null, 1),
2595              array('firstname', null, 'firstname', null, 0),
2596              array('lastname', null, 'lastname', null, 0),
2597              array('mobile', null, 'mobile', null, 1),
2598              array('designation', null, 'title', null, 1),
2599              array('secondaryemail', null, 'secondaryemail', null, 1),
2600              array('leadsource', null, 'leadsource', 'leadsource', 1),
2601              array('leadstatus', null, null, null, 1),
2602              array('noofemployees', 'employees', null, null, 1),
2603              array('annualrevenue', 'annual_revenue', null, null, 1)
2604          );
2605  
2606          $leadTab = getTabid('Leads');
2607          $accountTab = getTabid('Accounts');
2608          $contactTab = getTabid('Contacts');
2609          $potentialTab = getTabid('Potentials');
2610          $mapSql = "INSERT INTO vtiger_convertleadmapping(leadfid,accountfid,contactfid,potentialfid,editable) values(?,?,?,?,?)";
2611  
2612          foreach ($fieldMap as $values) {
2613              $leadfid = getFieldid($leadTab, $values[0]);
2614              $accountfid = getFieldid($accountTab, $values[1]);
2615              $contactfid = getFieldid($contactTab, $values[2]);
2616              $potentialfid = getFieldid($potentialTab, $values[3]);
2617              $editable = $values[4];
2618              $adb->pquery($mapSql, array($leadfid, $accountfid, $contactfid, $potentialfid, $editable));
2619          }
2620      }
2621  
2622  }
2623  
2624  ?>


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1