<?php
/*
 * shopping/product/unit/upload/Form.class.php
 * 
 * CopyRight(C) 2010 Shopformer Development Team. All Right Reserved
 * URL: http://sourceforge.jp/projects/shopformer/
 * 
 * 
 * Mail: m_nakashima@users.sourceforge.jp
 * Auther: Masanori Nakashima
 * Last Update: 2010-06-18
 */
require_once(dirname(dirname(dirname(__FILE__)))
.DIRECTORY_SEPARATOR.'PackageConfig.class.php');
class shopping_product_upload_Form extends system_login_ModuleBase {
	
	function shopping_product_upload_Form(){
	}
	function execute( & $request ) {

		$dbo 					= $request->getAttribute( 'dbo' );
		$sessionHashName		= 'shopping.product.upload.columnSelectedArray';
		$sessionInfoName		= 'shopping.product.upload.registInformationHash';
		$registInformationHash	= $request->getSession($sessionInfoName);
		// セッション登録済みのカラム定義を確認
		$columnSelectedArray	= $request->getSession($sessionHashName);
		if( !is_array($columnSelectedArray) ) {
			$columnSelectedArray	= array_keys($GLOBALS['SHOPPING_PRODUCT_CSV_DEFINITION']);
			$columnSelectedArray	= array_merge($columnSelectedArray,array_keys($GLOBALS['SHOPPING_PRODUCT_UNIT_CSV_DEFINITION']));
		}
		if( !is_array($registInformationHash) ) {
			$registInformationHash	= array(
				'ignoreFirstLine'		=> true,
				'importImages'		=> true,
			);
		} else {
			if( strlen($registInformationHash['temporaryUri']) > 0 ) {
				if( system_DataFileWriter::isExists( $request, $registInformationHash['temporaryUri'], DIR_NAME_TMP ) ) {
					system_DataFileWriter::delete( $request, $registInformationHash['temporaryUri'], DIR_NAME_TMP );
				}
			}
		}

		$request->setAttribute($sessionHashName, $columnSelectedArray);
		$request->setAttribute($sessionInfoName, $registInformationHash );		
	}
}
?>