source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXDMGT.m@ 1722

Last change on this file since 1722 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1LEXDMGT ; ISL Defaults - Manager/Update ; 09-23-96
2 ;;2.0;LEXICON UTILITY;;Sep 23, 1996
3 Q
4 ; LEXDICS Filter
5 ; LEXDICS(0) Filter name
6 ; LEXSHOW Display
7 ; LEXSHOW(0) Display name
8 ; LEXSUB Vocabulary
9 ; LEXSUB(0) Vocabulary name
10 ; LEXCTX Shortcut Context
11 ; LEXCTX(0) Shortcut Context name
12 ;
13 ; LEXAP Application
14 ; LEXAPS Multiple Applications
15 ; LEXDCUR Current default value (pre-edit)
16 ; LEXDNAM Default name
17 ; LEXDVAL Default value
18 ; LEXFLD Default field # in 757.201
19 ; LEXC Counter
20 ; LEXL User Location
21 ; LEXS User Service
22 ; LEXUSER DUZ of user to update defaults
23 ;
24 ; Needs:
25 ;
26 ; LEXAP Application
27 ; LEXOVER Flag - Overwrite user defaults (Y/N)
28 ; LEXLIM Limits (parameter for LEXMETH)
29 ; LEXMETH Method, singel user, by service, by location,
30 ; by both service and location, or all users
31 ;
32UPDATE ; Update user defaults
33 Q:'$L($G(LEXAP)) Q:'$L($G(LEXOVER)) Q:'$L($G(LEXMETH)) Q:'$L($G(LEXLIM))
34 N ZTSAVE,ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK,Y
35 S (ZTSAVE("LEXOVER"),ZTSAVE("LEXAP"),ZTSAVE("LEXMETH"),ZTSAVE("LEXLIM"))=""
36 S (ZTSAVE("LEXDICS"),ZTSAVE("LEXDICS(0)"),ZTSAVE("LEXSHOW"),ZTSAVE("LEXSHOW(0)"))=""
37 S (ZTSAVE("LEXSUB"),ZTSAVE("LEXSUB(0)"),ZTSAVE("LEXCTX"),ZTSAVE("LEXCTX(0)"))=""
38 S ZTRTN="UPDT^LEXDMGT",ZTDESC="Up-dating User Defaults"
39 S ZTDTH=$H,ZTIO="" D ^%ZTLOAD
40 W:$D(ZTSK) !!,"Task has been created to update user defaults"
41 W:'$D(ZTSK) !!,"Unable to create a task to update user defaults"
42 D HOME^%ZIS Q
43UPDT ; TaskManager entry point to Update Defaults (tasked)
44 N LEXUSER,LEXDVAL,LEXDNAM,LEXFLD
45 S LEXMETH=$P(LEXMETH,U,1) Q:LEXMETH=""
46ONE ; Single user
47 I LEXMETH="ONE" S LEXUSER=+LEXLIM D G UPDTQ
48 . Q:$P(^VA(200,LEXUSER,0),U,1)="" D BYAPPS
49MULTI ; Multiple users
50 S LEXUSER=+($O(^VA(200,1),-1))
51 F S LEXUSER=$O(^VA(200,LEXUSER)) Q:+LEXUSER=0 D
52 . Q:$P($G(^VA(200,LEXUSER,0)),U,1)="" D BYAPPS
53 G UPDTQ
54BYAPPS ; Process defaults by application
55 I LEXAP'[";" S LEXAP=+LEXAP D:+LEXAP>0 BYUSR Q
56 I LEXAP[";" D Q
57 . N LEXC,LEXAPS S LEXAPS=LEXAP
58 . F LEXC=1:1:$L(LEXAPS,";") S LEXAP=$P(LEXAPS,";",LEXC) D BYUSR
59 . S LEXAP=LEXAPS
60BYUSR ; Process defaults by user
61 N LEXS,LEXL
62 S LEXS=$P($G(^VA(200,LEXUSER,5)),"^",1) S:LEXS="" LEXS=-1
63 S LEXL=$P($G(^VA(200,LEXUSER,100.1)),"^",7) S:LEXL="" LEXL=-1
64 D:LEXMETH="ALL"!(LEXMETH="ONE") UPUSR
65 D:LEXMETH="SEV"&(+LEXLIM=+LEXS) UPUSR
66 D:LEXMETH="LOC"&(+LEXLIM=+LEXL) UPUSR
67 I LEXMETH="SAL" D
68 . I +($P(LEXLIM,U,1))>0,+($P(LEXLIM,U,1))=+LEXS D
69 . . I +($P(LEXLIM,U,2))>0,+($P(LEXLIM,U,2))=+LEXL D UPUSR
70 Q
71UPUSR ; Update user defaults for user LEXUSER
72 N LEXDCUR,LEXDVAL,LEXDNAM,LEXFLD
73UPDIC ; Filter LEXDICS
74 S LEXFLD=1,LEXDCUR=$G(^LEXT(757.2,LEXAP,200,LEXUSER,LEXFLD))
75 S LEXDVAL=$G(LEXDICS),LEXDNAM=$G(LEXDICS(0))
76 G:LEXDCUR'=""&('LEXOVER) UPSHOW D:LEXDVAL'="" SAVE
77 ;
78UPSHOW ; Display LEXSHOW
79 S LEXFLD=2,LEXDCUR=$G(^LEXT(757.2,LEXAP,200,LEXUSER,LEXFLD))
80 S LEXDVAL=$G(LEXSHOW),LEXDNAM=$G(LEXSHOW(0))
81 G:LEXDCUR'=""&('LEXOVER) UPSUB D:LEXDVAL'="" SAVE
82 ;
83UPSUB ; Vocabulary LEXSUB
84 S LEXFLD=3,LEXDCUR=$G(^LEXT(757.2,LEXAP,200,LEXUSER,LEXFLD))
85 S LEXDVAL=$G(LEXSUB),LEXDNAM=$G(LEXSUB(0))
86 G:LEXDCUR'=""&('LEXOVER) UPCON D:LEXDVAL'="" SAVE
87 ;
88UPCON ; Shortcut Context LEXCTX
89 S LEXFLD=4,LEXDCUR=$G(^LEXT(757.2,LEXAP,200,LEXUSER,LEXFLD))
90 S LEXDVAL=$G(LEXCTX),LEXDNAM=$G(LEXCTX(0))
91 G:LEXDCUR'=""&('LEXOVER) UPQ D:LEXDVAL'="" SAVE
92 ;
93UPQ ; Quit update
94 Q
95UPDTQ ; Quit update (tasked)
96 S:$D(ZTQUEUED) ZTREQ="@" Q
97 Q
98SAVE ; Save default - SET^LEXDSV(DUZ,APPLICATION,VALUE,NAME,FIELD)
99 I LEXDVAL'["@" D Q
100 . D SET^LEXDSV(LEXUSER,LEXAP,LEXDVAL,LEXDNAM,LEXFLD) Q
101 ; Kill default - SET^LEXDSV(DUZ,APPLICATION,"@","",FIELD)
102 D SET^LEXDSV(LEXUSER,LEXAP,"@","",LEXFLD) Q
Note: See TracBrowser for help on using the repository browser.