<?php
/*
 * member/mail/Delete.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(__FILE__))
.DIRECTORY_SEPARATOR.'PackageConfig.class.php');
class member_mail_Delete extends system_login_ModuleBase {
	var $errors				= array();
	function member_mail_Delete() {
		array_push($this->require_module_array,'database2.Connect');
	}
	function execute( & $request ) {
		$dbo				= $request->getAttribute( 'dbo' );
		$mail_id			= stripslashes( $_POST['mail_id'] );
		$mail_object		= spider_Controller::createObject('member_DaoMemberMail');
		if ( strlen(trim($mail_id)) == 0 ) {
			$request->addLocaledError('member.error.mail.requireid',SPIDER_LOG_LEVEL_FATAL,array(''));
		} else if( !$dbo->loadById( $mail_object, $mail_id) ){
			$request->addLocaledError('member.error.mail.notfound',SPIDER_LOG_LEVEL_FATAL,array(''));
		} else if( $mail_object->status_flag == 255 ){
			$request->addLocaledError('member.error.mail.notfound',SPIDER_LOG_LEVEL_FATAL,array(''));
		} else {
			$mail_object->status_flag		= 255;
			$mail_object->updated_date	= date( 'Y-m-d H:i:s' );
			if ( $dbo->update( $mail_object, true ) ) {
			} else {
				$request->addLocaledError('database2.error.update',SPIDER_LOG_LEVEL_FATAL,array(""));
			}
		}
		$request->setAttribute( 'member.mail.mail_object', $mail_object );
	}
}
?>