265: debug (ln_reg_id, 'OPEN/FETCH curosr c_chk_req_exists');
266:
267: lv_ret_val := false;
268:
269: if pv_event = jai_constants.DEFAULT_TAXES then
270:
271: open c_chk_default_req_exists;
272: fetch c_chk_default_req_exists into ln_req_exists;
273: lv_ret_val := c_chk_default_req_exists%found ;
272: fetch c_chk_default_req_exists into ln_req_exists;
273: lv_ret_val := c_chk_default_req_exists%found ;
274: close c_chk_default_req_exists;
275:
276: elsif pv_event = jai_constants.RECALCULATE_TAXES
277: then
278:
279: open c_chk_recalc_req_exists;
280: fetch c_chk_recalc_req_exists into ln_req_exists;
316: if (request_exists_for_event (pv_event)) = false then
317: --
318: -- Request does not exists
319: --
320: if pv_event = jai_constants.default_taxes then
321:
322: ln_parent_request_id := ln_conc_request_id;
323:
324: elsif pv_event = jai_constants.recalculate_taxes then
320: if pv_event = jai_constants.default_taxes then
321:
322: ln_parent_request_id := ln_conc_request_id;
323:
324: elsif pv_event = jai_constants.recalculate_taxes then
325:
326: ln_project_id := r_new.project_id;
327: ln_draft_invoice_num := r_new.draft_invoice_num;
328:
374: );
375: debug (ln_reg_id, 'ln_request_id='||ln_request_id);
376: if ln_request_id > 0 then
377:
378: if pv_event = jai_constants.DEFAULT_TAXES then
379: --
380: -- Event is default taxes hence the trigger is invoked by a project's draft invoice generation concurrent
381: -- By inserting a row in to global temporary table (which preserve row ever after COMMIT) to later check
382: -- if the request is already submitted in the current session (concurrent session)
391: pv_event
392: , ln_request_id
393: , ln_parent_request_id
394: );
395: elsif pv_event = jai_constants.RECALCULATE_TAXES then
396: --
397: -- Recalulate event is triggered from the front-end UI and here using a global temporary table
398: -- (which *DO NOT* preseve rows on COMMIT) so after each commit a new request will be submited
399: --
479:
480: if inserting then
481:
482: submit_request
483: ( pv_event => jai_constants.default_taxes
484: );
485:
486: end if ;
487:
502: ||',r_new.inv_currency_code='||r_new.inv_currency_code
503: ||',r_old.inv_currency_code='||r_old.inv_currency_code
504: );
505: submit_request
506: ( pv_event => jai_constants.recalculate_taxes
507: );
508:
509: end if;
510:
534: ||', lv_process_message:'||lv_process_message
535: );
536: end if;
537:
538: if lv_process_flag in (jai_constants.unexpected_error, jai_constants.expected_error, 'E') then
539: goto end_of_trigger;
540: end if;
541:
542: /* TESTING purpose
558: pv_process_flag => lv_process_flag,
559: pv_process_message => lv_process_message
560: ) ;
561:
562: if lv_process_flag in (jai_constants.unexpected_error, jai_constants.expected_error, 'E') then
563: goto end_of_trigger;
564: end if;
565:
566: end if;
569: -- End of Trigger logic
570: --
571: <
572: jai_cmn_debug_contexts_pkg.deregister (ln_reg_id);
573: if lv_process_flag in (jai_constants.unexpected_error, jai_constants.expected_error, 'E') then
574: fnd_message.set_name( 'JA', 'JAI_GENERIC_MSG');
575: fnd_message.set_token('MSG_TEXT', lv_process_message);
576: app_exception.raise_exception;
577: end if;