<?php
/*
 * shopping/flag/Delete.class.php
 * 
 * CopyRight(C) 2010 Shopformer Development Team. All Right Reserved
 * URL: http://sourceforge.jp/projects/shopformer/
 * 
 * 
 * Mail: m_nakashima@users.sourceforge.jp
 * Last Update: 2010-02-12
 * 
 */
require_once( dirname(dirname(__FILE__))
.DIRECTORY_SEPARATOR.'PackageConfig.class.php' );
require_once( dirname(dirname(dirname(__FILE__)))
.DIRECTORY_SEPARATOR.'content'
.DIRECTORY_SEPARATOR.'Uploader.class.php');
class shopping_flag_Delete extends system_login_ModuleBase {
	
	function shopping_flag_Delete(){
	}
	function execute( & $request ) {
		
		$dbo					= $request->getAttribute( 'dbo' );
		$shoppingProductFlagNumber	= stripslashes( $_GET['shpfn'] );
		$shoppingProductFlagObject	= spider_Controller::createObject('shopping_DaoShoppingProductFlag');
		$loginUserObject		= $this->getLoginUserObject( $request );
		
		// セッションにないなら作成する
		if( strlen(trim($shoppingProductFlagNumber)) > 0 ) {
			// IDが指定されているなら編集のため読み込み
			if( $dbo->loadByNumber( $shoppingProductFlagObject, $shoppingProductFlagNumber ) ){
				$shoppingProductFlagObject->modifier_id	= $loginUserObject->getUniqueId();
				// IDが存在するなら削除処理
				$shoppingProductFlagObject->status_flag	= 255;
				$shoppingProductFlagObject->updated_date	= date('Y-m-d H:i:s');
				if( $dbo->update( $shoppingProductFlagObject,true ) ) {
				} else {
					$request->addLocaledError('database2.error.delete',SPIDER_LOG_LEVEL_FATAL,array(''));
				}
			} else {
				$request->addLocaledError('shopping.error.flag.notfound',SPIDER_LOG_LEVEL_FATAL,array(''));
			}
		} else {
			// IDが指定されていないならエラー
			$request->addLocaledError('shopping.error.flag.selectflag',SPIDER_LOG_LEVEL_FATAL,array(''));
		}
		$request->setAttribute('shopping.flag.flag_object',		$shoppingProductFlagObject);
	}
}
?>