<?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     Admin.Itemmanage.Change.Struct.Insert.Done
 * @author      H.Watanabe <hiroshi.watanabe@netnee.jp>
 * @access      public
 */
class Admin_Itemmanage_Change_Struct_Insert_Done
{
    var $itemstruct;

    var $actionChain;

    var $title;
    var $pagename;
    var $actionnm;
    var $from;
    var $div;

    var $itemdiv;
    var $jancode;
    var $hinban;
    var $itemtitle;
    var $release_date_start;
    var $release_date_end;
    var $publish_date_start;
    var $publish_date_end;
    var $maker_capital;
    var $maker_name;
    var $media;
    var $cast;
    var $situation;
    var $photo_situation;
    var $publish_situation;
    var $sort;
    var $genre_select;

    var $cd;
    var $structcd;
    var $itemnm;
    var $variationnm;
    var $jancd;
    var $isbncd;
    var $makeritemcd;
    var $salestartdate;
    var $makerprice;
    var $orderclosedate;
    var $saleformcd;
    var $rectime;
    var $mediacd;
    var $struct_comment;
    var $item_struct_updcnt;

    var $upduser;

    var $option01;
    var $option02;
    var $option03;
    var $option04;
    var $option05;
    var $option06;
    var $option07;
    var $option08;
    var $option09;
    var $option10;

    var $option;

    var $download;

    /**
     * execute
     *
     * @access  public
     */
    function execute()
    {
        $errorList =& $this->actionChain->getCurErrorList();

        $log =& LogFactory::getLog();
        $log->debug("Admin_Itemmanage_Change_Struct_Insert_Doneが実行されました", "Admin_Itemmanage_Change_Struct_Insert_Done#execute");

        if (!empty($this->salestartdate)) {
            $this->salestartdate = str_replace("/", "-", $this->salestartdate);
        }
        if (!empty($this->orderclosedate)) {
            $this->orderclosedate = str_replace("/", "-", $this->orderclosedate);
        }


        $res = $this->itemstruct->insert($this->cd,
                                         $this->variationnm,
                                         $this->makeritemcd,
                                         $this->jancd,
                                         $this->salestartdate,
                                         $this->orderclosedate,
                                         $this->makerprice,
                                         $this->struct_comment,
                                         $this->option01,
                                         $this->option02,
                                         $this->option03,
                                         $this->option04,
                                         $this->option05,
                                         $this->option06,
                                         $this->option07,
                                         $this->option08,
                                         $this->option09,
                                         $this->option10,
                                         $this->download,
                                         $this->upduser);

        if (is_array($res)){
            $errorList -> add("Error", $res["errmsg"]);
            return 'error';
        }
        if (is_object($res)){
            return 'error';
        }
        if ($res===false){
            return 'error';
        }

        return 'done_success';
    }
}
?>
