Prevent Work Date change

fmhigue
Member Posts: 290
Hi everybody:
I made some changes to Codeunit 1 - ApplicationManagement on MakeDateText. I added the following code:
MemberOf.SETCURRENTKEY("User ID","Role ID",Company);
MemberOf.SETFILTER("User ID",USERID);
IF MemberOf.FIND('-') THEN
REPEAT
IF MemberOf."Role ID" <> 'SUPER' THEN
SuperUser:= FALSE
ELSE
SuperUser:= TRUE
UNTIL (SuperUser = TRUE) OR (MemberOf.NEXT=0);
IF UserSetup.GET(USERID) THEN
IF UserSetup."Allow Change Work Date" = TRUE THEN
WorkDateModifyUser := TRUE
ELSE
WorkDateModifyUser := FALSE;
IF (SuperUser = FALSE) AND (WorkDateModifyUser = FALSE) THEN
BEGIN
PreWorkDate := WORKDATE;
MESSAGE('You are not authorized to change Work Date. Please contact your manager.\'
+ '\Usted no esta autorizado para cambiar el Work Date. Por favor contacte a su gerente.');
DateText := FORMAT(PreWorkDate);
WORKDATE := PreWorkDate;
EXIT(1);
END
It works fine preventing not allowed users to change the Work Date. But now I got a problem with users that run Aged Accounts Receivables Reports, Aged Vendor Report, etc. They are getting the same error message. Like it they were trying to change the workdate. Any ideas?
Thank you in advance
I made some changes to Codeunit 1 - ApplicationManagement on MakeDateText. I added the following code:
MemberOf.SETCURRENTKEY("User ID","Role ID",Company);
MemberOf.SETFILTER("User ID",USERID);
IF MemberOf.FIND('-') THEN
REPEAT
IF MemberOf."Role ID" <> 'SUPER' THEN
SuperUser:= FALSE
ELSE
SuperUser:= TRUE
UNTIL (SuperUser = TRUE) OR (MemberOf.NEXT=0);
IF UserSetup.GET(USERID) THEN
IF UserSetup."Allow Change Work Date" = TRUE THEN
WorkDateModifyUser := TRUE
ELSE
WorkDateModifyUser := FALSE;
IF (SuperUser = FALSE) AND (WorkDateModifyUser = FALSE) THEN
BEGIN
PreWorkDate := WORKDATE;
MESSAGE('You are not authorized to change Work Date. Please contact your manager.\'
+ '\Usted no esta autorizado para cambiar el Work Date. Por favor contacte a su gerente.');
DateText := FORMAT(PreWorkDate);
WORKDATE := PreWorkDate;
EXIT(1);
END
It works fine preventing not allowed users to change the Work Date. But now I got a problem with users that run Aged Accounts Receivables Reports, Aged Vendor Report, etc. They are getting the same error message. Like it they were trying to change the workdate. Any ideas?
Thank you in advance
0
Comments
-
They are getting the same error message.
because AFAIK, makedatetext is called everytime you write in a date field/variable...(anyway, i've never modified it)0 -
Any ideas thow to get around of my problem?
Thank you0 -
Why do you need to prevent them from doing this? And why would they?
It shouldn't be because of posting, you can just change the allowed posting dates for the users.
I think you should just train the users not to change it. If they can't follow directions then you have a problem with the employee. Most users don't even know what a workdate is from what I've seen, much less how to change it.0 -
Please sai, why do you want to prevent them?
Only, like matttrax said, for posting?Do you make it right, it works too!0 -
matttrax wrote:I think you should just train the users not to change it. If they can't follow directions then you have a problem with the employee.
This seems more feasible solution than using hammer on system.Kapil Khanna0 -
Mattrax it is just what you said we have the bad habit of being changing workdate. It is a company problem to be honest but some managers are the ones making those mistakes so it does not apply the same for them.
matttrax0 -
I have a customer with A LOT of scedulers. They changed their Workdate by mistake to 1 year ahead and all the sceduled tasks where triggered.
We cannot use TODAY instead of WORKDATE because of supprt issues.
I´m considering a code in CU 10 -
I'm all for "error-proofing" the system at time, but I don't think this is one of them.
Try putting a warning message in, if the workdate is more than a certain amount past the schedule date it will say "Are you sure you didn't make a mistake?"
Users will make mistakes, even with training, but the best you can do is tell them to pay attention to what they are doing.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions