DBA Data[Home] [Help]

PACKAGE BODY: APPS.OE_PAYMENT_TYPES_UTIL

Source


1 PACKAGE BODY OE_PAYMENT_TYPES_UTIL as
2 /* $Header: OEXUPMTB.pls 120.1 2005/07/15 05:20:42 ppnair noship $ */
3 
4   PROCEDURE Insert_Row(X_Rowid                  IN OUT NOCOPY 	 VARCHAR2,
5                        p_name                	VARCHAR2,
6                        p_description            VARCHAR2,
7                        p_payment_type_id        NUMBER,
8                        p_payment_type_code      VARCHAR2,
9                        p_receipt_method_id      NUMBER,
10                        p_start_date_active      DATE,
11                        p_end_date_active        DATE,
12                        p_enabled_flag           VARCHAR2,
13                        p_defer_payment          VARCHAR2,
14                        p_credit_check_flag      VARCHAR2,
15                        p_org_id                	NUMBER  ,
16                        p_Last_Update_Date       DATE,
17                        p_Last_Updated_By        NUMBER  ,
18                        p_Creation_Date          DATE ,
19                        p_Created_By             NUMBER ,
20                        p_Last_Update_Login      NUMBER,
21                        p_program_application_id NUMBER,
22                        p_program_id         	NUMBER,
23                        p_request_id         	NUMBER,
24                        p_program_update_date    DATE ,
25                        p_Context 	        VARCHAR2,
26                        p_Attribute1             VARCHAR2,
27                        p_Attribute2             VARCHAR2,
28                        p_Attribute3             VARCHAR2,
29                        p_Attribute4             VARCHAR2,
30                        p_Attribute5             VARCHAR2,
31                        p_Attribute6             VARCHAR2,
32                        p_Attribute7             VARCHAR2,
33                        p_Attribute8             VARCHAR2,
34                        p_Attribute9             VARCHAR2,
35                        p_Attribute10            VARCHAR2,
36                        p_Attribute11            VARCHAR2,
37                        p_Attribute12            VARCHAR2,
38                        p_Attribute13            VARCHAR2,
39                        p_Attribute14            VARCHAR2,
40                        p_Attribute15            VARCHAR2
41   ) IS
42   --  CURSOR C IS SELECT rowid FROM oe_system_parameters_all
43                  /** WHERE nvl(org_id, -99) = nvl(X_Organization_Id, -99); **/
44                 -- NVL of -99 is removed as per SSA
45                 -- WHERE org_id = X_Organization_Id;
46    --              WHERE nvl(org_id, -99) = nvl(X_Organization_Id, -99);
47 
48 l_language		VARCHAR2(4);
49 l_source_lang		VARCHAR2(4);
50 l_org_id number := 0;
51 
52 BEGIN
53 
54 /*
55 SELECT USERENV('LANG'),USERENV('LANG')
56 INTO   l_language,l_source_lang
57 FROM   DUAL;
58 */
59 
60 l_org_id := p_org_id;
61 
62 if l_org_id is null then
63 
64     OE_GLOBALS.Set_Context;
65     l_org_id := OE_GLOBALS.G_ORG_ID;
66 
67 end if;
68 
69 INSERT INTO oe_payment_types_tl
70 (payment_type_code
71 ,language
72 ,source_lang
73 ,name
74 ,description
75 ,creation_date
76 ,created_by
77 ,last_update_date
78 ,last_updated_by
79 ,last_update_login
80 ,program_application_id
81 ,program_id
82 ,request_id
83 ,program_update_date
84 ,org_id
85 )
86 SELECT
87 p_payment_type_code
88 ,L.LANGUAGE_CODE
89 ,userenv('LANG')
90 ,p_name
91 ,p_description
92 ,p_creation_date
93 ,p_created_by
94 ,p_last_update_date
95 ,p_last_updated_by
96 ,p_last_update_login
97 ,p_program_application_id
98 ,p_program_id
99 ,p_request_id
100 ,p_program_update_date
101 ,p_org_id
102 FROM FND_LANGUAGES L
103 WHERE L.INSTALLED_FLAG IN ('I', 'B')
104 and not exists
105 ( select null
106   from oe_payment_types_tl t
107   where t.org_id = p_org_id
108   and t.payment_type_code = p_payment_type_code
109   and t.language = L.LANGUAGE_CODE);
110 
111 INSERT INTO oe_payment_types_all
112 (payment_type_code
113 ,start_date_active
114 ,end_date_active
115 ,enabled_flag
116 ,defer_payment_processing_flag
117 ,credit_check_flag
118 ,receipt_method_id
119 ,org_id
120 ,creation_date
121 ,created_by
122 ,last_update_date
123 ,last_updated_by
124 ,last_update_login
125 ,program_application_id
126 ,program_id
127 ,request_id
128 ,context
129 ,attribute1
130 ,attribute2
131 ,attribute3
132 ,attribute4
133 ,attribute5
134 ,attribute6
135 ,attribute7
136 ,attribute8
137 ,attribute9
138 ,attribute10
139 ,attribute11
140 ,attribute12
141 ,attribute13
142 ,attribute14
143 ,attribute15
144 ,program_update_date
145 )
146 VALUES(
147 p_payment_type_code
148 ,p_start_date_active
149 ,p_end_date_active
150 ,p_enabled_flag
151 ,p_defer_payment
152 ,p_credit_check_flag
153 ,p_receipt_method_id
154 ,p_org_id
155 ,p_creation_date
156 ,p_created_by
157 ,p_last_update_date
158 ,p_last_updated_by
159 ,p_last_update_login
160 ,p_program_application_id
161 ,p_program_id
162 ,p_request_id
163 ,p_context
164 ,p_attribute1
165 ,p_attribute2
166 ,p_attribute3
167 ,p_attribute4
168 ,p_attribute5
169 ,p_attribute6
170 ,p_attribute7
171 ,p_attribute8
172 ,p_attribute9
173 ,p_attribute10
174 ,p_attribute11
175 ,p_attribute12
176 ,p_attribute13
177 ,p_attribute14
178 ,p_attribute15
179 ,p_program_update_date
180 );
181 
182 END Insert_Row;
183 
184 
185 
186   PROCEDURE Lock_Row  (p_name                	VARCHAR2,
187                        p_description            VARCHAR2,
188                        p_payment_type_id        NUMBER,
189                        p_payment_type_code      VARCHAR2,
190                        p_receipt_method         VARCHAR2,
191                        p_start_date_active      DATE,
192                        p_end_date_active        DATE,
193                        p_enabled_flag           VARCHAR2,
194                        p_defer_payment          VARCHAR2,
195                        p_credit_check_flag      VARCHAR2,
196                        p_org_id                	NUMBER  ,
197                        p_Context 	        VARCHAR2,
198                        p_Attribute1             VARCHAR2,
199                        p_Attribute2             VARCHAR2,
200                        p_Attribute3             VARCHAR2,
201                        p_Attribute4             VARCHAR2,
202                        p_Attribute5             VARCHAR2,
203                        p_Attribute6             VARCHAR2,
204                        p_Attribute7             VARCHAR2,
205                        p_Attribute8             VARCHAR2,
206                        p_Attribute9             VARCHAR2,
207                        p_Attribute10            VARCHAR2,
208                        p_Attribute11            VARCHAR2,
209                        p_Attribute12            VARCHAR2,
210                        p_Attribute13            VARCHAR2,
211                        p_Attribute14            VARCHAR2,
212                        p_Attribute15            VARCHAR2
213 
214   ) IS
215     CURSOR C IS
216         SELECT *
217         FROM   oe_payment_types_all
218         WHERE  payment_type_code = p_payment_type_code
219         AND    nvl(org_id,-1) = nvl(p_org_id,-1)
220         FOR UPDATE OF PAYMENT_TYPE_CODE NOWAIT;
221 
222      CURSOR C1 IS
223         SELECT name,description,payment_type_code,
224                decode(LANGUAGE, userenv('LANG'), 'Y', 'N') BASELANG
225         FROM oe_payment_types_tl
226         WHERE payment_type_code = p_payment_type_code
227         AND nvl(org_id,-1) = nvl(p_org_id,-1)
228         AND   userenv('LANG') in (LANGUAGE, SOURCE_LANG)
229         FOR UPDATE OF PAYMENT_TYPE_CODE NOWAIT;
230 
231     Recinfo C%ROWTYPE;
232     RECORD_CHANGED EXCEPTION;
233     l_org_id number := 0;
234   BEGIN
235 
236    l_org_id := p_org_id;
237 
238    if l_org_id is null then
239 
240       OE_GLOBALS.Set_Context;
241       l_org_id := OE_GLOBALS.G_ORG_ID;
242 
243    end if;
244 
245     OPEN C;
246     FETCH C INTO Recinfo;
247     if (C%NOTFOUND) then
248       CLOSE C;
249       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
250       APP_EXCEPTION.Raise_Exception;
251     end if;
252     CLOSE C;
253 
254   IF ( ((recinfo.payment_type_code = p_payment_type_code)
255            OR ((recinfo.payment_type_code is null) AND (p_payment_type_code is null)))
256      -- AND ((recinfo.receipt_method = p_receipt_method)
257      --      OR ((recinfo.receipt_method is null) AND (p_receipt_method is null)))
258       AND ((recinfo.start_date_active = p_start_date_active)
259            OR ((recinfo.start_date_active is null) AND (p_start_date_active is null)))
260       AND ((recinfo.end_date_active = p_end_date_active)
261            OR ((recinfo.end_date_active is null) AND (p_end_date_active is null)))
262       AND ((recinfo.defer_payment_processing_flag = p_defer_payment)
263            OR ((recinfo.defer_payment_processing_flag is null) AND (p_defer_payment is null)))
264       AND ((recinfo.credit_check_flag = p_credit_check_flag)
265            OR ((recinfo.credit_check_flag is null) AND (p_credit_check_flag is null)))
266       AND ((recinfo.org_id = p_org_id)
267            OR ((recinfo.org_id is null) AND (p_org_id is null)))
268       AND ((recinfo.context = p_context)
269            OR ((recinfo.context is null) AND (p_context is null)))
270       AND ((recinfo.attribute1 = p_attribute1)
271            OR ((recinfo.attribute1 is null) AND (p_attribute1 is null)))
272       AND ((recinfo.attribute2 = p_attribute2)
273            OR ((recinfo.attribute2 is null) AND (p_attribute2 is null)))
274       AND ((recinfo.attribute3 = p_attribute3)
275            OR ((recinfo.attribute3 is null) AND (p_attribute3 is null)))
276       AND ((recinfo.attribute4 = p_attribute4)
277            OR ((recinfo.attribute4 is null) AND (p_attribute4 is null)))
278       AND ((recinfo.attribute5 = p_attribute5)
279            OR ((recinfo.attribute5 is null) AND (p_attribute5 is null)))
280 
281       AND ((recinfo.attribute6 = p_attribute6)
282            OR ((recinfo.attribute6 is null) AND (p_attribute6 is null)))
283       AND ((recinfo.attribute7 = p_attribute7)
284            OR ((recinfo.attribute7 is null) AND (p_attribute7 is null)))
285       AND ((recinfo.attribute8 = p_attribute8)
286            OR ((recinfo.attribute8 is null) AND (p_attribute8 is null)))
287       AND ((recinfo.attribute9 = p_attribute9)
288            OR ((recinfo.attribute9 is null) AND (p_attribute9 is null)))
289       AND ((recinfo.attribute10 = p_attribute10)
290            OR ((recinfo.attribute10 is null) AND (p_attribute10 is null)))
291       AND ((recinfo.attribute11 = p_attribute11)
292            OR ((recinfo.attribute11 is null) AND (p_attribute11 is null)))
293       AND ((recinfo.attribute12 = p_attribute12)
294            OR ((recinfo.attribute12 is null) AND (p_attribute12 is null)))
295       AND ((recinfo.attribute13 = p_attribute13)
296            OR ((recinfo.attribute13 is null) AND (p_attribute13 is null)))
297       AND ((recinfo.attribute14 = p_attribute14)
298            OR ((recinfo.attribute14 is null) AND (p_attribute14 is null)))
299       AND ((recinfo.attribute15 = p_attribute15)
300            OR ((recinfo.attribute15 is null) AND (p_attribute15 is null)))
301 
302   ) THEN
303     null;
304   ELSE
305     fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
306     app_exception.raise_exception;
307   END IF;
308 
309   FOR tlinfo IN C1 LOOP
310     if (tlinfo.BASELANG = 'Y') then
311       IF ((tlinfo.name = p_name)
312           AND ((tlinfo.description = p_description)
313            OR ((tlinfo.description is null) AND (p_description is null)))
314           AND (recinfo.payment_type_code = p_payment_type_code)
315          ) THEN
316          null;
317       ELSE
318          fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
319          app_exception.raise_exception;
320       END IF;
321     END IF;
322   END LOOP;
323 
324 
325 EXCEPTION
326   WHEN RECORD_CHANGED THEN
327     FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
328     APP_EXCEPTION.Raise_Exception;
329   WHEN OTHERS THEN
330     raise;
331 END Lock_Row;
332 
333 PROCEDURE Update_Row(X_Rowid         		VARCHAR2,
334                        p_name                	VARCHAR2,
335                        p_description            VARCHAR2,
336                        p_payment_type_id        NUMBER,
337                        p_payment_type_code      VARCHAR2,
338                        p_receipt_method_id      NUMBER,
339                        p_start_date_active      DATE,
340                        p_end_date_active        DATE,
341                        p_enabled_flag           VARCHAR2,
342                        p_defer_payment          VARCHAR2,
343                        p_credit_check_flag      VARCHAR2,
344                        p_org_id                	NUMBER  ,
345                        p_Last_Update_Date       DATE,
346                        p_Last_Updated_By        NUMBER  ,
347                        p_Creation_Date          DATE ,
348                        p_Created_By             NUMBER ,
349                        p_Last_Update_Login      NUMBER,
350                        p_program_application_id NUMBER,
351                        p_program_id         	NUMBER,
352                        p_request_id         	NUMBER,
353                        p_program_update_date    DATE ,
354                        p_Context 	        VARCHAR2,
355                        p_Attribute1             VARCHAR2,
356                        p_Attribute2             VARCHAR2,
357                        p_Attribute3             VARCHAR2,
358                        p_Attribute4             VARCHAR2,
359                        p_Attribute5             VARCHAR2,
360                        p_Attribute6             VARCHAR2,
361                        p_Attribute7             VARCHAR2,
362                        p_Attribute8             VARCHAR2,
363                        p_Attribute9             VARCHAR2,
364                        p_Attribute10            VARCHAR2,
365                        p_Attribute11            VARCHAR2,
366                        p_Attribute12            VARCHAR2,
367                        p_Attribute13            VARCHAR2,
368                        p_Attribute14            VARCHAR2,
369                        p_Attribute15            VARCHAR2
370                       ) IS
371 BEGIN
372 
373 
374     UPDATE oe_payment_types_tl
375     SET
376        org_id          = p_org_id,
377        payment_type_code	= p_payment_type_code,
378        name		        = p_name,
379        description		= p_description,
380        last_update_date         = p_Last_Update_Date,
381        last_updated_by          = p_Last_Updated_By,
382        last_update_login        = p_Last_Update_Login,
383        source_lang              = userenv('LANG')
384     WHERE nvl(org_id,-1) = nvl(p_org_id, -1)
385     AND  payment_type_code = p_payment_type_code
386     AND userenv('LANG') in (LANGUAGE, SOURCE_LANG);
387 
388     UPDATE oe_payment_types_all
389     SET
390      	payment_type_code	= p_payment_type_code,
391 	start_date_active	= p_start_date_active,
392 	end_date_active		= p_end_date_active,
393 	enabled_flag		= p_enabled_flag,
394 	defer_payment_processing_flag	= p_defer_payment,
395         credit_check_flag	= p_credit_check_flag,
396         last_update_date        = p_Last_Update_Date,
397         last_updated_by         = p_Last_Updated_By,
398         last_update_login       = p_Last_Update_Login,
399 	receipt_method_id	= p_receipt_method_id,
400 	org_id			= p_org_id,
401 	context              	= p_Context,
402        	attribute1              = p_Attribute1,
403       	attribute2              = p_Attribute2,
404        	attribute3              = p_Attribute3,
405        	attribute4              = p_Attribute4,
406        	attribute5              = p_Attribute5,
407        	attribute6              = p_Attribute6,
408        	attribute7              = p_Attribute7,
409        	attribute8              = p_Attribute8,
410        	attribute9              = p_Attribute9,
411        	attribute10             = p_Attribute10,
412        	attribute11             = p_Attribute11,
413        	attribute12             = p_Attribute12,
414        	attribute13             = p_Attribute13,
415        	attribute14             = p_Attribute14,
416        	attribute15             = p_Attribute15
417     WHERE nvl(org_id,-1) = nvl(p_org_id,-1)
418     AND   payment_type_code = p_payment_type_code;
419 
420     if (SQL%NOTFOUND) then
421       Raise NO_DATA_FOUND;
422     end if;
423 END Update_Row;
424 
425 PROCEDURE Delete_Row(p_payment_type_id IN NUMBER,
426                      p_payment_type_code IN VARCHAR2,
427                      p_org_id in NUMBER) IS
428   l_org_id number := 0;
429   BEGIN
430 
431 l_org_id := p_org_id;
432 
433 if l_org_id is null then
434 
435     OE_GLOBALS.Set_Context;
436     l_org_id := OE_GLOBALS.G_ORG_ID;
437 
438 end if;
439 
440 
441     DELETE FROM oe_payment_types_tl
442     WHERE nvl(org_id,-1) = nvl(l_org_id,-1)
443     AND payment_type_code = p_payment_type_code;
444 
445     DELETE FROM oe_payment_types_all
446     WHERE nvl(org_id,-1) = nvl(l_org_id,-1)
447     AND payment_type_code = p_payment_type_code;
448 
449 
450     if (SQL%NOTFOUND) then
451       Raise NO_DATA_FOUND;
452     end if;
453 END Delete_Row;
454 
455 
456 PROCEDURE Translate_Row(p_payment_type_id in VARCHAR2,
457                         p_payment_type_code in VARCHAR2,
458                         p_name in VARCHAR2,
459                         p_description in VARCHAR2,
460                         p_owner in varchar2,
461                         p_org_id in varchar2) IS
462    l_user_id number :=0;
463 BEGIN
464    l_user_id :=fnd_load_util.owner_id(p_owner); --seed data version changes
465    UPDATE oe_payment_types_tl
466     SET
467        payment_type_code	= p_payment_type_code,
468        name		        = p_name,
469        description		= p_description,
470        last_update_date         = sysdate,
471        --last_updated_by          = decode(p_owner, 'SEED', 1, 0),
472        last_updated_by          = l_user_id,
473        last_update_login        = 0,
474        source_lang = userenv('LANG')
475     WHERE nvl(org_id,-1) = nvl(p_org_id,-1)
476     AND   payment_type_code = p_payment_type_code
477     AND userenv('LANG') in (LANGUAGE, SOURCE_LANG);
478 
479 END Translate_Row;
480 
481 PROCEDURE LOAD_ROW( x_payment_type_id  in NUMBER,
482                       x_payment_type_code in VARCHAR2,
483                       x_request_id        in NUMBER,
484                       x_start_date_active in VARCHAR2,
485                       x_end_date_active   in VARCHAR2,
486                       x_enabled_flag      in VARCHAR2,
487                       x_defer_processing_flag in VARCHAR2,
488                       x_credit_check_flag in VARCHAR2,
489                       x_receipt_method_id in NUMBER,
490                       x_context           in VARCHAR2,
491                       x_attribute1        in VARCHAR2,
492                       x_attribute2        in VARCHAR2,
493                       x_attribute3        in VARCHAR2,
494                       x_attribute4        in VARCHAR2,
495                       x_attribute5        in VARCHAR2,
496                       x_attribute6        in VARCHAR2,
497                       x_attribute7        in VARCHAR2,
498                       x_attribute8        in VARCHAR2,
499                       x_attribute9        in VARCHAR2,
500                       x_attribute10        in VARCHAR2,
501                       x_attribute11        in VARCHAR2,
502                       x_attribute12        in VARCHAR2,
503                       x_attribute13        in VARCHAR2,
504                       x_attribute14        in VARCHAR2,
505                       x_attribute15        in VARCHAR2,
506                       x_name               in VARCHAR2,
507                       x_description        in VARCHAR2,
508                       x_last_update_date   in VARCHAR2,
509                       x_last_updated_by    in NUMBER,
510                       x_last_update_login  in NUMBER,
511                       x_owner              in VARCHAR2,
512                       x_org_id             in NUMBER) IS
513 l_user_id number := 0;
514 l_payment_type_id number := 0;
515 l_org_id number := 0;
516 l_rowid varchar2(240) := NULL;
517 l_db_user_id number := 0;
518 l_valid_release boolean :=false;
519 BEGIN
520 
521    IF x_owner = 'SEED' THEN
522       l_user_id := 1;
523    END IF;
524 
525    l_user_id :=fnd_load_util.owner_id(x_owner); --seed data version
526 
527      select org_id,last_updated_by into l_org_id,l_db_user_id
528      from oe_payment_types_all
529      where payment_type_code = x_payment_type_code
530      and nvl(org_id,-1) = nvl(x_org_id,-1)
531      and rownum = 1;
532      --seed data version start
533      if (l_db_user_id <= l_user_id)
534            or (l_db_user_id in (0,1,2)
535               and l_user_id in (0,1,2))       then
536 	  l_valid_release :=true ;
537      end if;
538      if l_valid_release then
539      --seed data version end
540       Update_Row(X_Rowid => l_rowid,
541                        p_name => x_name,
542                        p_description => x_description,
543                        p_payment_type_id => l_payment_type_id,
544                        p_payment_type_code => x_payment_type_code,
545                        p_receipt_method_id => x_receipt_method_id,
546                        p_start_date_active => x_start_date_active,
547                        p_end_date_active   => x_end_date_active,
548                        p_enabled_flag      => x_enabled_flag,
549                        p_defer_payment     => x_defer_processing_flag,
550                        p_credit_check_flag => x_credit_check_flag,
551                        p_org_id            => l_org_id,
552                        p_Last_Update_Date  => sysdate,
553                        p_Last_Updated_By   => l_user_id,
554                        p_Creation_Date     => NULL,
555                        p_Created_By        => NULL,
556                        p_Last_Update_Login => 0,
557                        p_program_application_id => NULL,
558                        p_program_id         	=> NULL,
559                        p_request_id         	=> x_request_id,
560                        p_program_update_date    => NULL,
561                        p_Context 	        => x_context,
562                        p_Attribute1             => x_attribute1,
563                        p_Attribute2             => x_attribute2,
564                        p_Attribute3             => x_attribute3,
565                        p_Attribute4             => x_attribute4,
566                        p_Attribute5             => x_attribute5,
567                        p_Attribute6             => x_attribute6,
568                        p_Attribute7             => x_attribute7,
569                        p_Attribute8             => x_attribute8,
570                        p_Attribute9             => x_attribute9,
571                        p_Attribute10            => x_attribute10,
572                        p_Attribute11            => x_attribute11,
573                        p_Attribute12            => x_attribute12,
574                        p_Attribute13            => x_attribute13,
575                        p_Attribute14            => x_attribute14,
576                        p_Attribute15            => x_attribute15 );
577        end if;
578       exception
579 
580          when no_data_found then
581 
582            Begin
583 
584               Insert_Row(X_Rowid => l_rowid,
585                        p_name => x_name,
586                        p_description => x_description,
587                        p_payment_type_id => x_payment_type_id,
588                        p_payment_type_code => x_payment_type_code,
589                        p_receipt_method_id => x_receipt_method_id,
590                        p_start_date_active => x_start_date_active,
591                        p_end_date_active   => x_end_date_active,
592                        p_enabled_flag      => x_enabled_flag,
593                        p_defer_payment     => x_defer_processing_flag,
594                        p_credit_check_flag => x_credit_check_flag,
595                        p_org_id            => x_org_id,
596                        p_Last_Update_Date  => sysdate,
597                        p_Last_Updated_By   => l_user_id,
598                        p_Creation_Date     => sysdate,
599                        p_Created_By        => l_user_id,
600                        p_Last_Update_Login => 0,
601                        p_program_application_id => NULL,
602                        p_program_id         	=> NULL,
603                        p_request_id         	=> x_request_id,
604                        p_program_update_date    => NULL,
605                        p_Context 	        => x_context,
606                        p_Attribute1             => x_attribute1,
607                        p_Attribute2             => x_attribute2,
608                        p_Attribute3             => x_attribute3,
609                        p_Attribute4             => x_attribute4,
610                        p_Attribute5             => x_attribute5,
611                        p_Attribute6             => x_attribute6,
612                        p_Attribute7             => x_attribute7,
613                        p_Attribute8             => x_attribute8,
614                        p_Attribute9             => x_attribute9,
615                        p_Attribute10            => x_attribute10,
616                        p_Attribute11            => x_attribute11,
617                        p_Attribute12            => x_attribute12,
618                        p_Attribute13            => x_attribute13,
619                        p_Attribute14            => x_attribute14,
620                        p_Attribute15            => x_attribute15 );
621 
622              Exception
623 
624                  when others then
625                       raise;
626 
627              END;
628 
629 
630 END LOAD_ROW;
631 
632 Procedure Copy_Payment_Types(p_from_org_id in number,
633                              p_to_org_id in number) is
634 Cursor
635 get_payment_types is
636 select payment_type_code,
637        request_id,
638        start_date_active,
639        end_date_active,
640        enabled_flag,
641        defer_payment_processing_flag,
642        credit_check_flag,
643        receipt_method_id,
644        context,
645        attribute1,
646        attribute2,
647        attribute3,
648        attribute4,
649        attribute5,
650        attribute6,
651        attribute7,
652        attribute8,
653        attribute9,
654        attribute10,
655        attribute11,
656        attribute12,
657        attribute13,
658        attribute14,
659        attribute15,
660        name,
661        description,
662        last_update_date,
663        last_updated_by,
664        last_update_login
665 from oe_payment_types_vl optv
666 where nvl(org_id, -1) = nvl(p_from_org_id, -1)
667 and not exists (
668 select null
669 from oe_payment_types_all opta
670 where opta.payment_type_code = optv.payment_type_code
671 and nvl(opta.org_id, -1) = nvl(p_to_org_id, -1) );
672 
673 x_owner varchar2(30) := NULL;
674 
675 Begin
676 
677   IF nvl(p_from_org_id, -1) <> nvl(p_to_org_id, -1) THEN
678 
679     for payment_type_rec in get_payment_types loop
680 
681        IF payment_type_rec.last_updated_by = 1 THEN
682             x_owner := 'SEED';
683 
684        END IF;
685 
686        LOAD_ROW(x_payment_type_id => NULL,
687                       x_payment_type_code => payment_type_rec.payment_type_code,
688                       x_request_id        => payment_type_rec.request_id,
689                       x_start_date_active => payment_type_rec.start_date_active,
690                       x_end_date_active   => payment_type_rec.end_date_active,
691                       x_enabled_flag      => payment_type_rec.enabled_flag,
692                       x_defer_processing_flag => payment_type_rec.defer_payment_processing_flag,
693                       x_credit_check_flag => payment_type_rec.credit_check_flag,
694                       x_receipt_method_id => payment_type_rec.receipt_method_id,
695                       x_context           => payment_type_rec.context,
696                       x_attribute1        => payment_type_rec.attribute1,
697                       x_attribute2        => payment_type_rec.attribute2,
698                       x_attribute3        => payment_type_rec.attribute3,
699                       x_attribute4        => payment_type_rec.attribute4,
700                       x_attribute5        => payment_type_rec.attribute5,
701                       x_attribute6        => payment_type_rec.attribute6,
702                       x_attribute7        => payment_type_rec.attribute7,
703                       x_attribute8        => payment_type_rec.attribute8,
704                       x_attribute9        => payment_type_rec.attribute9,
705                       x_attribute10       => payment_type_rec.attribute10,
706                       x_attribute11       => payment_type_rec.attribute11,
707                       x_attribute12       => payment_type_rec.attribute12,
708                       x_attribute13       => payment_type_rec.attribute13,
709                       x_attribute14       => payment_type_rec.attribute14,
710                       x_attribute15       => payment_type_rec.attribute15,
711                       x_name              => payment_type_rec.name,
712                       x_description       => payment_type_rec.description,
713                       x_last_update_date  => sysdate,
714                       x_last_updated_by   => payment_type_rec.last_updated_by,
715                       x_last_update_login => payment_type_rec.last_update_login,
716                       x_owner             => x_owner,
717                       x_org_id            => p_to_org_id);
718 
719     END LOOP;
720 
721   END IF;
722 
723 END Copy_Payment_Types;
724 
725 procedure ADD_LANGUAGE
726 is
727 begin
728   delete from OE_PAYMENT_TYPES_TL T
729   where not exists
730     (select NULL
731     from OE_PAYMENT_TYPES_ALL B
732     where B.PAYMENT_TYPE_CODE = T.PAYMENT_TYPE_CODE
733     and   NVL(B.ORG_ID, -1) = NVL(T.ORG_ID, -1)
734     );
735 
736   update OE_PAYMENT_TYPES_TL T set (
737       NAME,
738       DESCRIPTION
739     ) = (select
740       B.NAME,
741       B.DESCRIPTION
742     from OE_PAYMENT_TYPES_TL B
743     where B.PAYMENT_TYPE_CODE = T.PAYMENT_TYPE_CODE
744     and NVL(B.ORG_ID, -1) = NVL(T.ORG_ID, -1)
745     and B.LANGUAGE = T.SOURCE_LANG)
746   where (
747       T.PAYMENT_TYPE_CODE,
748       NVL(T.ORG_ID,-1),
749       T.LANGUAGE
750   ) in (select
751       SUBT.PAYMENT_TYPE_CODE,
752       NVL(SUBT.ORG_ID, -1),
753       SUBT.LANGUAGE
754     from OE_PAYMENT_TYPES_TL SUBB, OE_PAYMENT_TYPES_TL SUBT
755     where SUBB.PAYMENT_TYPE_CODE = SUBT.PAYMENT_TYPE_CODE
756     and NVL(SUBB.ORG_ID, -1) = NVL(SUBT.ORG_ID, -1)
757     and SUBB.LANGUAGE = SUBT.SOURCE_LANG
758     and (SUBB.NAME <> SUBT.NAME
759       or SUBB.DESCRIPTION <> SUBT.DESCRIPTION
760       or (SUBB.DESCRIPTION is null and SUBT.DESCRIPTION is not null)
761       or (SUBB.DESCRIPTION is not null and SUBT.DESCRIPTION is null)
762   ));
763 
764   insert into OE_PAYMENT_TYPES_TL (
765     PAYMENT_TYPE_CODE,
766     ORG_ID,
767     NAME,
768     DESCRIPTION,
769     CREATION_DATE,
770     CREATED_BY,
771     LAST_UPDATE_DATE,
772     LAST_UPDATED_BY,
773     LAST_UPDATE_LOGIN,
774     PROGRAM_APPLICATION_ID,
775     PROGRAM_ID,
776     REQUEST_ID,
777     LANGUAGE,
778     SOURCE_LANG
779   ) select
780     B.PAYMENT_TYPE_CODE,
781     B.ORG_ID,
782     B.NAME,
783     B.DESCRIPTION,
784     B.CREATION_DATE,
785     B.CREATED_BY,
786     B.LAST_UPDATE_DATE,
787     B.LAST_UPDATED_BY,
788     B.LAST_UPDATE_LOGIN,
789     B.PROGRAM_APPLICATION_ID,
790     B.PROGRAM_ID,
791     B.REQUEST_ID,
792     L.LANGUAGE_CODE,
793     B.SOURCE_LANG
794   from OE_PAYMENT_TYPES_TL B, FND_LANGUAGES L
795   where L.INSTALLED_FLAG in ('I', 'B')
796   and B.LANGUAGE = userenv('LANG')
797   and not exists
798     (select NULL
799     from OE_PAYMENT_TYPES_TL T
800     where T.PAYMENT_TYPE_CODE = B.PAYMENT_TYPE_CODE
801     and nvl(T.ORG_ID, -1) = NVL(B.ORG_ID, -1)
802     and T.LANGUAGE = L.LANGUAGE_CODE);
803 end ADD_LANGUAGE;
804 
805 END OE_PAYMENT_TYPES_UTIL;