DBA Data[Home] [Help]

PACKAGE BODY: APPS.POS_HZ_CONTACT_POINT_PKG

Source


1 PACKAGE BODY pos_hz_contact_point_pkg AS
2 /*$Header: POSHZCPB.pls 120.9 2011/09/23 10:49:43 ashgup ship $ */
3 
4 -- update if exists, create otherwise
5 PROCEDURE create_or_update_tca_phone
6   ( p_owner_table_id     IN  NUMBER   ,
7     p_owner_table_name   IN  VARCHAR2 ,
8     p_country_code       IN  VARCHAR2 ,
9     p_area_code          IN  VARCHAR2 ,
10     p_number             IN  VARCHAR2 ,
11     p_extension          IN  VARCHAR2 ,
12 --Start Bug 6620664
13     p_phone_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM,
14 --End Bug 6620664
15     x_return_status      OUT NOCOPY VARCHAR2,
16     x_msg_count          OUT NOCOPY NUMBER  ,
17     x_msg_data           OUT NOCOPY VARCHAR2
18     )
19 IS
20    CURSOR l_cur IS
21       SELECT contact_point_id, object_version_number,
22              phone_number, phone_area_code, phone_extension
23         FROM hz_contact_points
24        WHERE owner_table_name = p_owner_table_name
25          AND owner_table_id = p_owner_table_id
26          AND contact_point_type = 'PHONE'
27          AND phone_line_type = 'GEN'
28          AND primary_flag = 'Y'
29          AND status = 'A' ;
30 
31    l_rec   l_cur%ROWTYPE;
32    l_found BOOLEAN;
33 
34    l_contact_point_id    NUMBER;
35    l_contact_points_rec  hz_contact_point_v2pub.contact_point_rec_type;
36    l_phone_rec           hz_contact_point_v2pub.phone_rec_type;
37 
38 BEGIN
39 
40    OPEN l_cur;
41    FETCH l_cur INTO l_rec;
42    l_found := l_cur%found;
43    CLOSE l_cur;
44 
45    IF l_found THEN
46 
47       IF p_number is NULL OR trim(p_number) IS NULL THEN
48 
49          l_contact_points_rec.status := 'I';
50 
51          -- keep the old number when inactivating
52          l_phone_rec.phone_number    := l_rec.phone_number;
53 
54        ELSE
55          IF (l_rec.phone_area_code IS NULL     AND p_area_code IS NULL OR
56              l_rec.phone_area_code IS NOT NULL AND p_area_code IS NOT NULL AND
57              l_rec.phone_area_code             =   p_area_code
58              ) AND
59             (l_rec.phone_number    IS NULL     AND p_number    IS NULL OR
60              l_rec.phone_number    IS NOT NULL AND p_number    IS NOT NULL AND
61              l_rec.phone_number                =   p_number
62              ) AND
63             (l_rec.phone_extension    IS NULL     AND p_extension    IS NULL OR
64              l_rec.phone_extension    IS NOT NULL AND p_extension    IS NOT NULL AND
65              l_rec.phone_extension                =   p_extension
66              ) THEN
67             -- the current data is the same as the new data so no change needed
68 	    x_return_status := fnd_api.g_ret_sts_success;
69             RETURN;
70          END IF;
71 
72          l_contact_points_rec.status := 'A';
73          l_phone_rec.phone_number    := p_number;
74 
75       END IF;
76 
77 --Start for Bug 12928774
78       IF (l_rec.phone_area_code IS NOT NULL  AND p_area_code IS NULL) THEN
79         l_phone_rec.phone_area_code    := fnd_api.g_miss_char;
80       ELSE
81         l_phone_rec.phone_area_code    := p_area_code;
82       END IF;
83       IF (l_rec.phone_extension IS NOT NULL  AND p_extension IS NULL) THEN
84         l_phone_rec.phone_extension    := fnd_api.g_miss_char;
85       ELSE
86         l_phone_rec.phone_extension    := p_extension;
87       END IF;
88 --End for Bug 12928774
89 
90       l_contact_points_rec.contact_point_id := l_rec.contact_point_id;
91       l_phone_rec.phone_country_code := p_country_code;
92       l_phone_rec.phone_line_type    := 'GEN';
93 
94 --Start for Bug 6620664
95       IF p_phone_object_version_number <> fnd_api.G_NULL_NUM THEN
96 
97           l_rec.object_version_number := p_phone_object_version_number;
98       END IF;
99 --End for Bug 6620664
100 
101       hz_contact_point_v2pub.update_contact_point
102         (p_init_msg_list          => fnd_api.g_false,
103          p_contact_point_rec      => l_contact_points_rec,
104          p_phone_rec              => l_phone_rec,
105          p_object_version_number  => l_rec.object_version_number,
106          x_return_status          => x_return_status,
107          x_msg_count              => x_msg_count,
108          x_msg_data               => x_msg_data
109          );
110 
111     pos_log.log_call_result
112       (p_module        => 'POSADMB',
113        p_prefix        => 'call hz_contact_point_v2pub.update_contact_point',
114        p_return_status => x_return_status,
115        p_msg_count     => x_msg_count,
116        p_msg_data      => x_msg_data
117        );
118 
119     ELSIF p_number IS NOT NULL THEN
120        l_phone_rec.phone_country_code := p_country_code;
121        l_phone_rec.phone_area_code    := p_area_code;
122        l_phone_rec.phone_number       := p_number;
123        l_phone_rec.phone_extension    := p_extension;
124        l_phone_rec.phone_line_type    := 'GEN';
125 
126        l_contact_points_rec.contact_point_type := 'PHONE';
127        l_contact_points_rec.status             := 'A';
128        l_contact_points_rec.owner_table_name   := p_owner_table_name;
129        l_contact_points_rec.owner_table_id     := p_owner_table_id;
130        l_contact_points_rec.created_by_module  := 'POS_SUPPLIER_MGMT';
131        l_contact_points_rec.application_id     := 177;
132        l_contact_points_rec.primary_flag       := 'Y';
133 
134        hz_contact_point_v2pub.create_contact_point
135          ( p_init_msg_list     => fnd_api.g_false,
136            p_contact_point_rec => l_contact_points_rec,
137            p_phone_rec         => l_phone_rec,
138            x_contact_point_id  => l_contact_point_id,
139            x_return_status     => x_return_status,
140            x_msg_count         => x_msg_count,
141            x_msg_data          => x_msg_data
142            );
143 
144        pos_log.log_call_result
145 	 (p_module        => 'POSADMB',
146 	  p_prefix        => 'call hz_contact_point_v2pub.create_contact_point',
147 	  p_return_status => x_return_status,
148 	  p_msg_count     => x_msg_count,
149 	  p_msg_data      => x_msg_data
150        );
151     ELSE
152       x_return_status := fnd_api.g_ret_sts_success;
153    END IF;
154 
155 END create_or_update_tca_phone;
156 
157 -- update if exists, create otherwise
158 PROCEDURE create_or_update_tca_fax
159   ( p_owner_table_id     IN  NUMBER   ,
160     p_owner_table_name   IN  VARCHAR2 ,
161     p_country_code       IN  VARCHAR2 ,
162     p_area_code          IN  VARCHAR2 ,
163     p_number             IN  VARCHAR2 ,
164     p_extension          IN  VARCHAR2 ,
165 --Start Bug 6620664
166     p_fax_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM,
167 --End Bug 6620664
168     x_return_status      OUT NOCOPY VARCHAR2,
169     x_msg_count          OUT NOCOPY NUMBER  ,
170     x_msg_data           OUT NOCOPY VARCHAR2
171     )
172 IS
173    CURSOR l_cur IS
174       SELECT contact_point_id, object_version_number, phone_number,
175              phone_area_code, phone_extension
176         FROM hz_contact_points
177        WHERE owner_table_name = p_owner_table_name
178          AND owner_table_id = p_owner_table_id
179          AND contact_point_type = 'PHONE'
180          AND phone_line_type = 'FAX'
181          AND status = 'A' ;
182 
183    l_rec   l_cur%ROWTYPE;
184    l_found BOOLEAN;
185 
186    l_contact_point_id    NUMBER;
187    l_contact_points_rec  hz_contact_point_v2pub.contact_point_rec_type;
188    l_phone_rec           hz_contact_point_v2pub.phone_rec_type;
189 
190 BEGIN
191 
192    OPEN l_cur;
193    FETCH l_cur INTO l_rec;
194    l_found := l_cur%found;
195    CLOSE l_cur;
196 
197    IF l_found THEN
198 
199       IF p_number is NULL OR trim(p_number) IS NULL THEN
200 
201          l_contact_points_rec.status := 'I';
202 
203          -- keep the old number when inactivating
204          l_phone_rec.phone_number    := l_rec.phone_number;
205        ELSE
206          IF (l_rec.phone_area_code IS NULL     AND p_area_code IS NULL OR
207              l_rec.phone_area_code IS NOT NULL AND p_area_code IS NOT NULL AND
208              l_rec.phone_area_code             =   p_area_code
209              ) AND
210             (l_rec.phone_number    IS NULL     AND p_number    IS NULL OR
211              l_rec.phone_number    IS NOT NULL AND p_number    IS NOT NULL AND
212              l_rec.phone_number                =   p_number
213              ) AND
214 	    (l_rec.phone_extension    IS NULL     AND p_extension    IS NULL OR
215              l_rec.phone_extension    IS NOT NULL AND p_extension    IS NOT NULL AND
216              l_rec.phone_extension                =   p_extension
217              ) THEN
218             -- the current data is the same as the new data so no change needed
219 	    x_return_status := fnd_api.g_ret_sts_success;
220             RETURN;
221          END IF;
222          l_contact_points_rec.status := 'A';
223          l_phone_rec.phone_number    := p_number;
224       END IF;
225 
226 --Start for Bug 12928774
227       IF (l_rec.phone_area_code IS NOT NULL  AND p_area_code IS NULL) THEN
228         l_phone_rec.phone_area_code    := fnd_api.g_miss_char;
229       ELSE
230         l_phone_rec.phone_area_code    := p_area_code;
231       END IF;
232       IF (l_rec.phone_extension IS NOT NULL  AND p_extension IS NULL) THEN
233         l_phone_rec.phone_extension    := fnd_api.g_miss_char;
234       ELSE
235         l_phone_rec.phone_extension    := p_extension;
236       END IF;
237 --End for Bug 12928774
238 
239 	  l_contact_points_rec.contact_point_id := l_rec.contact_point_id;
240       l_phone_rec.phone_country_code := p_country_code;
241       l_phone_rec.phone_line_type    := 'FAX';
242 
243 --Start for Bug 6620664
244       IF p_fax_object_version_number <> fnd_api.G_NULL_NUM THEN
245 
246           l_rec.object_version_number := p_fax_object_version_number;
247       END IF;
248 --End for Bug 6620664
249 
250       hz_contact_point_v2pub.update_contact_point
251         (p_init_msg_list          => fnd_api.g_false,
252          p_contact_point_rec      => l_contact_points_rec,
253          p_phone_rec              => l_phone_rec,
254          p_object_version_number  => l_rec.object_version_number,
255          x_return_status          => x_return_status,
256          x_msg_count              => x_msg_count,
257          x_msg_data               => x_msg_data
258          );
259 
260     ELSIF p_number IS NOT NULL THEN
261        l_phone_rec.phone_country_code := p_country_code;
262        l_phone_rec.phone_area_code    := p_area_code;
263        l_phone_rec.phone_number       := p_number;
264        l_phone_rec.phone_extension    := p_extension;
265        l_phone_rec.phone_line_type    := 'FAX';
266 
267        l_contact_points_rec.contact_point_type := 'PHONE';
268        l_contact_points_rec.status             := 'A';
269        l_contact_points_rec.owner_table_name   := p_owner_table_name;
270        l_contact_points_rec.owner_table_id     := p_owner_table_id;
271        l_contact_points_rec.created_by_module  := 'POS_SUPPLIER_MGMT';
272        l_contact_points_rec.application_id     := 177;
273 
274        hz_contact_point_v2pub.create_contact_point
275          ( p_init_msg_list     => fnd_api.g_false,
276            p_contact_point_rec => l_contact_points_rec,
277            p_phone_rec         => l_phone_rec,
278            x_contact_point_id  => l_contact_point_id,
279            x_return_status     => x_return_status,
280            x_msg_count         => x_msg_count,
281            x_msg_data          => x_msg_data
282            );
283     ELSE
284       x_return_status := fnd_api.g_ret_sts_success;
285    END IF;
286 
287 END create_or_update_tca_fax;
288 
289 -- update if exists, create otherwise
290 PROCEDURE create_or_update_tca_email
291   ( p_owner_table_id   IN  NUMBER,
292     p_owner_table_name IN  VARCHAR2,
293     p_email_address    IN  VARCHAR2,
294 --Start Bug 6620664
295     p_email_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM,
296 --End Bug 6620664
297     x_return_status    OUT NOCOPY VARCHAR2,
298     x_msg_count        OUT NOCOPY NUMBER,
299     x_msg_data         OUT NOCOPY VARCHAR2
300     )
301   IS
302      CURSOR l_cur IS
303         SELECT contact_point_id, object_version_number, email_address
304           FROM hz_contact_points
305          WHERE owner_table_name = p_owner_table_name
306            AND owner_table_id = p_owner_table_id
307            AND contact_point_type = 'EMAIL'
308            AND primary_flag = 'Y'
309            AND status = 'A';
310 
311      l_rec    l_cur%ROWTYPE;
312      l_found  BOOLEAN;
313 
314      l_contact_point_id    NUMBER;
315      l_contact_points_rec  hz_contact_point_v2pub.contact_point_rec_type;
316      l_email_rec           hz_contact_point_v2pub.email_rec_type;
317 
318 BEGIN
319    OPEN l_cur;
320    FETCH l_cur INTO l_rec;
321    l_found := l_cur%found;
322    CLOSE l_cur;
323 
324    IF l_found THEN
325       IF p_email_address is NULL or trim(p_email_address) IS NULL THEN
326 
327          l_contact_points_rec.status := 'I';
328 
329          -- keep the old value when inactivating
330          l_email_rec.email_address   := l_rec.email_address;
331        ELSE
332          IF (l_rec.email_address IS NULL     AND p_email_address IS NULL OR
333              l_rec.email_address IS NOT NULL AND p_email_address IS NOT NULL AND
334              l_rec.email_address             =   p_email_address
335              ) THEN
336             -- the current data is the same as the new data so no change needed
337 	    x_return_status := fnd_api.g_ret_sts_success;
338             RETURN;
339          END IF;
340 
341          l_contact_points_rec.status := 'A';
342          l_email_rec.email_address   := p_email_address;
343       END IF;
344 
345       l_contact_points_rec.contact_point_id := l_rec.contact_point_id;
346 
347       l_email_rec.email_format := 'MAILTEXT';
348 
349 --Start for Bug 6620664
350       IF p_email_object_version_number <> fnd_api.G_NULL_NUM THEN
351 
352           l_rec.object_version_number := p_email_object_version_number;
353       END IF;
354 --End for Bug 6620664
355 
356       hz_contact_point_v2pub.update_contact_point
357         (p_init_msg_list          => fnd_api.g_false,
358          p_contact_point_rec      => l_contact_points_rec,
359          p_email_rec              => l_email_rec,
360          p_object_version_number  => l_rec.object_version_number,
361          x_return_status          => x_return_status,
362          x_msg_count              => x_msg_count,
363          x_msg_data               => x_msg_data
364          );
365 
366     ELSIF p_email_address is NOT NULL THEN
367       l_email_rec.email_format   := 'MAILTEXT';
368       l_email_rec.email_address  := p_email_address;
369 
370       l_contact_points_rec.contact_point_type := 'EMAIL';
371       l_contact_points_rec.status             := 'A';
372       l_contact_points_rec.owner_table_name   := p_owner_table_name;
373       l_contact_points_rec.owner_table_id     := p_owner_table_id;
374       l_contact_points_rec.created_by_module  := 'POS_SUPPLIER_MGMT';
375       l_contact_points_rec.application_id     := 177;
376 
377       hz_contact_point_v2pub.create_contact_point
378         ( p_init_msg_list     => fnd_api.g_false,
379           p_contact_point_rec => l_contact_points_rec,
380           p_email_rec         => l_email_rec,
381           x_contact_point_id  => l_contact_point_id,
382           x_return_status     => x_return_status,
383           x_msg_count         => x_msg_count,
384           x_msg_data          => x_msg_data
385           );
386     ELSE
387       x_return_status := fnd_api.g_ret_sts_success;
388    END IF;
389 
390 END create_or_update_tca_email;
391 
392 -- update if exists, create otherwise
393 PROCEDURE create_or_update_tca_alt_phone
394   ( p_owner_table_id     IN  NUMBER   ,
398     p_number             IN  VARCHAR2 ,
395     p_owner_table_name   IN  VARCHAR2 ,
396     p_country_code       IN  VARCHAR2 ,
397     p_area_code          IN  VARCHAR2 ,
399     p_extension          IN  VARCHAR2 ,
400     p_phone_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM,
401     x_return_status      OUT NOCOPY VARCHAR2,
402     x_msg_count          OUT NOCOPY NUMBER  ,
403     x_msg_data           OUT NOCOPY VARCHAR2
404     )
405 IS
406    CURSOR l_cur IS
407       SELECT contact_point_id, object_version_number,
408              phone_number, phone_area_code, phone_extension
409         FROM hz_contact_points
410        WHERE owner_table_name = p_owner_table_name
411          AND owner_table_id = p_owner_table_id
412          AND contact_point_type = 'PHONE'
413          AND phone_line_type = 'GEN'
414          AND primary_flag = 'N'
415          AND status = 'A' ;
416 
417    l_rec   l_cur%ROWTYPE;
418    l_found BOOLEAN;
419 
420    l_contact_point_id    NUMBER;
421    l_contact_points_rec  hz_contact_point_v2pub.contact_point_rec_type;
422    l_phone_rec           hz_contact_point_v2pub.phone_rec_type;
423 
424 BEGIN
425 
426    OPEN l_cur;
427    FETCH l_cur INTO l_rec;
428    l_found := l_cur%found;
429    CLOSE l_cur;
430 
431    IF l_found THEN
432 
433       IF p_number is NULL OR trim(p_number) IS NULL THEN
434 
435          l_contact_points_rec.status := 'I';
436 
437          -- keep the old number when inactivating
438          l_phone_rec.phone_number    := l_rec.phone_number;
439 
440        ELSE
441          IF (l_rec.phone_area_code IS NULL     AND p_area_code IS NULL OR
442              l_rec.phone_area_code IS NOT NULL AND p_area_code IS NOT NULL AND
443              l_rec.phone_area_code             =   p_area_code
444              ) AND
445             (l_rec.phone_number    IS NULL     AND p_number    IS NULL OR
446              l_rec.phone_number    IS NOT NULL AND p_number    IS NOT NULL AND
447              l_rec.phone_number                =   p_number
448              ) AND
449             (l_rec.phone_extension    IS NULL     AND p_extension    IS NULL OR
450              l_rec.phone_extension    IS NOT NULL AND p_extension    IS NOT NULL AND
451              l_rec.phone_extension                =   p_extension
452              ) THEN
453             -- the current data is the same as the new data so no change needed
454 	    x_return_status := fnd_api.g_ret_sts_success;
455             RETURN;
456          END IF;
457 
458          l_contact_points_rec.status := 'A';
459          l_phone_rec.phone_number    := p_number;
460 
461       END IF;
462 
463 --Start for Bug 12928774
464       IF (l_rec.phone_area_code IS NOT NULL  AND p_area_code IS NULL) THEN
465         l_phone_rec.phone_area_code    := fnd_api.g_miss_char;
466       ELSE
467         l_phone_rec.phone_area_code    := p_area_code;
468       END IF;
469       IF (l_rec.phone_extension IS NOT NULL  AND p_extension IS NULL) THEN
470         l_phone_rec.phone_extension    := fnd_api.g_miss_char;
471       ELSE
472         l_phone_rec.phone_extension    := p_extension;
473       END IF;
474 --End for Bug 12928774
475 
476       l_contact_points_rec.contact_point_id := l_rec.contact_point_id;
477       l_phone_rec.phone_country_code := p_country_code;
478       l_phone_rec.phone_line_type    := 'GEN';
479 
480       IF p_phone_object_version_number <> fnd_api.G_NULL_NUM THEN
481           l_rec.object_version_number := p_phone_object_version_number;
482       END IF;
483 
484       hz_contact_point_v2pub.update_contact_point
485         (p_init_msg_list          => fnd_api.g_false,
486          p_contact_point_rec      => l_contact_points_rec,
487          p_phone_rec              => l_phone_rec,
488          p_object_version_number  => l_rec.object_version_number,
489          x_return_status          => x_return_status,
490          x_msg_count              => x_msg_count,
491          x_msg_data               => x_msg_data
492          );
493 
494     pos_log.log_call_result
495       (p_module        => 'POSADMB',
496        p_prefix        => 'call hz_contact_point_v2pub.update_contact_point',
497        p_return_status => x_return_status,
498        p_msg_count     => x_msg_count,
499        p_msg_data      => x_msg_data
500        );
501 
502     ELSIF p_number IS NOT NULL THEN
503        l_phone_rec.phone_country_code := p_country_code;
504        l_phone_rec.phone_area_code    := p_area_code;
505        l_phone_rec.phone_number       := p_number;
506        l_phone_rec.phone_extension    := p_extension;
507        l_phone_rec.phone_line_type    := 'GEN';
508 
509        l_contact_points_rec.contact_point_type := 'PHONE';
510        l_contact_points_rec.status             := 'A';
511        l_contact_points_rec.owner_table_name   := p_owner_table_name;
512        l_contact_points_rec.owner_table_id     := p_owner_table_id;
513        l_contact_points_rec.created_by_module  := 'POS_SUPPLIER_MGMT';
514        l_contact_points_rec.application_id     := 177;
515        l_contact_points_rec.primary_flag       := 'N';
516 
517        hz_contact_point_v2pub.create_contact_point
521            x_contact_point_id  => l_contact_point_id,
518          ( p_init_msg_list     => fnd_api.g_false,
519            p_contact_point_rec => l_contact_points_rec,
520            p_phone_rec         => l_phone_rec,
522            x_return_status     => x_return_status,
523            x_msg_count         => x_msg_count,
524            x_msg_data          => x_msg_data
525            );
526 
527        pos_log.log_call_result
528 	 (p_module        => 'POSADMB',
529 	  p_prefix        => 'call hz_contact_point_v2pub.create_contact_point',
530 	  p_return_status => x_return_status,
531 	  p_msg_count     => x_msg_count,
532 	  p_msg_data      => x_msg_data
533        );
534     ELSE
535       x_return_status := fnd_api.g_ret_sts_success;
536    END IF;
537 
538 END create_or_update_tca_alt_phone;
539 
540 -- update if exists, create otherwise
541 PROCEDURE create_or_update_tca_url
542   ( p_owner_table_id   IN  NUMBER,
543     p_owner_table_name IN  VARCHAR2,
544     p_url    IN  VARCHAR2,
545     p_url_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM,
546     x_return_status    OUT NOCOPY VARCHAR2,
547     x_msg_count        OUT NOCOPY NUMBER,
548     x_msg_data         OUT NOCOPY VARCHAR2
549     )
550   IS
551      CURSOR l_cur IS
552         SELECT contact_point_id, object_version_number, url
553           FROM hz_contact_points
554          WHERE owner_table_name = p_owner_table_name
555            AND owner_table_id = p_owner_table_id
556            AND contact_point_type = 'WEB'
557            AND status = 'A';
558 
559      l_rec    l_cur%ROWTYPE;
560      l_found  BOOLEAN;
561 
562      l_contact_point_id    NUMBER;
563      l_contact_points_rec  hz_contact_point_v2pub.contact_point_rec_type;
564      l_url_rec             hz_contact_point_v2pub.web_rec_type;
565 
566 BEGIN
567    OPEN l_cur;
568    FETCH l_cur INTO l_rec;
569    l_found := l_cur%found;
570    CLOSE l_cur;
571 
572    IF l_found THEN
573       IF p_url is NULL or trim(p_url) IS NULL THEN
574 
575          l_contact_points_rec.status := 'I';
576 
577          -- keep the old value when inactivating
578          l_url_rec.url   := l_rec.url;
579          l_url_rec.web_type := 'HTTP';
580        ELSE
581          IF (l_rec.url IS NULL     AND p_url IS NULL OR
582              l_rec.url IS NOT NULL AND p_url IS NOT NULL AND
583              l_rec.url             =   p_url
584              ) THEN
585             -- the current data is the same as the new data so no change needed
586 	    x_return_status := fnd_api.g_ret_sts_success;
587             RETURN;
588          END IF;
589 
590          l_contact_points_rec.status := 'A';
591          l_url_rec.web_type := 'HTTP';
592          l_url_rec.url   := p_url;
596 
593       END IF;
594 
595       l_contact_points_rec.contact_point_id := l_rec.contact_point_id;
597       IF p_url_object_version_number <> fnd_api.G_NULL_NUM THEN
598           l_rec.object_version_number := p_url_object_version_number;
599       END IF;
600 
601       hz_contact_point_v2pub.update_contact_point
602         (p_init_msg_list          => fnd_api.g_false,
603          p_contact_point_rec      => l_contact_points_rec,
604          p_web_rec                => l_url_rec,
605          p_object_version_number  => l_rec.object_version_number,
606          x_return_status          => x_return_status,
607          x_msg_count              => x_msg_count,
608          x_msg_data               => x_msg_data
609          );
610 
611     ELSIF p_url is NOT NULL THEN
612       l_url_rec.url  := p_url;
613       l_url_rec.web_type := 'HTTP';
614       l_contact_points_rec.contact_point_type := 'WEB';
615       l_contact_points_rec.status             := 'A';
616       l_contact_points_rec.owner_table_name   := p_owner_table_name;
617       l_contact_points_rec.owner_table_id     := p_owner_table_id;
618       l_contact_points_rec.created_by_module  := 'POS_SUPPLIER_MGMT';
619       l_contact_points_rec.application_id     := 177;
620 
621       hz_contact_point_v2pub.create_contact_point
622         ( p_init_msg_list     => fnd_api.g_false,
623           p_contact_point_rec => l_contact_points_rec,
624           p_web_rec           => l_url_rec,
625           x_contact_point_id  => l_contact_point_id,
626           x_return_status     => x_return_status,
627           x_msg_count         => x_msg_count,
628           x_msg_data          => x_msg_data
629           );
630     ELSE
631       x_return_status := fnd_api.g_ret_sts_success;
632    END IF;
633 
634 END create_or_update_tca_url;
635 
636 PROCEDURE update_party_phone
637   ( p_party_id          IN  NUMBER
638   , p_country_code      IN  VARCHAR2
639   , p_area_code         IN  VARCHAR2
640   , p_number            IN  VARCHAR2
641   , p_extension         IN  VARCHAR2
642 --Start Bug 6620664
643   , p_phone_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM
644 --End Bug 6620664
645   , x_return_status     OUT NOCOPY VARCHAR2
646   , x_msg_count         OUT nocopy VARCHAR2
647   , x_msg_data          OUT NOCOPY VARCHAR2
648     )
649   IS
650 BEGIN
651    create_or_update_tca_phone
652      (p_owner_table_id   =>  p_party_id,
653       p_owner_table_name =>  'HZ_PARTIES',
654       p_country_code     =>  p_country_code,
655       p_area_code        =>  p_area_code,
656       p_number           =>  p_number,
657       p_extension        =>  p_extension,
658 --Start Bug 6620664
659       p_phone_object_version_number => p_phone_object_version_number,
660 --End Bug 6620664
661       x_return_status    =>  x_return_status,
662       x_msg_count        =>  x_msg_count,
663       x_msg_data         =>  x_msg_data
664       );
665 END update_party_phone;
666 
667 PROCEDURE update_party_fax
668   ( p_party_id          IN  NUMBER
669   , p_country_code      IN  VARCHAR2
670   , p_area_code         IN  VARCHAR2
671   , p_number            IN  VARCHAR2
672   , p_extension         IN  VARCHAR2
673 --Start Bug 6620664
674   , p_fax_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM
675 --End Bug 6620664
676   , x_return_status     OUT NOCOPY VARCHAR2
677   , x_msg_count         OUT nocopy VARCHAR2
678   , x_msg_data          OUT NOCOPY VARCHAR2
679   )
680   IS
681 BEGIN
682    create_or_update_tca_fax
683      (p_owner_table_id   =>  p_party_id,
684       p_owner_table_name =>  'HZ_PARTIES',
685       p_country_code     =>  p_country_code,
686       p_area_code        =>  p_area_code,
687       p_number           =>  p_number,
688       p_extension        =>  p_extension,
689 --Start Bug 6620664
690       p_fax_object_version_number => p_fax_object_version_number,
691 --End Bug 6620664
692       x_return_status    =>  x_return_status,
693       x_msg_count        =>  x_msg_count,
694       x_msg_data         =>  x_msg_data
695       );
696 END update_party_fax;
697 
698 PROCEDURE update_party_email
699   ( p_party_id          IN  NUMBER
700   , p_email             IN  VARCHAR2
701 --Start Bug 6620664
702   , p_email_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM
703 --End Bug 6620664
704   , x_return_status     OUT NOCOPY VARCHAR2
705   , x_msg_count         OUT nocopy VARCHAR2
706   , x_msg_data          OUT NOCOPY VARCHAR2
707   )
708 IS
709 BEGIN
710    create_or_update_tca_email
711      (p_owner_table_id   =>  p_party_id,
712       p_owner_table_name =>  'HZ_PARTIES',
713       p_email_address    =>  p_email,
714 --Start Bug 6620664
715       p_email_object_version_number => p_email_object_version_number,
716 --End Bug 6620664
717       x_return_status    =>  x_return_status,
718       x_msg_count        =>  x_msg_count,
719       x_msg_data         =>  x_msg_data
720       );
721 END update_party_email;
722 
723 PROCEDURE update_party_alt_phone
724   ( p_party_id          IN  NUMBER
725   , p_country_code      IN  VARCHAR2
726   , p_area_code         IN  VARCHAR2
727   , p_number            IN  VARCHAR2
728   , p_extension         IN  VARCHAR2
729   , p_phone_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM
730   , x_return_status     OUT NOCOPY VARCHAR2
731   , x_msg_count         OUT nocopy VARCHAR2
732   , x_msg_data          OUT NOCOPY VARCHAR2
733   )
734   IS
735 BEGIN
736    create_or_update_tca_alt_phone
737      (p_owner_table_id   =>  p_party_id,
738       p_owner_table_name =>  'HZ_PARTIES',
739       p_country_code     =>  p_country_code,
743       p_phone_object_version_number => p_phone_object_version_number,
740       p_area_code        =>  p_area_code,
741       p_number           =>  p_number,
742       p_extension        =>  p_extension,
744       x_return_status    =>  x_return_status,
745       x_msg_count        =>  x_msg_count,
746       x_msg_data         =>  x_msg_data
747       );
748 END update_party_alt_phone;
749 
750 PROCEDURE update_party_url
751   ( p_party_id          IN  NUMBER
752   , p_url               IN  VARCHAR2
753   , p_url_object_version_number   IN  NUMBER DEFAULT fnd_api.G_NULL_NUM
754   , x_return_status     OUT NOCOPY VARCHAR2
755   , x_msg_count         OUT nocopy VARCHAR2
756   , x_msg_data          OUT NOCOPY VARCHAR2
757   )
758 IS
759 BEGIN
760    create_or_update_tca_url
761      (p_owner_table_id   =>  p_party_id,
762       p_owner_table_name =>  'HZ_PARTIES',
763       p_url              =>  p_url,
764       p_url_object_version_number => p_url_object_version_number,
765       x_return_status    =>  x_return_status,
766       x_msg_count        =>  x_msg_count,
767       x_msg_data         =>  x_msg_data
768       );
769 END update_party_url;
770 
771 PROCEDURE update_party_site_phone
772   ( p_party_site_id     IN  NUMBER
773   , p_country_code      IN  VARCHAR2
774   , p_area_code         IN  VARCHAR2
775   , p_number            IN  VARCHAR2
776   , p_extension         IN  VARCHAR2
777   , x_return_status     OUT NOCOPY VARCHAR2
778   , x_msg_count         OUT nocopy VARCHAR2
779   , x_msg_data          OUT NOCOPY VARCHAR2
780   ) IS
781 BEGIN
782    create_or_update_tca_phone
783      (p_owner_table_id   =>  p_party_site_id,
784       p_owner_table_name =>  'HZ_PARTY_SITES',
785       p_country_code     =>  p_country_code,
786       p_area_code        =>  p_area_code,
787       p_number           =>  p_number,
788       p_extension        =>  p_extension,
789       x_return_status    =>  x_return_status,
790       x_msg_count        =>  x_msg_count,
791       x_msg_data         =>  x_msg_data
792       );
793 END update_party_site_phone;
794 
795 PROCEDURE update_party_site_fax
796   ( p_party_site_id     IN  NUMBER
797   , p_country_code      IN  VARCHAR2
798   , p_area_code         IN  VARCHAR2
799   , p_number            IN  VARCHAR2
800   , p_extension         IN  VARCHAR2
801   , x_return_status     OUT NOCOPY VARCHAR2
802   , x_msg_count         OUT nocopy VARCHAR2
803   , x_msg_data          OUT NOCOPY VARCHAR2
804   ) IS
805 BEGIN
806    create_or_update_tca_fax
807      (p_owner_table_id   =>  p_party_site_id,
808       p_owner_table_name =>  'HZ_PARTY_SITES',
809       p_country_code     =>  p_country_code,
810       p_area_code        =>  p_area_code,
811       p_number           =>  p_number,
812       p_extension        =>  p_extension,
813       x_return_status    =>  x_return_status,
814       x_msg_count        =>  x_msg_count,
815       x_msg_data         =>  x_msg_data
816       );
817 END update_party_site_fax;
818 
819 PROCEDURE update_party_site_email
820   ( p_party_site_id     IN  NUMBER
821   , p_email             IN  VARCHAR2
822   , x_return_status     OUT NOCOPY VARCHAR2
823   , x_msg_count         OUT nocopy VARCHAR2
824   , x_msg_data          OUT NOCOPY VARCHAR2
825   ) IS
826 BEGIN
827    create_or_update_tca_email
828      (p_owner_table_id   =>  p_party_site_id,
829       p_owner_table_name =>  'HZ_PARTY_SITES',
830       p_email_address    =>  p_email,
831       x_return_status    =>  x_return_status,
832       x_msg_count        =>  x_msg_count,
833       x_msg_data         =>  x_msg_data
834       );
835 END update_party_site_email;
836 
837 END pos_hz_contact_point_pkg;