[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /* +*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * *********************************************************************************** */ 10 vimport('~~modules/Users/DefaultDataPopulator.php'); 11 vimport('~~include/PopulateComboValues.php'); 12 13 class Install_InitSchema_Model { 14 15 /** 16 * Function starts applying schema changes 17 */ 18 public static function initialize() { 19 global $adb; 20 $adb = PearDatabase::getInstance(); 21 $adb->createTables("schema/DatabaseSchema.xml"); 22 23 $defaultDataPopulator = new DefaultDataPopulator(); 24 $defaultDataPopulator->create_tables(); 25 26 self::createDefaultUsersAccess(); 27 28 // create and populate combo tables 29 $combo = new PopulateComboValues(); 30 $combo->create_tables(); 31 $combo->create_nonpicklist_tables(); 32 33 create_tab_data_file(); 34 create_parenttab_data_file(); 35 36 // default report population 37 vimport('~~modules/Reports/PopulateReports.php'); 38 39 // default customview population 40 vimport('~~modules/CustomView/PopulateCustomView.php'); 41 42 // ensure required sequences are created (adodb creates them as needed, but if 43 // creation occurs within a transaction we get problems 44 $adb->getUniqueID("vtiger_crmentity"); 45 $adb->getUniqueID("vtiger_seactivityrel"); 46 $adb->getUniqueID("vtiger_freetags"); 47 48 $currencyName = $_SESSION['config_file_info']['currency_name']; 49 $currencyCode = $_SESSION['config_file_info']['currency_code']; 50 $currencySymbol = $_SESSION['config_file_info']['currency_symbol']; 51 $adb->pquery("INSERT INTO vtiger_currency_info VALUES (?,?,?,?,?,?,?,?)", array($adb->getUniqueID("vtiger_currency_info"), 52 $currencyName,$currencyCode,$currencySymbol,1,'Active','-11','0')); 53 54 Install_InitSchema_Model::installDefaultEventsAndWorkflows(); 55 } 56 57 /** 58 * Function upgrades the schema with changes post 540 version 59 */ 60 public static function upgrade() { 61 $migrateVersions = Migration_Module_Model::getInstance('')->getAllowedMigrationVersions(); 62 63 define('VTIGER_UPGRADE', true); 64 $oldVersion = null; 65 foreach($migrateVersions as $migrateVersion) { 66 foreach($migrateVersion as $newVersion => $versionLabel) { 67 // Not ready? 68 if ($oldVersion == null) { 69 $oldVersion = $newVersion; 70 break; 71 } 72 $oldVersion = str_replace(array('.', ' '), '', $oldVersion); 73 $newVersion = str_replace(array('.', ' '), '', $newVersion); 74 $filename = "modules/Migration/schema/".$oldVersion."_to_".$newVersion.".php"; 75 if(is_file($filename)) { 76 include($filename); 77 } 78 $oldVersion = $newVersion; 79 } 80 } 81 } 82 83 /** 84 * Function creates default user's Role, Profiles 85 */ 86 public static function createDefaultUsersAccess() { 87 $adb = PearDatabase::getInstance(); 88 $roleId1 = $adb->getUniqueID("vtiger_role"); 89 $roleId2 = $adb->getUniqueID("vtiger_role"); 90 $roleId3 = $adb->getUniqueID("vtiger_role"); 91 $roleId4 = $adb->getUniqueID("vtiger_role"); 92 $roleId5 = $adb->getUniqueID("vtiger_role"); 93 94 $profileId1 = $adb->getUniqueID("vtiger_profile"); 95 $profileId2 = $adb->getUniqueID("vtiger_profile"); 96 $profileId3 = $adb->getUniqueID("vtiger_profile"); 97 $profileId4 = $adb->getUniqueID("vtiger_profile"); 98 99 $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId1."','Organisation','H".$roleId1."',0)", array()); 100 $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId2."','CEO','H".$roleId1."::H".$roleId2."',1)", array()); 101 $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId3."','Vice President','H".$roleId1."::H".$roleId2."::H".$roleId3."',2)", array()); 102 $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId4."','Sales Manager','H".$roleId1."::H".$roleId2."::H".$roleId3."::H".$roleId4."',3)", array()); 103 $adb->pquery("INSERT INTO vtiger_role VALUES('H".$roleId5."','Sales Person','H".$roleId1."::H".$roleId2."::H".$roleId3."::H".$roleId4."::H".$roleId5."',4)", array()); 104 105 //INSERT INTO vtiger_role2profile 106 $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H".$roleId2."',".$profileId1.")", array()); 107 $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H".$roleId3."',".$profileId2.")", array()); 108 $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H".$roleId4."',".$profileId2.")", array()); 109 $adb->pquery("INSERT INTO vtiger_role2profile VALUES ('H".$roleId5."',".$profileId2.")", array()); 110 111 //New Security Start 112 //Inserting into vtiger_profile vtiger_table 113 $adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId1."','Administrator','Admin Profile')", array()); 114 $adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId2."','Sales Profile','Profile Related to Sales')", array()); 115 $adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId3."','Support Profile','Profile Related to Support')", array()); 116 $adb->pquery("INSERT INTO vtiger_profile VALUES ('".$profileId4."','Guest Profile','Guest Profile for Test Users')", array()); 117 118 //Inserting into vtiger_profile2gloabal permissions 119 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId1."',1,0)", array()); 120 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId1."',2,0)", array()); 121 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId2."',1,1)", array()); 122 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId2."',2,1)", array()); 123 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId3."',1,1)", array()); 124 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId3."',2,1)", array()); 125 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId4."',1,1)", array()); 126 $adb->pquery("INSERT INTO vtiger_profile2globalpermissions VALUES ('".$profileId4."',2,1)", array()); 127 128 //Inserting into vtiger_profile2tab 129 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",1,0)", array()); 130 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",2,0)", array()); 131 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",3,0)", array()); 132 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",4,0)", array()); 133 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",6,0)", array()); 134 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",7,0)", array()); 135 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",8,0)", array()); 136 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",9,0)", array()); 137 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",10,0)", array()); 138 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",13,0)", array()); 139 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",14,0)", array()); 140 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",15,0)", array()); 141 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",16,0)", array()); 142 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",18,0)", array()); 143 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",19,0)", array()); 144 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",20,0)", array()); 145 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",21,0)", array()); 146 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",22,0)", array()); 147 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",23,0)", array()); 148 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",24,0)", array()); 149 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",25,0)", array()); 150 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",26,0)", array()); 151 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId1.",27,0)", array()); 152 153 //Inserting into vtiger_profile2tab 154 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",1,0)", array()); 155 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",2,0)", array()); 156 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",3,0)", array()); 157 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",4,0)", array()); 158 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",6,0)", array()); 159 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",7,0)", array()); 160 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",8,0)", array()); 161 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",9,0)", array()); 162 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",10,0)", array()); 163 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",13,0)", array()); 164 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",14,0)", array()); 165 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",15,0)", array()); 166 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",16,0)", array()); 167 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",18,0)", array()); 168 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",19,0)", array()); 169 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",20,0)", array()); 170 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",21,0)", array()); 171 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",22,0)", array()); 172 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",23,0)", array()); 173 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",24,0)", array()); 174 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",25,0)", array()); 175 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",26,0)", array()); 176 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId2.",27,0)", array()); 177 178 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",1,0)", array()); 179 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",2,0)", array()); 180 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",3,0)", array()); 181 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",4,0)", array()); 182 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",6,0)", array()); 183 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",7,0)", array()); 184 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",8,0)", array()); 185 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",9,0)", array()); 186 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",10,0)", array()); 187 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",13,0)", array()); 188 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",14,0)", array()); 189 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",15,0)", array()); 190 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",16,0)", array()); 191 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",18,0)", array()); 192 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",19,0)", array()); 193 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",20,0)", array()); 194 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",21,0)", array()); 195 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",22,0)", array()); 196 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",23,0)", array()); 197 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",24,0)", array()); 198 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",25,0)", array()); 199 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",26,0)", array()); 200 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId3.",27,0)", array()); 201 202 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",1,0)", array()); 203 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",2,0)", array()); 204 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",3,0)", array()); 205 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",4,0)", array()); 206 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",6,0)", array()); 207 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",7,0)", array()); 208 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",8,0)", array()); 209 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",9,0)", array()); 210 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",10,0)", array()); 211 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",13,0)", array()); 212 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",14,0)", array()); 213 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",15,0)", array()); 214 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",16,0)", array()); 215 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",18,0)", array()); 216 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",19,0)", array()); 217 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",20,0)", array()); 218 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",21,0)", array()); 219 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",22,0)", array()); 220 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",23,0)", array()); 221 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",24,0)", array()); 222 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",25,0)", array()); 223 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",26,0)", array()); 224 $adb->pquery("INSERT INTO vtiger_profile2tab VALUES (".$profileId4.",27,0)", array()); 225 //Inserting into vtiger_profile2standardpermissions Adminsitrator 226 227 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",2,0,0)", array()); 228 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",2,1,0)", array()); 229 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",2,2,0)", array()); 230 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",2,3,0)", array()); 231 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",2,4,0)", array()); 232 233 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",4,0,0)", array()); 234 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",4,1,0)", array()); 235 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",4,2,0)", array()); 236 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",4,3,0)", array()); 237 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",4,4,0)", array()); 238 239 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",6,0,0)", array()); 240 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",6,1,0)", array()); 241 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",6,2,0)", array()); 242 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",6,3,0)", array()); 243 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",6,4,0)", array()); 244 245 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",7,0,0)", array()); 246 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",7,1,0)", array()); 247 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",7,2,0)", array()); 248 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",7,3,0)", array()); 249 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",7,4,0)", array()); 250 251 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",8,0,0)", array()); 252 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",8,1,0)", array()); 253 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",8,2,0)", array()); 254 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",8,3,0)", array()); 255 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",8,4,0)", array()); 256 257 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",9,0,0)", array()); 258 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",9,1,0)", array()); 259 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",9,2,0)", array()); 260 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",9,3,0)", array()); 261 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",9,4,0)", array()); 262 263 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",13,0,0)", array()); 264 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",13,1,0)", array()); 265 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",13,2,0)", array()); 266 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",13,3,0)", array()); 267 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",13,4,0)", array()); 268 269 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",14,0,0)", array()); 270 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",14,1,0)", array()); 271 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",14,2,0)", array()); 272 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",14,3,0)", array()); 273 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",14,4,0)", array()); 274 275 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",15,0,0)", array()); 276 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",15,1,0)", array()); 277 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",15,2,0)", array()); 278 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",15,3,0)", array()); 279 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",15,4,0)", array()); 280 281 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",16,0,0)", array()); 282 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",16,1,0)", array()); 283 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",16,2,0)", array()); 284 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",16,3,0)", array()); 285 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",16,4,0)", array()); 286 287 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",18,0,0)", array()); 288 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",18,1,0)", array()); 289 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",18,2,0)", array()); 290 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",18,3,0)", array()); 291 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",18,4,0)", array()); 292 293 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",19,0,0)", array()); 294 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",19,1,0)", array()); 295 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",19,2,0)", array()); 296 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",19,3,0)", array()); 297 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",19,4,0)", array()); 298 299 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",20,0,0)", array()); 300 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",20,1,0)", array()); 301 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",20,2,0)", array()); 302 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",20,3,0)", array()); 303 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",20,4,0)", array()); 304 305 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",21,0,0)", array()); 306 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",21,1,0)", array()); 307 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",21,2,0)", array()); 308 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",21,3,0)", array()); 309 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",21,4,0)", array()); 310 311 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",22,0,0)", array()); 312 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",22,1,0)", array()); 313 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",22,2,0)", array()); 314 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",22,3,0)", array()); 315 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",22,4,0)", array()); 316 317 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",23,0,0)", array()); 318 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",23,1,0)", array()); 319 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",23,2,0)", array()); 320 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",23,3,0)", array()); 321 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",23,4,0)", array()); 322 323 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",26,0,0)", array()); 324 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",26,1,0)", array()); 325 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",26,2,0)", array()); 326 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",26,3,0)", array()); 327 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId1.",26,4,0)", array()); 328 329 //INSERT INTO Profile 2 std permissions for Sales User 330 //Help Desk Create/Delete not allowed. Read-Only 331 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",2,0,0)", array()); 332 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",2,1,0)", array()); 333 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",2,2,0)", array()); 334 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",2,3,0)", array()); 335 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",2,4,0)", array()); 336 337 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",4,0,0)", array()); 338 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",4,1,0)", array()); 339 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",4,2,0)", array()); 340 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",4,3,0)", array()); 341 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",4,4,0)", array()); 342 343 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",6,0,0)", array()); 344 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",6,1,0)", array()); 345 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",6,2,0)", array()); 346 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",6,3,0)", array()); 347 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",6,4,0)", array()); 348 349 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",7,0,0)", array()); 350 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",7,1,0)", array()); 351 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",7,2,0)", array()); 352 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",7,3,0)", array()); 353 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",7,4,0)", array()); 354 355 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",8,0,0)", array()); 356 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",8,1,0)", array()); 357 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",8,2,0)", array()); 358 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",8,3,0)", array()); 359 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",8,4,0)", array()); 360 361 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",9,0,0)", array()); 362 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",9,1,0)", array()); 363 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",9,2,0)", array()); 364 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",9,3,0)", array()); 365 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",9,4,0)", array()); 366 367 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",13,0,1)", array()); 368 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",13,1,1)", array()); 369 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",13,2,1)", array()); 370 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",13,3,0)", array()); 371 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",13,4,0)", array()); 372 373 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",14,0,0)", array()); 374 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",14,1,0)", array()); 375 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",14,2,0)", array()); 376 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",14,3,0)", array()); 377 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",14,4,0)", array()); 378 379 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",15,0,0)", array()); 380 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",15,1,0)", array()); 381 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",15,2,0)", array()); 382 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",15,3,0)", array()); 383 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",15,4,0)", array()); 384 385 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",16,0,0)", array()); 386 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",16,1,0)", array()); 387 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",16,2,0)", array()); 388 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",16,3,0)", array()); 389 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",16,4,0)", array()); 390 391 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",18,0,0)", array()); 392 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",18,1,0)", array()); 393 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",18,2,0)", array()); 394 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",18,3,0)", array()); 395 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",18,4,0)", array()); 396 397 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",19,0,0)", array()); 398 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",19,1,0)", array()); 399 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",19,2,0)", array()); 400 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",19,3,0)", array()); 401 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",19,4,0)", array()); 402 403 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",20,0,0)", array()); 404 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",20,1,0)", array()); 405 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",20,2,0)", array()); 406 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",20,3,0)", array()); 407 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",20,4,0)", array()); 408 409 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",21,0,0)", array()); 410 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",21,1,0)", array()); 411 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",21,2,0)", array()); 412 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",21,3,0)", array()); 413 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",21,4,0)", array()); 414 415 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",22,0,0)", array()); 416 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",22,1,0)", array()); 417 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",22,2,0)", array()); 418 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",22,3,0)", array()); 419 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",22,4,0)", array()); 420 421 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",23,0,0)", array()); 422 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",23,1,0)", array()); 423 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",23,2,0)", array()); 424 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",23,3,0)", array()); 425 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",23,4,0)", array()); 426 427 428 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",26,0,0)", array()); 429 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",26,1,0)", array()); 430 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",26,2,0)", array()); 431 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",26,3,0)", array()); 432 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId2.",26,4,0)", array()); 433 434 //Inserting into vtiger_profile2std for Support Profile 435 // Potential is read-only 436 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",2,0,1)", array()); 437 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",2,1,1)", array()); 438 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",2,2,1)", array()); 439 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",2,3,0)", array()); 440 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",2,4,0)", array()); 441 442 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",4,0,0)", array()); 443 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",4,1,0)", array()); 444 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",4,2,0)", array()); 445 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",4,3,0)", array()); 446 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",4,4,0)", array()); 447 448 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",6,0,0)", array()); 449 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",6,1,0)", array()); 450 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",6,2,0)", array()); 451 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",6,3,0)", array()); 452 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",6,4,0)", array()); 453 454 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",7,0,0)", array()); 455 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",7,1,0)", array()); 456 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",7,2,0)", array()); 457 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",7,3,0)", array()); 458 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",7,4,0)", array()); 459 460 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",8,0,0)", array()); 461 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",8,1,0)", array()); 462 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",8,2,0)", array()); 463 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",8,3,0)", array()); 464 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",8,4,0)", array()); 465 466 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",9,0,0)", array()); 467 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",9,1,0)", array()); 468 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",9,2,0)", array()); 469 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",9,3,0)", array()); 470 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",9,4,0)", array()); 471 472 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",13,0,0)", array()); 473 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",13,1,0)", array()); 474 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",13,2,0)", array()); 475 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",13,3,0)", array()); 476 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",13,4,0)", array()); 477 478 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",14,0,0)", array()); 479 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",14,1,0)", array()); 480 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",14,2,0)", array()); 481 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",14,3,0)", array()); 482 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",14,4,0)", array()); 483 484 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",15,0,0)", array()); 485 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",15,1,0)", array()); 486 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",15,2,0)", array()); 487 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",15,3,0)", array()); 488 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",15,4,0)", array()); 489 490 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",16,0,0)", array()); 491 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",16,1,0)", array()); 492 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",16,2,0)", array()); 493 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",16,3,0)", array()); 494 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",16,4,0)", array()); 495 496 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",18,0,0)", array()); 497 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",18,1,0)", array()); 498 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",18,2,0)", array()); 499 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",18,3,0)", array()); 500 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",18,4,0)", array()); 501 502 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",19,0,0)", array()); 503 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",19,1,0)", array()); 504 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",19,2,0)", array()); 505 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",19,3,0)", array()); 506 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",19,4,0)", array()); 507 508 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",20,0,0)", array()); 509 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",20,1,0)", array()); 510 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",20,2,0)", array()); 511 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",20,3,0)", array()); 512 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",20,4,0)", array()); 513 514 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",21,0,0)", array()); 515 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",21,1,0)", array()); 516 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",21,2,0)", array()); 517 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",21,3,0)", array()); 518 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",21,4,0)", array()); 519 520 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",22,0,0)", array()); 521 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",22,1,0)", array()); 522 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",22,2,0)", array()); 523 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",22,3,0)", array()); 524 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",22,4,0)", array()); 525 526 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",23,0,0)", array()); 527 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",23,1,0)", array()); 528 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",23,2,0)", array()); 529 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",23,3,0)", array()); 530 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",23,4,0)", array()); 531 532 533 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",26,0,0)", array()); 534 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",26,1,0)", array()); 535 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",26,2,0)", array()); 536 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",26,3,0)", array()); 537 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId3.",26,4,0)", array()); 538 539 //Inserting into vtiger_profile2stdper for Profile Guest Profile 540 //All Read-Only 541 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",2,0,1)", array()); 542 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",2,1,1)", array()); 543 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",2,2,1)", array()); 544 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",2,3,0)", array()); 545 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",2,4,0)", array()); 546 547 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",4,0,1)", array()); 548 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",4,1,1)", array()); 549 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",4,2,1)", array()); 550 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",4,3,0)", array()); 551 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",4,4,0)", array()); 552 553 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",6,0,1)", array()); 554 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",6,1,1)", array()); 555 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",6,2,1)", array()); 556 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",6,3,0)", array()); 557 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",6,4,0)", array()); 558 559 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",7,0,1)", array()); 560 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",7,1,1)", array()); 561 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",7,2,1)", array()); 562 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",7,3,0)", array()); 563 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",7,4,0)", array()); 564 565 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",8,0,1)", array()); 566 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",8,1,1)", array()); 567 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",8,2,1)", array()); 568 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",8,3,0)", array()); 569 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",8,4,0)", array()); 570 571 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",9,0,1)", array()); 572 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",9,1,1)", array()); 573 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",9,2,1)", array()); 574 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",9,3,0)", array()); 575 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",9,4,0)", array()); 576 577 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",13,0,1)", array()); 578 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",13,1,1)", array()); 579 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",13,2,1)", array()); 580 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",13,3,0)", array()); 581 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",13,4,0)", array()); 582 583 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",14,0,1)", array()); 584 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",14,1,1)", array()); 585 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",14,2,1)", array()); 586 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",14,3,0)", array()); 587 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",14,4,0)", array()); 588 589 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",15,0,1)", array()); 590 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",15,1,1)", array()); 591 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",15,2,1)", array()); 592 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",15,3,0)", array()); 593 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",15,4,0)", array()); 594 595 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",16,0,1)", array()); 596 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",16,1,1)", array()); 597 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",16,2,1)", array()); 598 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",16,3,0)", array()); 599 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",16,4,0)", array()); 600 601 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",18,0,1)", array()); 602 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",18,1,1)", array()); 603 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",18,2,1)", array()); 604 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",18,3,0)", array()); 605 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",18,4,0)", array()); 606 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",19,0,1)", array()); 607 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",19,1,1)", array()); 608 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",19,2,1)", array()); 609 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",19,3,0)", array()); 610 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",19,4,0)", array()); 611 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",20,0,1)", array()); 612 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",20,1,1)", array()); 613 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",20,2,1)", array()); 614 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",20,3,0)", array()); 615 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",20,4,0)", array()); 616 617 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",21,0,1)", array()); 618 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",21,1,1)", array()); 619 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",21,2,1)", array()); 620 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",21,3,0)", array()); 621 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",21,4,0)", array()); 622 623 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",22,0,1)", array()); 624 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",22,1,1)", array()); 625 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",22,2,1)", array()); 626 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",22,3,0)", array()); 627 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",22,4,0)", array()); 628 629 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",23,0,1)", array()); 630 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",23,1,1)", array()); 631 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",23,2,1)", array()); 632 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",23,3,0)", array()); 633 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",23,4,0)", array()); 634 635 636 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",26,0,1)", array()); 637 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",26,1,1)", array()); 638 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",26,2,1)", array()); 639 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",26,3,0)", array()); 640 $adb->pquery("INSERT INTO vtiger_profile2standardpermissions VALUES (".$profileId4.",26,4,0)", array()); 641 642 //Inserting into vtiger_profile 2 utility Admin 643 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",2,5,0)", array()); 644 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",2,6,0)", array()); 645 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",4,5,0)", array()); 646 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",4,6,0)", array()); 647 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",6,5,0)", array()); 648 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",6,6,0)", array()); 649 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",7,5,0)", array()); 650 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",7,6,0)", array()); 651 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",8,6,0)", array()); 652 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",7,8,0)", array()); 653 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",6,8,0)", array()); 654 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",4,8,0)", array()); 655 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",13,5,0)", array()); 656 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",13,6,0)", array()); 657 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",13,8,0)", array()); 658 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",14,5,0)", array()); 659 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",14,6,0)", array()); 660 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",7,9,0)", array()); 661 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",18,5,0)", array()); 662 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",18,6,0)", array()); 663 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",7,10,0)", array()); 664 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",6,10,0)", array()); 665 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",4,10,0)", array()); 666 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",2,10,0)", array()); 667 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",13,10,0)", array()); 668 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",14,10,0)", array()); 669 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId1.",18,10,0)", array()); 670 671 //Inserting into vtiger_profile2utility Sales Profile 672 //Import Export Not Allowed. 673 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",2,5,1)", array()); 674 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",2,6,1)", array()); 675 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",4,5,1)", array()); 676 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",4,6,1)", array()); 677 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",6,5,1)", array()); 678 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",6,6,1)", array()); 679 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",7,5,1)", array()); 680 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",7,6,1)", array()); 681 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",8,6,1)", array()); 682 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",7,8,0)", array()); 683 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",6,8,0)", array()); 684 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",4,8,0)", array()); 685 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",13,5,1)", array()); 686 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",13,6,1)", array()); 687 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",13,8,0)", array()); 688 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",14,5,1)", array()); 689 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",14,6,1)", array()); 690 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",7,9,0)", array()); 691 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",18,5,1)", array()); 692 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",18,6,1)", array()); 693 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",7,10,0)", array()); 694 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",6,10,0)", array()); 695 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",4,10,0)", array()); 696 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",2,10,0)", array()); 697 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",13,10,0)", array()); 698 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",14,10,0)", array()); 699 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId2.",18,10,0)", array()); 700 701 //Inserting into vtiger_profile2utility Support Profile 702 //Import Export Not Allowed. 703 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",2,5,1)", array()); 704 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",2,6,1)", array()); 705 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",4,5,1)", array()); 706 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",4,6,1)", array()); 707 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",6,5,1)", array()); 708 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",6,6,1)", array()); 709 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",7,5,1)", array()); 710 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",7,6,1)", array()); 711 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",8,6,1)", array()); 712 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",7,8,0)", array()); 713 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",6,8,0)", array()); 714 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",4,8,0)", array()); 715 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",13,5,1)", array()); 716 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",13,6,1)", array()); 717 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",13,8,0)", array()); 718 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",14,5,1)", array()); 719 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",14,6,1)", array()); 720 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",7,9,0)", array()); 721 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",18,5,1)", array()); 722 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",18,6,1)", array()); 723 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",7,10,0)", array()); 724 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",6,10,0)", array()); 725 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",4,10,0)", array()); 726 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",2,10,0)", array()); 727 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",13,10,0)", array()); 728 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",14,10,0)", array()); 729 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId3.",18,10,0)", array()); 730 731 //Inserting into vtiger_profile2utility Guest Profile Read-Only 732 //Import Export BusinessCar Not Allowed. 733 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",2,5,1)", array()); 734 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",2,6,1)", array()); 735 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",4,5,1)", array()); 736 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",4,6,1)", array()); 737 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",6,5,1)", array()); 738 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",6,6,1)", array()); 739 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",7,5,1)", array()); 740 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",7,6,1)", array()); 741 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",8,6,1)", array()); 742 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",7,8,1)", array()); 743 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",6,8,1)", array()); 744 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",4,8,1)", array()); 745 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",13,5,1)", array()); 746 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",13,6,1)", array()); 747 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",13,8,1)", array()); 748 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",14,5,1)", array()); 749 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",14,6,1)", array()); 750 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",7,9,0)", array()); 751 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",18,5,1)", array()); 752 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",18,6,1)", array()); 753 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",7,10,0)", array()); 754 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",6,10,0)", array()); 755 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",4,10,0)", array()); 756 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",2,10,0)", array()); 757 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",13,10,0)", array()); 758 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",14,10,0)", array()); 759 $adb->pquery("INSERT INTO vtiger_profile2utility VALUES (".$profileId4.",18,10,0)", array()); 760 761 // Invalidate any cached information 762 VTCacheUtils::clearRoleSubordinates(); 763 764 $adminPassword = $_SESSION['config_file_info']['password']; 765 $userDateFormat = $_SESSION['config_file_info']['dateformat']; 766 $userTimeZone = $_SESSION['config_file_info']['timezone']; 767 //Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974 768 $userFirstName = $_SESSION['config_file_info']['firstname']; 769 $userLastName = $_SESSION['config_file_info']['lastname']; 770 // create default admin user 771 $user = CRMEntity::getInstance('Users'); 772 //Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974 773 $user->column_fields["first_name"] = $userFirstName; 774 $user->column_fields["last_name"] = $userLastName; 775 //Ends 776 $user->column_fields["user_name"] = 'admin'; 777 $user->column_fields["status"] = 'Active'; 778 $user->column_fields["is_admin"] = 'on'; 779 $user->column_fields["user_password"] = $adminPassword; 780 $user->column_fields["time_zone"] = $userTimeZone; 781 $user->column_fields["holidays"] = 'de,en_uk,fr,it,us,'; 782 $user->column_fields["workdays"] = '0,1,2,3,4,5,6,'; 783 $user->column_fields["weekstart"] = '1'; 784 $user->column_fields["namedays"] = ''; 785 $user->column_fields["currency_id"] = 1; 786 $user->column_fields["reminder_interval"] = '1 Minute'; 787 $user->column_fields["reminder_next_time"] = date('Y-m-d H:i'); 788 $user->column_fields["date_format"] = $userDateFormat; 789 $user->column_fields["hour_format"] = 'am/pm'; 790 $user->column_fields["start_hour"] = '08:00'; 791 $user->column_fields["end_hour"] = '23:00'; 792 $user->column_fields["imagename"] = ''; 793 $user->column_fields["internal_mailer"] = '1'; 794 $user->column_fields["activity_view"] = 'This Week'; 795 $user->column_fields["lead_view"] = 'Today'; 796 797 $adminEmail = $_SESSION['config_file_info']['admin_email']; 798 if($adminEmail == '') $adminEmail ="[email protected]"; 799 $user->column_fields["email1"] = $adminEmail; 800 $roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='CEO'"; 801 $adb->checkConnection(); 802 $adb->database->SetFetchMode(ADODB_FETCH_ASSOC); 803 $roleResult = $adb->pquery($roleQuery, array()); 804 $roleId = $adb->query_result($roleResult,0,"roleid"); 805 $user->column_fields["roleid"] = $roleId; 806 807 $user->save("Users"); 808 $adminUserId = $user->id; 809 810 //Inserting into vtiger_groups table 811 $groupId1 = $adb->getUniqueID("vtiger_users"); 812 $groupId2 = $adb->getUniqueID("vtiger_users"); 813 $groupId3 = $adb->getUniqueID("vtiger_users"); 814 815 $adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId1."','Team Selling','Group Related to Sales')", array()); 816 $adb->pquery("INSERT INTO vtiger_group2role VALUES ('".$groupId1."','H".$roleId4."')", array()); 817 $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('".$groupId1."','H".$roleId5."')", array()); 818 819 $adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId2."','Marketing Group','Group Related to Marketing Activities')", array()); 820 $adb->pquery("INSERT INTO vtiger_group2role VALUES ('".$groupId2."','H".$roleId2."')", array()); 821 $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('".$groupId2."','H".$roleId3."')", array()); 822 823 $adb->pquery("INSERT INTO vtiger_groups VALUES ('".$groupId3."','Support Group','Group Related to providing Support to Customers')", array()); 824 $adb->pquery("INSERT INTO vtiger_group2role VALUES ('".$groupId3."','H".$roleId3."')", array()); 825 $adb->pquery("INSERT INTO vtiger_group2rs VALUES ('".$groupId3."','H".$roleId3."')", array()); 826 827 // Setting user group relation for admin user 828 $adb->pquery("INSERT INTO vtiger_users2group VALUES (?,?)", array($groupId2, $adminUserId), array()); 829 830 //Creating the flat files for admin user 831 createUserPrivilegesfile($adminUserId); 832 createUserSharingPrivilegesfile($adminUserId); 833 834 //INSERT INTO vtiger_profile2field 835 insertProfile2field($profileId1); 836 insertProfile2field($profileId2); 837 insertProfile2field($profileId3); 838 insertProfile2field($profileId4); 839 840 insert_def_org_field(); 841 } 842 843 /** 844 * Function add necessary schema for event handlers and workflows, also add defaul workflows 845 */ 846 public static function installDefaultEventsAndWorkflows() { 847 $adb = PearDatabase::getInstance(); 848 849 // Register All the Events 850 self::registerEvents($adb); 851 852 // Register All the Entity Methods 853 self::registerEntityMethods($adb); 854 855 // Populate Default Workflows 856 self::populateDefaultWorkflows($adb); 857 858 // Populate Links 859 self::populateLinks(); 860 861 // Set Help Information for Fields 862 self::setFieldHelpInfo(); 863 864 // Register Cron Jobs 865 self::registerCronTasks(); 866 } 867 868 /** 869 * Register all the Cron Tasks 870 */ 871 public static function registerCronTasks() { 872 vimport('~~vtlib/Vtiger/Cron.php'); 873 Vtiger_Cron::register( 'Workflow', 'cron/modules/com_vtiger_workflow/com_vtiger_workflow.service', 900, 'com_vtiger_workflow', 1, 1, 'Recommended frequency for Workflow is 15 mins'); 874 Vtiger_Cron::register( 'RecurringInvoice', 'cron/modules/SalesOrder/RecurringInvoice.service', 43200, 'SalesOrder', 1, 2, 'Recommended frequency for RecurringInvoice is 12 hours'); 875 Vtiger_Cron::register( 'SendReminder', 'cron/SendReminder.service', 900, 'Calendar', 1, 3, 'Recommended frequency for SendReminder is 15 mins'); 876 Vtiger_Cron::register( 'ScheduleReports', 'cron/modules/Reports/ScheduleReports.service', 900, 'Reports', 1, 4, 'Recommended frequency for ScheduleReports is 15 mins'); 877 Vtiger_Cron::register( 'MailScanner', 'cron/MailScanner.service', 900, 'Settings', 1, 5, 'Recommended frequency for MailScanner is 15 mins'); 878 } 879 880 /** 881 * Function registers all the event handlers 882 */ 883 static function registerEvents($adb) { 884 vimport('~~include/events/include.inc'); 885 $em = new VTEventsManager($adb); 886 887 // Registering event for Recurring Invoices 888 $em->registerHandler('vtiger.entity.aftersave', 'modules/SalesOrder/RecurringInvoiceHandler.php', 'RecurringInvoiceHandler'); 889 890 //Registering Entity Delta handler for before save and after save events of the record to track the field value changes 891 $em->registerHandler('vtiger.entity.beforesave', 'data/VTEntityDelta.php', 'VTEntityDelta'); 892 $em->registerHandler('vtiger.entity.aftersave', 'data/VTEntityDelta.php', 'VTEntityDelta'); 893 894 // Workflow manager 895 $dependentEventHandlers = array('VTEntityDelta'); 896 $dependentEventHandlersJson = Zend_Json::encode($dependentEventHandlers); 897 $em->registerHandler('vtiger.entity.aftersave', 'modules/com_vtiger_workflow/VTEventHandler.inc', 'VTWorkflowEventHandler', 898 '',$dependentEventHandlersJson); 899 900 //Registering events for On modify 901 $em->registerHandler('vtiger.entity.afterrestore', 'modules/com_vtiger_workflow/VTEventHandler.inc', 'VTWorkflowEventHandler'); 902 903 // Registering event for HelpDesk - To reset from_portal value 904 $em->registerHandler('vtiger.entity.aftersave.final', 'modules/HelpDesk/HelpDeskHandler.php', 'HelpDeskHandler'); 905 } 906 907 /** 908 * Function registers all the work flow custom entity methods 909 * @param <PearDatabase> $adb 910 */ 911 static function registerEntityMethods($adb) { 912 vimport("~~modules/com_vtiger_workflow/include.inc"); 913 vimport("~~modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc"); 914 vimport("~~modules/com_vtiger_workflow/VTEntityMethodManager.inc"); 915 $emm = new VTEntityMethodManager($adb); 916 917 // Registering method for Updating Inventory Stock 918 $emm->addEntityMethod("SalesOrder","UpdateInventory","include/InventoryHandler.php","handleInventoryProductRel");//Adding EntityMethod for Updating Products data after creating SalesOrder 919 $emm->addEntityMethod("Invoice","UpdateInventory","include/InventoryHandler.php","handleInventoryProductRel");//Adding EntityMethod for Updating Products data after creating Invoice 920 921 // Register Entity Method for Customer Portal Login details email notification task 922 $emm->addEntityMethod("Contacts","SendPortalLoginDetails","modules/Contacts/ContactsHandler.php","Contacts_sendCustomerPortalLoginDetails"); 923 924 // Register Entity Method for Email notification on ticket creation from Customer portal 925 $emm->addEntityMethod("HelpDesk","NotifyOnPortalTicketCreation","modules/HelpDesk/HelpDeskHandler.php","HelpDesk_nofifyOnPortalTicketCreation"); 926 927 // Register Entity Method for Email notification on ticket comment from Customer portal 928 $emm->addEntityMethod("HelpDesk","NotifyOnPortalTicketComment","modules/HelpDesk/HelpDeskHandler.php","HelpDesk_notifyOnPortalTicketComment"); 929 930 // Register Entity Method for Email notification to Record Owner on ticket change, which is not from Customer portal 931 $emm->addEntityMethod("HelpDesk","NotifyOwnerOnTicketChange","modules/HelpDesk/HelpDeskHandler.php","HelpDesk_notifyOwnerOnTicketChange"); 932 933 // Register Entity Method for Email notification to Related Customer on ticket change, which is not from Customer portal 934 $emm->addEntityMethod("HelpDesk","NotifyParentOnTicketChange","modules/HelpDesk/HelpDeskHandler.php","HelpDesk_notifyParentOnTicketChange"); 935 } 936 937 /** 938 * Function adds default system workflows 939 * @param <PearDatabase> $adb 940 */ 941 static function populateDefaultWorkflows($adb) { 942 vimport("~~modules/com_vtiger_workflow/include.inc"); 943 vimport("~~modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc"); 944 vimport("~~modules/com_vtiger_workflow/VTEntityMethodManager.inc"); 945 vimport("~~modules/com_vtiger_workflow/VTTaskManager.inc"); 946 947 // register the workflow tasks 948 $taskTypes = array(); 949 $defaultModules = array('include' => array(), 'exclude'=>array()); 950 $createToDoModules = array('include' => array("Leads","Accounts","Potentials","Contacts","HelpDesk","Campaigns","Quotes","PurchaseOrder","SalesOrder","Invoice"), 'exclude'=>array("Calendar", "FAQ", "Events")); 951 $createEventModules = array('include' => array("Leads","Accounts","Potentials","Contacts","HelpDesk","Campaigns"), 'exclude'=>array("Calendar", "FAQ", "Events")); 952 953 $taskTypes[] = array("name"=>"VTEmailTask", "label"=>"Send Mail", "classname"=>"VTEmailTask", "classpath"=>"modules/com_vtiger_workflow/tasks/VTEmailTask.inc", "templatepath"=>"com_vtiger_workflow/taskforms/VTEmailTask.tpl", "modules"=>$defaultModules, "sourcemodule"=>''); 954 $taskTypes[] = array("name"=>"VTEntityMethodTask", "label"=>"Invoke Custom Function", "classname"=>"VTEntityMethodTask", "classpath"=>"modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc", "templatepath"=>"com_vtiger_workflow/taskforms/VTEntityMethodTask.tpl", "modules"=>$defaultModules, "sourcemodule"=>''); 955 $taskTypes[] = array("name"=>"VTCreateTodoTask", "label"=>"Create Todo", "classname"=>"VTCreateTodoTask", "classpath"=>"modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc", "templatepath"=>"com_vtiger_workflow/taskforms/VTCreateTodoTask.tpl", "modules"=>$createToDoModules, "sourcemodule"=>''); 956 $taskTypes[] = array("name"=>"VTCreateEventTask", "label"=>"Create Event", "classname"=>"VTCreateEventTask", "classpath"=>"modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc", "templatepath"=>"com_vtiger_workflow/taskforms/VTCreateEventTask.tpl", "modules"=>$createEventModules, "sourcemodule"=>''); 957 $taskTypes[] = array("name"=>"VTUpdateFieldsTask", "label"=>"Update Fields", "classname"=>"VTUpdateFieldsTask", "classpath"=>"modules/com_vtiger_workflow/tasks/VTUpdateFieldsTask.inc", "templatepath"=>"com_vtiger_workflow/taskforms/VTUpdateFieldsTask.tpl", "modules"=>$defaultModules, "sourcemodule"=>''); 958 $taskTypes[] = array("name"=>"VTCreateEntityTask", "label"=>"Create Entity", "classname"=>"VTCreateEntityTask", "classpath"=>"modules/com_vtiger_workflow/tasks/VTCreateEntityTask.inc", "templatepath"=>"com_vtiger_workflow/taskforms/VTCreateEntityTask.tpl", "modules"=>$defaultModules, "sourcemodule"=>''); 959 $taskTypes[] = array("name"=>"VTSMSTask", "label"=>"SMS Task", "classname"=>"VTSMSTask", "classpath"=>"modules/com_vtiger_workflow/tasks/VTSMSTask.inc", "templatepath"=>"com_vtiger_workflow/taskforms/VTSMSTask.tpl", "modules"=>$defaultModules, "sourcemodule"=>'SMSNotifier'); 960 961 foreach ($taskTypes as $taskType) { 962 VTTaskType::registerTaskType($taskType); 963 } 964 965 // Creating Workflow for Updating Inventory Stock for Invoice 966 $vtWorkFlow = new VTWorkflowManager($adb); 967 $invWorkFlow = $vtWorkFlow->newWorkFlow("Invoice"); 968 $invWorkFlow->test = '[{"fieldname":"subject","operation":"does not contain","value":"`!`"}]'; 969 $invWorkFlow->description = "UpdateInventoryProducts On Every Save"; 970 $invWorkFlow->defaultworkflow = 1; 971 $vtWorkFlow->save($invWorkFlow); 972 973 $tm = new VTTaskManager($adb); 974 $task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id); 975 $task->active=true; 976 $task->methodName = "UpdateInventory"; 977 $tm->saveTask($task); 978 979 // Creating Workflow for Accounts when Notifyowner is true 980 $vtaWorkFlow = new VTWorkflowManager($adb); 981 $accWorkFlow = $vtaWorkFlow->newWorkFlow("Accounts"); 982 $accWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]'; 983 $accWorkFlow->description = "Send Email to user when Notifyowner is True"; 984 $accWorkFlow->executionCondition=2; 985 $accWorkFlow->defaultworkflow = 1; 986 $vtaWorkFlow->save($accWorkFlow); 987 $id1=$accWorkFlow->id; 988 989 $tm = new VTTaskManager($adb); 990 $task = $tm->createTask('VTEmailTask',$accWorkFlow->id); 991 $task->active=true; 992 $task->methodName = "NotifyOwner"; 993 $task->recepient = "\$(assigned_user_id : (Users) email1)"; 994 $task->subject = "Regarding Account Creation"; 995 $task->content = "An Account has been assigned to you on vtigerCRM<br>Details of account are :<br><br>". 996 "AccountId:".'<b>$account_no</b><br>'."AccountName:".'<b>$accountname</b><br>'."Rating:".'<b>$rating</b><br>'. 997 "Industry:".'<b>$industry</b><br>'."AccountType:".'<b>$accounttype</b><br>'. 998 "Description:".'<b>$description</b><br><br><br>'."Thank You<br>Admin"; 999 $task->summary="An account has been created "; 1000 $tm->saveTask($task); 1001 $adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?",array(1,$id1)); 1002 1003 // Creating Workflow for Contacts when Notifyowner is true 1004 1005 $vtcWorkFlow = new VTWorkflowManager($adb); 1006 $conWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts"); 1007 $conWorkFlow->summary="A contact has been created "; 1008 $conWorkFlow->executionCondition=2; 1009 $conWorkFlow->test = '[{"fieldname":"notify_owner","operation":"is","value":"true:boolean"}]'; 1010 $conWorkFlow->description = "Send Email to user when Notifyowner is True"; 1011 $conWorkFlow->defaultworkflow = 1; 1012 $vtcWorkFlow->save($conWorkFlow); 1013 $id1=$conWorkFlow->id; 1014 $tm = new VTTaskManager($adb); 1015 $task = $tm->createTask('VTEmailTask',$conWorkFlow->id); 1016 $task->active=true; 1017 $task->methodName = "NotifyOwner"; 1018 $task->recepient = "\$(assigned_user_id : (Users) email1)"; 1019 $task->subject = "Regarding Contact Creation"; 1020 $task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>". 1021 "Contact Id:".'<b>$contact_no</b><br>'."LastName:".'<b>$lastname</b><br>'."FirstName:".'<b>$firstname</b><br>'. 1022 "Lead Source:".'<b>$leadsource</b><br>'. 1023 "Department:".'<b>$department</b><br>'. 1024 "Description:".'<b>$description</b><br><br><br>'."Thank You<br>Admin"; 1025 $task->summary="An contact has been created "; 1026 $tm->saveTask($task); 1027 $adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?",array(1,$id1)); 1028 1029 1030 // Creating Workflow for Contacts when PortalUser is true 1031 1032 $vtcWorkFlow = new VTWorkflowManager($adb); 1033 $conpuWorkFlow = $vtcWorkFlow->newWorkFlow("Contacts"); 1034 $conpuWorkFlow->test = '[{"fieldname":"portal","operation":"is","value":"true:boolean"}]'; 1035 $conpuWorkFlow->description = "Send Email to user when Portal User is True"; 1036 $conpuWorkFlow->executionCondition=2; 1037 $conpuWorkFlow->defaultworkflow = 1; 1038 $vtcWorkFlow->save($conpuWorkFlow); 1039 $id1=$conpuWorkFlow->id; 1040 1041 $taskManager = new VTTaskManager($adb); 1042 $task = $taskManager->createTask('VTEntityMethodTask', $id1); 1043 $task->active = true; 1044 $task->summary = 'Email Customer Portal Login Details'; 1045 $task->methodName = "SendPortalLoginDetails"; 1046 $taskManager->saveTask($task); 1047 // Creating Workflow for Potentials 1048 1049 $vtcWorkFlow = new VTWorkflowManager($adb); 1050 $potentialWorkFlow = $vtcWorkFlow->newWorkFlow("Potentials"); 1051 $potentialWorkFlow->description = "Send Email to users on Potential creation"; 1052 $potentialWorkFlow->executionCondition=1; 1053 $potentialWorkFlow->defaultworkflow = 1; 1054 $vtcWorkFlow->save($potentialWorkFlow); 1055 $id1=$potentialWorkFlow->id; 1056 1057 $tm = new VTTaskManager($adb); 1058 $task = $tm->createTask('VTEmailTask',$potentialWorkFlow->id); 1059 1060 $task->active=true; 1061 $task->recepient = "\$(assigned_user_id : (Users) email1)"; 1062 $task->subject = "Regarding Potential Assignment"; 1063 $task->content = "An Potential has been assigned to you on vtigerCRM<br>Details of Potential are :<br><br>". 1064 "Potential No:".'<b>$potential_no</b><br>'."Potential Name:".'<b>$potentialname</b><br>'. 1065 "Amount:".'<b>$amount</b><br>'. 1066 "Expected Close Date:".'<b>$closingdate</b><br>'. 1067 "Type:".'<b>$opportunity_type</b><br><br><br>'. 1068 "Description :".'$description<br>'."<br>Thank You<br>Admin"; 1069 1070 $task->summary="An Potential has been created "; 1071 $tm->saveTask($task); 1072 1073 $workflowManager = new VTWorkflowManager($adb); 1074 $taskManager = new VTTaskManager($adb); 1075 1076 // Contact workflow on creation/modification 1077 $contactWorkFlow = $workflowManager->newWorkFlow("Contacts"); 1078 $contactWorkFlow->test = ''; 1079 $contactWorkFlow->description = "Workflow for Contact Creation or Modification"; 1080 $contactWorkFlow->executionCondition = VTWorkflowManager::$ON_EVERY_SAVE; 1081 $contactWorkFlow->defaultworkflow = 1; 1082 $workflowManager->save($contactWorkFlow); 1083 1084 $tm = new VTTaskManager($adb); 1085 $task = $tm->createTask('VTEmailTask',$contactWorkFlow->id); 1086 1087 $task->active=true; 1088 $task->recepient = "\$(assigned_user_id : (Users) email1)"; 1089 $task->subject = "Regarding Contact Assignment"; 1090 $task->content = "An Contact has been assigned to you on vtigerCRM<br>Details of Contact are :<br><br>". 1091 "Contact Id:".'<b>$contact_no</b><br>'."LastName:".'<b>$lastname</b><br>'."FirstName:".'<b>$firstname</b><br>'. 1092 "Lead Source:".'<b>$leadsource</b><br>'. 1093 "Department:".'<b>$department</b><br>'. 1094 "Description:".'<b>$description</b><br><br><br>'."And <b>CustomerPortal Login Details</b> is sent to the " . 1095 "EmailID :-".'$email<br>'."<br>Thank You<br>Admin"; 1096 1097 $task->summary="An contact has been created "; 1098 $tm->saveTask($task); 1099 $adb->pquery("update com_vtiger_workflows set defaultworkflow=? where workflow_id=?",array(1,$id1)); 1100 1101 // Trouble Tickets workflow on creation from Customer Portal 1102 $helpDeskWorkflow = $workflowManager->newWorkFlow("HelpDesk"); 1103 $helpDeskWorkflow->test = '[{"fieldname":"from_portal","operation":"is","value":"true:boolean"}]'; 1104 $helpDeskWorkflow->description = "Workflow for Ticket Created from Portal"; 1105 $helpDeskWorkflow->executionCondition = VTWorkflowManager::$ON_FIRST_SAVE; 1106 $helpDeskWorkflow->defaultworkflow = 1; 1107 $workflowManager->save($helpDeskWorkflow); 1108 1109 $task = $taskManager->createTask('VTEntityMethodTask', $helpDeskWorkflow->id); 1110 $task->active = true; 1111 $task->summary = 'Notify Record Owner and the Related Contact when Ticket is created from Portal'; 1112 $task->methodName = "NotifyOnPortalTicketCreation"; 1113 $taskManager->saveTask($task); 1114 1115 // Trouble Tickets workflow on ticket update from Customer Portal 1116 $helpDeskWorkflow = $workflowManager->newWorkFlow("HelpDesk"); 1117 $helpDeskWorkflow->test = '[{"fieldname":"from_portal","operation":"is","value":"true:boolean"}]'; 1118 $helpDeskWorkflow->description = "Workflow for Ticket Updated from Portal"; 1119 $helpDeskWorkflow->executionCondition = VTWorkflowManager::$ON_MODIFY; 1120 $helpDeskWorkflow->defaultworkflow = 1; 1121 $workflowManager->save($helpDeskWorkflow); 1122 1123 $task = $taskManager->createTask('VTEntityMethodTask', $helpDeskWorkflow->id); 1124 $task->active = true; 1125 $task->summary = 'Notify Record Owner when Comment is added to a Ticket from Customer Portal'; 1126 $task->methodName = "NotifyOnPortalTicketComment"; 1127 $taskManager->saveTask($task); 1128 1129 // Trouble Tickets workflow on ticket change, which is not from Customer Portal - Both Record Owner and Related Customer 1130 $helpDeskWorkflow = $workflowManager->newWorkFlow("HelpDesk"); 1131 $helpDeskWorkflow->test = '[{"fieldname":"from_portal","operation":"is","value":"false:boolean"}]'; 1132 $helpDeskWorkflow->description = "Workflow for Ticket Change, not from the Portal"; 1133 $helpDeskWorkflow->executionCondition = VTWorkflowManager::$ON_EVERY_SAVE; 1134 $helpDeskWorkflow->defaultworkflow = 1; 1135 $workflowManager->save($helpDeskWorkflow); 1136 1137 $task = $taskManager->createTask('VTEntityMethodTask', $helpDeskWorkflow->id); 1138 $task->active = true; 1139 $task->summary = 'Notify Record Owner on Ticket Change, which is not done from Portal'; 1140 $task->methodName = "NotifyOwnerOnTicketChange"; 1141 $taskManager->saveTask($task); 1142 1143 $task = $taskManager->createTask('VTEntityMethodTask', $helpDeskWorkflow->id); 1144 $task->active = true; 1145 $task->summary = 'Notify Related Customer on Ticket Change, which is not done from Portal'; 1146 $task->methodName = "NotifyParentOnTicketChange"; 1147 $taskManager->saveTask($task); 1148 1149 // Events workflow when Send Notification is checked 1150 $eventsWorkflow = $workflowManager->newWorkFlow("Events"); 1151 $eventsWorkflow->test = '[{"fieldname":"sendnotification","operation":"is","value":"true:boolean"}]'; 1152 $eventsWorkflow->description = "Workflow for Events when Send Notification is True"; 1153 $eventsWorkflow->executionCondition = VTWorkflowManager::$ON_EVERY_SAVE; 1154 $eventsWorkflow->defaultworkflow = 1; 1155 $workflowManager->save($eventsWorkflow); 1156 1157 $task = $taskManager->createTask('VTEmailTask', $eventsWorkflow->id); 1158 $task->active = true; 1159 $task->summary = 'Send Notification Email to Record Owner'; 1160 $task->recepient = "\$(assigned_user_id : (Users) email1)"; 1161 $task->subject = "Event : \$subject"; 1162 $task->content = '$(assigned_user_id : (Users) first_name) $(assigned_user_id : (Users) last_name) ,<br/>' 1163 .'<b>Activity Notification Details:</b><br/>' 1164 .'Subject : $subject<br/>' 1165 .'Start date and time : $date_start $time_start ( $(general : (__VtigerMeta__) dbtimezone) ) <br/>' 1166 .'End date and time : $due_date $time_end ( $(general : (__VtigerMeta__) dbtimezone) ) <br/>' 1167 .'Status : $eventstatus <br/>' 1168 .'Priority : $taskpriority <br/>' 1169 .'Related To : $(parent_id : (Leads) lastname) $(parent_id : (Leads) firstname) $(parent_id : (Accounts) accountname) ' 1170 .'$(parent_id : (Potentials) potentialname) $(parent_id : (HelpDesk) ticket_title) <br/>' 1171 .'Contacts List : $(contact_id : (Contacts) lastname) $(contact_id : (Contacts) firstname) <br/>' 1172 .'Location : $location <br/>' 1173 .'Description : $description'; 1174 $taskManager->saveTask($task); 1175 1176 // Calendar workflow when Send Notification is checked 1177 $calendarWorkflow = $workflowManager->newWorkFlow("Calendar"); 1178 $calendarWorkflow->test = '[{"fieldname":"sendnotification","operation":"is","value":"true:boolean"}]'; 1179 $calendarWorkflow->description = "Workflow for Calendar Todos when Send Notification is True"; 1180 $calendarWorkflow->executionCondition = VTWorkflowManager::$ON_EVERY_SAVE; 1181 $calendarWorkflow->defaultworkflow = 1; 1182 $workflowManager->save($calendarWorkflow); 1183 1184 $task = $taskManager->createTask('VTEmailTask', $calendarWorkflow->id); 1185 $task->active = true; 1186 $task->summary = 'Send Notification Email to Record Owner'; 1187 $task->recepient = "\$(assigned_user_id : (Users) email1)"; 1188 $task->subject = "Task : \$subject"; 1189 $task->content = '$(assigned_user_id : (Users) first_name) $(assigned_user_id : (Users) last_name) ,<br/>' 1190 .'<b>Task Notification Details:</b><br/>' 1191 .'Subject : $subject<br/>' 1192 .'Start date and time : $date_start $time_start ( $(general : (__VtigerMeta__) dbtimezone) ) <br/>' 1193 .'End date and time : $due_date ( $(general : (__VtigerMeta__) dbtimezone) ) <br/>' 1194 .'Status : $taskstatus <br/>' 1195 .'Priority : $taskpriority <br/>' 1196 .'Related To : $(parent_id : (Leads) lastname) $(parent_id : (Leads) firstname) $(parent_id : (Accounts) accountname) ' 1197 .'$(parent_id : (Potentials) potentialname) $(parent_id : (HelpDesk) ticket_title) <br/>' 1198 .'Contacts List : $(contact_id : (Contacts) lastname) $(contact_id : (Contacts) firstname) <br/>' 1199 .'Location : $location <br/>' 1200 .'Description : $description'; 1201 $taskManager->saveTask($task); 1202 } 1203 1204 /** 1205 * Function adds default details view links 1206 */ 1207 public static function populateLinks() { 1208 vimport('~~vtlib/Vtiger/Module.php'); 1209 1210 // Links for Accounts module 1211 $accountInstance = Vtiger_Module::getInstance('Accounts'); 1212 // Detail View Custom link 1213 $accountInstance->addLink( 1214 'DETAILVIEWBASIC', 'LBL_ADD_NOTE', 1215 'index.php?module=Documents&action=EditView&return_module=$MODULE$&return_action=DetailView&return_id=$RECORD$&parent_id=$RECORD$', 1216 'themes/images/bookMark.gif' 1217 ); 1218 $accountInstance->addLink('DETAILVIEWBASIC', 'LBL_SHOW_ACCOUNT_HIERARCHY', 'index.php?module=Accounts&action=AccountHierarchy&accountid=$RECORD$'); 1219 1220 $leadInstance = Vtiger_Module::getInstance('Leads'); 1221 $leadInstance->addLink( 1222 'DETAILVIEWBASIC', 'LBL_ADD_NOTE', 1223 'index.php?module=Documents&action=EditView&return_module=$MODULE$&return_action=DetailView&return_id=$RECORD$&parent_id=$RECORD$', 1224 'themes/images/bookMark.gif' 1225 ); 1226 1227 $contactInstance = Vtiger_Module::getInstance('Contacts'); 1228 $contactInstance->addLink( 1229 'DETAILVIEWBASIC', 'LBL_ADD_NOTE', 1230 'index.php?module=Documents&action=EditView&return_module=$MODULE$&return_action=DetailView&return_id=$RECORD$&parent_id=$RECORD$', 1231 'themes/images/bookMark.gif' 1232 ); 1233 } 1234 1235 /** 1236 * Function add help information on special fields 1237 */ 1238 public static function setFieldHelpInfo() { 1239 // Added Help Info for Hours and Days fields of HelpDesk module. 1240 vimport('~~vtlib/Vtiger/Module.php'); 1241 $helpDeskModule = Vtiger_Module::getInstance('HelpDesk'); 1242 $field1 = Vtiger_Field::getInstance('hours',$helpDeskModule); 1243 $field2 = Vtiger_Field::getInstance('days',$helpDeskModule); 1244 1245 $field1->setHelpInfo('This gives the estimated hours for the Ticket.'. 1246 '<br>When the same ticket is added to a Service Contract,'. 1247 'based on the Tracking Unit of the Service Contract,'. 1248 'Used units is updated whenever a ticket is Closed.'); 1249 1250 $field2->setHelpInfo('This gives the estimated days for the Ticket.'. 1251 '<br>When the same ticket is added to a Service Contract,'. 1252 'based on the Tracking Unit of the Service Contract,'. 1253 'Used units is updated whenever a ticket is Closed.'); 1254 1255 $usersModuleInstance = Vtiger_Module::getInstance('Users'); 1256 $field1 = Vtiger_Field::getInstance('currency_grouping_pattern', $usersModuleInstance); 1257 $field2 = Vtiger_Field::getInstance('currency_decimal_separator', $usersModuleInstance); 1258 $field3 = Vtiger_Field::getInstance('currency_grouping_separator', $usersModuleInstance); 1259 $field4 = Vtiger_Field::getInstance('currency_symbol_placement', $usersModuleInstance); 1260 1261 $field1->setHelpInfo("<b>Currency - Digit Grouping Pattern</b> <br/><br/>". 1262 "This pattern specifies the format in which the currency separator will be placed."); 1263 $field2->setHelpInfo("<b>Currency - Decimal Separator</b> <br/><br/>". 1264 "Decimal separator specifies the separator to be used to separate ". 1265 "the fractional values from the whole number part. <br/>". 1266 "<b>Eg:</b> <br/>". 1267 ". => 123.45 <br/>". 1268 ", => 123,45 <br/>". 1269 "' => 123'45 <br/>". 1270 " => 123 45 <br/>". 1271 "$ => 123$45 <br/>"); 1272 $field3->setHelpInfo("<b>Currency - Grouping Separator</b> <br/><br/>". 1273 "Grouping separator specifies the separator to be used to group ". 1274 "the whole number part into hundreds, thousands etc. <br/>". 1275 "<b>Eg:</b> <br/>". 1276 ". => 123.456.789 <br/>". 1277 ", => 123,456,789 <br/>". 1278 "' => 123'456'789 <br/>". 1279 " => 123 456 789 <br/>". 1280 "$ => 123$456$789 <br/>"); 1281 $field4->setHelpInfo("<b>Currency - Symbol Placement</b> <br/><br/>". 1282 "Symbol Placement allows you to configure the position of the ". 1283 "currency symbol with respect to the currency value.<br/>". 1284 "<b>Eg:</b> <br/>". 1285 "$1.0 => $123,456,789.50 <br/>". 1286 "1.0$ => 123,456,789.50$ <br/>"); 1287 } 1288 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |