[Home] [Help]
PACKAGE BODY: APPS.OE_LINE_SCREDIT_SECURITY
Source
1 PACKAGE BODY OE_Line_Scredit_Security AS
2 /* $Header: OEXXLSCB.pls 115.23 2004/06/22 18:35:23 jvicenti ship $ */
3
4
5 -- Global constant holding the package name
6
7 G_PKG_NAME CONSTANT VARCHAR2(30) := 'OE_Line_Scredit_Security';
8
9 -- LOCAL PROCEDURES
10
11 FUNCTION Is_Op_Constrained
12 ( p_operation IN VARCHAR2
13 , p_column_name IN VARCHAR2 DEFAULT NULL
14 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
15 , x_on_operation_action OUT NOCOPY NUMBER
16
17 ) RETURN NUMBER IS
18 l_constraint_id NUMBER;
19 l_grp NUMBER;
20 l_result NUMBER;
21 l_constrained_column VARCHAR2(30);
22 l_audit_trail_enabled VARCHAR2(1) := OE_SYS_PARAMETERS.VALUE('AUDIT_TRAIL_ENABLE_FLAG');
23 l_code_level varchar2(6) := OE_CODE_CONTROL.GET_CODE_RELEASE_LEVEL;
24 l_order_booked_flag VARCHAR2(1);
25
26 CURSOR IS_ORDER_BOOKED(x_header_id NUMBER) IS
27 SELECT NVL(BOOKED_FLAG,'N')
28 FROM OE_ORDER_HEADERS_ALL
29 WHERE HEADER_ID = x_header_id;
30
31 l_transaction_phase_code VARCHAR2(30);
32 --
33 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
34 --
35 BEGIN
36
37 IF l_code_level >= '110510' THEN
38 OE_Order_Cache.Load_Order_Header(p_record.header_id);
39 l_transaction_phase_code := oe_order_cache.g_header_rec.transaction_phase_code;
40 END IF;
41
42 l_result := OE_PC_Constraints_Admin_PVT.Is_OP_constrained
43 ( p_responsibility_id => nvl(fnd_global.resp_id, -1)
44 , p_application_id => nvl(fnd_global.resp_appl_id,-1) --added for bug3631547
45 , p_operation => p_operation
46 , p_qualifier_attribute => l_transaction_phase_code
47 , p_entity_id => OE_PC_GLOBALS.G_ENTITY_LINE_SCREDIT
48 , p_column_name => p_column_name
49 , p_check_all_cols_constraint => g_check_all_cols_constraint
50 , p_is_caller_defaulting => g_is_caller_defaulting
51 , x_constraint_id => l_constraint_id
52 , x_constraining_conditions_grp => l_grp
53 , x_on_operation_action => x_on_operation_action
54 );
55
56 if l_result = OE_PC_GLOBALS.YES then
57
58 IF g_check_all_cols_constraint = 'Y'
59 AND (p_operation = OE_PC_GLOBALS.UPDATE_OP
60 OR p_operation = OE_PC_GLOBALS.CREATE_OP)
61 AND x_on_operation_action = 0
62 AND p_column_name IS NOT NULL THEN
63 SELECT column_name
64 INTO l_constrained_column
65 FROM oe_pc_constraints
66 WHERE constraint_id = l_constraint_id;
67 if l_constrained_column is null then
68 oe_debug_pub.add('There is an UPDATE constraint on all columns - Error',1);
69 RAISE FND_API.G_EXC_ERROR;
70 end if;
71 END IF;
72
73 elsif l_result = OE_PC_GLOBALS.ERROR then
74
75 raise FND_API.G_EXC_UNEXPECTED_ERROR;
76
77 end if;
78
79 g_check_all_cols_constraint := 'N';
80
81 /* Start Versioning */
82 IF l_code_level >= '110510' AND
83 ( p_column_name = 'TRANSACTION_PHASE_CODE' OR
84 x_on_operation_action IN (.1,.2))THEN
85 OE_Versioning_Util.Check_Security(p_column_name => p_column_name,
86 p_on_operation_action => x_on_operation_action);
87 END IF;
88 /* End Versioning */
89
90 /* Start AuditTrail */
91 -- Code level should be OM-H and
92 -- Audit Trail Not Disabled
93 IF g_is_caller_defaulting = 'N' THEN
94 IF l_code_level >= '110508' and nvl(l_audit_trail_enabled,'D') <> 'D' and
95 nvl(l_transaction_phase_code,'F') = 'F' and
96 not OE_GLOBALS.G_HEADER_CREATED THEN
97 IF l_audit_trail_enabled = 'B' THEN -- capture only for booked orders
98 OPEN IS_ORDER_BOOKED (p_record.header_id);
99 FETCH IS_ORDER_BOOKED INTO l_order_booked_flag;
100 CLOSE IS_ORDER_BOOKED;
101 IF l_order_booked_flag = 'Y' THEN
102 IF l_result = OE_PC_GLOBALS.YES THEN
103 IF x_on_operation_action = 1 THEN
104 -- set OUT result to NOT CONSTRAINED
105 IF l_debug_level > 0 THEN
106 oe_debug_pub.add( 'LINE SALES CREDIT SECURITY , ATTRIBUTE CHANGE REQUIRES REASON' , 1 ) ;
107 END IF;
108 OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG := 'Y';
109 OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'N';
110 ELSIF x_on_operation_action = 2 THEN
111 -- set OUT result to NOT CONSTRAINED
112 IF OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG <> 'Y' then
113 IF l_debug_level > 0 THEN
114 oe_debug_pub.add( 'LINE SALES CREDIT SECURITY , ATTRIBUTE CHANGE REQUIRES HISTORY' , 1 ) ;
115 END IF;
116 OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'Y';
117 END IF;
118 END IF;
119 END IF;
120 END IF;
121 ELSE -- capture audit trail for all orders
122 IF l_result = OE_PC_GLOBALS.YES THEN
123 IF x_on_operation_action = 1 THEN
124 -- set OUT result to NOT CONSTRAINED
125 IF l_debug_level > 0 THEN
126 oe_debug_pub.add( 'LINE SALES CREDIT SECURITY , ATTRIBUTE CHANGE REQUIRES REASON' , 1 ) ;
127 END IF;
128 OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG := 'Y';
129 OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'N';
130 ELSIF x_on_operation_action = 2 THEN
131 -- set OUT result to NOT CONSTRAINED
132 IF OE_GLOBALS.G_AUDIT_REASON_RQD_FLAG <> 'Y' then
133 IF l_debug_level > 0 THEN
134 oe_debug_pub.add( 'LINE SALES CREDIT SECURITY , ATTRIBUTE CHANGE REQUIRES HISTORY' , 1 ) ;
135 END IF;
136 OE_GLOBALS.G_AUDIT_HISTORY_RQD_FLAG := 'Y';
137 END IF;
138 END IF;
139 END IF;
140 END IF;
141 END IF;
142 END IF;
143 /* End AuditTrail */
144
145 IF x_on_operation_action > 0 THEN
146 l_result := OE_PC_GLOBALS.NO;
147 END IF;
148
149 RETURN l_result;
150
151 END Is_Op_Constrained;
152
153
154 -- PUBLIC PROCEDURES
155
156 -- Start of fix #1459428 for function definition
157
158 FUNCTION ATTRIBUTE1
159 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
160 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
161 , x_on_operation_action OUT NOCOPY NUMBER
162
163 ) RETURN NUMBER
164 IS
165 l_result NUMBER;
166 --
167 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
168 --
169 BEGIN
170
171 l_result := Is_OP_constrained
172 (p_operation => p_operation
173 ,p_column_name => 'ATTRIBUTE1'
174 ,p_record => p_record
175 ,x_on_operation_action => x_on_operation_action
176 );
177
178 RETURN(l_result);
179
180 END ATTRIBUTE1;
181
182
183 FUNCTION ATTRIBUTE10
184 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
185 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
186 , x_on_operation_action OUT NOCOPY NUMBER
187
188 ) RETURN NUMBER
189 IS
190 l_result NUMBER;
191 --
192 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
193 --
194 BEGIN
195
196 l_result := Is_OP_constrained
197 (p_operation => p_operation
198 ,p_column_name => 'ATTRIBUTE10'
199 ,p_record => p_record
200 ,x_on_operation_action => x_on_operation_action
201 );
202
203 RETURN(l_result);
204
205 END ATTRIBUTE10;
206
207 FUNCTION ATTRIBUTE11
208 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
209 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
210 , x_on_operation_action OUT NOCOPY NUMBER
211
212 ) RETURN NUMBER
213 IS
214 l_result NUMBER;
215 --
216 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
217 --
218 BEGIN
219
220 l_result := Is_OP_constrained
221 (p_operation => p_operation
222 ,p_column_name => 'ATTRIBUTE11'
223 ,p_record => p_record
224 ,x_on_operation_action => x_on_operation_action
225 );
226
227 RETURN(l_result);
228
229 END ATTRIBUTE11;
230
231
232 FUNCTION ATTRIBUTE12
233 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
234 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
235 , x_on_operation_action OUT NOCOPY NUMBER
236
237 ) RETURN NUMBER
238 IS
239 l_result NUMBER;
240 --
241 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
242 --
243 BEGIN
244
245 l_result := Is_OP_constrained
246 (p_operation => p_operation
247 ,p_column_name => 'ATTRIBUTE12'
248 ,p_record => p_record
249 ,x_on_operation_action => x_on_operation_action
250 );
251
252 RETURN(l_result);
253
254 END ATTRIBUTE12;
255
256
257 FUNCTION ATTRIBUTE13
258 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
259 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
260 , x_on_operation_action OUT NOCOPY NUMBER
261
262 ) RETURN NUMBER
263 IS
264 l_result NUMBER;
265 --
266 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
267 --
268 BEGIN
269
270 l_result := Is_OP_constrained
271 (p_operation => p_operation
272 ,p_column_name => 'ATTRIBUTE13'
273 ,p_record => p_record
274 ,x_on_operation_action => x_on_operation_action
275 );
276
277 RETURN(l_result);
278
279 END ATTRIBUTE13;
280
281
282 FUNCTION ATTRIBUTE14
283 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
284 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
285 , x_on_operation_action OUT NOCOPY NUMBER
286
287 ) RETURN NUMBER
288 IS
289 l_result NUMBER;
290 --
291 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
292 --
293 BEGIN
294
295 l_result := Is_OP_constrained
296 (p_operation => p_operation
297 ,p_column_name => 'ATTRIBUTE14'
298 ,p_record => p_record
299 ,x_on_operation_action => x_on_operation_action
300 );
301
302 RETURN(l_result);
303
304 END ATTRIBUTE14;
305
306
307 FUNCTION ATTRIBUTE15
308 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
309 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
310 , x_on_operation_action OUT NOCOPY NUMBER
311
312 ) RETURN NUMBER
313 IS
314 l_result NUMBER;
315 --
316 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
317 --
318 BEGIN
319
320 l_result := Is_OP_constrained
321 (p_operation => p_operation
322 ,p_column_name => 'ATTRIBUTE15'
323 ,p_record => p_record
324 ,x_on_operation_action => x_on_operation_action
325 );
326
327 RETURN(l_result);
328
329 END ATTRIBUTE15;
330
331
332 FUNCTION ATTRIBUTE2
333 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
334 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
335 , x_on_operation_action OUT NOCOPY NUMBER
336
337 ) RETURN NUMBER
338 IS
339 l_result NUMBER;
340 --
341 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
342 --
343 BEGIN
344
345 l_result := Is_OP_constrained
346 (p_operation => p_operation
347 ,p_column_name => 'ATTRIBUTE2'
348 ,p_record => p_record
349 ,x_on_operation_action => x_on_operation_action
350 );
351
352 RETURN(l_result);
353
354 END ATTRIBUTE2;
355
356
357 FUNCTION ATTRIBUTE3
358 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
359 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
360 , x_on_operation_action OUT NOCOPY NUMBER
361
362 ) RETURN NUMBER
363 IS
364 l_result NUMBER;
365 --
366 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
367 --
368 BEGIN
369
370 l_result := Is_OP_constrained
371 (p_operation => p_operation
372 ,p_column_name => 'ATTRIBUTE3'
373 ,p_record => p_record
374 ,x_on_operation_action => x_on_operation_action
375 );
376
377 RETURN(l_result);
378
379 END ATTRIBUTE3;
380
381
382 FUNCTION ATTRIBUTE4
383 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
384 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
385 , x_on_operation_action OUT NOCOPY NUMBER
386
387 ) RETURN NUMBER
388 IS
389 l_result NUMBER;
390 --
391 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
392 --
393 BEGIN
394
395 l_result := Is_OP_constrained
396 (p_operation => p_operation
397 ,p_column_name => 'ATTRIBUTE4'
398 ,p_record => p_record
399 ,x_on_operation_action => x_on_operation_action
400 );
401
402 RETURN(l_result);
403
404 END ATTRIBUTE4;
405
406
407 FUNCTION ATTRIBUTE5
408 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
409 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
410 , x_on_operation_action OUT NOCOPY NUMBER
411
412 ) RETURN NUMBER
413 IS
414 l_result NUMBER;
415 --
416 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
417 --
418 BEGIN
419
420 l_result := Is_OP_constrained
421 (p_operation => p_operation
422 ,p_column_name => 'ATTRIBUTE5'
423 ,p_record => p_record
424 ,x_on_operation_action => x_on_operation_action
425 );
426
427 RETURN(l_result);
428
429 END ATTRIBUTE5;
430
431
432 FUNCTION ATTRIBUTE6
433 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
434 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
435 , x_on_operation_action OUT NOCOPY NUMBER
436
437 ) RETURN NUMBER
438 IS
439 l_result NUMBER;
440 --
441 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
442 --
443 BEGIN
444
445 l_result := Is_OP_constrained
446 (p_operation => p_operation
447 ,p_column_name => 'ATTRIBUTE6'
448 ,p_record => p_record
449 ,x_on_operation_action => x_on_operation_action
450
451 );
452
453 RETURN(l_result);
454
455 END ATTRIBUTE6;
456
457
458 FUNCTION ATTRIBUTE7
459 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
460 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
461 , x_on_operation_action OUT NOCOPY NUMBER
462
463 ) RETURN NUMBER
464 IS
465 l_result NUMBER;
466 --
467 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
468 --
469 BEGIN
470
471 l_result := Is_OP_constrained
472 (p_operation => p_operation
473 ,p_column_name => 'ATTRIBUTE7'
474 ,p_record => p_record
475 ,x_on_operation_action => x_on_operation_action
476 );
477
478 RETURN(l_result);
479
480 END ATTRIBUTE7;
481
482
483 FUNCTION ATTRIBUTE8
484 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
485 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
486 , x_on_operation_action OUT NOCOPY NUMBER
487
488 ) RETURN NUMBER
489 IS
490 l_result NUMBER;
491 --
492 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
493 --
494 BEGIN
495
496 l_result := Is_OP_constrained
497 (p_operation => p_operation
498 ,p_column_name => 'ATTRIBUTE8'
499 ,p_record => p_record
500 ,x_on_operation_action => x_on_operation_action
501 );
502
503 RETURN(l_result);
504
505 END ATTRIBUTE8;
506
507
508 FUNCTION ATTRIBUTE9
509 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
510 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
511 , x_on_operation_action OUT NOCOPY NUMBER
512
513 ) RETURN NUMBER
514 IS
515 l_result NUMBER;
516 --
517 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
518 --
519 BEGIN
520
521 l_result := Is_OP_constrained
522 (p_operation => p_operation
523 ,p_column_name => 'ATTRIBUTE9'
524 ,p_record => p_record
525 ,x_on_operation_action => x_on_operation_action
526 );
527
528 RETURN(l_result);
529
530 END ATTRIBUTE9;
531 FUNCTION CONTEXT
532 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
533 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
534 , x_on_operation_action OUT NOCOPY NUMBER
535
536 ) RETURN NUMBER
537 IS
538 l_result NUMBER;
539 --
540 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
541 --
542 BEGIN
543
544 l_result := Is_OP_constrained
545 (p_operation => p_operation
546 ,p_column_name => 'CONTEXT'
547 ,p_record => p_record
548 ,x_on_operation_action => x_on_operation_action
549 );
550
551 RETURN(l_result);
552
553 END CONTEXT;
554
555 -- End of fix #1459428 for function definition
556
557 FUNCTION CREATED_BY
558 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
559 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
560 , x_on_operation_action OUT NOCOPY NUMBER
561
562 ) RETURN NUMBER
563 IS
564 l_result NUMBER;
565 --
566 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
567 --
568 BEGIN
569
570 l_result := Is_OP_constrained
571 (p_operation => p_operation
572 ,p_column_name => 'CREATED_BY'
573 ,p_record => p_record
574 ,x_on_operation_action => x_on_operation_action
575 );
576
577 RETURN(l_result);
578
579 END CREATED_BY;
580
581
582 FUNCTION DW_UPDATE_ADVICE
583 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
584 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
585 , x_on_operation_action OUT NOCOPY NUMBER
586
587 ) RETURN NUMBER
588 IS
589 l_result NUMBER;
590 --
591 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
592 --
593 BEGIN
594
595 l_result := Is_OP_constrained
596 (p_operation => p_operation
597 ,p_column_name => 'DW_UPDATE_ADVICE_FLAG'
598 ,p_record => p_record
599 ,x_on_operation_action => x_on_operation_action
600 );
601
602 RETURN(l_result);
603
604 END DW_UPDATE_ADVICE;
605
606
607 FUNCTION PERCENT
608 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
609 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
610 , x_on_operation_action OUT NOCOPY NUMBER
611
612 ) RETURN NUMBER
613 IS
614 l_result NUMBER;
615 --
616 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
617 --
618 BEGIN
619
620 l_result := Is_OP_constrained
621 (p_operation => p_operation
622 ,p_column_name => 'PERCENT'
623 ,p_record => p_record
624 ,x_on_operation_action => x_on_operation_action
625 );
626
627 RETURN(l_result);
628
629 END PERCENT;
630
631
632
633 FUNCTION Sales_Credit_Type
634 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
635 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
636 , x_on_operation_action OUT NOCOPY NUMBER
637
638 ) RETURN NUMBER
639 IS
640 l_result NUMBER;
641 --
642 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
643 --
644 BEGIN
645
646 l_result := Is_OP_constrained
647 (p_operation => p_operation
648 ,p_column_name => 'SALES_CREDIT_TYPE_ID'
649 ,p_record => p_record
650 ,x_on_operation_action => x_on_operation_action
651 );
652
653 RETURN(l_result);
654
655 END Sales_Credit_Type;
656
657
658 FUNCTION SALESREP
659 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
660 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
661 , x_on_operation_action OUT NOCOPY NUMBER
662
663 ) RETURN NUMBER
664 IS
665 l_result NUMBER;
666 --
667 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
668 --
669 BEGIN
670
671 l_result := Is_OP_constrained
672 (p_operation => p_operation
673 ,p_column_name => 'SALESREP_ID'
674 ,p_record => p_record
675 ,x_on_operation_action => x_on_operation_action
676 );
677
678 RETURN(l_result);
679
680 END SALESREP;
681
682
683 FUNCTION WH_UPDATE_DATE
684 ( p_operation IN VARCHAR2 DEFAULT OE_PC_GLOBALS.UPDATE_OP
685 , p_record IN OE_AK_LINE_SCREDITS_V%ROWTYPE
686 , x_on_operation_action OUT NOCOPY NUMBER
687
688 ) RETURN NUMBER
689 IS
690 l_result NUMBER;
691 --
692 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
693 --
694 BEGIN
695
696 l_result := Is_OP_constrained
697 (p_operation => p_operation
698 ,p_column_name => 'WH_UPDATE_DATE'
699 ,p_record => p_record
700 ,x_on_operation_action => x_on_operation_action
701 );
702
703 RETURN(l_result);
704
705 END WH_UPDATE_DATE;
706
707
708 PROCEDURE Entity
709 ( p_LINE_SCREDIT_rec IN OE_Order_PUB.LINE_SCREDIT_Rec_Type
710 , x_result OUT NOCOPY NUMBER
711
712 , x_return_status OUT NOCOPY VARCHAR2
713
714 ) IS
715 l_operation VARCHAR2(1);
716 l_on_operation_action NUMBER;
717 l_rowtype_rec OE_AK_LINE_SCREDITS_V%ROWTYPE;
718 --
719 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
720 --
721 BEGIN
722
723 IF l_debug_level > 0 THEN
724 oe_debug_pub.add( 'ENTER OE_LINE_SCREDIT_SECURITY.ENTITY' , 1 ) ;
725 END IF;
726
727 -- Initializing return status to SUCCESS
728 x_return_status := FND_API.G_RET_STS_SUCCESS;
729
730 IF p_LINE_SCREDIT_rec.operation = OE_GLOBALS.G_OPR_CREATE THEN
731 l_operation := OE_PC_GLOBALS.CREATE_OP;
732 ELSIF p_LINE_SCREDIT_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
733 l_operation := OE_PC_GLOBALS.UPDATE_OP;
734 ELSIF p_LINE_SCREDIT_rec.operation = OE_GLOBALS.G_OPR_DELETE THEN
735 l_operation := OE_PC_GLOBALS.DELETE_OP;
736 ELSE
737 IF l_debug_level > 0 THEN
738 oe_debug_pub.add( 'INVALID OPERATION' , 1 ) ;
739 END IF;
740 RAISE FND_API.G_EXC_ERROR;
741 END IF;
742
743 OE_Line_Scredit_Util.API_Rec_To_Rowtype_Rec
744 (p_LINE_SCREDIT_rec
745 ,l_rowtype_rec);
746
747 --Initialize security global record
748 OE_LINE_SCREDIT_SECURITY.g_record := l_rowtype_rec;
749
750 x_result := Is_OP_constrained
751 (p_operation => l_operation
752 ,p_record => l_rowtype_rec
753 ,x_on_operation_action => l_on_operation_action
754 );
755
756 IF l_debug_level > 0 THEN
757 oe_debug_pub.add( 'EXIT OE_LINE_SCREDIT_SECURITY.ENTITY' , 1 ) ;
758 END IF;
759
760 EXCEPTION
761 WHEN OTHERS THEN
762 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
763 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
764 OE_MSG_PUB.Add_Exc_Msg
765 ( G_PKG_NAME
766 , 'Entity'
767 );
768 END IF;
769
770 END Entity;
771
772
773 PROCEDURE Attributes
774 ( p_LINE_SCREDIT_rec IN OE_Order_PUB.LINE_SCREDIT_Rec_Type
775 , p_old_LINE_SCREDIT_rec IN OE_Order_PUB.LINE_SCREDIT_Rec_Type := OE_Order_PUB.G_MISS_LINE_SCREDIT_REC
776 , x_result OUT NOCOPY NUMBER
777
778 , x_return_status OUT NOCOPY VARCHAR2
779
780 ) IS
781 l_operation VARCHAR2(1);
782 l_on_operation_action NUMBER;
783 l_result NUMBER;
784 l_rowtype_rec OE_AK_LINE_SCREDITS_V%ROWTYPE;
785 l_column_name VARCHAR2(30);
786 l_check_all_cols_constraint VARCHAR2(1);
787 --
788 l_debug_level CONSTANT NUMBER := oe_debug_pub.g_debug_level;
789 --
790 BEGIN
791 IF l_debug_level > 0 THEN
792 oe_debug_pub.add( 'ENTER OE_LINE_SCREDIT_SECURITY.ATTRIBUTES' , 1 ) ;
793 END IF;
794
795 -- Initializing return status to SUCCESS
796 x_return_status := FND_API.G_RET_STS_SUCCESS;
797
798 -- Initializing out result to NOT CONSTRAINED
799 x_result := OE_PC_GLOBALS.NO;
800
801 -- Get the operation code to be passed to the security framework API
802 IF p_LINE_SCREDIT_rec.operation = OE_GLOBALS.G_OPR_CREATE THEN
803
804 l_operation := OE_PC_GLOBALS.CREATE_OP;
805
806 -- Bug 1755817: if there are no attribute-specific insert
807 -- constraints, then no need to go further. Entity level
808 -- security check for CREATE will be called again from
809 -- process order after defaulting.
810 IF NOT OE_PC_Constraints_Admin_PVT.Check_On_Insert_Exists
811 (p_entity_id => OE_PC_GLOBALS.G_ENTITY_LINE_SCREDIT
812 ,p_responsibility_id => nvl(fnd_global.resp_id, -1)
813 ,p_application_id => nvl(fnd_global.resp_appl_id,-1) --added for bug3631547
814 )
815 THEN
816 RETURN;
817 END IF;
818
819 ELSIF p_LINE_SCREDIT_rec.operation = OE_GLOBALS.G_OPR_UPDATE THEN
820 l_operation := OE_PC_GLOBALS.UPDATE_OP;
821 ELSE
822 IF l_debug_level > 0 THEN
823 oe_debug_pub.add( 'INVALID OPERATION' , 1 ) ;
824 END IF;
825 RAISE FND_API.G_EXC_ERROR;
826 END IF;
827
828 OE_Line_Scredit_Util.API_Rec_To_Rowtype_Rec
829 (p_LINE_SCREDIT_rec
830 ,l_rowtype_rec);
831
832 --Initialize security global record
833 OE_LINE_SCREDIT_SECURITY.g_record := l_rowtype_rec;
834
835 -- Compare the new and old entity records and
836 -- check constraints for all the changed attributes.
837
838
839 IF p_line_scredit_rec.percent = FND_API.G_MISS_NUM THEN NULL;
840 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.percent,p_old_line_scredit_rec.percent) THEN
841
842 l_result := PERCENT
843 (p_operation => l_operation
844 ,p_record => l_rowtype_rec
845 ,x_on_operation_action => l_on_operation_action
846 );
847
848 IF l_result = OE_PC_GLOBALS.YES THEN
849 -- set OUT result to CONSTRAINED
850 x_result := OE_PC_GLOBALS.YES;
851 END IF;
852
853 END IF;
854
855 IF p_line_scredit_rec.salesrep_id = FND_API.G_MISS_NUM THEN NULL;
856 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.salesrep_id,p_old_line_scredit_rec.salesrep_id) THEN
857
858 l_result := SALESREP
859 (p_operation => l_operation
860 ,p_record => l_rowtype_rec
861 ,x_on_operation_action => l_on_operation_action
862 );
863
864 IF l_result = OE_PC_GLOBALS.YES THEN
865 -- set OUT result to CONSTRAINED
866 x_result := OE_PC_GLOBALS.YES;
867 END IF;
868
869 END IF;
870
871 IF p_line_scredit_rec.dw_update_advice_flag = FND_API.G_MISS_CHAR THEN NULL;
872 ELSIF NOT OE_GLOBALS.Equal(p_line_scredit_rec.dw_update_advice_flag, p_old_line_scredit_rec.dw_update_advice_flag) THEN
873
874 l_result := DW_UPDATE_ADVICE
875 (p_operation => l_operation
876 ,p_record => l_rowtype_rec
877 ,x_on_operation_action => l_on_operation_action
878 );
879 IF l_result = OE_PC_GLOBALS.YES THEN
880 -- set OUT result to CONSTRAINED
881 x_result := OE_PC_GLOBALS.YES;
882 END IF;
883
884 END IF;
885
886 IF p_line_scredit_rec.wh_update_date = FND_API.G_MISS_DATE THEN NULL;
887 ELSIF NOT OE_GLOBALS.Equal(p_line_scredit_rec.wh_update_date, p_old_line_scredit_rec.wh_update_date) THEN
888
889 l_result := WH_UPDATE_DATE
890 (p_operation => l_operation
891 ,p_record => l_rowtype_rec
892 ,x_on_operation_action => l_on_operation_action
893 );
894 IF l_result = OE_PC_GLOBALS.YES THEN
895 -- set OUT result to CONSTRAINED
896 x_result := OE_PC_GLOBALS.YES;
897 END IF;
898
899 END IF;
900
901
902 -- BEGIN: CHECK FOR CONSTRAINTS ON DESC FLEXFIELD ATTRIBUTES
903 -- Bug 2003823:
904 -- If profile indicates that generic update constraints (e.g. seeded
905 -- closed order condition) should not be checked for DFF, then
906 -- set the global to 'N'.
907 -- Also, store the current value of global in a local variable and
908 -- re-set it after DFF check. If DFF were the only fields being
909 -- updated and profile was set to 'N', global at the end should
910 -- be re-set to 'Y' - this indicates to process order that no
911 -- constrainable attributes were updated and thus, it would
912 -- suppress entity level security check also.
913 IF OE_PC_GLOBALS.G_CHECK_UPDATE_ALL_FOR_DFF = 'N' THEN
914 l_check_all_cols_constraint := g_check_all_cols_constraint;
915 g_check_all_cols_constraint := 'N';
916 END IF;
917
918 IF p_line_scredit_rec.context = FND_API.G_MISS_CHAR THEN NULL;
919 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.context,p_old_line_scredit_rec.context) THEN
920
921 l_result := CONTEXT
922 (p_operation => l_operation
923 ,p_record => l_rowtype_rec
924 ,x_on_operation_action => l_on_operation_action
925 );
926
927 IF l_result = OE_PC_GLOBALS.YES THEN
928 -- set OUT result to CONSTRAINED
929 x_result := OE_PC_GLOBALS.YES;
930 END IF;
931
932 END IF;
933
934 IF p_line_scredit_rec.attribute1 = FND_API.G_MISS_CHAR THEN NULL;
935 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute1,p_old_line_scredit_rec.attribute1) THEN
936
937 l_result := ATTRIBUTE1
938 (p_operation => l_operation
939 ,p_record => l_rowtype_rec
940 ,x_on_operation_action => l_on_operation_action
941 );
942
943 IF l_result = OE_PC_GLOBALS.YES THEN
944 -- set OUT result to CONSTRAINED
945 x_result := OE_PC_GLOBALS.YES;
946 END IF;
947
948 END IF;
949
950 IF p_line_scredit_rec.attribute10 = FND_API.G_MISS_CHAR THEN NULL;
951 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute10,p_old_line_scredit_rec.attribute10) THEN
952
953 l_result := ATTRIBUTE10
954 (p_operation => l_operation
955 ,p_record => l_rowtype_rec
956 ,x_on_operation_action => l_on_operation_action
957 );
958
959 IF l_result = OE_PC_GLOBALS.YES THEN
960 -- set OUT result to CONSTRAINED
961 x_result := OE_PC_GLOBALS.YES;
962 END IF;
963
964 END IF;
965
966 IF p_line_scredit_rec.attribute11 = FND_API.G_MISS_CHAR THEN NULL;
967 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute11,p_old_line_scredit_rec.attribute11) THEN
968
969 l_result := ATTRIBUTE11
970 (p_operation => l_operation
971 ,p_record => l_rowtype_rec
972 ,x_on_operation_action => l_on_operation_action
973 );
974
975 IF l_result = OE_PC_GLOBALS.YES THEN
976 -- set OUT result to CONSTRAINED
977 x_result := OE_PC_GLOBALS.YES;
978 END IF;
979
980 END IF;
981
982 IF p_line_scredit_rec.attribute12 = FND_API.G_MISS_CHAR THEN NULL;
983 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute12,p_old_line_scredit_rec.attribute12) THEN
984
985 l_result := ATTRIBUTE12
986 (p_operation => l_operation
987 ,p_record => l_rowtype_rec
988 ,x_on_operation_action => l_on_operation_action
989 );
990
991 IF l_result = OE_PC_GLOBALS.YES THEN
992 -- set OUT result to CONSTRAINED
993 x_result := OE_PC_GLOBALS.YES;
994 END IF;
995
996 END IF;
997
998 IF p_line_scredit_rec.attribute13 = FND_API.G_MISS_CHAR THEN NULL;
999 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute13,p_old_line_scredit_rec.attribute13) THEN
1000
1001 l_result := ATTRIBUTE13
1002 (p_operation => l_operation
1003 ,p_record => l_rowtype_rec
1004 ,x_on_operation_action => l_on_operation_action
1005 );
1006
1007 IF l_result = OE_PC_GLOBALS.YES THEN
1008 -- set OUT result to CONSTRAINED
1009 x_result := OE_PC_GLOBALS.YES;
1010 END IF;
1011
1012 END IF;
1013
1014 IF p_line_scredit_rec.attribute14 = FND_API.G_MISS_CHAR THEN NULL;
1015 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute14,p_old_line_scredit_rec.attribute14) THEN
1016
1017 l_result := ATTRIBUTE14
1018 (p_operation => l_operation
1019 ,p_record => l_rowtype_rec
1020 ,x_on_operation_action => l_on_operation_action
1021 );
1022
1023 IF l_result = OE_PC_GLOBALS.YES THEN
1024 -- set OUT result to CONSTRAINED
1025 x_result := OE_PC_GLOBALS.YES;
1026 END IF;
1027
1028 END IF;
1029
1030 IF p_line_scredit_rec.attribute15 = FND_API.G_MISS_CHAR THEN NULL;
1031 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute15,p_old_line_scredit_rec.attribute15) THEN
1032
1033 l_result := ATTRIBUTE15
1034 (p_operation => l_operation
1035 ,p_record => l_rowtype_rec
1036 ,x_on_operation_action => l_on_operation_action
1037 );
1038
1039 IF l_result = OE_PC_GLOBALS.YES THEN
1040 -- set OUT result to CONSTRAINED
1041 x_result := OE_PC_GLOBALS.YES;
1042 END IF;
1043
1044 END IF;
1045
1046 IF p_line_scredit_rec.attribute2 = FND_API.G_MISS_CHAR THEN NULL;
1047 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute2,p_old_line_scredit_rec.attribute2) THEN
1048
1049 l_result := ATTRIBUTE2
1050 (p_operation => l_operation
1051 ,p_record => l_rowtype_rec
1052 ,x_on_operation_action => l_on_operation_action
1053 );
1054
1055 IF l_result = OE_PC_GLOBALS.YES THEN
1056 -- set OUT result to CONSTRAINED
1057 x_result := OE_PC_GLOBALS.YES;
1058 END IF;
1059
1060 END IF;
1061
1062 IF p_line_scredit_rec.attribute3 = FND_API.G_MISS_CHAR THEN NULL;
1063 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute3,p_old_line_scredit_rec.attribute3) THEN
1064
1065 l_result := ATTRIBUTE3
1066 (p_operation => l_operation
1067 ,p_record => l_rowtype_rec
1068 ,x_on_operation_action => l_on_operation_action
1069 );
1070
1071 IF l_result = OE_PC_GLOBALS.YES THEN
1072 -- set OUT result to CONSTRAINED
1073 x_result := OE_PC_GLOBALS.YES;
1074 END IF;
1075
1076 END IF;
1077
1078 IF p_line_scredit_rec.attribute4 = FND_API.G_MISS_CHAR THEN NULL;
1079 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute4,p_old_line_scredit_rec.attribute4) THEN
1080
1081 l_result := ATTRIBUTE4
1082 (p_operation => l_operation
1083 ,p_record => l_rowtype_rec
1084 ,x_on_operation_action => l_on_operation_action
1085 );
1086
1087 IF l_result = OE_PC_GLOBALS.YES THEN
1088 -- set OUT result to CONSTRAINED
1089 x_result := OE_PC_GLOBALS.YES;
1090 END IF;
1091
1092 END IF;
1093
1094 IF p_line_scredit_rec.attribute5 = FND_API.G_MISS_CHAR THEN NULL;
1095 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute5,p_old_line_scredit_rec.attribute5) THEN
1096
1097 l_result := ATTRIBUTE5
1098 (p_operation => l_operation
1099 ,p_record => l_rowtype_rec
1100 ,x_on_operation_action => l_on_operation_action
1101 );
1102
1103 IF l_result = OE_PC_GLOBALS.YES THEN
1104 -- set OUT result to CONSTRAINED
1105 x_result := OE_PC_GLOBALS.YES;
1106 END IF;
1107
1108 END IF;
1109
1110 IF p_line_scredit_rec.attribute6 = FND_API.G_MISS_CHAR THEN NULL;
1111 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute6,p_old_line_scredit_rec.attribute6) THEN
1112
1113 l_result := ATTRIBUTE6
1114 (p_operation => l_operation
1115 ,p_record => l_rowtype_rec
1116 ,x_on_operation_action => l_on_operation_action
1117 );
1118
1119 IF l_result = OE_PC_GLOBALS.YES THEN
1120 -- set OUT result to CONSTRAINED
1121 x_result := OE_PC_GLOBALS.YES;
1122 END IF;
1123
1124 END IF;
1125
1126 IF p_line_scredit_rec.attribute7 = FND_API.G_MISS_CHAR THEN NULL;
1127 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute7,p_old_line_scredit_rec.attribute7) THEN
1128
1129 l_result := ATTRIBUTE7
1130 (p_operation => l_operation
1131 ,p_record => l_rowtype_rec
1132 ,x_on_operation_action => l_on_operation_action
1133 );
1134
1135 IF l_result = OE_PC_GLOBALS.YES THEN
1136 -- set OUT result to CONSTRAINED
1137 x_result := OE_PC_GLOBALS.YES;
1138 END IF;
1139
1140 END IF;
1141
1142 IF p_line_scredit_rec.attribute8 = FND_API.G_MISS_CHAR THEN NULL;
1143 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute8,p_old_line_scredit_rec.attribute8) THEN
1144
1145 l_result := ATTRIBUTE8
1146 (p_operation => l_operation
1147 ,p_record => l_rowtype_rec
1148 ,x_on_operation_action => l_on_operation_action
1149 );
1150
1151 IF l_result = OE_PC_GLOBALS.YES THEN
1152 -- set OUT result to CONSTRAINED
1153 x_result := OE_PC_GLOBALS.YES;
1154 END IF;
1155
1156 END IF;
1157
1158 IF p_line_scredit_rec.attribute9 = FND_API.G_MISS_CHAR THEN NULL;
1159 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.attribute9,p_old_line_scredit_rec.attribute9) THEN
1160
1161 l_result := ATTRIBUTE9
1162 (p_operation => l_operation
1163 ,p_record => l_rowtype_rec
1164 ,x_on_operation_action => l_on_operation_action
1165 );
1166
1167 IF l_result = OE_PC_GLOBALS.YES THEN
1168 -- set OUT result to CONSTRAINED
1169 x_result := OE_PC_GLOBALS.YES;
1170 END IF;
1171
1172 END IF;
1173
1174 IF p_line_scredit_rec.sales_credit_type_id = FND_API.G_MISS_NUM THEN NULL;
1175 ELSIF NOT OE_GLOBALS.EQUAL(p_line_scredit_rec.sales_credit_type_id,p_old_line_scredit_rec.sales_credit_type_id) THEN
1176
1177 l_result := SALES_CREDIT_TYPE
1178 (p_operation => l_operation
1179 ,p_record => l_rowtype_rec
1180 ,x_on_operation_action => l_on_operation_action
1181 );
1182
1183 IF l_result = OE_PC_GLOBALS.YES THEN
1184 -- set OUT result to CONSTRAINED
1185 x_result := OE_PC_GLOBALS.YES;
1186 END IF;
1187
1188 END IF;
1189
1190 IF OE_PC_GLOBALS.G_CHECK_UPDATE_ALL_FOR_DFF = 'N' THEN
1191 IF l_debug_level > 0 THEN
1192 oe_debug_pub.add( 'SETTING CHECK ALL COLS CONSTRAINT TO:'||L_CHECK_ALL_COLS_CONSTRAINT ) ;
1193 END IF;
1194 g_check_all_cols_constraint := l_check_all_cols_constraint;
1195 END IF;
1196
1197 -- END: CHECK FOR CONSTRAINTS ON DESC FLEXFIELD ATTRIBUTES
1198 -- NOTE: Please add constraints check for new attributes before the
1199 -- descriptive flexfield attributes check.
1200
1201 IF l_debug_level > 0 THEN
1202 oe_debug_pub.add( 'EXIT OE_LINE_SCREDIT_SECURITY.ATTRIBUTES' , 1 ) ;
1203 END IF;
1204
1205 EXCEPTION
1206 WHEN FND_API.G_EXC_ERROR THEN
1207 x_return_status := FND_API.G_RET_STS_ERROR;
1208 WHEN OTHERS THEN
1209 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1210 IF OE_MSG_PUB.Check_Msg_Level(OE_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1211 OE_MSG_PUB.Add_Exc_Msg
1212 ( G_PKG_NAME
1213 , 'Attributes'
1214 );
1215 END IF;
1216
1217 END Attributes;
1218
1219 END OE_Line_Scredit_Security;