<MvCOMMENT>
|
| Miva Merchant v4.x
|
| This file and the source codes contained herein are the property 
| of Miva Corporation.  Use of this file is restricted to the specific 
| terms and conditions in the License Agreement associated with this 
| file.  Distribution of this file or portions of this file for uses
| not covered by the License Agreement is not allowed without a written 
| agreement signed by an officer of Miva Corporation.
| 
| Copyright 1998-2001 Miva Corporation.  All rights reserved.
| http://www.miva.com/
|
| dBase III Database Layer
| $Source: /home/cvs/merchant/Merchant/features/cus/cus_rt.mv,v $
|
| Prefix         : MER-CUS-RT-
| Next Error Code: 0    
| Next Text ID   : 1    
|
</MvCOMMENT>

<MvFUNCTION NAME = "Customer_Validate" STANDARDOUTPUTLEVEL = "">

	<MvASSIGN NAME = "l.valid" VALUE = 1>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.got_standard_fields" VALUE = "{ Get_StandardFields() }">

	<MvASSIGN NAME = "g.Customer_Login" VALUE = "{ ltrim( rtrim( g.Customer_Login ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.Customer_Login ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvASSIGN NAME = "g.Customer_Login_Invalid" VALUE = 1>
	<MvELSE>
		<MvASSIGN NAME = "l.check" VALUE = 1>

		<MvIF EXPR = "{ BasketList.d.cust_id }">
			<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.found" VALUE = "{ Customer_Find_ID( BasketList.d.cust_id ) }">
			<MvIF EXPR = "{ l.found }">
				<MvIF EXPR = "{ toupper( Customers.d.login ) EQ toupper( g.Customer_Login ) }">
					<MvASSIGN NAME = "l.check" VALUE = 0>
				</MvIF>
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ l.check }">
			<MvDO FILE = "{ g.Module_Feature_Cus_DB }" NAME = "l.found" VALUE = "{ Customer_Find_Login( g.Customer_Login ) }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_Login_Invalid" VALUE = 1>
				<MvASSIGN NAME = "g.Customer_Login_InUse" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_PasswordEmail" VALUE = "{ ltrim( rtrim( g.Customer_PasswordEmail ) ) }">
	<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.email_valid" VALUE = "{ Email_Validate( g.Customer_PasswordEmail ) }">
	<MvIF EXPR = "{ NOT l.email_valid }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_PasswordEmail_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_Password" VALUE = "{ ltrim( rtrim( g.Customer_Password ) ) }">
	<MvASSIGN NAME = "g.Customer_VerifyPassword" VALUE = "{ ltrim( rtrim( g.Customer_VerifyPassword ) ) }">

	<MvIF EXPR = "{ NOT BasketList.d.cust_id }">
		<MvIF EXPR = "{ ( NOT len( g.Customer_Password ) ) OR ( NOT len( g.Customer_VerifyPassword ) ) }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Customer_Password_Invalid" VALUE = 1>
			<MvASSIGN NAME = "g.Customer_VerifyPassword_Invalid" VALUE = 1>
		<MvELSE>
			<MvIF EXPR = "{ ( g.Customer_VerifyPassword NE g.Customer_Password ) }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_VerifyPassword_Invalid" VALUE = 1>
			</MvIF>
		</MvIF>
	<MvELSE>
		<MvIF EXPR = "{ ( g.Customer_VerifyPassword NE g.Customer_Password ) }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Customer_VerifyPassword_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipFirstName" VALUE = "{ ltrim( rtrim( g.Customer_ShipFirstName ) ) }">
	<MvIF EXPR = "{ ( StandardFields.d.mode_fname EQ 'R' ) AND ( NOT len( g.Customer_ShipFirstName ) ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_ShipFirstName_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipLastName" VALUE = "{ ltrim( rtrim( g.Customer_ShipLastName ) ) }">
	<MvIF EXPR = "{ ( StandardFields.d.mode_lname EQ 'R' ) AND ( NOT len( g.Customer_ShipLastName ) ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_ShipLastName_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipEmail" VALUE = "{ ltrim( rtrim( g.Customer_ShipEmail ) ) }">
	<MvIF EXPR = "{ len( g.Customer_ShipEmail ) EQ 0 }">
		<MvASSIGN NAME = "g.Customer_ShipEmail" VALUE = "{ ltrim( rtrim( g.Customer_BillEmail ) ) }">
	</MvIF>

	<MvIF EXPR = "{ ( StandardFields.d.mode_email EQ 'R' ) AND ( NOT len( g.Customer_ShipEmail ) ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_ShipEmail_Invalid" VALUE = 1>
	<MvELSE>
		<MvIF EXPR = "{ len( g.Customer_ShipEmail ) }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.email_valid" VALUE = "{ Email_Validate( g.Customer_ShipEmail ) }">
			<MvIF EXPR = "{ NOT l.email_valid }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_ShipEmail_Invalid" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipPhone" VALUE = "{ ltrim( rtrim( g.Customer_ShipPhone ) ) }">
	<MvIF EXPR = "{ StandardFields.d.mode_phone EQ 'R' }">
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.phone_valid" VALUE = "{ Phone_Validate( g.Customer_ShipPhone, g.Customer_ShipCountry ) }">
		<MvIF EXPR = "{ NOT l.phone_valid }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Customer_ShipPhone_Invalid" VALUE = 1>
		</MvIF>
	<MvELSE>
		<MvIF EXPR = "{ len( g.Customer_ShipPhone ) }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.phone_valid" VALUE = "{ Phone_Validate( g.Customer_ShipPhone, g.Customer_ShipCountry ) }">
			<MvIF EXPR = "{ NOT l.phone_valid }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_ShipPhone_Invalid" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipFax" VALUE = "{ ltrim( rtrim( g.Customer_ShipFax ) ) }">
	<MvIF EXPR = "{ ( StandardFields.d.mode_fax EQ 'R' ) }">
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.fax_valid" VALUE = "{ Phone_Validate( g.Customer_ShipFax, g.Customer_ShipCountry ) }">
		<MvIF EXPR = "{ NOT l.fax_valid }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Customer_ShipFax_Invalid" VALUE = 1>
		</MvIF>
	<MvELSE>
		<MvIF EXPR = "{ len( g.Customer_ShipFax ) }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.fax_valid" VALUE = "{ Phone_Validate( g.Customer_ShipFax, g.Customer_ShipCountry ) }">
			<MvIF EXPR = "{ NOT l.fax_valid }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_ShipFax_Invalid" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipCompany" VALUE = "{ ltrim( rtrim( g.Customer_ShipCompany ) ) }">
	<MvIF EXPR = "{ ( StandardFields.d.mode_comp EQ 'R' ) AND ( NOT len( g.Customer_ShipCompany ) ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_ShipCompany_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipAddress" VALUE = "{ ltrim( rtrim( g.Customer_ShipAddress ) ) }">
	<MvIF EXPR = "{ ( StandardFields.d.mode_addr EQ 'R' ) AND ( NOT len( g.Customer_ShipAddress ) ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_ShipAddress_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipCity" VALUE = "{ ltrim( rtrim( g.Customer_ShipCity ) ) }">
	<MvIF EXPR = "{ ( StandardFields.d.mode_city EQ 'R' ) AND ( NOT len( g.Customer_ShipCity ) ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_ShipCity_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipState" VALUE = "{ ltrim( rtrim( g.Customer_ShipState ) ) }">
	<MvIF EXPR = "{ len( g.Customer_ShipStateSelect ) }">
		<MvASSIGN NAME = "g.Customer_ShipState" VALUE = "{ g.Customer_ShipStateSelect }">
	<MvELSE>
		<MvIF EXPR = "{ ( StandardFields.d.mode_state EQ 'R' ) AND ( NOT len( g.Customer_ShipState ) ) }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Customer_ShipState_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipZip" VALUE = "{ ltrim( rtrim( g.Customer_ShipZip ) ) }">
	<MvIF EXPR = "{ StandardFields.d.mode_zip EQ 'R' }">
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.zip_valid" VALUE = "{ Zip_Validate( g.Customer_ShipZip, g.Customer_ShipCountry ) }">
		<MvIF EXPR = "{ NOT l.zip_valid }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Customer_ShipZip_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Customer_ShipCountry" VALUE = "{ ltrim( rtrim( g.Customer_ShipCountry ) ) }">
	<MvIF EXPR = "{ ( StandardFields.d.mode_cntry EQ 'R' ) AND ( NOT len( g.Customer_ShipCountry ) ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Customer_ShipCountry_Invalid" VALUE = 1>
	</MvIF>

	<MvIF EXPR = "{ l.valid }">
		<MvASSIGN NAME = "g.Customer_BillFirstName" VALUE = "{ ltrim( rtrim( g.Customer_BillFirstName ) ) }">
		<MvASSIGN NAME = "g.Customer_BillLastName" VALUE = "{ ltrim( rtrim( g.Customer_BillLastName ) ) }">
		<MvASSIGN NAME = "g.Customer_BillEmail" VALUE = "{ ltrim( rtrim( g.Customer_BillEmail ) ) }">
		<MvASSIGN NAME = "g.Customer_BillCompany" VALUE = "{ ltrim( rtrim( g.Customer_BillCompany ) ) }">
		<MvASSIGN NAME = "g.Customer_BillPhone" VALUE = "{ ltrim( rtrim( g.Customer_BillPhone ) ) }">
		<MvASSIGN NAME = "g.Customer_BillFax" VALUE = "{ ltrim( rtrim( g.Customer_BillFax ) ) }">
		<MvASSIGN NAME = "g.Customer_BillAddress" VALUE = "{ ltrim( rtrim( g.Customer_BillAddress ) ) }">
		<MvASSIGN NAME = "g.Customer_BillCity" VALUE = "{ ltrim( rtrim( g.Customer_BillCity ) ) }">
		<MvASSIGN NAME = "g.Customer_BillState" VALUE = "{ ltrim( rtrim( g.Customer_BillState ) ) }">
		<MvASSIGN NAME = "g.Customer_BillStateSelect" VALUE = "{ ltrim( rtrim( g.Customer_BillStateSelect ) ) }">
		<MvASSIGN NAME = "g.Customer_BillZip" VALUE = "{ ltrim( rtrim( g.Customer_BillZip ) ) }">
		<MvASSIGN NAME = "g.Customer_BillCountry" VALUE = "{ ltrim( rtrim( g.Customer_BillCountry ) ) }">

		<MvIF EXPR = "{ ( g.Customer_BillCountry EQ '' ) }">
			<MvASSIGN NAME = "g.Customer_BillCountry" VALUE = "{ g.Customer_ShipCountry }">
		</MvIF>

		<MvIF EXPR = "{ ( g.Customer_BillFirstName EQ '' ) AND
						( g.Customer_BillLastName EQ '' ) AND
						( g.Customer_BillEmail EQ '' ) AND
						( g.Customer_BillCompany EQ '' ) AND
						( g.Customer_BillPhone EQ '' ) AND
						( g.Customer_BillFax EQ '' ) AND
						( g.Customer_BillAddress EQ '' ) AND
						( g.Customer_BillCity EQ '' ) AND
						( g.Customer_BillState EQ '' ) AND
						( g.Customer_BillStateSelect EQ '' ) AND
						( g.Customer_BillZip EQ '' ) }">
			<MvASSIGN NAME = "g.Customer_BillFirstName" VALUE = "{ g.Customer_ShipFirstName }">
			<MvASSIGN NAME = "g.Customer_BillLastName" VALUE = "{ g.Customer_ShipLastName }">
			<MvASSIGN NAME = "g.Customer_BillEmail" VALUE = "{ g.Customer_ShipEmail }">
			<MvASSIGN NAME = "g.Customer_BillCompany" VALUE = "{ g.Customer_ShipCompany }">
			<MvASSIGN NAME = "g.Customer_BillPhone" VALUE = "{ g.Customer_ShipPhone }">
			<MvASSIGN NAME = "g.Customer_BillFax" VALUE = "{ g.Customer_ShipFax }">
			<MvASSIGN NAME = "g.Customer_BillAddress" VALUE = "{ g.Customer_ShipAddress }">
			<MvASSIGN NAME = "g.Customer_BillCity" VALUE = "{ g.Customer_ShipCity }">
			<MvASSIGN NAME = "g.Customer_BillState" VALUE = "{ g.Customer_ShipState }">
			<MvASSIGN NAME = "g.Customer_BillZip" VALUE = "{ g.Customer_ShipZip }">
		<MvELSE>
			<MvIF EXPR = "{ ( StandardFields.d.mode_fname EQ 'R' ) AND ( NOT len( g.Customer_BillFirstName ) ) }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_BillFirstName_Invalid" VALUE = 1>
			</MvIF>

			<MvIF EXPR = "{ ( StandardFields.d.mode_lname EQ 'R' ) AND ( NOT len( g.Customer_BillLastName ) ) }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_BillLastName_Invalid" VALUE = 1>
			</MvIF>

			<MvIF EXPR = "{ ( StandardFields.d.mode_email EQ 'R' ) OR ( ( StandardFields.d.mode_email EQ 'R' ) AND ( NOT len( g.Customer_BillLastName ) ) ) }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.email_valid" VALUE = "{ Email_Validate( g.Customer_BillEmail ) }">
				<MvIF EXPR = "{ NOT l.email_valid }">
					<MvASSIGN NAME = "l.valid" VALUE = 0>
					<MvASSIGN NAME = "g.Customer_BillEmail_Invalid" VALUE = 1>
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ StandardFields.d.mode_phone EQ 'R' }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.phone_valid" VALUE = "{ Phone_Validate( g.Customer_BillPhone, g.Customer_BillCountry ) }">
				<MvIF EXPR = "{ NOT l.phone_valid }">
					<MvASSIGN NAME = "l.valid" VALUE = 0>
					<MvASSIGN NAME = "g.Customer_BillPhone_Invalid" VALUE = 1>
				</MvIF>
			<MvELSE>
				<MvIF EXPR = "{ len( g.Customer_BillPhone ) }">
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.phone_valid" VALUE = "{ Phone_Validate( g.Customer_BillPhone, g.Customer_BillCountry ) }">
					<MvIF EXPR = "{ NOT l.phone_valid }">
						<MvASSIGN NAME = "l.valid" VALUE = 0>
						<MvASSIGN NAME = "g.Customer_BillPhone_Invalid" VALUE = 1>
					</MvIF>
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ ( StandardFields.d.mode_fax EQ 'R' ) }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.fax_valid" VALUE = "{ Phone_Validate( g.Customer_BillFax, g.Customer_BillCountry ) }">
				<MvIF EXPR = "{ NOT l.fax_valid }">
					<MvASSIGN NAME = "l.valid" VALUE = 0>
					<MvASSIGN NAME = "g.Customer_BillFax_Invalid" VALUE = 1>
				</MvIF>
			<MvELSE>
				<MvIF EXPR = "{ len( g.Customer_BillFax ) }">
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.fax_valid" VALUE = "{ Phone_Validate( g.Customer_BillFax, g.Customer_BillCountry ) }">
					<MvIF EXPR = "{ NOT l.fax_valid }">
						<MvASSIGN NAME = "l.valid" VALUE = 0>
						<MvASSIGN NAME = "g.Customer_BillFax_Invalid" VALUE = 1>
					</MvIF>
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ ( StandardFields.d.mode_comp EQ 'R' ) AND ( NOT len( g.Customer_BillCompany ) ) }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_BillCompany_Invalid" VALUE = 1>
			</MvIF>

			<MvIF EXPR = "{ ( StandardFields.d.mode_addr EQ 'R' ) AND ( NOT len( g.Customer_BillAddress ) ) }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_BillAddress_Invalid" VALUE = 1>
			</MvIF>

			<MvIF EXPR = "{ ( StandardFields.d.mode_city EQ 'R' ) AND ( NOT len( g.Customer_BillCity ) ) }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Customer_BillCity_Invalid" VALUE = 1>
			</MvIF>

			<MvIF EXPR = "{ len( g.Customer_BillStateSelect ) }">
				<MvASSIGN NAME = "g.Customer_BillState" VALUE = "{ g.Customer_BillStateSelect }">
			<MvELSE>
				<MvIF EXPR = "{ ( StandardFields.d.mode_state EQ 'R' ) AND ( NOT len( g.Customer_BillState ) ) }">
					<MvASSIGN NAME = "l.valid" VALUE = 0>
					<MvASSIGN NAME = "g.Customer_BillState_Invalid" VALUE = 1>
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ StandardFields.d.mode_zip EQ 'R' }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.zip_valid" VALUE = "{ Zip_Validate( g.Customer_BillZip, g.Customer_BillCountry ) }">
				<MvIF EXPR = "{ NOT l.zip_valid }">
					<MvASSIGN NAME = "l.valid" VALUE = 0>
					<MvASSIGN NAME = "g.Customer_BillZip_Invalid" VALUE = 1>
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.valid }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Customer_Login" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.continue" VALUE = 1>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Customer_Login() }">

		<MvIF EXPR = "{ l.result LE 0 }">
			<MvASSIGN NAME = "l.continue" VALUE = 0>

			<MvIF EXPR = "{ l.result EQ 0 }">
				<MvASSIGN NAME = "l.ok" VALUE = 0>
			</MvIF>

			<MvWHILESTOP>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>

	<MvIF EXPR = "{ l.continue }">
		<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.found" VALUE = "{ Customer_Find_Login( g.Customer_Login ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			<MvASSIGN NAME = "g.Customer_Login_Invalid" VALUE = 1>

			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_CustomerLogin() }">
		<MvELSE>
			<MvIF EXPR = "{ g.Customer_Password NE Customers.d.password }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
				<MvASSIGN NAME = "g.Customer_Password_Invalid" VALUE = 1>

				<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_CustomerLogin() }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ BasketList_Update_Customer( g.Session_ID, Customers.d.id ) }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Customer_Login( g.Customer_Email ) }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Customer_Logout" STANDARDOUTPUTLEVEL = "">

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Basket_Delete( g.Session_ID ) }">
	<MvASSIGN NAME = "BasketList.d.cust_id" VALUE = "">

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Customer_EmailPassword" ERROROUTPUTLEVEL = "syntax, expression">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.continue" VALUE = 1>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Customer_EmailPassword() }">

		<MvIF EXPR = "{ l.result LE 0 }">
			<MvASSIGN NAME = "l.continue" VALUE = 0>

			<MvIF EXPR = "{ l.result EQ 0 }">
				<MvASSIGN NAME = "l.ok" VALUE = 0>
			</MvIF>

			<MvWHILESTOP>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>

	<MvIF EXPR = "{ l.continue }">
		<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.found" VALUE = "{ Customer_Find_Login( g.Customer_Login ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			<MvASSIGN NAME = "g.Customer_Login_Invalid" VALUE = 1>

			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_CustomerEmail() }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.found" VALUE = "{ CustomerEmail_Load() }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "l.from" VALUE = "{ CustomerEmail.d.from }">
				<MvASSIGN NAME = "l.to" VALUE = "{ Customers.d.pw_email }">
				<MvASSIGN NAME = "l.cc" VALUE = "{ CustomerEmail.d.cc }">
				<MvASSIGN NAME = "l.subject" VALUE = "{ CustomerEmail.d.subject }">
				<MvASSIGN NAME = "l.lf" VALUE = "{ asciichar( 10 ) }">
				
				<MvASSIGN NAME = "l.message" VALUE = "{ CustomerEmail.d.header $ l.lf }">

				<MvLOCALIZED NAME = "l.pass" STANDARDOUTPUTLEVEL = "text, html" ID = "MER-CUS-RT-00001">
					<MvLOCALIZED-TOKEN NAME = "password" VALUE = "{ encodeentities( Customers.d.password ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Password: %password%</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ l.pass $ l.lf }">

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ SendEmail( l.to,l.from,l.cc,l.subject,l.headers,l.message ) }">

				<MvIF EXPR = "{ NOT l.ok }">
					<MvLOCALIZED NAME = "g.Error_Send_Email" ID = "MER-CUS-RT-00000">
						<MvLOCALIZED-TOKEN NAME = "error" VALUE = "{ g.Error_Message }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Your email could not be sent at this time. The following error was encountered: %error%</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Customer_EmailPassword( g.Customer_Email ) }">
					<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_CustomerEmail() }">
				<MvELSE>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Customer_EmailPassword( g.Customer_Email ) }">
					<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_CustomerEmail_Sent() }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Customer_Update" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.continue" VALUE = 1>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Customer_Update() }">

		<MvIF EXPR = "{ l.result LE 0 }">
			<MvASSIGN NAME = "l.continue" VALUE = 0>

			<MvIF EXPR = "{ l.result EQ 0 }">
				<MvASSIGN NAME = "l.ok" VALUE = 0>
			</MvIF>

			<MvWHILESTOP>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>

	<MvIF EXPR = "{ l.continue }">
		<MvIF EXPR = "{ NOT Customer_Validate() }">
			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_UpdateCustomerInformation() }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.ok" VALUE = "{ Customer_Find_ID( BasketList.d.cust_id ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.foo" VALUE = "{ Get_StandardFields() }">
				<MvIF EXPR = "{ StandardFields.d.mode_fname NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_fname" VALUE = "{ g.Customer_ShipFirstName }">
					<MvASSIGN NAME = "Customers.d.bill_fname" VALUE = "{ g.Customer_BillFirstName }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_lname NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_lname" VALUE = "{ g.Customer_ShipLastName }">
					<MvASSIGN NAME = "Customers.d.bill_lname" VALUE = "{ g.Customer_BillLastName }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_email NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_email" VALUE = "{ g.Customer_ShipEmail }">
					<MvASSIGN NAME = "Customers.d.bill_email" VALUE = "{ g.Customer_BillEmail }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_comp NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_comp" VALUE = "{ g.Customer_ShipCompany }">
					<MvASSIGN NAME = "Customers.d.bill_comp" VALUE = "{ g.Customer_BillCompany }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_phone NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_phone" VALUE = "{ g.Customer_ShipPhone }">
					<MvASSIGN NAME = "Customers.d.bill_phone" VALUE = "{ g.Customer_BillPhone }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_fax NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_fax" VALUE = "{ g.Customer_ShipFax }">
					<MvASSIGN NAME = "Customers.d.bill_fax" VALUE = "{ g.Customer_BillFax }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_addr NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_addr" VALUE = "{ g.Customer_ShipAddress }">
					<MvASSIGN NAME = "Customers.d.bill_addr" VALUE = "{ g.Customer_BillAddress }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_city NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_city" VALUE = "{ g.Customer_ShipCity }">
					<MvASSIGN NAME = "Customers.d.bill_city" VALUE = "{ g.Customer_BillCity }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_state NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_state" VALUE = "{ g.Customer_ShipState }">
					<MvASSIGN NAME = "Customers.d.bill_state" VALUE = "{ g.Customer_BillState }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_zip NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_zip" VALUE = "{ g.Customer_ShipZip }">
					<MvASSIGN NAME = "Customers.d.bill_zip" VALUE = "{ g.Customer_BillZip }">
				</MvIF>
				<MvIF EXPR = "{ StandardFields.d.mode_cntry NE 'H' }">
					<MvASSIGN NAME = "Customers.d.ship_cntry" VALUE = "{ g.Customer_ShipCountry }">
					<MvASSIGN NAME = "Customers.d.bill_cntry" VALUE = "{ g.Customer_BillCountry }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.ok" VALUE = "{ Customer_Update( BasketList.d.cust_id, g.Customer_Login, g.Customer_PasswordEmail, g.Customer_Password, Customers.d.ship_fname, Customers.d.ship_lname, Customers.d.ship_email, Customers.d.ship_comp, Customers.d.ship_phone, Customers.d.ship_fax, Customers.d.ship_addr, Customers.d.ship_city, Customers.d.ship_state, Customers.d.ship_zip, Customers.d.ship_cntry, Customers.d.bill_fname, Customers.d.bill_lname, Customers.d.bill_email, Customers.d.bill_comp, Customers.d.bill_phone, Customers.d.bill_fax, Customers.d.bill_addr, Customers.d.bill_city, Customers.d.bill_state, Customers.d.bill_zip, Customers.d.bill_cntry ) }">

				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Customer_Update( g.Customer_ShipEmail ) }">
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Customer_Insert" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.continue" VALUE = 1>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Customer_Insert() }">

		<MvIF EXPR = "{ l.result LE 0 }">
			<MvASSIGN NAME = "l.continue" VALUE = 0>

			<MvIF EXPR = "{ l.result EQ 0 }">
				<MvASSIGN NAME = "l.ok" VALUE = 0>
			</MvIF>

			<MvWHILESTOP>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>

	<MvIF EXPR = "{ l.continue }">
		<MvIF EXPR = "{ NOT Customer_Validate() }">
			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_InsertCustomerInformation() }">
		<MvELSE>
			<MvIF EXPR = "{ BasketList.d.cust_id }">
				<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.ok" VALUE = "{ Customer_Update( BasketList.d.cust_id, g.Customer_Login, g.Customer_PasswordEmail,
																					      g.Customer_Password, g.Customer_ShipFirstName, g.Customer_ShipLastName,
																						  g.Customer_ShipEmail, g.Customer_ShipCompany, g.Customer_ShipPhone,
																						  g.Customer_ShipFax, g.Customer_ShipAddress, g.Customer_ShipCity,
																						  g.Customer_ShipState, g.Customer_ShipZip, g.Customer_ShipCountry,
																						  g.Customer_BillFirstName, g.Customer_BillLastName, g.Customer_BillEmail,
																						  g.Customer_BillCompany, g.Customer_BillPhone, g.Customer_BillFax,
																						  g.Customer_BillAddress, g.Customer_BillCity, g.Customer_BillState,
																						  g.Customer_BillZip, g.Customer_BillCountry ) }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.ok" VALUE = "{ Customer_Insert( g.Customer_Login, g.Customer_PasswordEmail,
																						  g.Customer_Password, g.Customer_ShipFirstName,
																						  g.Customer_ShipLastName, g.Customer_ShipEmail,
																						  g.Customer_ShipCompany, g.Customer_ShipPhone,
																						  g.Customer_ShipFax, g.Customer_ShipAddress,
																						  g.Customer_ShipCity, g.Customer_ShipState,
																						  g.Customer_ShipZip, g.Customer_ShipCountry,
																						  g.Customer_BillFirstName, g.Customer_BillLastName,
																						  g.Customer_BillEmail, g.Customer_BillCompany,
																						  g.Customer_BillPhone, g.Customer_BillFax,
																						  g.Customer_BillAddress, g.Customer_BillCity,
																						  g.Customer_BillState, g.Customer_BillZip,
																						  g.Customer_BillCountry ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Feature_CUS_DB }" NAME = "l.found" VALUE = "{ Customer_Find_Login( g.Customer_Login ) }">
					<MvIF EXPR = "{ l.found }">
						<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ BasketList_Update_Customer( g.Session_ID, Customers.d.id ) }">
					</MvIF>
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Customer_Insert( g.Customer_ShipEmail ) }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

