Produced by Araxis Merge on 11/2/2017 7:18:07 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | CAPRI_CIF.zip\CAPRI_CIF\Source | KernelUtilities.pas | Wed Nov 1 18:09:34 2017 UTC |
2 | CAPRI_CIF.zip\CAPRI_CIF\Source | KernelUtilities.pas | Wed Nov 1 18:45:12 2017 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 582 |
Changed | 1 | 4 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | unit Kerne lUtilities ; | |
2 | ||
3 | // For inf o on use, e-mail PII | |
4 | // or PII | |
5 | // | |
6 | // Require s the RPCB roker deve lopment co mponents f or Delphi | |
7 | // Require s the File man compon ents for D elphi | |
8 | // | |
9 | // Origina lly built for the CA PRI applic ation | |
10 | // | |
11 | // Thanks for your h elp, Joel and Wally! :-) | |
12 | ||
13 | interface | |
14 | ||
15 | uses Fmcmp nts, | |
16 | Fmcntrls , | |
17 | dialogs, | |
18 | Trpcb, | |
19 | classes, | |
20 | sysutils ; | |
21 | ||
22 | function k ernel_Assi gnMenuToSe condary(xB roker: TRP CBroker; x DUZ: strin g; xMenu: string): s tring; | |
23 | function k ernel_Assi gnMenuToPr imary(xBro ker: TRPCB roker; xDU Z: string; xMenu: st ring): str ing; | |
24 | ||
25 | implementa tion | |
26 | ||
27 | // functio n Kernel_A ssignMenuT oPrimary(x Broker: TR PCBroker; xDUZ: Stri ng; xMenu: String):s tring; | |
28 | // | |
29 | // Checks if user's primary me nu matches the passe d in menu. | |
30 | // If not, the menu is changed to the ne w menu. | |
31 | // | |
32 | // Params: | |
33 | // xB roker = A TRPCBroker component already i nstantiate d in the m ain applic ation | |
34 | // xD UZ = User' s DUZ # (I EN in NEW PERSON fil e) to whic h the menu option sh ould be as signed | |
35 | // xM enu = The exact name of the me nu being a ssigned - .01 field of file 19 (OPTION f ile) | |
36 | // | |
37 | // Result: 1^Succes s message, if any | |
38 | // 0^Error/ Info messa ge/No chan ges made m essage | |
39 | ||
40 | function K ernel_Assi gnMenuToPr imary(xBro ker: TRPCB roker; xDU Z: string; xMenu: st ring): str ing; | |
41 | var | |
42 | xFMFinde r: TFMFind er; | |
43 | xFMGets: TFMGets; | |
44 | xFMFiler : TFMFiler ; | |
45 | Options: TStringLi st; | |
46 | OptionIE N: string; | |
47 | x: integ er; | |
48 | FoundFla g: Integer ; | |
49 | begin | |
50 | xMenu := uppercase (xMenu); | |
51 | ||
52 | // Check if the br oker is co nnected. If not, do n't contin ue. | |
53 | if xBrok er.Connect ed = False then begi n | |
54 | Result := '0^The RPCBroker does not have an ac tive conne ction.'; | |
55 | exit; | |
56 | end; | |
57 | ||
58 | // Searc h for a ma tch on the specified option. Get the IE N. | |
59 | // Use t he Finder for speed | |
60 | Options := TString List.Creat e; | |
61 | xFMFinde r := TFMFi nder.Creat e(xBroker) ; | |
62 | xFMFinde r.FileNumb er := '19' ; | |
63 | xFMFinde r.RPCBroke r := xBrok er; | |
64 | xFMFinde r.Value := xMenu; | |
65 | xFMFinde r.GetFinde rList(Opti ons); | |
66 | FoundFla g := -1; | |
67 | if Optio ns.Count > 0 then | |
68 | for x := 0 to Op tions.Coun t - 1 do | |
69 | if O ptions[x] = xMenu th en begin | |
70 | Fo undFlag := x; | |
71 | Op tionIEN := xFMFinder .Results[x ]; | |
72 | end; | |
73 | xFMFinde r.Free; | |
74 | Options. Free; | |
75 | if Found Flag = -1 then begin | |
76 | Result := '0^An exact matc h for opti on ' + xMe nu + ' was n''t found on this s ystem.'; | |
77 | exit; | |
78 | end; | |
79 | // Optio nIEN now c ontains th e IEN in t he option file for t he specifi ed menu op tion in th e params | |
80 | ||
81 | // Check the user' s primary menu in th e NEW PERS ON file. | |
82 | xFMGets := TFMGets .Create(xB roker); | |
83 | xFMGets. FileNumber := '200'; | |
84 | xFMGets. FieldNumbe rs.Add('20 1'); | |
85 | xFMGets. IENS := xD uz; | |
86 | xFMGets. RPCBroker := xBroker ; | |
87 | xFMGets. GetData; | |
88 | ||
89 | // If no primary m enu, set t he primary menu | |
90 | try | |
91 | if xFM Gets.GetFi eld('201') .FMDBInter nal = '' t hen begin | |
92 | xFMF iler := TF MFiler.Cre ate(xBroke r); | |
93 | xFMF iler.RPCBr oker := xB roker; | |
94 | xFMF iler.AddFD A('200', x DUZ, '201' , OptionIE N); | |
95 | if n ot xFMFile r.Update t hen begin | |
96 | xF MFiler.Fre e; | |
97 | Re sult := '0 ^There was a problem setting t he specifi ed user''s primary m enu to the specified option.'; | |
98 | ex it; | |
99 | end; | |
100 | xFMF iler.Free; | |
101 | end exce pt begin | |
102 | xFMG ets.Free; | |
103 | Resu lt := '0^T here was a problem r eading the primary m enu for th e specifie d user DUZ .'; | |
104 | exit ; | |
105 | end; | |
106 | end; | |
107 | ||
108 | // Check to see if the optio n passed i nto the fu nction is already th e user's p rimary men u | |
109 | if xFMGe ts.GetFiel d('201').F MDBInterna l = Option IEN then b egin | |
110 | xFMGet s.Free; | |
111 | Result := '1^The option be ing assign ed is alre ady the us er''s prim ary menu.' ; | |
112 | exit; | |
113 | end; | |
114 | xFMGets. Free; | |
115 | ||
116 | // Overw rite prima ry menu wi th the new menu bein g assigned . | |
117 | xFMFiler := TFMFil er.Create( xBroker); | |
118 | xFMFiler .RPCBroker := xBroke r; | |
119 | xFMFiler .AddFDA('2 00', xDUZ, '201', Op tionIEN); | |
120 | if xFMFi ler.Anythi ngToFile t hen | |
121 | if xFM Filer.Data ProblemChe ck then be gin | |
122 | xFMF iler.Free; | |
123 | Resu lt := '0^T here was a problem s etting the specified user''s p rimary men u to the s pecified o ption.'; | |
124 | exit ; | |
125 | end | |
126 | else | |
127 | if n ot xFMFile r.Update t hen begin | |
128 | xF MFiler.Fre e; | |
129 | Re sult := '0 ^There was a problem setting t he specifi ed user''s primary m enu to the specified option.'; | |
130 | ex it; | |
131 | end; | |
132 | xFMFiler .Free; | |
133 | ||
134 | Result : = '1^The p rimary men u matches the specif ied option .'; | |
135 | end; | |
136 | ||
137 | // functio n Kernel_A ssignMenuT oSecondary (xBroker: TRPCBroker ; xDUZ: St ring; xMen u: String) :string; | |
138 | // | |
139 | // Checks if a user has a prim ary menu. If not, m ailman is assigned. | |
140 | // If the specified option is the user's primary m enu, the f unction ex its with a result of 1^ | |
141 | // Checks if a user has the sp ecified me nu as a se condary. If not, it 's assigne d | |
142 | // | |
143 | // Params: | |
144 | // xB roker = A TRPCBroker component already i nstantiate d in the m ain applic ation | |
145 | // xD UZ = User' s DUZ # (I EN in NEW PERSON fil e) to whic h the menu option sh ould be as signed | |
146 | // xM enu = The exact name of the me nu being a ssigned - .01 field of file 19 (OPTION f ile) | |
147 | // | |
148 | // Result: 1^Succes s message, if any | |
149 | // 0^Error message | |
150 | ||
151 | function K ernel_Assi gnMenuToSe condary(xB roker: TRP CBroker; x DUZ: strin g; xMenu: string): s tring; | |
152 | var | |
153 | xFMFinde r: TFMFind er; | |
154 | xFMGets: TFMGets; | |
155 | xFMFiler : TFMFiler ; | |
156 | xFMListe r: TFMList er; | |
157 | Options: TStringLi st; | |
158 | OptionIE N: string; | |
159 | MailManI EN: string ; | |
160 | x: integ er; | |
161 | FoundFla g: integer ; | |
162 | begin | |
163 | xMenu := uppercase (xMenu); | |
164 | ||
165 | // Check if the br oker is co nnected. If not, do n't contin ue. | |
166 | if xBrok er.Connect ed = False then begi n | |
167 | Result := '0^The RPCBroker does not have an ac tive conne ction.'; | |
168 | exit; | |
169 | end; | |
170 | ||
171 | // Searc h for a ma tch on the specified option. Get the IE N. | |
172 | // Use t he Finder for speed | |
173 | Options := TString List.Creat e; | |
174 | xFMFinde r := TFMFi nder.Creat e(xBroker) ; | |
175 | xFMFinde r.FileNumb er := '19' ; | |
176 | xFMFinde r.RPCBroke r := xBrok er; | |
177 | xFMFinde r.Value := xMenu; | |
178 | xFMFinde r.GetFinde rList(Opti ons); | |
179 | FoundFla g := -1; | |
180 | if Optio ns.Count > 0 then | |
181 | for x := 0 to Op tions.Coun t - 1 do | |
182 | if O ptions[x] = xMenu th en begin | |
183 | Fo undFlag := x; | |
184 | Op tionIEN := xFMFinder .Results[x ]; | |
185 | end; | |
186 | xFMFinde r.Free; | |
187 | Options. Free; | |
188 | if Found Flag = -1 then begin | |
189 | Result := '0^An exact matc h for opti on ' + xMe nu + ' was n''t found on this s ystem.'; | |
190 | exit; | |
191 | end; | |
192 | // Optio nIEN now c ontains th e IEN in t he option file for t he specifi ed menu op tion in th e params | |
193 | ||
194 | // Grab the MailMa n Menu Opt ion IEN - XMUSER | |
195 | // Use t he Finder for speed | |
196 | Options := TString List.Creat e; | |
197 | xFMFinde r := TFMFi nder.Creat e(xBroker) ; | |
198 | xFMFinde r.FileNumb er := '19' ; | |
199 | xFMFinde r.RPCBroke r := xBrok er; | |
200 | xFMFinde r.Value := 'XUSERTOO LS'; | |
201 | xFMFinde r.GetFinde rList(Opti ons); | |
202 | FoundFla g := -1; | |
203 | if Optio ns.Count > 0 then | |
204 | for x := 0 to Op tions.Coun t - 1 do | |
205 | if O ptions[x] = 'XUSERTO OLS' then begin | |
206 | Fo undFlag := x; | |
207 | Ma ilManIEN : = xFMFinde r.Results[ x]; | |
208 | end; | |
209 | xFMFinde r.Free; | |
210 | Options. Free; | |
211 | if Found Flag = -1 then begin | |
212 | Result := '0^An exact matc h for opti on XUSERTO OLS wasn'' t found on this syst em.'; | |
213 | exit; | |
214 | end; | |
215 | // Mailm anIEN now contains t he MailMan IEN in th e option f ile. | |
216 | ||
217 | // Check the user' s primary menu in th e NEW PERS ON file. | |
218 | // If bl ank, stuff in the Ma ilman IEN | |
219 | xFMGets := TFMGets .Create(xB roker); | |
220 | xFMGets. FileNumber := '200'; | |
221 | xFMGets. FieldNumbe rs.Add('20 1'); | |
222 | xFMGets. IENS := xD uz; | |
223 | xFMGets. RPCBroker := xBroker ; | |
224 | xFMGets. GetData; | |
225 | ||
226 | //Showme ssage(xFMG ets.GetFie ld('201'). FMDBExtern al); | |
227 | // If no primary m enu, set t he primary menu to X USERTOOLS | |
228 | try | |
229 | if xFM Gets.GetFi eld('201') .FMDBInter nal = '' t hen begin | |
230 | xFMF iler := TF MFiler.Cre ate(xBroke r); | |
231 | xFMF iler.RPCBr oker := xB roker; | |
232 | xFMF iler.AddFD A('200', x DUZ, '201' , MailManI EN); | |
233 | if n ot xFMFile r.Update t hen begin | |
234 | xF MFiler.Fre e; | |
235 | Re sult := '0 ^There was a problem setting t he specifi ed user''s primary m enu to XUS ERTOOLS.'; | |
236 | ex it; | |
237 | end; | |
238 | xFMF iler.Free; | |
239 | end exce pt begin | |
240 | xFMG ets.Free; | |
241 | Resu lt := '0^T here was a problem r eading the primary m enu for th e specifie d user DUZ .'; | |
242 | exit ; | |
243 | end; | |
244 | end; | |
245 | // Check to see if the secon dary optio n passed i nto the fu nction is the user's primary m enu | |
246 | if xFMGe ts.GetFiel d('201').F MDBInterna l = Option IEN then b egin | |
247 | xFMGet s.Free; | |
248 | Result := '1^The secondary option be ing assign ed is alre ady the us er''s prim ary menu.' ; | |
249 | exit; | |
250 | end; | |
251 | xFMGets. Free; | |
252 | ||
253 | // Now l oad the se condary me nu options for the u ser and ch eck if the user alre ady has | |
254 | // the o ption to b e added. | |
255 | xFMListe r := TFMLi ster.Creat e(xBroker) ; | |
256 | xFMListe r.FileNumb er := '200 .03'; | |
257 | xFMListe r.IENS := ',' + xDuz + ','; | |
258 | xFMListe r.RPCBroke r := xBrok er; | |
259 | Options := TString List.Creat e; | |
260 | xFMListe r.GetList( Options); | |
261 | FoundFla g := -1; | |
262 | if Optio ns.Count > -1 then | |
263 | for x := 0 to Op tions.Coun t - 1 do | |
264 | if O ptions[x] = xMenu th en begin | |
265 | // User alre ady has th e secondar y option s pecified | |
266 | Fo undFlag := x; | |
267 | end; | |
268 | xFMListe r.Free; | |
269 | Options. Free; | |
270 | if Found Flag = -1 then begin | |
271 | // Use r doesn't have the s econdary o ption yet, so add it | |
272 | xFMFil er := TFMF iler.Creat e(xBroker) ; | |
273 | xFMFil er.RPCBrok er := xBro ker; | |
274 | xFMFil er.AddFDA( '200.03', '+1,' + xD UZ + ',', '.01', Opt ionIEN); | |
275 | if xFM Filer.Anyt hingToFile then | |
276 | if x FMFiler.Da taProblemC heck then begin | |
277 | xF MFiler.Fre e; | |
278 | Re sult := '0 ^There was a problem adding th e specifie d option t o the user ''s second ary menu.' ; | |
279 | ex it; | |
280 | end | |
281 | else | |
282 | if not xFMFi ler.Update then begi n | |
283 | xFMFiler.F ree; | |
284 | Result := '0^There w as a probl em adding the specif ied option to the us er''s seco ndary menu .'; | |
285 | exit; | |
286 | en d; | |
287 | xFMFil er.Free; | |
288 | end; | |
289 | ||
290 | Result : = '1^The s econdary o ption bein g assigned is availa ble to the user on t heir secon dary menu. '; | |
291 | end; | |
292 | ||
293 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.