Source for file LC_Page_Admin_Basis_DeliveryInput.php
Documentation is available at LC_Page_Admin_Basis_DeliveryInput.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 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.
require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Admin_Basis_DeliveryInput.php 21289 2011-10-20 10:04:19Z shutta $
$this->tpl_mainpage = 'basis/delivery_input.tpl';
$this->tpl_subno = 'delivery';
$this->tpl_mainno = 'basis';
$masterData = new SC_DB_MasterData_Ex();
$this->arrPref = $masterData->getMasterData('mtb_pref');
$this->arrProductType = $masterData->getMasterData("mtb_product_type");
$this->arrPayments = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method");
$this->tpl_maintitle = '基本情報管理';
$this->tpl_subtitle = '配送方法設定';
$this->mode = $this->getMode();
$objFormParam = new SC_FormParam_Ex();
$objFormParam->setParam($_POST);
$objFormParam->convParam();
if (count($this->arrErr) == 0) {
$objFormParam->setValue('deliv_id', $this->lfRegistData($objFormParam->getHashArray(), $_SESSION['member_id']));
$this->tpl_onload = "window.alert('配送方法設定が完了しました。');";
if (count($this->arrErr) > 0) {
SC_Utils_Ex::sfDispException();
$this->arrForm = $objFormParam->getFormParamList();
$objFormParam->initParam();
$objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
$objFormParam->addParam("配送業者名", 'name', STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("名称", "service_name", STEXT_LEN, 'KVa', array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("説明", 'remark', LLTEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
$objFormParam->addParam("伝票No.確認URL", "confirm_url", URL_LEN, 'n', array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
$objFormParam->addParam("取扱商品種別", "product_type_id", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("取扱支払方法", "payment_ids", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++ ) {
$objFormParam->addParam("お届け時間$cnt", "deliv_time$cnt", STEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++ ) {
$objFormParam->addParam("配送料金$cnt", "fee$cnt", PRICE_LEN, 'n', array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
$objFormParam->addParam('配送業者ID', 'deliv_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
$objQuery = & SC_Query_Ex::getSingletonInstance();
$sqlval['name'] = $arrRet['name'];
$sqlval['service_name'] = $arrRet['service_name'];
$sqlval['remark'] = $arrRet['remark'];
$sqlval['confirm_url'] = $arrRet['confirm_url'];
$sqlval['product_type_id'] = $arrRet['product_type_id'];
$sqlval['creator_id'] = $member_id;
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
if($arrRet['deliv_id'] != "") {
$deliv_id = $arrRet['deliv_id'];
$objQuery->update("dtb_deliv", $sqlval, $where, array($deliv_id));
$table = "dtb_delivtime";
$where = "deliv_id = ? AND time_id = ?";
for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++ ) {
$keyname = "deliv_time". $cnt;
$arrval = array($deliv_id, $cnt);
$curData = $objQuery->select("*", $table, $where, $arrval);
if(strcmp($arrRet[$keyname], "") != 0) {
$sqlval['deliv_time'] = $arrRet[$keyname];
$objQuery->update($table, $sqlval, $where, $arrval);
$sqlval['deliv_id'] = $deliv_id;
$sqlval['time_id'] = $cnt;
$objQuery->insert($table, $sqlval);
else if(count($curData)) {
$objQuery->delete($table, $where, $arrval);
for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++ ) {
if(strcmp($arrRet[$keyname], "") != 0) {
$sqlval = array('fee' => $arrRet[$keyname]);
$objQuery->update("dtb_delivfee", $sqlval, "deliv_id = ? AND fee_id = ?", array($deliv_id, $cnt));
$deliv_id = $objQuery->nextVal('dtb_deliv_deliv_id');
$sqlval['deliv_id'] = $deliv_id;
$sqlval['rank'] = $objQuery->max('rank', "dtb_deliv") + 1;
$sqlval['create_date'] = 'CURRENT_TIMESTAMP';
$objQuery->insert("dtb_deliv", $sqlval);
for($cnt = 1; $cnt <= DELIVTIME_MAX; $cnt++ ) {
$keyname = "deliv_time$cnt";
if($arrRet[$keyname] != "") {
$sqlval['deliv_id'] = $deliv_id;
$sqlval['time_id'] = $cnt;
$sqlval['deliv_time'] = $arrRet[$keyname];
$objQuery->insert("dtb_delivtime", $sqlval);
for($cnt = 1; $cnt <= DELIVFEE_MAX; $cnt++ ) {
if($arrRet[$keyname] != "") {
$sqlval['deliv_id'] = $deliv_id;
$sqlval['fee'] = $arrRet[$keyname];
$sqlval['fee_id'] = $cnt;
$objQuery->insert("dtb_delivfee", $sqlval);
$objQuery->delete('dtb_payment_options', 'deliv_id = ?', array($arrRet['deliv_id']));
foreach ($arrRet['payment_ids'] as $val) {
$sqlval['deliv_id'] = $deliv_id;
$sqlval['payment_id'] = $val;
$objQuery->insert('dtb_payment_options', $sqlval);
$objQuery = & SC_Query_Ex::getSingletonInstance();
$deliv_id = $objFormParam->getValue('deliv_id');
$col = "deliv_id, name, service_name, remark, confirm_url, product_type_id";
$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
$objFormParam->setParam($arrRet[0]);
$where = "deliv_id = ? ORDER BY time_id";
$table = "dtb_delivtime";
$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
$objFormParam->setParamList($arrRet, 'deliv_time');
$where = "deliv_id = ? ORDER BY pref";
$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
$objFormParam->setParamList($arrRet, 'fee');
$where = 'deliv_id = ? ORDER BY rank';
$table = 'dtb_payment_options';
$arrRet = $objQuery->select($col, $table, $where, array($deliv_id));
$arrPaymentIds = array();
foreach ($arrRet as $val) {
$arrPaymentIds[] = $val['payment_id'];
$objFormParam->setValue('payment_ids', $arrPaymentIds);
$arrRet = $objFormParam->getHashArray();
$objErr = new SC_CheckError_Ex($arrRet);
$objErr->arrErr = $objFormParam->checkError();
if(!isset ($objErr->arrErr['name']) && $arrRet['deliv_id'] == "") {
$objDb = new SC_Helper_DB_Ex();
$ret = $objDb->sfIsRecord("dtb_deliv", "service_name", array($arrRet['service_name']));
$objErr->arrErr['name'] = "※ 同じ名称の組み合わせは登録できません。<br>";
Documentation generated on Fri, 24 Feb 2012 14:01:02 +0900 by Seasoft
|