<?php
/**
 * @copyright ONE/DEPO Project
 * @license   PHP License 3.01 <http://www.php.net/license/3_01.txt>
 */

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * [[機能説明]]
 * ユーザー出品情報 - 詳細
 *
 * @package     [[package名]]
 * @author      T.Shimano
 * @access      public
 */
class Admin_Usermanage_Itemexhibit_Detail
{
	// ページ情報
	var $pagename;
	var $title;

	// 入力パラメータ
    var $itemcd;
    var $structcd;
    var $stockcd;
    var $sellercd;
    var $pageID;
    var $sort;
    var $listsize;
    
    // 検索パラメータ
    var $exno;
    var $titlenm;
    var $scdcompdate;
    var $membercd;
    var $membernm;
    var $mailaddr;
    var $image;
    var $status;
    
    // DB
    var $itemexhibit;
    var $order;
    var $data;

    //　エラー処理
    var $errormsg;
    
    
    function execute()
    {
    	// データ取得
    	$row = $this->itemexhibit->getOneItemexhibit($this->itemcd, $this->structcd, $this->stockcd, $this->sellercd);
    	if( count($row) != 1)
    	{
    	    $this->errormsg = "対象のデータが見つかりませんでした";
    	    return "input";
    	}
    	
    	$ordercount = $this->order->getSumOrderCount($this->itemcd, $this->structcd, $this->stockcd);
    	$row[0]["exhibitcount"] -= $ordercount;
    	if($row[0]["exhibitcount"] <= 0)
    	{
    	    $this->errormsg = "出品数が０の在庫データにアクセスしました";
    	    return "input";
    	}
    	    	
    	$this->data = $row[0];
    	
    	// ログ出力
        $log =& LogFactory::getLog();
        $log->debug("Admin_Usermanage_Itemexhibit_Detailが実行されました", "Admin_Usermanage_Itemexhibit_Detail#execute");
        return 'success';
    }

    function getFrom()
    {
        return "itemexhibit_detail&itemcd=".$this->itemcd."&structcd=".$this->structcd."&stockcd=".$this->stockcd."&sellercd=".$this->sellercd;
    }
    
    function getReturnTags()
    {
        $extratag = "";
    
        if(isset($this->exno)){
            $extratag .= '<input type="hidden" name="exno" value="'.$this->exno.'">'."\n";
        }
        if(isset($this->titlenm)){
            $extratag .= '<input type="hidden" name="titlenm" value="'.$this->titlenm.'">'."\n";
        }
        if(isset($this->scdcompdate)){
            $extratag .= '<input type="hidden" name="scdcompdate" value="'.$this->scdcompdate.'">'."\n";
        }
        if(isset($this->membercd)){
            $extratag .= '<input type="hidden" name="membercd" value="'.$this->membercd.'">'."\n";
        }
        if(isset($this->membernm)){
            $extratag .= '<input type="hidden" name="membernm" value="'.$this->membernm.'">'."\n";
        }
        if(isset($this->mailaddr)){
            $extratag .= '<input type="hidden" name="mailaddr" value="'.$this->mailaddr.'">'."\n";
        }
        if(isset($this->image)){
            $extratag .= '<input type="hidden" name="image" value="'.$this->image.'">'."\n";
        }
        if(isset($this->status)){
            $extratag .= '<input type="hidden" name="status" value="'.$this->status.'">'."\n";
        }
        if(isset($this->pageID)){
            $extratag .= '<input type="hidden" name="pageID" value="'.$this->pageID.'">'."\n";
        }
        if(isset($this->sort)){
            $extratag .= '<input type="hidden" name="sort" value="'.$this->sort.'">'."\n";
        }
        if(isset($this->listsize)){
            $extratag .= '<input type="hidden" name="listsize" value="'.$this->listsize.'">'."\n";
        }

        return $extratag;
    }
}
?>