Switching 'passing' to 'ytd' as requested, though this is weird.
[capital-apms-progress.git] / inc / persndtl.i
blob23682225ea8685407ebb7ccc05dc02477dbb4a3a
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Include
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 DEF VAR office-country-code LIKE PhoneDetail.cCountryCode NO-UNDO.
8 DEF VAR office-std-code LIKE PhoneDetail.cSTDCode NO-UNDO.
9 DEF VAR office-isd-prefix AS CHAR NO-UNDO INITIAL "00".
10 DEF VAR office-country-name AS CHAR NO-UNDO INITIAL "".
12 DEF VAR other-countries AS CHAR NO-UNDO INITIAL
13 "Australia,USA, U.S.A.,UK,U.K.,United Kingdom,France,New Zealand".
15 DEF VAR street-types AS CHAR NO-UNDO INITIAL
16 "st,tce,cr,pl".
18 DEF VAR city-suffixes AS CHAR NO-UNDO INITIAL
19 "bay".
21 {inc/ofc-this.i}
22 {inc/ofc-set.i "PhoneType-Priority" "phone-types"}
23 IF NOT AVAILABLE(OfficeSetting) THEN phone-types = "BUS,FAX,MOB,EMAL,DDI,HOME".
24 DEF VAR no-phone-types AS INT NO-UNDO.
25 no-phone-types = NUM-ENTRIES(phone-types).
27 /* _UIB-CODE-BLOCK-END */
28 &ANALYZE-RESUME
31 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
33 /* ******************** Preprocessor Definitions ******************** */
37 /* _UIB-PREPROCESSOR-BLOCK-END */
38 &ANALYZE-RESUME
41 /* ************************ Function Prototypes ********************** */
43 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD combine-name Include
44 FUNCTION combine-name RETURNS CHARACTER
45 ( INPUT p-title AS CHAR, INPUT p-first AS CHAR, INPUT p-middle AS CHAR, INPUT p-last AS CHAR, INPUT p-suffix AS CHAR ) FORWARD.
47 /* _UIB-CODE-BLOCK-END */
48 &ANALYZE-RESUME
50 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-phone-nos Include
51 FUNCTION get-phone-nos RETURNS CHARACTER
52 ( INPUT person-code AS INT ) FORWARD.
54 /* _UIB-CODE-BLOCK-END */
55 &ANALYZE-RESUME
58 /* *********************** Procedure Settings ************************ */
60 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
61 /* Settings for THIS-PROCEDURE
62 Type: Include
63 Allow:
64 Frames: 0
65 Add Fields to: Neither
66 Other Settings: INCLUDE-ONLY
68 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
70 /* ************************* Create Window ************************** */
72 &ANALYZE-SUSPEND _CREATE-WINDOW
73 /* DESIGN Window definition (used by the UIB)
74 CREATE WINDOW Include ASSIGN
75 HEIGHT = .1
76 WIDTH = 40.
77 /* END WINDOW DEFINITION */
79 &ANALYZE-RESUME
84 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Include
87 /* *************************** Main Block *************************** */
89 RUN get-office-phone-defaults.
91 /* _UIB-CODE-BLOCK-END */
92 &ANALYZE-RESUME
95 /* ********************** Internal Procedures *********************** */
97 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE combine-fullname Include
98 PROCEDURE combine-fullname :
99 /*------------------------------------------------------------------------------
100 Purpose:
101 ------------------------------------------------------------------------------*/
102 DEF INPUT PARAMETER first-name AS CHAR NO-UNDO.
103 DEF INPUT PARAMETER last-name AS CHAR NO-UNDO.
105 DEF OUTPUT PARAMETER full-name AS CHAR NO-UNDO.
106 full-name = TRIM( first-name + ' ' + last-name ).
108 END PROCEDURE.
110 /* _UIB-CODE-BLOCK-END */
111 &ANALYZE-RESUME
113 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE combine-phone Include
114 PROCEDURE combine-phone :
115 /*------------------------------------------------------------------------------
116 Purpose:
117 ------------------------------------------------------------------------------*/
118 DEF INPUT PARAMETER c-country LIKE PhoneDetail.cCountryCode NO-UNDO.
119 DEF INPUT PARAMETER c-std LIKE PhoneDetail.cSTDCode NO-UNDO.
120 DEF INPUT PARAMETER phone-no LIKE PhoneDetail.Number NO-UNDO.
122 DEF OUTPUT PARAMETER full-phone AS CHAR NO-UNDO.
124 DEF VAR country-part AS CHAR NO-UNDO INITIAL "".
125 DEF VAR std-part AS CHAR NO-UNDO INITIAL "".
127 /* If the phone number contains an @ then only put it in phone-no and return */
128 IF INDEX(phone-no, "@") > 0 THEN DO:
129 full-phone = phone-no.
130 RETURN.
131 END.
133 IF c-country <> "" AND c-country <> ? AND c-country <> office-country-code THEN
134 country-part = "+" + c-country + " ".
136 IF c-std = ? THEN c-std = "".
137 IF c-country <> office-country-code OR c-std <> office-std-code THEN
138 std-part = "(" + c-std + ") ".
140 full-phone = (IF country-part <> "" THEN country-part ELSE "")
141 + (IF std-part <> "" THEN std-part ELSE "")
142 + phone-no .
144 END PROCEDURE.
146 /* _UIB-CODE-BLOCK-END */
147 &ANALYZE-RESUME
149 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-office-phone-defaults Include
150 PROCEDURE get-office-phone-defaults :
151 /*------------------------------------------------------------------------------
152 Purpose: FInd the country code and std code for this office
153 Parameters: <none>
154 Notes:
155 ------------------------------------------------------------------------------*/
157 {inc/ofc-this.i}
159 FIND OfficeSettings OF Office WHERE OfficeSettings.SetName = "Country-Code" NO-LOCK NO-ERROR.
160 IF AVAILABLE OfficeSettings THEN office-country-code = OfficeSettings.SetValue.
162 FIND OfficeSettings OF Office WHERE OfficeSettings.SetName = "STD-Code" NO-LOCK NO-ERROR.
163 IF AVAILABLE OfficeSettings THEN office-std-code = OfficeSettings.SetValue.
165 FIND OfficeSettings OF Office WHERE OfficeSettings.SetName = "ISD-Prefix" NO-LOCK NO-ERROR.
166 IF AVAILABLE(OfficeSettings) THEN office-isd-prefix = OfficeSettings.SetValue.
168 FIND OfficeSettings OF Office WHERE OfficeSettings.SetName = "Country" NO-LOCK NO-ERROR.
169 IF AVAILABLE(OfficeSettings) THEN office-country-name = OfficeSettings.SetValue.
171 END PROCEDURE.
173 /* _UIB-CODE-BLOCK-END */
174 &ANALYZE-RESUME
176 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE split-address Include
177 PROCEDURE split-address :
178 /*------------------------------------------------------------------------------
179 Purpose:
180 ------------------------------------------------------------------------------*/
181 DEF INPUT PARAMETER address AS CHAR NO-UNDO.
182 DEF OUTPUT PARAMETER str-address AS CHAR NO-UNDO.
183 DEF OUTPUT PARAMETER city AS CHAR NO-UNDO INITIAL "".
184 DEF OUTPUT PARAMETER state AS CHAR NO-UNDO INITIAL "".
185 DEF OUTPUT PARAMETER zip AS CHAR NO-UNDO INITIAL "".
186 DEF OUTPUT PARAMETER country AS CHAR NO-UNDO INITIAL "".
188 DEF VAR n AS INT NO-UNDO.
189 DEF VAR m AS INT NO-UNDO.
190 address = TRIM(address).
191 n = NUM-ENTRIES( address, "~n" ).
193 /* country is probably the last, but we really have to verify it against a list */
194 country = TRIM(ENTRY( n, address, "~n" )).
195 IF country BEGINS "ATT" THEN DO:
196 /* an Attention: line... */
197 address = country + "~n" + TRIM( SUBSTRING( address, 1, LENGTH(address) - LENGTH(ENTRY( n, address, "~n" )))).
198 country = TRIM(ENTRY( n, address, "~n" )).
199 END.
200 IF LOOKUP( country, other-countries) = 0 THEN
201 country = office-country-name.
202 ELSE DO:
203 address = TRIM( SUBSTRING( address, 1, LENGTH(address) - LENGTH(ENTRY( n, address, "~n" )))).
204 n = n - 1.
205 END.
207 /* "city, state zip" is the standard format... */
208 city = TRIM(ENTRY( n, address, "~n" )).
209 city = TRIM(city, ",").
210 m = NUM-ENTRIES( city, " ").
212 zip = TRIM( ENTRY( m, city, " ") ).
213 /* if it has a digit in it, itis most likely to be a "ZIP" */
214 IF (INDEX( zip, "0") + INDEX( zip, "1") + INDEX( zip, "2") + INDEX( zip, "3") + INDEX( zip, "4") + INDEX( zip, "5") + INDEX( zip, "6") + INDEX( zip, "7") + INDEX( zip, "8") + INDEX( zip, "9")) > 0 THEN DO:
215 city = TRIM( SUBSTRING( city, 1, LENGTH(city) - LENGTH(ENTRY( m, city, " " )))).
216 ENTRY(n,address,"~n") = city.
217 m = m - 1.
218 END.
219 ELSE DO:
220 zip = "".
221 END.
223 /* state is probably a field after a "," on the line, otherwise if the last */
224 /* field is <= 4 characters we will assume it's a state */
225 city = TRIM(city, ",").
226 IF INDEX( city, ",") > 0 THEN DO:
227 state = TRIM( SUBSTRING( city, R-INDEX( city, ",") + 1) ).
228 city = TRIM( SUBSTRING( city, 1, R-INDEX( city, ",") - 1) ).
229 address = TRIM( SUBSTRING( address, 1, LENGTH(address) - LENGTH(ENTRY( n, address, "~n" )))).
230 n = n - 1.
231 END.
232 ELSE IF m > 1 THEN DO:
233 state = TRIM( SUBSTRING( city, R-INDEX( city, " ") + 1) ).
234 IF LOOKUP( TRIM(state,"."), street-types ) > 0 THEN DO:
235 city = "".
236 state = "".
237 END.
238 ELSE DO:
239 IF LENGTH(city) < 3 OR LOOKUP( state, city-suffixes) > 0 THEN
240 state = "".
241 ELSE IF LENGTH(state) < 4 THEN
242 city = TRIM( SUBSTRING( city, 1, R-INDEX( city, " ") - 1) ).
243 ELSE
244 state = "".
245 address = TRIM( SUBSTRING( address, 1, LENGTH(address) - LENGTH(ENTRY( n, address, "~n" )))).
246 n = n - 1.
247 END.
248 END.
249 ELSE IF n > 1 THEN DO:
250 address = TRIM( SUBSTRING( address, 1, LENGTH(address) - LENGTH(ENTRY( n, address, "~n" )))).
251 n = n - 1.
252 END.
254 str-address = address.
256 END PROCEDURE.
258 /* _UIB-CODE-BLOCK-END */
259 &ANALYZE-RESUME
261 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE split-fullname Include
262 PROCEDURE split-fullname :
263 /*------------------------------------------------------------------------------
264 Purpose:
265 Parameters: <none>
266 Notes:
267 ------------------------------------------------------------------------------*/
268 DEF INPUT PARAMETER full-name AS CHAR NO-UNDO.
269 DEF OUTPUT PARAMETER first-name AS CHAR NO-UNDO.
270 DEF OUTPUT PARAMETER last-name AS CHAR NO-UNDO.
272 DEF VAR next-part AS CHAR NO-UNDO.
273 IF NUM-ENTRIES( full-name, " " ) <= 1 THEN ASSIGN
274 first-name = ""
275 last-name = full-name.
276 ELSE DO:
277 first-name = TRIM( ENTRY( 1, full-name, " " ) ).
278 last-name = TRIM( SUBSTR( full-name, LENGTH( first-name ) + 1 ) ).
280 /* skip any title or so forth */
281 IF LOOKUP( first-name, "Mr,Mrs,Miss,Ms,Sir,Mast,Mstr,Master") > 0 THEN DO:
282 /* skip it */
283 first-name = TRIM( ENTRY( 1, last-name, " " ) ).
284 last-name = TRIM( SUBSTR( last-name, LENGTH( first-name ) + 1 ) ).
285 END.
287 /* move any middle initials and stuff to be part of the first name */
288 next-part = ENTRY( 1, last-name, " ").
289 DO WHILE next-part <> last-name AND LENGTH(TRIM(next-part,".")) = 1 :
290 first-name = first-name + " " + next-part.
291 last-name = TRIM( SUBSTR( last-name, LENGTH( next-part ) + 1 ) ).
292 next-part = ENTRY( 1, last-name, " ").
293 END.
294 END.
296 END PROCEDURE.
298 /* _UIB-CODE-BLOCK-END */
299 &ANALYZE-RESUME
301 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE split-name Include
302 PROCEDURE split-name :
303 /*------------------------------------------------------------------------------
304 Purpose:
305 ------------------------------------------------------------------------------*/
306 DEF INPUT PARAMETER full-name AS CHAR NO-UNDO.
308 DEF OUTPUT PARAMETER p-title AS CHAR NO-UNDO INITIAL "".
309 DEF OUTPUT PARAMETER p-first AS CHAR NO-UNDO INITIAL "".
310 DEF OUTPUT PARAMETER p-middle AS CHAR NO-UNDO INITIAL "".
311 DEF OUTPUT PARAMETER p-last AS CHAR NO-UNDO INITIAL "".
312 DEF OUTPUT PARAMETER p-suffix AS CHAR NO-UNDO INITIAL "".
314 DEF VAR next-part AS CHAR NO-UNDO.
315 IF NUM-ENTRIES( full-name, " " ) <= 1 THEN DO:
316 p-first = full-name.
317 p-last = "".
318 RETURN.
319 END.
321 p-first = TRIM( ENTRY( 1, full-name, " " ), " ." ).
322 p-last = TRIM( SUBSTR( full-name, INDEX(full-name, " ") + 1 ) ).
324 /* extract any title */
325 IF LOOKUP( p-first, "Mr,Mrs,Miss,Ms,Sir,Mast,Mstr,Master,Dr,Prof,Dame,(none)") > 0 THEN DO:
326 p-title = p-first.
327 /* and then skip it */
328 p-first = TRIM( ENTRY( 1, p-last, " " ), "." ).
329 p-last = TRIM( SUBSTR( p-last, INDEX( p-last, " " ) + 1 ) ).
330 END.
332 /* extract any suffix */
333 IF NUM-ENTRIES( p-last, " ") > 1 THEN DO:
334 p-suffix = TRIM(ENTRY( NUM-ENTRIES( p-last, " "), p-last, " "), " .").
335 IF LOOKUP( p-suffix, "Jr,Snr,I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII,XIII,XIV,XV,XVI,XVII,XVIII,XIX,XX") > 0 THEN
336 p-last = TRIM( SUBSTR( p-last, 1, R-INDEX(p-last, " ") - 1 ) ).
337 ELSE
338 p-suffix = "".
339 END.
341 /* split out any middle names */
342 IF NUM-ENTRIES( p-last, " ") > 1 THEN DO:
343 next-part = ENTRY( 1, p-last, " ").
344 DO WHILE next-part <> p-last:
345 IF LOOKUP( next-part, "de,van,der,mc,mac,o,di,des,en,st,te") > 0 THEN LEAVE.
346 p-middle = p-middle + next-part + " ".
347 p-last = TRIM( SUBSTR( p-last, INDEX( p-last, " ") + 1 ) ).
348 next-part = ENTRY( 1, p-last, " ").
349 END.
350 p-middle = TRIM(p-middle).
351 END.
353 END PROCEDURE.
355 /* _UIB-CODE-BLOCK-END */
356 &ANALYZE-RESUME
358 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE split-phone Include
359 PROCEDURE split-phone :
360 /*------------------------------------------------------------------------------
361 Purpose: Parses/Splits a single string phone number into
362 country code, STD code, phone number
363 Parameters: <none>
364 Notes:
365 ------------------------------------------------------------------------------*/
366 DEF INPUT PARAMETER full-phone AS CHAR NO-UNDO.
368 DEF OUTPUT PARAMETER c-country LIKE PhoneDetail.cCountryCode NO-UNDO INITIAL "".
369 DEF OUTPUT PARAMETER c-std LIKE PhoneDetail.cSTDCode NO-UNDO INITIAL "".
370 DEF OUTPUT PARAMETER phone-no LIKE PhoneDetail.Number NO-UNDO INITIAL "".
372 /* Parse the phone number ! */
373 DEF VAR part-parse AS CHAR NO-UNDO.
374 DEF VAR ch AS CHAR NO-UNDO.
375 DEF VAR extra-phone AS CHAR NO-UNDO.
376 DEF VAR i AS INT NO-UNDO.
377 DEF VAR n AS INT NO-UNDO.
379 /* If the phone number contains an @ then only put it in phone-no and return */
380 IF INDEX(full-phone, "@") > 0 THEN DO:
381 phone-no = full-phone.
382 RETURN.
383 END.
385 /* always replace "-" with " " first for improved parsing! */
386 full-phone = REPLACE( TRIM(full-phone), "-", " " ).
388 /* only parse up to the last 'phone-number' character */
389 n = LENGTH(full-phone).
390 DO i = 1 TO n:
391 ch = SUBSTR(full-phone, i, 1).
392 IF INDEX( "0123456789+() ", ch) = 0 THEN DO:
393 extra-phone = SUBSTR( full-phone, i).
394 full-phone = SUBSTR( full-phone, 1, i - 1).
395 n = i.
396 END.
397 END.
399 /* assume the last two are usually the base phone number, but if we */
400 /* detect sufficient structure we can override that choice */
401 n = MAXIMUM( NUM-ENTRIES( full-phone, " ") - 2, 0).
402 IF n < 1 AND SUBSTR( full-phone, 1, 1) = "+" THEN n = n + 1.
403 IF n < 1 AND SUBSTR( full-phone, 1, LENGTH(office-isd-prefix) ) = office-isd-prefix THEN n = n + 1.
404 IF n < 2 AND INDEX( full-phone, "(") <> 0 THEN n = n + 1.
405 IF n < 1 AND SUBSTR( full-phone, 1, 1) = "0" THEN n = 1.
406 n = MINIMUM( NUM-ENTRIES( full-phone, " "), n).
408 DO i = 1 TO n:
410 part-parse = ENTRY( i, full-phone, " " ).
412 IF c-country <> "" AND c-std <> "" THEN
413 /* no point picking country/std information twice */
414 phone-no = phone-no + part-parse + " ".
415 ELSE IF c-country <> "" AND c-std = "" THEN ASSIGN
416 /* since we have a country, but no STD, next bit must be STD */
417 c-std = part-parse
418 c-std = REPLACE( c-std, "(", "" )
419 c-std = REPLACE( c-std, ")", "" ).
420 ELSE IF SUBSTR( part-parse, 1, 1 ) = "+" THEN DO:
421 /* definitely a country */
422 c-country = REPLACE( part-parse, "+", "" ).
423 IF INDEX( c-country, "(") <> 0 THEN DO:
424 /* also runs straight into STD without spaces */
425 c-std = ENTRY( 2, c-country, "(" ).
426 c-country = ENTRY( 1, c-country, "(" ).
428 /* in case it runs straight into start of phone number as well */
429 c-std = REPLACE( c-std, ")", " " ).
430 c-std = c-std + " ".
431 phone-no = SUBSTR( c-std, INDEX( c-std, " ") + 1 ).
432 c-std = ENTRY( 1, c-std, " ").
433 END.
434 END.
435 ELSE IF c-country = "" AND SUBSTR( part-parse, 1, LENGTH(office-isd-prefix) ) = office-isd-prefix THEN DO:
436 c-country = TRIM( REPLACE( part-parse, office-isd-prefix, "" ) ).
437 IF c-country = "" THEN ASSIGN
438 i = i + 1
439 part-parse = ENTRY( i, full-phone, " " )
440 c-country = part-parse.
441 IF LENGTH(c-country) > 2 AND LOOKUP( SUBSTR( c-country, 1, 2), "44,61,64") <> 0 THEN DO:
442 ASSIGN
443 /* numbers of the style 00612 9223 5601 (quite common really) */
444 c-std = SUBSTR( c-country, 3)
445 c-country = SUBSTR( c-country, 1, 2).
446 END.
447 END.
448 ELSE IF SUBSTR( part-parse, 1, 1 ) = "(" THEN DO:
449 c-std = part-parse.
450 c-std = REPLACE( c-std, "(", "" ).
452 /* in case it runs straight into start of phone number as well */
453 c-std = REPLACE( c-std, ")", " " ).
454 c-std = c-std + " ".
455 phone-no = SUBSTR( c-std, INDEX( c-std, " ") + 1 ).
456 c-std = ENTRY( 1, c-std, " ").
457 END.
458 ELSE IF c-std = "" AND SUBSTR( part-parse, 1, 1 ) = "0" THEN
459 c-std = SUBSTR( part-parse, 2 ).
460 ELSE
461 phone-no = phone-no + part-parse + " ".
463 END.
464 DO WHILE i <= NUM-ENTRIES( full-phone, " "):
465 phone-no = phone-no + ENTRY( i, full-phone, " ") + " ".
466 i = i + 1.
467 END.
468 c-country = TRIM( c-country ).
469 c-std = TRIM( c-std ).
470 phone-no = TRIM(phone-no)
471 + (IF extra-phone = "" THEN "" ELSE " " + extra-phone).
473 IF c-country <> "" AND c-std = ""
474 AND c-country <> office-country-code
475 AND LOOKUP( c-country, "65,852") = 0
476 THEN ASSIGN
477 c-std = SUBSTRING( c-country, LENGTH(c-country), 1)
478 c-country = SUBSTRING( c-country, 1, LENGTH(c-country) - 1).
480 IF c-country = "" OR c-country = office-country-code THEN DO:
481 c-country = office-country-code.
482 IF c-std = "" AND LOOKUP( ENTRY( 1, phone-no, " "), "3,4,9" ) <> 0 THEN ASSIGN
483 c-std = ENTRY( 1, phone-no, " ")
484 phone-no = SUBSTR( phone-no, 3 ).
485 ELSE IF c-std = "" THEN
486 c-std = office-std-code.
487 END.
489 /* not even Hobart has a preceding 0 on their STD code now */
490 c-std = LEFT-TRIM( c-std, "0").
492 END PROCEDURE.
494 /* _UIB-CODE-BLOCK-END */
495 &ANALYZE-RESUME
497 /* ************************ Function Implementations ***************** */
499 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION combine-name Include
500 FUNCTION combine-name RETURNS CHARACTER
501 ( INPUT p-title AS CHAR, INPUT p-first AS CHAR, INPUT p-middle AS CHAR, INPUT p-last AS CHAR, INPUT p-suffix AS CHAR ) :
502 /*------------------------------------------------------------------------------
503 Purpose:
504 ------------------------------------------------------------------------------*/
505 DEF VAR full-name AS CHAR NO-UNDO.
507 IF p-title = ? THEN p-title = "".
508 IF p-first = ? THEN p-first = "".
509 IF p-middle = ? THEN p-middle = "".
510 IF p-last = ? THEN p-last = "".
511 IF p-suffix = ? THEN p-suffix = "".
513 full-name = TRIM( p-title ) + ' ' + TRIM( p-first ).
514 full-name = TRIM( full-name ) + ' ' + TRIM( p-middle ).
515 full-name = TRIM( full-name ) + ' ' + TRIM( p-last ).
516 full-name = TRIM(TRIM( full-name ) + ' ' + TRIM( p-suffix )).
518 RETURN full-name.
520 END FUNCTION.
522 /* _UIB-CODE-BLOCK-END */
523 &ANALYZE-RESUME
525 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-phone-nos Include
526 FUNCTION get-phone-nos RETURNS CHARACTER
527 ( INPUT person-code AS INT ) :
528 /*------------------------------------------------------------------------------
529 Purpose:
530 Notes:
531 ------------------------------------------------------------------------------*/
532 DEF VAR no-found AS INT NO-UNDO INITIAL 0.
533 DEF VAR phone-nos AS CHAR NO-UNDO INITIAL "".
534 DEF VAR this-phone AS CHAR NO-UNDO INITIAL "".
536 DEF VAR this-type AS CHAR NO-UNDO.
537 DEF VAR i AS INT NO-UNDO.
538 DO i = 1 TO no-phone-types:
539 this-type = ENTRY( i, phone-types).
540 FIND PhoneDetail WHERE PhoneDetail.PersonCode = person-code
541 AND PhoneDetail.PhoneType = this-type NO-LOCK NO-ERROR.
542 IF AVAILABLE(PhoneDetail) THEN DO:
543 no-found = no-found + 1.
544 RUN combine-phone( PhoneDetail.cCountryCode, PhoneDetail.cSTDCode, PhoneDetail.Number, OUTPUT this-phone ).
545 phone-nos = phone-nos + this-type + ":" + this-phone + ", ".
546 END.
547 END.
549 phone-nos = TRIM(phone-nos, ", ").
551 RETURN phone-nos.
553 END FUNCTION.
555 /* _UIB-CODE-BLOCK-END */
556 &ANALYZE-RESUME