DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGS_DA_SETUP_PKG

Source


1 PACKAGE BODY igs_da_setup_pkg AS
2 /* $Header: IGSKI40B.pls 120.1 2005/09/28 02:23:01 appldev ship $ */
3 
4   l_rowid VARCHAR2(25);
5   old_references igs_da_setup%ROWTYPE;
6   new_references igs_da_setup%ROWTYPE;
7 
8   PROCEDURE set_column_values (
9     p_action                            IN     VARCHAR2,
10     x_rowid                             IN     VARCHAR2,
11     x_s_control_num                     IN     NUMBER,
12     x_program_definition_ind            IN     VARCHAR2,
13     x_default_student_id_type           IN     VARCHAR2,
14     x_default_inst_id_type                   IN     VARCHAR2,
15     x_default_address_type              IN     VARCHAR2,
16     x_wif_major_unit_set_cat            IN     VARCHAR2,
17     x_wif_minor_unit_set_cat            IN     VARCHAR2,
18     x_wif_track_unit_set_cat            IN     VARCHAR2,
19     x_wif_unit_set_title                IN     VARCHAR2,
20     x_third_party_options               IN     VARCHAR2,
21 --    x_advisor_relationship_ind          IN     VARCHAR2,
22     x_display_container_ind             IN     VARCHAR2,
23     x_container_title                   IN     VARCHAR2,
24     x_link_text                         IN     VARCHAR2,
25     x_link_url                          IN     VARCHAR2,
26     x_creation_date                     IN     DATE,
27     x_created_by                        IN     NUMBER,
28     x_last_update_date                  IN     DATE,
29     x_last_updated_by                   IN     NUMBER,
30     x_last_update_login                 IN     NUMBER
31   ) AS
32   /*
33   ||  Created By : [email protected]
34   ||  Created On : 19-MAR-2003
35   ||  Purpose : Initialises the Old and New references for the columns of the table.
36   ||  Known limitations, enhancements or remarks :
37   ||  Change History :
38   ||  Who             When            What
39   ||  (reverse chronological order - newest change first)
40   */
41 
42     CURSOR cur_old_ref_values IS
43       SELECT   *
44       FROM     igs_da_setup
45       WHERE    rowid = x_rowid;
46 
47   BEGIN
48 
49     l_rowid := x_rowid;
50 
51     -- Code for setting the Old and New Reference Values.
52     -- Populate Old Values.
53     OPEN cur_old_ref_values;
54     FETCH cur_old_ref_values INTO old_references;
55     IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
56       CLOSE cur_old_ref_values;
57       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
58       igs_ge_msg_stack.add;
59       app_exception.raise_exception;
60       RETURN;
61     END IF;
62     CLOSE cur_old_ref_values;
63 
64     -- Populate New Values.
65     new_references.s_control_num                     := x_s_control_num;
66     new_references.program_definition_ind            := x_program_definition_ind;
67     new_references.default_student_id_type           := x_default_student_id_type;
68     new_references.default_inst_id_type                   := x_default_inst_id_type;
69     new_references.default_address_type              := x_default_address_type;
70     new_references.wif_major_unit_set_cat            := x_wif_major_unit_set_cat;
71     new_references.wif_minor_unit_set_cat            := x_wif_minor_unit_set_cat;
72     new_references.wif_track_unit_set_cat            := x_wif_track_unit_set_cat;
73     new_references.wif_unit_set_title                := x_wif_unit_set_title;
74     new_references.third_party_options               := x_third_party_options;
75 --    new_references.advisor_relationship_ind          := x_advisor_relationship_ind;
76     new_references.display_container_ind             := x_display_container_ind;
77     new_references.container_title                   := x_container_title;
78     new_references.link_text                         := x_link_text;
79     new_references.link_url                          := x_link_url;
80 
81     IF (p_action = 'UPDATE') THEN
82       new_references.creation_date                   := old_references.creation_date;
83       new_references.created_by                      := old_references.created_by;
84     ELSE
85       new_references.creation_date                   := x_creation_date;
86       new_references.created_by                      := x_created_by;
87     END IF;
88 
89     new_references.last_update_date                  := x_last_update_date;
90     new_references.last_updated_by                   := x_last_updated_by;
91     new_references.last_update_login                 := x_last_update_login;
92 
93   END set_column_values;
94 
95 
96   PROCEDURE check_parent_existance AS
97   /*
98   ||  Created By : [email protected]
99   ||  Created On : 19-MAR-2003
100   ||  Purpose : Checks for the existance of Parent records.
101   ||  Known limitations, enhancements or remarks :
102   ||  Change History :
103   ||  Who             When            What
104   ||  (reverse chronological order - newest change first)
105   */
106   BEGIN
107 
108     IF (((old_references.default_student_id_type = new_references.default_student_id_type)) OR
109         ((new_references.default_student_id_type IS NULL))) THEN
110       NULL;
111     ELSIF NOT igs_pe_person_id_typ_pkg.get_pk_for_validation (
112                 new_references.default_student_id_type
113               ) THEN
114       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
115       igs_ge_msg_stack.add;
116       app_exception.raise_exception;
117     END IF;
118 
119     IF (((old_references.wif_major_unit_set_cat = new_references.wif_major_unit_set_cat)) OR
120         ((new_references.wif_major_unit_set_cat IS NULL))) THEN
121       NULL;
122     ELSIF NOT igs_en_unit_set_cat_pkg.get_pk_for_validation (
123                 new_references.wif_major_unit_set_cat
124               ) THEN
125       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
126       igs_ge_msg_stack.add;
127       app_exception.raise_exception;
128     END IF;
129 
130     IF (((old_references.wif_minor_unit_set_cat = new_references.wif_minor_unit_set_cat)) OR
131         ((new_references.wif_minor_unit_set_cat IS NULL))) THEN
132       NULL;
133     ELSIF NOT igs_en_unit_set_cat_pkg.get_pk_for_validation (
134                 new_references.wif_minor_unit_set_cat
135               ) THEN
136       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
137       igs_ge_msg_stack.add;
138       app_exception.raise_exception;
139     END IF;
140 
141     IF (((old_references.wif_track_unit_set_cat = new_references.wif_track_unit_set_cat)) OR
142         ((new_references.wif_track_unit_set_cat IS NULL))) THEN
143       NULL;
144     ELSIF NOT igs_en_unit_set_cat_pkg.get_pk_for_validation (
145                 new_references.wif_track_unit_set_cat
146               ) THEN
147       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
148       igs_ge_msg_stack.add;
149       app_exception.raise_exception;
150     END IF;
151 
152     IF (((old_references.default_inst_id_type = new_references.default_inst_id_type)) OR
153         ((new_references.default_inst_id_type IS NULL))) THEN
154       NULL;
155     ELSIF NOT igs_or_org_alt_idtyp_pkg.get_pk_for_validation (
156                 new_references.default_inst_id_type
157               ) THEN
158       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
159       igs_ge_msg_stack.add;
160       app_exception.raise_exception;
161     END IF;
162 
163   END check_parent_existance;
164 
165 
166   FUNCTION get_pk_for_validation (
167     x_s_control_num                     IN     NUMBER
168   ) RETURN BOOLEAN AS
169   /*
170   ||  Created By : [email protected]
171   ||  Created On : 19-MAR-2003
172   ||  Purpose : Validates the Primary Key of the table.
173   ||  Known limitations, enhancements or remarks :
174   ||  Change History :
175   ||  Who             When            What
176   ||  (reverse chronological order - newest change first)
177   */
178     CURSOR cur_rowid IS
179       SELECT   rowid
180       FROM     igs_da_setup
181       WHERE    s_control_num = x_s_control_num
182       FOR UPDATE NOWAIT;
183 
184     lv_rowid cur_rowid%RowType;
185 
186   BEGIN
187 
188     OPEN cur_rowid;
189     FETCH cur_rowid INTO lv_rowid;
190     IF (cur_rowid%FOUND) THEN
191       CLOSE cur_rowid;
192       RETURN(TRUE);
193     ELSE
194       CLOSE cur_rowid;
195       RETURN(FALSE);
196     END IF;
197 
198   END get_pk_for_validation;
199 
200   PROCEDURE get_fk_igs_en_unit_set_cat (
201     x_unit_set_cat                      IN     VARCHAR2
202   ) AS
203   /*
204   ||  Created By : [email protected]
205   ||  Created On : 19-MAR-2003
206   ||  Purpose : Validates the Foreign Keys for the table.
207   ||  Known limitations, enhancements or remarks :
208   ||  Change History :
209   ||  Who             When            What
210   ||  (reverse chronological order - newest change first)
211   */
212     CURSOR cur_rowid IS
213       SELECT   rowid
214       FROM     igs_da_setup
215       WHERE   ((wif_major_unit_set_cat = x_unit_set_cat))
216       OR      ((wif_minor_unit_set_cat = x_unit_set_cat))
217       OR      ((wif_track_unit_set_cat = x_unit_set_cat));
218 
219     lv_rowid cur_rowid%RowType;
220 
221   BEGIN
222 
223     OPEN cur_rowid;
224     FETCH cur_rowid INTO lv_rowid;
225     IF (cur_rowid%FOUND) THEN
226       CLOSE cur_rowid;
227       fnd_message.set_name ('IGS', 'IGS_DA_SET_EUS_FK');
228       igs_ge_msg_stack.add;
229       app_exception.raise_exception;
230       RETURN;
231     END IF;
232     CLOSE cur_rowid;
233 
234   END get_fk_igs_en_unit_set_cat;
235 
236 
237   PROCEDURE get_fk_igs_or_org_alt_idtyp (
238     x_org_alternate_id_type             IN     VARCHAR2
239   ) AS
240   /*
241   ||  Created By : [email protected]
242   ||  Created On : 19-MAR-2003
243   ||  Purpose : Validates the Foreign Keys for the table.
244   ||  Known limitations, enhancements or remarks :
245   ||  Change History :
246   ||  Who             When            What
247   ||  (reverse chronological order - newest change first)
248   */
249     CURSOR cur_rowid IS
250       SELECT   rowid
251       FROM     igs_da_setup
252       WHERE   ((default_inst_id_type = x_org_alternate_id_type));
253 
254     lv_rowid cur_rowid%RowType;
255 
256   BEGIN
257 
258     OPEN cur_rowid;
259     FETCH cur_rowid INTO lv_rowid;
260     IF (cur_rowid%FOUND) THEN
261       CLOSE cur_rowid;
262       fnd_message.set_name ('IGS', 'IGS_DA_SET_OAIT_FK');
263       igs_ge_msg_stack.add;
264       app_exception.raise_exception;
265       RETURN;
266     END IF;
267     CLOSE cur_rowid;
268 
269   END get_fk_igs_or_org_alt_idtyp;
270 
271 
272   PROCEDURE before_dml (
273     p_action                            IN     VARCHAR2,
274     x_rowid                             IN     VARCHAR2,
275     x_s_control_num                     IN     NUMBER,
276     x_program_definition_ind            IN     VARCHAR2,
277     x_default_student_id_type           IN     VARCHAR2,
278     x_default_inst_id_type                   IN     VARCHAR2,
279     x_default_address_type              IN     VARCHAR2,
280     x_wif_major_unit_set_cat            IN     VARCHAR2,
281     x_wif_minor_unit_set_cat            IN     VARCHAR2,
282     x_wif_track_unit_set_cat            IN     VARCHAR2,
283     x_wif_unit_set_title                IN     VARCHAR2,
284     x_third_party_options               IN     VARCHAR2,
285 --    x_advisor_relationship_ind          IN     VARCHAR2,
286     x_display_container_ind             IN     VARCHAR2,
287     x_container_title                   IN     VARCHAR2,
288     x_link_text                         IN     VARCHAR2,
289     x_link_url                          IN     VARCHAR2,
290     x_creation_date                     IN     DATE,
291     x_created_by                        IN     NUMBER,
292     x_last_update_date                  IN     DATE,
293     x_last_updated_by                   IN     NUMBER,
294     x_last_update_login                 IN     NUMBER
295   ) AS
296   /*
297   ||  Created By : [email protected]
298   ||  Created On : 19-MAR-2003
299   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
300   ||            Trigger Handlers for the table, before any DML operation.
301   ||  Known limitations, enhancements or remarks :
302   ||  Change History :
303   ||  Who             When            What
304   ||  (reverse chronological order - newest change first)
305   */
306   BEGIN
307 
308     set_column_values (
309       p_action,
310       x_rowid,
311       x_s_control_num,
312       x_program_definition_ind,
313       x_default_student_id_type,
314       x_default_inst_id_type,
315       x_default_address_type,
316       x_wif_major_unit_set_cat,
317       x_wif_minor_unit_set_cat,
318       x_wif_track_unit_set_cat,
319       x_wif_unit_set_title,
320       x_third_party_options,
321 --      x_advisor_relationship_ind,
322       x_display_container_ind,
323       x_container_title,
324       x_link_text,
325       x_link_url,
326       x_creation_date,
327       x_created_by,
328       x_last_update_date,
329       x_last_updated_by,
330       x_last_update_login
331     );
332 
333     IF (p_action = 'INSERT') THEN
334       -- Call all the procedures related to Before Insert.
335       IF ( get_pk_for_validation(
336              new_references.s_control_num
337            )
338          ) THEN
339         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
340         igs_ge_msg_stack.add;
341         app_exception.raise_exception;
342       END IF;
343       check_parent_existance;
344     ELSIF (p_action = 'UPDATE') THEN
345       -- Call all the procedures related to Before Update.
346       check_parent_existance;
347     ELSIF (p_action = 'VALIDATE_INSERT') THEN
348       -- Call all the procedures related to Before Insert.
349       IF ( get_pk_for_validation (
350              new_references.s_control_num
351            )
352          ) THEN
353         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
354         igs_ge_msg_stack.add;
355         app_exception.raise_exception;
356       END IF;
357     END IF;
358 
359   END before_dml;
360 
361 
362   PROCEDURE insert_row (
363     x_rowid                             IN OUT NOCOPY VARCHAR2,
364     x_s_control_num                     IN     NUMBER,
365     x_program_definition_ind            IN     VARCHAR2,
366     x_default_student_id_type           IN     VARCHAR2,
367     x_default_inst_id_type                   IN     VARCHAR2,
368     x_default_address_type              IN     VARCHAR2,
369     x_wif_major_unit_set_cat            IN     VARCHAR2,
370     x_wif_minor_unit_set_cat            IN     VARCHAR2,
371     x_wif_track_unit_set_cat            IN     VARCHAR2,
372     x_wif_unit_set_title                IN     VARCHAR2,
373     x_third_party_options               IN     VARCHAR2,
374 --    x_advisor_relationship_ind          IN     VARCHAR2,
375     x_display_container_ind             IN     VARCHAR2,
376     x_container_title                   IN     VARCHAR2,
377     x_link_text                         IN     VARCHAR2,
378     x_link_url                          IN     VARCHAR2,
379     x_mode                              IN     VARCHAR2
380   ) AS
381   /*
382   ||  Created By : [email protected]
383   ||  Created On : 19-MAR-2003
384   ||  Purpose : Handles the INSERT DML logic for the table.
385   ||  Known limitations, enhancements or remarks :
386   ||  Change History :
387   ||  Who             When            What
388   ||  (reverse chronological order - newest change first)
389   */
390 
391     x_last_update_date           DATE;
392     x_last_updated_by            NUMBER;
393     x_last_update_login          NUMBER;
394 
395   BEGIN
396 
400       x_last_update_login := 0;
397     x_last_update_date := SYSDATE;
398     IF (x_mode = 'I') THEN
399       x_last_updated_by := 1;
401     ELSIF (x_mode = 'R') THEN
402       x_last_updated_by := fnd_global.user_id;
403       IF (x_last_updated_by IS NULL) THEN
404         x_last_updated_by := -1;
405       END IF;
406       x_last_update_login := fnd_global.login_id;
407       IF (x_last_update_login IS NULL) THEN
408         x_last_update_login := -1;
409       END IF;
410     ELSE
411       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
412       fnd_message.set_token ('ROUTINE', 'IGS_DA_SETUP_PKG.INSERT_ROW');
413       igs_ge_msg_stack.add;
414       app_exception.raise_exception;
415     END IF;
416 
417     before_dml(
418       p_action                            => 'INSERT',
419       x_rowid                             => x_rowid,
420       x_s_control_num                     => x_s_control_num,
421       x_program_definition_ind            => x_program_definition_ind,
422       x_default_student_id_type           => x_default_student_id_type,
423       x_default_inst_id_type                   => x_default_inst_id_type,
424       x_default_address_type              => x_default_address_type,
425       x_wif_major_unit_set_cat            => x_wif_major_unit_set_cat,
426       x_wif_minor_unit_set_cat            => x_wif_minor_unit_set_cat,
427       x_wif_track_unit_set_cat            => x_wif_track_unit_set_cat,
428       x_wif_unit_set_title                => x_wif_unit_set_title,
429       x_third_party_options               => x_third_party_options,
430 --      x_advisor_relationship_ind          => x_advisor_relationship_ind,
431       x_display_container_ind             => x_display_container_ind,
432       x_container_title                   => x_container_title,
433       x_link_text                         => x_link_text,
434       x_link_url                          => x_link_url,
435       x_creation_date                     => x_last_update_date,
436       x_created_by                        => x_last_updated_by,
437       x_last_update_date                  => x_last_update_date,
438       x_last_updated_by                   => x_last_updated_by,
439       x_last_update_login                 => x_last_update_login
440     );
441 
442     INSERT INTO igs_da_setup (
443       s_control_num,
444       program_definition_ind,
445       default_student_id_type,
446       default_inst_id_type,
447       default_address_type,
448       wif_major_unit_set_cat,
449       wif_minor_unit_set_cat,
450       wif_track_unit_set_cat,
451       wif_unit_set_title,
452       third_party_options,
453 --      advisor_relationship_ind,
454       display_container_ind,
455       container_title,
456       link_text,
457       link_url,
458       creation_date,
459       created_by,
460       last_update_date,
461       last_updated_by,
462       last_update_login
463     ) VALUES (
464       new_references.s_control_num,
465       new_references.program_definition_ind,
466       new_references.default_student_id_type,
467       new_references.default_inst_id_type,
468       new_references.default_address_type,
469       new_references.wif_major_unit_set_cat,
470       new_references.wif_minor_unit_set_cat,
471       new_references.wif_track_unit_set_cat,
472       new_references.wif_unit_set_title,
473       new_references.third_party_options,
474 --      new_references.advisor_relationship_ind,
475       new_references.display_container_ind,
476       new_references.container_title,
477       new_references.link_text,
478       new_references.link_url,
479       x_last_update_date,
480       x_last_updated_by,
481       x_last_update_date,
482       x_last_updated_by,
483       x_last_update_login
484     ) RETURNING ROWID INTO x_rowid;
485 
486   END insert_row;
487 
488 
489   PROCEDURE lock_row (
490     x_rowid                             IN     VARCHAR2,
491     x_s_control_num                     IN     NUMBER,
492     x_program_definition_ind            IN     VARCHAR2,
493     x_default_student_id_type           IN     VARCHAR2,
494     x_default_inst_id_type                   IN     VARCHAR2,
495     x_default_address_type              IN     VARCHAR2,
496     x_wif_major_unit_set_cat            IN     VARCHAR2,
497     x_wif_minor_unit_set_cat            IN     VARCHAR2,
498     x_wif_track_unit_set_cat            IN     VARCHAR2,
499     x_wif_unit_set_title                IN     VARCHAR2,
500     x_third_party_options               IN     VARCHAR2,
501 --    x_advisor_relationship_ind          IN     VARCHAR2,
502     x_display_container_ind             IN     VARCHAR2,
503     x_container_title                   IN     VARCHAR2,
504     x_link_text                         IN     VARCHAR2,
505     x_link_url                          IN     VARCHAR2
506   ) AS
507   /*
508   ||  Created By : [email protected]
509   ||  Created On : 19-MAR-2003
510   ||  Purpose : Handles the LOCK mechanism for the table.
511   ||  Known limitations, enhancements or remarks :
512   ||  Change History :
513   ||  Who             When            What
514   ||  (reverse chronological order - newest change first)
515   */
516     CURSOR c1 IS
517       SELECT
518         program_definition_ind,
522         wif_major_unit_set_cat,
519         default_student_id_type,
520         default_inst_id_type,
521         default_address_type,
523         wif_minor_unit_set_cat,
524         wif_track_unit_set_cat,
525         wif_unit_set_title,
526         third_party_options,
527 --        advisor_relationship_ind,
528         display_container_ind,
529         container_title,
530         link_text,
531         link_url
532       FROM  igs_da_setup
533       WHERE rowid = x_rowid
534       FOR UPDATE NOWAIT;
535 
536     tlinfo c1%ROWTYPE;
537 
538   BEGIN
539 
540     OPEN c1;
541     FETCH c1 INTO tlinfo;
542     IF (c1%notfound) THEN
543       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
544       igs_ge_msg_stack.add;
545       CLOSE c1;
546       app_exception.raise_exception;
547       RETURN;
548     END IF;
549     CLOSE c1;
550 
551     IF (
552         (tlinfo.program_definition_ind = x_program_definition_ind)
553         AND ((tlinfo.default_student_id_type = x_default_student_id_type) OR ((tlinfo.default_student_id_type IS NULL) AND (X_default_student_id_type IS NULL)))
554         AND ((tlinfo.default_inst_id_type = x_default_inst_id_type) OR ((tlinfo.default_inst_id_type IS NULL) AND (X_default_inst_id_type IS NULL)))
555         AND (tlinfo.default_address_type = x_default_address_type)
556         AND (tlinfo.wif_major_unit_set_cat = x_wif_major_unit_set_cat)
557         AND (tlinfo.wif_minor_unit_set_cat = x_wif_minor_unit_set_cat)
558         AND (tlinfo.wif_track_unit_set_cat = x_wif_track_unit_set_cat)
559         AND (tlinfo.wif_unit_set_title = x_wif_unit_set_title)
560         AND (tlinfo.third_party_options = x_third_party_options)
561 --        AND (tlinfo.advisor_relationship_ind = x_advisor_relationship_ind)
562         AND (tlinfo.display_container_ind = x_display_container_ind)
563         AND ((tlinfo.container_title = x_container_title) OR ((tlinfo.container_title IS NULL) AND (X_container_title IS NULL)))
564         AND ((tlinfo.link_text = x_link_text) OR ((tlinfo.link_text IS NULL) AND (X_link_text IS NULL)))
565         AND ((tlinfo.link_url = x_link_url) OR ((tlinfo.link_url IS NULL) AND (X_link_url IS NULL)))
566        ) THEN
567       NULL;
568     ELSE
569       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
570       igs_ge_msg_stack.add;
571       app_exception.raise_exception;
572     END IF;
573 
574     RETURN;
575 
576   END lock_row;
577 
578 
579   PROCEDURE update_row (
580     x_rowid                             IN     VARCHAR2,
581     x_s_control_num                     IN     NUMBER,
582     x_program_definition_ind            IN     VARCHAR2,
583     x_default_student_id_type           IN     VARCHAR2,
584     x_default_inst_id_type                   IN     VARCHAR2,
585     x_default_address_type              IN     VARCHAR2,
586     x_wif_major_unit_set_cat            IN     VARCHAR2,
587     x_wif_minor_unit_set_cat            IN     VARCHAR2,
588     x_wif_track_unit_set_cat            IN     VARCHAR2,
589     x_wif_unit_set_title                IN     VARCHAR2,
590     x_third_party_options               IN     VARCHAR2,
591 --    x_advisor_relationship_ind          IN     VARCHAR2,
592     x_display_container_ind             IN     VARCHAR2,
593     x_container_title                   IN     VARCHAR2,
594     x_link_text                         IN     VARCHAR2,
595     x_link_url                          IN     VARCHAR2,
596     x_mode                              IN     VARCHAR2
597   ) AS
598   /*
599   ||  Created By : [email protected]
600   ||  Created On : 19-MAR-2003
601   ||  Purpose : Handles the UPDATE DML logic for the table.
602   ||  Known limitations, enhancements or remarks :
603   ||  Change History :
604   ||  Who             When            What
605   ||  (reverse chronological order - newest change first)
606   */
607     x_last_update_date           DATE ;
608     x_last_updated_by            NUMBER;
609     x_last_update_login          NUMBER;
610 
611   BEGIN
612 
613     x_last_update_date := SYSDATE;
614     IF (X_MODE = 'I') THEN
615       x_last_updated_by := 1;
616       x_last_update_login := 0;
617     ELSIF (x_mode = 'R') THEN
618       x_last_updated_by := fnd_global.user_id;
619       IF x_last_updated_by IS NULL THEN
620         x_last_updated_by := -1;
621       END IF;
622       x_last_update_login := fnd_global.login_id;
623       IF (x_last_update_login IS NULL) THEN
624         x_last_update_login := -1;
625       END IF;
626     ELSE
627       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
628       fnd_message.set_token ('ROUTINE', 'IGS_DA_SETUP_PKG.UPDATE_ROW');
629       igs_ge_msg_stack.add;
630       app_exception.raise_exception;
631     END IF;
632 
633     before_dml(
634       p_action                            => 'UPDATE',
635       x_rowid                             => x_rowid,
636       x_s_control_num                     => x_s_control_num,
637       x_program_definition_ind            => x_program_definition_ind,
638       x_default_student_id_type           => x_default_student_id_type,
639       x_default_inst_id_type                   => x_default_inst_id_type,
640       x_default_address_type              => x_default_address_type,
641       x_wif_major_unit_set_cat            => x_wif_major_unit_set_cat,
645       x_third_party_options               => x_third_party_options,
642       x_wif_minor_unit_set_cat            => x_wif_minor_unit_set_cat,
643       x_wif_track_unit_set_cat            => x_wif_track_unit_set_cat,
644       x_wif_unit_set_title                => x_wif_unit_set_title,
646 --      x_advisor_relationship_ind          => x_advisor_relationship_ind,
647       x_display_container_ind             => x_display_container_ind,
648       x_container_title                   => x_container_title,
649       x_link_text                         => x_link_text,
650       x_link_url                          => x_link_url,
651       x_creation_date                     => x_last_update_date,
652       x_created_by                        => x_last_updated_by,
653       x_last_update_date                  => x_last_update_date,
654       x_last_updated_by                   => x_last_updated_by,
655       x_last_update_login                 => x_last_update_login
656     );
657 
658     UPDATE igs_da_setup
659       SET
660         program_definition_ind            = new_references.program_definition_ind,
661         default_student_id_type           = new_references.default_student_id_type,
662         default_inst_id_type                   = new_references.default_inst_id_type,
663         default_address_type              = new_references.default_address_type,
664         wif_major_unit_set_cat            = new_references.wif_major_unit_set_cat,
665         wif_minor_unit_set_cat            = new_references.wif_minor_unit_set_cat,
666         wif_track_unit_set_cat            = new_references.wif_track_unit_set_cat,
667         wif_unit_set_title                = new_references.wif_unit_set_title,
668         third_party_options               = new_references.third_party_options,
669 --        advisor_relationship_ind          = new_references.advisor_relationship_ind,
670         display_container_ind             = new_references.display_container_ind,
671         container_title                   = new_references.container_title,
672         link_text                         = new_references.link_text,
673         link_url                          = new_references.link_url,
674         last_update_date                  = x_last_update_date,
675         last_updated_by                   = x_last_updated_by,
676         last_update_login                 = x_last_update_login
677       WHERE rowid = x_rowid;
678 
679     IF (SQL%NOTFOUND) THEN
680       RAISE NO_DATA_FOUND;
681     END IF;
682 
683   END update_row;
684 
685 
686   PROCEDURE add_row (
687     x_rowid                             IN OUT NOCOPY VARCHAR2,
688     x_s_control_num                     IN     NUMBER,
689     x_program_definition_ind            IN     VARCHAR2,
690     x_default_student_id_type           IN     VARCHAR2,
691     x_default_inst_id_type                   IN     VARCHAR2,
692     x_default_address_type              IN     VARCHAR2,
693     x_wif_major_unit_set_cat            IN     VARCHAR2,
694     x_wif_minor_unit_set_cat            IN     VARCHAR2,
695     x_wif_track_unit_set_cat            IN     VARCHAR2,
696     x_wif_unit_set_title                IN     VARCHAR2,
697     x_third_party_options               IN     VARCHAR2,
698 --    x_advisor_relationship_ind          IN     VARCHAR2,
699     x_display_container_ind             IN     VARCHAR2,
700     x_container_title                   IN     VARCHAR2,
701     x_link_text                         IN     VARCHAR2,
702     x_link_url                          IN     VARCHAR2,
703     x_mode                              IN     VARCHAR2
704   ) AS
705   /*
706   ||  Created By : [email protected]
707   ||  Created On : 19-MAR-2003
708   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
709   ||  Known limitations, enhancements or remarks :
710   ||  Change History :
711   ||  Who             When            What
712   ||  (reverse chronological order - newest change first)
713   */
714     CURSOR c1 IS
715       SELECT   rowid
716       FROM     igs_da_setup
717       WHERE    s_control_num = x_s_control_num;
718 
719   BEGIN
720 
721     OPEN c1;
722     FETCH c1 INTO x_rowid;
723     IF (c1%NOTFOUND) THEN
724       CLOSE c1;
725 
726       insert_row (
727         x_rowid,
728         x_s_control_num,
729         x_program_definition_ind,
730         x_default_student_id_type,
731         x_default_inst_id_type,
732         x_default_address_type,
733         x_wif_major_unit_set_cat,
734         x_wif_minor_unit_set_cat,
735         x_wif_track_unit_set_cat,
736         x_wif_unit_set_title,
737         x_third_party_options,
738 --        x_advisor_relationship_ind,
739         x_display_container_ind,
740         x_container_title,
741         x_link_text,
742         x_link_url,
743         x_mode
744       );
745       RETURN;
746     END IF;
747     CLOSE c1;
748 
749     update_row (
750       x_rowid,
751       x_s_control_num,
752       x_program_definition_ind,
753       x_default_student_id_type,
754       x_default_inst_id_type,
755       x_default_address_type,
756       x_wif_major_unit_set_cat,
757       x_wif_minor_unit_set_cat,
758       x_wif_track_unit_set_cat,
759       x_wif_unit_set_title,
760       x_third_party_options,
761 --      x_advisor_relationship_ind,
762       x_display_container_ind,
763       x_container_title,
764       x_link_text,
765       x_link_url,
766       x_mode
767     );
768 
769   END add_row;
770 
771 
772   PROCEDURE delete_row (
773     x_rowid IN VARCHAR2
774   ) AS
775   /*
776   ||  Created By : [email protected]
777   ||  Created On : 19-MAR-2003
778   ||  Purpose : Handles the DELETE DML logic for the table.
779   ||  Known limitations, enhancements or remarks :
780   ||  Change History :
781   ||  Who             When            What
782   ||  (reverse chronological order - newest change first)
783   */
784   BEGIN
785 
786     before_dml (
787       p_action => 'DELETE',
788       x_rowid => x_rowid
789     );
790 
791     DELETE FROM igs_da_setup
792     WHERE rowid = x_rowid;
793 
794     IF (SQL%NOTFOUND) THEN
795       RAISE NO_DATA_FOUND;
796     END IF;
797 
798   END delete_row;
799 
800 
801 END igs_da_setup_pkg;