Index: branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php
===================================================================
--- branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php	(revision 17234)
+++ branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_Pdf.php	(revision 18007)
@@ -1,3 +1,3 @@
-﻿<?php
+<?php
 /*
  * This file is part of EC-CUBE
@@ -51,12 +51,12 @@
         $this->tpl_subtitle = '帳票出力';
 
-		    $this->SHORTTEXT_MAX = STEXT_LEN;
-		    $this->MIDDLETEXT_MAX = MTEXT_LEN;
-		    $this->LONGTEXT_MAX = LTEXT_LEN;
+        $this->SHORTTEXT_MAX = STEXT_LEN;
+        $this->MIDDLETEXT_MAX = MTEXT_LEN;
+        $this->LONGTEXT_MAX = LTEXT_LEN;
 
-		    $this->arrType[0]  = "納品書";
+        $this->arrType[0]  = "納品書";
 
-		    $this->arrDownload[0] = "ブラウザに開く";
-		    $this->arrDownload[1] = "ファイルに保存";
+        $this->arrDownload[0] = "ブラウザに開く";
+        $this->arrDownload[1] = "ファイルに保存";
     }
 
@@ -102,5 +102,13 @@
             // エラー入力なし
             if (count($this->arrErr) == 0) {
-                $objFpdf = new SC_Fpdf($arrRet);
+                $i = 0;
+                $objFpdf = new SC_Fpdf($arrRet['download'], $arrRet['title']);
+                foreach ( $arrRet['order_id'] AS $key=>$val ) {
+                    $arrPdfData = $arrRet;
+                    $arrPdfData['order_id'] = $val;
+                    $objFpdf->setData($arrPdfData);
+                    ++$i;
+                }
+                $objFpdf->createPdf();
             }
             break;
@@ -121,5 +129,10 @@
             // 受注番号があったら、セットする
             if(SC_Utils_Ex::sfIsInt($_GET['order_id'])) {
-	              $arrForm['order_id'] = $_GET['order_id'];
+                  $arrForm['order_id'][0] = $_GET['order_id'];
+            } elseif (is_array($_POST['pdf_order_id'])) {
+                    sort($_POST['pdf_order_id']);
+                    foreach ($_POST['pdf_order_id'] AS $key=>$val) {
+                          $arrForm['order_id'][] = $val;
+                    }
             }
 
Index: branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order.php
===================================================================
--- branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order.php	(revision 17738)
+++ branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order.php	(revision 18007)
@@ -124,4 +124,5 @@
         case 'delete':
         case 'csv':
+        case 'pdf':
         case 'delete_all':
         case 'search':
@@ -286,4 +287,9 @@
                     SC_Utils_Ex::sfCSVDownload($head.$data);
                     exit;
+                    break;
+                case 'pdf':
+                    $objFpdf = new SC_Fpdf(1, '納品書');
+                    $objFpdf->setData($arrRet);
+                    $objFpdf->createPdf();
                     break;
                 case 'delete_all':
Index: branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php
===================================================================
--- branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php	(revision 18007)
+++ branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_ProductSelect.php	(revision 18007)
@@ -0,0 +1,379 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * 商品選択 のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Admin_Order_ProductSelect extends LC_Page {
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init() {
+        parent::init();
+        $this->tpl_mainpage = 'order/product_select.tpl';
+        $this->tpl_mainno = 'order';
+        $this->tpl_subnavi = '';
+        $this->tpl_subno = "";
+        $this->tpl_subtitle = '商品選択';
+
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process() {
+        $conn = new SC_DBConn();
+        $objView = new SC_AdminView();
+        $objSess = new SC_Session();
+        $objDb = new SC_Helper_DB_Ex();
+        $objQuery = new SC_Query();
+
+        // 認証可否の判定
+        SC_Utils_Ex::sfIsSuccess($objSess);
+
+        if (!isset($_POST['mode'])) $_POST['mode'] = "";
+
+        if ($_GET['no'] != '') {
+            $this->tpl_no = strval($_GET['no']);
+        }elseif ($_POST['no'] != '') {
+            $this->tpl_no = strval($_POST['no']);
+        }
+
+        if ($_POST['mode'] == "search") {
+
+            // POST値の引き継ぎ
+            $this->arrForm = $_POST;
+            // 入力文字の強制変換
+            $this->lfConvertParam();
+
+            $where = "del_flg = 0";
+
+            /* 入力エラーなし */
+            foreach ($this->arrForm as $key => $val) {
+                if($val == "") {
+                    continue;
+                }
+                switch ($key) {
+                case 'search_name':
+                    $where .= " AND name ILIKE ?";
+                    $arrval[] = "%$val%";
+                    break;
+                case 'search_category_id':
+                    list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val);
+                    if($tmp_where != "") {
+                        $where.= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
+                        $arrval = array_merge((array)$arrval, (array)$tmp_arrval);
+                    }
+                    break;
+                case 'search_product_code':
+                    $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
+                    $arrval[] = "$val%";
+                    break;
+                default:
+                    break;
+                }
+            }
+
+
+            /*
+            $order = "update_date DESC, product_id DESC ";
+
+            // 読み込む列とテーブルの指定
+            $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
+            $from = "vw_products_nonclass AS noncls ";
+            */
+            $col = "DISTINCT T1.product_id, product_code_min, product_code_max,"
+                 . " price01_min, price01_max, price02_min, price02_max,"
+                 . " stock_min, stock_max, stock_unlimited_min,"
+                 . " stock_unlimited_max, del_flg, status, name, comment1,"
+                 . " comment2, comment3, main_list_comment, main_image,"
+                 . " main_list_image, product_flag, deliv_date_id, sale_limit,"
+                 . " point_rate, sale_unlimited, create_date, deliv_fee, "
+                 . " T4.product_rank, T4.category_rank";
+            $from = "vw_products_allclass AS T1"
+                  . " JOIN ("
+                  . " SELECT max(T3.rank) AS category_rank,"
+                  . "        max(T2.rank) AS product_rank,"
+                  . "        T2.product_id"
+                  . "   FROM dtb_product_categories T2"
+                  . "   JOIN dtb_category T3 USING (category_id)"
+                  . " GROUP BY product_id) AS T4 USING (product_id)";
+            $order = "T4.category_rank DESC, T4.product_rank DESC";
+
+            $objQuery = new SC_Query();
+            // 行数の取得
+            if (empty($arrval)) {
+                $arrval = array();
+            }
+            $linemax = $objQuery->count("dtb_products", $where, $arrval);
+            $this->tpl_linemax = $linemax;              // 何件が該当しました。表示用
+
+            // ページ送りの処理
+            if(isset($_POST['search_page_max'])
+               && is_numeric($_POST['search_page_max'])) {
+                $page_max = $_POST['search_page_max'];
+            } else {
+                $page_max = SEARCH_PMAX;
+            }
+
+            // ページ送りの取得
+            $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
+            $this->tpl_strnavi = $objNavi->strnavi;     // 表示文字列
+            $startno = $objNavi->start_row;
+
+            // 取得範囲の指定(開始行番号、行数のセット)
+            if(DB_TYPE != "mysql") $objQuery->setlimitoffset($page_max, $startno);
+            // 表示順序
+            $objQuery->setorder($order);
+
+            // viewも絞込みをかける(mysql用)
+            //sfViewWhere("&&noncls_where&&", $where, $arrval, $objQuery->order . " " .  $objQuery->setlimitoffset($page_max, $startno, true));
+
+            // 検索結果の取得
+            $this->arrProducts = $objQuery->select($col, $from, $where, $arrval);
+
+            // 規格名一覧
+            $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
+
+            // 規格分類名一覧
+            $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+
+            // 規格セレクトボックス設定
+            for($i = 0; $i < count($this->arrProducts); $i++) {
+                $this->lfMakeSelect($this->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);
+                // 購入制限数を取得
+                $this->lfGetSaleLimit($this->arrProducts[$i]);
+            }
+        }
+
+        // カテゴリ取得
+        $this->arrCatList = $objDb->sfGetCategoryList();
+
+        //---- ページ表示
+        $objView->assignobj($this);
+        $objView->display($this->tpl_mainpage);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy() {
+        parent::destroy();
+    }
+
+    /* 取得文字列の変換 */
+    function lfConvertParam() {
+        /*
+         *  文字列の変換
+         *  K :  「半角(ﾊﾝｶｸ)片仮名」を「全角片仮名」に変換
+         *  C :  「全角ひら仮名」を「全角かた仮名」に変換
+         *  V :  濁点付きの文字を一文字に変換。"K","H"と共に使用します
+         *  n :  「全角」数字を「半角(ﾊﾝｶｸ)」に変換
+         */
+        $arrConvList['search_name'] = "KVa";
+        $arrConvList['search_product_code'] = "KVa";
+
+        // 文字変換
+        foreach ($arrConvList as $key => $val) {
+            // POSTされてきた値のみ変換する。
+            if(isset($this->arrForm[$key])) {
+                $this->arrForm[$key] = mb_convert_kana($this->arrForm[$key] ,$val);
+            }
+        }
+    }
+
+    /* 規格セレクトボックスの作成 */
+    function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) {
+
+        $classcat_find1 = false;
+        $classcat_find2 = false;
+        // 在庫ありの商品の有無
+        $stock_find = false;
+
+        // 商品規格情報の取得
+        $arrProductsClass = $this->lfGetProductsClass($product_id);
+
+        // 規格1クラス名の取得
+        $this->tpl_class_name1[$product_id] =
+            isset($arrClassName[$arrProductsClass[0]['class_id1']])
+            ? $arrClassName[$arrProductsClass[0]['class_id1']]
+            : "";
+
+        // 規格2クラス名の取得
+        $this->tpl_class_name2[$product_id] =
+            isset($arrClassName[$arrProductsClass[0]['class_id2']])
+            ? $arrClassName[$arrProductsClass[0]['class_id2']]
+            : "";
+
+        // すべての組み合わせ数
+        $count = count($arrProductsClass);
+
+        $classcat_id1 = "";
+
+        $arrSele = array();
+        $arrList = array();
+
+        $list_id = 0;
+        $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'";
+        $arrVal[0] = "\tval". $product_id. "_0 = new Array(''";
+
+        for ($i = 0; $i < $count; $i++) {
+            // 在庫のチェック
+            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
+                continue;
+            }
+
+            $stock_find = true;
+
+            // 規格1のセレクトボックス用
+            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
+                $arrList[$list_id].=");\n";
+                $arrVal[$list_id].=");\n";
+                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
+                $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
+                $list_id++;
+
+                $arrList[$list_id] = "";
+                $arrVal[$list_id] = "";
+            }
+
+            // 規格2のセレクトボックス用
+            $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
+
+            // セレクトボックス表示値
+            if($arrList[$list_id] == "") {
+                $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'";
+            } else {
+                $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
+            }
+
+            // セレクトボックスPOST値
+            if($arrVal[$list_id] == "") {
+                $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'";
+            } else {
+                $arrVal[$list_id].= ", '".$classcat_id2."'";
+            }
+        }
+
+        $arrList[$list_id].=");\n";
+        $arrVal[$list_id].=");\n";
+
+        // 規格1
+        $this->arrClassCat1[$product_id] = $arrSele;
+
+        $lists = "\tlists".$product_id. " = new Array(";
+        $no = 0;
+        foreach($arrList as $val) {
+            $this->tpl_javascript.= $val;
+            if ($no != 0) {
+                $lists.= ",list". $product_id. "_". $no;
+            } else {
+                $lists.= "list". $product_id. "_". $no;
+            }
+            $no++;
+        }
+        $this->tpl_javascript.= $lists.");\n";
+
+        $vals = "\tvals".$product_id. " = new Array(";
+        $no = 0;
+        foreach($arrVal as $val) {
+            $this->tpl_javascript.= $val;
+            if ($no != 0) {
+                $vals.= ",val". $product_id. "_". $no;
+            } else {
+                $vals.= "val". $product_id. "_". $no;
+            }
+            $no++;
+        }
+        $this->tpl_javascript.= $vals.");\n";
+
+        // 選択されている規格2ID
+        $classcategory_id = "classcategory_id". $product_id;
+
+        $classcategory_id_2 = $classcategory_id . "_2";
+        if (!isset($classcategory_id_2)) $classcategory_id_2 = "";
+        if (!isset($_POST[$classcategory_id_2])) $_POST[$classcategory_id_2] = "";
+
+        $this->tpl_onload .= "lnSetSelect('" . $classcategory_id ."_1', "
+            . "'" . $classcategory_id_2 . "',"
+            . "'" . $product_id . "',"
+            . "'" . $_POST[$classcategory_id_2] ."'); ";
+
+        // 規格1が設定されている
+        if($arrProductsClass[0]['classcategory_id1'] != '0') {
+            $classcat_find1 = true;
+        }
+
+        // 規格2が設定されている
+        if($arrProductsClass[0]['classcategory_id2'] != '0') {
+            $classcat_find2 = true;
+        }
+
+        $this->tpl_classcat_find1[$product_id] = $classcat_find1;
+        $this->tpl_classcat_find2[$product_id] = $classcat_find2;
+        $this->tpl_stock_find[$product_id] = $stock_find;
+    }
+
+    /* 商品規格情報の取得 */
+    function lfGetProductsClass($product_id) {
+        $arrRet = array();
+        if(SC_Utils_Ex::sfIsInt($product_id)) {
+            // 商品規格取得
+            $objQuery = new SC_Query();
+            $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
+            $table = "vw_product_class AS prdcls";
+            $where = "product_id = ?";
+            $objQuery->setorder("rank1 DESC, rank2 DESC");
+            $arrRet = $objQuery->select($col, $table, $where, array($product_id));
+        }
+        return $arrRet;
+    }
+
+    // 購入制限数の設定
+    function lfGetSaleLimit($product) {
+        //在庫が無限または購入制限値が設定値より大きい場合
+        if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {
+            $this->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX;
+        } else {
+            $this->tpl_sale_limit[$product['product_id']] = $product['sale_limit'];
+        }
+    }
+}
+?>
Index: branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php
===================================================================
--- branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php	(revision 17395)
+++ branches/version-2/data/class/pages/admin/order/LC_Page_Admin_Order_Edit.php	(revision 18007)
@@ -27,10 +27,10 @@
 /* GMO決済モジュール連携用 */
 if (file_exists(MODULE_PATH . 'mdl_gmopg/inc/include.php') === TRUE) {
-    require_once(MODULE_PATH . 'mdl_gmopg/inc/include.php');
+  require_once(MODULE_PATH . 'mdl_gmopg/inc/include.php');
 }
 
 /* ペイジェント決済モジュール連携用 */
 if (file_exists(MODULE_PATH . 'mdl_paygent/include.php') === TRUE) {
-	require_once(MODULE_PATH . 'mdl_paygent/include.php');
+    require_once(MODULE_PATH . 'mdl_paygent/include.php');
 }
 
@@ -71,17 +71,22 @@
         parent::init();
         $this->tpl_mainpage = 'order/edit.tpl';
-		$this->tpl_subnavi = 'order/subnavi.tpl';
-		$this->tpl_mainno = 'order';
-		$this->tpl_subno = 'index';
-		$this->tpl_subtitle = '受注管理';
+        $this->tpl_subnavi = 'order/subnavi.tpl';
+        $this->tpl_mainno = 'order';
+        $this->tpl_subno = 'index';
+        $this->tpl_subtitle = '受注管理';
+        if (empty($_GET['order_id']) && empty($_POST['order_id'])) {
+            $this->tpl_subno = 'add';
+            $this->tpl_mode = 'add';
+            $this->tpl_subtitle = '新規受注入力';
+        }
 
         $masterData = new SC_DB_MasterData_Ex();
-		$this->arrPref = $masterData->getMasterData("mtb_pref",
+        $this->arrPref = $masterData->getMasterData("mtb_pref",
                                  array("pref_id", "pref_name", "rank"));
-		$this->arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
+        $this->arrORDERSTATUS = $masterData->getMasterData("mtb_order_status");
 
         /* ペイジェント決済モジュール連携用 */
         if(function_exists("sfPaygentOrderPage")) {
-            $this->arrDispKind = sfPaygentOrderPage();
+            $this->arrFormKind = sfPaygentOrderPage();
         }
 
@@ -141,4 +146,5 @@
             break;
         case 'edit':
+        case 'add':
             // POST情報で上書き
             $this->objFormParam->setParam($_POST);
@@ -147,12 +153,24 @@
             $this->objFormParam->convParam();
             $this->arrErr = $this->lfCheckError();
+            $this->arrErr = array_merge( (array) $this->arrErr, (array)$this->lfCheek($arrInfo, $_POST['mode']) );
+
             if(count($this->arrErr) == 0) {
-                $this->arrErr = $this->lfCheek($arrInfo);
-                if(count($this->arrErr) == 0) {
+                if ($_POST['mode'] == 'add') {
+                    $order_id = $this->lfRegistNewData();
+
+                    $this->tpl_order_id = $order_id;
+                    $this->tpl_mode = 'edit';
+
+                    $arrData['order_id'] = $order_id;
+                    $this->objFormParam->setParam($arrData);
+
+                    $text = "'新規受注を登録しました。'";
+                } else {
                     $this->lfRegistData($_POST['order_id']);
-                    // DBから受注情報を再読込
-                    $this->lfGetOrderData($order_id);
-                    $this->tpl_onload = "window.alert('受注履歴を編集しました。');";
+                    $text = "'受注履歴を編集しました。'";
                 }
+                // DBから受注情報を再読込
+                $this->lfGetOrderData($order_id);
+                $this->tpl_onload = "window.alert(".$text.");";
             }
             break;
@@ -165,5 +183,5 @@
             $this->arrErr = $this->lfCheckError();
             if(count($this->arrErr) == 0) {
-                $this->arrErr = $this->lfCheek($arrInfo);
+                $this->arrErr = $this->lfCheek($arrInfo, $_POST['mode']);
             }
             break;
@@ -171,4 +189,54 @@
         case 'paygent_order':
             $this->paygent_return = sfPaygentOrder($_POST['paygent_type'], $order_id);
+            break;
+        /* 商品削除*/
+        case 'delete_product':
+            $delete_no = $_POST['delete_no'];
+            foreach ($_POST AS $key=>$val) {
+                if (is_array($val)) {
+                    foreach ($val AS $k=>$v) {
+                        if ($k != $delete_no) {
+                            $arrData[$key][] = $v;
+                        }
+                    }
+                } else {
+                    $arrData[$key] = $val;
+                }
+            }
+            // 情報上書き
+            $this->objFormParam->setParam($arrData);
+            // 入力値の変換
+            $this->objFormParam->convParam();
+            break;
+        /* 商品追加ポップアップより商品選択後、商品情報取得*/
+        case 'select_product_detail':
+            // POST情報で上書き
+            $this->objFormParam->setParam($_POST);
+            if (!empty($_POST['add_product_id'])) {
+                $this->lfInsertProduct($_POST['add_product_id'], $_POST['add_classcategory_id1'], $_POST['add_classcategory_id2']);
+            } elseif (!empty($_POST['edit_product_id'])) {
+                $this->lfUpdateProduct($_POST['edit_product_id'], $_POST['edit_classcategory_id1'], $_POST['edit_classcategory_id2'], $_POST['no']);
+            }
+            $arrData = $_POST;
+            foreach ($this->arrForm AS $key=>$val) {
+                if (is_array($val)) {
+                    $arrData[$key] = $this->arrForm[$key]['value'];
+                } else {
+                    $arrData[$key] = $val;
+                }
+            }
+            // 情報上書き
+            $this->objFormParam->setParam($arrData);
+            // 入力値の変換
+            $this->objFormParam->convParam();
+            break;
+        /* 顧客検索ポップアップより顧客指定後、顧客情報取得*/
+        case 'search_customer':
+            // POST情報で上書き
+            $this->objFormParam->setParam($_POST);
+
+            // 検索結果から顧客IDを指定された場合、顧客情報をフォームに代入する
+            $this->lfSetCustomerInfo($_POST['edit_customer_id']);
+
             break;
         /* F-REGI決済モジュール連携用 */
@@ -218,4 +286,13 @@
 
         $this->arrForm = $this->objFormParam->getFormParamList();
+        $this->product_count = count($this->arrForm['quantity']['value']);
+
+        // アンカーを設定
+        if (isset($_POST['anchor_key']) && !empty($_POST['anchor_key'])) {
+            $anchor_hash = "location.hash='#" . $_POST['anchor_key'] . "'";
+        } else {
+            $anchor_hash = "";
+        }
+        $this->tpl_onload .= $anchor_hash;
 
         $this->arrInfo = $arrInfo;
@@ -254,4 +331,20 @@
     /* パラメータ情報の初期化 */
     function lfInitParam() {
+
+        // お客様情報
+        $this->objFormParam->addParam("顧客名1", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("顧客名2", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("顧客名カナ1", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("顧客名カナ2", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("メールアドレス", "order_email", MTEXT_LEN, "KVCa", array("EXIST_CHECK", "NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("EXIST_CHECK", "NUM_CHECK", "NUM_COUNT_CHECK"));
+        $this->objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        $this->objFormParam->addParam("住所1", "order_addr01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("住所2", "order_addr02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+        $this->objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+
         // 配送先情報
         $this->objFormParam->addParam("お名前1", "deliv_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
@@ -267,9 +360,16 @@
         $this->objFormParam->addParam("電話番号2", "deliv_tel02", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
         $this->objFormParam->addParam("電話番号3", "deliv_tel03", TEL_ITEM_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK" ,"NUM_CHECK"));
+
+
         // 受注商品情報
         $this->objFormParam->addParam("値引き", "discount", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
-        $this->objFormParam->addParam("送料", "deliv_fee", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0');
+        $this->objFormParam->addParam("送料", "deliv_fee", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("手数料", "charge", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
-        $this->objFormParam->addParam("利用ポイント", "use_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+
+        // ポイント機能ON時のみ
+        if( USE_POINT === true ){
+            $this->objFormParam->addParam("利用ポイント", "use_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
+        }
+
         $this->objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
         $this->objFormParam->addParam("配送時間ID", "deliv_time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"));
@@ -301,4 +401,7 @@
         $this->objFormParam->addParam("顧客ID", "customer_id");
         $this->objFormParam->addParam("現在のポイント", "point");
+        $this->objFormParam->addParam("受注番号", "order_id");
+        $this->objFormParam->addParam("受注日", "create_date");
+        $this->objFormParam->addParam("発送日", "commit_date");
     }
 
@@ -314,19 +417,19 @@
             $this->objFormParam->setValue('total_point', $total_point);
             $this->objFormParam->setValue('point', $point);
-            $this->arrDisp = $arrRet[0];
+            $this->arrForm = $arrRet[0];
             // 受注詳細データの取得
             $arrRet = $this->lfGetOrderDetail($order_id);
             $arrRet = SC_Utils_Ex::sfSwapArray($arrRet);
-            $this->arrDisp = array_merge($this->arrDisp, $arrRet);
+            $this->arrForm = array_merge($this->arrForm, $arrRet);
             $this->objFormParam->setParam($arrRet);
 
             // その他支払い情報を表示
-            if($this->arrDisp["memo02"] != "") $this->arrDisp["payment_info"] = unserialize($this->arrDisp["memo02"]);
-            if($this->arrDisp["memo01"] == PAYMENT_CREDIT_ID){
-                $this->arrDisp["payment_type"] = "クレジット決済";
-            }elseif($this->arrDisp["memo01"] == PAYMENT_CONVENIENCE_ID){
-                $this->arrDisp["payment_type"] = "コンビニ決済";
+            if($this->arrForm["memo02"] != "") $this->arrForm["payment_info"] = unserialize($this->arrForm["memo02"]);
+            if($this->arrForm["memo01"] == PAYMENT_CREDIT_ID){
+                $this->arrForm["payment_type"] = "クレジット決済";
+            }elseif($this->arrForm["memo01"] == PAYMENT_CONVENIENCE_ID){
+                $this->arrForm["payment_type"] = "コンビニ決済";
             }else{
-                $this->arrDisp["payment_type"] = "お支払い";
+                $this->arrForm["payment_type"] = "お支払い";
             }
         }
@@ -354,5 +457,5 @@
 
     /* 計算処理 */
-    function lfCheek($arrInfo) {
+    function lfCheek($arrInfo,$mode = "") {
         $objDb = new SC_Helper_DB_Ex();
         $arrVal = $this->objFormParam->getHashArray();
@@ -385,6 +488,9 @@
         $arrVal['add_point'] = SC_Utils_Ex::sfGetAddPoint($totalpoint, $arrVal['use_point'], $arrInfo);
 
-        list($arrVal['point'], $arrVal['total_point']) = $objDb->sfGetCustomerPoint($_POST['order_id'], $arrVal['use_point'], $arrVal['add_point']);
-
+        if (strlen($_POST['customer_id']) >0){
+            list($arrVal['point'], $arrVal['total_point']) = $objDb->sfGetCustomerPointFromCid($_POST['customer_id'], $arrVal['use_point'], $arrVal['add_point']);
+        }else{
+            list($arrVal['point'], $arrVal['total_point']) = $objDb->sfGetCustomerPoint($_POST['order_id'], $arrVal['use_point'], $arrVal['add_point']);
+        }
         if($arrVal['total'] < 0) {
             $arrErr['total'] = '合計額がマイナス表示にならないように調整して下さい。<br />';
@@ -394,7 +500,9 @@
             $arrErr['payment_total'] = 'お支払い合計額がマイナス表示にならないように調整して下さい。<br />';
         }
-
-        if($arrVal['total_point'] < 0) {
-            $arrErr['total_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />';
+        //新規追加受注のみ
+        if ($mode == "add"){
+            if($arrVal['total_point'] < 0) {
+                $arrErr['use_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />';
+            }
         }
 
@@ -403,4 +511,13 @@
     }
 
+    function lfReCheek($arrData, $arrInfo) {
+        // 情報上書き
+        $this->objFormParam->setParam($arrData);
+        // 入力値の変換
+        $this->objFormParam->convParam();
+        #if(count($this->arrErr) == 0) {
+            $this->arrErr = $this->lfCheek($arrInfo);
+        #}
+    }
     /* DB登録処理 */
     function lfRegistData($order_id) {
@@ -423,10 +540,4 @@
         $where = "order_id = ?";
 
-        // 受注ステータスの判定
-        if ($sqlval['status'] == ODERSTATUS_COMMIT) {
-            // 受注テーブルの発送済み日を更新する
-            $addcol['commit_date'] = "Now()";
-        }
-
         /*
          * XXX 本来なら配列だが, update 関数を string として
@@ -444,4 +555,9 @@
         $sql .= "     payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)";
         $sql .= "     ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))";
+        // 受注ステータスの判定
+        if ($sqlval['status'] == ODERSTATUS_COMMIT) {
+            // 受注テーブルの発送済み日を更新する
+            $sql .= "     ,commit_date = 'NOW()'";
+        }
         $sql .= " WHERE order_id = ?";
 
@@ -457,4 +573,5 @@
         $arrDetail = $this->objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
         $objQuery->delete("dtb_order_detail", $where, array($order_id));
+
 
         $max = count($arrDetail);
@@ -474,5 +591,180 @@
             $objQuery->insert("dtb_order_detail", $sqlval);
         }
+
+
         $objQuery->commit();
+    }
+
+    /* DB登録処理(追加) */
+    function lfRegistNewData() {
+        $objQuery = new SC_Query();
+
+        $objQuery->begin();
+
+        // 入力データを渡す。
+        $arrRet =  $this->objFormParam->getHashArray();
+        foreach($arrRet as $key => $val) {
+            // 配列は登録しない
+            if(!is_array($val)) {
+                $sqlval[$key] = $val;
+            }
+        }
+
+        // postgresqlとmysqlとで処理を分ける
+        if (DB_TYPE == "pgsql") {
+            $order_id = $objQuery->nextval("dtb_order","order_id");
+        }elseif (DB_TYPE == "mysql") {
+            $order_id = $objQuery->get_auto_increment("dtb_order");
+        }
+
+        $sqlval['order_id'] = $order_id;
+        $sqlval['create_date'] = "Now()";
+
+        // 注文ステータス:指定が無ければ新規受付に設定
+        if($sqlval["status"] == ""){
+            $sqlval['status'] = '1';
+        }
+
+        // customer_id
+        if($sqlval["customer_id"] == ""){
+            $sqlval['customer_id'] = '0';
+        }
+
+        unset($sqlval['total_point']);
+        unset($sqlval['point']);
+
+        $where = "order_id = ?";
+
+        // 受注ステータスの判定
+        if ($sqlval['status'] == ODERSTATUS_COMMIT) {
+            // 受注テーブルの発送済み日を更新する
+            $sqlval['commit_date'] = "Now()";
+        }
+
+        // 受注テーブルの登録
+        $objQuery->insert("dtb_order", $sqlval);
+
+        $sql = "";
+        $sql .= " UPDATE";
+        $sql .= "     dtb_order";
+        $sql .= " SET";
+        $sql .= "     payment_method = (SELECT payment_method FROM dtb_payment WHERE payment_id = ?)";
+        $sql .= "     ,deliv_time = (SELECT deliv_time FROM dtb_delivtime WHERE time_id = ? AND deliv_id = (SELECT deliv_id FROM dtb_payment WHERE payment_id = ? ))";
+        $sql .= " WHERE order_id = ?";
+
+        if ($arrRet['deliv_time_id'] == "") {
+            $deliv_time_id = 0;
+        } else {
+            $deliv_time_id = $arrRet['deliv_time_id'];
+        }
+        $arrUpdData = array($arrRet['payment_id'], $deliv_time_id, $arrRet['payment_id'], $order_id);
+        $objQuery->query($sql, $arrUpdData);
+
+        // 受注詳細データの更新
+        $arrDetail = $this->objFormParam->getSwapArray(array("product_id", "product_code", "product_name", "price", "quantity", "point_rate", "classcategory_id1", "classcategory_id2", "classcategory_name1", "classcategory_name2"));
+        $objQuery->delete("dtb_order_detail", $where, array($order_id));
+
+        $max = count($arrDetail);
+        for($i = 0; $i < $max; $i++) {
+            $sqlval = array();
+            $sqlval['order_id'] = $order_id;
+            $sqlval['product_id']  = $arrDetail[$i]['product_id'];
+            $sqlval['product_code']  = $arrDetail[$i]['product_code'];
+            $sqlval['product_name']  = $arrDetail[$i]['product_name'];
+            $sqlval['price']  = $arrDetail[$i]['price'];
+            $sqlval['quantity']  = $arrDetail[$i]['quantity'];
+            $sqlval['point_rate']  = $arrDetail[$i]['point_rate'];
+            $sqlval['classcategory_id1'] = $arrDetail[$i]['classcategory_id1'];
+            $sqlval['classcategory_id2'] = $arrDetail[$i]['classcategory_id2'];
+            $sqlval['classcategory_name1'] = $arrDetail[$i]['classcategory_name1'];
+            $sqlval['classcategory_name2'] = $arrDetail[$i]['classcategory_name2'];
+            $objQuery->insert("dtb_order_detail", $sqlval);
+        }
+        $objQuery->commit();
+
+        return $order_id;
+    }
+
+    function lfInsertProduct($product_id, $classcategory_id1, $classcategory_id2) {
+        $arrProduct = $this->lfGetProductsClass($product_id, $classcategory_id1, $classcategory_id2);
+        $this->arrForm = $this->objFormParam->getFormParamList();
+        $this->lfSetProductData($arrProduct);
+    }
+
+    function lfUpdateProduct($product_id, $classcategory_id1, $classcategory_id2, $no) {
+        $arrProduct = $this->lfGetProductsClass($product_id, $classcategory_id1, $classcategory_id2);
+        $this->arrForm = $this->objFormParam->getFormParamList();
+        $this->lfSetProductData($arrProduct, $no);
+    }
+
+    function lfSetProductData($arrProduct, $no = null) {
+        foreach ($arrProduct AS $key=>$val) {
+            if (!is_array($this->arrForm[$key]['value'])) {
+                unset($this->arrForm[$key]['value']);
+            }
+            if ($no === null) {
+                $this->arrForm[$key]['value'][] = $arrProduct[$key];
+            } else {
+                $this->arrForm[$key]['value'][$no] = $arrProduct[$key];
+            }
+        }
+    }
+
+    function lfGetProductsClass($product_id, $classcategory_id1, $classcategory_id2) {
+        $objDb = new SC_Helper_DB_Ex();
+        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+        $arrRet = $objDb->sfGetProductsClass(array($product_id, $classcategory_id1, $classcategory_id2));
+
+        $arrProduct['price'] = $arrRet['price02'];
+        $arrProduct['quantity'] = 1;
+        $arrProduct['product_id'] = $arrRet['product_id'];
+        $arrProduct['point_rate'] = $arrRet['point_rate'];
+        $arrProduct['product_code'] = $arrRet['product_code'];
+        $arrProduct['product_name'] = $arrRet['name'];
+        $arrProduct['classcategory_id1'] = $arrRet['classcategory_id1'];
+        $arrProduct['classcategory_id2'] = $arrRet['classcategory_id2'];
+        $arrProduct['classcategory_name1'] = $arrClassCatName[$arrRet['classcategory_id1']];
+        $arrProduct['classcategory_name2'] = $arrClassCatName[$arrRet['classcategory_id2']];
+
+        return $arrProduct;
+    }
+
+    /**
+     * 検索結果から顧客IDを指定された場合、顧客情報をフォームに代入する
+     * @param int $edit_customer_id 顧客ID
+     */
+    function lfSetCustomerInfo($edit_customer_id = ""){
+        // 顧客IDが指定されている場合のみ、処理を実行する
+        if( $edit_customer_id === "" ) return ;
+
+        // 検索で選択された顧客IDが入力されている場合
+        if( is_null($edit_customer_id) === false && 0 < strlen($edit_customer_id) && SC_Utils_Ex::sfIsInt($edit_customer_id) ){
+            $objQuery = new SC_Query();
+
+            // 顧客情報を取得する
+            $arrCustomerInfo = $objQuery->select('*', 'dtb_customer', 'customer_id = ? AND del_flg = 0', array($edit_customer_id));
+
+            // 顧客情報を取得する事が出来たら、テンプレートに値を渡す
+            if( 0 < count($arrCustomerInfo) && is_array($arrCustomerInfo) === true){
+                // カラム名にorder_を付ける(テンプレート側でorder_がついている為
+                foreach($arrCustomerInfo[0] as $index=>$customer_info){
+                    // customer_idにはorder_を付けないようにする
+                    $order_index = ($index == 'customer_id') ? $index : 'order_'.$index;
+                    $arrCustomer[$order_index] = $customer_info;
+                }
+            }
+
+            // hiddenに渡す
+            $this->edit_customer_id = $edit_customer_id;
+
+            // 受注日に現在の時刻を取得し、表示させる
+            $create_date = $objQuery->getall('SELECT now() as create_date;');
+            $arrCustomer['create_date'] = $create_date[0]['create_date'];
+
+            // 情報上書き
+            $this->objFormParam->setParam($arrCustomer);
+            // 入力値の変換
+            $this->objFormParam->convParam();
+        }
     }
 }
Index: branches/version-2/data/class/pages/admin/contents/LC_Page_Admin_Contents_Campaign.php
===================================================================
--- branches/version-2/data/class/pages/admin/contents/LC_Page_Admin_Contents_Campaign.php	(revision 17723)
+++ branches/version-2/data/class/pages/admin/contents/LC_Page_Admin_Contents_Campaign.php	(revision 18007)
@@ -143,5 +143,5 @@
         // キャンペーン期間用
         $objDate = new SC_Date();
-        $this->arrYear = $objDate->getYear();
+        $this->arrYear = $objDate->getYear(min(date('Y'), $this->arrForm['start_year']));
         $this->arrMonth = $objDate->getMonth();
         $this->arrDay = $objDate->getDay();
Index: branches/version-2/data/class/pages/admin/LC_Page_Admin_Login.php
===================================================================
--- branches/version-2/data/class/pages/admin/LC_Page_Admin_Login.php	(revision 17653)
+++ branches/version-2/data/class/pages/admin/LC_Page_Admin_Login.php	(revision 18007)
@@ -64,6 +64,7 @@
         if (!isset($_POST['password'])) $_POST['password'] = "";
 
+
         // 入力判定
-        if(strlen($_POST{'login_id'}) > 0 && strlen($_POST{'password'}) > 0) {
+        if(strlen($_POST{'login_id'}) > 0 && strlen($_POST{'password'}) >= PASSWORD_LEN1 && strlen($_POST{'password'}) <= PASSWORD_LEN2) {
             // 認証パスワードの判定
             $ret = $this->fnCheckPassword($conn);
Index: branches/version-2/data/class/pages/admin/basis/LC_Page_Admin_Basis.php
===================================================================
--- branches/version-2/data/class/pages/admin/basis/LC_Page_Admin_Basis.php	(revision 16741)
+++ branches/version-2/data/class/pages/admin/basis/LC_Page_Admin_Basis.php	(revision 18007)
@@ -52,4 +52,13 @@
         $this->arrTAXRULE = $masterData->getMasterData("mtb_taxrule");
         $this->tpl_subtitle = 'SHOPマスタ';
+
+        //定休日用配列
+        $this->arrRegularHoliday[0] = '日';
+        $this->arrRegularHoliday[1] = '月';
+        $this->arrRegularHoliday[2] = '火';
+        $this->arrRegularHoliday[3] = '水';
+        $this->arrRegularHoliday[4] = '木';
+        $this->arrRegularHoliday[5] = '金';
+        $this->arrRegularHoliday[6] = '土';
     }
 
@@ -82,4 +91,5 @@
             // 入力データの変換
             $this->arrForm = $this->lfConvertParam($this->arrForm);
+            $this->arrForm['regular_holiday_ids'] = $_POST['regular_holiday_ids'];  // 定休日情報を付加
             // 入力データのエラーチェック
             $this->arrErr = $this->lfErrorCheck($this->arrForm);
@@ -98,4 +108,9 @@
                 $this->tpl_onload = "window.alert('SHOPマスタの登録が完了しました。');";
             }
+            if( empty($this->arrForm['regular_holiday_ids']) ) {
+                $this->arrSel = array();
+            } else {
+                $this->arrSel = $this->arrForm['regular_holiday_ids'];
+            }
         } else {
             $arrCol = $this->lfGetCol();
@@ -103,4 +118,7 @@
             $arrRet = $objQuery->select($col, "dtb_baseinfo");
             $this->arrForm = $arrRet[0];
+
+            $regular_holiday_ids = explode('|', $this->arrForm['regular_holiday_ids']);
+            $this->arrForm['regular_holiday_ids'] = $regular_holiday_ids;
         }
 
@@ -145,5 +163,6 @@
             "free_rule",
             "good_traded",
-            "message"
+            "message",
+            "regular_holiday_ids"
 
         );
@@ -155,5 +174,11 @@
         $arrCol = $this->lfGetCol();
         foreach($arrCol as $val) {
-            $sqlval[$val] = $array[$val];
+            //$sqlval[$val] = $array[$val];
+            //配列の場合は、パイプ区切りの文字列に変換
+            if(is_array($array[$val])) {
+                $sqlval[$val] = implode("|", $array[$val]);
+            } else {
+                $sqlval[$val] = $array[$val];
+            }
         }
         $sqlval['update_date'] = 'Now()';
Index: branches/version-2/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php
===================================================================
--- branches/version-2/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php	(revision 18007)
+++ branches/version-2/data/class/pages/admin/customer/LC_Page_Admin_Customer_SearchCustomer.php	(revision 18007)
@@ -0,0 +1,190 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once(CLASS_PATH . "pages/LC_Page.php");
+
+/**
+ * Admin_Customer_SearchCustomer のページクラス.
+ *
+ * @package Page
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class LC_Page_Admin_Customer_SearchCustomer extends LC_Page
+{
+
+    // }}}
+    // {{{ functions
+
+    /**
+     * Page を初期化する.
+     *
+     * @return void
+     */
+    function init()
+    {
+        parent::init();
+        $this->tpl_mainpage = 'customer/search_customer.tpl';
+    }
+
+    /**
+     * Page のプロセス.
+     *
+     * @return void
+     */
+    function process()
+    {
+        $objView = new SC_AdminView();
+        // POSTのモードがsearchなら顧客検索開始
+        if($_POST['mode'] == 'search'){
+            $this->objFormParam = new SC_FormParam();
+            // 値の初期化
+            $this->lfInitParam();
+            // POST値の取得
+            $this->objFormParam->setParam($_POST);
+            // 入力値の変換
+            $this->objFormParam->convParam();
+
+            // 入力された値を取得する
+            $arrForm = $this->objFormParam->getHashArray();
+
+            // エラーチェック
+            $this->arrErr = $this->lfCheckError();
+            if( is_array($this->arrErr) === true && 0 < count($this->arrErr) ){
+                $is_select = false;
+            }else{
+                $where = "del_flg = 0";
+
+                // 検索
+                foreach($arrForm as $tmp_key => $val){
+                    if( is_array($val) === false && 0 < strlen($val)){
+                        $key = strtr($tmp_key , array('search_' => ''));
+                        switch($key){
+                            case 'customer_id':
+                                $where .= " AND customer_id = ? ";
+                                $sqlval[$key] = $val;
+                                break;
+                            case 'name01':
+                                    $where .= " AND name01 ILIKE ? ";
+                                    $sqlval[$key] = '%'.$val.'%';
+                                break;
+                            case 'name02':
+                                    $where .= " AND name02 ILIKE ? ";
+                                    $sqlval[$key] = '%'.$val.'%';
+                                break;
+                            case 'kana01':
+                                    $where .= " AND kana01 ILIKE ? ";
+                                    $sqlval[$key] = '%'.$val.'%';
+                                break;
+                            case 'kana02':
+                                    $where .= " AND kana02 ILIKE ? ";
+                                    $sqlval[$key] = '%'.$val.'%';
+                                break;
+                            default :
+                                break;
+                        }
+                    }
+                }
+
+                $is_select = true;
+            }
+
+
+            if( $is_select === true ){
+                $objQuery = new SC_Query();
+
+                // 既に購入した事がある顧客を取得
+                $col = '*';
+                $from = 'dtb_customer';
+                $order = 'customer_id';
+                $arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
+
+                // 顧客情報を取得できたら、テンプレートに
+                if( is_array($arrCustomer) === true && count($arrCustomer) > 0){
+                    $customer_count = count($arrCustomer);
+                    if( $customer_count != 0 ){
+                        $this->tpl_linemax = $customer_count;
+                    }
+                } else {
+                    $this->tpl_linemax = null;
+                }
+
+                // ページ送りの処理
+                if(isset($_POST['search_page_max'])
+                   && is_numeric($_POST['search_page_max'])) {
+                    $page_max = $_POST['search_page_max'];
+                } else {
+                    $page_max = SEARCH_PMAX;
+                }
+
+                // ページ送りの取得
+                $objNavi = new SC_PageNavi($_POST['search_pageno'], $customer_count, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
+                $this->tpl_strnavi = $objNavi->strnavi;      // 表示文字列
+                $startno = $objNavi->start_row;
+
+                // 取得範囲の指定(開始行番号、行数のセット)
+                $objQuery->setlimitoffset($page_max, $startno);
+                // 表示順序
+                $objQuery->setorder($order);
+                // 検索結果の取得
+                $this->arrCustomer = $objQuery->select($col, $from, $where, $sqlval);
+            }
+
+        }
+        // 画面の表示
+        $this->arrForm = $arrForm;
+        $objView->assignobj($this);
+        $objView->display($this->tpl_mainpage);
+    }
+
+    /**
+     * デストラクタ.
+     *
+     * @return void
+     */
+    function destroy()
+    {
+        parent::destroy();
+    }
+
+    /* パラメータ情報の初期化 */
+    function lfInitParam() {
+        $this->objFormParam->addParam("顧客ID", "search_customer_id", INT_LEN, "n", array("NUM_CHECK", "MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("顧客名(姓)", "search_name01", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("顧客名(名)", "search_name02", STEXT_LEN, "aKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("顧客名（カナ）", 'search_kana01', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+        $this->objFormParam->addParam("顧客名（カナ/名）", 'search_kana02', STEXT_LEN, "CKV", array("NO_SPTAB", "SPTAB_CHECK" ,"MAX_LENGTH_CHECK", "KANA_CHECK"));
+    }
+
+    /* 入力内容のチェック */
+    function lfCheckError() {
+        // 入力データを渡す。
+        $arrRet =  $this->objFormParam->getHashArray();
+        $objErr = new SC_CheckError($arrRet);
+        $objErr->arrErr = $this->objFormParam->checkError();
+
+        return $objErr->arrErr;
+    }
+}
+?>
Index: branches/version-2/data/class/pages/admin/customer/LC_Page_Admin_Customer.php
===================================================================
--- branches/version-2/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 17343)
+++ branches/version-2/data/class/pages/admin/customer/LC_Page_Admin_Customer.php	(revision 18007)
@@ -63,4 +63,7 @@
         $this->arrHtmlmail[1] = $this->arrMAILMAGATYPE[1];
         $this->arrHtmlmail[2] = $this->arrMAILMAGATYPE[2];
+
+        $this->arrStatus[1] = "仮会員";
+        $this->arrStatus[2] = "本会員";
 
         //---- CSVダウンロード用
@@ -182,4 +185,5 @@
             switch($key) {
             case 'sex':
+            case 'status':
                 $this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
                 if(!is_array($val)) {
@@ -208,5 +212,43 @@
             }
         }
-        if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
+        //if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
+        // 登録メール再送
+        if ($_POST['mode'] == "resend_mail") {
+            $arrRet = $objQuery->select("name01, name02, secret_key, email", "dtb_customer","customer_id = ? AND del_flg <> 1 AND status = 1", array($_POST["edit_customer_id"]));
+            if( is_array($arrRet) === true && count($arrRet) > 0 ){
+
+                $CONF = $objDb->sf_getBasisData();
+                $this->CONF = $CONF;
+                $objMailText = new SC_SiteView();
+                $objMailText->assignobj($this);
+                $mailHelper = new SC_Helper_Mail_Ex();
+
+                $this->name01 = $arrRet[0]['name01'];
+                $this->name02 = $arrRet[0]['name02'];
+                $this->uniqid = $arrRet[0]['secret_key'];
+
+                $subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご確認');
+                $toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
+
+                $objMail = new SC_SendMail();
+                $objMail->setItem(
+                                    ''                  //　宛先
+                                    , $subject          //　サブジェクト
+                                    , $toCustomerMail   //　本文
+                                    , $CONF["email03"]  //　配送元アドレス
+                                    , $CONF["shop_name"]//　配送元　名前
+                                    , $CONF["email03"]  //　reply_to
+                                    , $CONF["email04"]  //　return_path
+                                    , $CONF["email04"]  //  Errors_to
+                                 );
+                // 宛先の設定
+                $name = $this->name01 . $this->name02 ." 様";
+                $objMail->setTo($arrRet[0]["email"], $name);
+                $objMail->sendMail();
+            }
+
+        }
+        if ($_POST['mode'] == "search" || $_POST['mode'] == "csv"  || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "resend_mail") {
+
             // 入力文字の強制変換
             $this->lfConvertParam();
Index: branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php
===================================================================
--- branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php	(revision 16741)
+++ branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php	(revision 18007)
@@ -123,10 +123,11 @@
 
         // 行数の取得
-        $linemax = $objQuery->count($table, "T2.category_id = ?", array($category_id));
-        // 順位、該当件数表示用
+        $linemax = $objQuery->count($table, $where, array($category_id));
+        // 該当件数表示用
         $this->tpl_linemax = $linemax;
 
         $objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, SEARCH_PMAX, "fnNaviPage", NAVI_PMAX);
         $startno = $objNavi->start_row;
+        $this->tpl_start_row = $objNavi->start_row;
         $this->tpl_strnavi = $objNavi->strnavi;		// Navi表示文字列
         $this->tpl_pagemax = $objNavi->max_page;		// ページ最大数（「上へ下へ」表示判定用）
Index: branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
===================================================================
--- branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 17833)
+++ branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php	(revision 18007)
@@ -180,5 +180,5 @@
             $this->arrErr = array_merge((array)$this->arrErr, (array)$this->objUpFile->checkEXISTS($_POST['image_key']));
             // 画像保存処理
-            $this->arrErr[$_POST['image_key']] = $this->objUpFile->makeTempFile($_POST['image_key']);
+            $this->arrErr[$_POST['image_key']] = $this->objUpFile->makeTempFile($_POST['image_key'],IMAGE_RENAME);
 
             // 中、小画像生成
@@ -395,5 +395,5 @@
                             "deliv_fee", "comment1", "comment2", "comment3",
                             "comment4", "comment5", "comment6", "main_list_comment",
-                            "sale_limit", "sale_unlimited", "deliv_date_id");
+                            "sale_limit", "sale_unlimited", "deliv_date_id", "note");
         $arrList = SC_Utils_Ex::arrayDefineIndexes($arrList, $checkArray);
 
@@ -416,4 +416,5 @@
         $sqlval['sale_unlimited'] = $arrList['sale_unlimited'];
         $sqlval['deliv_date_id'] = $arrList['deliv_date_id'];
+        $sqlval['note'] = $arrList['note'];
         $sqlval['update_date'] = "Now()";
         $sqlval['creator_id'] = $_SESSION['member_id'];
@@ -457,5 +458,5 @@
                 unset($arrColList[$arrColList_tmp["product_class_id"]]);	 //規格ID
                 unset($arrColList[$arrColList_tmp["product_id"]]);			 //商品ID
-				unset($arrColList[$arrColList_tmp["create_date"]]);
+                unset($arrColList[$arrColList_tmp["create_date"]]);
 
                 $col = SC_Utils_Ex::sfGetCommaList($arrColList);
@@ -481,6 +482,6 @@
         //商品登録の時は規格を生成する。複製の場合は規格も複製されるのでこの処理は不要。
         if( $_POST["copy_product_id"] == "" ){
-        	// 規格登録
-        	SC_Utils_Ex::sfInsertProductClass($objQuery, $arrList, $product_id , $arrList['product_class_id'] );
+            // 規格登録
+            SC_Utils_Ex::sfInsertProductClass($objQuery, $arrList, $product_id , $arrList['product_class_id'] );
         }
 
@@ -507,4 +508,5 @@
         $arrConvList['main_list_comment'] = "KVa";
         $arrConvList['main_comment'] = "KVa";
+        $arrConvList['note'] = "KVa";
         $arrConvList['price01'] = "n";
         $arrConvList['price02'] = "n";
@@ -553,4 +555,5 @@
         $objErr->doFunc(array("ポイント付与率", "point_rate", PERCENTAGE_LEN), array("EXIST_CHECK", "NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("商品送料", "deliv_fee", PRICE_LEN), array("NUM_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));
+        $objErr->doFunc(array("備考欄(SHOP専用)", "note", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("検索ワード", "comment3", LLTEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK"));
         $objErr->doFunc(array("メーカーURL", "comment1", URL_LEN), array("SPTAB_CHECK", "URL_CHECK", "MAX_LENGTH_CHECK"));
@@ -690,5 +693,7 @@
                empty($this->objUpFile->save_file[$arrImageKey[$to_key]])) {
 
-                $path = $this->objUpFile->makeThumb($from_path, $to_w, $to_h);
+                // リネームする際は、自動生成される画像名に一意となるように、Suffixを付ける
+                $dst_file = $this->objUpFile->lfGetTmpImageName(IMAGE_RENAME, "", $this->objUpFile->temp_file[$arrImageKey[$from_key]]) . $this->lfGetAddSuffix($to_key);
+                $path = $this->objUpFile->makeThumb($from_path, $to_w, $to_h, $dst_file);
                 $this->objUpFile->temp_file[$arrImageKey[$to_key]] = basename($path);
             }
@@ -697,4 +702,25 @@
         }
     }
+
+    // リネームする際は、自動生成される画像名に一意となるように、Suffixを付ける
+    function lfGetAddSuffix($to_key){
+        if( IMAGE_RENAME === true ){ return ; }
+
+        // 自動生成される画像名
+        $dist_name = "";
+        switch($to_key){
+            case "main_list_image":
+                $dist_name = '_s';
+                break;
+            case "main_image":
+                $dist_name = '_m';
+                break;
+            default;
+                $arrRet = explode('sub_image', $to_key);
+                $dist_name = '_sub' .$arrRet[1];
+                break;
+        }
+        return $dist_name;
+    }
 }
 ?>
Index: branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php
===================================================================
--- branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 16741)
+++ branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_UploadCSV.php	(revision 18007)
@@ -245,4 +245,5 @@
         $this->objFormParam->addParam("メーカーURL", "comment1", URL_LEN, "KVa", array("SPTAB_CHECK","URL_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("検索ワード", "comment3", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
+        $this->objFormParam->addParam("備考欄(SHOP専用)", "note", LLTEXT_LEN, "KVa", array("SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("一覧-メインコメント", "main_list_comment", LTEXT_LEN, "KVa", array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
         $this->objFormParam->addParam("一覧-メイン画像", "main_list_image", LTEXT_LEN, "KVa", array("EXIST_CHECK","FILE_EXISTS","SPTAB_CHECK","MAX_LENGTH_CHECK"));
Index: branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
===================================================================
--- branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 17511)
+++ branches/version-2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 18007)
@@ -216,5 +216,5 @@
         $this->arrForm['product_name'] = $product_name;
     }
-    
+
     /**
      * デフォルトの表示
@@ -260,5 +260,5 @@
             $sql.= "WHERE class_id1 = ? AND class_id2 = 0 ORDER BY rank1 DESC;";
             $arrRet = $objQuery->getall($sql, array($class_id1));
-            
+
         }
 
@@ -345,4 +345,5 @@
         while($arrList["classcategory_id1:".$cnt] != "") {
             if($arrList["check:".$cnt] == 1) {
+                $sqlval = array();
                 $sqlval['product_id'] = $product_id;
                 $sqlval['classcategory_id1'] = $arrList["classcategory_id1:".$cnt];
Index: branches/version-2/data/class/pages/admin/total/LC_Page_Admin_Total.php
===================================================================
--- branches/version-2/data/class/pages/admin/total/LC_Page_Admin_Total.php	(revision 17213)
+++ branches/version-2/data/class/pages/admin/total/LC_Page_Admin_Total.php	(revision 18007)
@@ -639,5 +639,5 @@
 
         // 会員集計の取得
-        $col = "COUNT(*) AS order_count, SUM(total) AS total, trunc(AVG(total)) AS total_average, order_sex";
+        $col = "COUNT(*) AS order_count, SUM(total) AS total, trunc(AVG(total),0) AS total_average, order_sex";
         $from = "dtb_order";
         $objQuery = new SC_Query();
@@ -684,5 +684,5 @@
         $sql.= "SUM(quantity) AS products_count, ";
         $sql.= "(price * sum(quantity)) AS total ";
-        $sql.= "FROM dtb_order_detail WHERE order_id IN (SELECT order_id FROM dtb_order WHERE $where ) ";
+        $sql.= "FROM dtb_order_detail AS T2 WHERE EXISTS (SELECT 1 FROM dtb_order AS T3 WHERE T2.order_id = T3.order_id AND $where ) ";
         $sql.= "GROUP BY product_id, product_name, product_code, price ";
         $sql.= ") AS T1 ";
@@ -707,5 +707,5 @@
         list($where, $arrval) = $this->lfGetWhereMember('T2.create_date', $sdate, $edate, $type);
 
-        $sql = "SELECT job, count(*) AS order_count, SUM(total) AS total, trunc(AVG(total)) AS total_average ";
+        $sql = "SELECT job, count(*) AS order_count, SUM(total) AS total, trunc(AVG(total),0) AS total_average ";
         $sql.= "FROM dtb_customer AS T1 LEFT JOIN dtb_order AS T2 USING ( customer_id ) WHERE $where AND T2.del_flg = 0 and T2.status <> " . ORDER_CANCEL;
         $sql.= " GROUP BY job ORDER BY total DESC";
Index: branches/version-2/data/class/pages/admin/system/LC_Page_Admin_System_Input.php
===================================================================
--- branches/version-2/data/class/pages/admin/system/LC_Page_Admin_System_Input.php	(revision 16834)
+++ branches/version-2/data/class/pages/admin/system/LC_Page_Admin_System_Input.php	(revision 18007)
@@ -253,6 +253,6 @@
         // ログインID・パスワードの文字数チェック
         $objErr = new SC_CheckError();
-        $objErr->doFunc(array("パスワード", 'password', ID_MIN_LEN, ID_MAX_LEN), array("NUM_RANGE_CHECK"));
-        $objErr->doFunc(array("ログインID", 'login_id', ID_MIN_LEN, ID_MAX_LEN), array("NUM_RANGE_CHECK"));
+        $objErr->doFunc(array("パスワード", 'password', ID_MIN_LEN, ID_MAX_LEN), array("SPTAB_CHECK" ,"NUM_RANGE_CHECK"));
+        $objErr->doFunc(array("ログインID", 'login_id', ID_MIN_LEN, ID_MAX_LEN), array("SPTAB_CHECK" ,"NUM_RANGE_CHECK"));
 
         $arrErr = $objErr->arrErr;
