Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this page: 

Table of Contents
maxLevel3
stylenone

Introduction

These scripts reflect sample documentation which that can be added to the GDS PNR as a trip requiring Prepre-Trip Approval makes it's trip approval makes its way through the process.

In order to ensure that the entries which that need to be added AFTER the initial PNR creation are triggered when applicable, be sure to especially note the PNR Field Type for in  in the Secondary tag/keywords column.  If a script is noted with PNR Field Type = Pre Trip Approval, but is not configured as such, the corresponding entry will not be added to the PNR.

The following scripts can be added to two different areas: Custom PNR and Queue/Delivery Options

Custom PNR scripts

The following scripts are added in Services Tab > Agency Configuration > Custom PNR

State - Pending/Waiting for

...

approval

Trip has been submitted for Prepre-Trip trip approval, which is now in a pending state.

Tag/keyword
Secondary tag/keywords
Script
PTA

Pending Approval State

PNR Field Type = Accounting ID


Code Block
languagejava
titlePTA Pending
collapsetrue
//PTA - PENDING

if ((UserPnrData.DataType=="new") &&(UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState=="WAITING_FOR_APPROVAL"))

{out.print("5H-PTA-PENDING" );} 


State - Approved

Trip has been approved.

Tag/keyword
Secondary tag/keywords
Script
PTA

Approved Approval State

PNR Field Type = Pre Trip Approval


Code Block
languagejava
titlePTA Approved
collapsetrue
//PTA - APPROVED

if (UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState=="APPROVED")

{out.print("5H-PTA-APPROVED" );}


State - Declined

Pre-Trip Approval trip approval has been declined.

Tag/keyword
Secondary tag/keywords
Script
PTA

Declined Approval State

PNR Field Type = Pre Trip Approval


Code Block
languagejava
titlePTA Declined
collapsetrue
//PTA - DECLINED

if (UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState=="DECLINED")

{out.print("5H-PTA-DECLINED" );} 


State - Expired

Pre-Trip trip approval process has expired.

Tag/keyword
Secondary tag/keywords
Script
PTA

Expired Approval State

PNR Field Type = Pre Trip Approval


Code Block
languagejava
titlePTA Expired
collapsetrue
//PTA - EXPIRED

if (UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState=="EXPIRED")

{out.print("5H-PTA-EXPIRED" );} 


Email of

...

primary approver (script 1)

This script adds the primary approver to whom the Pre-Trip Approval Email email was sent. Email special character substitutions may need to be updated based on your agency requirements (see other email scripts on your site).

Tag/keyword
Secondary tag/keywords
Script
PTA

Primary Approver Email

PNR Field Type = Remark



Code Block
languagejava
titlePrimary Approver Email
collapsetrue
//PTA - PRIMARY APPROVER EMAIL

if((UserPnrData.DataType=="new")||(UserPnrData.DataType=="purchase.hold"))
{var k;
var temp = "";
var an=UserPnrData.UserBooking.PreTripApprovalInfo.ProfileApproverEmail + " ";


{for (i=0; i<an.lastIndexOf(".") + 4; i++) 
      {if (an.charAt(i) == "_") { k = ".UN." }
  else if (an.charAt(i) == "@") { k = ".AT." }
  else if (an.charAt(i) == "-") { k = ".AP." }
  else { k = an.charAt(i) }
temp = temp + k}

{out.print("5H-PTA-PRIM EML SENT-" + temp ); }}} 


Email of

...

primary approver (script 2)

This is an alternate script to add the primary approver to whom the Pre-Trip Approval Email pre-trip approval email was sent. This script doesn't contain any email special character substitutions.

Tag/keyword
Secondary tag/keywords
Script
PTA

Primary Approver Email 2

PNR Field Type =

Remark


Code Block
languagejava
titlePrimary Approver Email 2
collapsetrue
//PTA - PRIMARY APPROVER EMAIL

var an=UserPnrData.UserBooking.PreTripApprovalInfo.ProfileApproverEmail;

if(((UserPnrData.DataType=="new")||(UserPnrData.DataType=="hold")) && (an!=undefined))
{out.print("5UD3 " + an);}   


Primary or secondary travel approver to the PNR

This script will fire when the primary or profiled travel approver has approved the trip.

Tag/keyword
Secondary tag/keywords
Script
PTA

Primary or Secondary Travel Approver to the PNR


Code Block
languagejava
titlePTA
collapsetrue

TAW - Pending/Waiting for Approval

...

//PTA Travel Approver
//Primary
 
var ap=UserPnrData.UserBooking.PreTripApprovalInfo.ProfileApproverEmail;
 
ap=ap.toUpperCase();
ap=ap.replace(/@/g,"\@");
 
if(((UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState="APPROVED")&&(UserPnrData.UserBooking.PreTripApprovalInfo.StateChangedBy== "PROFILE_APPROVER")&&(ap!="")))
 
{out.print("5.S*UD146 " + ap);}


PNR not approved by primary/profiled travel approver and skips over the secondary approver

Tag/keyword
Secondary tag/keywords
Script
PTA

Secondary Approver skipped 



Code Block
languagejava
titleSkip Secondary
collapsetrue
//PTA Travel Approver
//Secondary -
 
var ap=UserPnrData.UserBooking.PreTripApprovalInfo.SecondaryApproverEmail;
 
ap=ap.toUpperCase();
ap=ap.replace(/@/g,"\@");
 
if((UserPnrData.UserBooking.PreTripApprovalInfo.StateChangedBy=="SECONDARY_APPROVER")&&(ap!="")){out.print("5.S*UD146 " + ap);}  



TAW - pending/waiting for approval

Although PNRs that are pending approval are generally blocked from dropping on the agency ticketing queue, you can enter a unique TAW for them, if required.

Tag/keyword
Secondary tag/keywords
Script
PTA

TAW - pending

PNR Field Type = Accounting ID



Code Block
languagejava
titleTAW Pending
collapsetrue
//TAW - PTA - PENDING

if ((UserPnrData.DataType=="new") &&(UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState=="WAITING_FOR_APPROVAL"))

{out.print("7TAWABCD101/ETKT PENDING APPROVAL" );}  


TAW -

...

trip approved

If a "pending approval" TAW is used for trips waiting for approval, that TAW should be updated once a trip has been approved.  This script will update the TAW when a trip has been approved.

Tag/keyword
Secondary tag/keywords
Script
PTA

TAW - approved

PNR Field Type = Pre Trip Approval



Code Block
languagejava
titleTAW - Approved
collapsetrue
//TAW - PTA - PENDING

if (UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState=="APPROVED")

with(UserPnrData.UserBooking.AgencyTransactionDate){
out.print("7TAWABCD" + Day + Month + "101/ETKT REQ");}   


Queue/Delivery

...

Options

Queue delivery - ticketing queue block

This script is added to a Queue Delivery Option - Block itineraries that are triggered for pre-trip approval from passing to the normal ticketing queue (as they would if pre-trip approval was not enabled). This script allows itineraries that do not trigger pre-trip approval to pass to the normal ticketing queue as usual, but stops itineraries that trigger pre-trip approval from going to ticketing before they are approved.

Note: The following scripts are added in Services Tab>Agency Configuration>Queue/Delivery Options

Tag/keyword
Secondary tag/keywords
Script
PTATicket Queue


Code Block
languagejava
titleTicket Queue Delivery Block
collapsetrue
var ifToPrint="true";
 
{var pta=UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState;
if (pta=="WAITING_FOR_APPROVAL") {
          ifToPrint="false";
      }
out.print(ifToPrint);}


Queue

...

delivery -

...

pending/

...

waiting for

...

approval

This script is added to a Queue Delivery OptionAdd this script to a queue delivery option if you'd like to drop on a queue PNRS which PNRs that have been sent for Pre-Trip Approvalpre-trip approval.

Tag/keyword
Secondary tag/keywords
Script
PTAPending Approval


Code Block
languagejava
titlePending Approval
collapsetrue
var ifToPrint="false";

 
{var pta=UserPnrData.UserBooking.PreTripApprovalInfo.CurrentApprovalState;
if (pta=="WAITING_FOR_APPROVAL") {
          ifToPrint="true";
      }
out.print(ifToPrint);}


...