Хочу добавить новое поле в настройки пользователя
Здравствуйте.
Хочу добавить новую настройку пользователя.
На такие записи система ругается.
Добавил новое поле.
Прописал аналогичные записи в скрипт.
UserSettings.ShowArhiveFiles);
Node.GetAttributeAsBool(ShowArhiveFilesAttrName,
UserSettings.ShowArhiveFiles, DefShowArhiveFiles);
Я так понимаю атрибуты ндолжны быть где-то заданы в системе.
Просто так их присвоить в ходе работы нельзя.
Как это сделать?
Нравится
Неужели никто не знает как это делается в X25 3.0.4 и возможно ли вообще?
Здравствуйте!
Там все достаточно просто. Необходимо сделать аналогично другим настройкам.
Приведите пожалуйста ошибки. После этого Вам можно будет ответить более точно.
src_UserSettingsScript:
// ---------------------------------------------------------------------------- // wnd_UserSettingsScript // ---------------------------------------------------------------------------- var UserSettings = new Object(); var DefHighligthOverdue = true; var HighligthOverdueAttrName = 'HighligthOverdue'; var DefCheckDuplicateContactName = true; var CheckDuplicateContactNameAttrName = 'CheckDuplicateContactName'; var DefCheckDuplicateContactCommunications = true; var CheckDuplicateContactCommunicationsAttrName = 'CheckDuplicateContactCommunications'; var DefCheckDuplicateAccountName = true; var CheckDuplicateAccountNameAttrName = 'CheckDuplicateAccountName'; var DefCheckDuplicateAccountCommunications = true; var CheckDuplicateAccountCommunicationsAttrName = 'CheckDuplicateAccountCommunications'; var DefAutobindingReceivedMessages = true; var AutobindingReceivedMessagesAttrName = 'AutobindingReceivedMessages'; var DefIgnoreRecieveRecipientAddress = true; var IgnoreRecieveRecipientAddressAttrName = 'IgnoreRecieveRecipientAddress'; var DefAutobindingSendedMessages = true; var AutobindingSendedMessagesAttrName = 'AutobindingSendedMessages'; var DefIgnoreSendSenderAddress = true; var IgnoreSendSenderAddressAttrName = 'IgnoreSendSenderAddress'; var DefLinkReceivedMessagesToCurrentUser = false; var LinkReceivedMessagesToCurrentUserAttrName = 'LinkReceivedMessagesToCurrentUser'; var DefLinkSendedMessagesToCurrentUser = true; var LinkSendedMessagesToCurrentUserAttrName = 'LinkSendedMessagesToCurrentUser'; var DefTasksShowConfirmDialogOnSendEmail = true; var TasksShowConfirmDialogOnSendEmailAttrName = 'TasksShowConfirmDialogOnSendEmail'; var DefOverdueColor = 0xDFDFFF; var OverdueColorAttrName = 'OverdueColor'; var DefShowAccountContactsByCareer = false; var DefAccountContactsByCareerColor = 0x000000; var ShowAccountContactsByCareerAttrName = 'ShowAccountContactsByCareer'; var AccountContactsByCareerColorAttrName = 'AccountContactsByCareerColor'; var QuickFilterLikeTypeIDAttrName = 'QuickFilterLikeTypeID'; var DefQuickFilterLikeTypeID = '-1'; var DefShowArhiveFiles = false; var ShowArhiveFilesAttrName = 'ShowArhiveFiles'; function InitializeCurrentUserAttributes() { var QuickFilterLikeTypeID = UserSettings.QuickFilterLikeTypeID; if (IsEmptyValue(QuickFilterLikeTypeID)) { QuickFilterLikeTypeID = -1; } Connector.CurrentUser.QuickFilterLikeType = QuickFilterLikeTypeID; } function InternalSetAttributes() { SetAttribute(Self, 'UserSettings', UserSettings); SetAttribute(Self, HighligthOverdueAttrName, UserSettings.HighligthOverdue); SetAttribute(Self, CheckDuplicateContactNameAttrName, UserSettings.CheckDuplicateContactName); SetAttribute(Self, CheckDuplicateContactCommunicationsAttrName, UserSettings.CheckDuplicateContactCommunications); SetAttribute(Self, CheckDuplicateAccountNameAttrName, UserSettings.CheckDuplicateAccountName); SetAttribute(Self, CheckDuplicateAccountCommunicationsAttrName, UserSettings.CheckDuplicateAccountCommunications); SetAttribute(Self, AutobindingReceivedMessagesAttrName, UserSettings.AutobindingReceivedMessages); SetAttribute(Self, IgnoreRecieveRecipientAddressAttrName, UserSettings.IgnoreRecieveRecipientAddress); SetAttribute(Self, AutobindingSendedMessagesAttrName, UserSettings.AutobindingSendedMessages); SetAttribute(Self, IgnoreSendSenderAddressAttrName, UserSettings.IgnoreSendSenderAddress); SetAttribute(Self, LinkReceivedMessagesToCurrentUserAttrName, UserSettings.LinkReceivedMessagesToCurrentUser); SetAttribute(Self, LinkSendedMessagesToCurrentUserAttrName, UserSettings.LinkSendedMessagesToCurrentUser); SetAttribute(Self, TasksShowConfirmDialogOnSendEmailAttrName, UserSettings.TasksShowConfirmDialogOnSendEmail); SetAttribute(Self, OverdueColorAttrName, UserSettings.OverdueColor); SetAttribute(Self, ShowAccountContactsByCareerAttrName, UserSettings.ShowAccountContactsByCareer); SetAttribute(Self, AccountContactsByCareerColorAttrName, UserSettings.AccountContactsByCareerColor); SetAttribute(Self, QuickFilterLikeTypeIDAttrName, UserSettings.QuickFilterLikeTypeID); // SetAttribute(Self, ShowArhiveFiles, // UserSettings.ShowArhiveFiles); InitializeCurrentUserAttributes(); } function SetDefaultUserSettings() { UserSettings.HighligthOverdue = DefHighligthOverdue; UserSettings.CheckDuplicateContactName = DefCheckDuplicateContactName; UserSettings.CheckDuplicateContactCommunications = DefCheckDuplicateContactCommunications; UserSettings.CheckDuplicateAccountName = DefCheckDuplicateAccountName; UserSettings.CheckDuplicateAccountCommunications = DefCheckDuplicateAccountCommunications; UserSettings.AutobindingReceivedMessages = DefAutobindingReceivedMessages; UserSettings.IgnoreRecieveRecipientAddress = DefIgnoreRecieveRecipientAddress; UserSettings.AutobindingSendedMessages = DefAutobindingSendedMessages; UserSettings.IgnoreSendSenderAddress = DefIgnoreSendSenderAddress; UserSettings.LinkReceivedMessagesToCurrentUser = DefLinkReceivedMessagesToCurrentUser; UserSettings.LinkSendedMessagesToCurrentUser = DefLinkSendedMessagesToCurrentUser; UserSettings.TasksShowConfirmDialogOnSendEmail = DefTasksShowConfirmDialogOnSendEmail; UserSettings.OverdueColor = DefOverdueColor; UserSettings.ShowAccountContactsByCareer = DefShowAccountContactsByCareer; UserSettings.AccountContactsByCareerColor = DefAccountContactsByCareerColor; UserSettings.QuickFilterLikeTypeID = DefQuickFilterLikeTypeID; UserSettings.ShowArhiveFiles = DefShowArhiveFiles; InternalSetAttributes(); } // ---------------------------------------------------------------------------- // Event handlers // ---------------------------------------------------------------------------- function wnd_UserSettingsOnCreate(Window) { SetDefaultUserSettings(); } function wnd_UserSettingsOnPrepare(Window) { frmData.GroupType = fgtHidden; } function wnd_UserSettingsOnShow(Window) { chbHighligthOverdue.IsChecked = UserSettings.HighligthOverdue; chbCheckDuplicateContactName.IsChecked = UserSettings.CheckDuplicateContactName; chbCheckDuplicateContactCommunications.IsChecked = UserSettings.CheckDuplicateContactCommunications; chbCheckDuplicateAccountName.IsChecked = UserSettings.CheckDuplicateAccountName; chbCheckDuplicateAccountCommunications.IsChecked = UserSettings.CheckDuplicateAccountCommunications; chbAutobindingReceivedMessages.IsChecked = UserSettings.AutobindingReceivedMessages; chbIgnoreRecieveRecipientAddress.IsChecked = UserSettings.IgnoreRecieveRecipientAddress; chbAutobindingSendedMessages.IsChecked = UserSettings.AutobindingSendedMessages; chbIgnoreSendSenderAddress.IsChecked = UserSettings.IgnoreSendSenderAddress; chbLinkToCurrentContactOnReceive.IsChecked = UserSettings.LinkReceivedMessagesToCurrentUser; chbLinkToCurrentContactOnSend.IsChecked = UserSettings.LinkSendedMessagesToCurrentUser; chbTasksShowConfirmDialogOnSendEmail.IsChecked = UserSettings.TasksShowConfirmDialogOnSendEmail; clbOverdueColor.Color = UserSettings.OverdueColor; chbShowAccountContactsByCareer.IsChecked = UserSettings.ShowAccountContactsByCareer; clbAccountContactsByCareerColor.Color = UserSettings.AccountContactsByCareerColor; edtQuickFilterLikeType.Value = edtQuickFilterLikeType.Enum.ItemsByID( UserSettings.QuickFilterLikeTypeID); chbShowArhiveFiles.IsChecked = UserSettings.ShowArhiveFiles; } function wnd_UserSettingsOnProfileDeserialize(Window, Node) { UserSettings.HighligthOverdue = Node.GetAttributeAsBool(HighligthOverdueAttrName, DefHighligthOverdue); UserSettings.CheckDuplicateContactName = Node.GetAttributeAsBool( CheckDuplicateContactNameAttrName, DefCheckDuplicateContactName); UserSettings.CheckDuplicateContactCommunications = Node.GetAttributeAsBool(CheckDuplicateContactCommunicationsAttrName, DefCheckDuplicateContactCommunications); UserSettings.CheckDuplicateAccountName = Node.GetAttributeAsBool( CheckDuplicateAccountNameAttrName, DefCheckDuplicateAccountName); UserSettings.CheckDuplicateAccountCommunications = Node.GetAttributeAsBool(CheckDuplicateAccountCommunicationsAttrName, DefCheckDuplicateAccountCommunications); UserSettings.AutobindingReceivedMessages = Node.GetAttributeAsBool( AutobindingReceivedMessagesAttrName, DefAutobindingReceivedMessages); UserSettings.IgnoreRecieveRecipientAddress = Node.GetAttributeAsBool(IgnoreRecieveRecipientAddressAttrName, DefIgnoreRecieveRecipientAddress); UserSettings.AutobindingSendedMessages = Node.GetAttributeAsBool( AutobindingSendedMessagesAttrName, DefAutobindingSendedMessages); UserSettings.IgnoreSendSenderAddress = Node.GetAttributeAsBool(IgnoreSendSenderAddressAttrName, DefIgnoreSendSenderAddress); UserSettings.LinkReceivedMessagesToCurrentUser = Node.GetAttributeAsBool(LinkReceivedMessagesToCurrentUserAttrName, DefLinkReceivedMessagesToCurrentUser); UserSettings.LinkSendedMessagesToCurrentUser = Node.GetAttributeAsBool(LinkSendedMessagesToCurrentUserAttrName, DefLinkSendedMessagesToCurrentUser); UserSettings.TasksShowConfirmDialogOnSendEmail = Node.GetAttributeAsBool(TasksShowConfirmDialogOnSendEmailAttrName, DefTasksShowConfirmDialogOnSendEmail); UserSettings.OverdueColor = Node.GetAttributeAsInt(OverdueColorAttrName, DefOverdueColor); UserSettings.ShowAccountContactsByCareer = Node.GetAttributeAsBool(ShowAccountContactsByCareerAttrName, DefShowAccountContactsByCareer); UserSettings.AccountContactsByCareerColor = Node.GetAttributeAsInt(AccountContactsByCareerColorAttrName, DefAccountContactsByCareerColor); UserSettings.QuickFilterLikeTypeID = Node.GetAttributeAsStr(QuickFilterLikeTypeIDAttrName, DefQuickFilterLikeTypeID); UserSettings.ShowArhiveFiles = Node.GetAttributeAsBool(ShowArhiveFilesAttrName, DefShowArhiveFiles); InternalSetAttributes(); } function wnd_UserSettingsOnProfileSerialize(Window, Node) { Node.SetAttributeAsBool(HighligthOverdueAttrName, UserSettings.HighligthOverdue, DefHighligthOverdue); Node.SetAttributeAsBool(CheckDuplicateContactNameAttrName, UserSettings.CheckDuplicateContactName, DefCheckDuplicateContactName); Node.SetAttributeAsBool(CheckDuplicateContactCommunicationsAttrName, UserSettings.CheckDuplicateContactCommunications, DefCheckDuplicateContactCommunications); Node.SetAttributeAsBool(CheckDuplicateAccountNameAttrName, UserSettings.CheckDuplicateAccountName, DefCheckDuplicateAccountName); Node.SetAttributeAsBool(CheckDuplicateAccountCommunicationsAttrName, UserSettings.CheckDuplicateAccountCommunications, DefCheckDuplicateAccountCommunications); Node.SetAttributeAsBool(AutobindingReceivedMessagesAttrName, UserSettings.AutobindingReceivedMessages, DefAutobindingReceivedMessages); Node.SetAttributeAsBool(IgnoreRecieveRecipientAddressAttrName, UserSettings.IgnoreRecieveRecipientAddress, DefIgnoreRecieveRecipientAddress); Node.SetAttributeAsBool(AutobindingSendedMessagesAttrName, UserSettings.AutobindingSendedMessages, DefAutobindingSendedMessages); Node.SetAttributeAsBool(IgnoreSendSenderAddressAttrName, UserSettings.IgnoreSendSenderAddress, DefIgnoreSendSenderAddress); Node.SetAttributeAsBool(LinkReceivedMessagesToCurrentUserAttrName, UserSettings.LinkReceivedMessagesToCurrentUser, DefLinkReceivedMessagesToCurrentUser); Node.SetAttributeAsBool(LinkSendedMessagesToCurrentUserAttrName, UserSettings.LinkSendedMessagesToCurrentUser, DefLinkSendedMessagesToCurrentUser); Node.SetAttributeAsBool(TasksShowConfirmDialogOnSendEmailAttrName, UserSettings.TasksShowConfirmDialogOnSendEmail, DefTasksShowConfirmDialogOnSendEmail); Node.SetAttributeAsInt(OverdueColorAttrName, UserSettings.OverdueColor, DefOverdueColor); Node.SetAttributeAsBool(ShowAccountContactsByCareerAttrName, UserSettings.ShowAccountContactsByCareer, DefShowAccountContactsByCareer); Node.SetAttributeAsInt(AccountContactsByCareerColorAttrName, UserSettings.AccountContactsByCareerColor, DefAccountContactsByCareerColor); Node.SetAttributeAsStr(QuickFilterLikeTypeIDAttrName, UserSettings.QuickFilterLikeTypeID, DefQuickFilterLikeTypeID); // Node.GetAttributeAsBool(ShowArhiveFilesAttrName, // UserSettings.ShowArhiveFiles, DefShowArhiveFiles); } function btnOKOnClick(Control) { UserSettings.HighligthOverdue = chbHighligthOverdue.IsChecked; UserSettings.CheckDuplicateContactName = chbCheckDuplicateContactName.IsChecked; UserSettings.CheckDuplicateContactCommunications = chbCheckDuplicateContactCommunications.IsChecked; UserSettings.CheckDuplicateAccountName = chbCheckDuplicateAccountName.IsChecked; UserSettings.CheckDuplicateAccountCommunications = chbCheckDuplicateAccountCommunications.IsChecked; UserSettings.AutobindingReceivedMessages = chbAutobindingReceivedMessages.IsChecked; UserSettings.IgnoreRecieveRecipientAddress = chbIgnoreRecieveRecipientAddress.IsChecked; UserSettings.AutobindingSendedMessages = chbAutobindingSendedMessages.IsChecked; UserSettings.IgnoreSendSenderAddress = chbIgnoreSendSenderAddress.IsChecked; UserSettings.LinkReceivedMessagesToCurrentUser = chbLinkToCurrentContactOnReceive.IsChecked; UserSettings.LinkSendedMessagesToCurrentUser = chbLinkToCurrentContactOnSend.IsChecked; UserSettings.TasksShowConfirmDialogOnSendEmail = chbTasksShowConfirmDialogOnSendEmail.IsChecked; UserSettings.OverdueColor = clbOverdueColor.Color; UserSettings.ShowAccountContactsByCareer = chbShowAccountContactsByCareer.IsChecked; UserSettings.AccountContactsByCareerColor = clbAccountContactsByCareerColor.Color; UserSettings.QuickFilterLikeTypeID = edtQuickFilterLikeType.Value.ID; UserSettings.ShowArhiveFiles = chbShowArhiveFiles.IsChecked; InternalSetAttributes(); Self.Close(); } function btnCancelOnClick(Control) { Self.Close(); }
При попытке раскомментировать новый параметр:
[08.10.14 11.01.00.771] (E) Ошибка выполнения метода 'wnd_UserSettingsOnCreate'. 'ShowArhiveFiles' - определение отсутствует «Call Stack» [08.10.14 11.01.03.584] (E) Ошибка выполнения метода 'wnd_UserSettingsOnProfileDeserialize'. 'ShowArhiveFiles' - определение отсутствует «Call Stack»
Ошибка в ф-ции InternalSetAttributes вместо имени атрибута Вы используете неизвестную переменную...
... SetAttribute(Self, ShowArhiveFilesAttrName, //<-- здесь была ошибка UserSettings.ShowArhiveFiles); ...
Node.GetAttributeAsBool(ShowArhiveFilesAttrName, UserSettings.ShowArhiveFiles, DefShowArhiveFiles); [08.10.14 11.17.45.084] (E) Ошибка выполнения метода 'wnd_UserSettingsOnProfileSerialize'. OLE error 80020101 «Call Stack» [08.10.14 11.17.56.990] (E) Ошибка выполнения метода 'wnd_UserSettingsOnProfileSerialize'. Недопустимое число аргументов или присвоение значения свойства «Call Stack»
Если Вы устанавливаете значение атрибута, то необходимо использовать ф-цию SetAttributeAsBool, а не GetAttributeAsBool...
Спасибо.
Нужно быть внимательнее.
Такие глупые ошибки.
Как добавить поле спросил, а как обратится к значению поля из скрипта wnd_FilesDetailGridAreaScript забыл спросить? :)
В скрипте scr_WindowUtils есть функция GetUserSettings. Она возращает объект UserSettings. И Вы у него можете запрашивать нужные Вам св-ва.
Здравствуйте!
Хочу добавить новое поле в карточку контрагента. При попытке сохранить tbl_account выдает ошибку unsuccessful metadata update
Column Name from table tbl_Account is referenced in tsp_GetCurrentUserInfo
This operation is not defined for system tables.
Error Code: 31
ALTER TABLE "tbl_Account" ALTER "Name" TYPE VARCHAR(250) CHARACTER SET UNICODE_FSS
Причем ошибка появляется даже если изменений не было сделано. Раньше все было нормально, поля добавлялись. Используем Terrasoft Sales 3.2, Firebird. Возможно дело в репликации которая не так давно проводилась.
Помогите пожалуйста.
Добрый день, Игорь!
Пожалуйста, создайте новую тему - Ваш вопрос не имеет отношения к пользовательским настройкам (но имеет отношение к процессу пересохранения таблиц для версии 3.2.x Firebird). При создании темы укажите полную версию приложения (4 цифры, например 3.2.0.19), версию и тип СУБД. Эти данные значительно помогут службе поддержки ответить на Ваш вопрос и сформировать решение.