From f90e80fdf12265ad2b67bd9ee6c078127b46e7ef Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Wed, 17 Nov 2010 02:40:00 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=205.2=20=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E7=89=88=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=20SVN=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yuchenghu@hawebs.net git-svn-id: https://svn.code.sf.net/p/hawebs/svn@649 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../trunk/modules/Users/AddMailAccount.php | 115 + .../trunk/modules/Users/Announcements.php | 36 + .../trunk/modules/Users/Authenticate.php | 155 + .../trunk/modules/Users/ChangePassword.php | 111 + .../trunk/modules/Users/CreateProfile.php | 68 + .../modules/Users/CreateUserPrivilegeFile.php | 1780 ++++++++++++ .../modules/Users/DefaultDataPopulator.php | 2547 +++++++++++++++++ oss/vtiger/trunk/modules/Users/Delete.php | 18 + .../trunk/modules/Users/DeleteGroup.php | 30 + .../trunk/modules/Users/DeleteProfile.php | 17 + oss/vtiger/trunk/modules/Users/DeleteRole.php | 18 + .../trunk/modules/Users/DeleteSharingRule.php | 16 + oss/vtiger/trunk/modules/Users/DeleteUser.php | 28 + oss/vtiger/trunk/modules/Users/DetailView.php | 236 ++ .../trunk/modules/Users/DetailViewAjax.php | 68 + oss/vtiger/trunk/modules/Users/EditView.php | 127 + oss/vtiger/trunk/modules/Users/Error.php | 26 + oss/vtiger/trunk/modules/Users/Forms.php | 227 ++ .../trunk/modules/Users/GroupDeleteStep1.php | 119 + oss/vtiger/trunk/modules/Users/ListView.php | 125 + .../trunk/modules/Users/ListViewPagging.php | 11 + oss/vtiger/trunk/modules/Users/Login.php | 197 ++ .../trunk/modules/Users/LoginHistory.php | 211 ++ oss/vtiger/trunk/modules/Users/Logout.php | 53 + .../modules/Users/OrgSharingEditView.php | 73 + oss/vtiger/trunk/modules/Users/Popup.php | 20 + .../modules/Users/ProfileDeleteStep1.php | 75 + .../modules/Users/RecalculateSharingRules.php | 18 + .../trunk/modules/Users/RenameProfile.php | 25 + .../trunk/modules/Users/RoleDragDrop.php | 64 + oss/vtiger/trunk/modules/Users/RolePopup.php | 160 ++ oss/vtiger/trunk/modules/Users/Save.php | 234 ++ .../trunk/modules/Users/SaveDefModuleView.php | 45 + oss/vtiger/trunk/modules/Users/SaveGroup.php | 126 + .../trunk/modules/Users/SaveMailAccount.php | 58 + .../trunk/modules/Users/SaveOrgSharing.php | 38 + .../trunk/modules/Users/SaveProfile.php | 212 ++ .../trunk/modules/Users/ShowHistory.html | 53 + .../trunk/modules/Users/ShowHistory.php | 74 + .../trunk/modules/Users/TemplateMerge.php | 34 + .../modules/Users/UpdateProfileChanges.php | 204 ++ .../trunk/modules/Users/UserDeleteStep1.php | 80 + oss/vtiger/trunk/modules/Users/UserGroups.php | 31 + oss/vtiger/trunk/modules/Users/Users.js | 320 +++ oss/vtiger/trunk/modules/Users/Users.php | 1375 +++++++++ oss/vtiger/trunk/modules/Users/UsersAjax.php | 19 + oss/vtiger/trunk/modules/Users/about_us.php | 215 ++ .../trunk/modules/Users/binaryfilelist.php | 98 + .../modules/Users/deletewordtemplate.php | 19 + .../trunk/modules/Users/downloadfile.php | 41 + .../trunk/modules/Users/getListOfRecords.php | 124 + .../modules/Users/language/en_us.lang.php | 689 +++++ .../modules/Users/language/zh_cn.lang.php | 689 +++++ .../modules/Users/lookupemailtemplates.php | 76 + .../trunk/modules/Users/massChangeStatus.php | 139 + oss/vtiger/trunk/modules/Users/massdelete.php | 80 + .../trunk/modules/Users/notify_detail.php | 69 + .../trunk/modules/Users/populatetemplate.php | 100 + .../modules/Users/updateLeadDBStatus.php | 104 + .../Users/updateNotificationSchedulers.php | 47 + 60 files changed, 12167 insertions(+) create mode 100644 oss/vtiger/trunk/modules/Users/AddMailAccount.php create mode 100644 oss/vtiger/trunk/modules/Users/Announcements.php create mode 100644 oss/vtiger/trunk/modules/Users/Authenticate.php create mode 100644 oss/vtiger/trunk/modules/Users/ChangePassword.php create mode 100644 oss/vtiger/trunk/modules/Users/CreateProfile.php create mode 100644 oss/vtiger/trunk/modules/Users/CreateUserPrivilegeFile.php create mode 100644 oss/vtiger/trunk/modules/Users/DefaultDataPopulator.php create mode 100644 oss/vtiger/trunk/modules/Users/Delete.php create mode 100644 oss/vtiger/trunk/modules/Users/DeleteGroup.php create mode 100644 oss/vtiger/trunk/modules/Users/DeleteProfile.php create mode 100644 oss/vtiger/trunk/modules/Users/DeleteRole.php create mode 100644 oss/vtiger/trunk/modules/Users/DeleteSharingRule.php create mode 100644 oss/vtiger/trunk/modules/Users/DeleteUser.php create mode 100644 oss/vtiger/trunk/modules/Users/DetailView.php create mode 100644 oss/vtiger/trunk/modules/Users/DetailViewAjax.php create mode 100644 oss/vtiger/trunk/modules/Users/EditView.php create mode 100644 oss/vtiger/trunk/modules/Users/Error.php create mode 100644 oss/vtiger/trunk/modules/Users/Forms.php create mode 100644 oss/vtiger/trunk/modules/Users/GroupDeleteStep1.php create mode 100644 oss/vtiger/trunk/modules/Users/ListView.php create mode 100644 oss/vtiger/trunk/modules/Users/ListViewPagging.php create mode 100644 oss/vtiger/trunk/modules/Users/Login.php create mode 100644 oss/vtiger/trunk/modules/Users/LoginHistory.php create mode 100644 oss/vtiger/trunk/modules/Users/Logout.php create mode 100644 oss/vtiger/trunk/modules/Users/OrgSharingEditView.php create mode 100644 oss/vtiger/trunk/modules/Users/Popup.php create mode 100644 oss/vtiger/trunk/modules/Users/ProfileDeleteStep1.php create mode 100644 oss/vtiger/trunk/modules/Users/RecalculateSharingRules.php create mode 100644 oss/vtiger/trunk/modules/Users/RenameProfile.php create mode 100644 oss/vtiger/trunk/modules/Users/RoleDragDrop.php create mode 100644 oss/vtiger/trunk/modules/Users/RolePopup.php create mode 100644 oss/vtiger/trunk/modules/Users/Save.php create mode 100644 oss/vtiger/trunk/modules/Users/SaveDefModuleView.php create mode 100644 oss/vtiger/trunk/modules/Users/SaveGroup.php create mode 100644 oss/vtiger/trunk/modules/Users/SaveMailAccount.php create mode 100644 oss/vtiger/trunk/modules/Users/SaveOrgSharing.php create mode 100644 oss/vtiger/trunk/modules/Users/SaveProfile.php create mode 100644 oss/vtiger/trunk/modules/Users/ShowHistory.html create mode 100644 oss/vtiger/trunk/modules/Users/ShowHistory.php create mode 100644 oss/vtiger/trunk/modules/Users/TemplateMerge.php create mode 100644 oss/vtiger/trunk/modules/Users/UpdateProfileChanges.php create mode 100644 oss/vtiger/trunk/modules/Users/UserDeleteStep1.php create mode 100644 oss/vtiger/trunk/modules/Users/UserGroups.php create mode 100644 oss/vtiger/trunk/modules/Users/Users.js create mode 100644 oss/vtiger/trunk/modules/Users/Users.php create mode 100644 oss/vtiger/trunk/modules/Users/UsersAjax.php create mode 100644 oss/vtiger/trunk/modules/Users/about_us.php create mode 100644 oss/vtiger/trunk/modules/Users/binaryfilelist.php create mode 100644 oss/vtiger/trunk/modules/Users/deletewordtemplate.php create mode 100644 oss/vtiger/trunk/modules/Users/downloadfile.php create mode 100644 oss/vtiger/trunk/modules/Users/getListOfRecords.php create mode 100644 oss/vtiger/trunk/modules/Users/language/en_us.lang.php create mode 100644 oss/vtiger/trunk/modules/Users/language/zh_cn.lang.php create mode 100644 oss/vtiger/trunk/modules/Users/lookupemailtemplates.php create mode 100644 oss/vtiger/trunk/modules/Users/massChangeStatus.php create mode 100644 oss/vtiger/trunk/modules/Users/massdelete.php create mode 100644 oss/vtiger/trunk/modules/Users/notify_detail.php create mode 100644 oss/vtiger/trunk/modules/Users/populatetemplate.php create mode 100644 oss/vtiger/trunk/modules/Users/updateLeadDBStatus.php create mode 100644 oss/vtiger/trunk/modules/Users/updateNotificationSchedulers.php diff --git a/oss/vtiger/trunk/modules/Users/AddMailAccount.php b/oss/vtiger/trunk/modules/Users/AddMailAccount.php new file mode 100644 index 00000000..ad404c0f --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/AddMailAccount.php @@ -0,0 +1,115 @@ +assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path); + +if(isset($_REQUEST['record']) && $_REQUEST['record']!='') +{ + $sql = "select * from vtiger_mail_accounts where user_id=?"; + $result = $adb->pquery($sql, array($_REQUEST['record'])); + $rowcount = $adb->num_rows($result); + + if ($rowcount!=0) + { + while($temprow = $adb->fetchByAssoc($result)) + { + $smarty->assign("DISPLAYNAME", $temprow['display_name']); + $smarty->assign("ID", $temprow['user_id']); + $smarty->assign("EMAIL", $temprow['mail_id']); + $smarty->assign("ACCOUNTNAME", $temprow['account_name']); + $smarty->assign($temprow['mail_protocol'],$temprow['mail_protocol']); + $smarty->assign("SERVERUSERNAME", $temprow['mail_username']); + $smarty->assign("SERVERPASSWORD", $temprow['mail_password']); + $smarty->assign("SERVERNAME", $temprow['mail_servername']); + $smarty->assign("RECORD_ID", $temprow['account_id']); + $smarty->assign("BOX_REFRESH", $temprow['box_refresh']); + $smarty->assign("MAILS_PER_PAGE", $temprow['mails_per_page']); + $smarty->assign("EDIT", "TRUE"); + + if(strtolower($temprow['mail_protocol']) == "imap") + $smarty->assign("IMAP", "CHECKED"); + if(strtolower($temprow['mail_protocol']) == "imap2") + $smarty->assign("IMAP2", "CHECKED"); + if(strtolower($temprow['mail_protocol']) == "imap4") + $smarty->assign("IMAP4", "CHECKED"); + if(strtolower($temprow['mail_protocol']) == "imap4rev1") + $smarty->assign("IMAP4R1", "CHECKED"); + if(strtolower($temprow['mail_protocol']) == "pop3") + $smarty->assign("POP3", "CHECKED"); + + if(strtolower($temprow['ssltype']) == "notls") + $smarty->assign("NOTLS", "CHECKED"); + if(strtolower($temprow['ssltype']) == "tls") + $smarty->assign("TLS", "CHECKED"); + if(strtolower($temprow['ssltype']) == "ssl") + $smarty->assign("SSL", "CHECKED"); + if(strtolower($temprow['sslmeth']) == "validate-cert") + $smarty->assign("VALIDATECERT", "CHECKED"); + if(strtolower($temprow['sslmeth']) == "novalidate-cert") + $smarty->assign("NOVALIDATECERT", "CHECKED"); + + if($temprow['int_mailer'] == "1") + $smarty->assign("INT_MAILER_USE", "CHECKED"); + else + $smarty->assign("INT_MAILER_NOUSE", "CHECKED"); + if(strtolower($temprow['box_refresh']) == "60000") + $smarty->assign("BOX_OPT1", " SELECTED"); + if(strtolower($temprow['box_refresh']) == "120000") + $smarty->assign("BOX_OPT2", " SELECTED"); + if(strtolower($temprow['box_refresh']) == "180000") + $smarty->assign("BOX_OPT3", " SELECTED"); + if(strtolower($temprow['box_refresh']) == "240000") + $smarty->assign("BOX_OPT4", " SELECTED"); + if(strtolower($temprow['box_refresh']) == "300000") + $smarty->assign("BOX_OPT5", " SELECTED"); + } + } +} +$qry_res = $adb->pquery("select * from vtiger_mail_accounts where user_id=?", array($current_user->id)); +$count = $adb->num_rows($qry_res); +if($count > 0) + $field = '';//""; +else + $field = ''; +$smarty->assign('CHANGE_PW_BUTTON',$field); + +$return_module = vtlib_purify($_REQUEST['return_module']); +if(empty($return_module)) $return_module = 'Settings'; +else $return_module = htmlspecialchars($return_module, ENT_QUOTES, $default_charset); + +$return_action = vtlib_purify($_REQUEST['return_action']); +if(empty($return_action)) $return_action = 'index'; +else $return_action = htmlspecialchars($return_action, ENT_QUOTES, $default_charset); + +$smarty->assign("RETURN_MODULE",$return_module); +$smarty->assign("RETURN_ACTION",$return_action); +$smarty->assign("JAVASCRIPT", get_validate_record_js()); +$smarty->assign("USERID", $current_user->id); + +$smarty->display('AddMailAccount.tpl'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/Announcements.php b/oss/vtiger/trunk/modules/Users/Announcements.php new file mode 100644 index 00000000..59aeb2ee --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Announcements.php @@ -0,0 +1,36 @@ +pquery($query, array($current_user->id)); +$announcement=$adb->query_result($result,0,'announcement'); +$title_prev=$adb->query_result($result,0,'title'); +$id=$adb->query_result($result,0,'creatorid'); + +$smarty = new vtigerCRM_Smarty; + +$smarty->assign("ANNOUNCE",$announcement); +$smarty->assign("MOD", return_module_language($current_language,'Settings')); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("APP", $app_strings); +$smarty->assign("CMOD", $mod_strings); + +$smarty->display("Settings/Announcements.tpl"); + +?> diff --git a/oss/vtiger/trunk/modules/Users/Authenticate.php b/oss/vtiger/trunk/modules/Users/Authenticate.php new file mode 100644 index 00000000..b765218f --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Authenticate.php @@ -0,0 +1,155 @@ +column_fields["user_name"] = to_html($_REQUEST['user_name']); +$user_password = vtlib_purify($_REQUEST['user_password']); + +$focus->load_user($user_password); + +if($focus->is_authenticated()) +{ + + //Inserting entries for audit trail during login + + if($audit_trail == 'true') + { + if($record == '') + $auditrecord = ''; + else + $auditrecord = $record; + + $date_var = $adb->formatDate(date('Y-m-d H:i:s'), true); + $query = "insert into vtiger_audit_trial values(?,?,?,?,?,?)"; + $params = array($adb->getUniqueID('vtiger_audit_trial'), $focus->id, 'Users','Authenticate','',$date_var); + $adb->pquery($query, $params); + } + + + // Recording the login info + $usip=$_SERVER['REMOTE_ADDR']; + $intime=date("Y/m/d H:i:s"); + require_once('modules/Users/LoginHistory.php'); + $loghistory=new LoginHistory(); + $Signin = $loghistory->user_login($focus->column_fields["user_name"],$usip,$intime); + + //Security related entries start + require_once('include/utils/UserInfoUtil.php'); + + createUserPrivilegesfile($focus->id); + + //Security related entries end + session_unregister('login_password'); + session_unregister('login_error'); + session_unregister('login_user_name'); + + $_SESSION['authenticated_user_id'] = $focus->id; + $_SESSION['app_unique_key'] = $application_unique_key; + + // store the user's theme in the session + if (isset($_REQUEST['login_theme'])) { + $authenticated_user_theme = vtlib_purify($_REQUEST['login_theme']); + } + elseif (isset($_REQUEST['ck_login_theme'])) { + $authenticated_user_theme = vtlib_purify($_REQUEST['ck_login_theme']); + } + else { + $authenticated_user_theme = $default_theme; + } + + // store the user's language in the session + if (isset($_REQUEST['login_language'])) { + $authenticated_user_language = vtlib_purify($_REQUEST['login_language']); + } + elseif (isset($_REQUEST['ck_login_language'])) { + $authenticated_user_language = vtlib_purify($_REQUEST['ck_login_language']); + } + else { + $authenticated_user_language = $default_language; + } + + // If this is the default user and the default user theme is set to reset, reset it to the default theme value on each login + if($reset_theme_on_default_user && $focus->user_name == $default_user_name) + { + $authenticated_user_theme = $default_theme; + } + if(isset($reset_language_on_default_user) && $reset_language_on_default_user && $focus->user_name == $default_user_name) + { + $authenticated_user_language = $default_language; + } + + $_SESSION['vtiger_authenticated_user_theme'] = $authenticated_user_theme; + $_SESSION['authenticated_user_language'] = $authenticated_user_language; + + $log->debug("authenticated_user_theme is $authenticated_user_theme"); + $log->debug("authenticated_user_language is $authenticated_user_language"); + $log->debug("authenticated_user_id is ". $focus->id); + $log->debug("app_unique_key is $application_unique_key"); + + +// Clear all uploaded import files for this user if it exists + + global $import_dir; + + $tmp_file_name = $import_dir. "IMPORT_".$focus->id; + + if (file_exists($tmp_file_name)) + { + unlink($tmp_file_name); + } + $arr = $_SESSION['lastpage']; + if(isset($_SESSION['lastpage'])) + header("Location: index.php?".$arr[0]); + else + header("Location: index.php"); +} +else +{ + $sql = 'select user_name, id, crypt_type from vtiger_users where user_name=?'; + $result = $adb->pquery($sql, array($focus->column_fields["user_name"])); + $rowList = $result->GetRows(); + foreach ($rowList as $row) { + $cryptType = $row['crypt_type']; + if(strtolower($cryptType) == 'md5' && version_compare(PHP_VERSION, '5.3.0') >= 0) { + header("Location: modules/Migration/PHP5.3_PasswordHelp.php"); + die; + } + } + $_SESSION['login_user_name'] = $focus->column_fields["user_name"]; + $_SESSION['login_password'] = $user_password; + $_SESSION['login_error'] = $mod_strings['ERR_INVALID_PASSWORD']; + + // go back to the login screen. + // create an error message for the user. + header("Location: index.php"); +} + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/ChangePassword.php b/oss/vtiger/trunk/modules/Users/ChangePassword.php new file mode 100644 index 00000000..b7d81e15 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/ChangePassword.php @@ -0,0 +1,111 @@ + + + + +
+ + + + + + +"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; +} +else echo ""; +?> + + + + + + + + + +
".$mod_strings['LBL_OLD_PASSWORD']."
+
+ + + + + + + +
' accessKey='' class='crmbutton small save' LANGUAGE=javascript onclick='if (set_password(this.form)) window.close(); else return false;' type='submit' name='button' value=' '>' accessyKey='' class='crmbutton small cancel' LANGUAGE=javascript onclick='window.close()' type='submit' name='button' value=' '>
+
+
+ diff --git a/oss/vtiger/trunk/modules/Users/CreateProfile.php b/oss/vtiger/trunk/modules/Users/CreateProfile.php new file mode 100644 index 00000000..d0adb793 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/CreateProfile.php @@ -0,0 +1,68 @@ +pquery($query, array($profilename)); + + if($adb->num_rows($result) > 0) + { + echo $mod_strings['LBL_PROFILENAME_EXIST']; + die; + }else + { + echo 'SUCCESS'; + die; + } + +} + + +global $theme; +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; +$smarty = new vtigerCRM_Smarty; + +if(isset($_REQUEST['parent_profile']) && $_REQUEST['parent_profile'] != '') + $smarty->assign("PARENT_PROFILE",vtlib_purify($_REQUEST['parent_profile'])); +if(isset($_REQUEST['radio_button']) && $_REQUEST['radio_button'] != '') + $smarty->assign("RADIO_BUTTON",vtlib_purify($_REQUEST['radio_button'])); +if(isset($_REQUEST['profile_name']) && $_REQUEST['profile_name'] != '') + $smarty->assign("PROFILE_NAME",vtlib_purify($_REQUEST['profile_name'])); +if(isset($_REQUEST['profile_description']) && $_REQUEST['profile_description'] != '') + $smarty->assign("PROFILE_DESCRIPTION",vtlib_purify($_REQUEST['profile_description'])); +if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != '') + $smarty->assign("MODE",vtlib_purify($_REQUEST['mode'])); + +$smarty->assign("MOD", return_module_language($current_language,'Settings')); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("APP", $app_strings); +$smarty->assign("CMOD", $mod_strings); + +$sql = "select * from vtiger_profile"; +$result = $adb->pquery($sql, array()); +$profilelist = array(); +$temprow = $adb->fetch_array($result); +do +{ + $name=$temprow["profilename"]; + $profileid=$temprow["profileid"]; + $profilelist[] = array($name,$profileid); +}while($temprow = $adb->fetch_array($result)); +$smarty->assign("PROFILE_LISTS", $profilelist); +$smarty->display("CreateProfile.tpl"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/CreateUserPrivilegeFile.php b/oss/vtiger/trunk/modules/Users/CreateUserPrivilegeFile.php new file mode 100644 index 00000000..c4b5a551 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/CreateUserPrivilegeFile.php @@ -0,0 +1,1780 @@ +retrieve_entity_info($userid,"Users"); + $userInfo=Array(); + $user_focus->column_fields["id"] = ''; + $user_focus->id = $userid; + foreach($user_focus->column_fields as $field=>$value_iter) + { + $userInfo[$field]= $user_focus->$field; + } + + if($user_focus->is_admin == 'on') + { + $newbuf .= "\$is_admin=true;\n"; + $newbuf .="\n"; + $newbuf .= "\$user_info=".constructSingleStringKeyValueArray($userInfo).";\n"; + $newbuf .= "\n"; + $newbuf .= "?>"; + fputs($handle, $newbuf); + fclose($handle); + return; + } + else + { + $newbuf .= "\$is_admin=false;\n"; + $newbuf .= "\n"; + + $globalPermissionArr=getCombinedUserGlobalPermissions($userid); + $tabsPermissionArr=getCombinedUserTabsPermissions($userid); + //$tabsPermissionArr=getCombinedUserTabsPermissions($userid); + $actionPermissionArr=getCombinedUserActionPermissions($userid); + $user_role=fetchUserRole($userid); + $user_role_info=getRoleInformation($user_role); + $user_role_parent=$user_role_info[$user_role][1]; + $userGroupFocus=new GetUserGroups(); + $userGroupFocus->getAllUserGroups($userid); + $subRoles=getRoleSubordinates($user_role); + $subRoleAndUsers=getSubordinateRoleAndUsers($user_role); + $def_org_share=getDefaultSharingAction(); + $parentRoles=getParentRole($user_role); + + + + + $newbuf .= "\$current_user_roles='".$user_role."';\n"; + $newbuf .= "\n"; + $newbuf .= "\$current_user_parent_role_seq='".$user_role_parent."';\n"; + $newbuf .= "\n"; + $newbuf .= "\$current_user_profiles=".constructSingleArray(getUserProfile($userid)).";\n"; + $newbuf .= "\n"; + $newbuf .= "\$profileGlobalPermission=".constructArray($globalPermissionArr).";\n"; + $newbuf .="\n"; + $newbuf .= "\$profileTabsPermission=".constructArray($tabsPermissionArr).";\n"; + $newbuf .="\n"; + $newbuf .= "\$profileActionPermission=".constructTwoDimensionalArray($actionPermissionArr).";\n"; + $newbuf .="\n"; + $newbuf .= "\$current_user_groups=".constructSingleArray($userGroupFocus->user_groups).";\n"; + $newbuf .="\n"; + $newbuf .= "\$subordinate_roles=".constructSingleCharArray($subRoles).";\n"; + $newbuf .="\n"; + $newbuf .= "\$parent_roles=".constructSingleCharArray($parentRoles).";\n"; + $newbuf .="\n"; + $newbuf .= "\$subordinate_roles_users=".constructTwoDimensionalCharIntSingleArray($subRoleAndUsers).";\n"; + $newbuf .="\n"; + $newbuf .= "\$user_info=".constructSingleStringKeyValueArray($userInfo).";\n"; + + $newbuf .= "?>"; + fputs($handle, $newbuf); + fclose($handle); + } + } +} + +/** Creates a file with all the organization default sharing permissions and custom sharing permissins specific for the specified user. In this file the information of the other users whose data is shared with the specified user is stored. + * @param $userid -- user id:: Type integer + * @returns sharing_privileges_userid file under the user_privileges directory + */ +function createUserSharingPrivilegesfile($userid) +{ + global $adb, $root_directory; + require('user_privileges/user_privileges_'.$userid.'.php'); + $handle=@fopen($root_directory.'user_privileges/sharing_privileges_'.$userid.'.php',"w+"); + +if($handle) + { + $newbuf=''; + $newbuf .="retrieve_entity_info($userid,"Users"); + if($user_focus->is_admin == 'on') + { + $newbuf .= "\n"; + $newbuf .= "?>"; + fputs($handle, $newbuf); + fclose($handle); + return; + } + else + { + //Constructig the Default Org Share Array + $def_org_share=getAllDefaultSharingAction(); + $newbuf .= "\$defaultOrgSharingPermission=".constructArray($def_org_share).";\n"; + $newbuf .= "\n"; + + //Constructing the Related Module Sharing Array + $relModSharArr=Array(); + $query ="select * from vtiger_datashare_relatedmodules"; + $result=$adb->pquery($query, array()); + $num_rows = $adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $parTabId=$adb->query_result($result,$i,'tabid'); + $relTabId=$adb->query_result($result,$i,'relatedto_tabid'); + if(is_array($relModSharArr[$relTabId])) + { + $temArr=$relModSharArr[$relTabId]; + $temArr[]=$parTabId; + } + else + { + $temArr=Array(); + $temArr[]=$parTabId; + } + $relModSharArr[$relTabId]=$temArr; + } + + $newbuf .= "\$related_module_share=".constructTwoDimensionalValueArray($relModSharArr).";\n\n"; + + //Constructing Lead Sharing Rules + $lead_share_per_array=getUserModuleSharingObjects("Leads",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $lead_share_read_per=$lead_share_per_array['read']; + $lead_share_write_per=$lead_share_per_array['write']; + $lead_sharingrule_members=$lead_share_per_array['sharingrules']; + + $newbuf .= "\$Leads_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($lead_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($lead_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Leads_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($lead_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($lead_share_write_per['GROUP']).");\n\n"; + + //Constructing the Lead Email Related Module Sharing Array + $lead_related_email=getRelatedModuleSharingArray("Leads","Emails",$lead_sharingrule_members,$lead_share_read_per,$lead_share_write_per,$def_org_share); + + $lead_email_share_read_per=$lead_related_email['read']; + $lead_email_share_write_per=$lead_related_email['write']; + + $newbuf .= "\$Leads_Emails_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($lead_email_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($lead_email_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Leads_Emails_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($lead_email_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($lead_email_share_write_per['GROUP']).");\n\n"; + + + + //Constructing Account Sharing Rules + $account_share_per_array=getUserModuleSharingObjects("Accounts",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $account_share_read_per=$account_share_per_array['read']; + $account_share_write_per=$account_share_per_array['write']; + $account_sharingrule_members=$account_share_per_array['sharingrules']; + /*echo '
';
+			print_r($account_share_read_per['GROUP']);
+			echo '
';*/ + $newbuf .= "\$Accounts_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($account_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($account_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Accounts_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($account_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($account_share_write_per['GROUP']).");\n\n"; + + //Constructing Contact Sharing Rules + $newbuf .= "\$Contacts_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($account_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($account_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Contacts_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($account_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($account_share_write_per['GROUP']).");\n\n"; + + + + + + //Constructing the Account Potential Related Module Sharing Array + $acct_related_pot=getRelatedModuleSharingArray("Accounts","Potentials",$account_sharingrule_members,$account_share_read_per,$account_share_write_per,$def_org_share); + + $acc_pot_share_read_per=$acct_related_pot['read']; + $acc_pot_share_write_per=$acct_related_pot['write']; + + $newbuf .= "\$Accounts_Potentials_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_pot_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_pot_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Accounts_Potentials_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_pot_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_pot_share_write_per['GROUP']).");\n\n"; + + //Constructing the Account Ticket Related Module Sharing Array + $acct_related_tkt=getRelatedModuleSharingArray("Accounts","HelpDesk",$account_sharingrule_members,$account_share_read_per,$account_share_write_per,$def_org_share); + + $acc_tkt_share_read_per=$acct_related_tkt['read']; + $acc_tkt_share_write_per=$acct_related_tkt['write']; + + $newbuf .= "\$Accounts_HelpDesk_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_tkt_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_tkt_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Accounts_HelpDesk_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_tkt_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_tkt_share_write_per['GROUP']).");\n\n"; + + //Constructing the Account Email Related Module Sharing Array + $acct_related_email=getRelatedModuleSharingArray("Accounts","Emails",$account_sharingrule_members,$account_share_read_per,$account_share_write_per,$def_org_share); + + $acc_email_share_read_per=$acct_related_email['read']; + $acc_email_share_write_per=$acct_related_email['write']; + + $newbuf .= "\$Accounts_Emails_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_email_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_email_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Accounts_Emails_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_email_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_email_share_write_per['GROUP']).");\n\n"; + + //Constructing the Account Quote Related Module Sharing Array + $acct_related_qt=getRelatedModuleSharingArray("Accounts","Quotes",$account_sharingrule_members,$account_share_read_per,$account_share_write_per,$def_org_share); + + $acc_qt_share_read_per=$acct_related_qt['read']; + $acc_qt_share_write_per=$acct_related_qt['write']; + + $newbuf .= "\$Accounts_Quotes_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_qt_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_qt_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Accounts_Quotes_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_qt_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_qt_share_write_per['GROUP']).");\n\n"; + + //Constructing the Account SalesOrder Related Module Sharing Array + $acct_related_so=getRelatedModuleSharingArray("Accounts","SalesOrder",$account_sharingrule_members,$account_share_read_per,$account_share_write_per,$def_org_share); + + $acc_so_share_read_per=$acct_related_so['read']; + $acc_so_share_write_per=$acct_related_so['write']; + + $newbuf .= "\$Accounts_SalesOrder_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_so_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_so_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Accounts_SalesOrder_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_so_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_so_share_write_per['GROUP']).");\n\n"; + + + //Constructing the Account Invoice Related Module Sharing Array + $acct_related_inv=getRelatedModuleSharingArray("Accounts","Invoice",$account_sharingrule_members,$account_share_read_per,$account_share_write_per,$def_org_share); + + $acc_inv_share_read_per=$acct_related_inv['read']; + $acc_inv_share_write_per=$acct_related_inv['write']; + + $newbuf .= "\$Accounts_Invoice_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_inv_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_inv_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Accounts_Invoice_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($acc_inv_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($acc_inv_share_write_per['GROUP']).");\n\n"; + + + //Constructing Potential Sharing Rules + $pot_share_per_array=getUserModuleSharingObjects("Potentials",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $pot_share_read_per=$pot_share_per_array['read']; + $pot_share_write_per=$pot_share_per_array['write']; + $pot_sharingrule_members=$pot_share_per_array['sharingrules']; + $newbuf .= "\$Potentials_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($pot_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($pot_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Potentials_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($pot_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($pot_share_write_per['GROUP']).");\n\n"; + + //Constructing the Potential Quotes Related Module Sharing Array + $pot_related_qt=getRelatedModuleSharingArray("Potentials","Quotes",$pot_sharingrule_members,$pot_share_read_per,$pot_share_write_per,$def_org_share); + + $pot_qt_share_read_per=$pot_related_qt['read']; + $pot_qt_share_write_per=$pot_related_qt['write']; + + $newbuf .= "\$Potentials_Quotes_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($pot_qt_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($pot_qt_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Potentials_Quotes_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($pot_qt_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($pot_qt_share_write_per['GROUP']).");\n\n"; + + //Constructing the Potential SalesOrder Related Module Sharing Array + $pot_related_inv=getRelatedModuleSharingArray("Potentials","SalesOrder",$pot_sharingrule_members,$pot_share_read_per,$pot_share_write_per,$def_org_share); + + + + $pot_inv_share_read_per=$pot_related_inv['read']; + $pot_inv_share_write_per=$pot_related_inv['write']; + + $newbuf .= "\$Potentials_SalesOrder_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($pot_inv_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($pot_inv_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Potentials_SalesOrder_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($pot_inv_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($pot_inv_share_write_per['GROUP']).");\n\n"; + + + + + //Constructing HelpDesk Sharing Rules + $hd_share_per_array=getUserModuleSharingObjects("HelpDesk",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $hd_share_read_per=$hd_share_per_array['read']; + $hd_share_write_per=$hd_share_per_array['write']; + $newbuf .= "\$HelpDesk_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($hd_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($hd_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$HelpDesk_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($hd_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($hd_share_write_per['GROUP']).");\n\n"; + + //Constructing Emails Sharing Rules + $email_share_per_array=getUserModuleSharingObjects("Emails",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $email_share_read_per=$email_share_per_array['read']; + $email_share_write_per=$email_share_per_array['write']; + $newbuf .= "\$Emails_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($email_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($email_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Emails_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($email_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($email_share_write_per['GROUP']).");\n\n"; + + //Constructing Campaigns Sharing Rules + $campaign_share_per_array=getUserModuleSharingObjects("Campaigns",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $campaign_share_read_per=$campaign_share_per_array['read']; + $campaign_share_write_per=$campaign_share_per_array['write']; + $newbuf .= "\$Campaigns_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($campaign_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($campaign_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Campaigns_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($campaign_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($campaign_share_write_per['GROUP']).");\n\n"; + + + //Constructing Quotes Sharing Rules + $quotes_share_per_array=getUserModuleSharingObjects("Quotes",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $quotes_share_read_per=$quotes_share_per_array['read']; + $quotes_share_write_per=$quotes_share_per_array['write']; + $quotes_sharingrule_members=$quotes_share_per_array['sharingrules']; + $newbuf .= "\$Quotes_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($quotes_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($quotes_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Quotes_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($quotes_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($quotes_share_write_per['GROUP']).");\n\n"; + + //Constructing the Quote SalesOrder Related Module Sharing Array + $qt_related_so=getRelatedModuleSharingArray("Quotes","SalesOrder",$quotes_sharingrule_members,$quotes_share_read_per,$quotes_share_write_per,$def_org_share); + + $qt_so_share_read_per=$qt_related_so['read']; + $qt_so_share_write_per=$qt_related_so['write']; + + $newbuf .= "\$Quotes_SalesOrder_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($qt_so_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($qt_so_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Quotes_SalesOrder_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($qt_so_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($qt_so_share_write_per['GROUP']).");\n\n"; + + + + + //Constructing Orders Sharing Rules + $po_share_per_array=getUserModuleSharingObjects("PurchaseOrder",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $po_share_read_per=$po_share_per_array['read']; + $po_share_write_per=$po_share_per_array['write']; + $newbuf .= "\$PurchaseOrder_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($po_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($po_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$PurchaseOrder_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($po_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($po_share_write_per['GROUP']).");\n\n"; + + //Constructing Sales Order Sharing Rules + $so_share_per_array=getUserModuleSharingObjects("SalesOrder",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $so_share_read_per=$so_share_per_array['read']; + $so_share_write_per=$so_share_per_array['write']; + $so_sharingrule_members=$so_share_per_array['sharingrules']; + $newbuf .= "\$SalesOrder_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($so_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($so_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$SalesOrder_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($so_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($so_share_write_per['GROUP']).");\n\n"; + + //Constructing the SalesOrder Invoice Related Module Sharing Array + $so_related_inv=getRelatedModuleSharingArray("SalesOrder","Invoice",$so_sharingrule_members,$so_share_read_per,$so_share_write_per,$def_org_share); + + $so_inv_share_read_per=$so_related_inv['read']; + $so_inv_share_write_per=$so_related_inv['write']; + + $newbuf .= "\$SalesOrder_Invoice_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($so_inv_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($so_inv_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$SalesOrder_Invoice_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($so_inv_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalValueArray($so_inv_share_write_per['GROUP']).");\n\n"; + + + + //Constructing Invoice Sharing Rules + $inv_share_per_array=getUserModuleSharingObjects("Invoice",$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + $inv_share_read_per=$inv_share_per_array['read']; + $inv_share_write_per=$inv_share_per_array['write']; + $newbuf .= "\$Invoice_share_read_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($inv_share_read_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($inv_share_read_per['GROUP']).");\n\n"; + $newbuf .= "\$Invoice_share_write_permission=array('ROLE'=>".constructTwoDimensionalCharIntSingleValueArray($inv_share_write_per['ROLE']).",'GROUP'=>".constructTwoDimensionalArray($inv_share_write_per['GROUP']).");\n\n"; + + // Writing Sharing Rules For Custom Modules. + // TODO: We are ignoring rules that has already been calculated above, it is good to add GENERIC logic here. + $custom_modules = getSharingModuleList( + Array('Leads', 'Accounts', 'Contacts', 'Potentials', 'HelpDesk', + 'Emails', 'Campaigns','Quotes', 'PurchaseOrder', 'SalesOrder', 'Invoice')); + + for($idx = 0; $idx < count($custom_modules); ++$idx) { + $module_name = $custom_modules[$idx]; + $mod_share_perm_array = getUserModuleSharingObjects($module_name,$userid, + $def_org_share,$current_user_roles,$parent_roles,$current_user_groups); + + $mod_share_read_perm = $mod_share_perm_array['read']; + $mod_share_write_perm= $mod_share_perm_array['write']; + $newbuf .= '$'.$module_name."_share_read_permission=array('ROLE'=>". + constructTwoDimensionalCharIntSingleValueArray($mod_share_read_perm['ROLE']).",'GROUP'=>". + constructTwoDimensionalArray($mod_share_read_perm['GROUP']).");\n\n"; + $newbuf .= '$'.$module_name."_share_write_permission=array('ROLE'=>". + constructTwoDimensionalCharIntSingleValueArray($mod_share_write_perm['ROLE']).",'GROUP'=>". + constructTwoDimensionalArray($mod_share_write_perm['GROUP']).");\n\n"; + } + // END + + $newbuf .= "?>"; + fputs($handle, $newbuf); + fclose($handle); + + //Populating Temp Tables + populateSharingtmptables($userid); + } + } +} + +/** Gives an array which contains the information for what all roles, groups and user data is to be shared with the spcified user for the specified module + + * @param $module -- module name:: Type varchar + * @param $userid -- user id:: Type integer + * @param $def_org_share -- default organization sharing permission array:: Type array + * @param $current_user_roles -- roleid:: Type varchar + * @param $parent_roles -- parent roles:: Type varchar + * @param $current_user_groups -- user id:: Type integer + * @returns $mod_share_permission -- array which contains the id of roles,group and users data shared with specifed user for the specified module + */ +function getUserModuleSharingObjects($module,$userid,$def_org_share,$current_user_roles,$parent_roles,$current_user_groups) +{ + global $adb; + + $mod_tabid=getTabid($module); + + $mod_share_permission; + $mod_share_read_permission=Array(); + $mod_share_write_permission=Array(); + $mod_share_read_permission['ROLE']=Array(); + $mod_share_write_permission['ROLE']=Array(); + $mod_share_read_permission['GROUP']=Array(); + $mod_share_write_permission['GROUP']=Array(); + + $share_id_members=Array(); + $share_id_groupmembers=Array(); + //If Sharing of leads is Private + if($def_org_share[$mod_tabid] == 3 || $def_org_share[$mod_tabid] == 0) + { + $role_read_per=Array(); + $role_write_per=Array(); + $rs_read_per=Array(); + $rs_write_per=Array(); + $grp_read_per=Array(); + $grp_write_per=Array(); + //Retreiving from vtiger_role to vtiger_role + $query="select vtiger_datashare_role2role.* from vtiger_datashare_role2role inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_role2role.shareid where vtiger_datashare_module_rel.tabid=? and vtiger_datashare_role2role.to_roleid=?"; + $result=$adb->pquery($query, array($mod_tabid, $current_user_roles)); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_roleid=$adb->query_result($result,$i,'share_roleid'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_role_members=Array(); + $share_id_roles=Array(); + $share_id_roles[]=$share_roleid; + $share_id_role_members['ROLE']=$share_id_roles; + $share_id_members[$shareid]=$share_id_role_members; + + $share_permission=$adb->query_result($result,$i,'permission'); + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + } + if(! array_key_exists($share_roleid,$role_write_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_write_per[$share_roleid]=$share_role_users; + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + + } + + } + + + + //Retreiving from role to rs + $parRoleList = array(); + foreach($parent_roles as $par_role_id) + { + array_push($parRoleList, $par_role_id); + } + array_push($parRoleList, $current_user_roles); + $query="select vtiger_datashare_role2rs.* from vtiger_datashare_role2rs inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_role2rs.shareid where vtiger_datashare_module_rel.tabid=? and vtiger_datashare_role2rs.to_roleandsubid in (". generateQuestionMarks($parRoleList) .")"; + $result=$adb->pquery($query, array($mod_tabid, $parRoleList)); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_roleid=$adb->query_result($result,$i,'share_roleid'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_role_members=Array(); + $share_id_roles=Array(); + $share_id_roles[]=$share_roleid; + $share_id_role_members['ROLE']=$share_id_roles; + $share_id_members[$shareid]=$share_id_role_members; + + $share_permission=$adb->query_result($result,$i,'permission'); + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + } + if(! array_key_exists($share_roleid,$role_write_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_write_per[$share_roleid]=$share_role_users; + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + + } + + } + + //Get roles from Role2Grp + $grpIterator=false; + $groupList = $current_user_groups; + if (!empty($groupList)) { + $query="select vtiger_datashare_role2group.* from vtiger_datashare_role2group inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_role2group.shareid where vtiger_datashare_module_rel.tabid=?"; + $qparams = array($mod_tabid); + if (count($groupList) > 0) { + $query .= " and vtiger_datashare_role2group.to_groupid in (". generateQuestionMarks($groupList) .")"; + array_push($qparams, $groupList); + } + $result=$adb->pquery($query, $qparams); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_roleid=$adb->query_result($result,$i,'share_roleid'); + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_role_members=Array(); + $share_id_roles=Array(); + $share_id_roles[]=$share_roleid; + $share_id_role_members['ROLE']=$share_id_roles; + $share_id_members[$shareid]=$share_id_role_members; + + $share_permission=$adb->query_result($result,$i,'permission'); + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + } + if(! array_key_exists($share_roleid,$role_write_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_write_per[$share_roleid]=$share_role_users; + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + + } + + } + } + + + //Retreiving from rs to vtiger_role + $query="select vtiger_datashare_rs2role.* from vtiger_datashare_rs2role inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_rs2role.shareid where vtiger_datashare_module_rel.tabid=? and vtiger_datashare_rs2role.to_roleid=?"; + $result=$adb->pquery($query, array($mod_tabid, $current_user_roles)); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_rsid=$adb->query_result($result,$i,'share_roleandsubid'); + $share_roleids=getRoleAndSubordinatesRoleIds($share_rsid); + $share_permission=$adb->query_result($result,$i,'permission'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_role_members=Array(); + $share_id_roles=Array(); + foreach($share_roleids as $share_roleid) + { + $share_id_roles[]=$share_roleid; + + + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + } + if(! array_key_exists($share_roleid,$role_write_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_write_per[$share_roleid]=$share_role_users; + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + + } + } + $share_id_role_members['ROLE']=$share_id_roles; + $share_id_members[$shareid]=$share_id_role_members; + + } + + + //Retreiving from rs to rs + $parRoleList = array(); + foreach($parent_roles as $par_role_id) + { + array_push($parRoleList, $par_role_id); + } + array_push($parRoleList, $current_user_roles); + $query="select vtiger_datashare_rs2rs.* from vtiger_datashare_rs2rs inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_rs2rs.shareid where vtiger_datashare_module_rel.tabid=? and vtiger_datashare_rs2rs.to_roleandsubid in (". generateQuestionMarks($parRoleList) .")"; + $result=$adb->pquery($query, array($mod_tabid, $parRoleList)); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_rsid=$adb->query_result($result,$i,'share_roleandsubid'); + $share_roleids=getRoleAndSubordinatesRoleIds($share_rsid); + $share_permission=$adb->query_result($result,$i,'permission'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_role_members=Array(); + $share_id_roles=Array(); + foreach($share_roleids as $share_roleid) + { + + $share_id_roles[]=$share_roleid; + + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + } + if(! array_key_exists($share_roleid,$role_write_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_write_per[$share_roleid]=$share_role_users; + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + + } + } + $share_id_role_members['ROLE']=$share_id_roles; + $share_id_members[$shareid]=$share_id_role_members; + + } + + //Get roles from Rs2Grp + + $query="select vtiger_datashare_rs2grp.* from vtiger_datashare_rs2grp inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_rs2grp.shareid where vtiger_datashare_module_rel.tabid=?"; + $qparams = array($mod_tabid); + if (count($groupList) > 0) { + $query .= " and vtiger_datashare_rs2grp.to_groupid in (". generateQuestionMarks($groupList) .")"; + array_push($qparams, $groupList); + } + $result=$adb->pquery($query, $qparams); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_rsid=$adb->query_result($result,$i,'share_roleandsubid'); + $share_roleids=getRoleAndSubordinatesRoleIds($share_rsid); + $share_permission=$adb->query_result($result,$i,'permission'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_role_members=Array(); + $share_id_roles=Array(); + + foreach($share_roleids as $share_roleid) + { + + $share_id_roles[]=$share_roleid; + + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + } + if(! array_key_exists($share_roleid,$role_write_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_write_per[$share_roleid]=$share_role_users; + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_roleid,$role_read_per)) + { + + $share_role_users=getRoleUserIds($share_roleid); + $role_read_per[$share_roleid]=$share_role_users; + } + + } + } + $share_id_role_members['ROLE']=$share_id_roles; + $share_id_members[$shareid]=$share_id_role_members; + + + + } + $mod_share_read_permission['ROLE']=$role_read_per; + $mod_share_write_permission['ROLE']=$role_write_per; + + //Retreiving from the grp2role sharing + $query="select vtiger_datashare_grp2role.* from vtiger_datashare_grp2role inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_grp2role.shareid where vtiger_datashare_module_rel.tabid=? and vtiger_datashare_grp2role.to_roleid=?"; + $result=$adb->pquery($query, array($mod_tabid, $current_user_roles)); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_grpid=$adb->query_result($result,$i,'share_groupid'); + $share_permission=$adb->query_result($result,$i,'permission'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_grp_members=Array(); + $share_id_grps=Array(); + $share_id_grps[]=$share_grpid; + + + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_grpid,$grp_read_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $share_grp_subgroups=$focusGrpUsers->group_subgroups; + $grp_read_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + } + } + if(! array_key_exists($share_grpid,$grp_write_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_write_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_write_per)) + { + $grp_write_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_grpid,$grp_read_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_read_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + } + + } + $share_id_grp_members['GROUP']=$share_id_grps; + $share_id_members[$shareid]=$share_id_grp_members; + + } + + //Retreiving from the grp2rs sharing + + $query="select vtiger_datashare_grp2rs.* from vtiger_datashare_grp2rs inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_grp2rs.shareid where vtiger_datashare_module_rel.tabid=? and vtiger_datashare_grp2rs.to_roleandsubid in (". generateQuestionMarks($parRoleList) .")"; + $result=$adb->pquery($query, array($mod_tabid, $parRoleList)); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_grpid=$adb->query_result($result,$i,'share_groupid'); + $share_permission=$adb->query_result($result,$i,'permission'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_grp_members=Array(); + $share_id_grps=Array(); + $share_id_grps[]=$share_grpid; + + + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_grpid,$grp_read_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_read_per[$share_grpid]=$share_grp_users; + + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + } + } + if(! array_key_exists($share_grpid,$grp_write_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_write_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_write_per)) + { + $grp_write_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_grpid,$grp_read_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_read_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + } + + } + $share_id_grp_members['GROUP']=$share_id_grps; + $share_id_members[$shareid]=$share_id_grp_members; + + } + + //Retreiving from the grp2grp sharing + + $query="select vtiger_datashare_grp2grp.* from vtiger_datashare_grp2grp inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_grp2grp.shareid where vtiger_datashare_module_rel.tabid=?"; + $qparams = array($mod_tabid); + if (count($groupList) > 0) { + $query .= " and vtiger_datashare_grp2grp.to_groupid in (". generateQuestionMarks($groupList) .")"; + array_push($qparams, $groupList); + } + $result=$adb->pquery($query, $qparams); + $num_rows=$adb->num_rows($result); + for($i=0;$i<$num_rows;$i++) + { + $share_grpid=$adb->query_result($result,$i,'share_groupid'); + $share_permission=$adb->query_result($result,$i,'permission'); + + $shareid=$adb->query_result($result,$i,'shareid'); + $share_id_grp_members=Array(); + $share_id_grps=Array(); + $share_id_grps[]=$share_grpid; + + if($share_permission == 1) + { + if($def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_grpid,$grp_read_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_read_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + + } + } + } + if(! array_key_exists($share_grpid,$grp_write_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_write_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_write_per)) + { + $grp_write_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + + } + } + elseif($share_permission == 0 && $def_org_share[$mod_tabid] == 3) + { + if(! array_key_exists($share_grpid,$grp_read_per)) + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($share_grpid); + $share_grp_users=$focusGrpUsers->group_users; + $grp_read_per[$share_grpid]=$share_grp_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + if(! in_array($subgrpid,$share_id_grps)) + { + $share_id_grps[]=$subgrpid; + } + + } + } + + } + $share_id_grp_members['GROUP']=$share_id_grps; + $share_id_members[$shareid]=$share_id_grp_members; + + } + $mod_share_read_permission['GROUP']=$grp_read_per; + $mod_share_write_permission['GROUP']=$grp_write_per; + } + $mod_share_permission['read']=$mod_share_read_permission; + $mod_share_permission['write']=$mod_share_write_permission; + $mod_share_permission['sharingrules']=$share_id_members; + return $mod_share_permission; +} + +/** Gives an array which contains the information for what all roles, groups and user's related module data that is to be shared for the specified parent module and shared module + + * @param $par_mod -- parent module name:: Type varchar + * @param $share_mod -- shared module name:: Type varchar + * @param $userid -- user id:: Type integer + * @param $def_org_share -- default organization sharing permission array:: Type array + * @param $mod_sharingrule_members -- Sharing Rule Members array:: Type array + * @param $$mod_share_read_per -- Sharing Module Read Permission array:: Type array + * @param $$mod_share_write_per -- Sharing Module Write Permission array:: Type array + * @returns $related_mod_sharing_permission; -- array which contains the id of roles,group and users related module data to be shared + */ +function getRelatedModuleSharingArray($par_mod,$share_mod,$mod_sharingrule_members,$mod_share_read_per,$mod_share_write_per,$def_org_share) +{ + + global $adb; + $related_mod_sharing_permission=Array(); + $mod_share_read_permission=Array(); + $mod_share_write_permission=Array(); + + $mod_share_read_permission['ROLE']=Array(); + $mod_share_write_permission['ROLE']=Array(); + $mod_share_read_permission['GROUP']=Array(); + $mod_share_write_permission['GROUP']=Array(); + + $par_mod_id=getTabid($par_mod); + $share_mod_id=getTabid($share_mod); + + if($def_org_share[$share_mod_id] == 3 || $def_org_share[$share_mod_id] == 0) + { + + $role_read_per=Array(); + $role_write_per=Array(); + $grp_read_per=Array(); + $grp_write_per=Array(); + + + + foreach($mod_sharingrule_members as $sharingid => $sharingInfoArr) + { + $query = "select vtiger_datashare_relatedmodule_permission.* from vtiger_datashare_relatedmodule_permission inner join vtiger_datashare_relatedmodules on vtiger_datashare_relatedmodules.datashare_relatedmodule_id=vtiger_datashare_relatedmodule_permission.datashare_relatedmodule_id where vtiger_datashare_relatedmodule_permission.shareid=? and vtiger_datashare_relatedmodules.tabid=? and vtiger_datashare_relatedmodules.relatedto_tabid=?"; + $result=$adb->pquery($query, array($sharingid, $par_mod_id, $share_mod_id)); + $share_permission=$adb->query_result($result,0,'permission'); + + foreach($sharingInfoArr as $shareType => $shareEntArr) + { + foreach($shareEntArr as $key=>$shareEntId) + { + if($shareType == 'ROLE') + { + if($share_permission == 1) + { + if($def_org_share[$share_mod_id] == 3) + { + if(! array_key_exists($shareEntId,$role_read_per)) + { + if(array_key_exists($shareEntId,$mod_share_read_per['ROLE'])) + { + $share_role_users=$mod_share_read_per['ROLE'][$shareEntId]; + } + elseif(array_key_exists($shareEntId,$mod_share_write_per['ROLE'])) + { + $share_role_users=$mod_share_write_per['ROLE'][$shareEntId]; + } + else + { + + $share_role_users=getRoleUserIds($shareEntId); + } + + $role_read_per[$shareEntId]=$share_role_users; + + } + } + if(! array_key_exists($shareEntId,$role_write_per)) + { + if(array_key_exists($shareEntId,$mod_share_read_per['ROLE'])) + { + $share_role_users=$mod_share_read_per['ROLE'][$shareEntId]; + } + elseif(array_key_exists($shareEntId,$mod_share_write_per['ROLE'])) + { + $share_role_users=$mod_share_write_per['ROLE'][$shareEntId]; + } + else + { + + $share_role_users=getRoleUserIds($shareEntId); + + } + + $role_write_per[$shareEntId]=$share_role_users; + } + } + elseif($share_permission == 0 && $def_org_share[$share_mod_id] == 3) + { + if(! array_key_exists($shareEntId,$role_read_per)) + { + if(array_key_exists($shareEntId,$mod_share_read_per['ROLE'])) + { + $share_role_users=$mod_share_read_per['ROLE'][$shareEntId]; + } + elseif(array_key_exists($shareEntId,$mod_share_write_per['ROLE'])) + { + $share_role_users=$mod_share_write_per['ROLE'][$shareEntId]; + } + else + { + + $share_role_users=getRoleUserIds($shareEntId); + } + + $role_read_per[$shareEntId]=$share_role_users; + + } + + + } + + } + elseif($shareType == 'GROUP') + { + if($share_permission == 1) + { + if($def_org_share[$share_mod_id] == 3) + { + + if(! array_key_exists($shareEntId,$grp_read_per)) + { + if(array_key_exists($shareEntId,$mod_share_read_per['GROUP'])) + { + $share_grp_users=$mod_share_read_per['GROUP'][$shareEntId]; + } + elseif(array_key_exists($shareEntId,$mod_share_write_per['GROUP'])) + { + $share_grp_users=$mod_share_write_per['GROUP'][$shareEntId]; + } + else + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($shareEntId); + $share_grp_users=$focusGrpUsers->group_users; + + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + + } + + } + + $grp_read_per[$shareEntId]=$share_grp_users; + + } + } + if(! array_key_exists($shareEntId,$grp_write_per)) + { + if(! array_key_exists($shareEntId,$grp_write_per)) + { + if(array_key_exists($shareEntId,$mod_share_read_per['GROUP'])) + { + $share_grp_users=$mod_share_read_per['GROUP'][$shareEntId]; + } + elseif(array_key_exists($shareEntId,$mod_share_write_per['GROUP'])) + { + $share_grp_users=$mod_share_write_per['GROUP'][$shareEntId]; + } + else + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($shareEntId); + $share_grp_users=$focusGrpUsers->group_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_write_per)) + { + $grp_write_per[$subgrpid]=$subgrpusers; + } + + } + + } + + $grp_write_per[$shareEntId]=$share_grp_users; + + } + } + } + elseif($share_permission == 0 && $def_org_share[$share_mod_id] == 3) + { + if(! array_key_exists($shareEntId,$grp_read_per)) + { + if(array_key_exists($shareEntId,$mod_share_read_per['GROUP'])) + { + $share_grp_users=$mod_share_read_per['GROUP'][$shareEntId]; + } + elseif(array_key_exists($shareEntId,$mod_share_write_per['GROUP'])) + { + $share_grp_users=$mod_share_write_per['GROUP'][$shareEntId]; + } + else + { + $focusGrpUsers = new GetGroupUsers(); + $focusGrpUsers->getAllUsersInGroup($shareEntId); + $share_grp_users=$focusGrpUsers->group_users; + foreach($focusGrpUsers->group_subgroups as $subgrpid=>$subgrpusers) + { + if(! array_key_exists($subgrpid,$grp_read_per)) + { + $grp_read_per[$subgrpid]=$subgrpusers; + } + + } + + } + + $grp_read_per[$shareEntId]=$share_grp_users; + + } + + + } + } + } + } + } + $mod_share_read_permission['ROLE']=$role_read_per; + $mod_share_write_permission['ROLE']=$role_write_per; + $mod_share_read_permission['GROUP']=$grp_read_per; + $mod_share_write_permission['GROUP']=$grp_write_per; + } + + $related_mod_sharing_permission['read']=$mod_share_read_permission; + $related_mod_sharing_permission['write']=$mod_share_write_permission; + return $related_mod_sharing_permission; + + +} + + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructArray($var) +{ + if (is_array($var)) + { + $code = 'array('; + foreach ($var as $key => $value) + { + $code .= "'".$key."'=>".$value.','; + } + $code .= ')'; + return $code; + } +} + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructSingleStringValueArray($var) +{ + + $size = sizeof($var); + $i=1; + if (is_array($var)) + { + $code = 'array('; + foreach ($var as $key => $value) + { + if($i<$size) + { + $code .= $key."=>'".$value."',"; + } + else + { + $code .= $key."=>'".$value."'"; + } + $i++; + } + $code .= ')'; + return $code; + } +} + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructSingleStringKeyAndValueArray($var) +{ + + $size = sizeof($var); + $i=1; + if (is_array($var)) + { + $code = 'array('; + foreach ($var as $key => $value) + { + if($i<$size) + { + $code .= "'".$key."'=>".$value.","; + } + else + { + $code .= "'".$key."'=>".$value; + } + $i++; + } + $code .= ')'; + return $code; + } +} + + + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructSingleStringKeyValueArray($var) { + global $adb; + $size = sizeof($var); + $i=1; + if (is_array($var)) { + $code = 'array('; + foreach ($var as $key => $value) { + //fix for signatue quote(') issue + $value=$adb->sql_escape_string($value); + if($i<$size) { + $code .= "'".$key."'=>'".$value."',"; + } else { + $code .= "'".$key."'=>'".$value."'"; + } + $i++; + } + $code .= ')'; + return $code; + } +} + + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructSingleArray($var) +{ + if (is_array($var)) + { + $code = 'array('; + foreach ($var as $value) + { + $code .= $value.','; + } + $code .= ')'; + return $code; + } +} + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructSingleCharArray($var) +{ + if (is_array($var)) + { + $code = "array("; + foreach ($var as $value) + { + $code .="'".$value."',"; + } + $code .= ")"; + return $code; + } +} + + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructTwoDimensionalArray($var) +{ + if (is_array($var)) + { + $code = 'array('; + foreach ($var as $key => $secarr) + { + $code .= $key.'=>array('; + foreach($secarr as $seckey => $secvalue) + { + $code .= $seckey.'=>'.$secvalue.','; + } + $code .= '),'; + } + $code .= ')'; + return $code; + } +} + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructTwoDimensionalValueArray($var) +{ + if (is_array($var)) + { + $code = 'array('; + foreach ($var as $key => $secarr) + { + $code .= $key.'=>array('; + foreach($secarr as $seckey => $secvalue) + { + $code .= $secvalue.','; + } + $code .= '),'; + } + $code .= ')'; + return $code; + } +} + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructTwoDimensionalCharIntSingleArray($var) +{ + if (is_array($var)) + { + $code = "array("; + foreach ($var as $key => $secarr) + { + $code .= "'".$key."'=>array("; + foreach($secarr as $seckey => $secvalue) + { + $code .= $seckey.","; + } + $code .= "),"; + } + $code .= ")"; + return $code; + } +} + +/** Converts the input array to a single string to facilitate the writing of the input array in a flat file + + * @param $var -- input array:: Type array + * @returns $code -- contains the whole array in a single string:: Type array + */ +function constructTwoDimensionalCharIntSingleValueArray($var) +{ + if (is_array($var)) + { + $code = "array("; + foreach ($var as $key => $secarr) + { + $code .= "'".$key."'=>array("; + foreach($secarr as $seckey => $secvalue) + { + $code .= $secvalue.","; + } + $code .= "),"; + } + $code .= ")"; + return $code; + } +} + + +/** Function to populate the read/wirte Sharing permissions data of user/groups for the specified user into the database + * @param $userid -- user id:: Type integer + */ + +function populateSharingtmptables($userid) +{ + global $adb; + require('user_privileges/sharing_privileges_'.$userid.'.php'); + //Deleting from the existing vtiger_tables + $table_arr=Array('vtiger_tmp_read_user_sharing_per', 'vtiger_tmp_write_user_sharing_per','vtiger_tmp_read_group_sharing_per','vtiger_tmp_write_group_sharing_per','vtiger_tmp_read_user_rel_sharing_per','vtiger_tmp_write_user_rel_sharing_per','vtiger_tmp_read_group_rel_sharing_per','vtiger_tmp_write_group_rel_sharing_per'); + foreach($table_arr as $tabname) + { + $query = "delete from ".$tabname." where userid=?"; + $adb->pquery($query, array($userid)); + } + + // Look up for modules for which sharing access is enabled. + $sharingArray = Array('Emails'); + $otherModules = getSharingModuleList(); + $sharingArray = array_merge($sharingArray, $otherModules); + + foreach($sharingArray as $module) + { + $module_sharing_read_permvar = $module.'_share_read_permission'; + $module_sharing_write_permvar = $module.'_share_write_permission'; + + populateSharingPrivileges('USER',$userid,$module,'read', $$module_sharing_read_permvar ); + populateSharingPrivileges('USER',$userid,$module,'write', $$module_sharing_write_permvar ); + populateSharingPrivileges('GROUP',$userid,$module,'read', $$module_sharing_read_permvar ); + populateSharingPrivileges('GROUP',$userid,$module,'write', $$module_sharing_write_permvar ); + } + //Populating Values into the temp related sharing tables + foreach($related_module_share as $rel_tab_id => $tabid_arr) + { + $rel_tab_name=getTabname($rel_tab_id); + foreach($tabid_arr as $taid) + { + $tab_name=getTabname($taid); + + $relmodule_sharing_read_permvar = $tab_name.'_'.$rel_tab_name.'_share_read_permission'; + $relmodule_sharing_write_permvar = $tab_name.'_'.$rel_tab_name.'_share_write_permission'; + + populateRelatedSharingPrivileges('USER',$userid,$tab_name,$rel_tab_name,'read', $$relmodule_sharing_read_permvar); + populateRelatedSharingPrivileges('USER',$userid,$tab_name,$rel_tab_name,'write', $$relmodule_sharing_write_permvar); + populateRelatedSharingPrivileges('GROUP',$userid,$tab_name,$rel_tab_name,'read', $$relmodule_sharing_read_permvar); + populateRelatedSharingPrivileges('GROUP',$userid,$tab_name,$rel_tab_name,'write', $$relmodule_sharing_write_permvar); + } + } +} + +/** Function to populate the read/wirte Sharing permissions data for the specified user into the database + * @param $userid -- user id:: Type integer + * @param $enttype -- can have the value of User or Group:: Type varchar + * @param $module -- module name:: Type varchar + * @param $pertype -- can have the value of read or write:: Type varchar + * @param $var_name_arr - Variable to use instead of including the sharing access again + */ +function populateSharingPrivileges($enttype,$userid,$module,$pertype, $var_name_arr=false) +{ + global $adb; + $tabid=getTabid($module); + + if(!$var_name_arr) { + require('user_privileges/sharing_privileges_'.$userid.'.php'); + } + + if($enttype=='USER') + { + if($pertype =='read') + { + $table_name='vtiger_tmp_read_user_sharing_per'; + $var_name=$module.'_share_read_permission'; + } + elseif($pertype == 'write') + { + $table_name='vtiger_tmp_write_user_sharing_per'; + $var_name=$module.'_share_write_permission'; + } + // Lookup for the variable if not set through function argument + if(!$var_name_arr) $var_name_arr=$$var_name; + $user_arr=Array(); + if(sizeof($var_name_arr['ROLE']) > 0) + { + foreach($var_name_arr['ROLE'] as $roleid=>$roleusers) + { + + foreach($roleusers as $user_id) + { + if(! in_array($user_id,$user_arr)) + { + $query="insert into ".$table_name." values(?,?,?)"; + $adb->pquery($query, array($userid, $tabid, $user_id)); + $user_arr[]=$user_id; + } + } + } + } + if(sizeof($var_name_arr['GROUP']) > 0) + { + foreach($var_name_arr['GROUP'] as $grpid=>$grpusers) + { + foreach($grpusers as $user_id) + { + if(! in_array($user_id,$user_arr)) + { + $query="insert into ".$table_name." values(?,?,?)"; + $adb->pquery($query, array($userid, $tabid, $user_id)); + $user_arr[]=$user_id; + } + } + } + } + + + } + elseif($enttype=='GROUP') + { + if($pertype =='read') + { + $table_name='vtiger_tmp_read_group_sharing_per'; + $var_name=$module.'_share_read_permission'; + } + elseif($pertype == 'write') + { + $table_name='vtiger_tmp_write_group_sharing_per'; + $var_name=$module.'_share_write_permission'; + } + // Lookup for the variable if not set through function argument + if(!$var_name_arr) $var_name_arr=$$var_name; + $grp_arr=Array(); + if(sizeof($var_name_arr['GROUP']) > 0) + { + + foreach($var_name_arr['GROUP'] as $grpid=>$grpusers) + { + if(! in_array($grpid,$grp_arr)) + { + $query="insert into ".$table_name." values(?,?,?)"; + $adb->pquery($query, array($userid, $tabid, $grpid)); + $grp_arr[]=$grpid; + } + } + } + + } + +} + + +/** Function to populate the read/wirte Sharing permissions related module data for the specified user into the database + * @param $userid -- user id:: Type integer + * @param $enttype -- can have the value of User or Group:: Type varchar + * @param $module -- module name:: Type varchar + * @param $relmodule -- related module name:: Type varchar + * @param $pertype -- can have the value of read or write:: Type varchar + * @param $var_name_arr - Variable to use instead of including the sharing access again + */ + +function populateRelatedSharingPrivileges($enttype,$userid,$module,$relmodule,$pertype, $var_name_arr=false) +{ + global $adb; + $tabid=getTabid($module); + $reltabid=getTabid($relmodule); + + if(!$var_name_arr) { + require('user_privileges/sharing_privileges_'.$userid.'.php'); + } + + if($enttype=='USER') + { + if($pertype =='read') + { + $table_name='vtiger_tmp_read_user_rel_sharing_per'; + $var_name=$module.'_'.$relmodule.'_share_read_permission'; + } + elseif($pertype == 'write') + { + $table_name='vtiger_tmp_write_user_rel_sharing_per'; + $var_name=$module.'_'.$relmodule.'_share_write_permission'; + } + // Lookup for the variable if not set through function argument + if(!$var_name_arr) $var_name_arr=$$var_name; + $user_arr=Array(); + if(sizeof($var_name_arr['ROLE']) > 0) + { + foreach($var_name_arr['ROLE'] as $roleid=>$roleusers) + { + + foreach($roleusers as $user_id) + { + if(! in_array($user_id,$user_arr)) + { + $query="insert into ".$table_name." values(?,?,?,?)"; + $adb->pquery($query, array($userid, $tabid, $reltabid, $user_id)); + $user_arr[]=$user_id; + } + } + } + } + if(sizeof($var_name_arr['GROUP']) > 0) + { + foreach($var_name_arr['GROUP'] as $grpid=>$grpusers) + { + foreach($grpusers as $user_id) + { + if(! in_array($user_id,$user_arr)) + { + $query="insert into ".$table_name." values(?,?,?,?)"; + $adb->pquery($query, array($userid, $tabid, $reltabid, $user_id)); + $user_arr[]=$user_id; + } + } + } + } + + + } + elseif($enttype=='GROUP') + { + if($pertype =='read') + { + $table_name='vtiger_tmp_read_group_rel_sharing_per'; + $var_name=$module.'_'.$relmodule.'_share_read_permission'; + } + elseif($pertype == 'write') + { + $table_name='vtiger_tmp_write_group_rel_sharing_per'; + $var_name=$module.'_'.$relmodule.'_share_write_permission'; + } + // Lookup for the variable if not set through function argument + if(!$var_name_arr) $var_name_arr=$$var_name; + $grp_arr=Array(); + if(sizeof($var_name_arr['GROUP']) > 0) + { + + foreach($var_name_arr['GROUP'] as $grpid=>$grpusers) + { + if(! in_array($grpid,$grp_arr)) + { + $query="insert into ".$table_name." values(?,?,?,?)"; + $adb->pquery($query, array($userid, $tabid, $reltabid, $grpid)); + $grp_arr[]=$grpid; + } + } + } + + } + +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DefaultDataPopulator.php b/oss/vtiger/trunk/modules/Users/DefaultDataPopulator.php new file mode 100644 index 00000000..371c6ace --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DefaultDataPopulator.php @@ -0,0 +1,2547 @@ +log = LoggerManager::getLogger('DefaultDataPopulator'); + $this->db = PearDatabase::getInstance(); + } + + var $new_schema = true; + + /** Function to populate the default required data during installation + */ + function create_tables () { + global $app_strings; + + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (3,'Home',0,1,'Home',0,1,0)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (7,'Leads',0,4,'Leads',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (6,'Accounts',0,5,'Accounts',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (4,'Contacts',0,6,'Contacts',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (2,'Potentials',0,7,'Potentials',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (8,'Documents',0,9,'Documents',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (9,'Calendar',0,3,'Calendar',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (10,'Emails',0,10,'Emails',0,1,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (13,'HelpDesk',0,11,'HelpDesk',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (14,'Products',0,8,'Products',0,1,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (1,'Dashboard',0,12,'Dashboards',0,1,0)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (15,'Faq',0,14,'Faq',0,1,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (16,'Events',2,13,'Events',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (18,'Vendors',0,15,'Vendors',0,1,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (19,'PriceBooks',0,16,'PriceBooks',0,1,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (20,'Quotes',0,17,'Quotes',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (21,'PurchaseOrder',0,18,'PurchaseOrder',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (22,'SalesOrder',0,19,'SalesOrder',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (23,'Invoice',0,20,'Invoice',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (24,'Rss',0,21,'Rss',0,1,0)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (25,'Reports',0,22,'Reports',0,1,0)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (26,'Campaigns',0,23,'Campaigns',0,0,1)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (27,'Portal',0,24,'Portal',0,1,0)"); + $this->db->query("INSERT INTO vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) VALUES (28,'Webmails',0,25,'Webmails',0,1,1)"); + $this->db->query("insert into vtiger_tab(tabid,name,presence,tabsequence,tablabel,customized,ownedby,isentitytype) values (29,'Users',0,26,'Users',0,1,0)"); + + // Populate the vtiger_blocks vtiger_table + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",2,'LBL_OPPORTUNITY_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",2,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",2,'LBL_DESCRIPTION_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",4,'LBL_CONTACT_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",4,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",4,'LBL_CUSTOMER_PORTAL_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",4,'LBL_ADDRESS_INFORMATION',4,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",4,'LBL_DESCRIPTION_INFORMATION',5,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",6,'LBL_ACCOUNT_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",6,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",6,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",6,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",7,'LBL_LEAD_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",7,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",7,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",7,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",8,'LBL_NOTE_INFORMATION',1,0,0,0,0,0,1,0)"); + $fileblockid = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$fileblockid.",8,'LBL_FILE_INFORMATION',3,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",9,'LBL_TASK_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",9,'',2,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",10,'LBL_EMAIL_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",10,'',2,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",10,'',3,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",10,'',4,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",13,'LBL_TICKET_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",13,'',2,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",13,'LBL_CUSTOM_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",13,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",13,'LBL_TICKET_RESOLUTION',5,0,0,1,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",13,'LBL_COMMENTS',6,0,0,1,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",14,'LBL_PRODUCT_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",14,'LBL_PRICING_INFORMATION',2,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",14,'LBL_STOCK_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",14,'LBL_CUSTOM_INFORMATION',4,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",14,'LBL_IMAGE_INFORMATION',5,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",14,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",15,'LBL_FAQ_INFORMATION',1,0,0,0,0,0,1,0)"); + //$this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",15,'',2,1,0,0,0,0,1,0)"); + //$this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",15,'',3,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",15,'LBL_COMMENT_INFORMATION',4,0,0,1,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",16,'LBL_EVENT_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",16,'',2,1,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",16,'',3,1,0,0,0,0,1,0)"); + $vendorbasicinfo = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$vendorbasicinfo.",18,'LBL_VENDOR_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",18,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $vendoraddressblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$vendoraddressblock.",18,'LBL_VENDOR_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)"); + $vendordescriptionblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$vendordescriptionblock.",18,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)"); + $pricebookbasicblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$pricebookbasicblock.",19,'LBL_PRICEBOOK_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",19,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $pricebookdescription = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$pricebookdescription.",19,'LBL_DESCRIPTION_INFORMATION',3,0,0,0,0,0,1,0)"); + $quotesbasicblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$quotesbasicblock.",20,'LBL_QUOTE_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",20,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $quotesaddressblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$quotesaddressblock.",20,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",20,'LBL_RELATED_PRODUCTS',4,0,0,0,0,0,1,0)"); + $quotetermsblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$quotetermsblock.",20,'LBL_TERMS_INFORMATION',5,0,0,0,0,0,1,0)"); + $quotedescription = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$quotedescription.",20,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)"); + $pobasicblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$pobasicblock.",21,'LBL_PO_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",21,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $poaddressblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$poaddressblock.",21,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",21,'LBL_RELATED_PRODUCTS',4,0,0,0,0,0,1,0)"); + $potermsblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$potermsblock.",21,'LBL_TERMS_INFORMATION',5,0,0,0,0,0,1,0)"); + $podescription = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$podescription.",21,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)"); + $sobasicblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$sobasicblock .",22,'LBL_SO_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",22,'LBL_CUSTOM_INFORMATION',3,0,0,0,0,0,1,0)"); + $soaddressblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$soaddressblock.",22,'LBL_ADDRESS_INFORMATION',4,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",22,'LBL_RELATED_PRODUCTS',5,0,0,0,0,0,1,0)"); + $sotermsblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$sotermsblock.",22,'LBL_TERMS_INFORMATION',6,0,0,0,0,0,1,0)"); + $sodescription = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$sodescription.",22,'LBL_DESCRIPTION_INFORMATION',7,0,0,0,0,0,1,0)"); + $invoicebasicblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$invoicebasicblock.",23,'LBL_INVOICE_INFORMATION',1,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",23,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $invoiceaddressblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$invoiceaddressblock.",23,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",23,'LBL_RELATED_PRODUCTS',4,0,0,0,0,0,1,0)"); + $invoicetermsblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$invoicetermsblock.",23,'LBL_TERMS_INFORMATION',5,0,0,0,0,0,1,0)"); + $invoicedescription = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$invoicedescription.",23,'LBL_DESCRIPTION_INFORMATION',6,0,0,0,0,0,1,0)"); + $imageblockid = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$imageblockid.",4,'LBL_IMAGE_INFORMATION',6,0,0,0,0,0,1,0)"); + $campaignbasicblockid = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$campaignbasicblockid.",26,'LBL_CAMPAIGN_INFORMATION',1,0,0,0,0,0,1,0)"); + $campaigncustomblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$campaigncustomblock.",26,'LBL_CUSTOM_INFORMATION',2,0,0,0,0,0,1,0)"); + $campaignexpectedandactualsblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$campaignexpectedandactualsblock.",26,'LBL_EXPECTATIONS_AND_ACTUALS',3,0,0,0,0,0,1,0)"); + $userloginandroleblockid = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$userloginandroleblockid.",29,'LBL_USERLOGIN_ROLE',1,0,0,0,0,0,1,0)"); + $usermoreinfoblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$usermoreinfoblock.",29,'LBL_MORE_INFORMATION',2,0,0,0,0,0,1,0)"); + $useraddressblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$useraddressblock.",29,'LBL_ADDRESS_INFORMATION',3,0,0,0,0,0,1,0)"); + //Added an extra block for new UI Settings in Campaigns module + $campaidndescriptionblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$campaidndescriptionblock.",26,'LBL_DESCRIPTION_INFORMATION',4,0,0,0,0,0,1,0)"); + $userblockid = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$userblockid.",29,'LBL_USER_IMAGE_INFORMATION',4,0,0,0,0,0,1,0)"); //Added a New Block User Image Info in Users Module + $useradvanceblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$useradvanceblock .",29,'LBL_USER_ADV_OPTIONS',5,0,0,0,0,0,1,0)"); //Added a New Block User Image Info in Users Module + //Added block 'File Information' to Documents module + $desc_blockid = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$desc_blockid.",8,'LBL_DESCRIPTION',2,0,0,0,0,0,1,0)"); + //Added block for storing the Recurring Inovice Informaiton in SalesOrder + $sorecurringinvoiceblock = $this->db->getUniqueID('vtiger_blocks'); + $this->db->query("insert into vtiger_blocks values (".$sorecurringinvoiceblock.",22,'Recurring Invoice Information',2,0,0,0,0,0,1,0)"); + //Added to support custom fields for Calendar + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",9,'LBL_CUSTOM_INFORMATION',3,0,0,0,0,0,1,0)"); + $this->db->query("insert into vtiger_blocks values (".$this->db->getUniqueID('vtiger_blocks').",16,'LBL_CUSTOM_INFORMATION',4,0,0,0,0,0,1,0)"); + + //Account Details -- START + //Block9 + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'accountname','vtiger_account',1,'2','accountname','Account Name',1,0,0,100,1,9,1,'V~M',0,1,'BAS',0)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'account_no','vtiger_account',1,'4','account_no','Account No',1,0,0,100,2,9,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'phone','vtiger_account',1,'11','phone','Phone',1,2,0,100,4,9,1,'V~O',2,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'website','vtiger_account',1,'17','website','Website',1,2,0,100,3,9,1,'V~O',2,3,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'fax','vtiger_account',1,'1','fax','Fax',1,2,0,100,6,9,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'tickersymbol','vtiger_account',1,'1','tickersymbol','Ticker Symbol',1,2,0,100,5,9,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'otherphone','vtiger_account',1,'11','otherphone','Other Phone',1,2,0,100,8,9,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'parentid','vtiger_account',1,'51','account_id','Member Of',1,2,0,100,7,9,1,'I~O',1,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'email1','vtiger_account',1,'13','email1','Email',1,2,0,100,10,9,1,'E~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'employees','vtiger_account',1,'7','employees','Employees',1,2,0,100,9,9,1,'I~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'email2','vtiger_account',1,'13','email2','Other Email',1,2,0,100,11,9,1,'E~O',1,null,'ADV',1)"); + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'ownership','vtiger_account',1,'1','ownership','Ownership',1,2,0,100,12,9,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'rating','vtiger_account',1,'15','rating','Rating',1,2,0,100,14,9,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'industry','vtiger_account',1,'15','industry','industry',1,2,0,100,13,9,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'siccode','vtiger_account',1,'1','siccode','SIC Code',1,2,0,100,16,9,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'account_type','vtiger_account',1,'15','accounttype','Type',1,2,0,100,15,9,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'annualrevenue','vtiger_account',1,'71','annual_revenue','Annual Revenue',1,2,0,100,18,9,1,'I~O',1,null,'ADV',1)"); + //Added vtiger_field emailoptout for vtiger_accounts -- after 4.2 patch2 + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'emailoptout','vtiger_account',1,'56','emailoptout','Email Opt Out',1,2,0,100,17,9,1,'C~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'notify_owner','vtiger_account',1,56,'notify_owner','Notify Owner',1,2,0,10,20,9,1,'C~O',1,NULL,'ADV',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,19,9,1,'V~M',0,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,22,9,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,21,9,2,'T~O',3,null,'BAS',0)"); + + //Block 11 + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'bill_street','vtiger_accountbillads',1,'21','bill_street','Billing Address',1,2,0,100,1,11,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'ship_street','vtiger_accountshipads',1,'21','ship_street','Shipping Address',1,2,0,100,2,11,1,'V~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'bill_city','vtiger_accountbillads',1,'1','bill_city','Billing City',1,2,0,100,5,11,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'ship_city','vtiger_accountshipads',1,'1','ship_city','Shipping City',1,2,0,100,6,11,1,'V~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'bill_state','vtiger_accountbillads',1,'1','bill_state','Billing State',1,2,0,100,7,11,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'ship_state','vtiger_accountshipads',1,'1','ship_state','Shipping State',1,2,0,100,8,11,1,'V~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'bill_code','vtiger_accountbillads',1,'1','bill_code','Billing Code',1,2,0,100,9,11,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'ship_code','vtiger_accountshipads',1,'1','ship_code','Shipping Code',1,2,0,100,10,11,1,'V~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'bill_country','vtiger_accountbillads',1,'1','bill_country','Billing Country',1,2,0,100,11,11,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'ship_country','vtiger_accountshipads',1,'1','ship_country','Shipping Country',1,2,0,100,12,11,1,'V~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'bill_pobox','vtiger_accountbillads',1,'1','bill_pobox','Billing Po Box',1,2,0,100,3,11,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'ship_pobox','vtiger_accountshipads',1,'1','ship_pobox','Shipping Po Box',1,2,0,100,4,11,1,'V~O',1,null,'BAS',1)"); + + //Block12 + $this->db->query("insert into vtiger_field values (6,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,12,1,'V~O',1,null,'BAS',1)"); + + //Account Details -- END + + //Lead Details --- START + //Block13 -- Start + + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'salutation','vtiger_leaddetails',1,'55','salutationtype','Salutation',1,0,0,100,1,13,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'firstname','vtiger_leaddetails',1,'55','firstname','First Name',1,2,0,100,2,13,1,'V~O',2,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'lead_no','vtiger_leaddetails',1,'4','lead_no','Lead No',1,0,0,100,3,13,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'phone','vtiger_leadaddress',1,'11','phone','Phone',1,2,0,100,5,13,1,'V~O',2,4,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'lastname','vtiger_leaddetails',1,'255','lastname','Last Name',1,0,0,100,4,13,1,'V~M',0,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'mobile','vtiger_leadaddress',1,'1','mobile','Mobile',1,2,0,100,7,13,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'company','vtiger_leaddetails',1,'2','company','Company',1,2,0,100,6,13,1,'V~M',2,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'fax','vtiger_leadaddress',1,'1','fax','Fax',1,2,0,100,9,13,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'designation','vtiger_leaddetails',1,'1','designation','Designation',1,2,0,100,8,13,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'email','vtiger_leaddetails',1,'13','email','Email',1,2,0,100,11,13,1,'E~O',2,5,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'leadsource','vtiger_leaddetails',1,'15','leadsource','Lead Source',1,2,0,100,10,13,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'website','vtiger_leadsubdetails',1,'17','website','Website',1,2,0,100,13,13,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'industry','vtiger_leaddetails',1,'15','industry','Industry',1,2,0,100,12,13,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'leadstatus','vtiger_leaddetails',1,'15','leadstatus','Lead Status',1,2,0,100,15,13,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'annualrevenue','vtiger_leaddetails',1,'71','annualrevenue','Annual Revenue',1,2,0,100,14,13,1,'I~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'rating','vtiger_leaddetails',1,'15','rating','Rating',1,2,0,100,17,13,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'noofemployees','vtiger_leaddetails',1,'1','noofemployees','No Of Employees',1,2,0,100,16,13,1,'I~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,19,13,1,'V~M',0,6,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'yahooid','vtiger_leaddetails',1,'13','yahooid','Yahoo Id',1,2,0,100,18,13,1,'E~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,21,13,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,20,13,2,'T~O',3,null,'BAS',0)"); + //Block13 -- End + + //Block15 -- Start + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'lane','vtiger_leadaddress',1,'21','lane','Street',1,2,0,100,1,15,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'code','vtiger_leadaddress',1,'1','code','Postal Code',1,2,0,100,3,15,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'city','vtiger_leadaddress',1,'1','city','City',1,2,0,100,4,15,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'country','vtiger_leadaddress',1,'1','country','Country',1,2,0,100,5,15,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'state','vtiger_leadaddress',1,'1','state','State',1,2,0,100,6,15,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'pobox','vtiger_leadaddress',1,'1','pobox','Po Box',1,2,0,100,2,15,1,'V~O',1,null,'BAS',1)"); + //Block15 --End + + //Block16 -- Start + $this->db->query("insert into vtiger_field values (7,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,16,1,'V~O',1,null,'BAS',1)"); + //Block16 -- End + + //Lead Details -- END + + //Contact Details -- START + //Block4 -- Start + + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'salutation','vtiger_contactdetails',1,'55','salutationtype','Salutation',1,0,0,100,1,4,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'firstname','vtiger_contactdetails',1,'55','firstname','First Name',1,2,0,100,2,4,1,'V~O',2,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'contact_no','vtiger_contactdetails',1,'4','contact_no','Contact Id',1,0,0,100,3,4,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'phone','vtiger_contactdetails',1,'11','phone','Office Phone',1,2,0,100,5,4,1,'V~O',2,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'lastname','vtiger_contactdetails',1,'255','lastname','Last Name',1,0,0,100,4,4,1,'V~M',0,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'mobile','vtiger_contactdetails',1,'1','mobile','Mobile',1,2,0,100,7,4,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'accountid','vtiger_contactdetails',1,'51','account_id','Account Name',1,0,0,100,6,4,1,'I~O',2,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'homephone','vtiger_contactsubdetails',1,'11','homephone','Home Phone',1,2,0,100,9,4,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'leadsource','vtiger_contactsubdetails',1,'15','leadsource','Lead Source',1,2,0,100,8,4,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'otherphone','vtiger_contactsubdetails',1,'11','otherphone','Other Phone',1,2,0,100,11,4,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'title','vtiger_contactdetails',1,'1','title','Title',1,2,0,100,10,4,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'fax','vtiger_contactdetails',1,'1','fax','Fax',1,2,0,100,13,4,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'department','vtiger_contactdetails',1,'1','department','Department',1,2,0,100,12,4,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'birthday','vtiger_contactsubdetails',1,'5','birthday','Birthdate',1,2,0,100,16,4,1,'D~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'email','vtiger_contactdetails',1,'13','email','Email',1,2,0,100,15,4,1,'E~O',2,5,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'reportsto','vtiger_contactdetails',1,'57','contact_id','Reports To',1,2,0,100,18,4,1,'V~O',1,null,'ADV',0)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'assistant','vtiger_contactsubdetails',1,'1','assistant','Assistant',1,2,0,100,17,4,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'yahooid','vtiger_contactdetails',1,'13','yahooid','Yahoo Id',1,2,0,100,20,4,1,'E~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'assistantphone','vtiger_contactsubdetails',1,'11','assistantphone','Assistant Phone',1,2,0,100,19,4,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'donotcall','vtiger_contactdetails',1,'56','donotcall','Do Not Call',1,2,0,100,22,4,1,'C~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'emailoptout','vtiger_contactdetails',1,'56','emailoptout','Email Opt Out',1,2,0,100,21,4,1,'C~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,24,4,1,'V~M',0,6,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'reference','vtiger_contactdetails',1,'56','reference','Reference',1,2,0,10,23,4,1,'C~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'notify_owner','vtiger_contactdetails',1,'56','notify_owner','Notify Owner',1,2,0,10,26,4,1,'C~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,25,4,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,27,4,2,'T~O',3,null,'BAS',0)"); + //Block4 -- End + + //Block6 - Begin Customer Portal + + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'portal','vtiger_customerdetails',1,'56','portal','Portal User',1,2,0,100,1,6,1,'C~O',1,null,'ADV',0)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'support_start_date','vtiger_customerdetails',1,'5','support_start_date','Support Start Date',1,2,0,100,2,6,1,'D~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'support_end_date','vtiger_customerdetails',1,'5','support_end_date','Support End Date',1,2,0,100,3,6,1,'D~O~OTH~GE~support_start_date~Support Start Date',1,null,'ADV',1)"); + + //Block6 - End Customer Portal + + //Block 7 -- Start + + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'mailingstreet','vtiger_contactaddress',1,'21','mailingstreet','Mailing Street',1,2,0,100,1,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'otherstreet','vtiger_contactaddress',1,'21','otherstreet','Other Street',1,2,0,100,2,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'mailingcity','vtiger_contactaddress',1,'1','mailingcity','Mailing City',1,2,0,100,5,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'othercity','vtiger_contactaddress',1,'1','othercity','Other City',1,2,0,100,6,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'mailingstate','vtiger_contactaddress',1,'1','mailingstate','Mailing State',1,2,0,100,7,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'otherstate','vtiger_contactaddress',1,'1','otherstate','Other State',1,2,0,100,8,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'mailingzip','vtiger_contactaddress',1,'1','mailingzip','Mailing Zip',1,2,0,100,9,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'otherzip','vtiger_contactaddress',1,'1','otherzip','Other Zip',1,2,0,100,10,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'mailingcountry','vtiger_contactaddress',1,'1','mailingcountry','Mailing Country',1,2,0,100,11,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'othercountry','vtiger_contactaddress',1,'1','othercountry','Other Country',1,2,0,100,12,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'mailingpobox','vtiger_contactaddress',1,'1','mailingpobox','Mailing Po Box',1,2,0,100,3,7,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'otherpobox','vtiger_contactaddress',1,'1','otherpobox','Other Po Box',1,2,0,100,4,7,1,'V~O',1,null,'BAS',1)"); + //Block7 -- End + + //ContactImageInformation + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'imagename','vtiger_contactdetails',1,'69','imagename','Contact Image',1,2,0,100,1,$imageblockid,1,'V~O',3,null,'ADV',0)"); + + + //Block8 -- Start + $this->db->query("insert into vtiger_field values (4,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,8,1,'V~O',1,null,'BAS',1)"); + //Block8 -- End + //Contact Details -- END + + //Potential Details -- START + //Block1 -- Start + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'potentialname','vtiger_potential',1,'2','potentialname','Potential Name',1,0,0,100,1,1,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'potential_no','vtiger_potential',1,'4','potential_no','Potential No',1,0,0,100,2,1,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'amount','vtiger_potential',1,71,'amount','Amount',1,2,0,100,4,1,1,'N~O',2,5,'BAS',1)"); + //changed for b2c model + $fieldid = $this->db->getUniqueID("vtiger_field"); + $this->db->query("insert into vtiger_field values (2,$fieldid,'related_to','vtiger_potential',1,'10','related_to','Related To',1,0,0,100,3,1,1,'V~M',0,2,'BAS',1)"); + $this->db->query("insert into vtiger_fieldmodulerel (fieldid, module, relmodule, status, sequence) values ($fieldid, 'Potentials', 'Accounts', NULL, 0), ($fieldid, 'Potentials', 'Contacts', NULL, 1)"); + //b2c model changes end + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'closingdate','vtiger_potential',1,'23','closingdate','Expected Close Date',1,2,0,100,7,1,1,'D~M',2,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'potentialtype','vtiger_potential',1,'15','opportunity_type','Type',1,2,0,100,6,1,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'nextstep','vtiger_potential',1,'1','nextstep','Next Step',1,2,0,100,9,1,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'leadsource','vtiger_potential',1,'15','leadsource','Lead Source',1,2,0,100,8,1,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'sales_stage','vtiger_potential',1,'15','sales_stage','Sales Stage',1,2,0,100,11,1,1,'V~M',2,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,2,0,100,10,1,1,'V~M',0,6,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'probability','vtiger_potential',1,'9','probability','Probability',1,2,0,100,13,1,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'campaignid','vtiger_potential',1,'58','campaignid','Campaign Source',1,2,0,100,12,1,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,15,1,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,14,1,2,'T~O',3,null,'BAS',0)"); + + //Block1 -- End + + //Block3 -- Start + $this->db->query("insert into vtiger_field values (2,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,3,1,'V~O',1,null,'BAS',1)"); + //Block3 -- End + //Potential Details -- END + + //campaign entries being added + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'campaignname','vtiger_campaign',1,'2','campaignname','Campaign Name',1,0,0,100,1,$campaignbasicblockid,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'campaign_no','vtiger_campaign',1,'4','campaign_no','Campaign No',1,0,0,100,2,$campaignbasicblockid,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'campaigntype','vtiger_campaign',1,15,'campaigntype','Campaign Type',1,2,0,100,5,$campaignbasicblockid,1,'V~O',2,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'product_id','vtiger_campaign',1,59,'product_id','Product',1,2,0,100,6,$campaignbasicblockid,1,'I~O',2,5,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'campaignstatus','vtiger_campaign',1,15,'campaignstatus','Campaign Status',1,2,0,100,4,$campaignbasicblockid,1,'V~O',2,6,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'closingdate','vtiger_campaign',1,'23','closingdate','Expected Close Date',1,2,0,100,8,$campaignbasicblockid,1,'D~M',2,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,3,$campaignbasicblockid,1,'V~M',0,7,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'numsent','vtiger_campaign',1,'9','numsent','Num Sent',1,2,0,100,12,$campaignbasicblockid,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'sponsor','vtiger_campaign',1,'1','sponsor','Sponsor',1,2,0,100,9,$campaignbasicblockid,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'targetaudience','vtiger_campaign',1,'1','targetaudience','Target Audience',1,2,0,100,7,$campaignbasicblockid,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(26,".$this->db->getUniqueID("vtiger_field").",'targetsize','vtiger_campaign',1,'1','targetsize','TargetSize',1,2,0,100,10,$campaignbasicblockid,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,11,$campaignbasicblockid,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,13,$campaignbasicblockid,2,'T~O',3,null,'BAS',0)"); + + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'expectedresponse','vtiger_campaign',1,'15','expectedresponse','Expected Response',1,2,0,100,3,$campaignexpectedandactualsblock,1,'V~O',2,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'expectedrevenue','vtiger_campaign',1,'1','expectedrevenue','Expected Revenue',1,2,0,100,4,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'budgetcost','vtiger_campaign',1,'1','budgetcost','Budget Cost',1,2,0,100,1,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'actualcost','vtiger_campaign',1,'1','actualcost','Actual Cost',1,2,0,100,2,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(26,".$this->db->getUniqueID("vtiger_field").",'expectedresponsecount','vtiger_campaign',1,'1','expectedresponsecount','Expected Response Count',1,2,0,100,7,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(26,".$this->db->getUniqueID("vtiger_field").",'expectedsalescount','vtiger_campaign',1,'1','expectedsalescount','Expected Sales Count',1,2,0,100,5,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(26,".$this->db->getUniqueID("vtiger_field").",'expectedroi','vtiger_campaign',1,'1','expectedroi','Expected ROI',1,2,0,100,9,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(26,".$this->db->getUniqueID("vtiger_field").",'actualresponsecount','vtiger_campaign',1,'1','actualresponsecount','Actual Response Count',1,2,0,100,8,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(26,".$this->db->getUniqueID("vtiger_field").",'actualsalescount','vtiger_campaign',1,'1','actualsalescount','Actual Sales Count',1,2,0,100,6,$campaignexpectedandactualsblock,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(26,".$this->db->getUniqueID("vtiger_field").",'actualroi','vtiger_campaign',1,'1','actualroi','Actual ROI',1,2,0,100,10,$campaignexpectedandactualsblock,1,'N~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (26,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,$campaidndescriptionblock,1,'V~O',1,null,'BAS',1)"); + + //entry to vtiger_field to maintain account,contact,lead relationships + + $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, selected, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (".getTabid('Contacts').",".$this->db->getUniqueID('vtiger_field').", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)"); + $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, selected, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (".getTabid('Accounts').",".$this->db->getUniqueID('vtiger_field').", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)"); + $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, selected, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (".getTabid('Leads').",".$this->db->getUniqueID('vtiger_field').", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)"); + $this->db->query("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, selected, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable) VALUES (".getTabid('Campaigns').",".$this->db->getUniqueID('vtiger_field').", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0)"); + //Campaign entries end + + //Ticket Details -- START + //Block25 -- Start + + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'ticket_no','vtiger_troubletickets',1,'4','ticket_no','Ticket No',1,0,0,100,13,25,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,4,25,1,'V~M',0,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'parent_id','vtiger_troubletickets',1,'68','parent_id','Related To',1,0,0,100,2,25,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'priority','vtiger_troubletickets',1,'15','ticketpriorities','Priority',1,2,0,100,6,25,1,'V~O',2,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'product_id','vtiger_troubletickets',1,'59','product_id','Product Name',1,2,0,100,5,25,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'severity','vtiger_troubletickets',1,'15','ticketseverities','Severity',1,2,0,100,8,25,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'status','vtiger_troubletickets',1,'15','ticketstatus','Status',1,2,0,100,7,25,1,'V~M',1,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'category','vtiger_troubletickets',1,'15','ticketcategories','Category',1,2,0,100,10,25,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'update_log','vtiger_troubletickets',1,'19','update_log','Update History',1,0,0,100,11,25,3,'V~O',1,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'hours','vtiger_troubletickets',1,'1','hours','Hours',1,2,0,100,9,25,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'days','vtiger_troubletickets',1,'1','days','Days',1,2,0,100,10,25,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,9,25,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,12,25,2,'T~O',3,null,'BAS',0)"); + + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'title','vtiger_troubletickets',1,'22','ticket_title','Title',1,0,0,100,1,25,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,28,1,'V~O',2,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'solution','vtiger_troubletickets',1,'19','solution','Solution',1,0,0,100,1,29,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (13,".$this->db->getUniqueID("vtiger_field").",'comments','vtiger_ticketcomments',1,'19','comments','Add Comment',1,0,0,100,1,30,1,'V~O',3,null,'BAS',0)"); + + //Block25-30 -- End + //Ticket Details -- END + + //Product Details -- START + //Block31-36 -- Start + + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'productname','vtiger_products',1,'2','productname','Product Name',1,0,0,100,1,31,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'product_no','vtiger_products',1,'4','product_no','Product No',1,0,0,100,2,31,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'productcode','vtiger_products',1,'1','productcode','Part Number',1,2,0,100,4,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'discontinued','vtiger_products',1,'56','discontinued','Product Active',1,2,0,100,3,31,1,'V~O',2,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'manufacturer','vtiger_products',1,'15','manufacturer','Manufacturer',1,2,0,100,6,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'productcategory','vtiger_products',1,'15','productcategory','Product Category',1,2,0,100,6,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'sales_start_date','vtiger_products',1,'5','sales_start_date','Sales Start Date',1,2,0,100,5,31,1,'D~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'sales_end_date','vtiger_products',1,'5','sales_end_date','Sales End Date',1,2,0,100,8,31,1,'D~O~OTH~GE~sales_start_date~Sales Start Date',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'start_date','vtiger_products',1,'5','start_date','Support Start Date',1,2,0,100,7,31,1,'D~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'expiry_date','vtiger_products',1,'5','expiry_date','Support Expiry Date',1,2,0,100,10,31,1,'D~O~OTH~GE~start_date~Start Date',1,null,'BAS',1)"); + + + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'website','vtiger_products',1,'17','website','Website',1,2,0,100,14,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'vendor_id','vtiger_products',1,'75','vendor_id','Vendor Name',1,2,0,100,13,31,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'mfr_part_no','vtiger_products',1,'1','mfr_part_no','Mfr PartNo',1,2,0,100,16,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'vendor_part_no','vtiger_products',1,'1','vendor_part_no','Vendor PartNo',1,2,0,100,15,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'serialno','vtiger_products',1,'1','serial_no','Serial No',1,2,0,100,18,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'productsheet','vtiger_products',1,'1','productsheet','Product Sheet',1,2,0,100,17,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'glacct','vtiger_products',1,'15','glacct','GL Account',1,2,0,100,20,31,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,19,31,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,21,31,2,'T~O',3,null,'BAS',0)"); + + + //Block32 Pricing Information + + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'unit_price','vtiger_products',1,'71','unit_price','Unit Price',1,2,0,100,1,32,1,'N~O',2,3,'BAS',0)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'commissionrate','vtiger_products',1,'9','commissionrate','Commission Rate',1,2,0,100,2,32,1,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'taxclass','vtiger_products',1,'83','taxclass','Tax Class',1,2,0,100,4,32,1,'V~O',3,null,'BAS',1)"); + + + //Block 33 stock info + + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'usageunit','vtiger_products',1,'15','usageunit','Usage Unit',1,2,0,100,1,33,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'qty_per_unit','vtiger_products',1,'1','qty_per_unit','Qty/Unit',1,2,0,100,2,33,1,'N~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'qtyinstock','vtiger_products',1,'1','qtyinstock','Qty In Stock',1,2,0,100,3,33,1,'NN~O',0,4,'ADV',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'reorderlevel','vtiger_products',1,'1','reorderlevel','Reorder Level',1,2,0,100,4,33,1,'I~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'handler','vtiger_products',1,'52','assigned_user_id','Handler',1,0,0,100,5,33,1,'I~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'qtyindemand','vtiger_products',1,'1','qtyindemand','Qty In Demand',1,2,0,100,6,33,1,'I~O',1,null,'ADV',1)"); + + //ProductImageInformation + + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'imagename','vtiger_products',1,'69','imagename','Product Image',1,2,0,100,1,35,1,'V~O',3,null,'ADV',1)"); + + //Block 36 Description Info + $this->db->query("insert into vtiger_field values (14,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,36,1,'V~O',1,null,'BAS',1)"); + + //Product Details -- END + + //Documents Details -- START + //Block17 -- Start + + $this->db->query("insert into vtiger_field values (8,".$this->db->getUniqueID("vtiger_field").",'title','vtiger_notes',1,'2','notes_title','Title',1,0,0,100,1,17,1,'V~M',0,1,'BAS',0)"); + $this->db->query("insert into vtiger_field values (8,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,5,17,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (8,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,6,17,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (8,".$this->db->getUniqueID("vtiger_field").",'filename','vtiger_notes',1,'28','filename','File Name',1,2,0,100,3,".$fileblockid.",1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (8,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,4,17,1,'V~M',0,3,'BAS',0)"); + $this->db->query("insert into vtiger_field values (8,".$this->db->getUniqueID("vtiger_field").",'notecontent','vtiger_notes',1,'19','notecontent','Note',1,2,0,100,1,$desc_blockid,1,'V~O',1,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values(8,".$this->db->getUniqueID("vtiger_field").",'filetype','vtiger_notes',1,1,'filetype','File Type',1,2,0,100,5,".$fileblockid.",2,'V~O',3,'','BAS',0)"); + $this->db->query("insert into vtiger_field values(8,".$this->db->getUniqueID("vtiger_field").",'filesize','vtiger_notes',1,1,'filesize','File Size',1,2,0,100,4,".$fileblockid.",2,'I~O',3,'','BAS',0)"); + $this->db->query("insert into vtiger_field values(8,".$this->db->getUniqueID("vtiger_field").",'filelocationtype','vtiger_notes',1,27,'filelocationtype','Download Type',1,0,0,100,1,".$fileblockid.",1,'V~O',3,'','BAS',0)"); + $this->db->query("insert into vtiger_field values(8,".$this->db->getUniqueID("vtiger_field").",'fileversion','vtiger_notes',1,1,'fileversion','Version',1,2,0,100,6,$fileblockid,1,'V~O',1,'','BAS',0)"); + $this->db->query("insert into vtiger_field values(8,".$this->db->getUniqueID("vtiger_field").",'filestatus','vtiger_notes',1,56,'filestatus','Active',1,2,0,100,2,".$fileblockid.",1,'V~O',1,'','BAS',0)"); + $this->db->query("insert into vtiger_field values(8,".$this->db->getUniqueID("vtiger_field").",'filedownloadcount','vtiger_notes',1,1,'filedownloadcount','Download Count',1,2,0,100,7,".$fileblockid.",2,'I~O',3,'','BAS',0)"); + $this->db->query("insert into vtiger_field values(8,".$this->db->getUniqueID("vtiger_field").",'folderid','vtiger_notes',1,26,'folderid','Folder Name',1,2,0,100,2,17,1,'V~O',2,2,'BAS',0)"); + + $this->db->query("insert into vtiger_field values (8,".$this->db->getUniqueID("vtiger_field").",'note_no','vtiger_notes',1,'4','note_no','Document No',1,0,0,100,3,17,1,'V~O',3,null,'BAS',0)"); + + //Block17 -- End + //Documents Details -- END + + //Email Details -- START + //Block21 -- Start + + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'date_start','vtiger_activity',1,'6','date_start','Date & Time Sent',1,0,0,100,1,21,1,'DT~M~time_start~Time Start',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'semodule','vtiger_activity',1,'2','parent_type','Sales Enity Module',1,0,0,100,2,21,3,'',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'activitytype','vtiger_activity',1,'2','activitytype','Activtiy Type',1,0,0,100,3,21,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,5,21,1,'V~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'subject','vtiger_activity',1,'2','subject','Subject',1,0,0,100,1,23,1,'V~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'name','vtiger_attachments',1,'61','filename','Attachment',1,0,0,100,2,23,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,0,0,100,1,24,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'time_start','vtiger_activity',1,'2','time_start','Time Start',1,0,0,100,9,23,1,'T~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,10,22,1,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (10,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,11,21,2,'T~O',3,null,'BAS',0)"); + $this->db->query("INSERT INTO vtiger_field VALUES (10,".$this->db->getUniqueID("vtiger_field").", 'access_count', 'vtiger_email_track', '1', '25', 'access_count', 'Access Count', '1', '0', '0', '100', '6', '21', '3', 'V~O', '1', NULL, 'BAS', 0)"); + + //Block21 -- End + //Email Details -- END + + //Task Details --START + //Block19 -- Start + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'subject','vtiger_activity',1,'2','subject','Subject',1,0,0,100,1,19,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,2,19,1,'V~M',0,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'date_start','vtiger_activity',1,'6','date_start','Start Date & Time',1,0,0,100,3,19,1,'DT~M~time_start',0,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'time_start','vtiger_activity',1,'2','time_start','Time Start',1,0,0,100,4,19,3,'T~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'time_end','vtiger_activity',1,'2','time_end','End Time',1,0,0,100,4,19,3,'T~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'due_date','vtiger_activity',1,'23','due_date','Due Date',1,0,0,100,5,19,1,'D~M~OTH~GE~date_start~Start Date & Time',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'crmid','vtiger_seactivityrel',1,'66','parent_id','Related To',1,0,0,100,7,19,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'contactid','vtiger_cntactivityrel',1,'57','contact_id','Contact Name',1,0,0,100,8,19,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'status','vtiger_activity',1,'15','taskstatus','Status',1,0,0,100,8,19,1,'V~M',0,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'eventstatus','vtiger_activity',1,'15','eventstatus','Status',1,0,0,100,9,19,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'priority','vtiger_activity',1,'15','taskpriority','Priority',1,0,0,100,10,19,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'sendnotification','vtiger_activity',1,'56','sendnotification','Send Notification',1,0,0,100,11,19,1,'C~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,14,19,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,15,19,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'activitytype','vtiger_activity',1,'15','activitytype','Activity Type',1,0,0,100,16,19,3,'V~O',1,null,'BAS',1)"); + $this->db->query("Insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'visibility','vtiger_activity',1,'16','visibility','Visibility',1,0,0,100,17,19,3,'V~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,0,0,100,1,20,1,'V~O',1,null,'BAS',1)"); + + + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'duration_hours','vtiger_activity',1,'63','duration_hours','Duration',1,0,0,100,17,19,3,'T~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'duration_minutes','vtiger_activity',1,'16','duration_minutes','Duration Minutes',1,0,0,100,18,19,3,'T~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'location','vtiger_activity',1,'1','location','Location',1,0,0,100,19,19,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'reminder_time','vtiger_activity_reminder',1,'30','reminder_time','Send Reminder',1,0,0,100,1,19,3,'I~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'recurringtype','vtiger_activity',1,'16','recurringtype','Recurrence',1,0,0,100,6,19,3,'O~O',1,null,'BAS',1)"); + + $this->db->query("Insert into vtiger_field values (9,".$this->db->getUniqueID("vtiger_field").",'notime','vtiger_activity',1,56,'notime','No Time',1,0,0,100,20,19,3,'C~O',1,null,'BAS',1)"); + //Block19 -- End + //Task Details -- END + + //Event Details --START + //Block41-43-- Start + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'subject','vtiger_activity',1,'2','subject','Subject',1,0,0,100,1,41,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,2,41,1,'V~M',0,6,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'date_start','vtiger_activity',1,'6','date_start','Start Date & Time',1,0,0,100,3,41,1,'DT~M~time_start',0,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'time_start','vtiger_activity',1,'2','time_start','Time Start',1,0,0,100,4,41,3,'T~M',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'due_date','vtiger_activity',1,'23','due_date','End Date',1,0,0,100,5,41,1,'D~M~OTH~GE~date_start~Start Date & Time',0,5,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'time_end','vtiger_activity',1,'2','time_end','End Time',1,0,0,100,5,41,3,'T~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'recurringtype','vtiger_activity',1,'16','recurringtype','Recurrence',1,0,0,100,6,41,1,'O~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'duration_hours','vtiger_activity',1,'63','duration_hours','Duration',1,0,0,100,7,41,1,'I~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'duration_minutes','vtiger_activity',1,'16','duration_minutes','Duration Minutes',1,0,0,100,8,41,3,'O~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'crmid','vtiger_seactivityrel',1,'66','parent_id','Related To',1,0,0,100,9,41,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'eventstatus','vtiger_activity',1,'15','eventstatus','Status',1,0,0,100,10,41,1,'V~M',0,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'sendnotification','vtiger_activity',1,'56','sendnotification','Send Notification',1,0,0,100,11,41,1,'C~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'activitytype','vtiger_activity',1,'15','activitytype','Activity Type',1,0,0,100,12,41,1,'V~M',0,4,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'location','vtiger_activity',1,'1','location','Location',1,0,0,100,13,41,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,14,41,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,15,41,2,'T~O',3,null,'BAS',0)"); + $this->db->query("Insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'priority','vtiger_activity',1,15,'taskpriority','Priority',1,0,0,100,16,41,1,'V~O',1,null,'BAS',1)"); + $this->db->query("Insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'notime','vtiger_activity',1,56,'notime','No Time',1,0,0,100,17,41,1,'C~O',1,null,'BAS',1)"); + $this->db->query("Insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'visibility','vtiger_activity',1,'16','visibility','Visibility',1,0,0,100,18,41,1,'V~O',1,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,0,0,100,1,41,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'reminder_time','vtiger_activity_reminder',1,'30','reminder_time','Send Reminder',1,0,0,100,1,40,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (16,".$this->db->getUniqueID("vtiger_field").",'contactid','vtiger_cntactivityrel',1,'57','contact_id','Contact Name',1,0,0,100,1,19,1,'I~O',1,null,'BAS',1)"); + + //Block41-43 -- End + //Event Details -- END + + //Faq Details -- START + //Block37-40 -- Start + + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'product_id','vtiger_faq',1,'59','product_id','Product Name',1,2,0,100,1,37,1,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'faq_no','vtiger_faq',1,'4','faq_no','Faq No',1,0,0,100,2,37,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'category','vtiger_faq',1,'15','faqcategories','Category',1,2,0,100,4,37,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'status','vtiger_faq',1,'15','faqstatus','Status',1,2,0,100,3,37,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'question','vtiger_faq',1,'20','question','Question',1,2,0,100,7,37,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'answer','vtiger_faq',1,'20','faq_answer','Answer',1,2,0,100,8,37,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'comments','vtiger_faqcomments',1,'19','comments','Add Comment',1,0,0,100,1,38,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,5,37,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (15,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,6,37,2,'T~O',3,null,'BAS',0)"); + + + //Block37-40 -- End + //Ticket Details -- END + + //Vendor Details --START + //Block44-47 + + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'vendorname','vtiger_vendor',1,'2','vendorname','Vendor Name',1,0,0,100,1,$vendorbasicinfo,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'vendor_no','vtiger_vendor',1,'4','vendor_no','Vendor No',1,0,0,100,2,$vendorbasicinfo,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'phone','vtiger_vendor',1,'1','phone','Phone',1,2,0,100,4,$vendorbasicinfo,1,'V~O',2,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'email','vtiger_vendor',1,'13','email','Email',1,2,0,100,3,$vendorbasicinfo,1,'E~O',2,3,'BAS',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'website','vtiger_vendor',1,'17','website','Website',1,2,0,100,6,$vendorbasicinfo,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'glacct','vtiger_vendor',1,'15','glacct','GL Account',1,2,0,100,5,$vendorbasicinfo,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'category','vtiger_vendor',1,'1','category','Category',1,2,0,100,8,$vendorbasicinfo,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,7,$vendorbasicinfo,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,9,$vendorbasicinfo,2,'T~O',3,null,'BAS',0)"); + + //Block 46 + + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'street','vtiger_vendor',1,'21','street','Street',1,2,0,100,1,$vendoraddressblock,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'pobox','vtiger_vendor',1,'1','pobox','Po Box',1,2,0,100,2,$vendoraddressblock,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'city','vtiger_vendor',1,'1','city','City',1,2,0,100,3,$vendoraddressblock,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'state','vtiger_vendor',1,'1','state','State',1,2,0,100,4,$vendoraddressblock,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'postalcode','vtiger_vendor',1,'1','postalcode','Postal Code',1,2,0,100,5,$vendoraddressblock,1,'V~O',1,null,'ADV',1)"); + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'country','vtiger_vendor',1,'1','country','Country',1,2,0,100,6,$vendoraddressblock,1,'V~O',1,null,'ADV',1)"); + + //Block 47 + + $this->db->query("insert into vtiger_field values (18,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,$vendordescriptionblock,1,'V~O',1,null,'ADV',1)"); + + //Vendor Details -- END + + //PriceBook Details Start + //Block48 + + $this->db->query("insert into vtiger_field values (19,".$this->db->getUniqueID("vtiger_field").",'bookname','vtiger_pricebook',1,'2','bookname','Price Book Name',1,0,0,100,1,$pricebookbasicblock,1,'V~M',0,1,'BAS',1)"); + $this->db->query("insert into vtiger_field values (19,".$this->db->getUniqueID("vtiger_field").",'pricebook_no','vtiger_pricebook',1,'4','pricebook_no','PriceBook No',1,0,0,100,3,$pricebookbasicblock,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (19,".$this->db->getUniqueID("vtiger_field").",'active','vtiger_pricebook',1,'56','active','Active',1,2,0,100,2,$pricebookbasicblock,1,'C~O',2,2,'BAS',1)"); + $this->db->query("insert into vtiger_field values (19,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,4,$pricebookbasicblock,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (19,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,5,$pricebookbasicblock,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (19,".$this->db->getUniqueID("vtiger_field").",'currency_id','vtiger_pricebook',1,'117','currency_id','Currency',1,0,0,100,5,$pricebookbasicblock,1,'I~M',0,3,'BAS',0)"); + //Block50 + + $this->db->query("insert into vtiger_field values (19,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,$pricebookdescription,1,'V~O',1,null,'BAS',1)"); + + //PriceBook Details End + + + //Quote Details -- START + //Block51 + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'quote_no','vtiger_quotes',1,'4','quote_no','Quote No',1,0,0,100,3,$quotesbasicblock,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'subject','vtiger_quotes',1,'2','subject','Subject',1,0,0,100,1,$quotesbasicblock,1,'V~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'potentialid','vtiger_quotes',1,'76','potential_id','Potential Name',1,2,0,100,2,$quotesbasicblock,1,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'quotestage','vtiger_quotes',1,'15','quotestage','Quote Stage',1,2,0,100,4,$quotesbasicblock,1,'V~M',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'validtill','vtiger_quotes',1,'5','validtill','Valid Till',1,2,0,100,5,$quotesbasicblock,1,'D~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'contactid','vtiger_quotes',1,'57','contact_id','Contact Name',1,2,0,100,6,$quotesbasicblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'carrier','vtiger_quotes',1,'15','carrier','Carrier',1,2,0,100,8,$quotesbasicblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'subtotal','vtiger_quotes',1,'1','hdnSubTotal','Sub Total',1,2,0,100,9,$quotesbasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'shipping','vtiger_quotes',1,'1','shipping','Shipping',1,2,0,100,10,$quotesbasicblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'inventorymanager','vtiger_quotes',1,'77','assigned_user_id1','Inventory Manager',1,2,0,100,11,$quotesbasicblock,1,'I~O',3,null,'BAS',1)"); + //$this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'tax','vtiger_quotes',1,'1','txtTax','Sales Tax',1,0,0,100,13,51,3,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'adjustment','vtiger_quotes',1,'1','txtAdjustment','Adjustment',1,2,0,100,20,$quotesbasicblock,3,'NN~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'total','vtiger_quotes',1,'1','hdnGrandTotal','Total',1,2,0,100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)"); + //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'taxtype','vtiger_quotes',1,'16','hdnTaxType','Tax Type',1,2,0,100,14,$quotesbasicblock,3,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'discount_percent','vtiger_quotes',1,'1','hdnDiscountPercent','Discount Percent',1,2,0,100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'discount_amount','vtiger_quotes',1,'1','hdnDiscountAmount','Discount Amount',1,2,0,100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'s_h_amount','vtiger_quotes',1,'1','hdnS_H_Amount','S&H Amount',1,2,0,100,14,$quotesbasicblock,3,'N~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'accountid','vtiger_quotes',1,'73','account_id','Account Name',1,2,0,100,16,$quotesbasicblock,1,'I~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,17,$quotesbasicblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,18,$quotesbasicblock,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,19,$quotesbasicblock,2,'T~O',3,null,'BAS',0)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'currency_id','vtiger_quotes',1,'117','currency_id','Currency',1,2,1,100,20,$quotesbasicblock,3,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'conversion_rate','vtiger_quotes',1,'1','conversion_rate','Conversion Rate',1,2,1,100,21,$quotesbasicblock,3,'N~O',3,null,'BAS',1)"); + + //Block 53 + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'bill_street','vtiger_quotesbillads',1,'24','bill_street','Billing Address',1,2,0,100,1,$quotesaddressblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'ship_street','vtiger_quotesshipads',1,'24','ship_street','Shipping Address',1,2,0,100,2,$quotesaddressblock,1,'V~M',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'bill_city','vtiger_quotesbillads',1,'1','bill_city','Billing City',1,2,0,100,5,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'ship_city','vtiger_quotesshipads',1,'1','ship_city','Shipping City',1,2,0,100,6,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'bill_state','vtiger_quotesbillads',1,'1','bill_state','Billing State',1,2,0,100,7,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'ship_state','vtiger_quotesshipads',1,'1','ship_state','Shipping State',1,2,0,100,8,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'bill_code','vtiger_quotesbillads',1,'1','bill_code','Billing Code',1,2,0,100,9,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'ship_code','vtiger_quotesshipads',1,'1','ship_code','Shipping Code',1,2,0,100,10,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'bill_country','vtiger_quotesbillads',1,'1','bill_country','Billing Country',1,2,0,100,11,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'ship_country','vtiger_quotesshipads',1,'1','ship_country','Shipping Country',1,2,0,100,12,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'bill_pobox','vtiger_quotesbillads',1,'1','bill_pobox','Billing Po Box',1,2,0,100,3,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'ship_pobox','vtiger_quotesshipads',1,'1','ship_pobox','Shipping Po Box',1,0,0,100,4,$quotesaddressblock,1,'V~O',3,null,'BAS',1)"); + //Block55 + + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,$quotedescription,1,'V~O',3,null,'ADV',1)"); + + //Block 56 + $this->db->query("insert into vtiger_field values (20,".$this->db->getUniqueID("vtiger_field").",'terms_conditions','vtiger_quotes',1,'19','terms_conditions','Terms & Conditions',1,2,0,100,1,$quotetermsblock,1,'V~O',3,null,'ADV',1)"); + + + //Quote Details -- END + + //Purchase Order Details -- START + //Block57 + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'purchaseorder_no','vtiger_purchaseorder',1,'4','purchaseorder_no','PurchaseOrder No',1,0,0,100,2,$pobasicblock,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'subject','vtiger_purchaseorder',1,'2','subject','Subject',1,0,0,100,1,$pobasicblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'vendorid','vtiger_purchaseorder',1,'81','vendor_id','Vendor Name',1,0,0,100,3,$pobasicblock,1,'I~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'requisition_no','vtiger_purchaseorder',1,'1','requisition_no','Requisition No',1,2,0,100,4,$pobasicblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'tracking_no','vtiger_purchaseorder',1,'1','tracking_no','Tracking Number',1,2,0,100,5,$pobasicblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'contactid','vtiger_purchaseorder',1,'57','contact_id','Contact Name',1,2,0,100,6,$pobasicblock,1,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'duedate','vtiger_purchaseorder',1,'5','duedate','Due Date',1,2,0,100,7,$pobasicblock,1,'D~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'carrier','vtiger_purchaseorder',1,'15','carrier','Carrier',1,2,0,100,8,$pobasicblock,1,'V~O',3,null,'BAS',1)"); + //$this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'salestax','vtiger_purchaseorder',1,'1','txtTax','Sales Tax',1,0,0,100,10,57,3,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'adjustment','vtiger_purchaseorder',1,'1','txtAdjustment','Adjustment',1,2,0,100,10,$pobasicblock,3,'NN~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'salescommission','vtiger_purchaseorder',1,'1','salescommission','Sales Commission',1,2,0,100,11,$pobasicblock,1,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'exciseduty','vtiger_purchaseorder',1,'1','exciseduty','Excise Duty',1,2,0,100,12,$pobasicblock,1,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'total','vtiger_purchaseorder',1,'1','hdnGrandTotal','Total',1,2,0,100,13,$pobasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'subtotal','vtiger_purchaseorder',1,'1','hdnSubTotal','Sub Total',1,2,0,100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)"); + //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'taxtype','vtiger_purchaseorder',1,'16','hdnTaxType','Tax Type',1,2,0,100,14,$pobasicblock,3,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'discount_percent','vtiger_purchaseorder',1,'1','hdnDiscountPercent','Discount Percent',1,2,0,100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'discount_amount','vtiger_purchaseorder',1,'1','hdnDiscountAmount','Discount Amount',1,0,0,100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'s_h_amount','vtiger_purchaseorder',1,'1','hdnS_H_Amount','S&H Amount',1,2,0,100,14,$pobasicblock,3,'N~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'postatus','vtiger_purchaseorder',1,'15','postatus','Status',1,2,0,100,15,$pobasicblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,16,$pobasicblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,17,$pobasicblock,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,18,$pobasicblock,2,'T~O',3,null,'BAS',0)"); + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'currency_id','vtiger_purchaseorder',1,'117','currency_id','Currency',1,2,1,100,19,$pobasicblock,3,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'conversion_rate','vtiger_purchaseorder',1,'1','conversion_rate','Conversion Rate',1,2,1,100,20,$pobasicblock,3,'N~O',3,null,'BAS',1)"); + + //Block 59 + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'bill_street','vtiger_pobillads',1,'24','bill_street','Billing Address',1,2,0,100,1,$poaddressblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'ship_street','vtiger_poshipads',1,'24','ship_street','Shipping Address',1,2,0,100,2,$poaddressblock,1,'V~M',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'bill_city','vtiger_pobillads',1,'1','bill_city','Billing City',1,2,0,100,5,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'ship_city','vtiger_poshipads',1,'1','ship_city','Shipping City',1,2,0,100,6,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'bill_state','vtiger_pobillads',1,'1','bill_state','Billing State',1,2,0,100,7,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'ship_state','vtiger_poshipads',1,'1','ship_state','Shipping State',1,2,0,100,8,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'bill_code','vtiger_pobillads',1,'1','bill_code','Billing Code',1,2,0,100,9,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'ship_code','vtiger_poshipads',1,'1','ship_code','Shipping Code',1,2,0,100,10,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'bill_country','vtiger_pobillads',1,'1','bill_country','Billing Country',1,2,0,100,11,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'ship_country','vtiger_poshipads',1,'1','ship_country','Shipping Country',1,2,0,100,12,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'bill_pobox','vtiger_pobillads',1,'1','bill_pobox','Billing Po Box',1,2,0,100,3,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'ship_pobox','vtiger_poshipads',1,'1','ship_pobox','Shipping Po Box',1,2,0,100,4,$poaddressblock,1,'V~O',3,null,'BAS',1)"); + + //Block61 + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,$podescription,1,'V~O',3,null,'ADV',1)"); + + //Block62 + $this->db->query("insert into vtiger_field values (21,".$this->db->getUniqueID("vtiger_field").",'terms_conditions','vtiger_purchaseorder',1,'19','terms_conditions','Terms & Conditions',1,2,0,100,1,$potermsblock,1,'V~O',3,null,'ADV',1)"); + + //Purchase Order Details -- END + + //Sales Order Details -- START + //Block63 + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'salesorder_no','vtiger_salesorder',1,'4','salesorder_no','SalesOrder No',1,0,0,100,4,$sobasicblock ,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'subject','vtiger_salesorder',1,'2','subject','Subject',1,0,0,100,1,$sobasicblock ,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'potentialid','vtiger_salesorder',1,'76','potential_id','Potential Name',1,2,0,100,2,$sobasicblock ,1,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'customerno','vtiger_salesorder',1,'1','customerno','Customer No',1,2,0,100,3,$sobasicblock ,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'quoteid','vtiger_salesorder',1,'78','quote_id','Quote Name',1,2,0,100,5,$sobasicblock ,1,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'purchaseorder','vtiger_salesorder',1,'1','vtiger_purchaseorder','Purchase Order',1,2,0,100,5,$sobasicblock ,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'contactid','vtiger_salesorder',1,'57','contact_id','Contact Name',1,2,0,100,6,$sobasicblock ,1,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'duedate','vtiger_salesorder',1,'5','duedate','Due Date',1,2,0,100,8,$sobasicblock ,1,'D~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'carrier','vtiger_salesorder',1,'15','carrier','Carrier',1,2,0,100,9,$sobasicblock ,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'pending','vtiger_salesorder',1,'1','pending','Pending',1,2,0,100,10,$sobasicblock ,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'sostatus','vtiger_salesorder',1,'15','sostatus','Status',1,2,0,100,11,$sobasicblock ,1,'V~M',3,null,'BAS',1)"); + //$this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'salestax','vtiger_salesorder',1,'1','txtTax','Sales Tax',1,0,0,100,12,63,3,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'adjustment','vtiger_salesorder',1,'1','txtAdjustment','Adjustment',1,2,0,100,12,$sobasicblock ,3,'NN~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'salescommission','vtiger_salesorder',1,'1','salescommission','Sales Commission',1,2,0,100,13,$sobasicblock ,1,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'exciseduty','vtiger_salesorder',1,'1','exciseduty','Excise Duty',1,2,0,100,13,$sobasicblock ,1,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'total','vtiger_salesorder',1,'1','hdnGrandTotal','Total',1,2,0,100,14,$sobasicblock ,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'subtotal','vtiger_salesorder',1,'1','hdnSubTotal','Sub Total',1,2,0,100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)"); + //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'taxtype','vtiger_salesorder',1,'16','hdnTaxType','Tax Type',1,2,0,100,15,$sobasicblock ,3,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'discount_percent','vtiger_salesorder',1,'1','hdnDiscountPercent','Discount Percent',1,2,0,100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'discount_amount','vtiger_salesorder',1,'1','hdnDiscountAmount','Discount Amount',1,0,0,100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'s_h_amount','vtiger_salesorder',1,'1','hdnS_H_Amount','S&H Amount',1,2,0,100,15,$sobasicblock ,3,'N~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'accountid','vtiger_salesorder',1,'73','account_id','Account Name',1,2,0,100,16,$sobasicblock ,1,'I~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,17,$sobasicblock ,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,18,$sobasicblock ,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,19,$sobasicblock ,2,'T~O',3,null,'BAS',0)"); + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'currency_id','vtiger_salesorder',1,'117','currency_id','Currency',1,2,1,100,20,$sobasicblock ,3,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'conversion_rate','vtiger_salesorder',1,'1','conversion_rate','Conversion Rate',1,2,1,100,21,$sobasicblock ,3,'N~O',3,null,'BAS',1)"); + + + //Block 65 + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'bill_street','vtiger_sobillads',1,'24','bill_street','Billing Address',1,2,0,100,1,$soaddressblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'ship_street','vtiger_soshipads',1,'24','ship_street','Shipping Address',1,2,0,100,2,$soaddressblock,1,'V~M',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'bill_city','vtiger_sobillads',1,'1','bill_city','Billing City',1,2,0,100,5,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'ship_city','vtiger_soshipads',1,'1','ship_city','Shipping City',1,2,0,100,6,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'bill_state','vtiger_sobillads',1,'1','bill_state','Billing State',1,2,0,100,7,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'ship_state','vtiger_soshipads',1,'1','ship_state','Shipping State',1,2,0,100,8,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'bill_code','vtiger_sobillads',1,'1','bill_code','Billing Code',1,2,0,100,9,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'ship_code','vtiger_soshipads',1,'1','ship_code','Shipping Code',1,2,0,100,10,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'bill_country','vtiger_sobillads',1,'1','bill_country','Billing Country',1,2,0,100,11,$soaddressblock,3,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'ship_country','vtiger_soshipads',1,'1','ship_country','Shipping Country',1,2,0,100,12,$soaddressblock,3,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'bill_pobox','vtiger_sobillads',1,'1','bill_pobox','Billing Po Box',1,2,0,100,3,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'ship_pobox','vtiger_soshipads',1,'1','ship_pobox','Shipping Po Box',1,2,0,100,4,$soaddressblock,1,'V~O',3,null,'BAS',1)"); + + //Block67 + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,$sodescription,1,'V~O',3,null,'ADV',1)"); + + //Block68 + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID("vtiger_field").",'terms_conditions','vtiger_salesorder',1,'19','terms_conditions','Terms & Conditions',1,2,0,100,1,$sotermsblock,1,'V~O',3,null,'ADV',1)"); + + // Add fields for the Recurring Information block - Block 86 + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID('vtiger_field').",'enable_recurring','vtiger_salesorder',1,'56','enable_recurring','Enable Recurring',1,0,0,100,1,$sorecurringinvoiceblock,1,'C~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID('vtiger_field').",'recurring_frequency','vtiger_invoice_recurring_info',1,'16','recurring_frequency','Frequency',1,0,0,100,2,$sorecurringinvoiceblock,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID('vtiger_field').",'start_period','vtiger_invoice_recurring_info',1,'5','start_period','Start Period',1,0,0,100,3,$sorecurringinvoiceblock,1,'D~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID('vtiger_field').",'end_period','vtiger_invoice_recurring_info',1,'5','end_period','End Period',1,0,0,100,4,$sorecurringinvoiceblock,1,'D~O~OTH~G~start_period~Start Period',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID('vtiger_field').",'payment_duration','vtiger_invoice_recurring_info',1,'16','payment_duration','Payment Duration',1,0,0,100,5,$sorecurringinvoiceblock,1,'V~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (22,".$this->db->getUniqueID('vtiger_field').",'invoice_status','vtiger_invoice_recurring_info',1,'15','invoicestatus','Invoice Status',1,0,0,100,6,$sorecurringinvoiceblock,1,'V~M',3,null,'BAS',0)"); + + //Sales Order Details -- END + + //Invoice Details -- START + //Block69 + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'subject','vtiger_invoice',1,'2','subject','Subject',1,0,0,100,1,$invoicebasicblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'salesorderid','vtiger_invoice',1,'80','salesorder_id','Sales Order',1,2,0,100,2,$invoicebasicblock,1,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'customerno','vtiger_invoice',1,'1','customerno','Customer No',1,2,0,100,3,$invoicebasicblock,1,'V~O',3,null,'BAS',1)"); + + + //to include contact name vtiger_field in Invoice-start + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'contactid','vtiger_invoice',1,'57','contact_id','Contact Name',1,2,0,100,4,$invoicebasicblock,1,'I~O',3,null,'BAS',1)"); + //end + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'invoicedate','vtiger_invoice',1,'5','invoicedate','Invoice Date',1,2,0,100,5,$invoicebasicblock,1,'D~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'duedate','vtiger_invoice',1,'5','duedate','Due Date',1,2,0,100,6,$invoicebasicblock,1,'D~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'purchaseorder','vtiger_invoice',1,'1','vtiger_purchaseorder','Purchase Order',1,2,0,100,8,$invoicebasicblock,1,'V~O',3,null,'BAS',1)"); + //$this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'salestax','vtiger_invoice',1,'1','txtTax','Sales Tax',1,0,0,100,9,69,3,'N~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'adjustment','vtiger_invoice',1,'1','txtAdjustment','Adjustment',1,2,0,100,9,$invoicebasicblock,3,'NN~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'salescommission','vtiger_invoice',1,'1','salescommission','Sales Commission',1,2,0,10,13,$invoicebasicblock,1,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'exciseduty','vtiger_invoice',1,'1','exciseduty','Excise Duty',1,2,0,100,11,$invoicebasicblock,1,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'subtotal','vtiger_invoice',1,'1','hdnSubTotal','Sub Total',1,2,0,100,12,$invoicebasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'total','vtiger_invoice',1,'1','hdnGrandTotal','Total',1,2,0,100,13,$invoicebasicblock,3,'N~O',3,null,'BAS',1)"); + //Added fields taxtype, discount percent, discount amount and S&H amount for Tax process + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'taxtype','vtiger_invoice',1,'16','hdnTaxType','Tax Type',1,2,0,100,13,$invoicebasicblock,3,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'discount_percent','vtiger_invoice',1,'1','hdnDiscountPercent','Discount Percent',1,2,0,100,13,$invoicebasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'discount_amount','vtiger_invoice',1,'1','hdnDiscountAmount','Discount Amount',1,2,0,100,13,$invoicebasicblock,3,'N~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'s_h_amount','vtiger_invoice',1,'1','hdnS_H_Amount','S&H Amount',1,2,0,100,14,57,3,'N~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'accountid','vtiger_invoice',1,'73','account_id','Account Name',1,2,0,100,14,$invoicebasicblock,1,'I~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'invoicestatus','vtiger_invoice',1,'15','invoicestatus','Status',1,2,0,100,15,$invoicebasicblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'smownerid','vtiger_crmentity',1,'53','assigned_user_id','Assigned To',1,0,0,100,16,$invoicebasicblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'createdtime','vtiger_crmentity',1,'70','createdtime','Created Time',1,0,0,100,17,$invoicebasicblock,2,'T~O',3,null,'BAS',0)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'modifiedtime','vtiger_crmentity',1,'70','modifiedtime','Modified Time',1,0,0,100,18,$invoicebasicblock,2,'T~O',3,null,'BAS',0)"); + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'currency_id','vtiger_invoice',1,'117','currency_id','Currency',1,2,1,100,19,$invoicebasicblock,3,'I~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'conversion_rate','vtiger_invoice',1,'1','conversion_rate','Conversion Rate',1,2,1,100,20,$invoicebasicblock,3,'N~O',3,null,'BAS',1)"); + + //Block 71 + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'bill_street','vtiger_invoicebillads',1,'24','bill_street','Billing Address',1,2,0,100,1,$invoiceaddressblock,1,'V~M',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'ship_street','vtiger_invoiceshipads',1,'24','ship_street','Shipping Address',1,2,0,100,2,$invoiceaddressblock,1,'V~M',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'bill_city','vtiger_invoicebillads',1,'1','bill_city','Billing City',1,2,0,100,5,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'ship_city','vtiger_invoiceshipads',1,'1','ship_city','Shipping City',1,2,0,100,6,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'bill_state','vtiger_invoicebillads',1,'1','bill_state','Billing State',1,2,0,100,7,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'ship_state','vtiger_invoiceshipads',1,'1','ship_state','Shipping State',1,2,0,100,8,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'bill_code','vtiger_invoicebillads',1,'1','bill_code','Billing Code',1,2,0,100,9,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'ship_code','vtiger_invoiceshipads',1,'1','ship_code','Shipping Code',1,2,0,100,10,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'bill_country','vtiger_invoicebillads',1,'1','bill_country','Billing Country',1,2,0,100,11,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'ship_country','vtiger_invoiceshipads',1,'1','ship_country','Shipping Country',1,2,0,100,12,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'bill_pobox','vtiger_invoicebillads',1,'1','bill_pobox','Billing Po Box',1,2,0,100,3,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'ship_pobox','vtiger_invoiceshipads',1,'1','ship_pobox','Shipping Po Box',1,2,0,100,4,$invoiceaddressblock,1,'V~O',3,null,'BAS',1)"); + + //Block73 + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_crmentity',1,'19','description','Description',1,2,0,100,1,$invoicedescription,1,'V~O',3,null,'ADV',1)"); + //Block74 + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'terms_conditions','vtiger_invoice',1,'19','terms_conditions','Terms & Conditions',1,2,0,100,1,$invoicetermsblock,1,'V~O',3,null,'ADV',1)"); + //Added for Custom invoice Number + $this->db->query("insert into vtiger_field values (23,".$this->db->getUniqueID("vtiger_field").",'invoice_no','vtiger_invoice',1,'4','invoice_no','Invoice No',1,0,0,100,3,$invoicebasicblock,1,'V~O',3,null,'BAS',0)"); + + //Invoice Details -- END + //users Details Starts Block 79,80,81 + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'user_name','vtiger_users',1,'106','user_name','User Name',1,0,0,11,1,$userloginandroleblockid,1,'V~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'is_admin','vtiger_users',1,'156','is_admin','Admin',1,0,0,3,2,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'user_password','vtiger_users',1,'99','user_password','Password',1,0,0,30,3,$userloginandroleblockid,4,'P~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'confirm_password','vtiger_users',1,'99','confirm_password','Confirm Password',1,0,0,30,5,$userloginandroleblockid,4,'P~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'first_name','vtiger_users',1,'1','first_name','First Name',1,0,0,30,7,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'last_name','vtiger_users',1,'2','last_name','Last Name',1,0,0,30,9,$userloginandroleblockid,1,'V~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'roleid','vtiger_user2role',1,'98','roleid','Role',1,0,0,200,11,$userloginandroleblockid,1,'V~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'email1','vtiger_users',1,'104','email1','Email',1,0,0,100,4,$userloginandroleblockid,1,'E~M',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'status','vtiger_users',1,'115','status','Status',1,0,0,100,6,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'activity_view','vtiger_users',1,'16','activity_view','Default Activity View',1,0,0,100,12,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'lead_view','vtiger_users',1,'16','lead_view','Default Lead View',1,0,0,100,10,$userloginandroleblockid,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'currency_id','vtiger_users',1,'117','currency_id','Currency',1,0,0,100,8,$userloginandroleblockid,1,'I~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'hour_format','vtiger_users',1,'116','hour_format','Calendar Hour Format',1,0,0,100,13,$userloginandroleblockid,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'end_hour','vtiger_users',1,'116','end_hour','Day ends at',1,0,0,100,15,$userloginandroleblockid,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'start_hour','vtiger_users',1,'116','start_hour','Day starts at',1,0,0,100,14,$userloginandroleblockid,3,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'title','vtiger_users',1,'1','title','Title',1,0,0,50,1,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'phone_work','vtiger_users',1,'1','phone_work','Office Phone',1,0,0,50,5,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'department','vtiger_users',1,'1','department','Department',1,0,0,50,3,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'phone_mobile','vtiger_users',1,'1','phone_mobile','Mobile',1,0,0,50,7,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'reports_to_id','vtiger_users',1,'101','reports_to_id','Reports To',1,0,0,50,8,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'phone_other','vtiger_users',1,'1','phone_other','Other Phone',1,0,0,50,11,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'email2','vtiger_users',1,'13','email2','Other Email',1,0,0,100,4,$usermoreinfoblock,1,'E~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'phone_fax','vtiger_users',1,'1','phone_fax','Fax',1,0,0,50,2,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'yahoo_id','vtiger_users',1,'13','yahoo_id','Yahoo id',1,0,0,100,6,$usermoreinfoblock,1,'E~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'phone_home','vtiger_users',1,'1','phone_home','Home Phone',1,0,0,50,9,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'date_format','vtiger_users',1,'16','date_format','Date Format',1,0,0,30,12,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'signature','vtiger_users',1,'21','signature','Signature',1,0,0,250,13,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'description','vtiger_users',1,'21','description','Documents',1,0,0,250,14,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_street','vtiger_users',1,'21','address_street','Street Address',1,0,0,250,1,$useraddressblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_city','vtiger_users',1,'1','address_city','City',1,0,0,100,3,$useraddressblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_state','vtiger_users',1,'1','address_state','State',1,0,0,100,5,$useraddressblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_postalcode','vtiger_users',1,'1','address_postalcode','Postal Code',1,0,0,100,4,$useraddressblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'address_country','vtiger_users',1,'1','address_country','Country',1,0,0,100,2,$useraddressblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values(29,".$this->db->getUniqueID("vtiger_field").",'accesskey','vtiger_users',1,3,'accesskey','Webservice Access Key',1,0,0,100,2,$useradvanceblock,2,'V~O',1,null,'BAS',1);"); + + //User Image Information + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'imagename','vtiger_users',1,'105','imagename','User Image',1,0,0,250,10,$userblockid,1,'V~O',1,null,'BAS',1)"); + //added for internl_mailer + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'internal_mailer','vtiger_users',1,'56','internal_mailer','INTERNAL_MAIL_COMPOSER',1,0,0,50,15,$usermoreinfoblock,1,'V~O',1,null,'BAS',1)"); + $this->db->query("insert into vtiger_field values (29,".$this->db->getUniqueID("vtiger_field").",'reminder_interval','vtiger_users',1,'16','reminder_interval','Reminder Interval',1,0,0,100,1,$useradvanceblock,1,'V~O',1,null,'BAS',1)"); + //user Details End + + // Updated Phone field uitype + $this->db->query("update vtiger_field set uitype='11' where fieldname='mobile' and tabid=".getTabid('Leads')); + $this->db->query("update vtiger_field set uitype='11' where fieldname='mobile' and tabid=".getTabid('Contacts')); + $this->db->query("update vtiger_field set uitype='11' where fieldname='fax' and tabid=".getTabid('Leads')); + $this->db->query("update vtiger_field set uitype='11' where fieldname='fax' and tabid=".getTabid('Contacts')); + $this->db->query("update vtiger_field set uitype='11' where fieldname='fax' and tabid=".getTabid('Accounts')); + + $tab_field_array = array( + 'Accounts'=>array('accountname'), + 'Contacts'=>array('imagename'), + 'Products'=>array('imagename','product_id'), + 'Invoice'=>array('invoice_no','salesorder_id'), + 'SalesOrder'=>array('quote_id','salesorder_no'), + 'PurchaseOrder'=>array('purchaseorder_no'), + 'Quotes'=>array('quote_no'), + 'HelpDesk'=>array('filename'), + ); + foreach($tab_field_array as $index=>$value){ + $tabid = getTabid($index); + $this->db->pquery("UPDATE vtiger_field SET masseditable=0 WHERE tabid=? AND fieldname IN (".generateQuestionMarks($value).")",array($tabid,$value)); + } + + //Emails field added here + $email_Tabid = getTabid('Emails'); + $blockquery = "select blockid from vtiger_blocks where blocklabel = ?"; + $blockres = $this->db->pquery($blockquery,array('LBL_EMAIL_INFORMATION')); + $blockid = $this->db->query_result($blockres,0,'blockid'); + $this->db->query("INSERT INTO vtiger_field values($email_Tabid,".$this->db->getUniqueID("vtiger_field").",'from_email','vtiger_emaildetails',1,12,'from_email','From',1,2,0,100,1,$blockid,3,'V~M',3,NULL,'BAS',0)"); + $this->db->query("INSERT INTO vtiger_field values($email_Tabid,".$this->db->getUniqueID("vtiger_field").",'to_email','vtiger_emaildetails',1,8,'saved_toid','To',1,2,0,100,2,$blockid,1,'V~M',3,NULL,'BAS',0)"); + $this->db->query("INSERT INTO vtiger_field values($email_Tabid,".$this->db->getUniqueID("vtiger_field").",'cc_email','vtiger_emaildetails',1,8,'ccmail','CC',1,2,0,1000,3,$blockid,1,'V~O',3,NULL,'BAS',0)"); + $this->db->query("INSERT INTO vtiger_field values($email_Tabid,".$this->db->getUniqueID("vtiger_field").",'bcc_email','vtiger_emaildetails',1,8,'bccmail','BCC' ,1,2,0,1000,4,$blockid,1,'V~O',3,NULL,'BAS',0)"); + $this->db->query("INSERT INTO vtiger_field values($email_Tabid,".$this->db->getUniqueID("vtiger_field").",'idlists','vtiger_emaildetails',1,357,'parent_id','Parent ID' ,1,2,0,1000,5,$blockid,1,'V~O',3,NULL,'BAS',0)"); + $this->db->query("INSERT INTO vtiger_field values($email_Tabid,".$this->db->getUniqueID("vtiger_field").",'email_flag','vtiger_emaildetails',1,16,'email_flag','Email Flag' ,1,2,0,1000,6,$blockid,3,'V~O',3,NULL,'BAS',0)"); + //Emails fields ends + + //The Entity Name for the modules are maintained in this table + $this->db->query("insert into vtiger_entityname values(7,'Leads','vtiger_leaddetails','lastname,firstname','leadid','leadid')"); + $this->db->query("insert into vtiger_entityname values(6,'Accounts','vtiger_account','accountname','accountid','account_id')"); + $this->db->query("insert into vtiger_entityname values(4,'Contacts','vtiger_contactdetails','lastname,firstname','contactid','contact_id')"); + $this->db->query("insert into vtiger_entityname values(2,'Potentials','vtiger_potential','potentialname','potentialid','potential_id')"); + $this->db->query("insert into vtiger_entityname values(8,'Documents','vtiger_notes','title','notesid','notesid')"); + $this->db->query("insert into vtiger_entityname values(13,'HelpDesk','vtiger_troubletickets','title','ticketid','ticketid')"); + $this->db->query("insert into vtiger_entityname values(9,'Calendar','vtiger_activity','subject','activityid','activityid')"); + $this->db->query("insert into vtiger_entityname values(10,'Emails','vtiger_activity','subject','activityid','activityid')"); + $this->db->query("insert into vtiger_entityname values(14,'Products','vtiger_products','productname','productid','product_id')"); + $this->db->query("insert into vtiger_entityname values(29,'Users','vtiger_users','last_name,first_name','id','id')"); + $this->db->query("insert into vtiger_entityname values(23,'Invoice','vtiger_invoice','subject','invoiceid','invoiceid')"); + $this->db->query("insert into vtiger_entityname values(20,'Quotes','vtiger_quotes','subject','quoteid','quote_id')"); + $this->db->query("insert into vtiger_entityname values(21,'PurchaseOrder','vtiger_purchaseorder','subject','purchaseorderid','purchaseorderid')"); + $this->db->query("insert into vtiger_entityname values(22,'SalesOrder','vtiger_salesorder','subject','salesorderid','salesorder_id')"); + $this->db->query("insert into vtiger_entityname values(18,'Vendors','vtiger_vendor','vendorname','vendorid','vendor_id')"); + $this->db->query("insert into vtiger_entityname values(19,'PriceBooks','vtiger_pricebook','bookname','pricebookid','pricebookid')"); + $this->db->query("insert into vtiger_entityname values(26,'Campaigns','vtiger_campaign','campaignname','campaignid','campaignid')"); + $this->db->query("insert into vtiger_entityname values(15,'Faq','vtiger_faq','question','id','id')"); + // Insert End + + + //Inserting values into org share action mapping + $this->db->query("insert into vtiger_org_share_action_mapping values(0,'Public: Read Only')"); + $this->db->query("insert into vtiger_org_share_action_mapping values(1,'Public: Read, Create/Edit')"); + $this->db->query("insert into vtiger_org_share_action_mapping values(2,'Public: Read, Create/Edit, Delete')"); + $this->db->query("insert into vtiger_org_share_action_mapping values(3,'Private')"); + + $this->db->query("insert into vtiger_org_share_action_mapping values(4,'Hide Details')"); + $this->db->query("insert into vtiger_org_share_action_mapping values(5,'Hide Details and Add Events')"); + $this->db->query("insert into vtiger_org_share_action_mapping values(6,'Show Details')"); + $this->db->query("insert into vtiger_org_share_action_mapping values(7,'Show Details and Add Events')"); + + + //Inserting for all vtiger_tabs + $def_org_tabid= Array(2,4,6,7,8,9,10,13,16,20,21,22,23,26); + + foreach($def_org_tabid as $def_tabid) + { + $this->db->query("insert into vtiger_org_share_action2tab values(0,".$def_tabid.")"); + $this->db->query("insert into vtiger_org_share_action2tab values(1,".$def_tabid.")"); + $this->db->query("insert into vtiger_org_share_action2tab values(2,".$def_tabid.")"); + $this->db->query("insert into vtiger_org_share_action2tab values(3,".$def_tabid.")"); + } + + //Insert into default_org_sharingrule + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",2,2,0)"); + + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",4,2,2)"); + + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",6,2,0)"); + + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",7,2,0)"); + + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",9,3,1)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",13,2,0)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",16,3,2)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",20,2,0)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",21,2,0)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",22,2,0)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",23,2,0)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",26,2,0)"); + $this->db->query("insert into vtiger_def_org_share values (".$this->db->getUniqueID('vtiger_def_org_share').",8,2,0)"); + + //Populating the DataShare Related Modules + + //Lead Related Module + + //Account Related Module + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,2)"); + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,13)"); + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,20)"); + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,22)"); + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",6,23)"); + + //Potential Related Module + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",2,20)"); + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",2,22)"); + + //Quote Related Module + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",20,22)"); + + //SO Related Module + $this->db->query("insert into vtiger_datashare_relatedmodules values (".$this->db->getUniqueID('vtiger_datashare_relatedmodules').",22,23)"); + + + + + // New Secutity End + + + //insert into the vtiger_notificationscheduler vtiger_table + + //insert into related list vtiger_table + //Inserting for vtiger_account related lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Contacts").",'get_contacts',1,'Contacts',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Potentials").",'get_opportunities',2,'Potentials',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Quotes").",'get_quotes',3,'Quotes',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("SalesOrder").",'get_salesorder',4,'Sales Order',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Invoice").",'get_invoices',5,'Invoice',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Calendar").",'get_activities',6,'Activities',0,'add')"); + + //added for the ticket4109 + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Emails").",'get_emails',7,'Emails',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Calendar").",'get_history',8,'Activity History',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Documents").",'get_attachments',9,'Documents',0,'add,select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("HelpDesk").",'get_tickets',10,'HelpDesk',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Accounts").",".getTabid("Products").",'get_products',11,'Products',0,'select')"); + + //Inserting Lead Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Leads").",".getTabid("Calendar").",'get_activities',1,'Activities',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Leads").",".getTabid("Emails").",'get_emails',2,'Emails',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Leads").",".getTabid("Calendar").",'get_history',3,'Activity History',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Leads").",".getTabid("Documents").",'get_attachments',4,'Documents',0,'add,select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Leads").",".getTabid("Products").",'get_products',5,'Products',0,'select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Leads").",".getTabid("Campaigns").",'get_campaigns',6,'Campaigns',0,'select')"); + + //Inserting for contact related lists + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Potentials").",'get_opportunities',1,'Potentials',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Calendar").",'get_activities',2,'Activities',0,'add')"); + + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Emails").",'get_emails',3,'Emails',0,'add')"); + + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("HelpDesk").",'get_tickets',4,'HelpDesk',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Quotes").",'get_quotes',5,'Quotes',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("PurchaseOrder").",'get_purchase_orders',6,'Purchase Order',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("SalesOrder").",'get_salesorder',7,'Sales Order',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Products").",'get_products',8,'Products',0,'select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Calendar").",'get_history',9,'Activity History',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Documents").",'get_attachments',10,'Documents',0,'add,select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Contacts").",".getTabid("Campaigns").",'get_campaigns',11,'Campaigns',0,'select')"); + + $this->db->query("INSERT INTO vtiger_relatedlists VALUES(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid('Contacts').",".getTabid('Invoice').",'get_invoices',12,'Invoice',0, 'add')"); + + //Inserting Potential Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",".getTabid("Calendar").",'get_activities',1,'Activities',0,'add')"); + + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",".getTabid("Contacts").",'get_contacts',2,'Contacts',0,'select')"); + + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",".getTabid("Products").",'get_products',3,'Products',0,'select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",0,'get_stage_history',4,'Sales Stage History',0,'')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",".getTabid("Documents").",'get_attachments',5,'Documents',0,'add,select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",".getTabid("Quotes").",'get_Quotes',6,'Quotes',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",".getTabid("SalesOrder").",'get_salesorder',7,'Sales Order',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Potentials").",".getTabid("Calendar").",'get_history',8,'Activity History',0,'')"); + + //Inserting Product Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("HelpDesk").",'get_tickets',1,'HelpDesk',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Documents").",'get_attachments',3,'Documents',0,'add,select')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Quotes").",'get_quotes',4,'Quotes',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("PurchaseOrder").",'get_purchase_orders',5,'Purchase Order',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("SalesOrder").",'get_salesorder',6,'Sales Order',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Invoice").",'get_invoices',7,'Invoice',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("PriceBooks").",'get_product_pricebooks',8,'PriceBooks',0,'add')"); + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Leads").",'get_leads',9,'Leads',0,'select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Accounts").",'get_accounts',10,'Accounts',0,'select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Contacts").",'get_contacts',11,'Contacts',0,'select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Potentials").",'get_opportunities',12,'Potentials',0,'select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Products").",'get_products',13,'Product Bundles',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Products").",".getTabid("Products").",'get_parent_products',14,'Parent Product',0,'')"); + + //Inserting Emails Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Emails").",".getTabid("Contacts").",'get_contacts',1,'Contacts',0,'select,bulkmail')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Emails").",0,'get_users',2,'Users',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Emails").",".getTabid("Documents").",'get_attachments',3,'Documents',0,'add,select')"); + + //Inserting HelpDesk Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("HelpDesk").",".getTabid("Calendar").",'get_activities',1,'Activities',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("HelpDesk").",".getTabid("Documents").",'get_attachments',2,'Documents',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("HelpDesk").",0,'get_ticket_history',3,'Ticket History',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("HelpDesk").",".getTabid("Calendar").",'get_history',4,'Activity History',0,'')"); + + //Inserting PriceBook Related Lists + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("PriceBooks").",14,'get_pricebook_products',2,'Products',0,'select')"); + + // Inserting Vendor Related Lists + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Vendors").",14,'get_products',1,'Products',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Vendors").",21,'get_purchase_orders',2,'Purchase Order',0,'add')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Vendors").",4,'get_contacts',3,'Contacts',0,'select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Vendors").",".getTabid("Emails").",'get_emails',4,'Emails',0,'add')"); + + // Inserting Quotes Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Quotes").",".getTabid("SalesOrder").",'get_salesorder',1,'Sales Order',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Quotes").",9,'get_activities',2,'Activities',0,'add')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Quotes").",".getTabid("Documents").",'get_attachments',3,'Documents',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Quotes").",9,'get_history',4,'Activity History',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Quotes").",0,'get_quotestagehistory',5,'Quote Stage History',0,'')"); + + // Inserting Purchase order Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("PurchaseOrder").",9,'get_activities',1,'Activities',0,'add')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("PurchaseOrder").",".getTabid("Documents").",'get_attachments',2,'Documents',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("PurchaseOrder").",".getTabid("Calendar").",'get_history',3,'Activity History',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("PurchaseOrder").",0,'get_postatushistory',4,'PurchaseOrder Status History',0,'')"); + + // Inserting Sales order Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("SalesOrder").",9,'get_activities',1,'Activities',0,'add')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("SalesOrder").",".getTabid("Documents").",'get_attachments',2,'Documents',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("SalesOrder").",".getTabid("Invoice").",'get_invoices',3,'Invoice',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("SalesOrder").",".getTabid("Calendar").",'get_history',4,'Activity History',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("SalesOrder").",0,'get_sostatushistory',5,'SalesOrder Status History',0,'')"); + + // Inserting Invoice Related Lists + + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Invoice").",9,'get_activities',1,'Activities',0,'add')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Invoice").",".getTabid("Documents").",'get_attachments',2,'Documents',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Invoice").",".getTabid("Calendar").",'get_history',3,'Activity History',0,'')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Invoice").",0,'get_invoicestatushistory',4,'Invoice Status History',0,'')"); + + // Inserting Activities Related Lists + + $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Calendar").",0,'get_users',1,'Users',0,'')"); + $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Calendar").",4,'get_contacts',2,'Contacts',0,'')"); + + // Inserting Campaigns Related Lists + + $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Campaigns").",".getTabid("Contacts").",'get_contacts',1,'Contacts',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Campaigns").",".getTabid("Leads").",'get_leads',2,'Leads',0,'add,select')"); + $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Campaigns").",".getTabid("Potentials").",'get_opportunities',3,'Potentials',0,'add')"); + $this->db->query("insert into vtiger_relatedlists values(".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Campaigns").",9,'get_activities',4,'Activities',0,'add')"); + $this->db->query("INSERT INTO vtiger_relatedlists VALUES (".$this->db->getUniqueID('vtiger_relatedlists').", ".getTabid("Accounts").", ".getTabid("Campaigns").", 'get_campaigns', 13, 'Campaigns', 0, 'select')"); + $this->db->query("INSERT INTO vtiger_relatedlists VALUES (".$this->db->getUniqueID('vtiger_relatedlists').", ".getTabid("Campaigns").", ".getTabid("Accounts").", 'get_accounts', 5, 'Accounts', 0, 'add,select')"); + + // Inserting Faq's Related Lists + $this->db->query("insert into vtiger_relatedlists values (".$this->db->getUniqueID('vtiger_relatedlists').",".getTabid("Faq").",".getTabid("Documents").",'get_attachments',1,'Documents',0,'add,select')"); + + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_TASK_NOTIFICATION_DESCRITPION',1,'Task Delay Notification','Tasks delayed beyond 24 hrs ','LBL_TASK_NOTIFICATION')"); + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_BIG_DEAL_DESCRIPTION' ,1,'Big Deal notification','Success! A big deal has been won! ','LBL_BIG_DEAL')"); + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_TICKETS_DESCRIPTION',1,'Pending Tickets notification','Ticket pending please ','LBL_PENDING_TICKETS')"); + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_MANY_TICKETS_DESCRIPTION',1,'Too many tickets Notification','Too many tickets pending against this entity ','LBL_MANY_TICKETS')"); + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label,type) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_START_DESCRIPTION' ,1,'Support Start Notification','10','LBL_START_NOTIFICATION','select')"); + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label,type) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_SUPPORT_DESCRIPTION',1,'Support ending please','11','LBL_SUPPORT_NOTICIATION','select')"); + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label,type) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_SUPPORT_DESCRIPTION_MONTH',1,'Support ending please','12','LBL_SUPPORT_NOTICIATION_MONTH','select')"); + $this->db->query("insert into vtiger_notificationscheduler(schedulednotificationid,schedulednotificationname,active,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_notificationscheduler").",'LBL_ACTIVITY_REMINDER_DESCRIPTION' ,1,'Activity Reminder Notification','This is a reminder notification for the Activity','LBL_ACTIVITY_NOTIFICATION')"); + + //inserting actions for get_attachments + $folderid = $this->db->getUniqueID("vtiger_attachmentsfolder"); + $this->db->query("insert into vtiger_attachmentsfolder values(".$folderid.",'Default','This is a Default Folder',1,1)"); + + //Inserting Inventory Notifications + $invoice_body = 'Dear {HANDLER}, + +The current stock of {PRODUCTNAME} in our warehouse is {CURRENTSTOCK}. Kindly procure required number of units as the stock level is below reorder level {REORDERLEVELVALUE}. + +Please treat this information as Urgent as the invoice is already sent to the customer. + +Severity: Critical + +Thanks, +{CURRENTUSER}'; + + + $this->db->query("insert into vtiger_inventorynotification(notificationid,notificationname,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_inventorynotification").",'InvoiceNotification','{PRODUCTNAME} Stock Level is Low','".$invoice_body." ','InvoiceNotificationDescription')"); + + $quote_body = 'Dear {HANDLER}, + +Quote is generated for {QUOTEQUANTITY} units of {PRODUCTNAME}. The current stock of {PRODUCTNAME} in our warehouse is {CURRENTSTOCK}. + +Severity: Minor + +Thanks, +{CURRENTUSER}'; + + + $this->db->query("insert into vtiger_inventorynotification(notificationid,notificationname,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_inventorynotification").",'QuoteNotification','Quote given for {PRODUCTNAME}','".$quote_body." ','QuoteNotificationDescription')"); + + $so_body = 'Dear {HANDLER}, + +SalesOrder is generated for {SOQUANTITY} units of {PRODUCTNAME}. The current stock of {PRODUCTNAME} in our warehouse is {CURRENTSTOCK}. + +Please treat this information with priority as the sales order is already generated. + +Severity: Major + +Thanks, +{CURRENTUSER}'; + + + $this->db->query("insert into vtiger_inventorynotification(notificationid,notificationname,notificationsubject,notificationbody,label) values (".$this->db->getUniqueID("vtiger_inventorynotification").",'SalesOrderNotification','Sales Order generated for {PRODUCTNAME}','".$so_body." ','SalesOrderNotificationDescription')"); + +//insert into inventory terms and conditions table + + $inv_tandc_text=' + - Unless otherwise agreed in writing by the supplier all invoices are payable within thirty (30) days of the date of invoice, in the currency of the invoice, drawn on a bank based in India or by such other method as is agreed in advance by the Supplier. + + - All prices are not inclusive of VAT which shall be payable in addition by the Customer at the applicable rate.'; + + $this->db->query("insert into vtiger_inventory_tandc(id,type,tandc) values (".$this->db->getUniqueID("vtiger_inventory_tandc").", 'Inventory', '".$inv_tandc_text."')"); + +//insert into email template vtiger_table + + $body='Hello!
+
+ On behalf of the vtiger team, I am pleased to announce the release of vtiger crm4.2 . This is a feature packed release including the mass email template handling, custom view feature, vtiger_reports feature and a host of other utilities. vtiger runs on all platforms.
+
+ Notable Features of vtiger are :
+
+ -Email Client Integration
+ -Trouble Ticket Integration
+ -Invoice Management Integration
+ -Reports Integration
+ -Portal Integration
+ -Enhanced Word Plugin Support
+ -Custom View Integration
+
+ Known Issues:
+ -ABCD
+ -EFGH
+ -IJKL
+ -MNOP
+ -QRST'; + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Announcement for Release','Announcement for Release','Announcement of a release','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + + +$body='name
+street,
+city,
+state,
+ zip)
+
+ Dear
+
+ Please check the following invoices that are yet to be paid by you:
+
+ No. Date Amount
+ 1 1/1/01 $4000
+ 2 2/2//01 $5000
+ 3 3/3/01 $10000
+ 4 7/4/01 $23560
+
+ Kindly let us know if there are any issues that you feel are pending to be discussed.
+ We will be more than happy to give you a call.
+ We would like to continue our business with you.'; + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Pending Invoices','Invoices Pending','Payment Due','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + + + + +$body=' Dear
+
+Your proposal on the project XYZW has been reviewed by us
+and is acceptable in its entirety.
+
+We are eagerly looking forward to this project
+and are pleased about having the opportunity to work
+together. We look forward to a long standing relationship
+with your esteemed firm.
+
+I would like to take this opportunity to invite you
+to a game of golf on Wednesday morning 9am at the
+Cuff Links Ground. We will be waiting for you in the
+Executive Lounge.
+
+Looking forward to seeing you there.'; + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Acceptance Proposal','Acceptance Proposal','Acceptance of Proposal','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + +$body= ' The undersigned hereby acknowledges receipt and delivery of the goods.
+The undersigned will release the payment subject to the goods being discovered not satisfactory.
+
+Signed under seal this '; + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Goods received acknowledgement','Goods received acknowledgement','Acknowledged Receipt of Goods','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + + $body= ' Dear
+ We are in receipt of your order as contained in the
+ purchase order form.We consider this to be final and binding on both sides.
+If there be any exceptions noted, we shall consider them
+only if the objection is received within ten days of receipt of
+this notice.
+
+Thank you for your patronage.'; + + + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Accept Order','Accept Order','Acknowledgement/Acceptance of Order','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + + + +$body='Dear
+
+We are relocating our office to
+11111,XYZDEF Cross,
+UVWWX Circle
+The telephone number for this new location is (101) 1212-1328.
+
+Our Manufacturing Division will continue operations
+at 3250 Lovedale Square Avenue, in Frankfurt.
+
+We hope to keep in touch with you all.
+Please update your addressbooks.'; + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Address Change','Change of Address','Address Change','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + + +$body='Dear
+
+Thank you for extending us the opportunity to meet with
+you and members of your staff.
+
+I know that John Doe serviced your account
+for many years and made many friends at your firm. He has personally
+discussed with me the deep relationship that he had with your firm.
+While his presence will be missed, I can promise that we will
+continue to provide the fine service that was accorded by
+John to your firm.
+
+I was genuinely touched to receive such fine hospitality.
+
+Thank you once again.'; + + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Follow Up','Follow Up','Follow Up of meeting','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + + +$body='Congratulations!
+
+The numbers are in and I am proud to inform you that our
+total sales for the previous quarter
+amounts to $100,000,00.00!. This is the first time
+we have exceeded the target by almost 30%.
+We have also beat the previous quarter record by a
+whopping 75%!
+
+Let us meet at Smoking Joe for a drink in the evening!
+ +C you all there guys!'; + + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Target Crossed!','Target Crossed!','Fantastic Sales Spree!','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + +$body='Dear
+
+Thank you for your confidence in our ability to serve you.
+We are glad to be given the chance to serve you.I look
+forward to establishing a long term partnership with you.
+Consider me as a friend.
+Should any need arise,please do give us a call.'; + + + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Thanks Note','Thanks Note','Note of thanks','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + +//Added for HTML Eemail templates.. +//for Customer Portal Login details +$body=' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + +
$logo$
vtiger CRM
The honest Open Source CRM
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Dear $contact_name$,
Thank you very much for subscribing to the vtiger CRM - annual support service.
Here is your self service portal login details:
+ + + + + + + + + + +

User ID : $login_name$
Password: $password$
$URL$
+
NOTE: We suggest you to change your password after logging in first time.

Help Documentation

After logging in to vtiger Self-service Portal first time, you can access the vtiger CRM documents from the Documents tab. Following documents are available for your reference:
+
    +
  • Installation Manual (Windows & Linux OS)
  • +
  • User & Administrator Manual
  • +
  • vtiger Customer Portal - User Manual
  • +
  • vtiger Outlook Plugin - User Manual
  • +
  • vtiger Office Plug-in - User Manual
  • +
  • vtiger Thunderbird Extension - User Manual
  • +
  • vtiger Web Forms - User Manual
  • +
  • vtiger Firefox Tool bar - User Manual
  • +
+

Knowledge Base

Periodically we update frequently asked question based on our customer experiences. You can access the latest articles from the FAQ tab.

vtiger CRM - Details

Kindly let us know your current vtiger CRM version and system specification so that we can provide you necessary guidelines to enhance your vtiger CRM system performance. Based on your system specification we alert you about the latest security & upgrade patches.

Thank you once again and wish you a wonderful experience with vtiger CRM.


Best Regards
$support_team$
www.vtiger.com
+
+
+ + + + + + + + + + +
Shree Narayana Complex, No 11 Sarathy Nagar, Vijaya Nagar , Velachery, Chennai - 600 042 India
Telephone No: +91 - 44 - 4202 - 1990 Toll Free No: +1 877 788 4437
Email Id: support@vtiger.com
+
+
'; + + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Customer Login Details','Customer Portal Login Details','Send Portal login details to customer','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + +//for Support end notification before a week +$body=' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + +
$logo$
vtiger CRM
The honest Open Source CRM
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Dear $contacts-lastname$,
This is just a notification mail regarding your support end.
Priority: Urgent
Your Support is going to expire on next week
Please contact support@vtiger.com.





Sincerly
Support Team
www.vtiger.com
+
+
+ + + + + + + + + + +
Shree Narayana Complex, No 11 Sarathy Nagar, Vijaya Nagar , Velachery, Chennai - 600 042 India
Telephone No: +91 - 44 - 4202 - 1990 Toll Free No: +1 877 788 4437
Email Id: info@vtiger.com
+
+
'; + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Support end notification before a week','VtigerCRM Support Notification','Send Notification mail to customer before a week of support end date','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + +//for Support end notification before a month +$body=' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + +
$logo$
vtiger CRM
The honest Open Source CRM
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Dear $contacts-lastname$,
This is just a notification mail regarding your support end.
Priority: Normal
Your Support is going to expire on next month.
Please contact support@vtiger.com





Sincerly
Support Team
www.vtiger.com
+
+
+ + + + + + + + + + +
Shree Narayana Complex, No 11 Sarathy Nagar, Vijaya Nagar , Velachery, Chennai - 600 042 India
Telephone No: +91 - 44 - 4202 - 1990 Toll Free No: +1 877 788 4437
Email Id: info@vtiger.com
+
+
'; + $this->db->query("insert into vtiger_emailtemplates(foldername,templatename,subject,description,body,deleted,templateid) values ('Public','Support end notification before a month','VtigerCRM Support Notification','Send Notification mail to customer before a month of support end date','".$body."',0,".$this->db->getUniqueID('vtiger_emailtemplates').")"); + + + + //Insert into vtiger_organizationdetails vtiger_table + $this->db->query("insert into vtiger_organizationdetails(organizationname,address,city,state,country,code,phone,fax,website,logoname) values ('vtiger',' 40-41-42, Sivasundar Apartments, Flat D-II, Shastri Street, Velachery','Chennai','Tamil Nadu','India','600 042','+91-44-5202-1990','+91-44-5202-1990','www.vtiger.com','vtiger-crm-logo.jpg')"); + + + $this->db->query("insert into vtiger_actionmapping values(0,'Save',0)"); + $this->db->query("insert into vtiger_actionmapping values(1,'EditView',0)"); + $this->db->query("insert into vtiger_actionmapping values(2,'Delete',0)"); + $this->db->query("insert into vtiger_actionmapping values(3,'index',0)"); + $this->db->query("insert into vtiger_actionmapping values(4,'DetailView',0)"); + $this->db->query("insert into vtiger_actionmapping values(5,'Import',0)"); + $this->db->query("insert into vtiger_actionmapping values(6,'Export',0)"); + //$this->db->query("insert into vtiger_actionmapping values(7,'AddBusinessCard',0)"); + $this->db->query("insert into vtiger_actionmapping values(8,'Merge',0)"); + $this->db->query("insert into vtiger_actionmapping values(1,'VendorEditView',1)"); + $this->db->query("insert into vtiger_actionmapping values(4,'VendorDetailView',1)"); + $this->db->query("insert into vtiger_actionmapping values(0,'SaveVendor',1)"); + $this->db->query("insert into vtiger_actionmapping values(2,'DeleteVendor',1)"); + $this->db->query("insert into vtiger_actionmapping values(1,'PriceBookEditView',1)"); + $this->db->query("insert into vtiger_actionmapping values(4,'PriceBookDetailView',1)"); + $this->db->query("insert into vtiger_actionmapping values(0,'SavePriceBook',1)"); + $this->db->query("insert into vtiger_actionmapping values(2,'DeletePriceBook',1)"); + $this->db->query("insert into vtiger_actionmapping values(9,'ConvertLead',0)"); + $this->db->query("insert into vtiger_actionmapping values(1,'DetailViewAjax',1)"); + $this->db->query("insert into vtiger_actionmapping values(4,'TagCloud',1)"); + $this->db->query("insert into vtiger_actionmapping values(1,'QuickCreate',1)"); + $this->db->query("insert into vtiger_actionmapping values(3,'Popup',1)"); + $this->db->query("insert into vtiger_actionmapping values(10,'DuplicatesHandling',0)"); + + //Insert values for vtiger_moduleowners vtiger_table which contains the modules and their vtiger_users. default user id admin - after 4.2 patch 2 + $module_array = Array('Potentials','Contacts','Accounts','Leads','Documents','Calendar','Emails','HelpDesk','Products','Faq','Vendors','PriceBooks','Quotes','PurchaseOrder','SalesOrder','Invoice','Reports','Campaigns'); + foreach($module_array as $mod) + { + $this->db->query("insert into vtiger_moduleowners values(".getTabid($mod).",1)"); + } + //added by jeri for category view from db + $this->db->query("insert into vtiger_parenttab values (1,'My Home Page',1,0)"); + $this->db->query("insert into vtiger_parenttab values (2,'Marketing',2,0)"); + $this->db->query("insert into vtiger_parenttab values (3,'Sales',3,0)"); + $this->db->query("insert into vtiger_parenttab values (4,'Support',4,0)"); + $this->db->query("insert into vtiger_parenttab values (5,'Analytics',5,0)"); + $this->db->query("insert into vtiger_parenttab values (6,'Inventory',6,0)"); + $this->db->query("insert into vtiger_parenttab values (7,'Tools',7,0)"); + $this->db->query("insert into vtiger_parenttab values (8,'Settings',8,0)"); + + $this->db->query("insert into vtiger_parenttabrel values (1,9,2)"); + $this->db->query("insert into vtiger_parenttabrel values (1,28,4)"); + $this->db->query("insert into vtiger_parenttabrel values (1,3,1)"); + $this->db->query("insert into vtiger_parenttabrel values (3,7,1)"); + $this->db->query("insert into vtiger_parenttabrel values (3,6,2)"); + $this->db->query("insert into vtiger_parenttabrel values (3,4,3)"); + $this->db->query("insert into vtiger_parenttabrel values (3,2,4)"); + $this->db->query("insert into vtiger_parenttabrel values (3,20,5)"); + $this->db->query("insert into vtiger_parenttabrel values (3,22,6)"); + $this->db->query("insert into vtiger_parenttabrel values (3,23,7)"); + $this->db->query("insert into vtiger_parenttabrel values (3,19,8)"); + $this->db->query("insert into vtiger_parenttabrel values (3,8,9)"); + $this->db->query("insert into vtiger_parenttabrel values (4,13,1)"); + $this->db->query("insert into vtiger_parenttabrel values (4,15,2)"); + $this->db->query("insert into vtiger_parenttabrel values (4,6,3)"); + $this->db->query("insert into vtiger_parenttabrel values (4,4,4)"); + $this->db->query("insert into vtiger_parenttabrel values (4,8,5)"); + $this->db->query("insert into vtiger_parenttabrel values (5,1,2)"); + $this->db->query("insert into vtiger_parenttabrel values (5,25,1)"); + $this->db->query("insert into vtiger_parenttabrel values (6,14,1)"); + $this->db->query("insert into vtiger_parenttabrel values (6,18,2)"); + $this->db->query("insert into vtiger_parenttabrel values (6,19,3)"); + $this->db->query("insert into vtiger_parenttabrel values (6,21,4)"); + $this->db->query("insert into vtiger_parenttabrel values (6,22,5)"); + $this->db->query("insert into vtiger_parenttabrel values (6,20,6)"); + $this->db->query("insert into vtiger_parenttabrel values (6,23,7)"); + $this->db->query("insert into vtiger_parenttabrel values (7,24,1)"); + $this->db->query("insert into vtiger_parenttabrel values (7,27,2)"); + $this->db->query("insert into vtiger_parenttabrel values (7,8,3)"); + $this->db->query("insert into vtiger_parenttabrel values (2,26,1)"); + $this->db->query("insert into vtiger_parenttabrel values (2,6,2)"); + $this->db->query("insert into vtiger_parenttabrel values (2,4,3)"); + $this->db->query("insert into vtiger_parenttabrel values (2,28,4)"); + $this->db->query("insert into vtiger_parenttabrel values (4,28,7)"); + $this->db->query("insert into vtiger_parenttabrel values (2,7,5)"); + $this->db->query("insert into vtiger_parenttabrel values (2,9,6)"); + $this->db->query("insert into vtiger_parenttabrel values (4,9,8)"); + $this->db->query("insert into vtiger_parenttabrel values (2,8,8)"); + $this->db->query("insert into vtiger_parenttabrel values (3,9,11)"); + + //add settings page to database starts + $this->addEntriesForSettings(); + //add settings page to database end + + //Added to populate the default inventory tax informations + $vatid = $this->db->getUniqueID("vtiger_inventorytaxinfo"); + $salesid = $this->db->getUniqueID("vtiger_inventorytaxinfo"); + $serviceid = $this->db->getUniqueID("vtiger_inventorytaxinfo"); + $this->db->query("insert into vtiger_inventorytaxinfo values($vatid,'tax".$vatid."','VAT','4.50','0')"); + $this->db->query("insert into vtiger_inventorytaxinfo values($salesid,'tax".$salesid."','Sales','10.00','0')"); + $this->db->query("insert into vtiger_inventorytaxinfo values($serviceid,'tax".$serviceid."','Service','12.50','0')"); + //After added these taxes we should add these taxes as columns in vtiger_inventoryproductrel table + $this->db->query("alter table vtiger_inventoryproductrel add column tax$vatid decimal(7,3) default NULL"); + $this->db->query("alter table vtiger_inventoryproductrel add column tax$salesid decimal(7,3) default NULL"); + $this->db->query("alter table vtiger_inventoryproductrel add column tax$serviceid decimal(7,3) default NULL"); + + //Added to handle picklist uniqueid for the picklist values + //$this->db->query("insert into vtiger_picklistvalues_seq values(1)"); + + //Added to populate the default Shipping & Hanlding tax informations + $shvatid = $this->db->getUniqueID("vtiger_shippingtaxinfo"); + $shsalesid = $this->db->getUniqueID("vtiger_shippingtaxinfo"); + $shserviceid = $this->db->getUniqueID("vtiger_shippingtaxinfo"); + $this->db->query("insert into vtiger_shippingtaxinfo values($shvatid,'shtax".$shvatid."','VAT','4.50','0')"); + $this->db->query("insert into vtiger_shippingtaxinfo values($shsalesid,'shtax".$shsalesid."','Sales','10.00','0')"); + $this->db->query("insert into vtiger_shippingtaxinfo values($shserviceid,'shtax".$shserviceid."','Service','12.50','0')"); + //After added these taxes we should add these taxes as columns in vtiger_inventoryshippingrel table + $this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shvatid decimal(7,3) default NULL"); + $this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shsalesid decimal(7,3) default NULL"); + $this->db->query("alter table vtiger_inventoryshippingrel add column shtax$shserviceid decimal(7,3) default NULL"); + + //version file is included here because without including this file version cannot be get + include('vtigerversion.php'); + $this->db->query("insert into vtiger_version values(".$this->db->getUniqueID('vtiger_version').",'".$vtiger_current_version."','".$vtiger_current_version."')"); + + //Register default language English + require_once('vtlib/Vtiger/Language.php'); + $vtlanguage = new Vtiger_Language(); + $vtlanguage->register('en_us','US English','English',true,true,true); + + $this->initWebservices(); + + /** + * Setup module sequence numbering. + */ + $modseq = array( + 'Leads' =>'LEA', + 'Accounts' =>'ACC', + 'Campaigns' =>'CAM', + 'Contacts' =>'CON', + 'Potentials'=>'POT', + 'HelpDesk' =>'TT', + 'Quotes' =>'QUO', + 'SalesOrder'=>'SO', + 'PurchaseOrder'=>'PO', + 'Invoice' =>'INV', + 'Products' =>'PRO', + 'Vendors' =>'VEN', + 'PriceBooks'=>'PB', + 'Faq' =>'FAQ', + 'Documents' =>'DOC' + ); + foreach($modseq as $modname => $prefix) { + $this->addInventoryRows( + array( + array('semodule'=>$modname, 'active'=>'1','prefix'=>$prefix,'startid'=>'1','curid'=>'1') + ) + ); + } + + // Adding Sharing Types for Reports + $this->db->query("insert into vtiger_reportfilters values(1,'Private')"); + $this->db->query("insert into vtiger_reportfilters values(2,'Public')"); + $this->db->query("insert into vtiger_reportfilters values(3,'Shared')"); + + require('modules/Utilities/Currencies.php'); + foreach($currencies as $key=>$value){ + $this->db->query("insert into vtiger_currencies values(".$this->db->getUniqueID("vtiger_currencies").",'$key','".$value[0]."','".$value[1]."')"); + } + + } + + function initWebservices(){ + $this->vtws_addEntityInfo(); + $this->vtws_addOperationInfo(); + $this->vtws_addFieldTypeInformation(); + } + + function vtws_addOperationInfo(){ + $operationMeta = array( + "login"=>array( + "include"=>array( + "include/Webservices/Login.php" + ), + "handler"=>"vtws_login", + "params"=>array( + "username"=>"String", + "accessKey"=>"String" + ), + "prelogin"=>1, + "type"=>"POST" + ), + "retrieve"=>array( + "include"=>array( + "include/Webservices/Retrieve.php" + ), + "handler"=>"vtws_retrieve", + "params"=>array( + "id"=>"String" + ), + "prelogin"=>0, + "type"=>"GET" + ), + "create"=>array( + "include"=>array( + "include/Webservices/Create.php" + ), + "handler"=>"vtws_create", + "params"=>array( + "elementType"=>"String", + "element"=>"encoded" + ), + "prelogin"=>0, + "type"=>"POST" + ), + "update"=>array( + "include"=>array( + "include/Webservices/Update.php" + ), + "handler"=>"vtws_update", + "params"=>array( + "element"=>"encoded" + ), + "prelogin"=>0, + "type"=>"POST" + ), + "delete"=>array( + "include"=>array( + "include/Webservices/Delete.php" + ), + "handler"=>"vtws_delete", + "params"=>array( + "id"=>"String" + ), + "prelogin"=>0, + "type"=>"POST" + ), + "sync"=>array( + "include"=>array( + "include/Webservices/GetUpdates.php" + ), + "handler"=>"vtws_sync", + "params"=>array( + "modifiedTime"=>"DateTime", + "elementType"=>"String" + ), + "prelogin"=>0, + "type"=>"GET" + ), + "query"=>array( + "include"=>array( + "include/Webservices/Query.php" + ), + "handler"=>"vtws_query", + "params"=>array( + "query"=>"String" + ), + "prelogin"=>0, + "type"=>"GET" + ), + "logout"=>array( + "include"=>array( + "include/Webservices/Logout.php" + ), + "handler"=>"vtws_logout", + "params"=>array( + "sessionName"=>"String" + ), + "prelogin"=>0, + "type"=>"POST" + ), + "listtypes"=>array( + "include"=>array( + "include/Webservices/ModuleTypes.php" + ), + "handler"=>"vtws_listtypes", + "params"=>array(), + "prelogin"=>0, + "type"=>"GET" + ), + "getchallenge"=>array( + "include"=>array( + "include/Webservices/AuthToken.php" + ), + "handler"=>"vtws_getchallenge", + "params"=>array( + "username"=>"String" + ), + "prelogin"=>1, + "type"=>"GET" + ), + "describe"=>array( + "include"=>array( + "include/Webservices/DescribeObject.php" + ), + "handler"=>"vtws_describe", + "params"=>array( + "elementType"=>"String" + ), + "prelogin"=>0, + "type"=>"GET" + ), + "extendsession"=>array( + "include"=>array( + "include/Webservices/ExtendSession.php" + ), + "handler"=>"vtws_extendSession", + 'params'=>array(), + "prelogin"=>1, + "type"=>"POST" + ), + 'convertlead'=>array( + "include"=>array( + "include/Webservices/ConvertLead.php" + ), + "handler"=>"vtws_convertlead", + "prelogin"=>0, + "type"=>"POST", + 'params'=>array( + 'leadId'=>'String', + 'assignedTo'=>'String', + 'accountName'=>'String', + 'avoidPotential'=>'Boolean', + 'potential'=>'Encoded' + ) + ), + "revise"=>array( + "include"=>array( + "include/Webservices/Revise.php" + ), + "handler"=>"vtws_revise", + "params"=>array( + "element"=>"Encoded" + ), + "prelogin"=>0, + "type"=>"POST" + ) + ); + $createOperationQuery = "insert into vtiger_ws_operation(operationid,name,handler_path,handler_method,type,prelogin) + values (?,?,?,?,?,?);"; + $createOperationParamsQuery = "insert into vtiger_ws_operation_parameters(operationid,name,type,sequence) + values (?,?,?,?);"; + foreach ($operationMeta as $operationName => $operationDetails) { + $operationId = $this->db->getUniqueID("vtiger_ws_operation"); + $result = $this->db->pquery($createOperationQuery,array($operationId,$operationName,$operationDetails['include'], + $operationDetails['handler'],$operationDetails['type'],$operationDetails['prelogin'])); + $params = $operationDetails['params']; + $sequence = 1; + foreach ($params as $paramName => $paramType) { + $result = $this->db->pquery($createOperationParamsQuery,array($operationId,$paramName,$paramType,$sequence++)); + } + } + } + + function vtws_addEntityInfo(){ + require_once 'include/Webservices/Utils.php'; + $names = vtws_getModuleNameList(); + $moduleHandler = array('file'=>'include/Webservices/VtigerModuleOperation.php', + 'class'=>'VtigerModuleOperation'); + + foreach ($names as $tab){ + if(in_array($tab,array('Rss','Webmails','Recyclebin'))){ + continue; + } + $entityId = $this->db->getUniqueID("vtiger_ws_entity"); + $this->db->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', + array($entityId,$tab,$moduleHandler['file'],$moduleHandler['class'],1)); + } + + $entityId = $this->db->getUniqueID("vtiger_ws_entity"); + $this->db->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', + array($entityId,'Events',$moduleHandler['file'],$moduleHandler['class'],1)); + + + $entityId = $this->db->getUniqueID("vtiger_ws_entity"); + $this->db->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', + array($entityId,'Users',$moduleHandler['file'],$moduleHandler['class'],1)); + + vtws_addDefaultActorTypeEntity('Groups',array('fieldNames'=>'groupname', + 'indexField'=>'groupid','tableName'=>'vtiger_groups')); + + require_once("include/Webservices/WebServiceError.php"); + require_once 'include/Webservices/VtigerWebserviceObject.php'; + $webserviceObject = VtigerWebserviceObject::fromName($this->db,'Groups'); + $this->db->pquery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values + (?,?)",array($webserviceObject->getEntityId(),'vtiger_groups')); + + vtws_addDefaultActorTypeEntity('Currency',array('fieldNames'=>'currency_name', + 'indexField'=>'id','tableName'=>'vtiger_currency_info')); + + $webserviceObject = VtigerWebserviceObject::fromName($this->db,'Currency'); + $this->db->pquery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values (?,?)", + array($webserviceObject->getEntityId(),'vtiger_currency_info')); + + vtws_addDefaultActorTypeEntity('DocumentFolders',array('fieldNames'=>'foldername', + 'indexField'=>'folderid','tableName'=>'vtiger_attachmentsfolder')); + $webserviceObject = VtigerWebserviceObject::fromName($this->db,'DocumentFolders'); + $this->db->pquery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values (?,?)", + array($webserviceObject->getEntityId(),'vtiger_attachmentsfolder')); + + } + + function vtws_addFieldTypeInformation(){ + $fieldTypeInfo = array('picklist'=>array(15,16),'text'=>array(19,20,21,24),'autogenerated'=>array(3),'phone'=>array(11), + 'multipicklist'=>array(33),'url'=>array(17),'skype'=>array(85),'boolean'=>array(56,156),'owner'=>array(53), + 'file'=>array(61,28)); + + foreach($fieldTypeInfo as $type=>$uitypes){ + foreach($uitypes as $uitype){ + $result = $this->db->pquery("insert into vtiger_ws_fieldtype(uitype,fieldtype) values(?,?)",array($uitype,$type)); + if(!is_object($result)){ + "Query for fieldtype details($uitype:uitype,$type:fieldtype)"; + } + } + } + + $this->vtws_addReferenceTypeInformation(); + } + + function vtws_addReferenceTypeInformation(){ + $referenceMapping = array("50"=>array("Accounts"),"51"=>array("Accounts"),"57"=>array("Contacts"), + "58"=>array("Campaigns"),"73"=>array("Accounts"),"75"=>array("Vendors"),"76"=>array("Potentials"), + "78"=>array("Quotes"),"80"=>array("SalesOrder"),"81"=>array("Vendors"),"101"=>array("Users"),"52"=>array("Users"), + "357"=>array("Contacts","Accounts","Leads","Users","Vendors"),"59"=>array("Products"), + "66"=>array("Leads","Accounts","Potentials","HelpDesk"),"77"=>array("Users"),"68"=>array("Contacts","Accounts"), + "117"=>array('Currency'),'26'=>array('DocumentFolders'),'10'=>array()); + + foreach($referenceMapping as $uitype=>$referenceArray){ + $success = true; + $result = $this->db->pquery("insert into vtiger_ws_fieldtype(uitype,fieldtype) values(?,?)",array($uitype,"reference")); + if(!is_object($result)){ + $success=false; + } + $result = $this->db->pquery("select * from vtiger_ws_fieldtype where uitype=?",array($uitype)); + $rowCount = $this->db->num_rows($result); + for($i=0;$i<$rowCount;$i++){ + $fieldTypeId = $this->db->query_result($result,$i,"fieldtypeid"); + foreach($referenceArray as $index=>$referenceType){ + $result = $this->db->pquery("insert into vtiger_ws_referencetype(fieldtypeid,type) values(?,?)",array($fieldTypeId,$referenceType)); + if(!is_object($result)){ + echo "failed for: $referenceType, uitype: $fieldTypeId"; + $success=false; + } + } + } + if(!$success){ + echo "Migration Query Failed"; + } + } + + $success = true; + $fieldTypeId = $this->db->getUniqueID("vtiger_ws_entity_fieldtype"); + $result = $this->db->pquery("insert into vtiger_ws_entity_fieldtype(fieldtypeid,table_name,field_name,fieldtype) values(?,?,?,?);", + array($fieldTypeId,'vtiger_attachmentsfolder','createdby',"reference")); + if(!is_object($result)){ + echo "failed fo init
"; + $success=false; + } + $result = $this->db->pquery("insert into vtiger_ws_entity_referencetype(fieldtypeid,type) values(?,?)",array($fieldTypeId,'Users')); + if(!is_object($result)){ + echo "failed for: Users, fieldtypeid: $fieldTypeId"; + $success=false; + } + if(!$success){ + echo "Migration Query Failed"; + } + + } + + function addInventoryRows($paramArray){ + global $adb; + + $fieldCreateCount = 0; + + for($index = 0; $index < count($paramArray); ++$index) { + $criteria = $paramArray[$index]; + + $semodule = $criteria['semodule']; + + $modfocus = CRMEntity::getInstance($semodule); + $modfocus->setModuleSeqNumber('configure', $semodule, $criteria['prefix'], $criteria['startid']); + } + } + + /** + * this function adds the entries for settings page + * it assumes entries as were present on 10-12-208 + */ + function addEntriesForSettings(){ + global $adb; + + //icons for all fields + $icons = array("ico-users.gif", + "ico-roles.gif", + "ico-profile.gif", + "ico-groups.gif", + "shareaccess.gif", + "orgshar.gif", + "audit.gif", + "set-IcoLoginHistory.gif", + "vtlib_modmng.gif", + "picklist.gif", + "ViewTemplate.gif", + "mailmarge.gif", + "notification.gif", + "inventory.gif", + "company.gif", + "ogmailserver.gif", + "backupserver.gif", + "assign.gif", + "currency.gif", + "taxConfiguration.gif", + "system.gif", + "proxy.gif", + "announ.gif", + "set-IcoTwoTabConfig.gif", + "terms.gif", + "settingsInvNumber.gif", + "mailScanner.gif", + "settingsWorkflow.png"); + + //labels for blocks + $blocks = array('LBL_MODULE_MANAGER', + 'LBL_USER_MANAGEMENT', + 'LBL_STUDIO', + 'LBL_COMMUNICATION_TEMPLATES', + 'LBL_OTHER_SETTINGS'); + + //field names + $names = array('LBL_USERS', + 'LBL_ROLES', + 'LBL_PROFILES', + 'USERGROUPLIST', + 'LBL_SHARING_ACCESS', + 'LBL_FIELDS_ACCESS', + 'LBL_AUDIT_TRAIL', + 'LBL_LOGIN_HISTORY_DETAILS', + 'VTLIB_LBL_MODULE_MANAGER', + 'LBL_PICKLIST_EDITOR', + 'EMAILTEMPLATES', + 'LBL_MAIL_MERGE', + 'NOTIFICATIONSCHEDULERS', + 'INVENTORYNOTIFICATION', + 'LBL_COMPANY_DETAILS', + 'LBL_MAIL_SERVER_SETTINGS', + 'LBL_BACKUP_SERVER_SETTINGS', + 'LBL_ASSIGN_MODULE_OWNERS', + 'LBL_CURRENCY_SETTINGS', + 'LBL_TAX_SETTINGS', + 'LBL_SYSTEM_INFO', + 'LBL_PROXY_SETTINGS', + 'LBL_ANNOUNCEMENT', + 'LBL_DEFAULT_MODULE_VIEW', + 'INVENTORYTERMSANDCONDITIONS', + 'LBL_CUSTOMIZE_MODENT_NUMBER', + 'LBL_MAIL_SCANNER', + 'LBL_LIST_WORKFLOWS',); + + + $name_blocks = array('LBL_USERS'=>'LBL_USER_MANAGEMENT', + 'LBL_ROLES'=>'LBL_USER_MANAGEMENT', + 'LBL_PROFILES'=>'LBL_USER_MANAGEMENT', + 'USERGROUPLIST'=>'LBL_USER_MANAGEMENT', + 'LBL_SHARING_ACCESS'=>'LBL_USER_MANAGEMENT', + 'LBL_FIELDS_ACCESS'=>'LBL_USER_MANAGEMENT', + 'LBL_AUDIT_TRAIL'=>'LBL_USER_MANAGEMENT', + 'LBL_LOGIN_HISTORY_DETAILS'=>'LBL_USER_MANAGEMENT', + 'VTLIB_LBL_MODULE_MANAGER'=>'LBL_STUDIO', + 'LBL_PICKLIST_EDITOR'=>'LBL_STUDIO', + 'EMAILTEMPLATES'=>'LBL_COMMUNICATION_TEMPLATES', + 'LBL_MAIL_MERGE'=>'LBL_COMMUNICATION_TEMPLATES', + 'NOTIFICATIONSCHEDULERS'=>'LBL_COMMUNICATION_TEMPLATES', + 'INVENTORYNOTIFICATION'=>'LBL_COMMUNICATION_TEMPLATES', + 'LBL_COMPANY_DETAILS'=>'LBL_COMMUNICATION_TEMPLATES', + 'LBL_MAIL_SERVER_SETTINGS'=>'LBL_OTHER_SETTINGS', + 'LBL_BACKUP_SERVER_SETTINGS'=>'LBL_OTHER_SETTINGS', + 'LBL_ASSIGN_MODULE_OWNERS'=>'LBL_OTHER_SETTINGS', + 'LBL_CURRENCY_SETTINGS'=>'LBL_OTHER_SETTINGS', + 'LBL_TAX_SETTINGS'=>'LBL_OTHER_SETTINGS', + 'LBL_SYSTEM_INFO'=>'LBL_OTHER_SETTINGS', + 'LBL_PROXY_SETTINGS'=>'LBL_OTHER_SETTINGS', + 'LBL_ANNOUNCEMENT'=>'LBL_OTHER_SETTINGS', + 'LBL_DEFAULT_MODULE_VIEW'=>'LBL_OTHER_SETTINGS', + 'INVENTORYTERMSANDCONDITIONS'=>'LBL_OTHER_SETTINGS', + 'LBL_CUSTOMIZE_MODENT_NUMBER'=>'LBL_OTHER_SETTINGS', + 'LBL_MAIL_SCANNER'=>'LBL_OTHER_SETTINGS', + 'LBL_LIST_WORKFLOWS'=>'LBL_OTHER_SETTINGS',); + + + //description for fields + $description = array('LBL_USER_DESCRIPTION', + 'LBL_ROLE_DESCRIPTION', + 'LBL_PROFILE_DESCRIPTION', + 'LBL_GROUP_DESCRIPTION', + 'LBL_SHARING_ACCESS_DESCRIPTION', + 'LBL_SHARING_FIELDS_DESCRIPTION', + 'LBL_AUDIT_DESCRIPTION', + 'LBL_LOGIN_HISTORY_DESCRIPTION', + 'VTLIB_LBL_MODULE_MANAGER_DESCRIPTION', + 'LBL_PICKLIST_DESCRIPTION', + 'LBL_EMAIL_TEMPLATE_DESCRIPTION', + 'LBL_MAIL_MERGE_DESCRIPTION', + 'LBL_NOTIF_SCHED_DESCRIPTION', + 'LBL_INV_NOTIF_DESCRIPTION', + 'LBL_COMPANY_DESCRIPTION', + 'LBL_MAIL_SERVER_DESCRIPTION', + 'LBL_BACKUP_SERVER_DESCRIPTION', + 'LBL_MODULE_OWNERS_DESCRIPTION', + 'LBL_CURRENCY_DESCRIPTION', + 'LBL_TAX_DESCRIPTION', + 'LBL_SYSTEM_DESCRIPTION', + 'LBL_PROXY_DESCRIPTION', + 'LBL_ANNOUNCEMENT_DESCRIPTION', + 'LBL_DEFAULT_MODULE_VIEW_DESC', + 'LBL_INV_TANDC_DESCRIPTION', + 'LBL_CUSTOMIZE_MODENT_NUMBER_DESCRIPTION', + 'LBL_MAIL_SCANNER_DESCRIPTION', + 'LBL_LIST_WORKFLOWS_DESCRIPTION'); + + $links = array('index.php?module=Administration&action=index&parenttab=Settings', + 'index.php?module=Settings&action=listroles&parenttab=Settings', + 'index.php?module=Settings&action=ListProfiles&parenttab=Settings', + 'index.php?module=Settings&action=listgroups&parenttab=Settings', + 'index.php?module=Settings&action=OrgSharingDetailView&parenttab=Settings', + 'index.php?module=Settings&action=DefaultFieldPermissions&parenttab=Settings', + 'index.php?module=Settings&action=AuditTrailList&parenttab=Settings', + 'index.php?module=Settings&action=ListLoginHistory&parenttab=Settings', + 'index.php?module=Settings&action=ModuleManager&parenttab=Settings', + 'index.php?module=PickList&action=PickList&parenttab=Settings', + 'index.php?module=Settings&action=listemailtemplates&parenttab=Settings', + 'index.php?module=Settings&action=listwordtemplates&parenttab=Settings', + 'index.php?module=Settings&action=listnotificationschedulers&parenttab=Settings', + 'index.php?module=Settings&action=listinventorynotifications&parenttab=Settings', + 'index.php?module=Settings&action=OrganizationConfig&parenttab=Settings', + 'index.php?module=Settings&action=EmailConfig&parenttab=Settings', + 'index.php?module=Settings&action=BackupServerConfig&parenttab=Settings', + 'index.php?module=Settings&action=ListModuleOwners&parenttab=Settings', + 'index.php?module=Settings&action=CurrencyListView&parenttab=Settings', + 'index.php?module=Settings&action=TaxConfig&parenttab=Settings', + 'index.php?module=System&action=listsysconfig&parenttab=Settings', + 'index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings', + 'index.php?module=Settings&action=Announcements&parenttab=Settings', + 'index.php?module=Settings&action=DefModuleView&parenttab=Settings', + 'index.php?module=Settings&action=OrganizationTermsandConditions&parenttab=Settings', + 'index.php?module=Settings&action=CustomModEntityNo&parenttab=Settings', + 'index.php?module=Settings&action=MailScanner&parenttab=Settings', + 'index.php?module=com_vtiger_workflow&action=workflowlist&parenttab=Settings',); + + //insert settings blocks + $count = count($blocks); + for($i=0; $i<$count; $i++){ + $adb->query("insert into vtiger_settings_blocks values (".$adb->getUniqueID('vtiger_settings_blocks').", '$blocks[$i]', $i+1)"); + } + + $count = count($icons); + //insert settings fields + for($i=0, $seq=1; $i<$count; $i++, $seq++){ + if($i==8 || $i==12 || $i==18){ + $seq = 1; + } + $adb->query("insert into vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) values (".$adb->getUniqueID('vtiger_settings_field').", ".getSettingsBlockId($name_blocks[$names[$i]]).", '$names[$i]', '$icons[$i]', '$description[$i]', '$links[$i]', $seq)"); + } + + // for Workflow in settings page of every module + $module_manager_id = getSettingsBlockId('LBL_MODULE_MANAGER'); + $result = $adb->pquery("SELECT max(sequence) AS maxseq FROM vtiger_settings_field WHERE blockid = ?",array($module_manager_id)); + $maxseq = $adb->query_result($result,0,'maxseq'); + if($maxseq < 0 || $maxseq == NULL){ + $maxseq=1; + } + $adb->pquery("INSERT INTO vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) VALUES (?,?,?,?,?,?,?)",array($adb->getUniqueID('vtiger_settings_field'), $module_manager_id, 'LBL_WORKFLOW_LIST', 'settingsWorkflow.png', 'LBL_AVAILABLE_WORKLIST_LIST', 'index.php?module=com_vtiger_workflow&action=workflowlist', $maxseq)); + + //hide the system details tab for now + $adb->query("update vtiger_settings_field set active=1 where name='LBL_SYSTEM_INFO'"); + } +} +?> diff --git a/oss/vtiger/trunk/modules/Users/Delete.php b/oss/vtiger/trunk/modules/Users/Delete.php new file mode 100644 index 00000000..18080c31 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Delete.php @@ -0,0 +1,18 @@ +pquery($sql, array($_REQUEST['record'], $_REQUEST['return_id'])); + +if($_REQUEST['return_module'] == 'Calendar') + $mode ='&activity_mode=Events'; + +header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action']).$mode."&record=".vtlib_purify($_REQUEST['return_id'])."&relmodule=".vtlib_purify($_REQUEST['module'])); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DeleteGroup.php b/oss/vtiger/trunk/modules/Users/DeleteGroup.php new file mode 100644 index 00000000..ae1915df --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DeleteGroup.php @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DeleteProfile.php b/oss/vtiger/trunk/modules/Users/DeleteProfile.php new file mode 100644 index 00000000..79d44e67 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DeleteProfile.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DeleteRole.php b/oss/vtiger/trunk/modules/Users/DeleteRole.php new file mode 100644 index 00000000..4ec84d9d --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DeleteRole.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DeleteSharingRule.php b/oss/vtiger/trunk/modules/Users/DeleteSharingRule.php new file mode 100644 index 00000000..fa992271 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DeleteSharingRule.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DeleteUser.php b/oss/vtiger/trunk/modules/Users/DeleteUser.php new file mode 100644 index 00000000..1df65fca --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DeleteUser.php @@ -0,0 +1,28 @@ +pquery($sql15, array($del_id)); + +//if check to delete user from detail view +if(isset($_REQUEST["ajax_delete"]) && $_REQUEST["ajax_delete"] == 'false') + header("Location: index.php?action=ListView&module=Users"); +else + header("Location: index.php?action=UsersAjax&module=Users&file=ListView&ajax=true"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DetailView.php b/oss/vtiger/trunk/modules/Users/DetailView.php new file mode 100644 index 00000000..97be94a9 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DetailView.php @@ -0,0 +1,236 @@ +retrieve_entity_info($_REQUEST['record'],'Users'); + $focus->id = $_REQUEST['record']; +} +else +{ + + echo " + + "; +} + +if( $focus->user_name == "" ) +{ + + if(is_admin($current_user)) + { + echo " + + + + "; + + echo " + + + +
+ User does not exist. +
+ List Users +
+ "; + exit; + } + +} + + +if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { + $focus->id = ""; +} + +global $theme; +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; + +//the user might belong to multiple groups +$log->info("User detail view"); + +$category = getParenttab(); + +$smarty = new vtigerCRM_Smarty; + +$smarty->assign("UMOD", $mod_strings); +global $current_language; +$smod_strings = return_module_language($current_language, 'Settings'); +$smarty->assign("MOD", $smod_strings); + +$smarty->assign("APP", $app_strings); + +$oGetUserGroups = new GetUserGroups(); +$oGetUserGroups->getAllUserGroups($focus->id); +if(useInternalMailer() == 1) + $smarty->assign("INT_MAILER","true"); + +$smarty->assign("GROUP_COUNT",count($oGetUserGroups->user_groups)); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); +$smarty->assign("ID", $focus->id); +$smarty->assign("CATEGORY", $category); +if(isset($focus->imagename) && $focus->imagename!='') +{ + $imagestring="
+
+
+ + +
+

"; + //$smarty->assign("USER_IMAGE",$imagestring); +} + +if(isset($_REQUEST['modechk']) && $_REQUEST['modechk'] != '' ) +{ + $modepref = $_REQUEST['modechk']; +} + if($_REQUEST['modechk'] == 'prefview') + $parenttab = ''; + else + $parenttab = 'Settings'; + +$smarty->assign("PARENTTAB", $parenttab); + +if ((is_admin($current_user) || $_REQUEST['record'] == $current_user->id) + && isset($default_user_name) + && $default_user_name == $focus->user_name + && isset($lock_default_user_name) + && $lock_default_user_name == true ) { + $buttons = ""; + $smarty->assign('EDIT_BUTTON',$buttons); +} +elseif (is_admin($current_user) || $_REQUEST['record'] == $current_user->id) { + $buttons = ""; + $smarty->assign('EDIT_BUTTON',$buttons); + + $buttons = ""; + $smarty->assign('CHANGE_PW_BUTTON',$buttons); + + +} +if (is_admin($current_user)) +{ + $buttons = ""; + $smarty->assign('DUPLICATE_BUTTON',$buttons); + + //done so that only the admin user can see the customize tab button + if($_REQUEST['record'] != $current_user->id) + { + $buttons = "id')\" type='button' name='Delete' value=' ".$app_strings['LBL_DELETE_BUTTON_LABEL']." '>"; + $smarty->assign('DELETE_BUTTON',$buttons); + } + + if($_SESSION['authenticated_user_roleid'] == 'administrator') + { + $buttons = ""; + $smarty->assign('LISTROLES_BUTTON',$buttons); + } + +} + +if(is_admin($current_user)) + $smarty->assign("IS_ADMIN", true); +else + $smarty->assign("IS_ADMIN", false); + +$lead_tables = Array('vtiger_users','vtiger_user2role'); +$tabid = getTabid("Users"); +$validationData = getDBValidationData($lead_tables,$tabid); +$data = split_validationdataArray($validationData); + +if($current_user->id == $_REQUEST['record'] || is_admin($current_user) == true) +{ +$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']); +$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']); +$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']); +$smarty->assign("MODULE", 'Users'); +$smarty->assign("CURRENT_USERID", $current_user->id); +$smarty->assign("HOMEORDER",$focus->getHomeStuffOrder($focus->id)); +//Added to provide User based Tagcloud +$smarty->assign("TAGCLOUDVIEW",getTagCloudView($focus->id)); +$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields)); +$smarty->assign("USERNAME",$focus->last_name.' '.$focus->first_name); +$smarty->assign("HOUR_FORMAT",$focus->hour_format); +$smarty->assign("START_HOUR",$focus->start_hour); +$_SESSION['Users_FORM_TOKEN'] = rand(5, 2000) * rand(2, 7); +$smarty->assign('FORM_TOKEN', $_SESSION['Users_FORM_TOKEN']); + +//for check audittrail if it is enable or not +$smarty->assign("AUDITTRAIL",$audit_trail); + +$smarty->display("UserDetailView.tpl"); +} +else +{ + $output = ' + +
+
+ + + + + + + + +
+ + + '.$app_strings["LBL_PERMISSION"].' + +
+ '.$app_strings["LBL_GO_BACK"].' +
+
+
+
'; + echo $output; +} + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/DetailViewAjax.php b/oss/vtiger/trunk/modules/Users/DetailViewAjax.php new file mode 100644 index 00000000..796c08ea --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/DetailViewAjax.php @@ -0,0 +1,68 @@ +retrieve_entity_info($userid,"Users"); + $userObj->column_fields[$fieldname] = $fieldvalue; + + if($fieldname=='asterisk_extension'){ + $query = "select 1 from vtiger_asteriskextensions + inner join vtiger_users on vtiger_users.id=vtiger_asteriskextensions.userid + where status='Active' and asterisk_extension =?"; + $params = array($fieldvalue); + + $result = $adb->pquery($query, $params); + if($adb->num_rows($result) > 0) + { + echo ":#:ERR".$mod_strings['LBL_ASTERISKEXTENSIONS_EXIST']; + return false; + } + } + if($fieldname == 'internal_mailer'){ + + if(isset($_SESSION['internal_mailer']) && $_SESSION['internal_mailer'] != $userObj->column_fields['internal_mailer']) + $_SESSION['internal_mailer'] = $userObj->column_fields['internal_mailer']; + } + $userObj->id = $userid; + $userObj->mode = "edit"; + $userObj->save("Users"); + if($userObj->id != "") + { + echo ":#:SUCCESS"; + }else + { + echo ":#:FAILURE"; + } + }else + { + echo ":#:FAILURE"; + } +} +?> diff --git a/oss/vtiger/trunk/modules/Users/EditView.php b/oss/vtiger/trunk/modules/Users/EditView.php new file mode 100644 index 00000000..f494c89d --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/EditView.php @@ -0,0 +1,127 @@ +assign("ID",vtlib_purify($_REQUEST['record'])); + $mode='edit'; + if (!is_admin($current_user) && $_REQUEST['record'] != $current_user->id) die ("Unauthorized access to user administration."); + $focus->retrieve_entity_info($_REQUEST['record'],'Users'); + $smarty->assign("USERNAME",$focus->last_name.' '.$focus->first_name); +}else +{ + $mode='create'; +} + +if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { + $focus->id = ""; + $focus->user_name = ""; + $mode='create'; + + //When duplicating the user the password fields should be empty + $focus->column_fields['user_password']=''; + $focus->column_fields['confirm_password']=''; +} + +global $theme; +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; + +$log->info("User edit view"); + + +$smarty->assign("JAVASCRIPT", get_validate_record_js()); +$smarty->assign("UMOD", $mod_strings); +global $current_language; +$smod_strings = return_module_language($current_language,'Settings'); +$smarty->assign("MOD", $smod_strings); +$smarty->assign("CURRENT_USERID", $current_user->id); +$smarty->assign("APP", $app_strings); + +if (isset($_REQUEST['error_string'])) $smarty->assign("ERROR_STRING", "Error: ".vtlib_purify($_REQUEST['error_string']).""); +if (isset($_REQUEST['return_module'])) +{ + $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module'])); + $RETURN_MODULE=vtlib_purify($_REQUEST['return_module']); +} +if (isset($_REQUEST['return_action'])) +{ + $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action'])); + $RETURN_ACTION = vtlib_purify($_REQUEST['return_action']); +} +if ($_REQUEST['isDuplicate'] != 'true' && isset($_REQUEST['return_id'])) +{ + $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id'])); + $RETURN_ID = vtlib_purify($_REQUEST['return_id']); +} +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path);$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); +$focus->mode = $mode; +$disp_view = getView($focus->mode); +$smarty->assign("IMAGENAME",$focus->imagename); +$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields)); +$smarty->assign("MODULE", 'Settings'); +$smarty->assign("MODE",$focus->mode); +$smarty->assign("HOUR_FORMAT",$focus->hour_format); +$smarty->assign("START_HOUR",$focus->start_hour); +if ($_REQUEST['Edit'] == ' Edit ') +{ + $smarty->assign("READONLY", "readonly"); + $smarty->assign("USERNAME_READONLY", "readonly"); + +} +if(isset($_REQUEST['record']) && $_REQUEST['isDuplicate'] != 'true') +{ + $smarty->assign("USERNAME_READONLY", "readonly"); +} + +$smarty->assign("HOMEORDER",$focus->getHomeStuffOrder($focus->id)); +//Added to provide User based Tagcloud +if($mode == 'create') $smarty->assign("TAGCLOUDVIEW","true"); // While creating user select tag cloud by default +else $smarty->assign("TAGCLOUDVIEW",getTagCloudView($focus->id)); + +$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate'])); +$smarty->assign("USER_MODE",$mode); +$smarty->assign('PARENTTAB', getParentTab()); +$_SESSION['Users_FORM_TOKEN'] = rand(5, 2000) * rand(2, 7); +$smarty->assign('FORM_TOKEN', $_SESSION['Users_FORM_TOKEN']); + +$smarty->display('UserEditView.tpl'); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/Error.php b/oss/vtiger/trunk/modules/Users/Error.php new file mode 100644 index 00000000..3efa01ce --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Error.php @@ -0,0 +1,26 @@ + +

+ +

+ +
+ diff --git a/oss/vtiger/trunk/modules/Users/Forms.php b/oss/vtiger/trunk/modules/Users/Forms.php new file mode 100644 index 00000000..20f46458 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Forms.php @@ -0,0 +1,227 @@ +query($sql); + $count = $adb->num_rows($result); + + if($count > 0){ + return "true"; + }else{ + return "false"; + } +} + +/** + * this function gets the asterisk extensions assigned in vtiger + */ +function getAsteriskExtensions(){ + global $adb, $current_user; + + $sql = "SELECT * FROM vtiger_asteriskextensions + INNER JOIN vtiger_users ON vtiger_users.id = vtiger_asteriskextensions.userid + AND vtiger_users.deleted=0 AND status = 'Active'"; + $result = $adb->pquery($sql, array()); + $count = $adb->num_rows($result); + $data = array(); + + for($i=0;$i<$count;$i++){ + $user = $adb->query_result($result, $i, "userid"); + $extension = $adb->query_result($result, $i, "asterisk_extension"); + if(!empty($extension)){ + $data[$user] = $extension; + } + } + return $data; +} + +/** + * Create javascript to validate the data entered into a record. + * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. + * All Rights Reserved. + * Contributor(s): ______________________________________.. + */ +function get_validate_record_js () { +global $mod_strings; +global $app_strings, $current_user; + +$lbl_last_name = $mod_strings['LBL_LIST_LAST_NAME']; +$lbl_user_name = $mod_strings['LBL_LIST_USER_NAME']; +$lbl_role_name = $mod_strings['LBL_ROLE_NAME']; +$lbl_new_password = $mod_strings['LBL_LIST_PASSWORD']; +$lbl_confirm_new_password = $mod_strings['LBL_LIST_CONFIRM_PASSWORD']; +$lbl_user_email1 = $mod_strings['LBL_LIST_EMAIL']; +$err_missing_required_fields = $app_strings['ERR_MISSING_REQUIRED_FIELDS']; +$err_invalid_email_address = $app_strings['ERR_INVALID_EMAIL_ADDRESS']; +$err_invalid_yahoo_email_address = $app_strings['ERR_INVALID_YAHOO_EMAIL_ADDRESS']; +$lbl_user_image=$mod_strings['User Image']; +$the_emailid = $app_strings['THE_EMAILID']; +$email_field_is = $app_strings['EMAIL_FILED_IS'].$err_invalid_email_address; +$other_email_field_is = $app_strings['OTHER_EMAIL_FILED_IS'].$err_invalid_email_address; +$yahoo_email_field_is = $app_strings['YAHOO_EMAIL_FILED_IS'].$err_invalid_yahoo_email_address; +$lbl_asterisk_details_not_set = $app_strings['LBL_ASTERISK_SET_ERROR']; + +//check asteriskdetails start +$checkAsteriskDetails = checkAsteriskDetails(); +// Fix : 6362 +$record = ($_REQUEST['record'])?$_REQUEST['record']:'false';// used to check the asterisk extension in edit mode + $mode = ($_REQUEST['isDuplicate'] == 'true')?'true':'false'; + $extensions = getAsteriskExtensions(); +$extensions_list = Zend_Json::encode($extensions); +//check asteriskdetails end + +$the_script = << + + +EOQ; + +return $the_script; +} + +?> diff --git a/oss/vtiger/trunk/modules/Users/GroupDeleteStep1.php b/oss/vtiger/trunk/modules/Users/GroupDeleteStep1.php new file mode 100644 index 00000000..1c4b034e --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/GroupDeleteStep1.php @@ -0,0 +1,119 @@ + +
+ + + + + + + + +
'.$mod_strings['LBL_DELETE_GROUP'].''.$app_strings[
+ + + + +
+ + + + + + + + + +
'.$mod_strings['LBL_DELETE_GROUPNAME'].''.htmlentities($delete_group_name,ENT_QUOTES,$default_charset).'
'.$mod_strings['LBL_TRANSFER_GROUP'].''; + global $adb; + $sql = "select groupid,groupname from vtiger_groups"; + $result = $adb->pquery($sql, array()); + $num_groups = $adb->num_rows($result); + + $sql1 = "select id,user_name from vtiger_users where deleted=0"; + $result1= $adb->pquery($sql1, array()); + $num_users = $adb->num_rows($result1); + + + $output.= ' User'; + if($num_groups > 1) + { + $output .= ' Group'; + } + + $output .= ''; + + $output .= ''; + + if($num_groups > 1) + { + $output .= ''; + } + + $output.='
+
+ + + + +
+
+
'; + +echo $output; +?> diff --git a/oss/vtiger/trunk/modules/Users/ListView.php b/oss/vtiger/trunk/modules/Users/ListView.php new file mode 100644 index 00000000..ec2c5d80 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/ListView.php @@ -0,0 +1,125 @@ +is_admin != 'on') +{ + die("

".$app_strings['LBL_PERMISSION']." ".$app_strings['LBL_GO_BACK'].".
"); +} + +$log = LoggerManager::getLogger('user_list'); + +global $mod_strings,$adb; +global $theme; +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; +global $current_language; +$mod_strings = return_module_language($current_language,'Users'); +$category = getParentTab(); +$focus = new Users(); +$no_of_users=UserCount(); + +//Display the mail send status +$smarty = new vtigerCRM_Smarty; +if($_REQUEST['mail_error'] != '') +{ + require_once("modules/Emails/mail.php"); + $error_msg = strip_tags(parseEmailErrorString($_REQUEST['mail_error'])); + $error_msg = $app_strings['LBL_MAIL_NOT_SENT_TO_USER']. ' ' . vtlib_purify($_REQUEST['user']). '. ' .$app_strings['LBL_PLS_CHECK_EMAIL_N_SERVER']; + $smarty->assign("ERROR_MSG",$mod_strings['LBL_MAIL_SEND_STATUS'].' '.$error_msg.''); +} + +$list_query = getListQuery("Users"); + +//Postgres 8 fixes +if( $adb->dbType == "pgsql") + $list_query = fixPostgresQuery($list_query, $log, 0); + +$userid = array(); +$userid_Query = "SELECT id,user_name FROM vtiger_users WHERE user_name IN ('admin')"; +$users = $adb->pquery($userid_Query,array()); +$norows = $adb->num_rows($users); +if($norows > 0){ + for($i=0;$i<$norows ;$i++){ + $id = $adb->query_result($users,$i,'id'); + $userid[$id] = $adb->query_result($users,$i,'user_name'); + } +} +$smarty->assign("USERNODELETE",$userid); + +if(!$_SESSION['lvs'][$currentModule]) { + unset($_SESSION['lvs']); + $modObj = new ListViewSession(); + $modObj->sorder = $sorder; + $modObj->sortby = $order_by; + $_SESSION['lvs'][$currentModule] = get_object_vars($modObj); +} + +if($_REQUEST['sorder'] !='') + $sorder = $adb->sql_escape_string($_REQUEST['sorder']); +else + $sorder = $focus->getSortOrder(); +$_SESSION['USERS_SORT_ORDER'] = $sorder; + +if($_REQUEST['order_by'] != '') + $order_by = $adb->sql_escape_string($_REQUEST['order_by']); +else + $order_by = $focus->getOrderBy(); +$_SESSION['USERS_ORDER_BY'] = $order_by; + +if(!empty($order_by)){ + $list_query .= ' ORDER BY '.$order_by.' '.$sorder; +} + +if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){ + $count_result = $adb->query( mkCountQuery($list_query)); + $noofrows = $adb->query_result($count_result,0,"count"); +}else{ + $noofrows = null; +} +$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true'); +$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, '', $queryMode); + +$navigation_array = VT_getSimpleNavigationValues($start,$list_max_entries_per_page,$noofrows); + +$limit_start_rec = ($start-1) * $list_max_entries_per_page; + +if( $adb->dbType == "pgsql") + $list_result = $adb->pquery($list_query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array()); +else + $list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array()); + +$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows); +$smarty->assign('recordListRange',$recordListRangeMsg); + +$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"Users","index",''); +$smarty->assign("MOD", return_module_language($current_language,'Settings')); +$smarty->assign("CMOD", $mod_strings); +$smarty->assign("APP", $app_strings); +$smarty->assign("CURRENT_USERID", $current_user->id); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("CATEGORY",$category); +$smarty->assign("LIST_HEADER",getListViewHeader($focus,"Users",$url_string,$sorder,$order_by,"","")); +$smarty->assign("LIST_ENTRIES",getListViewEntries($focus,"Users",$list_result,$navigation_array,"","","EditView","Delete","")); +$smarty->assign("PAGE_START_RECORD",$limit_start_rec); +$smarty->assign("RECORD_COUNTS", $record_string); +$smarty->assign("NAVIGATION", $navigationOutput); +$smarty->assign("USER_IMAGES",getUserImageNames()); +if($_REQUEST['ajax'] !='') + $smarty->display("UserListViewContents.tpl"); +else + $smarty->display("UserListView.tpl"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/ListViewPagging.php b/oss/vtiger/trunk/modules/Users/ListViewPagging.php new file mode 100644 index 00000000..333f1768 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/ListViewPagging.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/Login.php b/oss/vtiger/trunk/modules/Users/Login.php new file mode 100644 index 00000000..7978f6c3 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Login.php @@ -0,0 +1,197 @@ + + + + + + +

+
+ + + + +
+ + + + + + + + + + + +
vtiger CRMThe honest Open Source CRM
+ + + + + +
+
+ + + + + + + + + + + +
<?php echo $app_strings['LBL_SIGN_IN']?>
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
 
+

+
+
+
+
diff --git a/oss/vtiger/trunk/modules/Users/LoginHistory.php b/oss/vtiger/trunk/modules/Users/LoginHistory.php new file mode 100644 index 00000000..e2a9b697 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/LoginHistory.php @@ -0,0 +1,211 @@ +log = LoggerManager::getLogger('loginhistory'); + $this->db = PearDatabase::getInstance(); + } + + var $sortby_fields = Array('user_name', 'user_ip', 'login_time', 'logout_time', 'status'); + + // This is the list of vtiger_fields that are in the lists. + var $list_fields = Array( + 'User Name'=>Array('vtiger_loginhistory'=>'user_name'), + 'User IP'=>Array('vtiger_loginhistory'=>'user_ip'), + 'Signin Time'=>Array('vtiger_loginhistory'=>'login_time'), + 'Signout Time'=>Array('vtiger_loginhistory'=>'logout_time'), + 'Status'=>Array('vtiger_loginhistory'=>'status'), + ); + + var $list_fields_name = Array( + 'User Name'=>'user_name', + 'User IP'=>'user_ip', + 'Signin Time'=>'login_time', + 'Signout Time'=>'logout_time', + 'Status'=>'status' + ); + var $default_order_by = "login_time"; + var $default_sort_order = 'DESC'; + +/** + * Function to get the Header values of Login History. + * Returns Header Values like UserName, IP, LoginTime etc in an array format. +**/ + function getHistoryListViewHeader() + { + global $log; + $log->debug("Entering getHistoryListViewHeader method ..."); + global $app_strings; + + $header_array = array($app_strings['LBL_LIST_USER_NAME'], $app_strings['LBL_LIST_USERIP'], $app_strings['LBL_LIST_SIGNIN'], $app_strings['LBL_LIST_SIGNOUT'], $app_strings['LBL_LIST_STATUS']); + + $log->debug("Exiting getHistoryListViewHeader method ..."); + return $header_array; + + } + +/** + * Function to get the Login History values of the User. + * @param $navigation_array - Array values to navigate through the number of entries. + * @param $sortorder - DESC + * @param $orderby - login_time + * Returns the login history entries in an array format. +**/ + function getHistoryListViewEntries($username, $navigation_array, $sorder='', $orderby='') + { + global $log; + $log->debug("Entering getHistoryListViewEntries() method ..."); + global $adb, $current_user; + + if($sorder != '' && $order_by != '') + $list_query = "Select * from vtiger_loginhistory where user_name=? order by ".$order_by." ".$sorder; + else + $list_query = "Select * from vtiger_loginhistory where user_name=? order by ".$this->default_order_by." ".$this->default_sort_order; + + $result = $adb->pquery($list_query, array($username)); + $entries_list = array(); + + if($navigation_array['end_val'] != 0) + { + for($i = $navigation_array['start']; $i <= $navigation_array['end_val']; $i++) + { + $entries = array(); + $loginid = $adb->query_result($result, $i-1, 'login_id'); + + $entries[] = $adb->query_result($result, $i-1, 'user_name'); + $entries[] = $adb->query_result($result, $i-1, 'user_ip'); + $entries[] = $adb->query_result($result, $i-1, 'login_time'); + $entries[] = $adb->query_result($result, $i-1, 'logout_time'); + $entries[] = $adb->query_result($result, $i-1, 'status'); + + $entries_list[] = $entries; + } + $log->debug("Exiting getHistoryListViewEntries() method ..."); + return $entries_list; + } + } + + /** Function that Records the Login info of the User + * @param ref variable $usname :: Type varchar + * @param ref variable $usip :: Type varchar + * @param ref variable $intime :: Type timestamp + * Returns the query result which contains the details of User Login Info + */ + function user_login(&$usname,&$usip,&$intime) + { + global $adb; + //Kiran: Setting logout time to '0000-00-00 00:00:00' instead of null + $query = "Insert into vtiger_loginhistory (user_name, user_ip, logout_time, login_time, status) values (?,?,?,?,?)"; + $params = array($usname,$usip,'0000-00-00 00:00:00', $this->db->formatDate($intime, true),'Signed in'); + $result = $adb->pquery($query, $params) + or die("MySQL error: ".mysql_error()); + + return $result; + } + + /** Function that Records the Logout info of the User + * @param ref variable $usname :: Type varchar + * @param ref variable $usip :: Type varchar + * @param ref variable $outime :: Type timestamp + * Returns the query result which contains the details of User Logout Info + */ + function user_logout(&$usname,&$usip,&$outtime) + { + global $adb; + $logid_qry = "SELECT max(login_id) AS login_id from vtiger_loginhistory where user_name=? and user_ip=?"; + $result = $adb->pquery($logid_qry, array($usname, $usip)); + $loginid = $adb->query_result($result,0,"login_id"); + if ($loginid == '') + { + return; + } + // update the user login info. + $query = "Update vtiger_loginhistory set logout_time =?, status=? where login_id = ?"; + $result = $adb->pquery($query, array($this->db->formatDate($outtime, true), 'Signed off', $loginid)) + or die("MySQL error: ".mysql_error()); + } + + /** Function to create list query + * @param reference variable - order by is passed when the query is executed + * @param reference variable - where condition is passed when the query is executed + * Returns Query. + */ + function create_list_query(&$order_by, &$where) + { + // Determine if the vtiger_account name is present in the where clause. + global $current_user, $adb; + $query = "SELECT user_name,user_ip, status, + ".$this->db->getDBDateString("login_time")." AS login_time, + ".$this->db->getDBDateString("logout_time")." AS logout_time + FROM ".$this->table_name; + if($where != "") + { + if(!is_admin($current_user)) + $where .=" AND user_name = '". $adb->sql_escape_string($current_user->user_name) ."'"; + $query .= " WHERE ($where)"; + } + else + { + if(!is_admin($current_user)) + $query .= " WHERE user_name = '". $adb->sql_escape_string($current_user->user_name) ."'"; + } + + if(!empty($order_by)) + $query .= " ORDER BY ". $adb->sql_escape_string($order_by); + + return $query; + } + +} + + + +?> diff --git a/oss/vtiger/trunk/modules/Users/Logout.php b/oss/vtiger/trunk/modules/Users/Logout.php new file mode 100644 index 00000000..f3046389 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Logout.php @@ -0,0 +1,53 @@ +backup(); +} +// Recording Logout Info + $usip=$_SERVER['REMOTE_ADDR']; + $outtime=date("Y/m/d H:i:s"); + $loghistory=new LoginHistory(); + $loghistory->user_logout($current_user->user_name,$usip,$outtime); + + +$local_log =& LoggerManager::getLogger('Logout'); + +// clear out the autthenticating flag +session_destroy(); + +define("IN_LOGIN", true); + +// go to the login screen. +header("Location: index.php?action=Login&module=Users"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/OrgSharingEditView.php b/oss/vtiger/trunk/modules/Users/OrgSharingEditView.php new file mode 100644 index 00000000..cbf1765b --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/OrgSharingEditView.php @@ -0,0 +1,73 @@ + $def_perr) +{ + $entity_name = getTabname($tab_id); + if($tab_id == 6) + { + $cont_name = getTabname(4); + $entity_name .= ' & '.$cont_name; + } + $defActionArr=getModuleSharingActionArray($tab_id); + + $entries[] = $entity_name; + + if($tab_id != 6) + { + $output = ''; + } + $entries[] = $tab_id; + + foreach($defActionArr as $shareActId=>$shareActName) + { + $selected=''; + if($shareActId == $def_perr) + { + $selected='selected'; + } + $output .= ''; + + } + + + $output .= ''; + $entries[] = $output; + $row++; +} + +$list_entries=array_chunk($entries,3); +$smarty->assign("ORGINFO",$list_entries); +$smarty->assign("MOD", return_module_language($current_language,'Settings')); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("APP", $app_strings); +$smarty->assign("CMOD", $mod_strings); + +$smarty->display("OrgSharingEditView.tpl"); +?> diff --git a/oss/vtiger/trunk/modules/Users/Popup.php b/oss/vtiger/trunk/modules/Users/Popup.php new file mode 100644 index 00000000..88877b45 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Popup.php @@ -0,0 +1,20 @@ + diff --git a/oss/vtiger/trunk/modules/Users/ProfileDeleteStep1.php b/oss/vtiger/trunk/modules/Users/ProfileDeleteStep1.php new file mode 100644 index 00000000..d9d717cb --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/ProfileDeleteStep1.php @@ -0,0 +1,75 @@ + +
+ + + + + + + + +
'.$mod_strings["LBL_DELETE_PROFILE"].''.$app_strings[
+ + + + +
+ + + + + + + + + +
'.$mod_strings["LBL_PROFILE_TO_BE_DELETED"].''.htmlentities($delete_prof_name,ENT_QUOTES,$default_charset).'
'.$mod_strings["LBL_TRANSFER_ROLES_TO_PROFILE"].''; + $output.=''; + + $output.='
+
+ + + + +
+ +
+
'; + +echo $output; +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/RecalculateSharingRules.php b/oss/vtiger/trunk/modules/Users/RecalculateSharingRules.php new file mode 100644 index 00000000..bbf2ea7e --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/RecalculateSharingRules.php @@ -0,0 +1,18 @@ + diff --git a/oss/vtiger/trunk/modules/Users/RenameProfile.php b/oss/vtiger/trunk/modules/Users/RenameProfile.php new file mode 100644 index 00000000..3f18c6f1 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/RenameProfile.php @@ -0,0 +1,25 @@ +pquery($query, array($profilename, $profileDesc, $profileid)); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/RoleDragDrop.php b/oss/vtiger/trunk/modules/Users/RoleDragDrop.php new file mode 100644 index 00000000..ec6f96d9 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/RoleDragDrop.php @@ -0,0 +1,64 @@ +pquery($query, array($toid)); +$parentRoleList=$adb->query_result($result,0,'parentrole'); +$replace_with=$parentRoleList; +$orgDepth=$adb->query_result($result,0,'depth'); + +//echo 'replace with is '.$replace_with; +//echo '
org depth '.$orgDepth; +$parentRoles=explode('::',$parentRoleList); + +if(in_array($fromid,$parentRoles)) +{ + echo $mod_strings['ROLE_DRAG_ERR_MSG']; + die; +} + + +$roleInfo=getRoleAndSubordinatesInformation($fromid); + +$fromRoleInfo=$roleInfo[$fromid]; +$replaceToStringArr=explode('::'.$fromid,$fromRoleInfo[1]); +$replaceToString=$replaceToStringArr[0]; +//echo '
to be replaced string '.$replaceToString; + + +$stdDepth=$fromRoleInfo['2']; +//echo '
std depth '.$stdDepth; + +//Constructing the query +foreach($roleInfo as $mvRoleId=>$mvRoleInfo) +{ + $subPar=explode($replaceToString,$mvRoleInfo[1],2);//we have to spilit as two elements only + $mvParString=$replace_with.$subPar[1]; + $subDepth=$mvRoleInfo[2]; + $mvDepth=$orgDepth+(($subDepth-$stdDepth)+1); + $query="update vtiger_role set parentrole=?,depth=? where roleid=?"; + //echo $query; + $adb->pquery($query, array($mvParString, $mvDepth, $mvRoleId)); + + // Invalidate any cached information + VTCacheUtils::clearRoleSubordinates($roleId); +} + + + +header("Location: index.php?action=SettingsAjax&module=Settings&file=listroles&ajax=true"); +?> diff --git a/oss/vtiger/trunk/modules/Users/RolePopup.php b/oss/vtiger/trunk/modules/Users/RolePopup.php new file mode 100644 index 00000000..3ccb432f --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/RolePopup.php @@ -0,0 +1,160 @@ +pquery($hquery, array()); +$num_rows = $adb->num_rows($hr_res); +$hrarray= Array(); + +for($l=0; $l<$num_rows; $l++) +{ + $roleid = $adb->query_result($hr_res,$l,'roleid'); + $parent = $adb->query_result($hr_res,$l,'parentrole'); + $temp_list = explode('::',$parent); + $size = sizeof($temp_list); + $i=0; + $k= Array(); + $y=$hrarray; + if(sizeof($hrarray) == 0) + { + $hrarray[$temp_list[0]]= Array(); + } + else + { + while($i<$size-1) + { + $y=$y[$temp_list[$i]]; + $k[$temp_list[$i]] = $y; + $i++; + + } + $y[$roleid] = Array(); + $k[$roleid] = Array(); + + //Reversing the Array + $rev_temp_list=array_reverse($temp_list); + $j=0; + //Now adding this into the main array + foreach($rev_temp_list as $value) + { + if($j == $size-1) + { + $hrarray[$value]=$k[$value]; + } + else + { + $k[$rev_temp_list[$j+1]][$value]=$k[$value]; + } + $j++; + } + } + +} +//Constructing the Roledetails array +$role_det = getAllRoleDetails(); +$query = "select * from vtiger_role"; +$result = $adb->pquery($query, array()); +$num_rows=$adb->num_rows($result); +$mask_roleid=Array(); +$del_roleid=$_REQUEST['maskid']; +if($del_roleid != '' && strlen($del_roleid) >0) +{ + $mask_roleid= getRoleAndSubordinatesRoleIds($del_roleid); +} +$roleout =''; +$roleout .= indent($hrarray,$roleout,$role_det,$mask_roleid); + +/** recursive function to construct the role tree ui + * @param $hrarray -- Hierarchial role tree array with only the roleid:: Type array + * @param $roleout -- html string ouput of the constucted role tree ui:: Type varchar + * @param $role_det -- Roledetails array got from calling getAllRoleDetails():: Type array + * @param $mask_roleid -- role id to be masked from selecting in the tree:: Type integer + * @returns $role_out -- html string ouput of the constucted role tree ui:: Type string + * + */ +function indent($hrarray,$roleout,$role_det,$mask_roleid='') +{ + global $theme,$app_strings,$default_charset; + $theme_path="themes/".$theme."/"; + $image_path=$theme_path."images/"; + foreach($hrarray as $roleid => $value) + { + + //retreiving the vtiger_role details + $role_det_arr=$role_det[$roleid]; + $roleid_arr=$role_det_arr[2]; + $rolename = htmlentities($role_det_arr[0],ENT_QUOTES,$default_charset); + $roledepth = $role_det_arr[1]; + $roleout .= ''; + + } + + return $roleout; +} +$smarty->assign("THEME",$theme_path); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("APP", $app_strings); +$smarty->assign("CMOD", $mod_strings); +$smarty->assign("ROLETREE", $roleout); +$smarty->display("RolePopup.tpl"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/Save.php b/oss/vtiger/trunk/modules/Users/Save.php new file mode 100644 index 00000000..105c7a43 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Save.php @@ -0,0 +1,234 @@ +pquery($user_query, array($user_name)); + $group_query = "SELECT groupname FROM vtiger_groups WHERE groupname =?"; + $group_result = $adb->pquery($group_query, array($user_name)); + + if($adb->num_rows($user_result) > 0) { + echo $mod_strings['LBL_USERNAME_EXIST']; + die; + } elseif($adb->num_rows($group_result) > 0) { + echo $mod_strings['LBL_GROUPNAME_EXIST']; + die; + } else { + echo 'SUCCESS'; + die; + } +} +if((empty($_SESSION['Users_FORM_TOKEN']) || $_SESSION['Users_FORM_TOKEN'] + !== (int)$_REQUEST['form_token']) && $_REQUEST['deleteImage'] != 'true' && + $_REQUEST['changepassword'] != 'true') { + header("Location: index.php?action=Error&module=Users&error_string=". + urlencode($app_strings['LBL_PERMISSION'])); + die; +} + +if (isset($_POST['record']) && !is_admin($current_user) && $_POST['record'] != $current_user->id) echo ("Unauthorized access to user administration."); +elseif (!isset($_POST['record']) && !is_admin($current_user)) echo ("Unauthorized access to user administration."); + +$focus = new Users(); +if(isset($_REQUEST["record"]) && $_REQUEST["record"] != '') +{ + $focus->mode='edit'; + $focus->id = $_REQUEST["record"]; +} +else +{ + $focus->mode=''; +} + + +if($_REQUEST['deleteImage'] == 'true') { + $focus->id = $_REQUEST['recordid']; + $focus->deleteImage(); + echo "SUCCESS"; + exit; +} + +if($_REQUEST['changepassword'] == 'true') +{ + $focus->retrieve_entity_info($_REQUEST['record'],'Users'); + $focus->id = $_REQUEST['record']; +if (isset($_POST['new_password'])) { + $new_pass = $_POST['new_password']; + $new_passwd = $_POST['new_password']; + $new_pass = md5($new_pass); + $old_pass = $_POST['old_password']; + $uname = $_POST['user_name']; + if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) { + + header("Location: index.php?action=Error&module=Users&error_string=".urlencode($focus->error_string)); + exit; +} +} + +} + + +//save user Image +if(! $_REQUEST['changepassword'] == 'true') +{ + if(strtolower($current_user->is_admin) == 'off' && $current_user->id != $focus->id) + { + $log->fatal("SECURITY:Non-Admin ". $current_user->id . " attempted to change settings for user:". $focus->id); + header("Location: index.php?module=Users&action=Logout"); + exit; + } + if(strtolower($current_user->is_admin) == 'off' && isset($_POST['is_admin']) && strtolower($_POST['is_admin']) == 'on') + { + $log->fatal("SECURITY:Non-Admin ". $current_user->id . " attempted to change is_admin settings for user:". $focus->id); + header("Location: index.php?module=Users&action=Logout"); + exit; + } + + if (!isset($_POST['is_admin'])) $_REQUEST["is_admin"] = 'off'; + //Code contributed by mike crowe for rearrange the home page and tab + if (!isset($_POST['deleted'])) $_REQUEST["deleted"] = '0'; + if (!isset($_POST['homeorder']) || $_POST['homeorder'] == "" ) $_REQUEST["homeorder"] = 'ILTI,QLTQ,ALVT,PLVT,CVLVT,HLT,OLV,GRT,OLTSO'; + if(isset($_REQUEST['internal_mailer']) && $_REQUEST['internal_mailer'] == 'on') + $focus->column_fields['internal_mailer'] = 1; + else + $focus->column_fields['internal_mailer'] = 0; + if(isset($_SESSION['internal_mailer']) && $_SESSION['internal_mailer'] != $focus->column_fields['internal_mailer']) + $_SESSION['internal_mailer'] = $focus->column_fields['internal_mailer']; + setObjectValuesFromRequest($focus); + + // Added for Reminder Popup support + $query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?",array($focus->id)); + $prev_reminder_interval = $adb->query_result($query_prev_interval,0,'reminder_interval'); + + $focus->saveentity("Users"); + //$focus->imagename = $image_upload_array['imagename']; + $focus->saveHomeStuffOrder($focus->id); + SaveTagCloudView($focus->id); + + // Added for Reminder Popup support + $focus->resetReminderInterval($prev_reminder_interval); + + $return_id = $focus->id; + +if (isset($_POST['user_name']) && isset($_POST['new_password'])) { + $new_pass = $_POST['new_password']; + $new_passwd = $_POST['new_password']; + $new_pass = md5($new_pass); + $uname = $_POST['user_name']; + if (!$focus->change_password($_POST['confirm_new_password'], $_POST['new_password'])) { + + header("Location: index.php?action=Error&module=Users&error_string=".urlencode($focus->error_string)); + exit; +} +} + +if(isset($focus->id) && $focus->id != '') +{ + + if(isset($_POST['user_role'])) + { + updateUser2RoleMapping($_POST['user_role'],$focus->id); + } + if(isset($_POST['group_name']) && $_POST['group_name'] != '') + { + updateUsers2GroupMapping($_POST['group_name'],$focus->id); + } +} +else +{ + if(isset($_POST['user_role'])) + { + insertUser2RoleMapping($_POST['user_role'],$focus->id); + } + if(isset($_POST['group_name'])) + { + insertUsers2GroupMapping($_POST['group_name'],$focus->id); + } +} + +//Creating the Privileges Flat File +require_once('modules/Users/CreateUserPrivilegeFile.php'); +createUserPrivilegesfile($focus->id); +createUserSharingPrivilegesfile($focus->id); + +} +if(isset($_POST['return_module']) && $_POST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']); +else $return_module = "Users"; +if(isset($_POST['return_action']) && $_POST['return_action'] != "") $return_action = vtlib_purify($_REQUEST['return_action']); +else $return_action = "DetailView"; +if(isset($_POST['return_id']) && $_POST['return_id'] != "") $return_id = vtlib_purify($_REQUEST['return_id']); +if(isset($_REQUEST['activity_mode'])) $activitymode = '&activity_mode='.vtlib_purify($_REQUEST['activity_mode']); +if(isset($_POST['parenttab'])) $parenttab = getParentTab(); + +$log->debug("Saved record with id of ".$return_id); + +//Asha: Added Check to see if the mode is User Creation and if yes, then sending the email notification to the User with Login details. +if($_REQUEST['mode'] == 'create') { + global $app_strings, $mod_strings, $default_charset; + require_once('modules/Emails/mail.php'); + $user_emailid = $focus->column_fields['email1']; + // send email on Create user only if NOTIFY_OWNER_EMAILS is set to true + + $subject = $mod_strings['User Login Details']; + $email_body = $app_strings['MSG_DEAR']." ". $focus->column_fields['last_name'] .",

"; + $email_body .= $app_strings['LBL_PLEASE_CLICK'] . " " + . $app_strings['LBL_HERE'] . " " . $mod_strings['LBL_TO_LOGIN'] . "

"; + $email_body .= $mod_strings['LBL_USER_NAME'] . " : " . $focus->column_fields['user_name'] . "
"; + $email_body .= $mod_strings['LBL_PASSWORD'] . " : " . $focus->column_fields['user_password'] . "
"; + $email_body .= $mod_strings['LBL_ROLE_NAME'] . " : " . getRoleName($_POST['user_role']) . "
"; + $email_body .= "
" . $app_strings['MSG_THANKS'] . "
" . $current_user->user_name; + $email_body = htmlentities($email_body, ENT_QUOTES, $default_charset); + + $mail_status = send_mail('Users',$user_emailid,$HELPDESK_SUPPORT_NAME,$HELPDESK_SUPPORT_EMAIL_ID,$subject,$email_body); + if($mail_status != 1) { + $mail_status_str = $user_emailid."=".$mail_status."&&&"; + $error_str = getMailErrorString($mail_status_str); + } +} +$location = "Location: index.php?action=".vtlib_purify($return_action)."&module=".vtlib_purify($return_module)."&record=".vtlib_purify($return_id); + +if($_REQUEST['modechk'] != 'prefview') { + $location .= "&parenttab=".vtlib_purify($parenttab); +} + +if ($error_str != '') { + $user = $focus->column_fields['user_name']; + $location .= "&user=$user&$error_str"; +} + +header($location); + +?> diff --git a/oss/vtiger/trunk/modules/Users/SaveDefModuleView.php b/oss/vtiger/trunk/modules/Users/SaveDefModuleView.php new file mode 100644 index 00000000..877f48fc --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/SaveDefModuleView.php @@ -0,0 +1,45 @@ + + diff --git a/oss/vtiger/trunk/modules/Users/SaveGroup.php b/oss/vtiger/trunk/modules/Users/SaveGroup.php new file mode 100644 index 00000000..48cc3435 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/SaveGroup.php @@ -0,0 +1,126 @@ +pquery($query, $params); + + $user_query = "SELECT user_name FROM vtiger_users WHERE user_name =?"; + $user_result = $adb->pquery($user_query, array($groupName)); + + if($adb->num_rows($result) > 0) { + echo $mod_strings['LBL_GROUPNAME_EXIST']; + die; + } elseif($adb->num_rows($user_result) > 0) { + echo $mod_strings['LBL_USERNAME_EXIST']; + die; + } else { + echo 'SUCCESS'; + die; + } +} + + +/** returns the group members in an formatted array + * @param $member_array -- member_array:: Type varchar + * @returns $groupMemberArray:: Type varchar + + $groupMemberArray['groups'] -- gives the array of sub groups members ; + $groupMemberArray['roles'] -- gives the array of roles present in the group ; + $groupMemberArray['rs'] -- gives the array of roles & subordinates present in the group ; + $groupMemberArray['users'] -- gives the array of roles & subordinates present in the group; + * + */ +function constructGroupMemberArray($member_array) +{ + global $adb; + + $groupMemberArray=Array(); + $roleArray=Array(); + $roleSubordinateArray=Array(); + $groupArray=Array(); + $userArray=Array(); + + foreach($member_array as $member) + { + $memSubArray=explode('::',$member); + if($memSubArray[0] == 'groups') + { + $groupArray[]=$memSubArray[1]; + } + if($memSubArray[0] == 'roles') + { + $roleArray[]=$memSubArray[1]; + } + if($memSubArray[0] == 'rs') + { + $roleSubordinateArray[]=$memSubArray[1]; + } + if($memSubArray[0] == 'users') + { + $userArray[]=$memSubArray[1]; + } + } + + $groupMemberArray['groups']=$groupArray; + $groupMemberArray['roles']=$roleArray; + $groupMemberArray['rs']=$roleSubordinateArray; + $groupMemberArray['users']=$userArray; + + return $groupMemberArray; + +} + + if(isset($_REQUEST['returnaction']) && $_REQUEST['returnaction'] != '') + { + $returnaction=$_REQUEST['returnaction'].'&roleid='.$_REQUEST['roleid']; + } + else + { + $returnaction='GroupDetailView'; + } + + //Inserting values into Role Table + if(isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'edit') + { + $groupId = $_REQUEST['groupId']; + $selected_col_string = $_REQUEST['selectedColumnsString']; + $member_array = explode(';',$selected_col_string); + $groupMemberArray=constructGroupMemberArray($member_array); + updateGroup($groupId,$groupName,$groupMemberArray,$description); + + $loc = "Location: index.php?action=".vtlib_purify($returnaction)."&module=Settings&parenttab=Settings&groupId=".vtlib_purify($groupId); + } + elseif(isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'create') + { + $selected_col_string = $_REQUEST['selectedColumnsString']; + $member_array = explode(';',$selected_col_string); + $groupMemberArray=constructGroupMemberArray($member_array); + $groupId=createGroup($groupName,$groupMemberArray,$description); + $loc = "Location: index.php?action=".vtlib_purify($returnaction)."&parenttab=Settings&module=Settings&groupId=".vtlib_purify($groupId); + + } + + header($loc); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/SaveMailAccount.php b/oss/vtiger/trunk/modules/Users/SaveMailAccount.php new file mode 100644 index 00000000..1dd4cf70 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/SaveMailAccount.php @@ -0,0 +1,58 @@ +id; +$email=$_REQUEST['email']; +$account_name=$_REQUEST['account_name']; +$mailprotocol=$_REQUEST['mailprotocol']; +$server_username = $_REQUEST['server_username']; +$server_password = $_REQUEST['server_password']; +$mail_servername = $_REQUEST['mail_servername']; +$box_refresh = $_REQUEST['box_refresh']; +$mails_per_page = $_REQUEST['mails_per_page']; +$ssltype = $_REQUEST["ssltype"]; +$sslmeth = $_REQUEST["sslmeth"]; + +if($mails_per_page == '') $mails_per_page='0'; + +if(isset($_REQUEST['record']) && $_REQUEST['record']!='') { + $id=$_REQUEST['record']; +} + +$focus = new Users(); +$encrypted_password=$focus->changepassword($_REQUEST['server_password']); +if(isset($_REQUEST['edit']) && $_REQUEST['edit'] && $_REQUEST['record']!='') { + $sql="update vtiger_mail_accounts set display_name = ?, mail_id = ?, account_name = ?, mail_protocol = ?, mail_username = ?"; + $params = array($displayname, $email, $account_name, $mailprotocol, $server_username); + if($server_password != '*****') { + $sql.=", mail_password=?"; + array_push($params, $encrypted_password); + } + $sql.=", mail_servername=?, box_refresh=?, mails_per_page=?, ssltype=? , sslmeth=?, int_mailer=? where user_id = ?"; + array_push($params, $mail_servername, $box_refresh, $mails_per_page, $ssltype, $sslmeth, $_REQUEST["int_mailer"], $id); +} else { + $account_id = $adb->getUniqueID("vtiger_mail_accounts"); + $sql="insert into vtiger_mail_accounts(account_id, user_id, display_name, mail_id, account_name, mail_protocol, mail_username, mail_password, mail_servername, box_refresh, mails_per_page, ssltype, sslmeth, int_mailer, status, set_default) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $params = array($account_id, $current_user->id, $displayname, $email, $account_name, $mailprotocol, $server_username, $encrypted_password, $mail_servername, $box_refresh, $mails_per_page, $ssltype, $sslmeth, $_REQUEST["int_mailer"],'1','0'); +} + +$adb->pquery($sql, $params); + +$return_module = vtlib_purify($_REQUEST['return_module']); +if(empty($return_module)) $return_module = 'Webmails'; + +$return_action = vtlib_purify($_REQUEST['return_action']); +if(empty($return_action)) $return_action = 'index'; + +header("Location:index.php?module=$return_module&action=$return_action&mailbox=INBOX&parenttab=My Home Page"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/SaveOrgSharing.php b/oss/vtiger/trunk/modules/Users/SaveOrgSharing.php new file mode 100644 index 00000000..4966a121 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/SaveOrgSharing.php @@ -0,0 +1,38 @@ +pquery($sql2, array()); +$num_rows = $adb->num_rows($result2); + +for($i=0; $i<$num_rows; $i++) { + $ruleid=$adb->query_result($result2,$i,'ruleid'); + $tabid=$adb->query_result($result2,$i,'tabid'); + $reqval = $tabid.'_per'; + $permission=$_REQUEST[$reqval]; + $sql7="update vtiger_def_org_share set permission=? where tabid=? and ruleid=?"; + $adb->pquery($sql7, array($permission, $tabid, $ruleid)); + + if($tabid == 6) { + $sql8="update vtiger_def_org_share set permission=? where tabid=4"; + $adb->pquery($sql8, array($permission)); + } + + if($tabid == 9) { + $sql8="update vtiger_def_org_share set permission=? where tabid=16"; + $adb->pquery($sql8, array($permission)); + } +} +$loc = "Location: index.php?action=OrgSharingDetailView&module=Settings&parenttab=Settings"; +header($loc); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/SaveProfile.php b/oss/vtiger/trunk/modules/Users/SaveProfile.php new file mode 100644 index 00000000..5e0f131e --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/SaveProfile.php @@ -0,0 +1,212 @@ +getUniqueID("vtiger_profile"); +//Inserting values into Profile Table +$sql1 = "insert into vtiger_profile(profileid, profilename, description) values(?,?,?)"; +$adb->pquery($sql1, array($profile_id,$profilename, $description)); + + //Retreiving the vtiger_profileid + $sql2 = "select max(profileid) as current_id from vtiger_profile"; + $result2 = $adb->pquery($sql2, array()); + $profileid = $adb->query_result($result2,0,'current_id'); + + + //Retreiving the vtiger_tabs permission array + // + + //Retreiving the first profileid + $prof_query="select profileid from vtiger_profile order by profileid ASC"; + $prof_result = $adb->pquery($prof_query, array()); + $first_prof_id = $adb->query_result($prof_result,0,'profileid'); + +$tab_perr_result = $adb->pquery("select * from vtiger_profile2tab where profileid=?", array($first_prof_id)); +$act_perr_result = $adb->pquery("select * from vtiger_profile2standardpermissions where profileid=?", array($first_prof_id)); +$act_utility_result = $adb->pquery("select * from vtiger_profile2utility where profileid=?", array($first_prof_id)); +$num_tab_per = $adb->num_rows($tab_perr_result); +$num_act_per = $adb->num_rows($act_perr_result); +$num_act_util_per = $adb->num_rows($act_utility_result); + + //Updating vtiger_profile2global permissons vtiger_table + $view_all_req=$_REQUEST['view_all']; + $view_all = getPermissionValue($view_all_req); + + $edit_all_req=$_REQUEST['edit_all']; + $edit_all = getPermissionValue($edit_all_req); + + + $sql4="insert into vtiger_profile2globalpermissions values(?,?,?)"; + $adb->pquery($sql4, array($profileid,1, $view_all)); + + $sql4="insert into vtiger_profile2globalpermissions values(?,?,?)"; + $adb->pquery($sql4, array($profileid,2, $edit_all)); + + + //profile2tab permissions + for($i=0; $i<$num_tab_per; $i++) + { + $tab_id = $adb->query_result($tab_perr_result,$i,"tabid"); + $request_var = $tab_id.'_tab'; + if($tab_id != 3 && $tab_id != 16) + { + $permission = $_REQUEST[$request_var]; + if($permission == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + $sql4="insert into vtiger_profile2tab values(?,?,?)"; + $adb->pquery($sql4, array($profileid, $tab_id, $permission_value)); + + if($tab_id ==9) + { + $sql4="insert into vtiger_profile2tab values(?,?,?)"; + $adb->pquery($sql4, array($profileid,16, $permission_value)); + } + } + } + + //profile2standard permissions + for($i=0; $i<$num_act_per; $i++) + { + $tab_id = $adb->query_result($act_perr_result,$i,"tabid"); + $action_id = $adb->query_result($act_perr_result,$i,"operation"); + if($tab_id != 16) + { + $action_name = getActionname($action_id); + if($action_name == 'EditView' || $action_name == 'Delete' || $action_name == 'DetailView') + { + $request_var = $tab_id.'_'.$action_name; + } + elseif($action_name == 'Save') + { + $request_var = $tab_id.'_EditView'; + } + elseif($action_name == 'index') + { + $request_var = $tab_id.'_DetailView'; + } + + $permission = $_REQUEST[$request_var]; + if($permission == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + + $sql7="insert into vtiger_profile2standardpermissions values(?,?,?,?)"; + $adb->pquery($sql7, array($profileid, $tab_id, $action_id, $permission_value)); + + if($tab_id ==9) + { + $sql7="insert into vtiger_profile2standardpermissions values(?,?,?,?)"; + $adb->pquery($sql7, array($profileid, 16, $action_id, $permission_value)); + } + } + } + + //Update Profile 2 utility + for($i=0; $i<$num_act_util_per; $i++) + { + $tab_id = $adb->query_result($act_utility_result,$i,"tabid"); + + $action_id = $adb->query_result($act_utility_result,$i,"activityid"); + $action_name = getActionname($action_id); + $request_var = $tab_id.'_'.$action_name; + + + $permission = $_REQUEST[$request_var]; + if($permission == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + + $sql9="insert into vtiger_profile2utility values(?,?,?,?)"; + $adb->pquery($sql9, array($profileid, $tab_id, $action_id, $permission_value)); + + } + + + + $modArr=getFieldModuleAccessArray(); + + +foreach($modArr as $fld_module => $fld_label) +{ + $fieldListResult = getProfile2FieldList($fld_module, $first_prof_id); + $noofrows = $adb->num_rows($fieldListResult); + $tab_id = getTabid($fld_module); + for($i=0; $i<$noofrows; $i++) + { + $fieldid = $adb->query_result($fieldListResult,$i,"fieldid"); + $visible = $_REQUEST[$fieldid]; + if($visible == 'on') + { + $visible_value = 0; + } + else + { + $visible_value = 1; + } + //Updating the Mandatory vtiger_fields + $uitype = $adb->query_result($fieldListResult,$i,"uitype"); + $displaytype = $adb->query_result($fieldListResult,$i,"displaytype"); + $fieldname = $adb->query_result($fieldListResult,$i,"fieldname"); + $typeofdata = $adb->query_result($fieldListResult,$i,"typeofdata"); + $fieldtype = explode("~",$typeofdata); + if($fieldtype[1] == 'M') + { + $visible_value = 0; + } + //Updating the database + $sql11="insert into vtiger_profile2field values(?,?,?,?,?)"; + $adb->pquery($sql11, array($profileid, $tab_id, $fieldid, $visible_value,1)); + } +} + $loc = "Location: index.php?action=ListProfiles&module=Settings&mode=view&parenttab=Settings&profileid=".vtlib_purify($profileid)."&selected_tab=".vtlib_purify($def_tab)."&selected_module=".vtlib_purify($def_module); + header($loc); + + +/** returns value 0 if request permission is on else returns value 1 + * @param $req_per -- Request Permission:: Type varchar + * @returns $permission - can have value 0 or 1:: Type integer + * + */ +function getPermissionValue($req_per) +{ + if($req_per == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + return $permission_value; +} + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/ShowHistory.html b/oss/vtiger/trunk/modules/Users/ShowHistory.html new file mode 100644 index 00000000..62568e4e --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/ShowHistory.html @@ -0,0 +1,53 @@ + + + + + + + + + +

+ + {MOD.LBL_LOGIN_HISTORY_BUTTON_LABEL} +

+ + +
{START_LINK}  {PREVIOUS_LINK}   + {NEXT_LINK}  {END_LINK}   {START_RECORD} - {END_RECORD} {APP.LBL_LIST_OF} {ROW_COUNT}  
+ + + + + + + + + + + + + + + + + + + + +
 {APP.LBL_LIST_USER_NAME}{user_name_arrow} {APP.LBL_LIST_USERIP}{user_ip_arrow} {APP.LBL_LIST_SIGNIN}{login_time_arrow} {APP.LBL_LIST_SIGNOUT}{logout_time_arrow} {APP.LBL_LIST_STATUS}
{LOGIN.USER_NAME}{LOGIN.USER_IP}{LOGIN.LOGIN_TIME}{LOGIN.LOGOUT_TIME}{LOGIN.STATUS}
+ +
+
+ + diff --git a/oss/vtiger/trunk/modules/Users/ShowHistory.php b/oss/vtiger/trunk/modules/Users/ShowHistory.php new file mode 100644 index 00000000..a3524a53 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/ShowHistory.php @@ -0,0 +1,74 @@ +pquery($qry, array($username)); +$no_of_rows = $adb->num_rows($qry_result); + +//Retreiving the start value from request +if(isset($_REQUEST['start']) && $_REQUEST['start'] != '') { + $start = vtlib_purify($_REQUEST['start']); +} else { + $start=1; +} + +//Retreive the Navigation array +$navigation_array = getNavigationValues($start, $no_of_rows, '10'); + +$start_rec = $navigation_array['start']; +$end_rec = $navigation_array['end_val']; +$record_string= $app_strings[LBL_SHOWING]." " .$start_rec." - ".$end_rec." " .$app_strings[LBL_LIST_OF] ." ".$no_of_rows; + +$navigationOutput = getTableHeaderNavigation($navigation_array, $url_string,"Users","ShowHistory",''); + +$smarty->assign("CMOD", $mod_strings); +$smarty->assign("MOD", return_module_language($current_language, "Settings")); +$smarty->assign("APP", $app_strings); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH",$image_path); +$smarty->assign("LIST_HEADER",$focus->getHistoryListViewHeader()); +$smarty->assign("LIST_ENTRIES",$focus->getHistoryListViewEntries($username, $navigation_array, $sorder, $sortby)); +$smarty->assign("RECORD_COUNTS", $record_string); +$smarty->assign("NAVIGATION", $navigationOutput); +$smarty->assign("CATEGORY",$category); + +$smarty->display("ShowHistoryContents.tpl"); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/TemplateMerge.php b/oss/vtiger/trunk/modules/Users/TemplateMerge.php new file mode 100644 index 00000000..c333de9a --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/TemplateMerge.php @@ -0,0 +1,34 @@ + +
+ + +
+ diff --git a/oss/vtiger/trunk/modules/Users/UpdateProfileChanges.php b/oss/vtiger/trunk/modules/Users/UpdateProfileChanges.php new file mode 100644 index 00000000..e7b15923 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/UpdateProfileChanges.php @@ -0,0 +1,204 @@ +pquery("select * from vtiger_profile2tab where profileid=?", array($profileid)); +$act_perr_result = $adb->pquery("select * from vtiger_profile2standardpermissions where profileid=?", array($profileid)); +$act_utility_result = $adb->pquery("select * from vtiger_profile2utility where profileid=?", array($profileid)); +$num_tab_per = $adb->num_rows($tab_perr_result); +$num_act_per = $adb->num_rows($act_perr_result); +$num_act_util_per = $adb->num_rows($act_utility_result); + + //Updating vtiger_profile2global permissons vtiger_table + $view_all_req=$_REQUEST['view_all']; + $view_all = getPermissionValue($view_all_req); + + $edit_all_req=$_REQUEST['edit_all']; + $edit_all = getPermissionValue($edit_all_req); + + $update_query = "update vtiger_profile2globalpermissions set globalactionpermission=? where globalactionid=1 and profileid=?"; + $adb->pquery($update_query, array($view_all, $profileid)); + $update_query = "update vtiger_profile2globalpermissions set globalactionpermission=? where globalactionid=2 and profileid=?"; + $adb->pquery($update_query, array($edit_all, $profileid)); + + + //profile2tab permissions + for($i=0; $i<$num_tab_per; $i++) + { + $tab_id = $adb->query_result($tab_perr_result,$i,"tabid"); + $request_var = $tab_id.'_tab'; + if($tab_id != 3 && $tab_id != 16) + { + $permission = $_REQUEST[$request_var]; + if($permission == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + $update_query = "update vtiger_profile2tab set permissions=? where tabid=? and profileid=?"; + $adb->pquery($update_query, array($permission_value, $tab_id, $profileid)); + if($tab_id ==9) + { + $update_query = "update vtiger_profile2tab set permissions=? where tabid=16 and profileid=?"; + $adb->pquery($update_query, array($permission_value, $profileid)); + } + } + } + + //profile2standard permissions + for($i=0; $i<$num_act_per; $i++) + { + $tab_id = $adb->query_result($act_perr_result,$i,"tabid"); + if($tab_id != 16) + { + $action_id = $adb->query_result($act_perr_result,$i,"operation"); + $action_name = getActionname($action_id); + if($action_name == 'EditView' || $action_name == 'Delete' || $action_name == 'DetailView') + { + $request_var = $tab_id.'_'.$action_name; + } + elseif($action_name == 'Save') + { + $request_var = $tab_id.'_EditView'; + } + elseif($action_name == 'index') + { + $request_var = $tab_id.'_DetailView'; + } + + $permission = $_REQUEST[$request_var]; + if($permission == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + $update_query = "update vtiger_profile2standardpermissions set permissions=? where tabid=? and Operation=? and profileid=?"; + $adb->pquery($update_query, array($permission_value, $tab_id, $action_id, $profileid)); + if($tab_id ==9) + { + $update_query = "update vtiger_profile2standardpermissions set permissions=? where tabid=16 and Operation=? and profileid=?"; + $adb->pquery($update_query, array($permission_value, $action_id, $profileid)); + } + + + + } + } + + //Update Profile 2 utility + for($i=0; $i<$num_act_util_per; $i++) + { + $tab_id = $adb->query_result($act_utility_result,$i,"tabid"); + + $action_id = $adb->query_result($act_utility_result,$i,"activityid"); + $action_name = getActionname($action_id); + $request_var = $tab_id.'_'.$action_name; + + + $permission = $_REQUEST[$request_var]; + if($permission == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + + $update_query = "update vtiger_profile2utility set permission=? where tabid=? and activityid=? and profileid=?"; + $adb->pquery($update_query, array($permission_value, $tab_id, $action_id, $profileid)); + + + } + + + + $modArr=getFieldModuleAccessArray(); + +foreach($modArr as $fld_module => $fld_label) +{ + $fieldListResult = getProfile2FieldList($fld_module, $profileid); + $noofrows = $adb->num_rows($fieldListResult); + $tab_id = getTabid($fld_module); + for($i=0; $i<$noofrows; $i++) + { + $fieldid = $adb->query_result($fieldListResult,$i,"fieldid"); + $visible = $_REQUEST[$fieldid]; + if($visible == 'on') + { + $visible_value = 0; + } + else + { + $visible_value = 1; + } + //Updating the Mandatory vtiger_fields + $uitype = $adb->query_result($fieldListResult,$i,"uitype"); + $displaytype = $adb->query_result($fieldListResult,$i,"displaytype"); + $fieldname = $adb->query_result($fieldListResult,$i,"fieldname"); + $typeofdata = $adb->query_result($fieldListResult,$i,"typeofdata"); + $fieldtype = explode("~",$typeofdata); + if($fieldtype[1] == 'M') + { + $visible_value = 0; + } + //Updating the database + $update_query = "update vtiger_profile2field set visible=? where fieldid=? and profileid=? and tabid=?"; + $adb->pquery($update_query, array($visible_value, $fieldid, $profileid, $tab_id)); + + } +} + if($return_action == 'profilePrivileges' || $return_action == 'ListProfiles') + { + $loc = "Location: index.php?action=".$return_action."&module=Settings&mode=view&parenttab=Settings&profileid=".$profileid."&selected_tab=".$def_tab."&selected_module=".$def_module; + } + else + { + $loc = "Location: index.php?action=".$return_action."&module=Users&mode=view&parenttab=Settings&profileid=".$profileid."&selected_tab=".$def_tab."&selected_module=".$def_module; + } + header($loc); + + /** returns value 0 if request permission is on else returns value 1 + * @param $req_per -- Request Permission:: Type varchar + * @returns $permission - can have value 0 or 1:: Type integer + * + */ +function getPermissionValue($req_per) +{ + if($req_per == 'on') + { + $permission_value = 0; + } + else + { + $permission_value = 1; + } + return $permission_value; +} + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/UserDeleteStep1.php b/oss/vtiger/trunk/modules/Users/UserDeleteStep1.php new file mode 100644 index 00000000..bf1cf699 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/UserDeleteStep1.php @@ -0,0 +1,80 @@ + +
+ + + + + + + + +
'.$mod_strings['LBL_DELETE'].' '.$mod_strings['LBL_USER'].''.$app_strings[
+ + + + +
+ + + + + + + + + + + +
'.$mod_strings['LBL_DELETE_USER'].''.$delete_user_name.'
'.$mod_strings['LBL_TRANSFER_USER'].''; + + $output.='
+
+ + + + +
+
+
'; + +echo $output; +?> diff --git a/oss/vtiger/trunk/modules/Users/UserGroups.php b/oss/vtiger/trunk/modules/Users/UserGroups.php new file mode 100644 index 00000000..676da8b6 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/UserGroups.php @@ -0,0 +1,31 @@ +getAllUserGroups($user_id); +$user_group_info = Array(); +foreach($oGetUserGroups->user_groups as $groupid) +{ + $user_group_info[$groupid] = getGroupDetails($groupid); +} +$smarty->assign("IS_ADMIN",is_admin($current_user)); +$smarty->assign("GROUPLIST",$user_group_info); +$smarty->assign("UMOD", $mod_strings); +$smarty->display("UserGroups.tpl"); +?> diff --git a/oss/vtiger/trunk/modules/Users/Users.js b/oss/vtiger/trunk/modules/Users/Users.js new file mode 100644 index 00000000..8398d9ba --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/Users.js @@ -0,0 +1,320 @@ +/********************************************************************************* +** The contents of this file are subject to the vtiger CRM Public License Version 1.0 + * ("License"); You may not use this file except in compliance with the License + * The Original Code is: vtiger CRM Open Source + * The Initial Developer of the Original Code is vtiger. + * Portions created by vtiger are Copyright (C) vtiger. + * All Rights Reserved. + * + ********************************************************************************/ + + + +document.write(" + + + + + + + + + + + + + + + + +
  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Akilan
Anusha
Asha
Bharath
Bharathi
Dhananjay
Dina
Don
Fenzik
Gopal
Jeri
Kiran
Mani
Mickie
Minnie
Musavir
Nitin
Panchavarnam
Pavani
Philip
Pinaki
Prasad
Preethi
Puneeth
Radiant
Richie
Sandeep
Shahul
Sidharth
Sreenivas
Srinivasan
Tamilmani
Vamsee
Varma
Vashni
 
Aissa Belaid
Allan Bush
Brian Devendorf
Brian Laughlin
Davide Giarolo
Dennis Grant
Dhr. R.R. Gerbrands
Dino Eberle
Dirk Gorny
Fathi Boudra
Frank Piepiorra
Jamie Jackson
Jeff Kowalczyk
Jens Gammelgaard
Jens Hamisch
Joao Oliveira
Joel Rydbeck
Josh Lee
Ken Lyle
Kim Haverblad
Manilal K M
Matjaz Slak
Matthew Brichacek
Michel Jacquemes
Mike Crowe
Mike Fedyk
Neil
Tim Smith
Sergio A. Kessler
Steve Fairchild
Valmir Carlos Trindade
 
-
ADOdb
Ajax Popup Chat
Apache HTTP Server
Attachments in E-mail Client
Calculator
Carousel Slideshow
class_http
ExcelReader
CKEditor
FPDF
freetag
gdwin32
Graph
Image Crossfade Redux
Image_Canvas
Image_Color
jscalendar
log4php
MagpieRSS
Mailfeed
MySQL
nusoap
NOCC
PHP
PHPMailer
phpSysinfo
Prototype
script.oculo.us
Smarty Template Engine
SugarCRM (SPL 1.1.2)
TCPDF
 
 
 
+
+
 
 
+ + + + + +
+  |  +  |  +  |  + + + +
+
+ + diff --git a/oss/vtiger/trunk/modules/Users/binaryfilelist.php b/oss/vtiger/trunk/modules/Users/binaryfilelist.php new file mode 100644 index 00000000..d3a957a8 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/binaryfilelist.php @@ -0,0 +1,98 @@ +pquery($dbQuery, array()) or die("Couldn't get file list"); + +$list = ''; + +$list .= ''; +$list .=''; +$list .= ''; + +$list .= ''; + +$list .= ''; + +$list .= ''; + +$list .= ''; + +$list .= ''; + +$list .= ''; + +//$list .= ''; + +$i=1; +while($row = $adb->fetch_array($result)) +{ + + +if ($i%2==0) +$trowclass = 'evenListRow'; +else +$trowclass = 'oddListRow'; + $list .= ''; + + $list .= ''; + $list .= ''; + + $list .= ''; + + $list .= ''; +$i++; +} + + $list .= '
'.$app_strings['LBL_OPERATION'].'
'; +$list .= $app_strings['LBL_FILENAME'].''; +$list .= $mod_strings['LBL_MODULENAMES'].''; +$list .= $app_strings['LBL_UPD_DESC'].''; +$list .= $app_strings['LBL_TYPE'].''; +$list .= $app_strings['LBL_FILE'].'
Del '; + + $list .= $row["filename"]; + + $list .= ''.$row["module"].''; + + $list .= $row["description"]; + + $list .= ''; + + $list .= $row["filetype"]; + + $list .= ''; + + $list .= ''; + + $list .= $app_strings['LBL_DOWNLOAD']; + + $list .= '
'; + +return $list; +} +?> diff --git a/oss/vtiger/trunk/modules/Users/deletewordtemplate.php b/oss/vtiger/trunk/modules/Users/deletewordtemplate.php new file mode 100644 index 00000000..bf7aced2 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/deletewordtemplate.php @@ -0,0 +1,19 @@ +pquery($sql, array($id_array[$i])); +} +header("Location:index.php?module=Users&action=listwordtemplates&parenttab=Settings"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/downloadfile.php b/oss/vtiger/trunk/modules/Users/downloadfile.php new file mode 100644 index 00000000..222aa138 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/downloadfile.php @@ -0,0 +1,41 @@ +pquery($dbQuery, array($templateid)) or die("Couldn't get file list"); +if($adb->num_rows($result) == 1) +{ +$fileType = $adb->query_result($result, 0, "filetype"); +$name = $adb->query_result($result, 0, "filename"); +//echo 'filetype is ' .$fileType; +$fileContent = $adb->query_result($result, 0, "data"); +$size = $adb->query_result($result, 0, "filesize"); +$name = html_entity_decode($name, ENT_QUOTES, $default_charset); +header("Content-type: $fileType"); +//header("Content-length: $size"); +header("Cache-Control: private"); +header("Content-Disposition: attachment; filename=$name"); +header("Content-Description: PHP Generated Data"); +echo base64_decode($fileContent); +} +else +{ +echo "Record doesn't exist."; +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/getListOfRecords.php b/oss/vtiger/trunk/modules/Users/getListOfRecords.php new file mode 100644 index 00000000..f6db14a7 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/getListOfRecords.php @@ -0,0 +1,124 @@ +pquery("SELECT tablename,entityidfield, fieldname from vtiger_entityname WHERE modulename = ?",array($sModule)); +$table_name = $adb->query_result($query,0,'tablename'); +$field_name = $adb->query_result($query,0,'fieldname'); +$id_field = $adb->query_result($query,0,'entityidfield'); +$fieldname = split(",",$field_name); +$fields_array = array($sModule=>$fieldname); +$id_array = array($sModule=>$id_field); +$tables_array = array($sModule=>$table_name); + +$permittedFieldNameList = array(); +foreach ($fieldname as $fieldName) { + $checkForFieldAccess = $fieldName; + // Handling case where fieldname in vtiger_entityname mismatches fieldname in vtiger_field + if($sModule == 'HelpDesk' && $checkForFieldAccess == 'title') { + $checkForFieldAccess = 'ticket_title'; + } else if($sModule == 'Documents' && $checkForFieldAccess == 'title') { + $checkForFieldAccess = 'notes_title'; + } + // END + if(getFieldVisibilityPermission($sModule,$current_user->id, $checkForFieldAccess) == '0'){ + $permittedFieldNameList[] = $fieldName; + } +} + +$cv = new CustomView(); +$viewId = $cv->getViewId($sModule); +if(!empty($_SESSION[$sModule.'_DetailView_Navigation'.$viewId])){ + $recordNavigationInfo = Zend_Json::decode($_SESSION[$sModule.'_DetailView_Navigation'.$viewId]); + $recordList = array(); + $recordIndex = null; + $recordPageMapping = array(); + foreach ($recordNavigationInfo as $start=>$recordIdList){ + foreach ($recordIdList as $index=>$recordId) { + $recordList[] = $recordId; + $recordPageMapping[$recordId] = $start; + if($recordId == $iCurRecord){ + $recordIndex = count($recordList)-1; + } + } + } +}else{ + $recordList = array(); +} +$output = ' + + + +
Jump to '.$app_strings[$sModule].':
+ +
+ +
'; +$output .= '
'; +$output .= ''; + +if(count($recordList) > 0){ + $displayRecordCount = 10; + $count = count($recordList); + $idListEndIndex = ($count < ($recordIndex+$displayRecordCount))? ($count+1) : ($recordIndex+$displayRecordCount+1); + $idListStartIndex = $recordIndex-$displayRecordCount; + if($idListStartIndex < 0){ + $idListStartIndex = 0; + } + $idsArray = array_slice($recordList,$idListStartIndex,($idListEndIndex - $idListStartIndex)); + + $selectColString = implode(',',$permittedFieldNameList).', '.$id_array[$sModule]; + $fieldQuery = "SELECT $selectColString from ".$tables_array[$sModule]." WHERE ".$id_array[$sModule]." IN (". generateQuestionMarks($idsArray) .")"; + + $fieldResult = $adb->pquery($fieldQuery,$idsArray); + $numOfRows = $adb->num_rows($fieldResult); + $recordNameMapping = array(); + for($i=0; $i<$numOfRows; ++$i) { + $recordId = $adb->query_result($fieldResult,$i,$id_array[$sModule]); + $fieldValue = ''; + foreach ($permittedFieldNameList as $fieldName) { + $fieldValue .= " ".$adb->query_result($fieldResult,$i,$fieldName); + } + $fieldValue = textlength_check($fieldValue); + $recordNameMapping[$recordId] = $fieldValue; + } + foreach ($idsArray as $id) { + if($id===$iCurRecord){ + $output .= ''; + }else{ + $output .= ''; + } + } +} +$output .= '
'.$recordNameMapping[$id].'
'.$recordNameMapping[$id].'
'; +$output .= '
'; + +echo $output; +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/language/en_us.lang.php b/oss/vtiger/trunk/modules/Users/language/en_us.lang.php new file mode 100644 index 00000000..4e346b68 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/language/en_us.lang.php @@ -0,0 +1,689 @@ +'Users', +'LBL_MODULE_TITLE'=>'Users: Home', +'LBL_SEARCH_FORM_TITLE'=>'User Search', +'LBL_LIST_FORM_TITLE'=>'User List', +'LBL_NEW_FORM_TITLE'=>'New User', +'LBL_CREATE_NEW_USER'=>'Create New User', +'LBL_LOGIN'=>'Login', +'LBL_USER_ROLE'=>'Role', +'LBL_LIST_NAME'=>'Name', +'LBL_LIST_LAST_NAME'=>'Last Name', +'LBL_LIST_USER_NAME'=>'User Name', +'LBL_LIST_DEPARTMENT'=>'Department', +'LBL_LIST_EMAIL'=>'E-Mail', +'LBL_LIST_PRIMARY_PHONE'=>'Primary Phone', +'LBL_LIST_ADMIN'=>'Admin', +'LBL_LIST_CONFIRM_PASSWORD'=>'Confirm Password', +'LBL_LIST_USER_NAME_ROLE'=>'User ID , Name & Role', +'LBL_LIST_SELECT'=>'Select', +'LBL_LIST_PHONE'=>'Phone', +'LBL_LIST_NO'=>'#', + +'LBL_ADMINS'=>'Admins', +'LBL_STD_USERS'=>'Standard Users', + +'UserName'=>'UserName', +'Name'=>'Name', +'Tools'=>'Tools', + + +//added for patch2 +'LBL_GROUP'=>'Group', +'LBL_CURRENCY_NAME'=>'Currency', + +'LBL_NEW_USER_BUTTON_TITLE'=>'New User [Alt+N]', +'LBL_NEW_USER_BUTTON_LABEL'=>'New User', +'LBL_NEW_USER_BUTTON_KEY'=>'N', +'LBL_DATE_FORMAT'=>'Date Format', + +'LBL_ERROR'=>'Error:', +'LBL_PASSWORD'=>'Password', +'LBL_USER_NAME'=>'User Name', +'LBL_CRM_ID'=>'CRM ID', +'LBL_FIRST_NAME'=>'First Name', +'LBL_LAST_NAME'=>'Last Name', +'LBL_YAHOO_ID'=>'Yahoo ID', +'LBL_THEME'=>'Color Theme', +'LBL_LANGUAGE'=>'Language', +'LBL_ADMIN'=>'Admin', +'LBL_OFFICE_PHONE'=>'Office Phone', +'LBL_REPORTS_TO'=>'Reports to', +'LBL_OTHER_PHONE'=>'Other Phone', +'LBL_OTHER_EMAIL'=>'Other Email', +'LBL_DEPARTMENT'=>'Department', +'LBL_STATUS'=>'Status', +'LBL_TITLE'=>'Title', +'LBL_ANY_PHONE'=>'Any Phone:', +'LBL_ANY_EMAIL'=>'Any Email:', +'LBL_ADDRESS'=>'Street Address', +'LBL_CITY'=>'City', +'LBL_STATE'=>'State', +'LBL_POSTAL_CODE'=>'Postal Code', +'LBL_COUNTRY'=>'Country', +'LBL_USER_SETTINGS'=>'User Settings', +'LBL_USER_INFORMATION'=>'User Information', +'LBL_MOBILE_PHONE'=>'Mobile', +'LBL_OTHER'=>'Other', +'LBL_FAX'=>'Fax', +'LBL_EMAIL'=>'E-Mail Id', +'LBL_HOME_PHONE'=>'Home Phone', +'LBL_ADDRESS_INFORMATION'=>'User Address', +'LBL_CAL_HRFORMAT'=>'Calendar Time Format', +'LBL_CAL_DURATION'=>'Day starts at', +'LBL_PRIMARY_ADDRESS'=>'Primary Address:', + +'LBL_CHANGE_PASSWORD_BUTTON_TITLE'=>'Change Password [Alt+P]', +'LBL_CHANGE_PASSWORD_BUTTON_KEY'=>'P', +'LBL_CHANGE_PASSWORD_BUTTON_LABEL'=>'Change Password', +'LBL_LOGIN_BUTTON_TITLE'=>'Login [Alt+L]', +'LBL_LOGIN_BUTTON_KEY'=>'L', +'LBL_LOGIN_BUTTON_LABEL'=>'Login', +'LBL_LOGIN_HISTORY_BUTTON_TITLE'=>'Login History [Alt+H]', +'LBL_LOGIN_HISTORY_BUTTON_KEY'=>'H', +'LBL_LOGIN_HISTORY_BUTTON_LABEL'=>'Login History', +'LBL_LOGIN_HISTORY_TITLE'=>'Users: Login History', +'LBL_RESET_PREFERENCES'=>'Reset To Default Preferences', + +'LBL_CHANGE_PASSWORD'=>'Change Password', +'LBL_OLD_PASSWORD'=>'Old Password:', +'LBL_NEW_PASSWORD'=>'New Password:', +'LBL_CONFIRM_PASSWORD'=>'Confirm Password:', +'ERR_ENTER_OLD_PASSWORD'=>'Please enter your old password.', +'ERR_ENTER_NEW_PASSWORD'=>'Please enter your new password.', +'ERR_ENTER_CONFIRMATION_PASSWORD'=>'Please enter your password confirmation.', +'ERR_REENTER_PASSWORDS'=>'Please re-enter passwords. The \"new password\" and \"confirm password\" values do not match.', +'ERR_INVALID_PASSWORD'=>'You must specify a valid username and password.', +'ERR_PASSWORD_CHANGE_FAILED_1'=>'User password change failed for ', +'ERR_PASSWORD_CHANGE_FAILED_2'=>' failed. The new password must be set.', +'ERR_PASSWORD_INCORRECT_OLD'=>'Incorrect old password specified. Re-enter password information.', +'ERR_USER_NAME_EXISTS_1'=>'The user name ', +'ERR_USER_NAME_EXISTS_2'=>' already exists. Duplicate user names are not allowed.
Change the user name to be unique.', +'ERR_LAST_ADMIN_1'=>'The user name ', +'ERR_LAST_ADMIN_2'=>' is the last Admin user. At least one user must be an Admin user.
Check the Admin user setting.', + +'ERR_DELETE_RECORD'=>"A record number must be specified to delete the account.", + +// Additional Fields for i18n --- Release vtigerCRM 3.2 Patch 2 +// Users--listroles.php , createrole.php , ListPermissions.php , editpermissions.php + +'LBL_ROLES'=>'Roles', +'LBL_ROLES_SUBORDINATES'=>'Roles and Subordinates', + +'LBL_CREATE_NEW_ROLE'=>'Create New Role', +'LBL_INDICATES_REQUIRED_FIELD'=>'Indicates Required Field', +'LBL_NEW_ROLE'=>'New Role', +'LBL_PARENT_ROLE'=>'Parent Role', + +'LBL_LIST_ROLES'=>'List Roles', +'LBL_ENTITY_LEVEL_PERMISSIONS'=>'Entity Level Permissions', +'LBL_ENTITY'=>'Entity', +'LBL_CREATE_EDIT'=>'Create/Edit', +'LBL_DELETE'=>'Delete', +'LBL_LEADS'=>'Leads', +'LBL_ACCOUNTS'=>'Accounts', +'LBL_CONTACTS'=>'Contacts', +'LBL_OPPURTUNITIES'=>'Opportunities', +'LBL_TASKS'=>'Tasks', +'LBL_CASES'=>'Cases', +'LBL_EMAILS'=>'Email', +'LBL_NOTES'=>'Documents', +'LBL_MEETINGS'=>'Meetings', +'LBL_CALLS'=>'Calls', +'LBL_IMPORT_PERMISSIONS'=>'Import Permissions', +'LBL_IMPORT_LEADS'=>'Import Leads', +'LBL_IMPORT_ACCOUNTS'=>'Import Accounts', +'LBL_IMPORT_CONTACTS'=>'Import Contacts', +'LBL_IMPORT_OPPURTUNITIES'=>'Import Opportunities', + +'LBL_ROLE_DETAILS'=>'Role Details', +//added for vtigercrm4 rc +'LBL_FILE'=> 'File Name', +'LBL_FILE_TYPE'=>'File Type', +'LBL_UPLOAD'=>'Upload File', +'LBL_ATTACH_FILE'=>'Attach Mail Merge Template', +'LBL_EMAIL_TEMPLATES'=>'Email Templates', +'LBL_TEMPLATE_HEADER'=>'Template', +'LBL_TEMPLATE_DETAILS'=>'Template Details', +'LBL_EDIT_TEMPLATE'=>'Edit Template', +'LBL_TEMPLATE_FILE'=>'Template File', +'LBL_EMAIL_TEMPLATES_LIST'=>'Communication Templates > Email Templates', +'LBL_MAILMERGE_TEMPLATES_LIST'=>' > Communication Templates > Mail Merge Templates', +'LBL_MAILMERGE_TEMPLATES_ATTACHMENT' => '> Communication Templates > Attach Mail Merge Template', +'LBL_DOWNLOAD_NOW'=>'Download Now', +'LBL_DOWNLOAD'=>'Download', +'LBL_SELECT_MODULE'=>'Select Module', +'LBL_MERGE_FILE'=>'File : ', +'LBL_MERGE_MSG'=>'Select a module to assign this Template', +'LBL_MERGE_FIELDS'=>'Merge Fields', +'LBL_COPY_PASTE'=>'Copy & Paste', +'LNK_GO_TO_TOP'=>'Go to Page Top', +'LBL_COLON'=>':', +'LBL_EMAIL_TEMPLATE'=>'Email Template', +'LBL_NEW_TEMPLATE'=>'New Template', +'LBL_ADD_TEMPLATE'=>'Add Template', +'LBL_USE_MERGE_FIELDS_TO_EMAIL_CONTENT'=>'Use merge fields to personalize your email content.', +'LBL_AVAILABLE_MERGE_FIELDS'=>'Available Merge Fields', +'LBL_SELECT_FIELD_TYPE'=>'Select Field Type', +'LBL_SELECT_FIELD'=>'Select Field :', +'LBL_MERGE_FIELD_VALUE'=>'Copy Merge Field Value :', +'LBL_ACCOUNT_FIELDS'=>'Account Fields', +'LBL_CONTACT_FIELDS'=>'Contact Fields', +'LBL_LEAD_FIELDS'=>'Lead Fields', +'LBL_COPY_AND_PASTE_MERGE_FIELD'=>'Copy and paste the merge field value into your template below.', +'LBL_EMAIL_TEMPLATE_INFORMATION'=>'Communication Templates > Email Templates > Viewing', +'LBL_FOLDER'=>'Folder', +'LBL_PERSONAL'=>'Personal', +'LBL_PUBLIC'=>'Public', +'LBL_TEMPLATE_NAME'=>'Template Name:', +'LBL_SUBJECT'=>'Subject', +'LBL_BODY'=>'Email Body', +'LBL_TEMPLATE_TOOLS'=>'Tools', +'LBL_TEMPLATE_PUBLIC'=>'Public Access', +'LBL_TEMPLATE_PRIVATE'=>'Private Access', +'LBL_TEMPLATE_SUBJECT'=>'Email Subject', +'LBL_TEMPLATE_MESSAGE'=>'Email Message', +'LBL_VIEWING'=>'Viewing', +'LBL_PROPERTIES'=>'Properties of', + + +//added to fix the issue #6630 +'LBL_ASTERISKEXTENSIONS_EXIST' => 'Asterisk Extension Already Exists!', + +// Added fields in createnewgroup.php +'LBL_CREATE_NEW_GROUP'=>'Create New Group', +'LBL_NEW_GROUP'=>'New Group', +'LBL_EDIT_GROUP'=>'Edit Group', +'LBL_GROUP_NAME'=>'Group Name', +'LBL_GROUP_DETAILS'=>'Group Details', +'LBL_MEMBER'=>'Members', +'LBL_MEMBER_AVLBL'=>'Available Entities & Members', +'LBL_MEMBER_SELECTED'=>'Selected Members', +'LBL_GROUP_MESG1'=>'Groups are a flexible way to assign access rights, when complex access rights has to be defined. You can combine multiple entities like Roles, Users, profiles etc into a single group.', +'LBL_GROUP_MESG2'=>'To add, select the Entity members from left and click the ">>" button.', +'LBL_GROUP_MESG3'=>'To remove, select the group members from the right and click the "<<" button.', + + +// Added fields in detailViewmailtemplate.html,listgroupmembers.php,listgroups.php +'LBL_DETAIL_VIEW_OF_EMAIL_TEMPLATE'=>'Detail View of Email Template', +'LBL_DETAIL_VIEW'=>'Detail View of', +'LBL_EDIT_VIEW'=>'Editing details of the user', +'LBL_EDITING'=>'Editing user', +'LBL_GROUP_MEMBERS_LIST'=>'Group members list', +'LBL_GROUPS'=>'Groups', +'LBL_MY_GROUPS'=>'My Groups', +'LBL_ADD_GROUP_BUTTON'=>'Add Group', +'LBL_WORD_TEMPLATES'=>'Mail Merge Templates', +'LBL_NEW_WORD_TEMPLATE'=>'New Template', +'LBL_EMAIL_TEMPLATE_DESC'=>'Manage email templates used for Campaigns and Mass mailing', +'LBL_NAME'=>'Name', + +// Added fields in TabCustomise.php,html and UpdateTab.php,html +'LBL_CUSTOMISE_TABS'=>'Customize Tabs', +'LBL_CHOOSE_TABS'=>'Choose Tabs', +'LBL_AVAILABLE_TABS'=>'Available Tabs', +'LBL_SELECTED_TABS'=>'Selected Tabs', +'LBL_USER'=>'User', +'LBL_TAB_MENU_UPDATED'=>'Tab Menu Updated! kindly go to ', +'LBL_TO_VIEW_CHANGES'=>' to view the changes', + +// Added to change homepage order +'LBL_CHANGE_HOMEPAGE_LABEL'=>'Homepage Order', +'LBL_CHANGE_HOMEPAGE_TITLE'=>'Homepage', + +// Added fields in binaryfilelist.php +'LBL_OERATION'=>'Operation', + +// Added fields in CreateProfile.php +'LBL_PROFILE_NAME'=>'Create New Profile:', +'LBL_NEW_PROFILE'=>'New Profile', +'LBL_NEW_PROFILE_NAME'=>'Profile Name', +'LBL_PARENT_PROFILE'=>'Parent Profile', +'LBL_BASIC_PROFILE_DETAILS'=>'Basic details of Profile', +'LBL_STEP_1_2'=>'Step 1 of 2', +'LBL_STEP_2_2'=>'Step 2 of 2', +'LBL_STEP'=>'Step', +'LBL_SELECT_BASE_PROFILE'=>'Select Base Profile', +'LBL_PROFILE_PRIVILEGES'=>'Profile Privileges', +'LBL_GLOBAL_PRIVILEGES'=>'Global Privileges', +'LBL_TAB_PRIVILEGES'=>'Tab Privileges', +'LBL_FIELD_PRIVILEGES'=>'Field Privileges', +'LBL_STANDARD_PRIVILEGES'=>'Standard Privileges', +'LBL_UTILITY_PRIVILEGES'=>'Utility Privileges', +'LBL_UTILITIES'=>'Utilities', +'LBL_BASE_PROFILE_MESG'=>'I would like to setup a base profile and edit privileges (Recommended)', +'LBL_BASE_PROFILE'=>'Base Profile:', +'LBL_OR'=>'OR', +'LBL_BASE_PROFILE_MESG_ADV'=>'I will choose the privileges from scratch (Advanced Users)', +'LBL_FOR'=>'for', +'LBL_GLOBAL_MESG_OPTION'=>'Select the options below to change global privileges', +'LBL_VIEW_ALL'=>'View all', +'LBL_EDIT_ALL'=>'Edit all', +'LBL_ALLOW'=>'Allows', +'LBL_MESG_VIEW'=>'to view all information / modules of vtiger CRM', +'LBL_MESG_EDIT'=>'to edit all information / modules of vtiger CRM', +'LBL_STD_MESG_OPTION'=>'Select the standard actions to be permitted', +'LBL_TAB_MESG_OPTION'=>'modules to be shown', +'LBL_UTILITY_MESG_OPTION'=>'Select the utility actions to be permitted', +'LBL_FIELD_MESG_OPTION'=>'Select the fields to be permitted', +'LBL_FINISH_BUTTON'=>'Finish', +'LBL_PROFILE_DETAIL_VIEW'=>'Detail View of Profile', +'LBL_PROFILE_MESG'=>'Viewing access privileges for', +'LBL_PROFILE_M'=>'Profile', +'LBL_DEFINE_PRIV_FOR'=>' Define Privileges for ', +'LBL_USE_OPTION_TO_SET_PRIV'=>'Use the options below to set privileges', +'LBL_SUPER_USER_PRIV'=>'Global Privileges', +'LBL_SET_PRIV_FOR_EACH_MODULE'=>'Set Privileges for each Module ', +'LBL_FIELDS_AND_TOOLS_SETTINGS'=>'Fields & Tools Settings', +'LBL_SHOW_FIELDS'=>'Show Fields', +'LBL_TOOLS_TO_BE_SHOWN'=>'Tools to be shown', +'LBL_WELCOME_PROFILE_CREATE'=>'Welcome to Privilege Profile Creator ', +'LBL_SELECT_CHOICE_NEW_PROFILE'=>'Select your choice of creating the new profile', +'LBL_ADD_CUSTOM_RULE'=>'Add Custom Privilege Rule', +'LBL_EDIT_CUSTOM_RULE'=>'Edit Custom Privilege Rule', +'LBL_CLOSE'=>'Close', +'LBL_SELECT_ENTITY'=>'Select an entity below', +'LBL_CAN_BE_ACCESSED_BY'=>'Can be accessed by', +'LBL_PERMISSIONS'=>'Permissions', +'LBL_ACCESS_RIGHTS_FOR_MODULES'=>'Access rights for relative modules', +'LBL_RULE_CONSTRUCTION'=>'Rule Construction Display', +'LBL_ADD_RULE'=>'Add Rule', +'LBL_RELATED_MODULE_RIGHTS'=>'Related Module Rights', +'LBL_IN_PERMISSION'=>'in the permission', + +//Added fields in createrole.php +'LBL_HDR_ROLE_NAME'=>'Create New Role:', +'LBL_TITLE_ROLE_NAME'=>'New Role', +'LBL_ROLE_NAME'=>'Role Name', +'LBL_ROLE_PROFILE_NAME'=>'Associate With Profile', +'LBL_SPECIFY_ROLE_NAME'=>'Specify a name for new role :', +'LBL_ASSIGN_PROFILE'=>'Assign Profile(s)', +'LBL_PROFILE_SELECT_TEXT'=>'Select the Profiles below and click on assign button', +'LBL_PROFILES_AVLBL'=>'Profiles Available', +'LBL_ASSIGN_PROFILES'=>'Assigned Profiles', +'LBL_REPORTS_TO_ROLE'=>'Reports to Role', +'LBL_ASSOCIATED_PROFILES'=>'Associated Profiles :', +'LBL_ASSOCIATED_USERS'=>'Associated Users :', + + +//Added fields in OrgSharingDetailsView.php +'LBL_ORG_SHARING_PRIVILEGES'=>'Organisation Sharing Privileges', +'LBL_EDIT_PERMISSIONS'=>'Edit Permissions', +'LBL_SAVE_PERMISSIONS'=>'Save Permissions', +'LBL_READ_ONLY'=>'Public: Read Only', +'LBL_EDIT_CREATE_ONLY'=>'Public: Read, Create/Edit', +'LBL_READ_CREATE_EDIT_DEL'=>'Public: Read, Create/Edit, Delete', +'LBL_PRIVATE'=>'Private', + +//Added fields in listnotificationschedulers.php +'LBL_HDR_EMAIL_SCHDS'=>'Users : Email Notifications', +'LBL_EMAIL_SCHDS_DESC'=>'The following is the list of notifications that are activated automatically when the corresponding event has happened.', +'LBL_ACTIVE'=>'Active', +'LBL_INACTIVE'=>'Inactive', +'LBL_NOTIFICATION'=>'Notification', +'LBL_DESCRIPTION'=>'Description', +'LBL_TASK_NOTIFICATION'=>'Delayed Task Notification', +'LBL_TASK_NOTIFICATION_DESCRITPION'=>'Notify when a task is delayed beyond 24 hrs', +'LBL_MANY_TICKETS'=>'Too many tickets Notification', +'LBL_MANY_TICKETS_DESCRIPTION'=>'Notify when a particular entity is allocated too many tickets, might reflect Service Level commitments', +'LBL_PENDING_TICKETS'=>'Pending Tickets Notification', +'LBL_TICKETS_DESCRIPTION'=>'Notify for getting attention to status of tickets which are pending', +'LBL_START_NOTIFICATION'=>'Support Start Notification', +'LBL_START_DESCRIPTION'=>'Notifiy stating the start of support/service', +'LBL_BIG_DEAL'=>'Big Deal Notification', +'LBL_BIG_DEAL_DESCRIPTION'=>'Notify on completion of big deal', +'LBL_SUPPORT_NOTICIATION'=>'Support End Notification', +'LBL_SUPPORT_DESCRIPTION'=>'Notify when support is about to end', +'LBL_BUTTON_UPDATE'=>'Update', +'LBL_MODULENAMES'=>'Module', + +//Added fields in ListFieldPermissions.html +'LBL_FIELD_PERMISSION_FIELD_NAME'=>'Field Name', +'LBL_FIELD_PERMISSION_VISIBLE'=>'Visible', +'LBL_FIELD_PERMISSIOM_TABLE_HEADER'=>'Standard Fields', +'LBL_FIELD_LEVEL_ACCESS'=>'Field Level Access', + +//Added fields after 4.0.1 +'LBL_SIGNATURE'=>'Signature', + +//Added for Event Reminder 4.2 Alpha release +'LBL_ACTIVITY_NOTIFICATION'=>'Event Reminder Notification', +'LBL_ACTIVITY_REMINDER_DESCRIPTION'=>'Notify before an event to occur based on the reminder set', +'LBL_MESSAGE'=>'Message', + +//Added for Global Privileges + +'Public: Read Only'=>'Public: Read Only', +'Public: Read, Create/Edit'=>'Public: Read, Create/Edit', +'Public: Read, Create/Edit, Delete'=>'Public: Read, Create/Edit, Delete', +'Private'=>'Private', +'Hide Details'=>'Hide Details', +'Hide Details and Add Events'=>'Hide Details and Add Events', +'Show Details'=>'Show Details', +'Show Details and Add Events'=>'Show Details and Add Events', + +'LBL_USR_CANNOT_ACCESS'=>'Users cannot access other users ', +'LBL_USR_CAN_ACCESS'=>'Users can ', +'LBL_USR_OTHERS'=>' other users ', + +'Read Only '=>'Read Only ', +'Read, Create/Edit, Delete '=>'Read, Create/Edit, Delete ', +'Read, Create/Edit '=>'Read, Create/Edit ', +'Read/Write'=>'Read/Write', +'LBL_GO_TO_TOP'=>'Go to Top', +'LNK_CLICK_HERE'=>'Click here', +'LBL_RULE_NO'=>'Rule No.', +'LBL_CAN_BE_ACCESSED'=>'can be accessed by', +'LBL_PRIVILEGES'=>'Privileges', +'LBL_OF'=>'of', + + + +//Added for 4.2GA support for mail server integration +'LBL_ADD_MAILSERVER_BUTTON_TITLE'=>'Add Mail Server', +'LBL_ADD_MAILSERVER_BUTTON_KEY'=>'M', +'LBL_ADD_MAILSERVER_BUTTON_LABEL'=>'Add Mail Server', + +'LBL_LIST_MAILSERVER_BUTTON_TITLE'=>'List Mail Server', +'LBL_LIST_MAILSERVER_BUTTON_KEY'=>'L', +'LBL_LIST_MAILSERVER_BUTTON_LABEL'=>'List Mail Server', +//added for inventory terms and conditions +'INV_TANDC'=>'Terms & Coditions', +'INV_TERMSANDCONDITIONS'=>'Inventory Terms & Coditions', +'LBL_INV_TERMSANDCONDITIONS'=>'Inventory Management', + + +'INVENTORYNOTIFICATION'=>'Inventory Notifications', +'LBL_INVENTORY_NOTIFICATIONS'=>'Edit Inventory Email Notifications', +'LBL_INV_NOT_DESC'=>'The following are the list of notifications that are sent to the product handler regarding the demand and the current quantity in hand during the creation of a Quote, SalesOrder and Invoice.', + +'InvoiceNotification'=>'Product Stock Notification during Invoice Generation', +'InvoiceNotificationDescription'=>'When the product stock level goes below the re-order level, notification will be sent to the product handler', + +'QuoteNotification'=>'Product Stock Notification during Quote Generation', +'QuoteNotificationDescription'=>'During quote generation if the product stock in warehouse is lesser than the quantity mentioned in quote then this notification will be sent to the product handler', + +'SalesOrderNotification'=>'Product Stock Notification during Sales Order Generation', +'SalesOrderNotificationDescription'=>'During sales order generation if the product stock in warehouse is lesser than the quantity mentioned in sales order then this notification will be sent to the product handler', + +//New addition for 4.2 GA +'LBL_USER_FIELDS'=>'User Fields', +'LBL_NOTE_DO_NOT_REMOVE_INFO'=>'Note: Donot remove or alter the values within { }', + +//Added for patch2 +'LBL_FILE_INFORMATION'=>'File Information', + +//Added after pathc2 +'LBL_LEAD_FIELD_ACCESS'=>'Lead Field Access', + +'LBL_ACCOUNT_FIELD_ACCESS'=>'Account Field Access', + +'LBL_CONTACT_FIELD_ACCESS'=>'Contact Field Access', + +'LBL_OPPORTUNITY_FIELD_ACCESS'=>'Potential Field Access', + +'LBL_HELPDESK_FIELD_ACCESS'=>'HelpDesk Field Access', + +'LBL_PRODUCT_FIELD_ACCESS'=>'Product Field Access', + +'LBL_NOTE_FIELD_ACCESS'=>'Document Field Access', + +'LBL_EMAIL_FIELD_ACCESS'=>'Email Field Access', + +'LBL_TASK_FIELD_ACCESS'=>'Task Field Access', + +'LBL_EVENT_FIELD_ACCESS'=>'Event Field Access', +'LBL_VENDOR_FIELD_ACCESS'=>'Vendor Field Access', +'LBL_PB_FIELD_ACCESS'=>'PriceBook Field Access', +'LBL_QUOTE_FIELD_ACCESS'=>'Quote Field Access', +'LBL_PO_FIELD_ACCESS'=>'Purchase Order Field Access', +'LBL_SO_FIELD_ACCESS'=>'Sales Order Access', +'LBL_INVOICE_FIELD_ACCESS'=>'Invoice Field Access', + +//given for calendar color for an user user +'LBL_COLOR'=>'Color in Calendar', +//added for activity view in home page +'LBL_ACTIVITY_VIEW'=>'Default Activity View', +//Added to change Home page order +'LBL_HOMEPAGE_ORDER_UPDATE'=>'Update Home Page Block Order', +'LBL_HOMEPAGE_ID'=>'Block Order', +'ERR_INVALID_USER'=>'Invalid access--Please call from My Accounts', +'ALVT'=>'Top Accounts', +'PLVT'=>'Top Potentials', +'QLTQ'=>'Top Quotes', +'CVLVT'=>'Key Metrics', +'HLT'=>'Top Trouble Tickets', +'OLV'=>'Upcoming & Pending Activities', +'GRT'=>'My Group Allocation', +'OLTSO'=>'Top Sales Orders', +'ILTI'=>'Top Invoices', +'HDB'=>'Home Page Dashboard', +'OLTPO'=>'Top Purchase Orders', +'LTFAQ'=>'My Recent FAQs', +'UA'=>'Upcoming Activities', +'PA'=>'Pending Activities', + +//Added for 5.0 alpha +'LBL_GROUP_NAME_ERROR'=>'Group Name already exists!', +'MNL'=>'My New Leads', +'LBL_LEAD_VIEW'=>'Default Leads View', +'LBL_TAG_CLOUD'=>'Tag Cloud', +'LBL_LIST_TOOLS'=>'Tools', +'LBL_STATISTICS'=>'Statistics', +'LBL_TOTAL'=>'Total :', +'LBL_OTHERS'=>'Others :', +'LBL_USERS'=>'User(s)', +'LBL_USER_LOGIN_ROLE'=>'User Login & Role', +'LBL_USER_MORE_INFN'=>'More Information', +'LBL_USER_ADDR_INFN'=>'Address Information', +'LBL_USER_IMAGE'=>'User Image', +'LBL_USR'=>'Users', + +'LBL_MY'=>'My', +'LBL_MY_DEFAULTS'=>'My Defaults', +'LBL_MY_DESG'=>'My Designation & Contact Details', +'LBL_MY_ADDR'=>'My Postal Address', +'LBL_MY_PHOTO'=>'My Photo', +'LBL_CHANGE_PHOTO'=>'Change Photo...', +'LBL_CHANGE'=>'Change', + + +//Added for Access Privileges + +'LBL_GLOBAL_FIELDS_MANAGER'=>'Global Fields Manager', +'LBL_GLOBAL_ACCESS_PRIVILEGES'=>'Organization-level Sharing Rules', +'LBL_CUSTOM_ACCESS_PRIVILEGES'=>'Custom Sharing Rules', +'LBL_BOTH'=>'Both', +'LBL_VIEW'=>'View', +'LBL_RECALCULATE_BUTTON'=>'Recalculate', +'LBL_ADD_PRIVILEGES_BUTTON'=>'Add Privileges', +'LBL_CUSTOM_ACCESS_MESG'=>'No Custom Access Rules defined .', +'LBL_CREATE_RULE_MESG'=>'to create a new Rule', +'LBL_SELECT_SCREEN'=>'Select the Screen / Module :', +'LBL_FIELDS_AVLBL'=>'Fields Available in', +'LBL_FIELDS_SELECT_DESELECT'=>'Fields to be shown', +'LBL_ROLE_TO_BE_DELETED'=>'Role to be Deleted', +'LBL_TRANSFER_USER_ROLE'=>'Transfer Users to Role', +'LBL_DELETE_ROLE'=>'Delete Role', +'LBL_MORE_INFORMATION'=>'More Information', +'LBL_USERLOGIN_ROLE'=>'User Login & Role', +'LBL_USER_IMAGE_INFORMATION'=>'User Photograph', + +//Added for 5.0 for all fields +'Role'=>'Role', +'Email'=>'Email', +'Admin'=>'Admin', +'User Name'=>'User Name', +'First Name'=>'First Name', +'Last Name'=>'Last Name', +'Status'=>'Status', +'Default Activity View'=>'Default Calendar View', +'Default Lead View'=>'Default Lead View', +'Currency'=>'Currency', +'Title'=>'Title', +'Office Phone'=>'Office Phone', +'Department'=>'Department', +'Mobile'=>'Mobile', +'Reports To'=>'Reports To', +'Other Phone'=>'Other Phone', +'Other Email'=>'Other Email', +'Fax'=>'Fax', +'Yahoo id'=>'Yahoo id', +'Home Phone'=>'Home Phone', +'User Image'=>'Upload Photograph', +'Date Format'=>'Date Format', +'Tag Cloud'=>'Tag Cloud', +'Signature'=>'Signature', +'Documents'=>'Notes', +'Street Address'=>'Street Address', +'City'=>'City', +'State'=>'State', +'Postal Code'=>'Postal Code', +'Country'=>'Country', +'Password'=>'Password', +'Confirm Password'=>'Confirm Password', +'LBL_SHOWN'=>'Shown', +'LBL_HIDDEN'=>'Hidden', +'LBL_SHOW'=>'Show', +'LBL_HIDE'=>'Hide', +'LBL_HOME_PAGE_COMP'=>'Home Page Components', +'LBL_LOGIN_HISTORY'=>'Login History', +'LBL_USERDETAIL_INFO'=>'Viewing details about the user', +'LBL_DELETE_GROUP'=>'Delete Group', +'LBL_DELETE_GROUPNAME'=>'Group to be Deleted', +'LBL_TRANSFER_GROUP'=>'Transfer Ownership to: ', +'LBL_DELETE_USER'=>'User to be Deleted', +'LBL_TRANSFER_USER'=>'Transfer Ownership to User', +'LBL_DELETE_PROFILE'=>'Delete Profile', +'LBL_TRANSFER_ROLES_TO_PROFILE'=>'Transfer Roles to Profile', +'LBL_PROFILE_TO_BE_DELETED'=>'Profile to be Deteted', + +//Added for disabling window Recalculate + +'LBL_RECALC_MSG'=>'Are you sure, you wish to Recalculate Sharing Access?', +'LBL_YES'=>'Yes', +'LBL_NO'=>'No', + +'LBL_MANDATORY_MSG'=>'Mandatory Fields', +'LBL_DISABLE_FIELD_MSG'=>'Fields Disabled from Global Field Access Settings', + +//Added for About Us + +'LBL_CONTACT_US'=>'Contact Us', +'LBL_READ_LICENSE'=>'Read License', +'LBL_VERSION'=>'Version', +'LBL_TEAM'=>'Team', +'LBL_CREDITS'=>'Credits', +'LBL_THIRD_PARTY'=>'Third Party Packages', +'LBL_COMMUNITY'=>'And vtiger Community', + +'LBL_ASSIGN_ROLE'=>'Assign Role', + +//Moved from Settings to here for Webmail client integration (for 5.0.3 release) + +'LBL_ADD_MAIL_ACCOUNT'=>'Add Mail Account', +'LBL_NEW_MAIL_ACCOUNT_TITLE'=>'New Mail Account [Alt+M]', +'LBL_NEW_MAIL_ACCOUNT_KEY'=>'M', +'LBL_NEW_MAIL_ACCOUNT_LABEL'=>'New Mail Account', +'LBL_GENERAL_INFO'=>'General Information', +'LBL_DISPLAY_NAME'=>'Display Name', +'LBL_MAIL_PROTOCOL'=>'Mail Protocol', +'LBL_LIST_PASSWORD'=>'Password', +'LBL_MAIL_SERVER_NAME'=>'Mail Server Name or IP', +'LBL_INCOME_SERVER_SETTINGS'=>'Incoming Server', +'LBL_TEST_SETTINGS'=>'Test my account setting immediately', +'LBL_TEST_BUTTON_TITLE'=>'Test my account now! [Alt+T]', +'LBL_TEST_BUTTON_KEY'=>'T', +'LBL_TEST_BUTTON_LABEL'=>'Test my account now!', +'LBL_DEFAULT'=>'Default', +'LBL_IMAP2'=>'IMAP2', +'LBL_IMAP4'=>'IMAP4', +'LBL_POP'=>'POP', +'LBL_IMAP'=>'IMAP', +'LBL_MAIL_DISCLAIM'=>'Items marked with * are required', +'LBL_SSL_OPTIONS'=>'SSL Options', +'LBL_TLS'=>'TLS', +'LBL_NO_TLS'=>'No TLS', +'LBL_CERT_VAL'=>'Certificate Validations', +'LBL_INT_MAILER'=>'Use Internal Mailer?', +'LBL_INT_MAILER_USE'=>'Yes', +'LBL_INT_MAILER_NOUSE'=>'No', +'LBL_VAL_SSL_CERT'=>'Validate SSL Cert', +'LBL_DONOT_VAL_SSL_CERT'=>'Do Not Validate SSL Cert', +'LBL_WEB_MAIL_CONFIG'=>'Web Mail Configuration', +'LBL_CONFIGURE_WEB_MAIL'=>' - Configure Web Mail', +'LBL_LIST_MAIL_ACCOUNT'=>' List Mail Account', +'LBL_MY_MAIL_SERVER_DET'=>'My Incoming Mail Server Details', +'LBL_MY_DETAILS'=>'My Details', +'LBL_EMAIL_ID'=>'Email ID', +'LBL_EMAIL_ADDRESS'=>'Email', +'LBL_NAME_EXAMPLE'=>'(example : John Fenner)', +'LBL_EMAIL_EXAMPLE'=>'(example : johnfenner@xyz.com)', +'LBL_REFRESH_TIMEOUT'=>'Refresh Timeout', +'LBL_1_MIN'=>'1 minute', +'LBL_2_MIN'=>'2 minutes', +'LBL_3_MIN'=>'3 minutes', +'LBL_4_MIN'=>'4 minutes', +'LBL_5_MIN'=>'5 minutes', +'LBL_EMAILS_PER_PAGE'=>'Email per Page', +// Added for 5.0.3 + +'LBL_ENTER_PROFILE'=>'Enter The Profile Name', +'TITLE_USER_DOCUMENT'=>'Untitled Document', +'TITLE_VTIGER_CRM_5'=>'vtiger CRM 5 - Free, Commercial grade Open Source CRM', +'ROLE_DRAG_ERR_MSG'=>'You cannot move a Parent Node under a Child Node', + +'LBL_NOTIFICATION_ACTIVITY'=>'Notification Activity', +'LBL_NOTIFICATION_EMAIL_INFO'=>'Notification Email Information', +'LBL_GOTO_LISTVIEW_BUTTON'=>'Goto ListView', + +// Added/Updated for vtiger CRM 5.0.4 + +'LBL_SSL' => 'SSL', +//Added to fix the issue #4081 +'LBL_USERNAME_EXIST' => 'A User with the specified name Already Exists!', +'LBL_UNAUTHORIZED_ACCESS' => 'Unauthorized access to user administration', +//Added to provide User based TagCloud +'LBL_TAGCLOUD_DISPLAY'=>'Tag Cloud Display', +'INTERNAL_MAIL_COMPOSER'=>'Internal Mail Composer', + +// Added for 5.0.4 to Support Email notication on User Creation +'User Login Details'=>'User Login Details', +'LBL_TO_LOGIN' => 'to Login', + +// Added after 5.0.4 GA + +'LBL_USER_ADV_OPTIONS'=>'User Advanced Options', +'Reminder Interval'=>'Reminder Interval', +'Webservice Access Key'=>'Access Key', + +//user-group fixes +'LBL_GROUPNAME_EXIST' => 'A Group with the specified name Already Exists!', +'LBL_PROFILENAME_EXIST' => 'A Profile with the specified name Already Exists!', + +//Fixed For Asterisk Configration +'Asterisk Configuration' => 'Asterisk Configuration', +'Asterisk Extension' => 'Asterisk Extension', +' Receive Incoming Calls' => 'Receive Incoming Calls', +); + +?> diff --git a/oss/vtiger/trunk/modules/Users/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Users/language/zh_cn.lang.php new file mode 100644 index 00000000..4e346b68 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/language/zh_cn.lang.php @@ -0,0 +1,689 @@ +'Users', +'LBL_MODULE_TITLE'=>'Users: Home', +'LBL_SEARCH_FORM_TITLE'=>'User Search', +'LBL_LIST_FORM_TITLE'=>'User List', +'LBL_NEW_FORM_TITLE'=>'New User', +'LBL_CREATE_NEW_USER'=>'Create New User', +'LBL_LOGIN'=>'Login', +'LBL_USER_ROLE'=>'Role', +'LBL_LIST_NAME'=>'Name', +'LBL_LIST_LAST_NAME'=>'Last Name', +'LBL_LIST_USER_NAME'=>'User Name', +'LBL_LIST_DEPARTMENT'=>'Department', +'LBL_LIST_EMAIL'=>'E-Mail', +'LBL_LIST_PRIMARY_PHONE'=>'Primary Phone', +'LBL_LIST_ADMIN'=>'Admin', +'LBL_LIST_CONFIRM_PASSWORD'=>'Confirm Password', +'LBL_LIST_USER_NAME_ROLE'=>'User ID , Name & Role', +'LBL_LIST_SELECT'=>'Select', +'LBL_LIST_PHONE'=>'Phone', +'LBL_LIST_NO'=>'#', + +'LBL_ADMINS'=>'Admins', +'LBL_STD_USERS'=>'Standard Users', + +'UserName'=>'UserName', +'Name'=>'Name', +'Tools'=>'Tools', + + +//added for patch2 +'LBL_GROUP'=>'Group', +'LBL_CURRENCY_NAME'=>'Currency', + +'LBL_NEW_USER_BUTTON_TITLE'=>'New User [Alt+N]', +'LBL_NEW_USER_BUTTON_LABEL'=>'New User', +'LBL_NEW_USER_BUTTON_KEY'=>'N', +'LBL_DATE_FORMAT'=>'Date Format', + +'LBL_ERROR'=>'Error:', +'LBL_PASSWORD'=>'Password', +'LBL_USER_NAME'=>'User Name', +'LBL_CRM_ID'=>'CRM ID', +'LBL_FIRST_NAME'=>'First Name', +'LBL_LAST_NAME'=>'Last Name', +'LBL_YAHOO_ID'=>'Yahoo ID', +'LBL_THEME'=>'Color Theme', +'LBL_LANGUAGE'=>'Language', +'LBL_ADMIN'=>'Admin', +'LBL_OFFICE_PHONE'=>'Office Phone', +'LBL_REPORTS_TO'=>'Reports to', +'LBL_OTHER_PHONE'=>'Other Phone', +'LBL_OTHER_EMAIL'=>'Other Email', +'LBL_DEPARTMENT'=>'Department', +'LBL_STATUS'=>'Status', +'LBL_TITLE'=>'Title', +'LBL_ANY_PHONE'=>'Any Phone:', +'LBL_ANY_EMAIL'=>'Any Email:', +'LBL_ADDRESS'=>'Street Address', +'LBL_CITY'=>'City', +'LBL_STATE'=>'State', +'LBL_POSTAL_CODE'=>'Postal Code', +'LBL_COUNTRY'=>'Country', +'LBL_USER_SETTINGS'=>'User Settings', +'LBL_USER_INFORMATION'=>'User Information', +'LBL_MOBILE_PHONE'=>'Mobile', +'LBL_OTHER'=>'Other', +'LBL_FAX'=>'Fax', +'LBL_EMAIL'=>'E-Mail Id', +'LBL_HOME_PHONE'=>'Home Phone', +'LBL_ADDRESS_INFORMATION'=>'User Address', +'LBL_CAL_HRFORMAT'=>'Calendar Time Format', +'LBL_CAL_DURATION'=>'Day starts at', +'LBL_PRIMARY_ADDRESS'=>'Primary Address:', + +'LBL_CHANGE_PASSWORD_BUTTON_TITLE'=>'Change Password [Alt+P]', +'LBL_CHANGE_PASSWORD_BUTTON_KEY'=>'P', +'LBL_CHANGE_PASSWORD_BUTTON_LABEL'=>'Change Password', +'LBL_LOGIN_BUTTON_TITLE'=>'Login [Alt+L]', +'LBL_LOGIN_BUTTON_KEY'=>'L', +'LBL_LOGIN_BUTTON_LABEL'=>'Login', +'LBL_LOGIN_HISTORY_BUTTON_TITLE'=>'Login History [Alt+H]', +'LBL_LOGIN_HISTORY_BUTTON_KEY'=>'H', +'LBL_LOGIN_HISTORY_BUTTON_LABEL'=>'Login History', +'LBL_LOGIN_HISTORY_TITLE'=>'Users: Login History', +'LBL_RESET_PREFERENCES'=>'Reset To Default Preferences', + +'LBL_CHANGE_PASSWORD'=>'Change Password', +'LBL_OLD_PASSWORD'=>'Old Password:', +'LBL_NEW_PASSWORD'=>'New Password:', +'LBL_CONFIRM_PASSWORD'=>'Confirm Password:', +'ERR_ENTER_OLD_PASSWORD'=>'Please enter your old password.', +'ERR_ENTER_NEW_PASSWORD'=>'Please enter your new password.', +'ERR_ENTER_CONFIRMATION_PASSWORD'=>'Please enter your password confirmation.', +'ERR_REENTER_PASSWORDS'=>'Please re-enter passwords. The \"new password\" and \"confirm password\" values do not match.', +'ERR_INVALID_PASSWORD'=>'You must specify a valid username and password.', +'ERR_PASSWORD_CHANGE_FAILED_1'=>'User password change failed for ', +'ERR_PASSWORD_CHANGE_FAILED_2'=>' failed. The new password must be set.', +'ERR_PASSWORD_INCORRECT_OLD'=>'Incorrect old password specified. Re-enter password information.', +'ERR_USER_NAME_EXISTS_1'=>'The user name ', +'ERR_USER_NAME_EXISTS_2'=>' already exists. Duplicate user names are not allowed.
Change the user name to be unique.', +'ERR_LAST_ADMIN_1'=>'The user name ', +'ERR_LAST_ADMIN_2'=>' is the last Admin user. At least one user must be an Admin user.
Check the Admin user setting.', + +'ERR_DELETE_RECORD'=>"A record number must be specified to delete the account.", + +// Additional Fields for i18n --- Release vtigerCRM 3.2 Patch 2 +// Users--listroles.php , createrole.php , ListPermissions.php , editpermissions.php + +'LBL_ROLES'=>'Roles', +'LBL_ROLES_SUBORDINATES'=>'Roles and Subordinates', + +'LBL_CREATE_NEW_ROLE'=>'Create New Role', +'LBL_INDICATES_REQUIRED_FIELD'=>'Indicates Required Field', +'LBL_NEW_ROLE'=>'New Role', +'LBL_PARENT_ROLE'=>'Parent Role', + +'LBL_LIST_ROLES'=>'List Roles', +'LBL_ENTITY_LEVEL_PERMISSIONS'=>'Entity Level Permissions', +'LBL_ENTITY'=>'Entity', +'LBL_CREATE_EDIT'=>'Create/Edit', +'LBL_DELETE'=>'Delete', +'LBL_LEADS'=>'Leads', +'LBL_ACCOUNTS'=>'Accounts', +'LBL_CONTACTS'=>'Contacts', +'LBL_OPPURTUNITIES'=>'Opportunities', +'LBL_TASKS'=>'Tasks', +'LBL_CASES'=>'Cases', +'LBL_EMAILS'=>'Email', +'LBL_NOTES'=>'Documents', +'LBL_MEETINGS'=>'Meetings', +'LBL_CALLS'=>'Calls', +'LBL_IMPORT_PERMISSIONS'=>'Import Permissions', +'LBL_IMPORT_LEADS'=>'Import Leads', +'LBL_IMPORT_ACCOUNTS'=>'Import Accounts', +'LBL_IMPORT_CONTACTS'=>'Import Contacts', +'LBL_IMPORT_OPPURTUNITIES'=>'Import Opportunities', + +'LBL_ROLE_DETAILS'=>'Role Details', +//added for vtigercrm4 rc +'LBL_FILE'=> 'File Name', +'LBL_FILE_TYPE'=>'File Type', +'LBL_UPLOAD'=>'Upload File', +'LBL_ATTACH_FILE'=>'Attach Mail Merge Template', +'LBL_EMAIL_TEMPLATES'=>'Email Templates', +'LBL_TEMPLATE_HEADER'=>'Template', +'LBL_TEMPLATE_DETAILS'=>'Template Details', +'LBL_EDIT_TEMPLATE'=>'Edit Template', +'LBL_TEMPLATE_FILE'=>'Template File', +'LBL_EMAIL_TEMPLATES_LIST'=>'Communication Templates > Email Templates', +'LBL_MAILMERGE_TEMPLATES_LIST'=>' > Communication Templates > Mail Merge Templates', +'LBL_MAILMERGE_TEMPLATES_ATTACHMENT' => '> Communication Templates > Attach Mail Merge Template', +'LBL_DOWNLOAD_NOW'=>'Download Now', +'LBL_DOWNLOAD'=>'Download', +'LBL_SELECT_MODULE'=>'Select Module', +'LBL_MERGE_FILE'=>'File : ', +'LBL_MERGE_MSG'=>'Select a module to assign this Template', +'LBL_MERGE_FIELDS'=>'Merge Fields', +'LBL_COPY_PASTE'=>'Copy & Paste', +'LNK_GO_TO_TOP'=>'Go to Page Top', +'LBL_COLON'=>':', +'LBL_EMAIL_TEMPLATE'=>'Email Template', +'LBL_NEW_TEMPLATE'=>'New Template', +'LBL_ADD_TEMPLATE'=>'Add Template', +'LBL_USE_MERGE_FIELDS_TO_EMAIL_CONTENT'=>'Use merge fields to personalize your email content.', +'LBL_AVAILABLE_MERGE_FIELDS'=>'Available Merge Fields', +'LBL_SELECT_FIELD_TYPE'=>'Select Field Type', +'LBL_SELECT_FIELD'=>'Select Field :', +'LBL_MERGE_FIELD_VALUE'=>'Copy Merge Field Value :', +'LBL_ACCOUNT_FIELDS'=>'Account Fields', +'LBL_CONTACT_FIELDS'=>'Contact Fields', +'LBL_LEAD_FIELDS'=>'Lead Fields', +'LBL_COPY_AND_PASTE_MERGE_FIELD'=>'Copy and paste the merge field value into your template below.', +'LBL_EMAIL_TEMPLATE_INFORMATION'=>'Communication Templates > Email Templates > Viewing', +'LBL_FOLDER'=>'Folder', +'LBL_PERSONAL'=>'Personal', +'LBL_PUBLIC'=>'Public', +'LBL_TEMPLATE_NAME'=>'Template Name:', +'LBL_SUBJECT'=>'Subject', +'LBL_BODY'=>'Email Body', +'LBL_TEMPLATE_TOOLS'=>'Tools', +'LBL_TEMPLATE_PUBLIC'=>'Public Access', +'LBL_TEMPLATE_PRIVATE'=>'Private Access', +'LBL_TEMPLATE_SUBJECT'=>'Email Subject', +'LBL_TEMPLATE_MESSAGE'=>'Email Message', +'LBL_VIEWING'=>'Viewing', +'LBL_PROPERTIES'=>'Properties of', + + +//added to fix the issue #6630 +'LBL_ASTERISKEXTENSIONS_EXIST' => 'Asterisk Extension Already Exists!', + +// Added fields in createnewgroup.php +'LBL_CREATE_NEW_GROUP'=>'Create New Group', +'LBL_NEW_GROUP'=>'New Group', +'LBL_EDIT_GROUP'=>'Edit Group', +'LBL_GROUP_NAME'=>'Group Name', +'LBL_GROUP_DETAILS'=>'Group Details', +'LBL_MEMBER'=>'Members', +'LBL_MEMBER_AVLBL'=>'Available Entities & Members', +'LBL_MEMBER_SELECTED'=>'Selected Members', +'LBL_GROUP_MESG1'=>'Groups are a flexible way to assign access rights, when complex access rights has to be defined. You can combine multiple entities like Roles, Users, profiles etc into a single group.', +'LBL_GROUP_MESG2'=>'To add, select the Entity members from left and click the ">>" button.', +'LBL_GROUP_MESG3'=>'To remove, select the group members from the right and click the "<<" button.', + + +// Added fields in detailViewmailtemplate.html,listgroupmembers.php,listgroups.php +'LBL_DETAIL_VIEW_OF_EMAIL_TEMPLATE'=>'Detail View of Email Template', +'LBL_DETAIL_VIEW'=>'Detail View of', +'LBL_EDIT_VIEW'=>'Editing details of the user', +'LBL_EDITING'=>'Editing user', +'LBL_GROUP_MEMBERS_LIST'=>'Group members list', +'LBL_GROUPS'=>'Groups', +'LBL_MY_GROUPS'=>'My Groups', +'LBL_ADD_GROUP_BUTTON'=>'Add Group', +'LBL_WORD_TEMPLATES'=>'Mail Merge Templates', +'LBL_NEW_WORD_TEMPLATE'=>'New Template', +'LBL_EMAIL_TEMPLATE_DESC'=>'Manage email templates used for Campaigns and Mass mailing', +'LBL_NAME'=>'Name', + +// Added fields in TabCustomise.php,html and UpdateTab.php,html +'LBL_CUSTOMISE_TABS'=>'Customize Tabs', +'LBL_CHOOSE_TABS'=>'Choose Tabs', +'LBL_AVAILABLE_TABS'=>'Available Tabs', +'LBL_SELECTED_TABS'=>'Selected Tabs', +'LBL_USER'=>'User', +'LBL_TAB_MENU_UPDATED'=>'Tab Menu Updated! kindly go to ', +'LBL_TO_VIEW_CHANGES'=>' to view the changes', + +// Added to change homepage order +'LBL_CHANGE_HOMEPAGE_LABEL'=>'Homepage Order', +'LBL_CHANGE_HOMEPAGE_TITLE'=>'Homepage', + +// Added fields in binaryfilelist.php +'LBL_OERATION'=>'Operation', + +// Added fields in CreateProfile.php +'LBL_PROFILE_NAME'=>'Create New Profile:', +'LBL_NEW_PROFILE'=>'New Profile', +'LBL_NEW_PROFILE_NAME'=>'Profile Name', +'LBL_PARENT_PROFILE'=>'Parent Profile', +'LBL_BASIC_PROFILE_DETAILS'=>'Basic details of Profile', +'LBL_STEP_1_2'=>'Step 1 of 2', +'LBL_STEP_2_2'=>'Step 2 of 2', +'LBL_STEP'=>'Step', +'LBL_SELECT_BASE_PROFILE'=>'Select Base Profile', +'LBL_PROFILE_PRIVILEGES'=>'Profile Privileges', +'LBL_GLOBAL_PRIVILEGES'=>'Global Privileges', +'LBL_TAB_PRIVILEGES'=>'Tab Privileges', +'LBL_FIELD_PRIVILEGES'=>'Field Privileges', +'LBL_STANDARD_PRIVILEGES'=>'Standard Privileges', +'LBL_UTILITY_PRIVILEGES'=>'Utility Privileges', +'LBL_UTILITIES'=>'Utilities', +'LBL_BASE_PROFILE_MESG'=>'I would like to setup a base profile and edit privileges (Recommended)', +'LBL_BASE_PROFILE'=>'Base Profile:', +'LBL_OR'=>'OR', +'LBL_BASE_PROFILE_MESG_ADV'=>'I will choose the privileges from scratch (Advanced Users)', +'LBL_FOR'=>'for', +'LBL_GLOBAL_MESG_OPTION'=>'Select the options below to change global privileges', +'LBL_VIEW_ALL'=>'View all', +'LBL_EDIT_ALL'=>'Edit all', +'LBL_ALLOW'=>'Allows', +'LBL_MESG_VIEW'=>'to view all information / modules of vtiger CRM', +'LBL_MESG_EDIT'=>'to edit all information / modules of vtiger CRM', +'LBL_STD_MESG_OPTION'=>'Select the standard actions to be permitted', +'LBL_TAB_MESG_OPTION'=>'modules to be shown', +'LBL_UTILITY_MESG_OPTION'=>'Select the utility actions to be permitted', +'LBL_FIELD_MESG_OPTION'=>'Select the fields to be permitted', +'LBL_FINISH_BUTTON'=>'Finish', +'LBL_PROFILE_DETAIL_VIEW'=>'Detail View of Profile', +'LBL_PROFILE_MESG'=>'Viewing access privileges for', +'LBL_PROFILE_M'=>'Profile', +'LBL_DEFINE_PRIV_FOR'=>' Define Privileges for ', +'LBL_USE_OPTION_TO_SET_PRIV'=>'Use the options below to set privileges', +'LBL_SUPER_USER_PRIV'=>'Global Privileges', +'LBL_SET_PRIV_FOR_EACH_MODULE'=>'Set Privileges for each Module ', +'LBL_FIELDS_AND_TOOLS_SETTINGS'=>'Fields & Tools Settings', +'LBL_SHOW_FIELDS'=>'Show Fields', +'LBL_TOOLS_TO_BE_SHOWN'=>'Tools to be shown', +'LBL_WELCOME_PROFILE_CREATE'=>'Welcome to Privilege Profile Creator ', +'LBL_SELECT_CHOICE_NEW_PROFILE'=>'Select your choice of creating the new profile', +'LBL_ADD_CUSTOM_RULE'=>'Add Custom Privilege Rule', +'LBL_EDIT_CUSTOM_RULE'=>'Edit Custom Privilege Rule', +'LBL_CLOSE'=>'Close', +'LBL_SELECT_ENTITY'=>'Select an entity below', +'LBL_CAN_BE_ACCESSED_BY'=>'Can be accessed by', +'LBL_PERMISSIONS'=>'Permissions', +'LBL_ACCESS_RIGHTS_FOR_MODULES'=>'Access rights for relative modules', +'LBL_RULE_CONSTRUCTION'=>'Rule Construction Display', +'LBL_ADD_RULE'=>'Add Rule', +'LBL_RELATED_MODULE_RIGHTS'=>'Related Module Rights', +'LBL_IN_PERMISSION'=>'in the permission', + +//Added fields in createrole.php +'LBL_HDR_ROLE_NAME'=>'Create New Role:', +'LBL_TITLE_ROLE_NAME'=>'New Role', +'LBL_ROLE_NAME'=>'Role Name', +'LBL_ROLE_PROFILE_NAME'=>'Associate With Profile', +'LBL_SPECIFY_ROLE_NAME'=>'Specify a name for new role :', +'LBL_ASSIGN_PROFILE'=>'Assign Profile(s)', +'LBL_PROFILE_SELECT_TEXT'=>'Select the Profiles below and click on assign button', +'LBL_PROFILES_AVLBL'=>'Profiles Available', +'LBL_ASSIGN_PROFILES'=>'Assigned Profiles', +'LBL_REPORTS_TO_ROLE'=>'Reports to Role', +'LBL_ASSOCIATED_PROFILES'=>'Associated Profiles :', +'LBL_ASSOCIATED_USERS'=>'Associated Users :', + + +//Added fields in OrgSharingDetailsView.php +'LBL_ORG_SHARING_PRIVILEGES'=>'Organisation Sharing Privileges', +'LBL_EDIT_PERMISSIONS'=>'Edit Permissions', +'LBL_SAVE_PERMISSIONS'=>'Save Permissions', +'LBL_READ_ONLY'=>'Public: Read Only', +'LBL_EDIT_CREATE_ONLY'=>'Public: Read, Create/Edit', +'LBL_READ_CREATE_EDIT_DEL'=>'Public: Read, Create/Edit, Delete', +'LBL_PRIVATE'=>'Private', + +//Added fields in listnotificationschedulers.php +'LBL_HDR_EMAIL_SCHDS'=>'Users : Email Notifications', +'LBL_EMAIL_SCHDS_DESC'=>'The following is the list of notifications that are activated automatically when the corresponding event has happened.', +'LBL_ACTIVE'=>'Active', +'LBL_INACTIVE'=>'Inactive', +'LBL_NOTIFICATION'=>'Notification', +'LBL_DESCRIPTION'=>'Description', +'LBL_TASK_NOTIFICATION'=>'Delayed Task Notification', +'LBL_TASK_NOTIFICATION_DESCRITPION'=>'Notify when a task is delayed beyond 24 hrs', +'LBL_MANY_TICKETS'=>'Too many tickets Notification', +'LBL_MANY_TICKETS_DESCRIPTION'=>'Notify when a particular entity is allocated too many tickets, might reflect Service Level commitments', +'LBL_PENDING_TICKETS'=>'Pending Tickets Notification', +'LBL_TICKETS_DESCRIPTION'=>'Notify for getting attention to status of tickets which are pending', +'LBL_START_NOTIFICATION'=>'Support Start Notification', +'LBL_START_DESCRIPTION'=>'Notifiy stating the start of support/service', +'LBL_BIG_DEAL'=>'Big Deal Notification', +'LBL_BIG_DEAL_DESCRIPTION'=>'Notify on completion of big deal', +'LBL_SUPPORT_NOTICIATION'=>'Support End Notification', +'LBL_SUPPORT_DESCRIPTION'=>'Notify when support is about to end', +'LBL_BUTTON_UPDATE'=>'Update', +'LBL_MODULENAMES'=>'Module', + +//Added fields in ListFieldPermissions.html +'LBL_FIELD_PERMISSION_FIELD_NAME'=>'Field Name', +'LBL_FIELD_PERMISSION_VISIBLE'=>'Visible', +'LBL_FIELD_PERMISSIOM_TABLE_HEADER'=>'Standard Fields', +'LBL_FIELD_LEVEL_ACCESS'=>'Field Level Access', + +//Added fields after 4.0.1 +'LBL_SIGNATURE'=>'Signature', + +//Added for Event Reminder 4.2 Alpha release +'LBL_ACTIVITY_NOTIFICATION'=>'Event Reminder Notification', +'LBL_ACTIVITY_REMINDER_DESCRIPTION'=>'Notify before an event to occur based on the reminder set', +'LBL_MESSAGE'=>'Message', + +//Added for Global Privileges + +'Public: Read Only'=>'Public: Read Only', +'Public: Read, Create/Edit'=>'Public: Read, Create/Edit', +'Public: Read, Create/Edit, Delete'=>'Public: Read, Create/Edit, Delete', +'Private'=>'Private', +'Hide Details'=>'Hide Details', +'Hide Details and Add Events'=>'Hide Details and Add Events', +'Show Details'=>'Show Details', +'Show Details and Add Events'=>'Show Details and Add Events', + +'LBL_USR_CANNOT_ACCESS'=>'Users cannot access other users ', +'LBL_USR_CAN_ACCESS'=>'Users can ', +'LBL_USR_OTHERS'=>' other users ', + +'Read Only '=>'Read Only ', +'Read, Create/Edit, Delete '=>'Read, Create/Edit, Delete ', +'Read, Create/Edit '=>'Read, Create/Edit ', +'Read/Write'=>'Read/Write', +'LBL_GO_TO_TOP'=>'Go to Top', +'LNK_CLICK_HERE'=>'Click here', +'LBL_RULE_NO'=>'Rule No.', +'LBL_CAN_BE_ACCESSED'=>'can be accessed by', +'LBL_PRIVILEGES'=>'Privileges', +'LBL_OF'=>'of', + + + +//Added for 4.2GA support for mail server integration +'LBL_ADD_MAILSERVER_BUTTON_TITLE'=>'Add Mail Server', +'LBL_ADD_MAILSERVER_BUTTON_KEY'=>'M', +'LBL_ADD_MAILSERVER_BUTTON_LABEL'=>'Add Mail Server', + +'LBL_LIST_MAILSERVER_BUTTON_TITLE'=>'List Mail Server', +'LBL_LIST_MAILSERVER_BUTTON_KEY'=>'L', +'LBL_LIST_MAILSERVER_BUTTON_LABEL'=>'List Mail Server', +//added for inventory terms and conditions +'INV_TANDC'=>'Terms & Coditions', +'INV_TERMSANDCONDITIONS'=>'Inventory Terms & Coditions', +'LBL_INV_TERMSANDCONDITIONS'=>'Inventory Management', + + +'INVENTORYNOTIFICATION'=>'Inventory Notifications', +'LBL_INVENTORY_NOTIFICATIONS'=>'Edit Inventory Email Notifications', +'LBL_INV_NOT_DESC'=>'The following are the list of notifications that are sent to the product handler regarding the demand and the current quantity in hand during the creation of a Quote, SalesOrder and Invoice.', + +'InvoiceNotification'=>'Product Stock Notification during Invoice Generation', +'InvoiceNotificationDescription'=>'When the product stock level goes below the re-order level, notification will be sent to the product handler', + +'QuoteNotification'=>'Product Stock Notification during Quote Generation', +'QuoteNotificationDescription'=>'During quote generation if the product stock in warehouse is lesser than the quantity mentioned in quote then this notification will be sent to the product handler', + +'SalesOrderNotification'=>'Product Stock Notification during Sales Order Generation', +'SalesOrderNotificationDescription'=>'During sales order generation if the product stock in warehouse is lesser than the quantity mentioned in sales order then this notification will be sent to the product handler', + +//New addition for 4.2 GA +'LBL_USER_FIELDS'=>'User Fields', +'LBL_NOTE_DO_NOT_REMOVE_INFO'=>'Note: Donot remove or alter the values within { }', + +//Added for patch2 +'LBL_FILE_INFORMATION'=>'File Information', + +//Added after pathc2 +'LBL_LEAD_FIELD_ACCESS'=>'Lead Field Access', + +'LBL_ACCOUNT_FIELD_ACCESS'=>'Account Field Access', + +'LBL_CONTACT_FIELD_ACCESS'=>'Contact Field Access', + +'LBL_OPPORTUNITY_FIELD_ACCESS'=>'Potential Field Access', + +'LBL_HELPDESK_FIELD_ACCESS'=>'HelpDesk Field Access', + +'LBL_PRODUCT_FIELD_ACCESS'=>'Product Field Access', + +'LBL_NOTE_FIELD_ACCESS'=>'Document Field Access', + +'LBL_EMAIL_FIELD_ACCESS'=>'Email Field Access', + +'LBL_TASK_FIELD_ACCESS'=>'Task Field Access', + +'LBL_EVENT_FIELD_ACCESS'=>'Event Field Access', +'LBL_VENDOR_FIELD_ACCESS'=>'Vendor Field Access', +'LBL_PB_FIELD_ACCESS'=>'PriceBook Field Access', +'LBL_QUOTE_FIELD_ACCESS'=>'Quote Field Access', +'LBL_PO_FIELD_ACCESS'=>'Purchase Order Field Access', +'LBL_SO_FIELD_ACCESS'=>'Sales Order Access', +'LBL_INVOICE_FIELD_ACCESS'=>'Invoice Field Access', + +//given for calendar color for an user user +'LBL_COLOR'=>'Color in Calendar', +//added for activity view in home page +'LBL_ACTIVITY_VIEW'=>'Default Activity View', +//Added to change Home page order +'LBL_HOMEPAGE_ORDER_UPDATE'=>'Update Home Page Block Order', +'LBL_HOMEPAGE_ID'=>'Block Order', +'ERR_INVALID_USER'=>'Invalid access--Please call from My Accounts', +'ALVT'=>'Top Accounts', +'PLVT'=>'Top Potentials', +'QLTQ'=>'Top Quotes', +'CVLVT'=>'Key Metrics', +'HLT'=>'Top Trouble Tickets', +'OLV'=>'Upcoming & Pending Activities', +'GRT'=>'My Group Allocation', +'OLTSO'=>'Top Sales Orders', +'ILTI'=>'Top Invoices', +'HDB'=>'Home Page Dashboard', +'OLTPO'=>'Top Purchase Orders', +'LTFAQ'=>'My Recent FAQs', +'UA'=>'Upcoming Activities', +'PA'=>'Pending Activities', + +//Added for 5.0 alpha +'LBL_GROUP_NAME_ERROR'=>'Group Name already exists!', +'MNL'=>'My New Leads', +'LBL_LEAD_VIEW'=>'Default Leads View', +'LBL_TAG_CLOUD'=>'Tag Cloud', +'LBL_LIST_TOOLS'=>'Tools', +'LBL_STATISTICS'=>'Statistics', +'LBL_TOTAL'=>'Total :', +'LBL_OTHERS'=>'Others :', +'LBL_USERS'=>'User(s)', +'LBL_USER_LOGIN_ROLE'=>'User Login & Role', +'LBL_USER_MORE_INFN'=>'More Information', +'LBL_USER_ADDR_INFN'=>'Address Information', +'LBL_USER_IMAGE'=>'User Image', +'LBL_USR'=>'Users', + +'LBL_MY'=>'My', +'LBL_MY_DEFAULTS'=>'My Defaults', +'LBL_MY_DESG'=>'My Designation & Contact Details', +'LBL_MY_ADDR'=>'My Postal Address', +'LBL_MY_PHOTO'=>'My Photo', +'LBL_CHANGE_PHOTO'=>'Change Photo...', +'LBL_CHANGE'=>'Change', + + +//Added for Access Privileges + +'LBL_GLOBAL_FIELDS_MANAGER'=>'Global Fields Manager', +'LBL_GLOBAL_ACCESS_PRIVILEGES'=>'Organization-level Sharing Rules', +'LBL_CUSTOM_ACCESS_PRIVILEGES'=>'Custom Sharing Rules', +'LBL_BOTH'=>'Both', +'LBL_VIEW'=>'View', +'LBL_RECALCULATE_BUTTON'=>'Recalculate', +'LBL_ADD_PRIVILEGES_BUTTON'=>'Add Privileges', +'LBL_CUSTOM_ACCESS_MESG'=>'No Custom Access Rules defined .', +'LBL_CREATE_RULE_MESG'=>'to create a new Rule', +'LBL_SELECT_SCREEN'=>'Select the Screen / Module :', +'LBL_FIELDS_AVLBL'=>'Fields Available in', +'LBL_FIELDS_SELECT_DESELECT'=>'Fields to be shown', +'LBL_ROLE_TO_BE_DELETED'=>'Role to be Deleted', +'LBL_TRANSFER_USER_ROLE'=>'Transfer Users to Role', +'LBL_DELETE_ROLE'=>'Delete Role', +'LBL_MORE_INFORMATION'=>'More Information', +'LBL_USERLOGIN_ROLE'=>'User Login & Role', +'LBL_USER_IMAGE_INFORMATION'=>'User Photograph', + +//Added for 5.0 for all fields +'Role'=>'Role', +'Email'=>'Email', +'Admin'=>'Admin', +'User Name'=>'User Name', +'First Name'=>'First Name', +'Last Name'=>'Last Name', +'Status'=>'Status', +'Default Activity View'=>'Default Calendar View', +'Default Lead View'=>'Default Lead View', +'Currency'=>'Currency', +'Title'=>'Title', +'Office Phone'=>'Office Phone', +'Department'=>'Department', +'Mobile'=>'Mobile', +'Reports To'=>'Reports To', +'Other Phone'=>'Other Phone', +'Other Email'=>'Other Email', +'Fax'=>'Fax', +'Yahoo id'=>'Yahoo id', +'Home Phone'=>'Home Phone', +'User Image'=>'Upload Photograph', +'Date Format'=>'Date Format', +'Tag Cloud'=>'Tag Cloud', +'Signature'=>'Signature', +'Documents'=>'Notes', +'Street Address'=>'Street Address', +'City'=>'City', +'State'=>'State', +'Postal Code'=>'Postal Code', +'Country'=>'Country', +'Password'=>'Password', +'Confirm Password'=>'Confirm Password', +'LBL_SHOWN'=>'Shown', +'LBL_HIDDEN'=>'Hidden', +'LBL_SHOW'=>'Show', +'LBL_HIDE'=>'Hide', +'LBL_HOME_PAGE_COMP'=>'Home Page Components', +'LBL_LOGIN_HISTORY'=>'Login History', +'LBL_USERDETAIL_INFO'=>'Viewing details about the user', +'LBL_DELETE_GROUP'=>'Delete Group', +'LBL_DELETE_GROUPNAME'=>'Group to be Deleted', +'LBL_TRANSFER_GROUP'=>'Transfer Ownership to: ', +'LBL_DELETE_USER'=>'User to be Deleted', +'LBL_TRANSFER_USER'=>'Transfer Ownership to User', +'LBL_DELETE_PROFILE'=>'Delete Profile', +'LBL_TRANSFER_ROLES_TO_PROFILE'=>'Transfer Roles to Profile', +'LBL_PROFILE_TO_BE_DELETED'=>'Profile to be Deteted', + +//Added for disabling window Recalculate + +'LBL_RECALC_MSG'=>'Are you sure, you wish to Recalculate Sharing Access?', +'LBL_YES'=>'Yes', +'LBL_NO'=>'No', + +'LBL_MANDATORY_MSG'=>'Mandatory Fields', +'LBL_DISABLE_FIELD_MSG'=>'Fields Disabled from Global Field Access Settings', + +//Added for About Us + +'LBL_CONTACT_US'=>'Contact Us', +'LBL_READ_LICENSE'=>'Read License', +'LBL_VERSION'=>'Version', +'LBL_TEAM'=>'Team', +'LBL_CREDITS'=>'Credits', +'LBL_THIRD_PARTY'=>'Third Party Packages', +'LBL_COMMUNITY'=>'And vtiger Community', + +'LBL_ASSIGN_ROLE'=>'Assign Role', + +//Moved from Settings to here for Webmail client integration (for 5.0.3 release) + +'LBL_ADD_MAIL_ACCOUNT'=>'Add Mail Account', +'LBL_NEW_MAIL_ACCOUNT_TITLE'=>'New Mail Account [Alt+M]', +'LBL_NEW_MAIL_ACCOUNT_KEY'=>'M', +'LBL_NEW_MAIL_ACCOUNT_LABEL'=>'New Mail Account', +'LBL_GENERAL_INFO'=>'General Information', +'LBL_DISPLAY_NAME'=>'Display Name', +'LBL_MAIL_PROTOCOL'=>'Mail Protocol', +'LBL_LIST_PASSWORD'=>'Password', +'LBL_MAIL_SERVER_NAME'=>'Mail Server Name or IP', +'LBL_INCOME_SERVER_SETTINGS'=>'Incoming Server', +'LBL_TEST_SETTINGS'=>'Test my account setting immediately', +'LBL_TEST_BUTTON_TITLE'=>'Test my account now! [Alt+T]', +'LBL_TEST_BUTTON_KEY'=>'T', +'LBL_TEST_BUTTON_LABEL'=>'Test my account now!', +'LBL_DEFAULT'=>'Default', +'LBL_IMAP2'=>'IMAP2', +'LBL_IMAP4'=>'IMAP4', +'LBL_POP'=>'POP', +'LBL_IMAP'=>'IMAP', +'LBL_MAIL_DISCLAIM'=>'Items marked with * are required', +'LBL_SSL_OPTIONS'=>'SSL Options', +'LBL_TLS'=>'TLS', +'LBL_NO_TLS'=>'No TLS', +'LBL_CERT_VAL'=>'Certificate Validations', +'LBL_INT_MAILER'=>'Use Internal Mailer?', +'LBL_INT_MAILER_USE'=>'Yes', +'LBL_INT_MAILER_NOUSE'=>'No', +'LBL_VAL_SSL_CERT'=>'Validate SSL Cert', +'LBL_DONOT_VAL_SSL_CERT'=>'Do Not Validate SSL Cert', +'LBL_WEB_MAIL_CONFIG'=>'Web Mail Configuration', +'LBL_CONFIGURE_WEB_MAIL'=>' - Configure Web Mail', +'LBL_LIST_MAIL_ACCOUNT'=>' List Mail Account', +'LBL_MY_MAIL_SERVER_DET'=>'My Incoming Mail Server Details', +'LBL_MY_DETAILS'=>'My Details', +'LBL_EMAIL_ID'=>'Email ID', +'LBL_EMAIL_ADDRESS'=>'Email', +'LBL_NAME_EXAMPLE'=>'(example : John Fenner)', +'LBL_EMAIL_EXAMPLE'=>'(example : johnfenner@xyz.com)', +'LBL_REFRESH_TIMEOUT'=>'Refresh Timeout', +'LBL_1_MIN'=>'1 minute', +'LBL_2_MIN'=>'2 minutes', +'LBL_3_MIN'=>'3 minutes', +'LBL_4_MIN'=>'4 minutes', +'LBL_5_MIN'=>'5 minutes', +'LBL_EMAILS_PER_PAGE'=>'Email per Page', +// Added for 5.0.3 + +'LBL_ENTER_PROFILE'=>'Enter The Profile Name', +'TITLE_USER_DOCUMENT'=>'Untitled Document', +'TITLE_VTIGER_CRM_5'=>'vtiger CRM 5 - Free, Commercial grade Open Source CRM', +'ROLE_DRAG_ERR_MSG'=>'You cannot move a Parent Node under a Child Node', + +'LBL_NOTIFICATION_ACTIVITY'=>'Notification Activity', +'LBL_NOTIFICATION_EMAIL_INFO'=>'Notification Email Information', +'LBL_GOTO_LISTVIEW_BUTTON'=>'Goto ListView', + +// Added/Updated for vtiger CRM 5.0.4 + +'LBL_SSL' => 'SSL', +//Added to fix the issue #4081 +'LBL_USERNAME_EXIST' => 'A User with the specified name Already Exists!', +'LBL_UNAUTHORIZED_ACCESS' => 'Unauthorized access to user administration', +//Added to provide User based TagCloud +'LBL_TAGCLOUD_DISPLAY'=>'Tag Cloud Display', +'INTERNAL_MAIL_COMPOSER'=>'Internal Mail Composer', + +// Added for 5.0.4 to Support Email notication on User Creation +'User Login Details'=>'User Login Details', +'LBL_TO_LOGIN' => 'to Login', + +// Added after 5.0.4 GA + +'LBL_USER_ADV_OPTIONS'=>'User Advanced Options', +'Reminder Interval'=>'Reminder Interval', +'Webservice Access Key'=>'Access Key', + +//user-group fixes +'LBL_GROUPNAME_EXIST' => 'A Group with the specified name Already Exists!', +'LBL_PROFILENAME_EXIST' => 'A Profile with the specified name Already Exists!', + +//Fixed For Asterisk Configration +'Asterisk Configuration' => 'Asterisk Configuration', +'Asterisk Extension' => 'Asterisk Extension', +' Receive Incoming Calls' => 'Receive Incoming Calls', +); + +?> diff --git a/oss/vtiger/trunk/modules/Users/lookupemailtemplates.php b/oss/vtiger/trunk/modules/Users/lookupemailtemplates.php new file mode 100644 index 00000000..0dcff2ba --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/lookupemailtemplates.php @@ -0,0 +1,76 @@ + + + + + + <?php echo $mod_strings['LBL_EMAIL_TEMPLATES_LIST']; ?> + + + +
+
+
+ + + + + + +pquery($sql, array()); + $temprow = $adb->fetch_array($result); + +$cnt=1; + +require_once('include/utils/UserInfoUtil.php'); +require('user_privileges/user_privileges_'.$current_user->id.'.php'); +do +{ + $templatename = $temprow["templatename"]; + if($is_admin == false) + { + $folderName = $temprow['foldername']; + if($folderName != 'Personal') + { + printf(""; + printf("",$temprow["description"]); + } + } + else + { + printf(""; + printf("",$temprow["description"]); + } + $cnt++; + +}while($temprow = $adb->fetch_array($result)); +?> +
+
"); + echo "".$temprow["templatename"]."%s
"); + echo "".$temprow["templatename"]."%s
+ + + diff --git a/oss/vtiger/trunk/modules/Users/massChangeStatus.php b/oss/vtiger/trunk/modules/Users/massChangeStatus.php new file mode 100644 index 00000000..11aebd50 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/massChangeStatus.php @@ -0,0 +1,139 @@ +'lead_status_dom'); +$comboFieldArray = getComboArray($comboFieldNames); + +?> + + + + +
+ + + + + + + +
Status Information
+ + + + +
Select New Status:
+
+ + + + +
+ + +
+ + +
+pquery("select * from vtiger_users", array()); + for($i=0;$i<$adb->num_rows($result);$i++) + { + $useridlist[$i]=$adb->query_result($result,$i,'id'); + $usernamelist[$useridlist[$i]]=$adb->query_result($result,$i,'user_name'); + } + +?> +
+ +
+ + + + + + + +
Owner Information
+ + + + +
Select New Owner:
+
+ + + + +
+ + +
+ + +
+ \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/massdelete.php b/oss/vtiger/trunk/modules/Users/massdelete.php new file mode 100644 index 00000000..a3b10a6c --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/massdelete.php @@ -0,0 +1,80 @@ + 0) { + $ret = getEntityName($returnmodule,$ids_list); + if(count($ret) > 0) + { + $errormsg = implode(',',$ret); + } +} + +if(isset($_REQUEST['smodule']) && ($_REQUEST['smodule']!='')) +{ + $smod = "&smodule=".vtlib_purify($_REQUEST['smodule']); +} +if(isset($_REQUEST['start']) && ($_REQUEST['start']!='')) +{ + $rstart = "&start=".vtlib_purify($_REQUEST['start']); +} +if($returnmodule == 'Emails') +{ + if(isset($_REQUEST['folderid']) && $_REQUEST['folderid'] != '') + { + $folderid = vtlib_purify($_REQUEST['folderid']); + }else + { + $folderid = 1; + } + header("Location: index.php?module=".$returnmodule."&action=".$returnmodule."Ajax&folderid=".$folderid."&ajax=delete".$rstart."&file=ListView&errormsg=".$errormsg.$url); +} +elseif($return_action == 'ActivityAjax') +{ + $subtab = vtlib_purify($_REQUEST['subtab']); + header("Location: index.php?module=".$returnmodule."&action=".$return_action."".$rstart."&view=".vtlib_purify($_REQUEST['view'])."&hour=".vtlib_purify($_REQUEST['hour'])."&day=".vtlib_purify($_REQUEST['day'])."&month=".vtlib_purify($_REQUEST['month'])."&year=".vtlib_purify($_REQUEST['year'])."&type=".vtlib_purify($_REQUEST['type'])."&viewOption=".vtlib_purify($_REQUEST['viewOption'])."&subtab=".$subtab.$url); +} + +elseif($returnmodule!='Faq') +{ + header("Location: index.php?module=".$returnmodule."&action=".$returnmodule."Ajax&ajax=delete".$rstart."&file=ListView&viewname=".$viewid."&errormsg=".$errormsg.$url); +} +else +{ + header("Location: index.php?module=".$returnmodule."&action=".$returnmodule."Ajax&ajax=delete".$rstart."&file=ListView&errormsg=".$errormsg.$url); +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/notify_detail.php b/oss/vtiger/trunk/modules/Users/notify_detail.php new file mode 100644 index 00000000..137dbbee --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/notify_detail.php @@ -0,0 +1,69 @@ + + + + + + +<?php echo $mod_strings['TITLE_USER_DOCUMENT']; ?> + + + +
+ + + + +
: +
+
+ + + + + + + + + + + + + + + + + + + + + + +
:
:
:
: <?php echo $mod_strings['LBL_INACTIVE']; ?> + [Deactivate]
:
:
+ + + +
  + +  
+
+ + diff --git a/oss/vtiger/trunk/modules/Users/populatetemplate.php b/oss/vtiger/trunk/modules/Users/populatetemplate.php new file mode 100644 index 00000000..68c6904e --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/populatetemplate.php @@ -0,0 +1,100 @@ +pquery($sql, array($_REQUEST["templateid"])); +$tempArray = $adb->fetch_array($tempresult); +$fileContent = $tempArray["body"]; + +checkFileAccess($root_directory.'/modules/Emails/templates/'.$_REQUEST["templatename"]); +$handle = fopen($root_directory.'/modules/Emails/templates/'.$_REQUEST["templatename"],"wb") ; +fwrite($handle,$fileContent,89999999); +fclose($handle); + +//create a file and write to it so that it can be used as the emailtemplateusage.php file + +if (is_file($root_directory.'/modules/Emails/templates/testemailtemplateusage.php')) { + $is_writable = is_writable($root_directory.'/modules/Emails/templates/testemailtemplateusage.php'); +} else { + $is_writable = is_writable('.'); +} + +$myString = "retrieve_entity_info($recordid,$module); + +$i=0; +$m=0; +$n=0; +$myString; + +//storing the columnname and the value pairs +foreach ($focus->column_fields as $columnName=>$value) { + $myString .= "$" .$module ."_" .$columnName.' = "'. $value."\";\n\n"; + $colName[$i] = $columnName; + $i++; + $j=$i; +} + +global $current_user; +global $adb; +$query = 'select * from vtiger_users where id= ?'; +$result = $adb->pquery($query, array($current_user->id)); +$res_row = $adb->fetchByAssoc($result); +foreach ($res_row as $columnName=>$value) { + $myString .='$users_' .$columnName.' = "'. $value."\";\n\n"; + $usercolName[$n] = $columnName; + $n++; + $m=$n; +} + +$myString .= "\$globals = \""; + +for($i=0;$i<$j-1;$i++) { + $myString .= "\\$" .$module ."_" .$colName[$i].", "; +} +for($n=0;$n<$m;$n++) { + $myString .= '\\$users_' .$usercolName[$n].", "; +} + +$myString .= "\\$" .$module ."_" .$colName[$i]; +$myString .="\"; \n\n"; + +$myString .= "?> \n"; +if ($is_writable && ($config_file = @ fopen($root_directory.'/modules/Emails/templates/testemailtemplateusage.php', "w"))) { + $log->debug("writing to the testemailtemplatuseage.php file"); + fputs($config_file, $myString, strlen($myString)); + fclose($config_file); +} +checkFileAccess($root_directory.'/modules/Emails/templates/'.$_REQUEST["templatename"]); +$templatename = $root_directory.'/modules/Emails/templates/'.$_REQUEST["templatename"]; +header("Location:index.php?module=Users&action=TemplateMerge&templatename=".$templatename); + +?> + diff --git a/oss/vtiger/trunk/modules/Users/updateLeadDBStatus.php b/oss/vtiger/trunk/modules/Users/updateLeadDBStatus.php new file mode 100644 index 00000000..649de193 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/updateLeadDBStatus.php @@ -0,0 +1,104 @@ +pquery($del_act,array($id, $id)); + if($_REQUEST['owner_type'] == 'User') { + $count_r = $adb->pquery("select * from vtiger_salesmanactivityrel where smid=? and activityid=?",array($idval, $id)); + if($adb->num_rows($count_r) == 0) { + $insert = "insert into vtiger_salesmanactivityrel values(?,?)"; + $result = $adb->pquery($insert, array($idval, $id)); + } + } + } + //Now we have to update the smownerid + $sql = "update vtiger_crmentity set modifiedby=?, smownerid=?, modifiedtime=? where crmid=?"; + $result = $adb->pquery($sql, array($current_user->id, $idval, $adb->formatDate($date_var, true), $id)); + } + else + { + $ids_list[] = $id; + } + } +} +elseif(isset($_REQUEST['leadval']) && $_REQUEST['leadval']!='') +{ + + foreach($storearray as $id) + { + if(isPermitted($return_module,'EditView',$id) == 'yes') + { + if($id != '') { + $sql = "update vtiger_leaddetails set leadstatus=? where leadid=?"; + $result = $adb->pquery($sql, array($leadstatusval, $id)); + $query = "update vtiger_crmentity set modifiedby=?, modifiedtime=? where crmid=?"; + $result1 = $adb->pquery($query, array($current_user->id, $adb->formatDate($date_var, true), $id)); + } + } + else + { + $ids_list[] = $id; + } + + } +} +if(count($ids_list) > 0) { + $ret_owner = getEntityName($return_module,$ids_list); + $errormsg = implode(',',$ret_owner); +} else { + $errormsg = ''; +} +if($return_action == 'ActivityAjax') { + $view = vtlib_purify($_REQUEST['view']); + $day = vtlib_purify($_REQUEST['day']); + $month = vtlib_purify($_REQUEST['month']); + $year = vtlib_purify($_REQUEST['year']); + $type = vtlib_purify($_REQUEST['type']); + $viewOption = vtlib_purify($_REQUEST['viewOption']); + $subtab = vtlib_purify($_REQUEST['subtab']); + + header("Location: index.php?module=$return_module&action=".$return_action."&type=".$type.$rstart."&view=".$view."&day=".$day."&month=".$month."&year=".$year."&viewOption=".$viewOption."&subtab=".$subtab.$url); +} else { + header("Location: index.php?module=$return_module&action=".$return_module."Ajax&file=ListView&ajax=changestate".$rstart."&viewname=".$viewid."&errormsg=".$errormsg.$url); +} + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Users/updateNotificationSchedulers.php b/oss/vtiger/trunk/modules/Users/updateNotificationSchedulers.php new file mode 100644 index 00000000..55a000e5 --- /dev/null +++ b/oss/vtiger/trunk/modules/Users/updateNotificationSchedulers.php @@ -0,0 +1,47 @@ +pquery($sql, array($flag, $i)); +} + +header("Location:index.php?module=Users&action=listnotificationschedulers"); + + + + + +?>