<MvCOMMENT>
|
| Miva Merchant v4.x
|
| This file and the source codes contained herein are the property 
| of Miva Corporation.  Use of this file is restricted to the specific 
| terms and conditions in the License Agreement associated with this 
| file.  Distribution of this file or portions of this file for uses
| not covered by the License Agreement is not allowed without a written 
| agreement signed by an officer of Miva Corporation.
| 
| Copyright 1998-2001 Miva Corporation.  All rights reserved.
| http://www.miva.com/
|
| dBase III Database Layer
| $Source: /home/cvs/merchant/Merchant/features/rpd/rpd_ad.mv,v $
|
| Prefix         : MER-RPD-AD
| Next Error Code: 2    
| Next Text ID   : 11   
|
</MvCOMMENT>
<MvFUNCTION NAME = "RPD_Generate_Tab" STANDARDOUTPUTLEVEL = "text,html,compresswhitespace">
	<MvLOCALIZED NAME = "l.tab" ID = "MER-RPD-AD00000">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">RELP:Related Products</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

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

<MvFUNCTION NAME = "RPD_Tab" STANDARDOUTPUTLEVEL = "text,html,compresswhitespace">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_view"	VALUE = "{ CanI( 'PROD', 1, 0, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add"	VALUE = "{ CanI( 'PROD', 0, 1, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'PROD', 0, 0, 1, 0 ) }">

	<MvLOCALIZED NAME = "l.text" ID = "MER-RPD-AD00001">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Sorting items cannot be undone by pressing the reset button.\n\nContinue?</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.javascript" VALUE = "{ JavaScript_Set_A_Variable( 'text', l.text ) }">
	<MvEVAL EXPR = "{ l.javascript }">
	<SCRIPT LANGUAGE = "JavaScript">
<!--
function SwapProducts( prod_code1, prod_code2 )
{
if ( CheckModified() )
{
document.forms[ Screen ].elements[ 'Action' ].value = 'PSRT';
document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
document.forms[ Screen ].elements[ 'Swap_Product_1' ].value = unescape( prod_code1 );
document.forms[ Screen ].elements[ 'Swap_Product_2' ].value = unescape( prod_code2 );
document.forms[ Screen ].submit();
}
}
function SortRelatedProducts( key )
{
if ( CheckModified() )
{
if ( confirm( text ) )
{
	document.forms[ Screen ].elements[ 'Product_Sort' ].value = '1';
	document.forms[ Screen ].elements[ 'Action' ].value = 'PSRT';
	if ( key == 'aname')
	{
		document.forms[ Screen ].elements[ 'Product_Sort_By' ].value = 'name';
		document.forms[ Screen ].elements[ 'Product_Sort_Ascending' ].value = '1';
	}
	else
	{
		if ( key == 'dname')
		{
			document.forms[ Screen ].elements[ 'Product_Sort_By' ].value = 'name';
			document.forms[ Screen ].elements[ 'Product_Sort_Ascending' ].value = '0';
		}
		else
		{
			if ( key == 'acode')
			{
				document.forms[ Screen ].elements[ 'Product_Sort_By' ].value = 'code';
				document.forms[ Screen ].elements[ 'Product_Sort_Ascending' ].value = '1';
			}
			else
			{
				if ( key == 'dcode')
				{
					document.forms[ Screen ].elements[ 'Product_Sort_By' ].value = 'code';
					document.forms[ Screen ].elements[ 'Product_Sort_Ascending' ].value = '0';
				}
				else
				{
					document.forms[ Screen ].elements[ 'Product_Sort' ].value = '0';
				}
			}
		}
	}

	document.forms[ Screen ].submit();
}
}
}
//-->
	</SCRIPT>

	<INPUT TYPE = "hidden" NAME = "Product_Sort" VALUE = "">
	<INPUT TYPE = "hidden" NAME = "Product_Sort_By" VALUE = "">
	<INPUT TYPE = "hidden" NAME = "Product_Sort_Ascending" VALUE = "">

	<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">

	<TR><TD ALIGN = "left" VALIGN = "middle" WIDTH = "100%">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1">
		<INPUT TYPE = "hidden" NAME = "RelatedProduct_Show" VALUE = "{ encodeentities( g.RelatedProduct_Show ) }">

		<A HREF = "JavaScript:ListReloadField( 'RelatedProduct_Offset', 'RelatedProduct_Stack', 'RelatedProduct_Show', 'All' );">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_all" VALUE = "{ DrawImgButton_All( g.RelatedProduct_Show EQ 'All' ) }">
		<MvEVAL EXPR = "{ l.button_all }"></A>
		<A HREF = "JavaScript:ListReloadField( 'RelatedProduct_Offset', 'RelatedProduct_Stack', 'RelatedProduct_Show', 'Unassigned' );">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_unassign" VALUE = "{ DrawImgButton_Unassigned( g.RelatedProduct_Show EQ 'Unassigned' ) }">
		<MvEVAL EXPR = "{ l.button_unassign }"></A>
		<A HREF = "JavaScript:ListReloadField( 'RelatedProduct_Offset', 'RelatedProduct_Stack', 'RelatedProduct_Show', 'Assigned' );">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_assign" VALUE = "{ DrawImgButton_Assigned( g.RelatedProduct_Show EQ 'Assigned' ) }">
		<MvEVAL EXPR = "{ l.button_assign }"></A>
		</FONT>
	</TD><TD ALIGN = "right" VALIGN = "middle">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
		<MvLOCALIZED ID = "MER-RPD-AD00002">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Search:</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD ALIGN = "right" VALIGN = "middle" NOWRAP>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1">
		<MvASSIGN NAME = "g.Product_Search" VALUE = "{ ltrim( rtrim( g.Product_Search ) ) }">
		<INPUT TYPE = "text" NAME = "Product_Search" VALUE = "{ encodeentities( g.Product_Search ) }" SIZE = 20>
		<A HREF = "JavaScript:ListReload( 'RelatedProduct_Offset', 'RelatedProduct_Stack' );">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_search" VALUE = "{ DrawImgButton_Search(0) }">
		<MvEVAL EXPR = "{ l.button_search }"></A>
		</FONT>
	</TD></TR>

	</TABLE>

	<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
	<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-RPD-AD00003">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Assigned</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT><BR>
		<MvLOCALIZED NAME = "l.check_all" ID = "MER-RPD-AD00009">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Check All</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvLOCALIZED NAME = "l.uncheck_all" ID = "MER-RPD-AD00010">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Uncheck All</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<A HREF = "JavaScript:CheckAll( 'RelatedProduct_Assigned', 1 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'checkall.gif' }" ALT = "{ l.check_all }"></A>
		&nbsp;
		<A HREF = "JavaScript:CheckAll( 'RelatedProduct_Assigned', 0 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'uncheckall.gif' }" ALT = "{ l.uncheck_all }"></A>
	</TD><TD BGCOLOR = "#000080">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-RPD-AD00004">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Code</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD BGCOLOR = "#000080" WIDTH = "100%">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
		<MvLOCALIZED ID = "MER-RPD-AD00005">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Name</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
		<MvIF EXPR = "{ l.can_product_add }">
			<MvLOCALIZED NAME = "l.alt" ID = "MER-RPD-AD00006">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Product</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<A HREF = "{ g.sessionurl $ 'Screen=PROD&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Category_Code=' $ encodeattribute( g.Category_Code ) }">
			<MvEVAL EXPR = "{ DrawImgButton_NewX( 0, l.alt ) }"></A>
		<MvELSE>
			&nbsp;
		</MvIF>
		</FONT>
	</TD></TR>

	<MvASSIGN NAME = "l.shown" VALUE = 0>
	<MvASSIGN NAME = "l.lastoffset" VALUE = 0>
	<MvASSIGN NAME = "l.last_relprod_code" VALUE = "">

	<MvIF EXPR = "{ ( g.RelatedProduct_Show EQ 'All' ) OR ( g.RelatedProduct_Show EQ 'Unassigned' ) }">
		<MvASSIGN NAME = "l.assigned" VALUE = 0>
	</MvIF>

	<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'Assigned' }">
		<MvASSIGN NAME = "l.assigned" VALUE = 1>
	</MvIF>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Product_Find_Code( g.Edit_Product ) }">
	<MvIF EXPR = "{ l.found }">
		<MvASSIGN NAME = "l.current_id" VALUE = "{ Products.d.id }">
	</MvIF>

	<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'All' }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.nextoffset" VALUE = "{ Product_FindOffset_All( g.RelatedProduct_Offset, g.Product_Search ) }">
	</MvIF>
	<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'Unassigned' }">
		<MvDO FILE = "{ g.Module_Feature_RPD_DB }" NAME = "l.nextoffset" VALUE = "{ RelatedProduct_FindOffset_Unassigned( l.current_id , g.RelatedProduct_Offset, g.Product_Search ) }">
	</MvIF>

	<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'Assigned' }">
		<MvDO FILE = "{ g.Module_Feature_RPD_DB }" NAME = "l.nextoffset" VALUE = "{ RelatedProduct_FindOffset_Assigned( l.current_id, g.RelatedProduct_Offset, g.Product_Search ) }">
	</MvIF>

	<MvWHILE EXPR = "{ ( l.shown LT g.RelatedProduct_Display ) AND l.nextoffset }">

		<MvASSIGN NAME = "l.relprod_id" VALUE = "{ Products.d.id }">
		<MvASSIGN NAME = "l.relprod_code" VALUE = "{ Products.d.code }">
		<MvASSIGN NAME = "l.relprod_name" VALUE = "{ Products.d.name }">
		<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">

		<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'All' }">
			<MvDO FILE = "{ g.Module_Feature_RPD_DB }" NAME = "l.assigned" VALUE = "{ RelatedProduct_CheckAssigned( l.current_id, Products.d.id ) }">
			<MvDO FILE = "{ g.Module_Feature_RPD_DB }" NAME = "l.nextoffset" VALUE = "{ RelatedProduct_FindNext_All( l.current_id, l.nextoffset, g.Product_Search ) }">
		</MvIF>

		<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'Unassigned' }">
			<MvDO FILE = "{ g.Module_Feature_RPD_DB }" NAME = "l.nextoffset" VALUE = "{ RelatedProduct_FindNext_Unassigned( l.current_id, l.nextoffset, g.Product_Search ) }">
		</MvIF>

		<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'Assigned' }">
			<MvDO FILE = "{ g.Module_Feature_RPD_DB }" NAME = "l.nextoffset" VALUE = "{ RelatedProduct_FindNext_Assigned( l.current_id, l.nextoffset, g.Product_Search ) }">
		</MvIF>

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

		<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
			<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
		<MvELSE>
			<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
		</MvIF>

		<TR><TD ALIGN = "center" BGCOLOR = "{ l.bgcolor }" VALIGN = "top">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvIF EXPR = "{ l.can_modify }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckboxModAlert( l.assigned, 'RelatedProduct_Assigned[' $ l.shown $ ']', 'Yes', '' ) }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.check_assign" VALUE = "{ DrawCheck_Assigned( l.assigned ) }">
				<MvEVAL EXPR = "{ l.check_assign }">
			</MvIF>
			</FONT>
		</TD><TD BGCOLOR = "{ l.bgcolor }"  VALIGN = "top">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "hidden" NAME = "{ 'RelatedProduct[' $ l.shown $ ']' }" VALUE = "{ encodeentities( l.relprod_code ) }">
			<MvEVAL EXPR = "{ encodeentities( l.relprod_code ) }">
			</FONT>
		</TD><TD BGCOLOR = "{ l.bgcolor }" WIDTH = "100%" VALIGN = "top">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvEVAL EXPR = "{ encodeentities( l.relprod_name ) }">
			</FONT>
		</TD><TD ALIGN = "right" BGCOLOR = "{ l.bgcolor }" NOWRAP VALIGN = "top">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<A HREF = "{ g.sessionurl $ 'Screen=PROD&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Product=' $ encodeattribute( l.relprod_code ) }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_edit" VALUE = "{ DrawImgButton_Edit('0') }">
			<MvEVAL EXPR = "{ l.button_edit }"></A>
			</FONT>
		</TD></TR>

		<MvASSIGN NAME = "l.last_relprod_code" VALUE = "{ l.relprod_code }">
	</MvWHILE>

	<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
		<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
		<MvHIDE FIELDS = "g.RelatedProduct_Stack, g.RelatedProduct_Offset">

		<MvIF EXPR = "{ g.RelatedProduct_Show EQ 'All' }">
			<MvIF EXPR = "{ l.shown }">
				<B><MvEVAL EXPR = "{ g.RelatedProduct_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
			<MvELSE>
				<B>0-0</B>
			</MvIF>
		<MvELSE>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.boldna" VALUE = "{ Show_BoldNA() }">
			<MvEVAL EXPR = "{ l.boldna }">
		</MvIF>

		</FONT>
	</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = "4">
		<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
		<MvIF EXPR = "{ len( g.RelatedProduct_Stack ) }">
			<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListPrevious( \'RelatedProduct_Offset\', \'RelatedProduct_Stack\' );">' }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.draw_prev" VALUE = "{ DrawImgButton_Previous('0') }">
			<MvEVAL EXPR = "{ l.draw_prev }"><MvEVAL EXPR = "</A>">
		</MvIF>

		<INPUT TYPE = "text" NAME = "RelatedProduct_Display" VALUE = "{ encodeentities( g.RelatedProduct_Display ) }" SIZE = 5> 
		<A HREF = "JavaScript:ListReload( 'RelatedProduct_Offset', 'RelatedProduct_Stack' );">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button_refresh" VALUE = "{ DrawImgButton_Refresh('0') }">
		<MvEVAL EXPR = "{ l.button_refresh }"></A>
		<INPUT TYPE = "hidden" NAME = "RelatedProduct_Count" VALUE = "{ encodeentities( l.shown ) }">

		<MvIF EXPR = "{ l.nextoffset }">
			<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'RelatedProduct_Offset\', \'RelatedProduct_Stack\', ' $ l.lastoffset $ ' );">' }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.draw_next" VALUE = "{ DrawImgButton_Next('0') }">
			<MvEVAL EXPR = "{ l.draw_next }"><MvEVAL EXPR = "</A>">
		</MvIF>
		</FONT>
	</TD></TR>
	</TABLE>
</MvFUNCTION>

<MvFUNCTION NAME = "RPD_Provision_RelatedProducts_Add_Product" PARAMETERS = "version, store_code, delimiter, data">
	<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.related_code" 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-RPD-AD00007">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-RPD-AD00000', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<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>
	
	

	<MvWHILE EXPR = "{ len( l.related_code ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.related_code ) }">

		<MvIF EXPR = "{ NOT l.ok }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_RPD_DB}" NAME = "l.found" VALUE = "{ RelatedProduct_Find_ID( l.product_id, Products.d.id ) }">

		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Feature_RPD_DB}" NAME = "l.ok" VALUE = "{ RelatedProduct_Insert( l.product_id, Products.d.id ) }">
		</MvIF>
		<MvASSIGN NAME = "l.related_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 = "RPD_Provision_RelatedProducts_Remove_Product" PARAMETERS = "version, store_code, delimiter, data">
	<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.related_code" 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-RPD-AD00008">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Product code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-RPD-AD00001', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<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>
	
	

	<MvWHILE EXPR = "{ len( l.related_code ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Product_Find_Code( l.related_code ) }">

		<MvIF EXPR = "{ NOT l.ok }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_RPD_DB}" NAME = "l.found" VALUE = "{ RelatedProduct_Find_ID( l.product_id, Products.d.id ) }">

		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Feature_RPD_DB}" NAME = "l.ok" VALUE = "{ RelatedProduct_Delete( l.product_id, Products.d.id ) }">
		</MvIF>
		<MvASSIGN NAME = "l.related_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>
