<?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     Seller.Itemexhibit.Now.Updconfirm
 * @author      S.Oguma <shinichiro.oguma@netnee.jp>
 * @access      public
 */
class Seller_Itemexhibit_Now_Updconfirm
{
    var $auth;
    var $session;

    var $title;

    var $results;
    var $actionChain;

    var $list_check;
    var $list_check_serial;

    // 入力パラメータ
    var $cd;           // itemcd|structcd|stockcd|updcnt
    var $sellingprice;
    var $souryouprc;
    var $itemcd;
    var $structcd;
    var $stockcd;
    var $upduser;
    var $updcnt;

    // DB
    var $itemexhibit;
    var $data;
    var $cnt;
    
    // エラー処理
    var $errormsg;


	var $sort;
	var $pageID;
	var $listsize;
    
    /**
     * Actionの実行
     *
     * @access  public
     */
    function execute()
    {
        $log =& LogFactory::getLog();
        $log->debug("Seller_Itemexhibit_Now_Updconfirmが実行されました", "Seller_Itemexhibit_Now_Updconfirm#execute");

        $params = array();

        if( $this->itemcd != "" && $this->structcd != "" && $this->stockcd != "" )
        {
            if(!($this->sellingprice > 0))
            {
                $this->errormsg = "価格として正しい数値を入力してください";
                return "error";
            }
            if(!($this->souryouprc >= 0))
            {
                $this->errormsg = "送料として正しい数値を入力してください";
                return "error";
            }
            $params[] = array(
                    "price"    => $this->sellingprice,
                    "souryou"  => $this->souryouprc,
                    "itemcd"   => $this->itemcd,
                    "structcd" => $this->structcd,
                    "stockcd"  => $this->stockcd,
                    "updcnt"   => $this->updcnt
                    );
        } else {
            $this->errormsg = "コードが指定されていません";
            return "error";
        }

        // 販売価格変更
        foreach ( $params as $key=>$val ) {
            $rc = $this->itemexhibit->updatePrice($val["price"],
                                            $val["souryou"],
                                            $val["itemcd"],
                                            $val["structcd"],
                                            $val["stockcd"],
                                            $this->upduser,
                                            $val["updcnt"]);
            if( !$rc )
            {
                $this->errormsg = "DB上でエラーが発生しました";
                return "error";
            }
        }

        return 'success';
    }

	function setList_check(&$list_check)
	{
   		 $this -> list_check =& $list_check;
	}

    function getList_check()
	{
    	return $this -> list_check;
	}

    function setList_check_serial($value)
    {
        $value = urldecode($value);
        $this -> list_check_serial = $value;
        $this -> list_check = unserialize($value);
    }

    function getList_check_serial()
    {
        return urlencode(serialize($this -> list_check));
    }
}
?>