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