#!perl
#**************************************************************************
#
# ActinicConst.pm	- basic constants required by most of the Actinic cart scripts
#
# Written by Zoltan Magyar
# 1:04 PM 11/29/2001
#
# Copyright (c) Actinic Software Ltd 2001
#
#**************************************************************************
package ActinicConstants;
require 5.002;
#
# Version
#
$ActinicConstants::prog_name = 'ActinicConstants.pm';		# Program Name
$ActinicConstants::prog_name = $ActinicConstants::prog_name;	# remove compiler warning
$ActinicConstants::prog_ver = '$Revision: 21302 $ ';			# program version
$ActinicConstants::prog_ver = substr($ActinicConstants::prog_ver, 11); # strip the revision information
$ActinicConstants::prog_ver =~ s/ \$//;						# and the trailers
#
# Application major version
#
$::EC_MAJOR_VERSION = <Actinic:Variable Name="ECMajorVersion"/>;	# This value is used by the PSP plug-in scripts when it is necessary to branch on EC version for function calls
$::EC_VERSION_STRING = '<Actinic:Variable Name="ECVersionString"/>';	# This string is for future version dependent conditions
###############################################################
#
# Customisable constants
#
# The constants defined below can be changed without any general
# effect on the scripts.
# See individual descriptions below.
#
###############################################################

#
# Search log customisation: by uncommenting  the following line the
# search script will record the executed search query. The log file name will
# be the below specified.
#
#$::SEARCH_WORD_LOG_FILE	= "search.log";

#
# Product duplicates customisation: by uncommenting the line below
# your cart display will include a list of product duplicates
# (if there is any)
#
#$::DISPLAY_PRODUCT_DUPLICATE_LINKS = 1;

#
# Uncomment the line below if you would like to see the adjustment
# lines as they are appears offline (attached to the appropriate
# triggering lines)
#
#$::DISPLAY_INDIVIDUAL_ADJUSTMENT_LINES = 1;
#
# Debug constants
#
#
# compose DEBUG_CLASS_FILTER by adding
# all class variable together which you want to dump to the error.err file
#
$::DC_NONE					= 0;							# do not dump anything
$::DC_ORDERSCRIPT 		= 1;							# dump order script failure messages
$::DC_CART_RESTORE 		= 2;							# dump cart restore failure messages
$::DC_SEARCH         	= 4;							# dump search messages
$::DEBUG_CLASS_FILTER = $::DC_NONE; 			 	# log nothing in release mode
#
# Log mode for debug version
#
#?$::DEBUG_CLASS_FILTER |= 	$::DC_ORDERSCRIPT | # log only if we are in debug mode
#?							$::DC_CART_RESTORE |
#?							$::DC_SEARCH;

#
# Compatibility error message. This string is defined here because it might be
# used before the prompts are processed. When the prompts are available this
# value will be overwritten by the value from the prompts
#
$::g_sCompabilityError = "There was a problem with some information in the online shop so we " .
	"cannot take your order.  Please contact the shop owner with this " .
	"information so that they can rectify the problem.\r\n" .
	"Details: The version number (%s) of one of your uploaded data files (%s) ".
	"is incompatible with the existing script version (%s). Solution: Refresh the site.";
#
# HTML code used for formatting cart error messages
#
$::ERROR_FORMAT = "<TABLE CELLPADDING=\"10\" WIDTH=\"550\" BORDER=\"1\" BGCOLOR=\"$$::g_pSetupBlob{FORM_BACKGROUND_COLOR}\">" .
						"<TR><TD><BIG>%s</BIG></TD></TR></TABLE><P><HR>";

###############################################################
#
# Generic constants
#
# The constants defined below is only for internal use
# Any modification of the below listed values may lead to
# serious malfunction of the Actinic scripts.
# Therefore please do not change thse values unless you are
# serious about your knowledge.
#
###############################################################

$::FALSE 	= 0;											# This value is referenced in the shipping and PSP plug-ins - any changes need to be reflected there
$::TRUE	 	= 1;											# This value is referenced in the shipping and PSP plug-ins - any changes need to be reflected there

$::FAILURE 	= 0;											# This value is referenced in the shipping and PSP plug-ins - any changes need to be reflected there
$::SUCCESS 	= 1;											# This value is referenced in the shipping and PSP plug-ins - any changes need to be reflected there
$::NOTFOUND = 2;
$::FAILEDSEARCH = $::NOTFOUND;						# synonyms
$::EOF		= 3;											# This value is referenced in the PSP plug-ins - any changes need to be reflected there
$::EOB     	= 4;
$::BADDATA	= 5;
$::WARNING	= 6;
$::ACCEPTED	= 7;											# This value is referenced in the PSP plug-ins - any changes need to be reflected there
$::REJECTED	= 8;											# This value is referenced in the PSP plug-ins - any changes need to be reflected there
$::PENDING	= 9;											# This value is referenced in the PSP plug-ins - any changes need to be reflected there
$::STARTSEQUENCE = 0;
#
# Template Variables
#
$::VARPREFIX 	= 'NETQUOTEVAR:';						# This value is referenced in the shipping and PSP plug-ins - any changes need to be reflected there
$::DELPREFIX 	= 'NETQUOTEDEL:';						# This value is referenced in the PSP plug-ins - any changes need to be reflected there

$::RBBYTE     = 0;										# enumeration of the field types
$::RBWORD     = 1;
$::RBDWORD    = 2;
$::RBQWORD    = 3;
$::RBSTRING   = 4;
$::RBKEY      = 5;

$::HIDDEN	= 0;											# the prompt status
$::OPTIONAL	= 1;
$::REQUIRED = 2;
#
# Constants for payment methods
# DO NOT TOUCH
#
$::PAYMENT_UNDEFINED					= -1;
$::PAYMENT_CREDIT_CARD				= 10005;			# the various payment methods
$::PAYMENT_CASH_ON_DELIVERY		= 10000;
$::PAYMENT_CHECK_ON_DELIVERY		= 10001;
$::PAYMENT_INVOICE					= 10002;
$::PAYMENT_INVOICE_PRE_PAY			= 10003;
$::PAYMENT_CREDIT_CARD_SEPARATE	= 10004;
$::PAYMENT_ON_ACCOUNT            = 10006;
$::PAYMENT_PAYPAL						= 900;
$::PAYMENT_NOCHEX						= 52;
$::PAYMENT_PAYPAL_PRO				= 58;
$::PAYMENT_PAYPAL_EC					= 901;

$::ORDER_AID_NONE			= 0;							# the order aid methods
$::ORDER_AID_COMPLETE	= 1;
$::ORDER_AID_RESPOND		= 2;
$::ORDER_AID_CONTINUE	= 3;

$::LOCK_SH = 1;											# flock - share permissions
$::LOCK_EX = 2;											# flock - exclusive lock
$::LOCK_NB = 4;											# flock - non-blocking (can be or'ed with others)
$::LOCK_UN = 8;											# flock - unlock

$::MAX_ORD_QTY = 32767;									# maximum orderable quantity
#
# Localtime and gmtime array indices
#
$::TIME_SECOND = 0;										# 0..59
$::TIME_MINUTE = 1;										# 0..59
$::TIME_HOUR   = 2;										# 0..23
$::TIME_MDAY   = 3;										# day of the month (1..31)
$::TIME_MONTH  = 4;										# 0..11
$::TIME_YEAR   = 5;										# 0 based - need to add 1900
$::TIME_WDAY   = 6;										# day of the week (0..6)
$::TIME_YDAY   = 7;										# day of the year (1..366)
$::TIME_ISDST  = 8;
#
# The global button labels
#
$::g_sCancelButtonLabel 		= '';
$::g_sConfirmButtonLabel 		= '';
$::g_sAddToButtonLabel 			= '';
$::g_sEditButtonLabel 			= '';
$::g_sRemoveButtonLabel 		= '';
$::g_sSearchButtonLabel 		= '';
$::g_sSaveShoppingListLabel 	= '';
$::g_sGetShoppingListLabel 	= '';
$::g_sUpdateCartLabel			= '';

$::s_nErrorRecursionCounter = 0;						# used to track XML parser recursion DO NOT TOUCH

$::g_bLoginPage = $::FALSE;							# varible used to make XML parser fool
$::g_bJustAfterLogin = $::FALSE;						# flag for proper SSL bounce after login in case of split SSL

#
# Blob Versions
#
$::g_nSetupBlobVersion 		= 26;						# setup blob (nqset00.fil)
$::g_nCatalogBlobVersion	= 2;						# catalog blob A000.cat
$::g_nSectionBlobVersion	= 12;						# section blob version
$::g_nPaymentBlobVersion	= 1;						# payment.fil
$::g_nLocationBlobVersion	= 1;						# locations.fil
$::g_nSearchSetupBlobVersion = 1;					# search.fil
$::g_nTaxSetupBlobVersion	= 2;						# taxsetup.fil
$::g_nSSPSetupBlobVersion	= 1;						# sspsetup.fil
$::g_nSearchIndexVersion	= 258;					# oldprod.fil
$::g_nSearchTextIndexVersion = 257;					# oldtext.fil
$::g_nDiscountBlobVersion	= 2;						# discounts.fil
$::g_nCustomerAccountBlobVersion = 1;				# customer account blob version
$::g_nBuyerBlobVersion		= 1;					# buyer blob version
$::g_nAddressBlobVersion	= 2;					# address blob version

#
# SharedSSL protocol version
#
$::SSSL_Protocol_Version	= 3;
#
# Add to cart modes
#
$::ATCM_SIMPLE 	= 0;									# old style
$::ATCM_ADVANCED	= 1;									# product details captured on product page
$::ATCM_SINGLE		= 2;									# single add to cart button per page
$::ATCM_PDONCART	= 3;									# quantity and product details will be set on cart display page
#
# Section Blob Constants
#
# a) component array indices
#
$::CBIDX_NAME 				= 0;							# component name
$::CBIDX_ATTRIBUTELIST 	= 1;							# list of attributes
$::CBIDX_QUANTITYUSED	= 2;							# quantity used per product
$::CBIDX_PERMUTATIONS	= 3;							# permuatations
$::CBIDX_ASSOCPRODPRICE = 4;							# use associated product price flag
$::CBIDX_EXPLANATION		= 5; 							# hash of price explanations
$::CBIDX_ASSOCIATEDPROD	= 6;							# associated product flag
$::CBIDX_OPTIONAL		 	= 7;							# optional component flag
$::CBIDX_ASSOCIATEDTAX	= 8;							# use associated tax flag
$::CBIDX_ASSOCIATEDNAME	= 9;							# use associated product name flag
$::CBIDX_SEPARATELINE	= 10;							# component as separate order line flag
$::CBIDX_ASSOCIATEDSHIP	= 11;							# use associated product shipping flag
#
# b) attribute array indices
#
$::ABIDX_NAME				= 0;							# attribute name
$::ABIDX_WIDGETIDX		= 1;							# index of the UI widget
$::ABIDX_CHOICES			= 2; 							# list of choices
#
# c) permutation list indices
#
$::PBIDX_CHOICELIST		= 0;							# list of choices
$::PBIDX_ASSOCIATEDPROD	= 1;							# the associated product hash or "-" is invalid or "+" if out of stock
$::PBIDX_PRICE				= 2; 							# price hash of the permutation
$::PBIDX_PRICINGMODEL	= 3;							# pricing model flag
$::PBIDX_ASSOCIATEDTAX	= 4;							# use associated product tax flag
$::PBIDX_ASSOCIATEDNAME	= 5;							# use associated product name flag
$::PBIDX_ASSOCIATEDSHIP	= 6;							# use associated product shipping flag
#
# Hash operation (mainly for search scripts)
#
$::INTERSECT		= 0;									# intersection (AND op) of two hashes
$::UNION          = 1;									# union (OR op) of two hashes
#
# Order Detail line type
#
$::eOrderLineProduct			= 0;						# product line
$::eOrderLineComponent		= 1;						# component
$::eOrderLineProductAdjust	= 2;						# product adjustment
$::eOrderLineOrderAdjust	= 3;						# order adjustment
#
# Adjustment array indices
#
$::eAdjIdxProductRef					= 0;				# product reference
$::eAdjIdxProductDescription		= 1;				# description
$::eAdjIdxAmount						= 2;				# amount
$::eAdjIdxTaxTreatment				= 3;				# adjustment tax treatment
$::eAdjIdxLineType					= 4;				# line type
$::eAdjIdxTax1							= 5;				# tax 1
$::eAdjIdxTax2							= 6;				# tax 2
$::eAdjIdxCurOpaqueData				= 7;				# current tax opaque data
$::eAdjIdxDefOpaqueData				= 8;				# default tax opaque data
$::eAdjIdxTaxProductRef				= 9;				# product reference for tax purposes
$::eAdjIdxCustomTaxAsExempt		= 10;				# whether to treat custom tax as exempt
$::eAdjIdxAdjustmentBasis			= 11;				# adjustment calculation basis
$::eAdjIdxCouponCode					= 12;				# coupon code
$::eAdjIdxCartIndex					= 13;				# index of the cart line associated with the adjustment
$::eAdjIdxDiscountID					= 14;				# the unique ID of the discount
$::eAdjIdxRewardType					= 15;				# the reward type of the discount
#
# Adjustment tax treatments
#
$::eAdjTaxAsProduct					= 0;				# use product tax data
$::eAdjTaxProRata						= 1;				# pro-rata on products before product adjustments
$::eAdjTaxProRataAdjusted			= 2;				# pro-rata on products after product adjustments
$::eAdjTaxProRataOrderAdjusted	= 3;				# pro-rata on products after order adjust - this is used for shipping pro-rata
$::eAdjTaxProRataTotal				= 4;				# pro-rata on order total
#
# Script IDs
#
$::sShoppingScriptID				= 'ca';				# id of shopping script
$::sAccountScriptID				= 'bb';				# id of customer account script
$::sOrderScriptID					= 'ao';				# id of order script
$::sCartManagerScriptID			= 'cm';				# id of cart manager script
$::sMergeDiffScriptID			= 'md';				# id of merge diff script
$::sMailScriptID					= 'ms';				# id of mail script
$::sCatalogScriptID				= 'nq';				# id of catalog script
$::sReferrerScriptID				= 'rs';				# id of referrer script
$::sSearchHighlightScriptID	= 'sh';				# id of search highlight script
$::sSearchScriptID				= 'ss';				# id of search script
#
# UPS coding-encoding pwd
#
$::UPS_ENCRYPT_PASSWORD = 'Seherezade';
#
# SMTP Authectication parameters
#
$::sSMTPUsername = '<Actinic:Variable Name="SmtpUserName"/>';
$::sSMTPPassword = '<Actinic:Variable Name="SmtpPassword"/>';
$::bSTMPAuth = <Actinic:Variable Name="SmtpAuth"/>;
#
# Discount basis constants
#
$::eBasisTaxExclusiveValue				= 0;			# Discount basis tax exclusive value
$::eBasisValueIncludingDefaultTax	= 1;			# Discount basis value including default tax
$::eBasisValueIncludingActualTax		= 2;			# Discount basis value including actual tax
$::eBasisQuantity							= 3;			# Discount basis quantity
$::eBasisProductReference				= 4;			# Virtual discount basis for product reference
#
# Discount rewards constants
#
$::eRewardMoneyOff						= 0;			# Discount reward money off
$::eRewardPercentageOff					= 1;			# Discount reward percentage off
$::eRewardPercentageOffCheapest		= 2;			# Discount reward percentage off of cheapest item
$::eRewardMoneyOffExtraProduct		= 3;			# Discount reward money off of extra product
$::eRewardPercentageOffExtraProduct	= 4;			# Discount reward percentage off of extra product
$::eRewardFixedPrice						= 5;			# Discount reward fixed price
#
# Discounting cart content array indices
#
$::eDCartLineIndex			= 0;						# the index of the cart line
$::eDCartLineQuantity		= 1;						# quantity in the cart line
$::eDCartLineTotal			= 2;						# total price of the line
$::eDCartLineItemCost		= 3;						# price of one item of the line
$::eDCartLineTax1Band		= 4;						# tax band 1
$::eDCartLineTax2Band		= 5;						# tax band 2
$::eDcartLineTax1Actual		= 6;						# actual tax 1
$::eDCartLineTax2Actual		= 7;						# actual tax 2
$::eDcartLineTax1Default	= 8;						# default tax 1
$::eDcartLineTax2Default	= 9;						# default tax 2
$::eDcartLineQuantityUsed	= 10;						# quantity already used by discounts
$::eDcartLineValueUsed		= 11;						# value already used by discounts
$::eDcartLineProductRef		= 12;						# product reference of the cart item
#
# Data restrictions
#
$::eABDataLimit	= 0;									# maximum characters allowed between angle brackets
1;
