#!/usr/bin/perl
#--NetShopOwner-CGI-version:3.1.7.0--
;#
;# support1.cgi
;# [店舗]お問合せ画面
;# Copyright (c) 2004- Increment P Corp. All rights reserved.
;#
;# last modified 2008/03/03 T.Hinohara 懸案No.6対応
;# nishihara 問い合わせ表示仕様変更(DB格納)対応
;#
use strict;
use uselib;
use defnsopath_shop;
use NsoVersionPC 1.00;
use Lib::SiteStatus;
use Lib::Support;
use Lib::DbConnect;
use NsoSupportCall;
&ReadParse();
my %in = %main::in;
my %incfn = %main::incfn;
my %inct = %main::inct;
# インスタンス定義
my $objConfigSystem = Config::NsoSystem->newShop();
my $objConfigMaster = Config::NsoMaster->new();
my $NsoMisc = NsoMisc->new();
my $LibSupport = Lib::Support->new();
# コンフィグレーションのキャッシュ
my %ConfigSystem = $objConfigSystem->cache_config();
my %ConfigMaster = $objConfigMaster->cache_config();
my $NsoSupportCall = NsoSupportCall->new();
my $DbConnect = Lib::DbConnect->new({ ConfigSystem=>\%ConfigSystem, ConfigMaster=>\%ConfigMaster});
my $status_err;
FUNC:{
my $func = $in{func} || 'main';
my %function = (
main => \&main,
);
&check_closing();
if ($function{$func}){
$function{$func}->();
}else{
&main();
}
}
exit();
;#
;# 開店・閉店状態検査
;#
sub check_closing {
my $SiteStatus = Lib::SiteStatus->new({ ConfigSystem=>\%ConfigSystem });
$SiteStatus->CheckClosing({ IgnoreFlag=>1 });
}
;#
;# メイン処理
;#
sub main {
# HTMLタグ無効化
my %Text = ();
foreach my $key ( keys( %in) ) {
$Text{$key} = $NsoMisc->html_encode($in{$key});
}
# 質問部分編集
for (my $i=1; $i <= 4; $i++) {
# objectにより処理振り分け
if ($Text{"question$i"."_object"} eq "cmb") {
$Text{"question$i"."_".substr($Text{"question$i"},0,1) } = "selected"; # selected用
$Text{"question$i"} = substr( $Text{"question$i"}, 2); # 確認出力用
} else {
$Text{"question$i"} = $Text{"question$i"};
}
}
# 商品問い合わせ
if ($in{GoodsID}) {
$Text{Inquiry} = &getGoodsinfo();
}
# テンプレート置換
my $system_templ_dir = $main::nsoDB_path ."/";
my $system_templ_kind = "templ";
my $Data = "support1.htmp";
# テンプレート置換
my $NsoTempl = NsoTempl->new({ DataDir=>$system_templ_dir, DirKind=>$system_templ_kind, Data=>$Data });
my %replace_templ = (
Text => \%Text,
);
print $NsoMisc->print_header();
print $NsoTempl->replace_templ(\%replace_templ);
exit();
}
;#
;# 商品情報取得
;#
sub getGoodsinfo {
my $self = shift;
my $GoodsID = $in{GoodsID};
my $RecordList;
my $ArticleNo;
my $ArticleName;
my %RecordHash;
my $RecordCount;
#GoodsIDのチェック(半角数値1桁以上) OK:SQL実行、NG:$RecordにNull代入(テキスト表示なし)
if ($GoodsID =~ m/^\d+$/) {
# クエリ作成
my $SQL_query = $NsoSupportCall->make_supportcallQuery( {GoodsID=>$GoodsID, target=>0} );
# DB接続
my $connectError = $DbConnect->DbConnect();
if ( $connectError ne "" ){
$status_err = $status_err . "
" . $connectError if($status_err ne "");
$status_err = $status_err . $connectError if($status_err eq "");
return;
}
# クエリ発行
my %db = $DbConnect->DbSelect($SQL_query);
# SQL 結果取得
$RecordList = %db->{RecordList};
my $queryError = %db->{status_err};
if ( $queryError ne "" ){
$status_err = $status_err . "
" . $queryError if($status_err ne "");
$status_err = $status_err . $queryError if($status_err eq "");
return;
}
$RecordCount = scalar @$RecordList;
} else {
$RecordCount = 0;
}
return if ($RecordCount == 0);
foreach my $RecList (@{$RecordList}){
%RecordHash = (
ArticleNo => $NsoMisc->j_decode_euc2sjis($$RecList[0]), # 商品ID
ArticleName => $NsoMisc->j_decode_euc2sjis($$RecList[1]), # 商品名
);
}
$ArticleNo = ${RecordHash{ArticleNo}};
$ArticleName = ${RecordHash{ArticleName}};
my @Goodsinfo = ();
push (@Goodsinfo, qq(●お問合せ商品情報));
push (@Goodsinfo, qq(<商品番号>).$ArticleNo);
push (@Goodsinfo, qq(<商品名>).$ArticleName);
push (@Goodsinfo, "");
push (@Goodsinfo, qq(●ご質問・お問い合わせ内容));
push (@Goodsinfo, "");
push (@Goodsinfo, qq(●ご連絡先\(E-mail以外での連絡をご希望の場合\)));
push (@Goodsinfo, "");
return join("\n",@Goodsinfo);
}