1 | <?php
|
---|
2 | /**
|
---|
3 | * This file is part of EC-CUBE
|
---|
4 | *
|
---|
5 | * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved.
|
---|
6 | *
|
---|
7 | * http://www.lockon.co.jp/
|
---|
8 | *
|
---|
9 | * This program is free software; you can redistribute it and/or
|
---|
10 | * modify it under the terms of the GNU General Public License
|
---|
11 | * as published by the Free Software Foundation; either version 2
|
---|
12 | * of the License, or (at your option) any later version.
|
---|
13 | *
|
---|
14 | * This program is distributed in the hope that it will be useful,
|
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | * GNU General Public License for more details.
|
---|
18 | *
|
---|
19 | * You should have received a copy of the GNU General Public License
|
---|
20 | * along with this program; if not, write to the Free Software
|
---|
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
22 | */
|
---|
23 | define("MDL_ZAIKOROBOT_ID", 15);
|
---|
24 | define("MODULE_NAME", "zaiko robotϢư¥â¥¸¥å¡¼¥ë");
|
---|
25 |
|
---|
26 | //================================================================================
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * DB¤Ë¥Ç¡¼¥¿ÅÐÏ¿
|
---|
30 | */
|
---|
31 | function sfZaikoSetModuleDB($module_id, $objFormParam) {
|
---|
32 | $objQuery = new SC_Query();
|
---|
33 | $arrRet = $objFormParam->getHashArray();
|
---|
34 | foreach($arrRet as $key => $val) {
|
---|
35 | $arrVal[$key] = $val;
|
---|
36 | }
|
---|
37 | $sqlval['sub_data'] = serialize($arrVal);
|
---|
38 | $objQuery->update("dtb_module", $sqlval, "module_id = ?", array($module_id));
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * DB¤«¤é¥Ç¡¼¥¿¼èÆÀ
|
---|
43 | */
|
---|
44 | function sfZaikoGetModuleDB($module_id) {
|
---|
45 | $objQuery = new SC_Query();
|
---|
46 | $arrVal = array($module_id);
|
---|
47 | $arrRet = array();
|
---|
48 | $sql = "SELECT sub_data
|
---|
49 | FROM dtb_module WHERE module_id = ?";
|
---|
50 | $arrRet = $objQuery->getall($sql, $arrVal);
|
---|
51 | return unserialize($arrRet[0]['sub_data']);
|
---|
52 | }
|
---|
53 |
|
---|
54 | /**
|
---|
55 | * ID¥Á¥§¥Ã¥¯
|
---|
56 | */
|
---|
57 | function sfZaikoIdCheck() {
|
---|
58 | $ret = sfZaikoGetModuleDb(MDL_ZAIKOROBOT_ID);
|
---|
59 | // ǧ¾ÚÀ®¸ù
|
---|
60 | if (isset($_POST['sys_id']) && isset($_POST['sys_pass']) &&
|
---|
61 | $ret['id'] == $_POST['sys_id'] && $ret['pass'] == $_POST['sys_pass']) {
|
---|
62 | return true;
|
---|
63 | // ǧ¾Ú¥¨¥é¡¼
|
---|
64 | } else {
|
---|
65 | echo "NG\n";
|
---|
66 | echo "auth_error";
|
---|
67 | exit;
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * ºß¸ËÄ´À°
|
---|
73 | */
|
---|
74 | function sfZaikoUpdate() {
|
---|
75 | if (isset($_POST['product'])) {
|
---|
76 | $objQuery = new SC_Query();
|
---|
77 | $cnt = "0";
|
---|
78 | foreach($_POST['product'] as $key => $val) {
|
---|
79 | $table = "dtb_products_class";
|
---|
80 | $where = "product_id = ? AND product_code = ?";
|
---|
81 | $arrval = array();
|
---|
82 | $arrval[] = empty($val['product_id']) ? "0" : $val['product_id'];
|
---|
83 | $arrval[] = empty($val['product_code']) ? "0" : $val['product_code'];
|
---|
84 | // ºß¸Ë¹¹¿·
|
---|
85 | if (sfDataExists($table, $where, $arrval) === true) {
|
---|
86 | $sqlval['stock'] = empty($val['stock']) ? "0" : $val['stock'];
|
---|
87 | $objQuery->update($table, $sqlval, $where, $arrval);
|
---|
88 | // ¾¦ÉÊ¥¨¥é¡¼
|
---|
89 | } else {
|
---|
90 | $cnt++;
|
---|
91 | if ($cnt == "1") $mes = "NG\n";
|
---|
92 | $mes .= "no_product(product_id=". $arrval[0]. ",product_code=". $arrval[1]. ")\n";
|
---|
93 | }
|
---|
94 | }
|
---|
95 | // À®¸ù
|
---|
96 | if ($cnt == "0") {
|
---|
97 | $mes = "OK";
|
---|
98 | }
|
---|
99 | // ¥¯¥¨¥ê¡¼¥¨¥é¡¼
|
---|
100 | } else {
|
---|
101 | $mes = "NG\n". "no_query";
|
---|
102 | }
|
---|
103 | echo $mes;
|
---|
104 | exit;
|
---|
105 | }
|
---|
106 |
|
---|
107 | ?> |
---|