DBA Data[Home] [Help]

PACKAGE BODY: APPS.PJM_TASK_ATTRIBUTES_PKG

Source


1 PACKAGE BODY PJM_TASK_ATTRIBUTES_PKG AS
2 /* $Header: PJMPTAB.pls 115.7 2003/02/15 06:49:31 alaw ship $ */
3 
4 PROCEDURE LOAD_ROW
5 ( X_Assignment_Type    IN VARCHAR2
6 , X_Attribute_Code     IN VARCHAR2
7 , X_Owner              IN VARCHAR2
8 , X_Attribute_Name     IN VARCHAR2
9 , X_Form_Field_Name    IN VARCHAR2
10 ) IS
11 
12   user_id number;
13 
14 BEGIN
15 
16   if (X_Owner = 'SEED') then
17     user_id := 1;
18   else
19     user_id := 0;
20   end if;
21 
22   --
23   -- load the record
24   --
25   BEGIN
26     --
27     -- Update non-translated values in all languages
28     --
29     UPDATE pjm_task_attributes_tl
30     SET    form_field_name  = X_Form_Field_Name
31     ,      last_update_date = sysdate
32     ,      last_updated_by  = user_id
33     WHERE  assignment_type  = X_Assignment_Type
34     AND    attribute_code   = X_Attribute_Code;
35 
36     --
37     -- Update translated values in current language
38     --
39     UPDATE pjm_task_attributes_tl
40     SET    attribute_name   = X_Attribute_Name
41     ,      source_lang      = userenv('LANG')
42     WHERE  assignment_type  = X_Assignment_Type
43     AND    attribute_code   = X_Attribute_Code
44     AND    userenv('LANG') in ( language , source_lang );
45 
46     --
47     -- refresh translation in PJM_TASK_ATTR_USAGES_TL
48     --
49     UPDATE pjm_task_attr_usages_tl
50     SET    prompt           = X_Attribute_Name
51     ,      last_update_date = sysdate
52     ,      last_updated_by  = user_id
53     ,      source_lang      = userenv('LANG')
54     WHERE  assignment_type  = X_Assignment_Type
55     AND    attribute_code   = X_Attribute_Code
56     AND    language         = userenv('LANG')
57     AND    source_lang <> language;
58 
59     --
60     -- Insert if missing
61     --
62     INSERT INTO pjm_task_attributes_tl
63     (      assignment_type
64     ,      attribute_code
65     ,      last_update_date
66     ,      last_updated_by
67     ,      creation_date
68     ,      created_by
69     ,      last_update_login
70     ,      attribute_name
71     ,      form_field_name
72     ,      language
73     ,      source_lang )
74     SELECT X_Assignment_Type
75     ,      X_Attribute_Code
76     ,      sysdate
77     ,      user_id
78     ,      sysdate
79     ,      user_id
80     ,      -1
81     ,      X_Attribute_Name
82     ,      X_Form_Field_Name
83     ,      L.language_code
84     ,      userenv('LANG')
85     FROM   fnd_languages L
86     WHERE  L.installed_flag in ('I' , 'B')
87     AND NOT EXISTS (
88         SELECT null
89         FROM   pjm_task_attributes_tl
90         WHERE  assignment_type = X_Assignment_Type
91         AND    attribute_code = X_Attribute_Code
92         AND    language = L.language_code
93     );
94 
95   EXCEPTION
96     when others then
97       raise;
98 
99   END;
100 
101 END LOAD_ROW;
102 
103 PROCEDURE TRANSLATE_ROW
104 ( X_Assignment_Type    IN VARCHAR2
105 , X_Attribute_Code     IN VARCHAR2
106 , X_Owner              IN VARCHAR2
107 , X_Attribute_Name     IN VARCHAR2
108 ) IS
109 
110   user_id number;
111 
112 BEGIN
113 
114   if (X_Owner = 'SEED') then
115      user_id := 1;
116   else
117      user_id := 0;
118   end if;
119 
120   --
121   -- update the translation
122   --
123   UPDATE pjm_task_attributes_tl
124   SET    attribute_name   = X_Attribute_Name
125   ,      last_update_date = sysdate
126   ,      last_updated_by  = user_id
127   ,      source_lang      = userenv('LANG')
128   WHERE  assignment_type  = X_Assignment_Type
129   AND    attribute_code   = X_Attribute_Code
130   AND    userenv('LANG') in ( language , source_lang );
131 
132   --
133   -- refresh translation in PJM_TASK_ATTR_USAGES_TL
134   --
135   UPDATE pjm_task_attr_usages_tl
136   SET    prompt           = X_Attribute_Name
137   ,      last_update_date = sysdate
138   ,      last_updated_by  = user_id
139   ,      source_lang      = userenv('LANG')
140   WHERE  assignment_type  = X_Assignment_Type
141   AND    attribute_code   = X_Attribute_Code
142   AND    language         = userenv('LANG')
143   AND    source_lang <> language;
144 
145 EXCEPTION
146   when no_data_found then
147     null;
148 
149 END TRANSLATE_ROW;
150 
151 
152 PROCEDURE ADD_LANGUAGE
153 IS
154 BEGIN
155 
156   INSERT INTO pjm_task_attributes_tl
157   ( assignment_type
158   , attribute_code
159   , creation_date
160   , created_by
161   , last_update_date
162   , last_updated_by
163   , last_update_login
164   , form_field_name
165   , attribute_name
166   , language
167   , source_lang
168   )
169   SELECT M.assignment_type
170   ,      M.attribute_code
171   ,      M.creation_date
172   ,      M.created_by
173   ,      M.last_update_date
174   ,      M.last_updated_by
175   ,      M.last_update_login
176   ,      M.form_field_name
177   ,      M.attribute_name
178   ,      L.language_code
179   ,      M.source_lang
180   FROM   pjm_task_attributes_tl M
181   ,      fnd_languages L
182   WHERE  M.language = userenv('LANG')
183   AND    L.installed_flag in ( 'I' , 'B' )
184   AND NOT EXISTS (
185       SELECT null
186       FROM   pjm_task_attributes_tl
187       WHERE  assignment_type = M.assignment_type
188       AND    attribute_code = M.attribute_code
189       AND    language = L.language_code );
190 
191 END ADD_LANGUAGE;
192 
193 END PJM_TASK_ATTRIBUTES_PKG;