AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 19.01.2009, 20:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,584 / 848 (80) +++++++
Регистрация: 28.10.2006
staticsax: Restore(ctrl-F5) and access control (AllowEdit) problem
Источник: http://staticsax.blogspot.com/2009/0...s-control.html
==============



 
Trivia:
It is usual programming pattern in AX that one overrides active() method on the datasource to allow/disallow data entry on fields depending on values of any fields in record.
It is also usual pattern to do similar thing overriding modified() method on datasource fields.


I would like to warn anyone using that pattern , that every screen in AX2009 SP0  will fail to behave as expected.
 
Problem:
When you re-read the contents of the record on the form using F5 function key, AX 2009 SP0 does call the datasource's active method, allowing you to re-set access (   _DS.object().allowEdit(...)    )
but DOES NOT call *_DS.active()  method when one press Ctrl-F5.
 
Scenario of failure:
User arrives at the record, enters some data , is allowed access to the other fields (based on previous input).
Now user presses Ctrl-F5, and all field values return to initially fetched, but *_DS.active() method is not called, potentially making editable fields which were not  available upon arrival to that record.   User happily changes the data, and developer ask himself a question how did it happened.
 
BTW: _DS.cursorNotify() is not called either.
 
It would be good if someone would confirm this behaviour in AX4 and AX2009SP1
 
Solution:
For the time being there's small generic solution to this. You need to modify the SysSetupFormRun.task() to make it call active() after Ctrl-F5 was pressed.
 
public int task(int _p1)
{
    #task
    FormDataSource formDataSource;

 
    int ret;
 
    if (_p1 == #taskFilter)
    {
        formDataSource = this.objectSet();
        if (formDataSource &&
            formDataSource.queryRun() &&
            formDataSource.queryRun().args() &&
            !formDataSource.queryRun().args().caller())
        {
            formDataSource.queryRun().args().caller(this);
        }
    }

 
    ret = super(_p1);
    //mku------------------------------------------------- to call the datasource's active and allow re-setting the access----------
    if(_p1 == 2839)
    {
        formDataSource = this.objectSet();
        if(formDataSource)
        {
            formDataSource.active();
        }
    }

 
    //mku ------------------------------------------------------  end  ------------------------------------------------------------
    return ret;
}









Источник: http://staticsax.blogspot.com/2009/0...s-control.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:24.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.