Source for file LC_Page_Admin_Basis_Delivery_Input.php
Documentation is available at LC_Page_Admin_Basis_Delivery_Input.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.
require_once(CLASS_PATH .
"pages/LC_Page.php");
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Admin_Basis_Delivery_Input.php 17580 2008-08-28 23:15:31Z Seasoft $
$this->tpl_subnavi =
'basis/subnavi.tpl';
$this->tpl_subno =
'delivery';
$this->arrPref =
$masterData->getMasterData("mtb_pref", array("pref_id", "pref_name", "rank"));
$this->tpl_subtitle =
'配送業者設定';
if (!isset
($_POST['mode'])) $_POST['mode'] =
"";
if(count($this->arrErr) ==
0) {
$this->tpl_onload =
"window.alert('配送業者設定が完了しました。');";
if($_POST['deliv_id'] !=
"") {
$this->tpl_deliv_id =
$_POST['deliv_id'];
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
$this->objFormParam->addParam("配送業者名", "name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$this->objFormParam->addParam("名称", "service_name", STEXT_LEN, "KVa", array("EXIST_CHECK", "MAX_LENGTH_CHECK"));
$this->objFormParam->addParam("伝票No.確認URL", "confirm_url", STEXT_LEN, "n", array("URL_CHECK", "MAX_LENGTH_CHECK"), "http://");
for($cnt =
1; $cnt <=
DELIVTIME_MAX; $cnt++
) {
$this->objFormParam->addParam("配送時間$cnt", "deliv_time$cnt", STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK"));
for($cnt =
1; $cnt <=
DELIVFEE_MAX; $cnt++
) {
$this->objFormParam->addParam("配送料金$cnt", "fee$cnt", PRICE_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"));
$sqlval['name'] =
$arrRet['name'];
$sqlval['service_name'] =
$arrRet['service_name'];
$sqlval['confirm_url'] =
$arrRet['confirm_url'];
$sqlval['creator_id'] =
$_SESSION['member_id'];
$sqlval['update_date'] =
'Now()';
if($_POST['deliv_id'] !=
"") {
$deliv_id =
$_POST['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 *
$deliv_id));
$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 *
$deliv_id);
$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 pref = ?", array($deliv_id, $cnt));
if (DB_TYPE ==
"pgsql") {
$deliv_id =
$objQuery->nextval('dtb_deliv', 'deliv_id');
$sqlval['deliv_id'] =
$deliv_id;
$sqlval['rank'] =
$objQuery->max("dtb_deliv", "rank") +
1;
$sqlval['create_date'] =
'Now()';
$objQuery->insert("dtb_deliv", $sqlval);
if (DB_TYPE ==
"mysql") {
$deliv_id =
$objQuery->nextval('dtb_deliv', 'deliv_id');
for($cnt =
1; $cnt <=
DELIVTIME_MAX; $cnt++
) {
$keyname =
"deliv_time$cnt";
if($arrRet[$keyname] !=
"") {
$sqlval['deliv_id'] =
$deliv_id;
$sqlval['time_id'] =
($cnt *
$deliv_id);
$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];
$objQuery->insert("dtb_delivfee", $sqlval);
$col =
"deliv_id, name, service_name, confirm_url";
$arrRet =
$objQuery->select($col, $table, $where, array($deliv_id));
$where =
"deliv_id = ? ORDER BY time_id";
$table =
"dtb_delivtime";
$arrRet =
$objQuery->select($col, $table, $where, array($deliv_id));
$where =
"deliv_id = ? ORDER BY pref";
$arrRet =
$objQuery->select($col, $table, $where, array($deliv_id));
if(!isset
($objErr->arrErr['name']) &&
$_POST['deliv_id'] ==
"") {
$ret =
$objDb->sfIsRecord("dtb_deliv", "service_name", array($arrRet['service_name']));
$objErr->arrErr['name'] =
"※ 同じ名称の組み合わせは登録できません。<br>";
Documentation generated on Tue, 28 Apr 2009 18:10:42 +0900 by phpDocumentor 1.4.2