<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/
|
| Provisioning - admin Functions
| $Source: /home/cvs/merchant/Merchant/features/prv/prv_ad.mv,v $
|
| Prefix         : MER-PRV-
| Next Error Code: 85   
| Next Text ID   : 88   
|
</MvCOMMENT>

<MvFUNCTION NAME = "PRV_ProvisionAsNeeded" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvIF EXPR = "{ fexists( 'provide.dat' ) }">
		<MvASSIGN NAME = "l.ok" VALUE = "{ PRV_Action_Provision() }">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Provision" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvASSIGN NAME = "g.PRV_line" VALUE = "0">
	<MvASSIGN NAME = "l.save_store_code" VALUE = "{ Stores.d.code }">
	<MvASSIGN NAME = "l.save_user_id" VALUE = "{ Users.d.id }">
	<MvASSIGN NAME = "g.PRV_Save_Provisioning_File" VALUE = "0">
	
	<MvLOCALIZED NAME = "l.message" ID = "MER-PRV-00000">
		<MvLOCALIZED-TOKEN NAME = "size" VALUE = "{ fsize( 'provide.dat' ) }">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Provisioning from 'provide.dat' with a size of %size% bytes.</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogMessage( l.message ) }">
		
	<MvIMPORT FILE = "provide.dat"
					  FIELDS = "l.product, l.version, l.store_code, l.type, l.code, l.delimiter, l.data"
					  DELIMITER = "|">
		<MvASSIGN NAME = "l.ok" VALUE = "1">
		<MvASSIGN NAME = "g.PRV_line" VALUE = "{ g.PRV_line + 1 }">

		<MvASSIGN NAME = "l.product" value = "{ toupper(ltrim( rtrim( l.product ) ) ) }">					  
		<MvIF EXPR = "{ l.product EQ 'MERCHANT'}">
			<MvASSIGN NAME = "l.version" value = "{ ltrim( rtrim( l.version ) ) }">
			<MvASSIGN NAME = "l.store_code" value = "{ ltrim( rtrim( l.store_code ) ) }">
			<MvASSIGN NAME = "l.type" value = "{ toupper( ltrim( rtrim( l.type ) ) )}">
			<MvASSIGN NAME = "l.code" value = "{ ltrim( rtrim( l.code ) ) }">
			<MvASSIGN NAME = "l.delimiter" value = "{ ltrim( rtrim( l.delimiter ) ) }">
			<MvIF EXPR = "{ len( l.store_code ) }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Open_Store( l.store_code ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok AND (l.type EQ 'MODULE' ) }">
				<MvASSIGN NAME = "l.ok" VALUE = "{ PRV_Action_Provision_Module( l.version, l.store_code, l.type, l.code, l.delimiter, l.data ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok AND (l.type EQ 'ACTION' )}">
				<MvASSIGN NAME = "l.ok" VALUE = "{ PRV_Action_Provision_Action( l.version, l.store_code, l.type, l.code, l.delimiter, l.data ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok AND (l.type EQ 'COMMAND' )}">
				<MvASSIGN NAME = "l.ok" VALUE = "{ PRV_Action_Provision_Command( l.code, l.delimiter, l.data ) }">
			</MvIF>

			<MvIF EXPR = "{ NOT l.ok }">
				<MvASSIGN NAME = "l.null" VALUE = "{ PRV_ErrorMessage( ) }">
				<!--MvIMPORTSTOP-->
			</MvIF>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Close_Store() }">
		</MvIF>
	</MvIMPORT>
	
	<MvIF EXPR = "{ NOT g.PRV_Save_Provisioning_File }">
		<MvASSIGN NAME = "l.null" VALUE = "{ fdelete( 'provide.dat' ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.save_store_code NE Stores.d.code }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Open_Store( l.save_store_code ) }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( g.Admin_User_ID ) }">

	<MvASSIGN NAME = "g.Admin_User_Administrator" VALUE = "{ Users.d.admin }">

	<MvIF EXPR = "{ NOT( g.Admin_User_PageLen ) }">
		<MvASSIGN NAME = "g.Admin_User_PageLen" VALUE = "{ Users.d.page_len }">
	</MvIF>

	<MvASSIGN NAME = "g.Admin_User_Create" VALUE = "{ Users.d.create }">
			
	
	<MvFUNCTIONRETURN VALUE = "1">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Provision_Command" PARAMETERS = "action, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvASSIGN NAME = "l.action" VALUE = "{ toupper( l.action ) }">
	<MvIF EXPR = "{ l.action EQ 'CLEAR_LOG' }">
		<MvASSIGN NAME = "l.null" VALUE = "{ fdelete( 'provide.log' ) }">
		<MvFUNCTIONRETURN VALUE = "1">
	</MvIF>
	<MvIF EXPR = "{ l.action EQ 'SAVE_PROVIDE_DAT' }">
		<MvASSIGN NAME = "g.PRV_Save_Provisioning_File" VALUE = "1">
		<MvFUNCTIONRETURN VALUE = "1">
	</MvIF>
	<MvIF EXPR = "{ l.action EQ 'INSERT_MESSAGE' }">
		<MvASSIGN NAME = "l.ok" VALUE = "{ PRV_Command_Insert_Message( l.action, l.delimiter, l.data ) }" VALUE = "1">
		<MvFUNCTIONRETURN VALUE = "1">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Command_Insert_Message" PARAMETERS = "action, delimiter, data">
	<MvIF EXPR = "{ len( l.data ) }"> 
		<MvASSIGN NAME = "l.message" VALUE = "{ l.data }">
	<MvELSE>
		<MvLOCALIZED NAME = "l.message" ID = "MER-PRV-00000">
			<MvLOCALIZED-TOKEN NAME = "size" VALUE = "{ fsize( 'provide.dat' ) }">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Provisioning from 'provide.dat' with a size of %size% bytes.</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
	</MvIF>
	
	<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogMessage( l.message ) }">

	<MvFUNCTIONRETURN VALUE = "1">

</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Provision_Module" PARAMETERS = "version, store_code, type, code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.code ) }">
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version LT 4.0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00001">
				<MvLOCALIZED-TOKEN NAME = "module_name" VALUE = "{ Modules.d.name }">
				<MvLOCALIZED-TOKEN NAME = "module_version" VALUE = "{ l.module_api_version }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					Provisioning requires a module API of 4.00 or greater. Module '%module_name%' has an API version of %module_version%.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00000', l.error ) }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.version) AND (l.module_api_version LT l.version) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00002">
			<MvLOCALIZED-TOKEN NAME = "module_name" VALUE = "{ Modules.d.name }">
			<MvLOCALIZED-TOKEN NAME = "module_version" VALUE = "{ l.module_api_version }">
			<MvLOCALIZED-TOKEN NAME = "version" VALUE = "{ l.version }">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Provisioning requires a module API of %version% or greater for this item. Module '%module_name%' has an API version of %module_version%.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00001', l.error ) }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.store_code ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ StoreModule_Find_ID( Modules.d.id ) }">	
		<MvIF EXPR = "{ NOT l.ok }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00003">
				<MvLOCALIZED-TOKEN NAME = "module_name" VALUE = "{ Modules.d.name }">
				<MvLOCALIZED-TOKEN NAME = "store_name" VALUE = "{ Stores.d.name }">

				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Module '%module_name%' is not installed in store '%store_name%'</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00002', l.error ) }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.provisionable" VALUE = "{ Module_Is_Provisionable() }">
		<MvIF EXPR = "{ NOT l.provisionable }">
			<MvLOCALIZED NAME = "error" ID = "MER-PRV-00004">
				<MvLOCALIZED-TOKEN NAME = "module_name" VALUE = "{ Modules.d.name }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Module '%module_name%' is not provisionable.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00003', l.error ) }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Provision( l.version, l.store_code, l.delimiter, l.data ) }">					
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Provision_Action" PARAMETERS = "version, store_code, type, action, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.action" VALUE = "{ toupper( l.action ) }">
	
	<MvCOMMENT>
	|
	| Domain level actions, no store required
	|
	</MvCOMMENT>

	<MvIF EXPR = "{ l.action EQ 'ADD_UPDATE_STORE_SETTINGS' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Add_Store( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DELETE_STORE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>

	<MvIF EXPR = "{ l.action EQ 'DOMAIN_UPDATE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Update( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DOMAIN_UPDATE_ADMINDISABLING' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Update_AdminDisabling( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DOMAIN_UPDATE_NOTIFICATIONSETTINGS' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Update_NotificationSettings( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>

	<MvIF EXPR = "{ l.action EQ 'DOMAIN_ADD_UPDATE_USER' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Add_Update_User( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DOMAIN_DELETE_USER' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Delete_User( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DOMAIN_INSTALL_MODULE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Install_Module( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DOMAIN_UNINSTALL_MODULE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Uninstall_Module( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DOMAIN_ACTIVATE_MODULE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Activate_Module( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DOMAIN_DEACTIVATE_MODULE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Domain_Dectivate_Module( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'ADD_NOTE' }">
		<MvDO FILE = "{ g.Module_Feature_NOT }" NAME = "l.ok" VALUE = "{ NOT_Provision_Add_Note( l.version, l.store_code, l.delimiter, l.data ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'CLEAR_TASKS' }">
		<MvDO FILE = "{ g.Module_Feature_STP_AD }" NAME = "l.ok" VALUE = "{ STP_Provision_Clear_Tasks( l.version, l.store_code, l.delimiter, l.data ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'ADD_UPDATE_TASK' }">
		<MvDO FILE = "{ g.Module_Feature_STP_AD }" NAME = "l.ok" VALUE = "{ STP_Provision_Add_Update_Task( l.version, l.store_code, l.delimiter, l.data ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'DELETE_TASKS' }">
		<MvDO FILE = "{ g.Module_Feature_STP_AD }" NAME = "l.ok" VALUE = "{ STP_Provision_Task_Delete( l.version, l.store_code, l.delimiter, l.data ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvCOMMENT>
	|
	| Store level actions - check store first
	|
	</MvCOMMENT>
	<MvIF EXPR = "{ NOT len( l.store_code ) }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Error_StoreRequired( 'STORE_CODE' ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORETASK_UPDATE_COMPLETED' }">
		<MvDO FILE = "{ g.Module_Feature_STP_AD }" NAME = "l.ok" VALUE = "{ STP_Provision_StoreTask_Completed( l.version, l.store_code, l.delimiter, l.data ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvIF EXPR = "{ l.action EQ 'STORE_UPDATE_CUSTOMERFIELDS' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Update_Store_StandardFields( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>

	<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_STATE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Add_Update_State( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_STATE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete_State( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_CLEAR_STATE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Clear_State( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_COUNTRY' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Add_Update_Country( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_COUNTRY' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete_Country( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_CLEAR_COUNTRY' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Clear_Country( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>

	<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_GROUP' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Add_Update_Group( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_GROUP' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete_Group( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_GROUP_ADD_USER' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Group_Add_User( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_GROUP_REMOVE_USER' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Group_Remove_User( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_INSTALL_MODULE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Install_Module( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_UNINSTALL_MODULE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Uninstall_Module( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_PRODUCT' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Add_Update_Product( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_ATTRIBUTE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Add_Update_Attribute( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_ATTRIBUTE' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete_Attribute( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_OPTION' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Add_Update_Option( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_OPTION' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete_Option( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_PRODUCT' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete_Product( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_CATEGORY' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Add_Update_Category( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_CATEGORY' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Delete_Category( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_CATEGORY_ADD_PRODUCT' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Category_ADD_PRODUCT( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.action EQ 'STORE_CATEGORY_REMOVE_PRODUCT' }">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Action_Store_Category_Remove_Product( l.version, l.store_code, l.delimiter, l.data ) }">
	</MvIF>
	
	<MvCOMMENT>
	|
	| Customers
	|
	</MvCOMMENT>
	
	<MvIF EXPR = "{ g.Features:Customers:Enabled }">
		<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_CUSTOMER' }">
			<MvDO FILE = "{ g.Module_Feature_CUS }" NAME = "l.ok" VALUE = "{ CUS_Provision_Add_Update_Customer( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_CUSTOMER' }">
			<MvDO FILE = "{ g.Module_Feature_CUS }" NAME = "l.ok" VALUE = "{ CUS_Provision_Delete_Customer( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvIF EXPR = "{ g.Features:AvailabilityGroups:Enabled }">
			<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_AVAILABILITYGROUP' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_Add_Update_AvailabilityGroup( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_AVAILABILITYGROUP' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_Delete_AvailabilityGroup( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_AVAILABILITYGROUP_ADD_CUSTOMER' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_AvailabilityGroup_Add_Customer( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_AVAILABILITYGROUP_REMOVE_CUSTOMER' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_AvailabilityGroup_Remove_Customer( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_AVAILABILITYGROUP_ADD_PRODUCT' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_AvailabilityGroup_Add_Product( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_AVAILABILITYGROUP_REMOVE_PRODUCT' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_AvailabilityGroup_Remove_Product( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_AVAILABILITYGROUP_ADD_CATEGORY' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_AvailabilityGroup_Add_Category( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_AVAILABILITYGROUP_REMOVE_CATEGORY' }">
				<MvDO FILE = "{ g.Module_Feature_AGR_AD }" NAME = "l.ok" VALUE = "{ AGR_Provision_AvailabilityGroup_Remove_Category( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>
		</MvIF>	

		<MvIF EXPR = "{ g.Features:PriceGroups:Enabled }">
			<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_PRICEGROUP' }">
				<MvDO FILE = "{ g.Module_Feature_PGR_AD }" NAME = "l.ok" VALUE = "{ PGR_Provision_Add_Update_PriceGroup( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_PRICEGROUP' }">
				<MvDO FILE = "{ g.Module_Feature_PGR_AD }" NAME = "l.ok" VALUE = "{ PGR_Provision_Delete_PriceGroup( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_PRICEGROUP_ADD_CUSTOMER' }">
				<MvDO FILE = "{ g.Module_Feature_PGR_AD }" NAME = "l.ok" VALUE = "{ PGR_Provision_PriceGroup_Add_Customer( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_PRICEGROUP_REMOVE_CUSTOMER' }">
				<MvDO FILE = "{ g.Module_Feature_PGR_AD }" NAME = "l.ok" VALUE = "{ PGR_Provision_PriceGroup_Remove_Customer( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_PRICEGROUP_ADD_PRODUCT' }">
				<MvDO FILE = "{ g.Module_Feature_PGR_AD }" NAME = "l.ok" VALUE = "{ PGR_Provision_PriceGroup_Add_Product( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>

			<MvIF EXPR = "{ l.action EQ 'STORE_PRICEGROUP_REMOVE_PRODUCT' }">
				<MvDO FILE = "{ g.Module_Feature_PGR_AD }" NAME = "l.ok" VALUE = "{ PGR_Provision_PriceGroup_Remove_Product( l.version, l.store_code, l.delimiter, l.data ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>
		</MvIF>	
	</MvIF>	

	<MvCOMMENT>
	|
	| Related Products
	|
	</MvCOMMENT>
	
	<MvIF EXPR = "{ g.Features:RelatedProducts:Enabled }">
		<MvIF EXPR = "{ l.action EQ 'STORE_RELATEDPRODUCTS_ADD_PRODUCT' }">
			<MvDO FILE = "{ g.Module_Feature_RPD_AD }" NAME = "l.ok" VALUE = "{ RPD_Provision_Relatedproducts_Add_Product( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvIF EXPR = "{ l.action EQ 'STORE_RELATEDPRODUCTS_REMOVE_PRODUCT' }">
			<MvDO FILE = "{ g.Module_Feature_RPD_AD }" NAME = "l.ok" VALUE = "{ RPD_Provision_Relatedproducts_Remove_Product( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>
	
	<MvCOMMENT>
	|
	| Attribute Templates
	|
	</MvCOMMENT>
	
	<MvIF EXPR = "{ g.Features:AttributeTemplates:Enabled }">
		<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_ATTRIBUTETEMPLATE' }">
			<MvDO FILE = "{ g.Module_Feature_ATT }" NAME = "l.ok" VALUE = "{ ATT_Provision_Add_Update_AttributeTemplate( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		
		<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_ATTRIBUTETEMPLATEATTRIBUTE' }">
			<MvDO FILE = "{ g.Module_Feature_ATT }" NAME = "l.ok" VALUE = "{ ATT_Provision_Add_Update_AttributeTemplateAttribute( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		
		<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_ATTRIBUTETEMPLATEATTRIBUTE' }">
			<MvDO FILE = "{ g.Module_Feature_ATT }" NAME = "l.ok" VALUE = "{ ATT_Provision_Delete_AttributeTemplateAttribute( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		
		<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_ATTRIBUTETEMPLATEOPTION' }">
			<MvDO FILE = "{ g.Module_Feature_ATT }" NAME = "l.ok" VALUE = "{ ATT_Provision_Add_Update_AttributeTemplateOption( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		
		<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_ATTRIBUTETEMPLATEOPTION' }">
			<MvDO FILE = "{ g.Module_Feature_ATT }" NAME = "l.ok" VALUE = "{ ATT_Provision_Delete_AttributeTemplateOption( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		
		<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_ATTRIBUTETEMPLATE' }">
			<MvDO FILE = "{ g.Module_Feature_ATT }" NAME = "l.ok" VALUE = "{ ATT_Provision_Delete_AttributeTemplate( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvCOMMENT>
	|
	| Affiliates
	|
	</MvCOMMENT>
	
	<MvIF EXPR = "{ g.Features:Affiliates:Enabled }">
		<MvIF EXPR = "{ l.action EQ 'STORE_UPDATE_AFFILIATEMANAGE' }">
			<MvDO FILE = "{ g.Module_Feature_AFF }" NAME = "l.ok" VALUE = "{ AFF_Provision_Update_AffiliateManage( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvIF EXPR = "{ l.action EQ 'STORE_UPDATE_AFFILIATEEMAIL' }">
			<MvDO FILE = "{ g.Module_Feature_AFF }" NAME = "l.ok" VALUE = "{ AFF_Provision_Update_AffiliateEmail( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		
		<MvIF EXPR = "{ l.action EQ 'STORE_UPDATE_AFFILIATEOPTIONS' }">
			<MvDO FILE = "{ g.Module_Feature_AFF }" NAME = "l.ok" VALUE = "{ AFF_Provision_Update_AffiliateOptions( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		
		<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_AFFILIATE' }">
			<MvDO FILE = "{ g.Module_Feature_AFF }" NAME = "l.ok" VALUE = "{ AFF_Provision_Add_Update_Affiliate( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_AFFILIATE' }">
			<MvDO FILE = "{ g.Module_Feature_AFF }" NAME = "l.ok" VALUE = "{ AFF_Provision_Delete_Affiliate( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvCOMMENT>
	|
	| Inventory
	|
	</MvCOMMENT>
	
	<MvIF EXPR = "{ g.Features:Inventory:Enabled }">
		<MvIF EXPR = "{ l.action EQ 'STORE_UPDATE_INVENTORYSETTINGS' }">
			<MvDO FILE = "{ g.Module_Feature_INV_AD }" NAME = "l.ok" VALUE = "{ INV_Provision_Update_InventorySettings( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_INVENTORYPRODUCTSETTINGS' }">
			<MvDO FILE = "{ g.Module_Feature_INV_AD }" NAME = "l.ok" VALUE = "{ INV_Provision_Add_Update_InventoryProductSettings( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_INVENTORYPRODUCTSETTINGS' }">
			<MvDO FILE = "{ g.Module_Feature_INV_AD }" NAME = "l.ok" VALUE = "{ INV_Provision_Delete_InventoryProductSettings( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvCOMMENT>
	|
	| Upsell
	|
	</MvCOMMENT>
	
	<MvIF EXPR = "{ g.Features:Upsale:Enabled }">
		<MvIF EXPR = "{ l.action EQ 'STORE_UPDATE_UPSELLOPTIONS' }">
			<MvDO FILE = "{ g.Module_Feature_USL_AD }" NAME = "l.ok" VALUE = "{ USL_Provision_Update_UpsellOptions( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		<MvIF EXPR = "{ l.action EQ 'STORE_ADD_UPDATE_UPSELL' }">
			<MvDO FILE = "{ g.Module_Feature_USL_AD }" NAME = "l.ok" VALUE = "{ USL_Provision_Add_Update_Upsell( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		<MvIF EXPR = "{ l.action EQ 'STORE_DELETE_UPSELL' }">
			<MvDO FILE = "{ g.Module_Feature_USL_AD }" NAME = "l.ok" VALUE = "{ USL_Provision_Delete_Upsell( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		<MvIF EXPR = "{ l.action EQ 'STORE_UPSELL_ADD_PRODUCT' }">
			<MvDO FILE = "{ g.Module_Feature_USL_AD }" NAME = "l.ok" VALUE = "{ USL_Provision_Upsell_Add_Product( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
		<MvIF EXPR = "{ l.action EQ 'STORE_UPSELL_REMOVE_PRODUCT' }">
			<MvDO FILE = "{ g.Module_Feature_USL_AD }" NAME = "l.ok" VALUE = "{ USL_Provision_Upsell_Remove_Product( l.version, l.store_code, l.delimiter, l.data ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00005">
		<MvLOCALIZED-TOKEN NAME = "action" VALUE = "{ l.action }">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">'%action%' is not a valid action.</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00004', l.error ) }">

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

<MvFUNCTION NAME = "PRV_Action_Add_Store" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Close_Store() }">

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

	<MvASSIGN NAME = "l.manager" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.license" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.store_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.owner" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.email" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.company" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.address" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.city" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.state" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.zip" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.country" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.phone" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.fax" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.weight_units" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.basket_expiration" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.price_group_overlap" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.module_ui" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.module_currency" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.module_tax" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.order_start" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.maintenance" VALUE = "{ toupper( substring( ltrim( gettoken( l.data, l.delimiter, l.pos ) ),1 ,1 ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.maintenance_new" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.maintenance_warning" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.maintenance_message" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.omin_quant" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.omin_price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.omin_all" VALUE = "{ toupper( substring( ltrim( gettoken( l.data, l.delimiter, l.pos ) ), 1, 1 ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.omin_msg" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.omin_all" VALUE = "{ PRV_Parse_Boolean( l.omin_all ) }">
	<MvASSIGN NAME = "l.maint" VALUE = "{ PRV_Parse_Boolean( l.maintenance ) }">

	<MvIF EXPR = "{ l.maint }">
		<MvASSIGN NAME = "l.maintenance_time" VALUE = "{ s.time_t }">
	<MvELSE>
		<MvASSIGN NAME = "l.maintenance_time" VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_Name( l.manager ) }">
		<MvIF EXPR = "{ NOT l.ok }">
			<MvFUNCTIONRETURN VALUE = 0>
		</MvIF>
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Store_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
		<MvASSIGN NAME = "l.ok" VALUE = "{ PRV_Action_Update_Store( l.manager, l.code, l.license, l.store_name, l.owner, 
															  l.email, l.company, l.address, l.city, l.state, l.zip,
															  l.country, l.phone, l.fax, l.weight_units, l.basket_expiration,
															  l.price_group_overlap, l.module_ui, l.module_currency,
															  l.module_tax, l.order_start, l.maintenance_time, l.maintenance_new, 
															  l.maintenance_warning, l.maintenance_message, l.omin_quant, 
															  l.omin_price, l.omin_all, l.omin_msg ) }">		
	<MvELSE>
		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.module_ui ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.module_ui_id" VALUE = "{ Modules.d.id }">
				<MvASSIGN NAME = "g.Store_Module_UI" VALUE = "{ Modules.d.module }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.module_currency ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.module_currency_id" VALUE = "{ Modules.d.id }">
				<MvASSIGN NAME = "g.Store_Module_Currency" VALUE = "{ Modules.d.module }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.module_tax ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.module_tax_id" VALUE = "{ Modules.d.id }">
				<MvASSIGN NAME = "g.Store_Module_Tax" VALUE = "{ Modules.d.module }">
			</MvIF>
		</MvIF>

<MvCOMMENT>
We must change the error messages to something like "A store code must be specified" in the future.
</MvCOMMENT>

		<MvIF EXPR = "{ l.ok }">
			<MvIF EXPR = "{ NOT len( l.code ) }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00054">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a store code</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00008', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ NOT len( l.store_name ) }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00055">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a store name</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00009', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ len( l.email ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00056">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's email address</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00052', l.error ) }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( l.email ) }">
				<MvIF EXPR = "{ NOT l.valid }">
					<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00057">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a valid email address</MvLOCALIZED-TEXT>
					</MvLOCALIZED>

					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00053', l.error ) }">
				</MvIF>		
			</MvIF>

			<MvIF EXPR = "{ len( l.owner ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00058">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's name</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00054', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ len( l.address ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00059">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's address</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00055', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ len( l.city ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00060">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's city</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00056', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ len( l.state ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00061">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's state</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00057', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ len( l.zip ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00062">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's Zip/Postal code</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00058', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ len( l.country ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00063">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's country</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00059', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ len( l.phone ) EQ 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00064">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's phone number</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00060', l.error ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.inuse" VALUE = "{ Store_License_In_Use( Domain.d.license ) }">
				<MvIF EXPR = "{ NOT l.inuse }">
					<MvASSIGN NAME = "l.license" VALUE = "{ Domain.d.license }">
				<MvELSE>
					<MvIF EXPR = "{ len( l.license ) EQ 0 }">
						<MvLOCALIZED NAME = "l.error" ID = "MER-ADM-00192">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a license number</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00005', l.error ) }">
					<MvELSE>
						<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.inuse" VALUE = "{ Store_License_In_Use( l.license ) }">
						<MvIF EXPR = "{ l.inuse }">
							<MvLOCALIZED NAME = "l.error" ID = "MER-ADM-00193">
								<MvLOCALIZED-TOKEN NAME = "license" VALUE = "{ g.Store_License }">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Sorry, you are already using license number '%license%' for another storefront. Please check your records and try again.</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00006', l.error ) }">
						</MvIF>

						<MvASSIGN NAME = "API" VALUE = "{ s.apitype }">
						<MvASSIGN NAME = "MERCHANT_HOST" VALUE = "{ s.server_name }">
						<MvASSIGN NAME = "LICENSE_NUMBER" VALUE = "{ l.license }">
						<MvASSIGN NAME = "MERCHANT_VERSION" VALUE = "{ Domain.d.version }">
						<MvASSIGN NAME = "NAME" VALUE = "{ l.owner }">
						<MvASSIGN NAME = "COMPANY" VALUE = "{ l.company }">
						<MvASSIGN NAME = "ADDRESS" VALUE = "{ l.address }">
						<MvASSIGN NAME = "CITY" VALUE = "{ l.city }">
						<MvASSIGN NAME = "STATE" VALUE = "{ l.state }">
						<MvASSIGN NAME = "ZIP" VALUE = "{ l.zip }">
						<MvASSIGN NAME = "COUNTRY" VALUE = "{ l.country }">
						<MvASSIGN NAME = "PHONE" VALUE = "{ l.phone }">
						<MvASSIGN NAME = "FAX" VALUE = "{ l.fax }">
						<MvASSIGN NAME = "EMAIL" VALUE = "{ l.email }">
						<MvASSIGN NAME = "PRODUCT_TYPE" VALUE = "STOREFRONT">
						<MvASSIGN NAME = "PRODUCT_LINE" VALUE = "MERCHANT">
						<MvASSIGN NAME = "OPERATIONS" VALUE = "REGISTER">
						<MvASSIGN NAME = "LANGUAGE" VALUE = "{ s.miva_language }">
						<MvASSIGN NAME = "MERCHANT_STOREURL" VALUE = "{ Domain.d.mm_url }">

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

						<MvCALL METHOD = "POST"
								ACTION = "http://licensemgr.miva.com/gateway/gateway.mv"
								FIELDS = "MERCHANT_HOST, API, LICENSE_NUMBER, MERCHANT_VERSION, NAME, COMPANY, ADDRESS,
										  CITY, STATE, ZIP, COUNTRY, PHONE, FAX, EMAIL, PRODUCT_LINE, PRODUCT_TYPE, LANGUAGE, MERCHANT_STOREURL">
							<MvIF EXPR = "{ s.callobjectelement EQ 'LmLICENSE' }">
								<MvASSIGN NAME = "l.attribute" VALUE = 1>
								<MvWHILE EXPR = "{ ( l.attribute LE s.callobjectnumattributes ) }">
									<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'VALID' }">
										<MvASSIGN NAME = "l.valid_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
									</MvIF>
									<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'ERROR_CODE' }">
										<MvASSIGN NAME = "l.error_code_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
									</MvIF>
									<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'ERROR_MESSAGE' }">
										<MvASSIGN NAME = "l.error_message_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
									</MvIF>
									<MvASSIGN NAME = "l.attribute" VALUE = "{ l.attribute + 1 }">
								</MvWHILE>
							</MvIF>
						</MvCALL>

						<MvIF EXPR = "{ toupper( l.valid_value ) EQ 'YES' }">
							<MvASSIGN NAME = "l.valid" VALUE = "1">
						<MvELSE>
							<MvASSIGN NAME = "l.error_message_value" VALUE = "{ ltrim( rtrim( l.error_message_value ) ) }">
							<MvASSIGN NAME = "l.error_code_value" VALUE = "{ ltrim( rtrim( l.error_code_value ) ) }">
							<MvIF EXPR = "{ NOT len( l.error_message_value ) }">
								<MvIF EXPR = "{ len( l.error_code_value ) }">
									<MvASSIGN NAME = "l.error_text" VALUE = "{ l.error_code_value }">
								</MvIF>
							<MvELSE>
								<MvASSIGN NAME = "l.error_text" VALUE = "{ l.error_message_value }">
							</MvIF>
						</MvIF>

						<MvIF EXPR = "{ NOT l.valid }">
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00007', l.error_text $ l.license) }">
						</MvIF>
					</MvIF>
				</MvIF>
			</MvIF>
			
			<MvIF EXPR = "{ toupper( l.weight_units ) EQ '#NONE' }">
				<MvASSIGN NAME = "l.weight_units" VALUE = "">
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.id" VALUE = "{ Store_Create( Users.d.id, l.code, l.license, l.store_name, l.owner, l.email, l.company, l.address, l.city, l.state, l.zip, l.country, l.phone, l.fax, l.weight_units, l.basket_expiration, l.price_group_overlap, l.module_ui_id, l.module_currency_id, l.module_tax_id, l.order_start, l.maintenance_time, l.maintenance_new, l.maintenance_warning, l.maintenance_message, l.omin_quant, l.omin_price, l.omin_all, l.omin_msg ) }">
			</MvIF>

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

			<MvIF EXPR = "{ l.ok AND len( l.module_tax ) }">		
				<MvDO FILE = "{ g.Module_Root $ g.Store_Module_Tax }" NAME = "l.ok" VALUE = "{ Module_Install_Store() }">
			<MvELSE>
				<MvFUNCTIONRETURN VALUE = 0>
			</MvIF>

			<MvIF EXPR = "{ l.ok AND len( l.module_currency ) }">
				<MvDO FILE = "{ g.Module_Root $ g.Store_Module_Currency }" NAME = "l.ok" VALUE = "{ Module_Install_Store() }">
			<MvELSE>
				<MvFUNCTIONRETURN VALUE = 0>
			</MvIF>

			<MvIF EXPR = "{ l.ok AND len( l.module_ui ) }">
				<MvDO FILE = "{ g.Module_Root $ g.Store_Module_UI }" NAME = "l.ok" VALUE = "{ Module_Install_Store() }">
			<MvELSE>
				<MvFUNCTIONRETURN VALUE = 0>
			</MvIF>

			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Close_Store() }">
		</MvIF>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Update_Store" PARAMETERS = "manager, code, license, store_name, owner,
															email, company, address, city, state, zip,
															country, phone, fax, weight_units, basket_expiration,
															price_group_overlap, module_ui, module_currency,
															module_tax, order_start, maintenance_time, maintenance_new, 
															maintenance_warning, maintenance_message, omin_quant, 
															omin_price, omin_all, omin_msg" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Open_Store( l.code ) }">

	<MvIF EXPR = "{ len( l.manager ) }">
		<MvASSIGN NAME = "Stores.d.manager_id" VALUE = "{ l.manager }">
	</MvIF>

	<MvIF EXPR = "{ len( l.license ) }">
		<MvASSIGN NAME = "Stores.d.license" VALUE = "{ l.license }">
	</MvIF>

	<MvIF EXPR = "{ len( l.store_name ) }">
		<MvASSIGN NAME = "Stores.d.name" VALUE = "{ l.store_name }">
	</MvIF>

	<MvIF EXPR = "{ len( l.company ) }">
		<MvIF EXPR = "{ toupper( l.company ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Stores.d.company" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Stores.d.company" VALUE = "{ l.company }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.fax ) }">
		<MvIF EXPR = "{ toupper( l.fax ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Stores.d.fax" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Stores.d.fax" VALUE = "{ l.fax }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.weight_units ) }">
		<MvIF EXPR = "{ toupper( l.weight_units ) }">
			<MvASSIGN NAME = "Stores.d.wtunits" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Stores.d.wtunits" VALUE = "{ l.weight_units }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.basket_expiration ) }">
		<MvASSIGN NAME = "Stores.d.baskexp" VALUE = "{ l.basket_expiration }">
	</MvIF>

	<MvIF EXPR = "{ len( l.price_group_overlap ) }">
		<MvASSIGN NAME = "Stores.d.pgrp_ovlp" VALUE = "{ l.price_group_overlap }">
	</MvIF>

	<MvIF EXPR = "{ len( l.maintenance_time ) }">
		<MvASSIGN NAME = "Stores.d.mnt_time" VALUE = "{ l.maintenance_time }">
	</MvIF>

	<MvIF EXPR = "{ len( l.maintenance_new ) }">
		<MvASSIGN NAME = "Stores.d.mnt_no_new" VALUE = "{ l.maintenance_new }">
	</MvIF>

	<MvIF EXPR = "{ len( l.maintenance_warning ) }">
		<MvASSIGN NAME = "Stores.d.mnt_warn" VALUE = "{ l.maintenance_warning }">
	</MvIF>

	<MvIF EXPR = "{ len( l.maintenance_message ) }">
		<MvASSIGN NAME = "Stores.d.mnt_close" VALUE = "{ l.maintenance_message }">
	</MvIF>

	<MvIF EXPR = "{ len( l.omin_quant ) }">
		<MvASSIGN NAME = "Stores.d.omin_quant" VALUE = "{ l.omin_quant }">
	</MvIF>

	<MvIF EXPR = "{ len( l.omin_price ) }">
		<MvASSIGN NAME = "Stores.d.omin_price" VALUE = "{ l.omin_price }">
	</MvIF>

	<MvIF EXPR = "{ len( l.omin_all ) }">
		<MvASSIGN NAME = "Stores.d.omin_all" VALUE = "{ l.omin_all }">
	</MvIF>

	<MvIF EXPR = "{ len( l.omin_msg ) }">
		<MvASSIGN NAME = "Stores.d.omin_msg" VALUE = "{ l.omin_msg }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.module_tax ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.module_tax ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "l.module_tax_id" VALUE = "{ Modules.d.id }">
			<MvASSIGN NAME = "g.Store_Module_Tax" VALUE = "{ Modules.d.module }">
		</MvIF>
		<MvIF EXPR = "{ l.module_tax_id NE Stores.d.tax_id }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_ID( Stores.d.tax_id ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Root $ g.Store_Module_Tax }" NAME = "l.ok" VALUE = "{ Module_Install_Store() }">
				</MvIF>
			</MvIF>
			
			<MvASSIGN NAME = "Stores.d.tax_id" VALUE = "{ l.module_tax_id }">

			<MvIF EXPR = "{ l.ok }">		
				<MvDO FILE = "{ g.Module_Root $ g.Store_Module_Tax }" NAME = "l.ok" VALUE = "{ Module_Store_Update() }">
			</MvIF>
		</MvIF>
	</MvIF>
	
	<MvIF EXPR = "{ l.ok AND len( l.module_currency ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.module_currency ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "l.module_currency_id" VALUE = "{ Modules.d.id }">
			<MvASSIGN NAME = "g.Store_Module_Currency" VALUE = "{ Modules.d.module }">
		</MvIF>
		<MvIF EXPR = "{ l.module_currency_id NE Stores.d.currncy_id }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_ID( Stores.d.currncy_id ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Root $ g.Store_Module_Currency }" NAME = "l.ok" VALUE = "{ Module_Install_Store() }">
				</MvIF>
			</MvIF>

			<MvASSIGN NAME = "Stores.d.currncy_id" VALUE = "{ l.module_currency_id }">

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Root $ g.Store_Module_Currency }" NAME = "l.ok" VALUE = "{ Module_Store_Update() }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.module_ui ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.module_ui ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "l.module_ui_id" VALUE = "{ Modules.d.id }">
			<MvASSIGN NAME = "g.Store_Module_UI" VALUE = "{ Modules.d.module }">
		</MvIF>
		<MvIF EXPR = "{ l.module_ui_id NE Stores.d.ui_id }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_ID( Stores.d.ui_id ) }">
			<MvIF EXPR = "{ l.ok }">
			
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Root $ g.Store_Module_UI }" NAME = "l.ok" VALUE = "{ Module_Install_Store() }">
				</MvIF>
			</MvIF>
			
			<MvASSIGN NAME = "Stores.d.ui_id" VALUE = "{ l.module_ui_id }">

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Root $ g.Store_Module_UI }" NAME = "l.ok" VALUE = "{ Module_Store_Update() }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.email ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00065">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's email address</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00061', l.error ) }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( l.email ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00066">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a valid email address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00062', l.error ) }">
		<MvELSE>
			<MvASSIGN NAME = "Stores.d.email" VALUE = "{ l.email }">		
		</MvIF>		
	</MvIF>

	<MvIF EXPR = "{ len( l.owner ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00067">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's name</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00063', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Stores.d.owner" VALUE = "{ l.owner }">		
	</MvIF>
	
	<MvIF EXPR = "{ len( l.address ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00068">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's address</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00064', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Stores.d.address" VALUE = "{ l.address }">		
	</MvIF>
	
	<MvIF EXPR = "{ len( l.city ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00069">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's city</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00065', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Stores.d.city" VALUE = "{ l.city }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.state ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00070">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's state</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00066', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Stores.d.state" VALUE = "{ l.state }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.zip ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00071">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's Zip/Postal code</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00067', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Stores.d.zip" VALUE = "{ l.zip }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.country ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00072">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's country</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00068', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Stores.d.country" VALUE = "{ l.country }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.phone ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00073">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the store owner's phone number</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00069', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Stores.d.phone" VALUE = "{ l.phone }">		
	</MvIF>

	<MvCOMMENT>
		added a local variable here to stop it from overiding the Stores.d.name field. 	
	</MvCOMMENT>

	<MvASSIGN NAME = "l.name" VALUE = "">

	<MvIF EXPR = "{ ( l.license NE Stores.d.license ) AND len( l.license ) AND l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.inuse" VALUE = "{ Store_License_In_Use( Domain.d.license ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Store_Find_Code( l.code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvIF EXPR = "{ ( Stores.d.license EQ Domain.d.license ) OR NOT l.inuse }">
				<MvASSIGN NAME = "l.license" VALUE = "{ Domain.d.license }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.inuse" VALUE = "{ Store_License_In_Use( l.license ) }">
				<MvIF EXPR = "{ l.inuse }">
					<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00052">
						<MvLOCALIZED-TOKEN NAME = "license" VALUE = "{ g.Store_License }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Sorry, you are already using license number '%license%' for another storefront. Please check your records and try again.</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00009', l.error ) }">
				</MvIF>

				<MvASSIGN NAME = "API" VALUE = "{ s.apitype }">
				<MvASSIGN NAME = "MERCHANT_HOST" VALUE = "{ s.server_name }">
				<MvASSIGN NAME = "LICENSE_NUMBER" VALUE = "{ l.license }">
				<MvASSIGN NAME = "MERCHANT_VERSION" VALUE = "{ Domain.d.version }">
				<MvASSIGN NAME = "NAME" VALUE = "{ l.owner }">
				<MvASSIGN NAME = "COMPANY" VALUE = "{ l.company }">
				<MvASSIGN NAME = "ADDRESS" VALUE = "{ l.address }">
				<MvASSIGN NAME = "CITY" VALUE = "{ l.city }">
				<MvASSIGN NAME = "STATE" VALUE = "{ l.state }">
				<MvASSIGN NAME = "ZIP" VALUE = "{ l.zip }">
				<MvASSIGN NAME = "COUNTRY" VALUE = "{ l.country }">
				<MvASSIGN NAME = "PHONE" VALUE = "{ l.phone }">
				<MvASSIGN NAME = "FAX" VALUE = "{ l.fax }">
				<MvASSIGN NAME = "EMAIL" VALUE = "{ l.email }">
				<MvASSIGN NAME = "PRODUCT_TYPE" VALUE = "STOREFRONT">
				<MvASSIGN NAME = "PRODUCT_LINE" VALUE = "MERCHANT">
				<MvASSIGN NAME = "OPERATIONS" VALUE = "REGISTER">
				<MvASSIGN NAME = "LANGUAGE" VALUE = "{ s.miva_language }">
				<MvASSIGN NAME = "MERCHANT_STOREURL" VALUE = "{ Domain.d.mm_url }">

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

				<MvCALL METHOD = "POST"
						ACTION = "http://licensemgr.miva.com/gateway/gateway.mv"
						FIELDS = "MERCHANT_HOST, API, LICENSE_NUMBER, MERCHANT_VERSION, NAME, COMPANY, ADDRESS,
								  CITY, STATE, ZIP, COUNTRY, PHONE, FAX, EMAIL, PRODUCT_LINE, PRODUCT_TYPE, LANGUAGE, MERCHANT_STOREURL">
					<MvIF EXPR = "{ s.callobjectelement EQ 'LmLICENSE' }">
						<MvASSIGN NAME = "l.attribute" VALUE = 1>
						<MvWHILE EXPR = "{ ( l.attribute LE s.callobjectnumattributes ) }">
							<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'VALID' }">
								<MvASSIGN NAME = "l.valid_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
							</MvIF>
							<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'ERROR_CODE' }">
								<MvASSIGN NAME = "l.error_code_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
							</MvIF>
							<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'ERROR_MESSAGE' }">
								<MvASSIGN NAME = "l.error_message_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
							</MvIF>
							<MvASSIGN NAME = "l.attribute" VALUE = "{ l.attribute + 1 }">
						</MvWHILE>
					</MvIF>
				</MvCALL>

				<MvIF EXPR = "{ toupper( l.valid_value ) EQ 'YES' }">
					<MvASSIGN NAME = "l.valid" VALUE = "1">
				<MvELSE>
					<MvASSIGN NAME = "l.error_message_value" VALUE = "{ ltrim( rtrim( l.error_message_value ) ) }">
					<MvASSIGN NAME = "l.error_code_value" VALUE = "{ ltrim( rtrim( l.error_code_value ) ) }">
					<MvIF EXPR = "{ NOT len( l.error_message_value ) }">
						<MvIF EXPR = "{ len( l.error_code_value ) }">
							<MvASSIGN NAME = "l.error_text" VALUE = "{ l.error_code_value }">
						</MvIF>
					<MvELSE>
						<MvASSIGN NAME = "l.error_text" VALUE = "{ l.error_message_value }">
					</MvIF>
				</MvIF>

				<MvIF EXPR = "{ NOT l.valid }">
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00010', l.error_text $ l.license ) }">
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.id" VALUE = "{ Store_Update( Stores.d.id, Users.d.id, Stores.d.code, Stores.d.license, Stores.d.name, Stores.d.owner, Stores.d.email, Stores.d.company, Stores.d.address, Stores.d.city, Stores.d.state, Stores.d.zip, Stores.d.country, Stores.d.phone, Stores.d.fax, Stores.d.wtunits, Stores.d.baskexp, Stores.d.pgrp_ovlp, Stores.d.ui_id, Stores.d.currncy_id, Stores.d.tax_id, Stores.d.mnt_time, Stores.d.mnt_no_new, Stores.d.mnt_warn, Stores.d.mnt_close, Stores.d.omin_quant, Stores.d.omin_price, Stores.d.omin_all, Stores.d.omin_msg ) }">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Delete" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvIF EXPR = "{ len( l.data ) NE 0 }">
		<MvASSIGN NAME = "l.store_code" VALUE = "{ l.data }">
	</MvIF>
	
	<MvIF EXPR = "{ len( l.store_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00053">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Store Code  is required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00011', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	<MvELSE>
	
	
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Open_Store( l.store_code ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "l.store_name" VALUE = "{ Stores.d.name }">

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Find_ID( Stores.d.tax_id ) }">
			<MvIF EXPR = "{ l.found }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Find_ID( Stores.d.currncy_id ) }">
				<MvIF EXPR = "{ l.found }">
					<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Find_ID( Stores.d.ui_id ) }">
				<MvIF EXPR = "{ l.found }">
					<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
				<MvWHILE EXPR = "{ l.ok AND l.found }">
					<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
				</MvWHILE>
			</MvIF>

			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ Admin_Close_Store() }">

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Store_Delete( l.store_code ) }">
			</MvIF>
		</MvIF>
	</MvIF>	
		
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Update_Store_StandardFields" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.bill" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.fname" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.lname" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.email" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.phone" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.fax" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.comp" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.addr" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.city" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.state" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.zip" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.cntry" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

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

	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ ( l.bill EQ 'H' ) OR ( l.bill EQ 'O' ) }">
			<MvASSIGN NAME = "StandardFields.d.billing" VALUE = "{ l.bill }">
		</MvIF>

		<MvIF EXPR = "{ ( l.fname EQ 'H' ) OR ( l.fname EQ 'O' ) OR ( l.fname EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_fname" VALUE = "{ l.fname }">
		</MvIF>

		<MvIF EXPR = "{ ( l.lname EQ 'H' ) OR ( l.lname EQ 'O' ) OR ( l.lname EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_lname" VALUE = "{ l.lname }">
		</MvIF>

		<MvIF EXPR = "{ ( l.email EQ 'H' ) OR ( l.email EQ 'O' ) OR ( l.email EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_email" VALUE = "{ l.email }">
		</MvIF>

		<MvIF EXPR = "{ ( l.phone EQ 'H' ) OR ( l.phone EQ 'O' ) OR ( l.phone EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_phone" VALUE = "{ l.phone }">
		</MvIF>

		<MvIF EXPR = "{ ( l.fax EQ 'H' ) OR ( l.fax EQ 'O' ) OR ( l.fax EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_fax" VALUE = "{ l.fax }">
		</MvIF>

		<MvIF EXPR = "{ ( l.comp EQ 'H' ) OR ( l.comp EQ 'O' ) OR ( l.comp EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_comp" VALUE = "{ l.comp }">
		</MvIF>

		<MvIF EXPR = "{ ( l.addr EQ 'H' ) OR ( l.addr EQ 'O' ) OR ( l.addr EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_addr" VALUE = "{ l.addr }">
		</MvIF>

		<MvIF EXPR = "{ ( l.city EQ 'H' ) OR ( l.city EQ 'O' ) OR ( l.city EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_city" VALUE = "{ l.city }">
		</MvIF>

		<MvIF EXPR = "{ ( l.state EQ 'H' ) OR ( l.state EQ 'O' ) OR ( l.state EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_state" VALUE = "{ l.state }">
		</MvIF>

		<MvIF EXPR = "{ ( l.zip EQ 'H' ) OR ( l.zip EQ 'O' ) OR ( l.zip EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_zip" VALUE = "{ l.zip }">
		</MvIF>

		<MvIF EXPR = "{ ( l.cntry EQ 'H' ) OR ( l.cntry EQ 'O' ) OR ( l.cntry EQ 'R' ) }">
			<MvASSIGN NAME = "StandardFields.d.mode_cntry" VALUE = "{ l.cntry }">
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ StandardFields_Update( StandardFields.d.billing, StandardFields.d.mode_fname, StandardFields.d.mode_lname, StandardFields.d.mode_email, StandardFields.d.mode_phone, StandardFields.d.mode_fax, StandardFields.d.mode_comp, StandardFields.d.mode_addr, StandardFields.d.mode_city, StandardFields.d.mode_state, StandardFields.d.mode_zip, StandardFields.d.mode_cntry ) }">
		</MvIF>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Domain_Update_NotificationSettings" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.url" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.security" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.updates" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.offers" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.poll" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvDO FILE = "{ g.Module_Feature_NOT_DB }" NAME = "l.ok" VALUE = "{ _DB_Open_NotificationSettings() }">

	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ len( l.url ) }">
			<MvASSIGN NAME = "RemoteNotificationSettings.d.pollurl" VALUE = "{ l.url }">
		</MvIF>

		<MvIF EXPR = "{ len( l.security ) }">
			<MvASSIGN NAME = "RemoteNotificationSettings.d.security" VALUE = "{ PRV_Parse_Boolean( l.security ) }">
		</MvIF>

		<MvIF EXPR = "{ len( l.updates ) }">
			<MvASSIGN NAME = "RemoteNotificationSettings.d.updates" VALUE = "{ PRV_Parse_Boolean( l.updates ) }">
		</MvIF>

		<MvIF EXPR = "{ len( l.offers ) }">
			<MvASSIGN NAME = "RemoteNotificationSettings.d.offers" VALUE = "{ PRV_Parse_Boolean( l.offers ) }">
		</MvIF>

		<MvIF EXPR = "{ len( l.poll ) }">
			<MvASSIGN NAME = "l.poll" VALUE = "{ toupper( l.poll ) }">

			<MvIF EXPR = "{ ( l.poll EQ 'L' ) OR ( l.poll EQ 'W' ) OR ( l.poll EQ 'D' ) OR ( l.poll EQ 'N' ) }">
				<MvASSIGN NAME = "RemoteNotificationSettings.d.poll" VALUE = "{ l.poll }">
			<MvELSE>
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00074">
					<MvLOCALIZED-TOKEN NAME = "poll" VALUE = "{ l.poll }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Check for Notification setting has invalid value type of '%poll%' specified</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00070', l.error ) }">
				<MvFUNCTIONRETURN VALUE = "0">
			</MvIF>
		</MvIF>
	</MvIF>
	
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Feature_NOT_DB }" NAME = "l.ok" VALUE = "{ Domain_NoteSettings_Update( RemoteNotificationSettings.d.security, RemoteNotificationSettings.d.updates, RemoteNotificationSettings.d.offers,
																										RemoteNotificationSettings.d.poll, RemoteNotificationSettings.d.pollurl ) }">
	</MvIF>

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


<MvFUNCTION NAME = "PRV_Action_Domain_Update" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.license" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.owner" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.email" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.company" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.address" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.city" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.state" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.zip" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.country" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.phone" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.fax" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.mm_url" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.mm_surl" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.admin_surl" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.image_root" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.base_url" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.base_surl" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.mod_root" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.mod_sroot" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.admexp" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.mailhost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.mail_angl" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.ui_module" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.lo_time" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.li_trys" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.img_ext_delimiter" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvIF EXPR = "{ len( l.img_ext_delimiter ) }">
		<MvASSIGN NAME = "l.pos_img" VALUE = 1>	
	</MvIF>

	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">	

	<MvASSIGN NAME = "l.img_ext" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.mailmethod" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">

	<MvIF EXPR = "{ l.ok AND len( l.name ) }">
		<MvASSIGN NAME = "Domain.d.name" VALUE = "{ l.name }">
	</MvIF>

	<MvIF EXPR = "{ len( l.email ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00075">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter the email address of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00071', l.error ) }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( l.email ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00076">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a valid email address of the Domain Administrator</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00072', l.error ) }">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.email" VALUE = "{ l.email }">		
		</MvIF>		
	</MvIF>

	<MvIF EXPR = "{ len( l.owner ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00077">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter the name of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00073', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Domain.d.owner" VALUE = "{ l.owner }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.address ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00078">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter the address of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00074', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Domain.d.address" VALUE = "{ l.address }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.city ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00079">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter the city of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00075', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Domain.d.city" VALUE = "{ l.city }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.state ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00080">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter the state/province of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00076', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Domain.d.state" VALUE = "{ l.state }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.zip ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00081">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter the Zip/Postal code of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00077', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Domain.d.zip" VALUE = "{ l.zip }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.country ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00082">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please select the country of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00078', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Domain.d.country" VALUE = "{ l.country }">		
	</MvIF>

	<MvIF EXPR = "{ len( l.phone ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00083">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter the phone number of the Domain Administrator</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00079', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "Domain.d.phone" VALUE = "{ l.phone }">		
	</MvIF>
	
	<MvIF EXPR = "{ l.ok AND len( l.license ) }">
		<MvASSIGN NAME = "API" VALUE = "{ s.apitype }">
		<MvASSIGN NAME = "MERCHANT_HOST" VALUE = "{ s.server_name }">
		<MvASSIGN NAME = "LICENSE_NUMBER" VALUE = "{ l.license }">
		<MvASSIGN NAME = "MERCHANT_VERSION" VALUE = "{ Domain.d.version }">
		<MvASSIGN NAME = "NAME" VALUE = "{ l.owner }">
		<MvASSIGN NAME = "COMPANY" VALUE = "{ l.company }">
		<MvASSIGN NAME = "ADDRESS" VALUE = "{ l.address }">
		<MvASSIGN NAME = "CITY" VALUE = "{ l.city }">
		<MvASSIGN NAME = "STATE" VALUE = "{ l.state }">
		<MvASSIGN NAME = "ZIP" VALUE = "{ l.zip }">
		<MvASSIGN NAME = "COUNTRY" VALUE = "{ l.country }">
		<MvASSIGN NAME = "PHONE" VALUE = "{ l.phone }">
		<MvASSIGN NAME = "FAX" VALUE = "{ l.fax }">
		<MvASSIGN NAME = "EMAIL" VALUE = "{ l.email }">
		<MvASSIGN NAME = "PRODUCT_LINE" VALUE = "MERCHANT">
		<MvASSIGN NAME = "PRODUCT_TYPE" VALUE = "DOMAIN">
		<MvASSIGN NAME = "OPERATIONS" VALUE = "REGISTER">
		<MvASSIGN NAME = "LANGUAGE" VALUE = "{ s.miva_language }">
		<MvASSIGN NAME = "MERCHANT_STOREURL" VALUE = "{ l.mm_url }">

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

		<MvLOCALIZED NAME = "l.error_text" ID = "MER-SET-00007">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Unable to register license number</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvCALL METHOD = "POST"
				ACTION = "http://licensemgr.miva.com/gateway/gateway.mv"
				FIELDS = "MERCHANT_HOST, API, LICENSE_NUMBER, MERCHANT_VERSION, NAME, COMPANY, ADDRESS,
						  CITY, STATE, ZIP, COUNTRY, PHONE, FAX, EMAIL, PRODUCT_LINE, PRODUCT_TYPE, LANGUAGE, MERCHANT_STOREURL">
			<MvIF EXPR = "{ s.callobjectelement EQ 'LmLICENSE' }">
				<MvASSIGN NAME = "l.attribute" VALUE = 1>
				<MvWHILE EXPR = "{ ( l.attribute LE s.callobjectnumattributes ) }">
					<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'VALID' }">
						<MvASSIGN NAME = "l.valid_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
					</MvIF>
					<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'ERROR_CODE' }">
						<MvASSIGN NAME = "l.error_code_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
					</MvIF>
					<MvIF EXPR = "{ s.callobjectattribute[ l.attribute ] EQ 'ERROR_MESSAGE' }">
						<MvASSIGN NAME = "l.error_message_value" VALUE = "{ s.callobjectvalue[ l.attribute ] }">
					</MvIF>
					<MvASSIGN NAME = "l.attribute" VALUE = "{ l.attribute + 1 }">
				</MvWHILE>
			</MvIF>
		</MvCALL>

		<MvIF EXPR = "{ toupper( l.valid_value ) EQ 'YES' }">
			<MvASSIGN NAME = "l.valid" VALUE = "1">
		<MvELSE>
			<MvASSIGN NAME = "l.error_message_value" VALUE = "{ ltrim( rtrim( l.error_message_value ) ) }">
			<MvASSIGN NAME = "l.error_code_value" VALUE = "{ ltrim( rtrim( l.error_code_value ) ) }">
			<MvIF EXPR = "{ NOT len( l.error_message_value ) }">
				<MvIF EXPR = "{ len( l.error_code_value ) }">
					<MvASSIGN NAME = "l.error_text" VALUE = "{ l.error_code_value }">
				</MvIF>
			<MvELSE>
				<MvASSIGN NAME = "l.error_text" VALUE = "{ l.error_message_value }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ NOT l.valid }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00008', l.error_text $ l.license ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.store_found" VALUE = "{ Store_FindFirst() }">
		<MvWHILE EXPR = "{ l.store_found }">
			<MvIF EXPR = "{ Domain.d.license EQ Stores.d.license }">		
				<MvASSIGN NAME = "Stores.d.license" VALUE = "{ l.license }">
				<MvUPDATE NAME = "Stores">
			</MvIF>
			
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.store_found" VALUE = "{ Store_FindNext() }">
		</MvWHILE>

		<MvASSIGN NAME = "Domain.d.license" VALUE = "{ l.license }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.company ) }">
		<MvIF EXPR = "{ toupper( l.company ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Domain.d.company" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.company" VALUE = "{ l.company }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.fax ) }">
		<MvIF EXPR = "{ toupper( l.fax ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Domain.d.fax" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.fax" VALUE = "{ l.fax }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.mm_url ) }">
		<MvASSIGN NAME = "Domain.d.mm_url" VALUE = "{ l.mm_url }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.mm_surl ) }">
		<MvIF EXPR = "{ toupper( l.mm_surl ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Domain.d.mm_surl" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.mm_surl" VALUE = "{ l.mm_surl }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.admin_surl ) }">
		<MvIF EXPR = "{ toupper( l.admin_surl ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Domain.d.admin_surl" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.admin_surl" VALUE = "{ l.admin_surl }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.image_root ) }">
		<MvASSIGN NAME = "Domain.d.image_root" VALUE = "{ l.image_root }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.base_url ) }">
		<MvASSIGN NAME = "Domain.d.base_url" VALUE = "{ l.base_url }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.base_surl ) }">
		<MvIF EXPR = "{ toupper( l.base_surl ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Domain.d.base_surl" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.base_surl" VALUE = "{ l.base_surl }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.mod_root ) }">
		<MvASSIGN NAME = "Domain.d.mod_root" VALUE = "{ l.mod_root }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.mod_sroot ) }">
		<MvIF EXPR = "{ toupper( l.mod_sroot ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Domain.d.mod_sroot" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.mod_sroot" VALUE = "{ l.mod_sroot }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.admexp ) }">
		<MvASSIGN NAME = "Domain.d.admexp" VALUE = "{ l.admexp }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.mailhost ) }">
		<MvASSIGN NAME = "Domain.d.mailhost" VALUE = "{ l.mailhost }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.mailmethod ) }">
		<MvIF EXPR = "{ toupper( l.mailmethod ) EQ '#NONE#' }">
			<MvASSIGN NAME = "Domain.d.mailmeth" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "Domain.d.mailmeth" VALUE = "{ l.mailmethod }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.mail_angl ) }">
		<MvASSIGN NAME = "Domain.d.mail_angl" VALUE = "{ PRV_Parse_Boolean( l.mail_angl ) }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.ui_module ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.ui_module ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_type" VALUE = "{ Module_Type() }">
			<MvIF EXPR = "{ l.module_type NE 'UI' }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00007">
					<MvLOCALIZED-TOKEN NAME = "module_name" VALUE = "{ Modules.d.name }">

					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Module '%module_name%' is not a user-interface module</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00012', l.error ) }">
			<MvELSE>
				<MvASSIGN NAME = "Domain.d.ui_id" VALUE = "{ Modules.d.id }">
			</MvIF>
		<MvELSE>
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00007">
				<MvLOCALIZED-TOKEN NAME = "ui" VALUE = "{ l.ui_module }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Module '%ui%' is not a user-interface module</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00080', l.error ) }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.lo_time ) }">
		<MvASSIGN NAME = "Domain.d.lo_time" VALUE = "{ l.lo_time }">
	</MvIF>

	<MvIF EXPR = "{ l.ok AND len( l.li_trys ) }">
		<MvASSIGN NAME = "Domain.d.li_trys" VALUE = "{ l.li_trys }">
	</MvIF>

	<MvASSIGN NAME = "l.invalid_ext" VALUE = "">	

	<MvIF EXPR = "{ l.img_ext_delimiter EQ l.delimiter }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00084">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Your image extension delimiter cannot be the same as your format delimiter</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00081', l.error ) }">
	<MvELSE>
		<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.img_ext, l.img_ext_delimiter, l.pos_img ) ) ) }">

		<MvIF EXPR = "{ l.ok AND len( l.image ) }">
			<MvIF EXPR = "{ toupper( l.image ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Domain.d.img_ext" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Domain.d.img_ext" VALUE = "">

				<MvWHILE EXPR = "{ len( l.image ) NE 0 }">
					<MvIF EXPR = "{ '.' IN l.image }">
						<MvIF EXPR = "{ len( l.invalid_ext ) }">
							<MvASSIGN NAME = "l.invalid_ext" VALUE = "{ l.invalid_ext $ ', ' $ l.image }">
						<MvELSE>
							<MvASSIGN NAME = "l.invalid_ext" VALUE = "{ l.image }">
						</MvIF>
					<MvELSE>
						<MvIF EXPR = "{ len( Domain.d.img_ext ) }">
							<MvASSIGN NAME = "Domain.d.img_ext" VALUE = "{ Domain.d.img_ext $ ',' $ l.image }">
						<MvELSE>
							<MvASSIGN NAME = "Domain.d.img_ext" VALUE = "{ l.image }">
						</MvIF>
					</MvIF>

					<MvASSIGN NAME = "l.pos_img" VALUE = "{ l.pos_img + 1 }">
					<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.img_ext, l.img_ext_delimiter, l.pos_img ) ) ) }">
				</MvWHILE>
			</MvIF>
		</MvIF>
	</MvIF>
	
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Domain_Update( Domain.d.name, Domain.d.license, Domain.d.version, Domain.d.owner, Domain.d.email, Domain.d.company, Domain.d.address, Domain.d.city, Domain.d.state, Domain.d.zip, Domain.d.country, Domain.d.phone, Domain.d.fax, Domain.d.mm_url, Domain.d.mm_surl, Domain.d.admin_surl, Domain.d.image_root, Domain.d.base_url, Domain.d.base_surl, Domain.d.mod_root, Domain.d.mod_sroot, Domain.d.admexp, Domain.d.mailhost, Domain.d.mailmeth, Domain.d.mail_angl, Domain.d.ui_id, Domain.d.lo_time, Domain.d.li_trys, Domain.d.img_ext ) }">
	</MvIF>
	
	<MvIF EXPR = "{ len( l.invalid_ext ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00085">
			<MvLOCALIZED-TOKEN NAME = "ext" VALUE = "{ encodeentities( l.invalid_ext ) }">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">The following extensions contained a '.' and could not be created: '%ext%'</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00082', l.error ) }">
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Domain_Update_AdminDisabling" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	
	<MvASSIGN NAME = "l.d_set" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_mod" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_pay" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_ship" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_ful" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_usr" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_log" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_sys" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.d_utl" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.maxstores" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvIF EXPR = "{ len( l.d_set ) }">
		<MvASSIGN NAME = "Domain.d.d_set" VALUE = "{ PRV_Parse_Boolean( l.d_set ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_mod ) }">
		<MvASSIGN NAME = "Domain.d.d_mod" VALUE = "{ PRV_Parse_Boolean( l.d_mod ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_pay ) }">
		<MvASSIGN NAME = "Domain.d.d_pay" VALUE = "{ PRV_Parse_Boolean( l.d_pay ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_ship ) }">
		<MvASSIGN NAME = "Domain.d.d_ship" VALUE = "{ PRV_Parse_Boolean( l.d_ship ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_ful ) }">
		<MvASSIGN NAME = "Domain.d.d_ful" VALUE = "{ PRV_Parse_Boolean( l.d_ful ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_usr ) }">
		<MvASSIGN NAME = "Domain.d.d_usr" VALUE = "{ PRV_Parse_Boolean( l.d_usr ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_log ) }">
		<MvASSIGN NAME = "Domain.d.d_log" VALUE = "{ PRV_Parse_Boolean( l.d_log ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_sys ) }">
		<MvASSIGN NAME = "Domain.d.d_sys" VALUE = "{ PRV_Parse_Boolean( l.d_sys ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.d_utl ) }">
		<MvASSIGN NAME = "Domain.d.d_utl" VALUE = "{ PRV_Parse_Boolean( l.d_utl ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.maxstores ) }">
		<MvASSIGN NAME = "Domain.d.maxstores" VALUE = "{ l.maxstores }">
	</MvIF>
	
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Domain_Update_AdminDisabling( Domain.d.d_set, Domain.d.d_mod, Domain.d.d_pay, Domain.d.d_ship, Domain.d.d_ful, Domain.d.d_usr, Domain.d.d_log, Domain.d.d_sys, Domain.d.d_utl, Domain.d.maxstores ) }">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Add_Update_State" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0}">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00008">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				No states to add / modify
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00013', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ len( l.code ) NE 0 }">
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		
		<MvIF EXPR = "{ toupper( l.code ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.code" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ len( l.name ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00009">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					State Name required
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00014', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.code ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.code" VALUE = "">
		</MvIF>


		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ State_Find_Code( l.code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ State_Update( l.code, l.code, l.name ) }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ State_Insert( l.code, l.name ) }">
		</MvIF>
		
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	</MvWHILE>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Delete_State" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0}">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00010">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				No states to delete
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00015', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ len( l.code ) NE 0}">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ State_Find_Code( l.code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ State_Delete( l.code ) }">
		</MvIF>
		<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	</MvWHILE>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Clear_State" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ State_FindFirst() }">
	<MvWHILE EXPR = "{ l.found AND l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ State_Delete( States.d.code ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ State_FindNext() }">
	</MvWHILE>
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">	
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Add_Update_Country" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0}">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00011">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				No countrys to add / modify
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00016', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ len( l.code ) NE 0}">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreCountry_Find_Alpha( l.code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Country_Find_Alpha( l.code ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ StoreCountry_Insert( Countries.d.id, Countries.d.name, Countries.d.alpha, Countries.d.numeric ) }">
			</MvIF>
		</MvIF>
		<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	</MvWHILE>
	
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Delete_Country" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0}">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00012">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				No countrys to delete
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00017', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ len( l.code ) NE 0}">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreCountry_Find_Alpha( l.code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ StoreCountry_Delete( StoreCountries.d.id ) }">
		</MvIF>
		<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	</MvWHILE>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Clear_Country" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreCountry_FindFirst_Alpha() }">
	<MvWHILE EXPR = "{ l.found AND l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ StoreCountry_Delete( StoreCountries.d.id ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreCountry_FindNext_Alpha() }">
	</MvWHILE>
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">	
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Add_Update_Group" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Group_Find_Name( l.name ) }">
	<MvIF EXPR = "{ NOT l.found }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Group_Insert( l.name ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Privilege_FindFirst() }">
		<MvWHILE EXPR = "{ l.ok AND l.found }">

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ GroupPrivilege_Insert( Groups.d.id, Privileges.d.privilege, 0, 0, 0, 0 ) }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Privilege_FindNext() }">
		</MvWHILE>
	</MvIF>
	
	<MvASSIGN NAME = "l.item" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvWHILE EXPR = "{ len( l.item ) and l.ok }">
		<MvASSIGN NAME = "l.privilege" VALUE = "{ ltrim( rtrim( gettoken( l.item, ':', 1 ) ) ) }">
		<MvASSIGN NAME = "l.view" VALUE = "{ PRV_Parse_Boolean( ltrim( gettoken( l.item, ':', 2 ) ) ) }">
		<MvASSIGN NAME = "l.add" VALUE = "{ PRV_Parse_Boolean( ltrim( gettoken( l.item, ':', 3 ) ) ) }">
		<MvASSIGN NAME = "l.modify" VALUE = "{ PRV_Parse_Boolean( ltrim( gettoken( l.item, ':', 4 ) ) ) }">
		<MvASSIGN NAME = "l.delete" VALUE = "{ PRV_Parse_Boolean( ltrim( gettoken( l.item, ':', 5 ) ) ) }">

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ GroupPrivilege_Find( Groups.d.id, l.privilege ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ GroupPrivilege_Update( Groups.d.id, l.privilege, l.view, l.add, l.modify, l.delete ) }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Privilege_Find( l.privilege ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ GroupPrivilege_Update( Groups.d.id, l.privilege, l.view, l.add, l.modify, l.delete ) }">
			</MvIF>
		</MvIF>
		<MvASSIGN NAME = "l.item" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	</MvWHILE>

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

<MvFUNCTION NAME = "PRV_Action_Store_Delete_Group" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Group_Find_Name( l.name ) }">
	<MvIF EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Group_Delete( Groups.d.id ) }">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Group_Add_User" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.group_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvIF EXPR = "{ len( l.group_name ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00013">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Group code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00018', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Group_Find_Name( l.group_name ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.user_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.user_name ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00014">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				At least one user name required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00019', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ len( l.user_name ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_Name( l.user_name ) }">
		<MvIF EXPR = "{ NOT l.ok }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ UserXGroup_Find( Users.d.id, Groups.d.id ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ UserXGroup_Insert( Users.d.id, Groups.d.id ) }">
		</MvIF>
		
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.user_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		
	</MvWHILE>

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

<MvFUNCTION NAME = "PRV_Action_Store_Group_Remove_User" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.group_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvIF EXPR = "{ len( l.group_name ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00015">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Group code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00020', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Group_Find_Name( l.group_name ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.user_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.user_name ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00016">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				At least one user name required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00021', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ len( l.user_name ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_Name( l.user_name ) }">
		<MvIF EXPR = "{ NOT l.ok }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ UserXGroup_Find( Users.d.id, Groups.d.id ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ UserXGroup_Delete( Users.d.id, Groups.d.id ) }">
		</MvIF>
		
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.user_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		
	</MvWHILE>

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

<MvFUNCTION NAME = "PRV_Action_Domain_Add_Update_User" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.password" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.admin" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.create" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.parent" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.page_len" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvASSIGN NAME = "l.simple_mode" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvIF EXPR = "{ len( l.name ) EQ 0}">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00017">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">User name is required</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00022', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.parent ) EQ 0 }">
		<MvASSIGN NAME = "l.parent_id" VALUE = "0">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.parent_id" VALUE = "{ User_Find_Name( l.parent ) }">
		<MvIF EXPR = "{ len( l.parent_id ) EQ 0}">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ User_Find_Name( l.name ) }">
	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.admin ) NE 0 }">
			<MvASSIGN NAME = "Users.d.admin" VALUE = "{ PRV_Parse_Boolean( l.admin ) }">
		</MvIF>
		<MvIF EXPR = "{ len( l.create ) NE 0 }">
			<MvASSIGN NAME = "Users.d.create" VALUE = "{ PRV_Parse_Boolean( l.create ) }">
		</MvIF>
		<MvIF EXPR = "{ len( l.parent ) NE 0 }">
			<MvASSIGN NAME = "Users.d.parent_id" VALUE = "{ l.parent_id }">
		</MvIF>
		<MvIF EXPR = "{ len( l.page_len ) NE 0 }">
			<MvASSIGN NAME = "Users.d.page_len" VALUE = "{ l.page_len }">
		</MvIF>
		
		<MvIF EXPR = "{ len( l.simple_mode ) NE 0 }">
			<MvASSIGN NAME = "Users.d.smod" VALUE = "{ PRV_Parse_Boolean( l.simple_mode ) }">
		</MvIF>
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Update( Users.d.id, Users.d.parent_id, Users.d.page_len, Users.d.name, l.password, Users.d.admin, Users.d.create, Users.d.t_fails, Users.d.c_fails, Users.d.lo_date, Users.d.smod ) }">
																						id, parent_id, page_len, name, password, admin, create, t_fails, c_fails, lo_date, switch
	<MvELSE>
		<MvIF EXPR = "{ len( l.password ) EQ 0}">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00018">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Password is required</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00023', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		
		<MvASSIGN NAME = "l.admin" VALUE = "{ PRV_Parse_Boolean( l.admin ) }">
		<MvASSIGN NAME = "l.create" VALUE = "{ PRV_Parse_Boolean( l.create ) }">
		<MvASSIGN NAME = "l.simple_mode" VALUE = "{ PRV_Parse_Boolean( l.simple_mode ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Insert( l.parent_id, l.page_len, l.name, l.password, l.admin, l.create, l.simple_mode, 0, 0, 0 ) }">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Domain_Delete_User" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	
	<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">

	<MvIF EXPR = "{ len( l.name ) EQ 0}">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00019">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">User name is required</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00024', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ User_Find_Name( l.name ) }">
	<MvIF EXPR = "{ NOT l.found }">
		<MvFUNCTIONRETURN VALUE = "0">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Delete( Users.d.id ) }">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Install_Module" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.new_module_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, 1 ) ) ) }">
	</MvIF>
	
	<MvIF EXPR = "{ NOT len( l.new_module_code ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00020">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				No module code specified.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00025', l.error ) }">
	</MvIF>
	
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.new_module_code ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_Find_ID( Modules.d.id ) }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogWarning( 'Module \'' $ Modules.d.name $'\' is already installed - no action taken.') }">
			<MvELSE>
				<MvASSIGN NAME = "l.old_module" VALUE = "">
				<MvASSIGN NAME = "l.update_store" VALUE = "0">
				<MvIF EXPR = "{ Modules.d.type EQ 'UI' }">
					<MvASSIGN NAME = "l.old_module" VALUE = "{ Stores.d.ui_id }">
					<MvASSIGN NAME = "l.update_store" VALUE = "1">
					<MvASSIGN NAME = "Stores.d.ui_id" VALUE = "{ Modules.d.id }">
				</MvIF>
				<MvIF EXPR = "{ Modules.d.type EQ 'CURRENCY' }">
					<MvASSIGN NAME = "l.old_module" VALUE = "{ Stores.d.currncy_id }">
					<MvASSIGN NAME = "l.update_store" VALUE = "1">
					<MvASSIGN NAME = "Stores.d.currncy_id" VALUE = "{ Modules.d.id }">
				</MvIF>
				<MvIF EXPR = "{ Modules.d.type EQ 'TAX' }">
					<MvASSIGN NAME = "l.old_module" VALUE = "{ Stores.d.tax_id }">
					<MvASSIGN NAME = "l.update_store" VALUE = "1">
					<MvASSIGN NAME = "Stores.d.tax_id" VALUE = "{ Modules.d.id }">
				</MvIF>
				
				<MvDO FILE = "{ g.Module_Root $ Modules.d.Module }" NAME = "l.ok" VALUE = "{ Module_Install_Store() }">
				
				<MvIF EXPR = "{ l.ok }">
					<MvIF EXPR = "{ NOT l.update_store }"> 
						<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ StoreModule_Insert( Modules.d.id, Modules.d.type ) }">
						<MvIF EXPR = "{ l.ok }">
							<MvASSIGN NAME = "l.modified" VALUE = 1>
						</MvIF>
					<MvELSE>
						<MvDO FILE = "{ g.Module_Library_DB}" NAME = "l.ok" VALUE = "{ Store_Update( Stores.d.id, Stores.d.manager_id, Stores.d.code, Stores.d.license, Stores.d.name, Stores.d.owner, Stores.d.email, Stores.d.company, Stores.d.address, Stores.d.city, Stores.d.state, Stores.d.zip, Stores.d.country, Stores.d.phone, Stores.d.fax, Stores.d.wtunits, Stores.d.baskexp, Stores.d.pgrp_ovlp, Stores.d.ui_id, Stores.d.currncy_id, Stores.d.tax_id, Stores.d.mnt_time, Stores.d.mnt_no_new, Stores.d.mnt_close, Stores.d.mnt_warn, Stores.d.omin_quant, Stores.d.omin_price, Stores.d.omin_all, Stores.d.omin_msg ) }">

						<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_ID( l.old_module ) }">
						
						<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_Find_ID( l.old_module ) }">
						
						<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
						
						
					</MvIF>
				</MvIF>				
			</MvIF>
		</MvIF>
	</MvIF>

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



<MvFUNCTION NAME = "PRV_Action_Store_Uninstall_Module" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.new_module_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, 1 ) ) ) }">
	</MvIF>
		
	<MvIF EXPR = "{ NOT len( l.new_module_code ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00021">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				No module code specified.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00026', l.error ) }">
	</MvIF>
	
	
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_Code( l.new_module_code ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_Find_ID( Modules.d.id ) }">
			<MvIF EXPR = "{ NOT l.found }">
				<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogWarning( 'Module \'' $ Modules.d.name $'\' is not installed - no action taken.') }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_type" VALUE = "{ Module_Type() }">

				<MvIF EXPR = "{ (l.module_type EQ 'UI') OR ( l.module_type EQ 'CURRENCY' ) OR ( l.module_type EQ 'TAX' ) }">

					<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00086">
						<MvLOCALIZED-TOKEN NAME = "module" VALUE = "{ Modules.d.name }">
						<MvLOCALIZED-TOKEN NAME = "type" VALUE = "{ tolower( l.module_type ) }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">
							Cannot uninstall '%module%', it is the %type% module for this store
						</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00083', l.error ) }">
					<MvFUNCTIONRETURN VALUE = "0">
				</MvIF>

				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall_Store() }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ StoreModule_Delete( Modules.d.id ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvASSIGN NAME = "l.modified" VALUE = 1>
					</MvIF>
				</MvIF>
				
			</MvIF>
		</MvIF>
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Domain_Install_Module" PARAMETERS = "provision_version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.new_module_path" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, 1 ) ) ) }">
	</MvIF>
		
	<MvIF EXPR = "{ NOT len( l.new_module_path ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00022">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				No module path specified.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00027', l.error ) }">
	</MvIF>
	
	<MvIF EXPR = "{ NOT sexists( g.Module_Root $ l.new_module_path ) }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00023">
			<MvLOCALIZED-TOKEN NAME = "module" VALUE = "{ g.Module_Root $ l.new_module_path }">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">The file '%module%' does not exist</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00028', l.error ) }">
		
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Root $ l.new_module_path }" NAME = "l.type" VALUE = "{ Module_Type() }">
		<MvDO FILE = "{ g.Module_Root $ l.new_module_path }" NAME = "l.code" VALUE = "{ Module_Code() }">
		<MvDO FILE = "{ g.Module_Root $ l.new_module_path }" NAME = "l.name" VALUE = "{ Module_Name() }">
		<MvDO FILE = "{ g.Module_Root $ l.new_module_path }" NAME = "l.provider" VALUE = "{ Module_Provider() }">
		<MvDO FILE = "{ g.Module_Root $ l.new_module_path }" NAME = "l.version" VALUE = "{ Module_Version() }">

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Find_Code( l.code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogWarning( 'Module \'' $ Modules.d.name $'\' is already installed - no action taken.') }">
		<MvELSE>
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Insert( l.type, l.code, l.name, l.provider, l.version, l.new_module_path, 1 ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Root $ l.new_module_path }" NAME = "l.ok" VALUE = "{ Module_Install() }">
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Domain_Uninstall_Module" PARAMETERS = "provision_version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.module_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, 1 ) ) ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Find_Code( l.module_code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogWarning( 'Module \'' $ Modules.d.name $'\' is not installed - no action taken.') }">
		<MvELSE>
			<MvIF EXPR = "{ Modules.d.id EQ Domain.d.ui_id }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00024">
					<MvLOCALIZED-TOKEN NAME = "module" VALUE = "{ Modules.d.name }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Module '%module%' is the Store Selection Layout module and cannot be deleted</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00029', l.error ) }">
			</MvIF>
		
			<MvIF EXPR = "{ Modules.d.refcount GT 0 }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00025">
					<MvLOCALIZED-TOKEN NAME = "module" VALUE = "{ Modules.d.name }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Module '%module%' is in use by one or more stores, and cannot be deleted</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00030', l.error ) }">
			</MvIF>
			
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Uninstall() }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Delete( Modules.d.id ) }">
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Domain_Activate_Module" PARAMETERS = "provision_version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.module_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, 1 ) ) ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Find_Code( l.module_code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogWarning( 'Module \'' $ Modules.d.name $'\' is not installed - no action taken.') }">
		<MvELSE>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Update( Modules.d.id, Modules.d.code, Modules.d.name, Modules.d.provider, Modules.d.version, Modules.d.module, 1 ) }">			
		</MvIF>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Domain_Dectivate_Module" PARAMETERS = "provision_version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.module_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, 1 ) ) ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Find_Code( l.module_code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvASSIGN NAME = "l.null" VALUE = "{ PRV_LogWarning( 'Module \'' $ Modules.d.name $'\' is not installed - no action taken.') }">
		<MvELSE>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Module_Update( Modules.d.id, Modules.d.code, Modules.d.name, Modules.d.provider, Modules.d.version, Modules.d.module, 0 ) }">			
		</MvIF>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Add_Update_Product" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.thumbnail" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.desc" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.weight" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.taxable" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.active" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00026">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00031', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Product_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.name ) }">
			<MvASSIGN NAME = "Products.d.name" VALUE = "{ l.name }">
		</MvIF>

		<MvIF EXPR = "{ len( l.thumbnail ) }">
			<MvIF EXPR = "{ toupper( l.thumbnail ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Products.d.thumbnail" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Products.d.thumbnail" VALUE = "{ l.thumbnail }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.image ) }">
			<MvIF EXPR = "{ toupper( l.image ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Products.d.image" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Products.d.image" VALUE = "{ l.image }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.price ) }">
			<MvASSIGN NAME = "Products.d.price" VALUE = "{ l.price }">
		</MvIF>

		<MvIF EXPR = "{ len( l.cost ) }">
			<MvASSIGN NAME = "Products.d.cost" VALUE = "{ l.cost }">
		</MvIF>

		<MvIF EXPR = "{ len( l.desc ) }">
			<MvIF EXPR = "{ toupper( l.desc ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Products.d.desc" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Products.d.desc" VALUE = "{ l.desc }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.weight ) }">
			<MvASSIGN NAME = "Products.d.weight" VALUE = "{ l.weight }">
		</MvIF>

		<MvIF EXPR = "{ len( l.taxable ) }">
			<MvASSIGN NAME = "Products.d.taxable" VALUE = "{ PRV_Parse_Boolean( l.taxable )}">
		</MvIF>

		<MvIF EXPR = "{ len( l.active ) }">
			<MvASSIGN NAME = "Products.d.active" VALUE = "{ PRV_Parse_Boolean( l.active ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{Product_Update( Products.d.id, Products.d.code, Products.d.name, Products.d.thumbnail, Products.d.image, Products.d.price, Products.d.cost, Products.d.desc, Products.d.weight, Products.d.taxable, Products.d.active ) }">
	<MvELSE>
		<MvIF EXPR = "{ len( l.name ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00027">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					Product name required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00032', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		<MvASSIGN NAME = "l.active" VALUE = "{ PRV_Parse_Boolean( l.active ) }">
		<MvASSIGN NAME = "l.taxable" VALUE = "{ PRV_Parse_Boolean( l.taxable ) }">
		<MvIF EXPR = "{ toupper( l.desc ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.desc" VALUE = "">
		</MvIF>
		<MvIF EXPR = "{ toupper( l.thumbnail ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.thumbnail" VALUE = "">
		</MvIF>
		<MvIF EXPR = "{ toupper( l.image ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.image" VALUE = "">
		</MvIF>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Insert( l.code, l.name, l.thumbnail, l.image, l.price, l.cost, l.desc, l.weight, l.taxable, l.active ) }">
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Store_Add_Update_Attribute" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.type" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.prompt" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.required" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00028">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00033', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00029">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Attribute code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00034', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvIF EXPR = "{ g.Features:AttributeTemplates:Enabled }">
		<MvIF EXPR = "{ 'template' CIN l.type }">
			<MvASSIGN NAME = "l.template" VALUE = "{ ltrim( rtrim( gettoken( l.type, ':', 2 ) ) ) }">
			<MvASSIGN NAME = "l.type" VALUE = "template">
			<MvIF EXPR = "{ NOT len( l.template ) }">
				<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00030">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">
						Attribute code required.
					</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00035', l.error ) }">
				<MvFUNCTIONRETURN VALUE = "0">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( l.template ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvASSIGN NAME = "l.template_id" VALUE = "{ AttributeTemplates.d.id }"> 
				</MvIF>
			</MvIF>
		<MvELSE>
			<MvASSIGN NAME = "l.template_id" VALUE = "0">
		</MvIF>
	<MvELSE>
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00087">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Attribute Templates feature is disabled.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00084', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Attribute_Find_Code( Products.d.id, l.attribute_code ) }">
	
	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.type ) }">
			<MvASSIGN NAME = "Attributes.d.type" VALUE = "{ l.type }">
			<MvASSIGN NAME = "Attributes.d.attemp_id" VALUE = "{ l.template_id }">
		</MvIF>

		<MvIF EXPR = "{ len( l.prompt ) }">
			<MvASSIGN NAME = "Attributes.d.thumbnail" VALUE = "{ l.thumbnail }">
		</MvIF>

		<MvIF EXPR = "{ len( l.price ) }">
			<MvASSIGN NAME = "Attributes.d.price" VALUE = "{ l.price }">
		</MvIF>

		<MvIF EXPR = "{ len( l.cost ) }">
			<MvASSIGN NAME = "Attributes.d.cost" VALUE = "{ l.cost }">
		</MvIF>

		<MvIF EXPR = "{ len( l.required ) }">
			<MvASSIGN NAME = "Attributes.d.desc" VALUE = "{ l.desc }">
		</MvIF>

		<MvIF EXPR = "{ len( l.image ) }">
			<MvIF EXPR = "{ toupper( l.image ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Attributes.d.image" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Attributes.d.image" VALUE = "{ l.image }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.required ) }">
			<MvASSIGN NAME = "Attributes.d.required" VALUE = "{ PRV_Parse_Boolean( l.required ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Attribute_Update( Attributes.d.id, Attributes.d.default_id, Attributes.d.code, Attributes.d.type, Attributes.d.attemp_id, Attributes.d.prompt, Attributes.d.price, Attributes.d.cost, Attributes.d.required, Attributes.d.image ) }">
	<MvELSE>
		<MvIF EXPR = "{ len( l.prompt ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00031">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					Attribute prompt required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00036', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.image ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.image" VALUE = "">
		</MvIF>

		<MvASSIGN NAME = "l.required" VALUE = "{ PRV_Parse_Boolean( l.required ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Attribute_Insert( Products.d.id, l.attribute_code, l.type, l.template_id, l.prompt, l.price, l.cost, l.required, l.image ) }">
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Store_Delete_Attribute" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00032">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00037', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00033">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Attribute code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00038', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Attribute_Find_Code( Products.d.id, l.attribute_code ) }">
	
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Attribute_Delete( Attributes.d.id ) }">
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Action_Store_Add_Update_Option" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.option_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.prompt" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.default" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00034">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00039', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00035">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Option code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00040', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Attribute_Find_Code( Products.d.id, l.attribute_code ) }">
		
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Option_Find_Code( Attributes.d.id, l.option_code ) }">
	
	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.prompt ) }">
			<MvASSIGN NAME = "Options.d.thumbnail" VALUE = "{ l.thumbnail }">
		</MvIF>

		<MvIF EXPR = "{ len( l.price ) }">
			<MvASSIGN NAME = "Options.d.price" VALUE = "{ l.price }">
		</MvIF>

		<MvIF EXPR = "{ len( l.cost ) }">
			<MvASSIGN NAME = "Options.d.cost" VALUE = "{ l.cost }">
		</MvIF>

		<MvIF EXPR = "{ len( l.required ) }">
			<MvASSIGN NAME = "Options.d.desc" VALUE = "{ l.desc }">
		</MvIF>

		<MvIF EXPR = "{ len( l.image ) }">
			<MvIF EXPR = "{ toupper( l.image ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Options.d.image" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Options.d.image" VALUE = "{ l.image }">
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{Option_Update( Options.d.id,  Options.d.code, Options.d.prompt, Options.d.price, Options.d.cost, Options.d.image ) }">
	<MvELSE>
		<MvIF EXPR = "{ len( l.prompt ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00036">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					Option prompt required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00041', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		<MvASSIGN NAME = "l.required" VALUE = "{ PRV_Parse_Boolean( l.required ) }">
		
		<MvIF EXPR = "{ toupper( l.image ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.image" VALUE = "">
		</MvIF>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.option_id" VALUE = "{ Option_Insert( Attributes.d.id, l.option_code, l.prompt, l.price, l.cost, l.image ) }">
	</MvIF>
	
	<MvIF EXPR = "{ len( l.default ) }">
		<MvIF EXPR = "{ PRV_Parse_Boolean( l.default ) }">
			<MvIF EXPR = "{ Attributes.d.default_id NE Options.d.id }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{Attribute_Update( Attributes.d.id, Options.d.id, Attributes.d.code, Attributes.d.type, Attributes.d.attemp_id, Attributes.d.prompt, Attributes.d.price, Attributes.d.cost, Attributes.d.required, Attributes.d.image ) }">
			</MvIF>
		<MvELSE>
			<MvIF EXPR = "{ Attributes.d.default_id EQ Options.d.id }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{Attribute_Update( Attributes.d.id, 0, Attributes.d.code, Attributes.d.type, Attributes.d.attemp_id, Attributes.d.prompt, Attributes.d.price, Attributes.d.cost, Attributes.d.required, Attributes.d.image ) }">
			</MvIF>
		</MvIF>
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Store_Delete_Option" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.option_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.prompt" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00037">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00042', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00038">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Option code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00043', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Attribute_Find_Code( Products.d.id, l.attribute_code ) }">
		
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Option_Find_Code( Attributes.d.id, l.option_code ) }">
	
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{Option_Delete( Options.d.id ) }">

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

<MvFUNCTION NAME = "PRV_Action_Store_Delete_Product" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00039">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00044', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Product_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Delete( Products.d.id ) }">
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Store_Add_Update_Category" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.parent" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.active" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00040">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Category code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00045', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvIF EXPR = "{ ( len( l.parent ) EQ 0 ) OR ( l.parent EQ '#NONE#' ) }">
		<MvASSIGN NAME = "l.parent_id" VALUE = "0">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.parent_id" VALUE = "{ Category_Find_Code( l.parent ) }">
		<MvIF EXPR = "{ NOT l.parent_id }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
	</MvIF>
		
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Category_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.name ) }">
			<MvASSIGN NAME = "Categories.d.name" VALUE = "{ l.name }">
		</MvIF>
		<MvIF EXPR = "{ len( l.parent) }">
			<MvASSIGN NAME = "Categories.d.parent_id" VALUE = "{ l.parent_id }">
		</MvIF>
		<MvIF EXPR = "{ len( l.active ) }">
			<MvASSIGN NAME = "Categories.d.active" VALUE = "{ PRV_Parse_Boolean( l.active ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{Category_Update( Categories.d.id, Categories.d.parent_id, Categories.d.code, Categories.d.name, Categories.d.active ) }">
	<MvELSE>
		<MvIF EXPR = "{ len( l.name ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00041">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					Category name required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00046', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		<MvASSIGN NAME = "l.active" VALUE = "{ PRV_Parse_Boolean( l.active ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Category_Insert( l.parent_id, l.code, l.name, l.active ) }">
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Store_Delete_Category" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00042">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Category code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00047', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Category_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Category_Delete( Categories.d.id ) }">
	</MvIF>

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

<MvFUNCTION NAME = "PRV_Action_Store_Category_Add_Product" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.category_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvIF EXPR = "{ len( l.category_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00043">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Category code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00048', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.category_id" VALUE = "{ Category_Find_Code( l.category_code ) }">
	<MvIF EXPR = "{ NOT l.category_id }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00044">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				At least one product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00049', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvWHILE EXPR = "{ len( l.product_code ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.product_id" VALUE = "{ Product_Find_Code( l.product_code ) }">
		<MvIF EXPR = "{ NOT l.product_id }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ CategoryXProduct_Find( l.category_id, l.product_id ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ CategoryXProduct_Insert( l.category_id, l.product_id ) }">
		</MvIF>
		
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		
	</MvWHILE>

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



<MvFUNCTION NAME = "PRV_Action_Store_Category_Remove_Product" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.category_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.category_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00045">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Category code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00050', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.category_id" VALUE = "{ Category_Find_Code( l.category_code ) }">
	<MvIF EXPR = "{ NOT l.category_id }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-PRV-00046">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				At least one product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-PRV-00051', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvWHILE EXPR = "{ len( l.product_code ) }">
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.product_id" VALUE = "{ Product_Find_Code( l.product_code ) }">
		<MvIF EXPR = "{ NOT l.product_id }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ CategoryXProduct_Find( l.category_id, l.product_id ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ CategoryXProduct_Delete( l.category_id, l.product_id ) }">
		</MvIF>
		
		<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
		<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
		
	</MvWHILE>

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

<MvFUNCTION NAME = "PRV_ErrorMessage" PARAMETERS = "" STANDARDOUTPUTLEVEL = "">  
	<MvLOCALIZED NAME = "l.message" ID = "MER-PRV-00047">
		<MvLOCALIZED-TOKEN NAME = "error" VALUE = "{ ltrim( rtrim( g.Error_Message ) ) }">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Error: %error%</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvFUNCTIONRETURN VALUE = "{ PRV_LogMessage( l.message ) }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_LogWarning" PARAMETERS = "warning" STANDARDOUTPUTLEVEL = "">  
	<MvLOCALIZED NAME = "l.message" ID = "MER-PRV-00048">
		<MvLOCALIZED-TOKEN NAME = "warning" VALUE = "{ ltrim( rtrim( l.warning ) ) }">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Warning: %warning%</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvFUNCTIONRETURN VALUE = "{ PRV_LogMessage( l.message ) }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Error_StoreRequired" PARAMETERS = "action" STANDARDOUTPUTLEVEL = "">  
	<MvLOCALIZED NAME = "l.message" ID = "MER-PRV-00049">
		<MvLOCALIZED-TOKEN NAME = "action" VALUE = "{ l.action }">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Error: store must be specified.</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvFUNCTIONRETURN VALUE = "{ PRV_LogMessage( l.message ) }">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_LogMessage" PARAMETERS = "message" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.time_t" VALUE = "{ s.dyn_time_t }">
	<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( l.time_t, s.miva_language ) }">
	<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time_Short( l.time_t, s.miva_language ) }">
	
	<MvASSIGN NAME = "l.message" VALUE = "{ ltrim( rtrim( l.message ) ) }">
	<MvLOCALIZED NAME = "l.log_message" ID = "MER-PRV-00050">
		<MvLOCALIZED-TOKEN NAME = "date" VALUE = "{ l.formated_date }">
		<MvLOCALIZED-TOKEN NAME = "time" VALUE = "{ l.formated_time }">
		<MvLOCALIZED-TOKEN NAME = "line" VALUE = "{ g.PRV_line }">
		<MvLOCALIZED-TOKEN NAME = "message" VALUE = "{ l.message }">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">%date% %time% line: %line% %message%</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvEXPORT FILE = "provide.log" FIELDS = "l.log_message" DELIMITER = "">
	
	<MvFUNCTIONRETURN VALUE = "0">
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Parse_Boolean" PARAMETERS = "flag" STANDARDOUTPUTLEVEL = "">
	<MvIF EXPR = "{ toupper( substring( ltrim( l.flag ),1 ,1 ) ) EQ 'Y' }">
		<MvFUNCTIONRETURN VALUE = "1">
	<MvELSE>
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
</MvFUNCTION>

<MvFUNCTION NAME = "PRV_Parse_Tristate" PARAMETERS = "flag" STANDARDOUTPUTLEVEL = "">
	<MvIF EXPR = "{ toupper( substring( ltrim( l.flag ),1 ,1 ) ) EQ 'Y' }">
		<MvFUNCTIONRETURN VALUE = "y">
	<MvELSE>
		<MvIF EXPR = "{ toupper( substring( ltrim( l.flag ),1 ,1 ) ) EQ 'N' }">
			<MvFUNCTIONRETURN VALUE = "n">
		<MvELSE>
			<MvFUNCTIONRETURN VALUE = "">
		</MvIF>
	</MvIF>
</MvFUNCTION>


