1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2010 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 | |
---|
24 | // {{{ requires |
---|
25 | require_once(CLASS_EX_REALDIR . "page_extends/admin/order/LC_Page_Admin_Order_Ex.php"); |
---|
26 | |
---|
27 | /** |
---|
28 | * 受注修正 のページクラス. |
---|
29 | * |
---|
30 | * @package Page |
---|
31 | * @author LOCKON CO.,LTD. |
---|
32 | * @version $Id$ |
---|
33 | */ |
---|
34 | class LC_Page_Admin_Order_Edit extends LC_Page_Admin_Order_Ex { |
---|
35 | |
---|
36 | // }}} |
---|
37 | // {{{ functions |
---|
38 | |
---|
39 | /** |
---|
40 | * Page を初期化する. |
---|
41 | * |
---|
42 | * @return void |
---|
43 | */ |
---|
44 | function init() { |
---|
45 | parent::init(); |
---|
46 | $this->tpl_mainpage = 'order/edit.tpl'; |
---|
47 | $this->tpl_subnavi = 'order/subnavi.tpl'; |
---|
48 | $this->tpl_mainno = 'order'; |
---|
49 | |
---|
50 | $masterData = new SC_DB_MasterData_Ex(); |
---|
51 | $this->arrPref = $masterData->getMasterData('mtb_pref'); |
---|
52 | $this->arrORDERSTATUS = $masterData->getMasterData("mtb_order_status"); |
---|
53 | $this->arrDeviceType = $masterData->getMasterData('mtb_device_type'); |
---|
54 | |
---|
55 | $objDate = new SC_Date(RELEASE_YEAR); |
---|
56 | $this->arrYearShippingDate = $objDate->getYear('', date('Y'), ''); |
---|
57 | $this->arrMonthShippingDate = $objDate->getMonth(true); |
---|
58 | $this->arrDayShippingDate = $objDate->getDay(true); |
---|
59 | |
---|
60 | // 支払い方法の取得 |
---|
61 | $this->arrPayment = SC_Helper_DB_Ex::sfGetIDValueList("dtb_payment", "payment_id", "payment_method"); |
---|
62 | |
---|
63 | // 配送業者の取得 |
---|
64 | $this->arrDeliv = SC_Helper_DB_Ex::sfGetIDValueList("dtb_deliv", "deliv_id", "name"); |
---|
65 | |
---|
66 | $this->httpCacheControl('nocache'); |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * Page のプロセス. |
---|
71 | * |
---|
72 | * @return void |
---|
73 | */ |
---|
74 | function process() { |
---|
75 | $this->action(); |
---|
76 | $this->sendResponse(); |
---|
77 | } |
---|
78 | |
---|
79 | /** |
---|
80 | * Page のアクション. |
---|
81 | * |
---|
82 | * @return void |
---|
83 | */ |
---|
84 | function action() { |
---|
85 | $objPurchase = new SC_Helper_Purchase_Ex(); |
---|
86 | $objFormParam = new SC_FormParam(); |
---|
87 | |
---|
88 | // パラメータ情報の初期化 |
---|
89 | $this->lfInitParam($objFormParam); |
---|
90 | $objFormParam->setParam($_REQUEST); |
---|
91 | $objFormParam->convParam(); |
---|
92 | $order_id = $objFormParam->getValue('order_id'); |
---|
93 | |
---|
94 | // DBから受注情報を読み込む |
---|
95 | if (!SC_Utils_Ex::isBlank($order_id)) { |
---|
96 | $this->setOrderToFormParam($objFormParam, $order_id); |
---|
97 | $this->tpl_subno = 'index'; |
---|
98 | $this->tpl_subtitle = '受注管理'; |
---|
99 | } else { |
---|
100 | $this->tpl_subno = 'add'; |
---|
101 | $this->tpl_mode = 'add'; |
---|
102 | $this->tpl_subtitle = '新規受注入力'; |
---|
103 | } |
---|
104 | |
---|
105 | $this->arrSearchHidden = $objFormParam->getSearchArray(); |
---|
106 | |
---|
107 | switch($this->getMode()) { |
---|
108 | case 'pre_edit': |
---|
109 | case 'order_id': |
---|
110 | break; |
---|
111 | |
---|
112 | case 'edit': |
---|
113 | $objFormParam->setParam($_POST); |
---|
114 | $objFormParam->convParam(); |
---|
115 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
116 | if (SC_Utils_Ex::isBlank($this->arrErr)) { |
---|
117 | $order_id = $this->doRegister($order_id, $objPurchase, $objFormParam); |
---|
118 | $this->setOrderToFormParam($objFormParam, $order_id); |
---|
119 | $this->tpl_onload = "window.alert('受注を編集しました。');"; |
---|
120 | } |
---|
121 | break; |
---|
122 | |
---|
123 | case 'add': |
---|
124 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
---|
125 | $objFormParam->setParam($_POST); |
---|
126 | $objFormParam->convParam(); |
---|
127 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
128 | if (SC_Utils_Ex::isBlank($this->arrErr)) { |
---|
129 | $order_id = $this->doRegister(null, $objPurchase, $objFormParam); |
---|
130 | $this->tpl_mode = 'edit'; |
---|
131 | $objFormParam->setValue('order_id', $order_id); |
---|
132 | $this->setOrderToFormParam($objFormParam, $order_id); |
---|
133 | $this->tpl_onload = "window.alert('新規受注を登録しました。');"; |
---|
134 | } |
---|
135 | } |
---|
136 | |
---|
137 | break; |
---|
138 | |
---|
139 | // 再計算 |
---|
140 | case 'recalculate': |
---|
141 | //支払い方法の選択 |
---|
142 | case 'payment': |
---|
143 | // 配送業者の選択 |
---|
144 | case 'deliv': |
---|
145 | $objFormParam->setParam($_POST); |
---|
146 | $objFormParam->convParam(); |
---|
147 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
148 | break; |
---|
149 | |
---|
150 | // 商品削除 |
---|
151 | case 'delete_product': |
---|
152 | $objFormParam->setParam($_POST); |
---|
153 | $objFormParam->convParam(); |
---|
154 | $delete_no = $objFormParam->getValue('delete_no'); |
---|
155 | $this->doDeleteProduct($delete_no, $objFormParam); |
---|
156 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
157 | break; |
---|
158 | |
---|
159 | // 商品追加ポップアップより商品選択 |
---|
160 | case 'select_product_detail': |
---|
161 | $objFormParam->setParam($_POST); |
---|
162 | $objFormParam->convParam(); |
---|
163 | $this->doRegisterProduct($objFormParam); |
---|
164 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
165 | break; |
---|
166 | |
---|
167 | // 顧客検索ポップアップより顧客指定 |
---|
168 | case 'search_customer': |
---|
169 | $objFormParam->setParam($_POST); |
---|
170 | $objFormParam->convParam(); |
---|
171 | $this->setCustomerTo($objFormParam->getValue('edit_customer_id'), |
---|
172 | $objFormParam); |
---|
173 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
174 | break; |
---|
175 | |
---|
176 | // 複数配送設定表示 |
---|
177 | case 'multiple': |
---|
178 | $objFormParam->setParam($_POST); |
---|
179 | $objFormParam->convParam(); |
---|
180 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
181 | break; |
---|
182 | |
---|
183 | // 複数配送設定を反映 |
---|
184 | case 'multiple_set_to': |
---|
185 | $this->lfInitMultipleParam($objFormParam); |
---|
186 | $objFormParam->setParam($_POST); |
---|
187 | $objFormParam->convParam(); |
---|
188 | $this->setMultipleItemTo($objFormParam); |
---|
189 | break; |
---|
190 | |
---|
191 | // お届け先の追加 |
---|
192 | case 'append_shipping': |
---|
193 | $objFormParam->setParam($_POST); |
---|
194 | $objFormParam->convParam(); |
---|
195 | $this->addShipping($objFormParam); |
---|
196 | break; |
---|
197 | |
---|
198 | default: |
---|
199 | } |
---|
200 | |
---|
201 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
202 | $this->arrDelivTime = $objPurchase->getDelivTime($objFormParam->getValue('deliv_id')); |
---|
203 | $this->tpl_onload .= $this->getAnchorKey($objFormParam); |
---|
204 | $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); |
---|
205 | } |
---|
206 | |
---|
207 | /** |
---|
208 | * デストラクタ. |
---|
209 | * |
---|
210 | * @return void |
---|
211 | */ |
---|
212 | function destroy() { |
---|
213 | parent::destroy(); |
---|
214 | } |
---|
215 | |
---|
216 | /** |
---|
217 | * パラメータ情報の初期化を行う. |
---|
218 | * |
---|
219 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
220 | * @return void |
---|
221 | */ |
---|
222 | function lfInitParam(&$objFormParam) { |
---|
223 | // 検索条件のパラメータを初期化 |
---|
224 | parent::lfInitParam($objFormParam); |
---|
225 | |
---|
226 | // お客様情報 |
---|
227 | $objFormParam->addParam("顧客名1", "order_name01", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
228 | $objFormParam->addParam("顧客名2", "order_name02", STEXT_LEN, "KVa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
229 | $objFormParam->addParam("顧客名カナ1", "order_kana01", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
230 | $objFormParam->addParam("顧客名カナ2", "order_kana02", STEXT_LEN, "KVCa", array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
231 | $objFormParam->addParam("メールアドレス", "order_email", MTEXT_LEN, "KVCa", array("NO_SPTAB", "EMAIL_CHECK", "EMAIL_CHAR_CHECK", "MAX_LENGTH_CHECK")); |
---|
232 | $objFormParam->addParam("郵便番号1", "order_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK")); |
---|
233 | $objFormParam->addParam("郵便番号2", "order_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK")); |
---|
234 | $objFormParam->addParam("都道府県", "order_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
235 | $objFormParam->addParam("住所1", "order_addr01", MTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
236 | $objFormParam->addParam("住所2", "order_addr02", MTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
237 | $objFormParam->addParam("電話番号1", "order_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); |
---|
238 | $objFormParam->addParam("電話番号2", "order_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); |
---|
239 | $objFormParam->addParam("電話番号3", "order_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); |
---|
240 | |
---|
241 | // 受注商品情報 |
---|
242 | $objFormParam->addParam("値引き", "discount", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
243 | $objFormParam->addParam("送料", "deliv_fee", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
244 | $objFormParam->addParam("手数料", "charge", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
245 | |
---|
246 | // ポイント機能ON時のみ |
---|
247 | if (USE_POINT !== false) { |
---|
248 | $objFormParam->addParam("利用ポイント", "use_point", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
249 | } |
---|
250 | |
---|
251 | $objFormParam->addParam("配送業者", "deliv_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
252 | $objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
253 | $objFormParam->addParam("対応状況", "status", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
254 | $objFormParam->addParam("お支払方法名称", "payment_method"); |
---|
255 | |
---|
256 | // 受注詳細情報 |
---|
257 | $objFormParam->addParam("商品項番", "product_class_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
258 | $objFormParam->addParam("商品種別ID", "product_type_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
259 | $objFormParam->addParam("単価", "price", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
260 | $objFormParam->addParam("数量", "quantity", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
261 | $objFormParam->addParam("商品ID", "product_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
262 | $objFormParam->addParam("商品規格ID", "product_class_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
263 | $objFormParam->addParam("ポイント付与率", "point_rate"); |
---|
264 | $objFormParam->addParam("商品コード", "product_code"); |
---|
265 | $objFormParam->addParam("商品名", "product_name"); |
---|
266 | $objFormParam->addParam("規格名1", "classcategory_name1"); |
---|
267 | $objFormParam->addParam("規格名2", "classcategory_name2"); |
---|
268 | $objFormParam->addParam("メモ", "note", MTEXT_LEN, "KVa", array("MAX_LENGTH_CHECK")); |
---|
269 | $objFormParam->addParam("削除用項番", "delete_no", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
270 | |
---|
271 | // DB読込用 |
---|
272 | $objFormParam->addParam("小計", "subtotal"); |
---|
273 | $objFormParam->addParam("合計", "total"); |
---|
274 | $objFormParam->addParam("支払い合計", "payment_total"); |
---|
275 | $objFormParam->addParam("加算ポイント", "add_point"); |
---|
276 | $objFormParam->addParam("お誕生日ポイント", "birth_point"); |
---|
277 | $objFormParam->addParam("消費税合計", "tax"); |
---|
278 | $objFormParam->addParam("最終保持ポイント", "total_point"); |
---|
279 | $objFormParam->addParam("顧客ID", "customer_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
280 | $objFormParam->addParam("顧客ID", "edit_customer_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
281 | $objFormParam->addParam("現在のポイント", "customer_point"); |
---|
282 | $objFormParam->addParam("受注前ポイント", "point"); |
---|
283 | $objFormParam->addParam("注文番号", "order_id"); |
---|
284 | $objFormParam->addParam("受注日", "create_date"); |
---|
285 | $objFormParam->addParam("発送日", "commit_date"); |
---|
286 | $objFormParam->addParam("備考", "message"); |
---|
287 | $objFormParam->addParam("入金日", "payment_date"); |
---|
288 | $objFormParam->addParam("アクセス端末", "device_type_id"); |
---|
289 | |
---|
290 | // 複数情報 |
---|
291 | $objFormParam->addParam("配送数", "shipping_quantity", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 1); |
---|
292 | $objFormParam->addParam("配送ID", "shipping_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), 0); |
---|
293 | $objFormParam->addParam("お名前1", "shipping_name01", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
294 | $objFormParam->addParam("お名前2", "shipping_name02", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
295 | $objFormParam->addParam("お名前(フリガナ・姓)", "shipping_kana01", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
296 | $objFormParam->addParam("お名前(フリガナ・名)", "shipping_kana02", STEXT_LEN, "KVCa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
297 | $objFormParam->addParam("郵便番号1", "shipping_zip01", ZIP01_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK")); |
---|
298 | $objFormParam->addParam("郵便番号2", "shipping_zip02", ZIP02_LEN, "n", array("NUM_CHECK", "NUM_COUNT_CHECK")); |
---|
299 | $objFormParam->addParam("都道府県", "shipping_pref", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
300 | $objFormParam->addParam("住所1", "shipping_addr01", MTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
301 | $objFormParam->addParam("住所2", "shipping_addr02", MTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
302 | $objFormParam->addParam("電話番号1", "shipping_tel01", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); |
---|
303 | $objFormParam->addParam("電話番号2", "shipping_tel02", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); |
---|
304 | $objFormParam->addParam("電話番号3", "shipping_tel03", TEL_ITEM_LEN, "n", array("MAX_LENGTH_CHECK" ,"NUM_CHECK")); |
---|
305 | $objFormParam->addParam("お届け時間ID", "time_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
306 | $objFormParam->addParam("お届け時間", "shipping_time"); |
---|
307 | $objFormParam->addParam("お届け日(年)", "shipping_date_year", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
308 | $objFormParam->addParam("お届け日(月)", "shipping_date_month", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
309 | $objFormParam->addParam("お届け日(日)", "shipping_date_day", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
310 | $objFormParam->addParam("お届け日", "shipping_date", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
311 | $objFormParam->addParam("配送商品数", "shipping_product_quantity", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
312 | |
---|
313 | $objFormParam->addParam("商品規格ID", "shipment_product_class_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
314 | $objFormParam->addParam("商品コード", "shipment_product_code"); |
---|
315 | $objFormParam->addParam("商品名", "shipment_product_name"); |
---|
316 | $objFormParam->addParam("規格名1", "shipment_classcategory_name1"); |
---|
317 | $objFormParam->addParam("規格名2", "shipment_classcategory_name2"); |
---|
318 | $objFormParam->addParam("単価", "shipment_price", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
319 | $objFormParam->addParam("数量", "shipment_quantity", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '0'); |
---|
320 | |
---|
321 | $objFormParam->addParam("商品項番", "no", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
322 | $objFormParam->addParam("追加商品規格ID", "add_product_class_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
323 | $objFormParam->addParam("修正商品規格ID", "edit_product_class_id", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
324 | $objFormParam->addParam("アンカーキー", "anchor_key", STEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); |
---|
325 | } |
---|
326 | |
---|
327 | /** |
---|
328 | * 複数配送用フォームの初期化を行う. |
---|
329 | * |
---|
330 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
331 | * @return void |
---|
332 | */ |
---|
333 | function lfInitMultipleParam(&$objFormParam) { |
---|
334 | $objFormParam->addParam("商品規格ID", "multiple_product_class_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
335 | $objFormParam->addParam("商品コード", "multiple_product_code", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), 1); |
---|
336 | $objFormParam->addParam("商品名", "multiple_product_name", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), 1); |
---|
337 | $objFormParam->addParam("規格1", "multiple_classcategory_name1", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), 1); |
---|
338 | $objFormParam->addParam("規格2", "multiple_classcategory_name2", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), 1); |
---|
339 | $objFormParam->addParam("単価", "multiple_price", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), 1); |
---|
340 | $objFormParam->addParam("数量", "multiple_quantity", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK"), 1); |
---|
341 | $objFormParam->addParam("配送先住所", "multiple_shipping_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); |
---|
342 | } |
---|
343 | |
---|
344 | /** |
---|
345 | * 複数配送入力フォームで入力された値を SC_FormParam へ設定する. |
---|
346 | * |
---|
347 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
348 | * @return void |
---|
349 | */ |
---|
350 | function setMultipleItemTo(&$objFormParam) { |
---|
351 | $arrMultipleKey = array('multiple_shipping_id', |
---|
352 | 'multiple_product_class_id', |
---|
353 | 'multiple_product_name', |
---|
354 | 'multiple_product_code', |
---|
355 | 'multiple_classcategory_name1', |
---|
356 | 'multiple_classcategory_name2', |
---|
357 | 'multiple_price', |
---|
358 | 'multiple_quantity'); |
---|
359 | $arrMultipleParams = $objFormParam->getSwapArray($arrMultipleKey); |
---|
360 | |
---|
361 | /* |
---|
362 | * 複数配送フォームの入力値を shipping_id ごとにマージ |
---|
363 | * |
---|
364 | * $arrShipmentItem[配送先ID][商品規格ID]['shipment_(key)'] = 値 |
---|
365 | */ |
---|
366 | $arrShipmentItem = array(); |
---|
367 | foreach ($arrMultipleParams as $arrMultiple) { |
---|
368 | $shipping_id = $arrMultiple['multiple_shipping_id']; |
---|
369 | $product_class_id = $arrMultiple['multiple_product_class_id']; |
---|
370 | foreach ($arrMultiple as $key => $val) { |
---|
371 | if ($key == 'multiple_quantity') { |
---|
372 | $arrShipmentItem[$shipping_id][$product_class_id][str_replace('multiple', 'shipment', $key)] += $val; |
---|
373 | } else { |
---|
374 | $arrShipmentItem[$shipping_id][$product_class_id][str_replace('multiple', 'shipment', $key)] = $val; |
---|
375 | } |
---|
376 | } |
---|
377 | } |
---|
378 | |
---|
379 | /* |
---|
380 | * フォームの配送先ごとの配列を生成 |
---|
381 | * |
---|
382 | * $arrShipmentForm['(key)'][$shipping_index][$item_index] = 値 |
---|
383 | * $arrProductQuantity[$shipping_index] = 配送先ごとの配送商品数 |
---|
384 | */ |
---|
385 | $arrShipmentForm = array(); |
---|
386 | $arrProductQuantity = array(); |
---|
387 | $arrShippingIds = $objFormParam->getValue('shipping_id'); |
---|
388 | foreach ($arrShippingIds as $shipping_index => $shipping_id) { |
---|
389 | $item_index = 0; |
---|
390 | foreach ($arrShipmentItem[$shipping_id] as $product_class_id => $shipment_item) { |
---|
391 | foreach ($shipment_item as $key => $val) { |
---|
392 | $arrShipmentForm[$key][$shipping_index][$item_index] = $val; |
---|
393 | } |
---|
394 | // 受注商品の数量を設定 |
---|
395 | $arrQuantity[$product_class_id] += $shipment_item['shipment_quantity']; |
---|
396 | $item_index++; |
---|
397 | } |
---|
398 | // 配送先ごとの配送商品数を設定 |
---|
399 | $arrProductQuantity[$shipping_index] = count($arrShipmentItem[$shipping_id]); |
---|
400 | } |
---|
401 | |
---|
402 | $objFormParam->setParam($arrShipmentForm); |
---|
403 | $objFormParam->setValue('shipping_product_quantity', $arrProductQuantity); |
---|
404 | |
---|
405 | // 受注商品の数量を変更 |
---|
406 | $arrDest = array(); |
---|
407 | foreach ($arrQuantity as $product_class_id => $quantity) { |
---|
408 | foreach ($objFormParam->getValue('product_class_id') as $n => $order_product_class_id) { |
---|
409 | if ($product_class_id == $order_product_class_id) { |
---|
410 | $arrDest['quantity'][$n] = $quantity; |
---|
411 | } |
---|
412 | } |
---|
413 | } |
---|
414 | $objFormParam->setParam($arrDest); |
---|
415 | } |
---|
416 | |
---|
417 | /** |
---|
418 | * 受注データを取得して, SC_FormParam へ設定する. |
---|
419 | * |
---|
420 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
421 | * @param integer $order_id 取得元の受注ID |
---|
422 | * @return void |
---|
423 | */ |
---|
424 | function setOrderToFormParam(&$objFormParam, $order_id) { |
---|
425 | $objPurchase = new SC_Helper_Purchase_Ex(); |
---|
426 | |
---|
427 | // 受注詳細を設定 |
---|
428 | $arrOrderDetail = $objPurchase->getOrderDetail($order_id, false); |
---|
429 | $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrOrderDetail)); |
---|
430 | |
---|
431 | $arrShippings = $objPurchase->getShippings($order_id); |
---|
432 | // お届け日の処理 |
---|
433 | foreach (array_keys($arrShippings) as $key) { |
---|
434 | $shipping =& $arrShippings[$key]; |
---|
435 | if (!SC_Utils_Ex::isBlank($shipping["shipping_date"])) { |
---|
436 | $ts = strtotime($shipping["shipping_date"]); |
---|
437 | $arrShippings[$key]['shipping_date_year'] = date("Y", $ts); |
---|
438 | $arrShippings[$key]['shipping_date_month'] = date("n", $ts); |
---|
439 | $arrShippings[$key]['shipping_date_day'] = date("j", $ts); |
---|
440 | } |
---|
441 | } |
---|
442 | $objFormParam->setValue('shipping_quantity', count($arrShippings)); |
---|
443 | $objFormParam->setParam(SC_Utils_Ex::sfSwapArray($arrShippings)); |
---|
444 | |
---|
445 | /* |
---|
446 | * 配送商品を設定 |
---|
447 | * |
---|
448 | * $arrShipmentItem['shipment_(key)'][$shipping_index][$item_index] = 値 |
---|
449 | * $arrProductQuantity[$shipping_index] = 配送先ごとの配送商品数 |
---|
450 | */ |
---|
451 | $arrProductQuantity = array(); |
---|
452 | $arrShipmentItem = array(); |
---|
453 | foreach ($arrShippings as $shipping_index => $arrShipping) { |
---|
454 | $arrProductQuantity[$shipping_index] = count($arrShipping['shipment_item']); |
---|
455 | foreach ($arrShipping['shipment_item'] as $item_index => $arrItem) { |
---|
456 | foreach ($arrItem as $item_key => $item_val) { |
---|
457 | $arrShipmentItem['shipment_' . $item_key][$shipping_index][$item_index] = $item_val; |
---|
458 | } |
---|
459 | } |
---|
460 | } |
---|
461 | $objFormParam->setValue('shipping_product_quantity', $arrProductQuantity); |
---|
462 | $objFormParam->setParam($arrShipmentItem); |
---|
463 | |
---|
464 | /* |
---|
465 | * 受注情報を設定 |
---|
466 | * $arrOrderDetail と項目が重複しており, $arrOrderDetail は連想配列の値 |
---|
467 | * が渡ってくるため, $arrOrder で上書きする. |
---|
468 | */ |
---|
469 | $arrOrder = $objPurchase->getOrder($order_id); |
---|
470 | $objFormParam->setParam($arrOrder); |
---|
471 | |
---|
472 | // XXX ポイントを設定 |
---|
473 | list($db_point, $rollback_point) = SC_Helper_DB_Ex::sfGetRollbackPoint($order_id, $arrOrder['use_point'], $arrOrder['add_point']); |
---|
474 | $objFormParam->setValue('total_point', $db_point); |
---|
475 | $objFormParam->setValue('point', $rollback_point); |
---|
476 | |
---|
477 | if (!SC_Utils_Ex::isBlank($objFormParam->getValue('customer_id'))) { |
---|
478 | $this->setCustomerTo($objFormParam->getValue('customer_id'), |
---|
479 | $objFormParam); |
---|
480 | } |
---|
481 | } |
---|
482 | |
---|
483 | /** |
---|
484 | * 入力内容のチェックを行う. |
---|
485 | * |
---|
486 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
487 | * @return array エラーメッセージの配列 |
---|
488 | */ |
---|
489 | function lfCheckError(&$objFormParam) { |
---|
490 | $arrErr = $objFormParam->checkError(); |
---|
491 | |
---|
492 | if (!SC_Utils_Ex::isBlank($objErr->arrErr)) { |
---|
493 | return $arrErr; |
---|
494 | } |
---|
495 | |
---|
496 | $arrValues = $objFormParam->getHashArray(); |
---|
497 | |
---|
498 | // 商品の種類数 |
---|
499 | $max = count($arrValues['quantity']); |
---|
500 | $subtotal = 0; |
---|
501 | $totalpoint = 0; |
---|
502 | $totaltax = 0; |
---|
503 | for($i = 0; $i < $max; $i++) { |
---|
504 | // 小計の計算 |
---|
505 | $subtotal += SC_Helper_DB_Ex::sfCalcIncTax($arrValues['price'][$i]) * $arrValues['quantity'][$i]; |
---|
506 | // 小計の計算 |
---|
507 | $totaltax += SC_Helper_DB_Ex::sfTax($arrValues['price'][$i]) * $arrValues['quantity'][$i]; |
---|
508 | // 加算ポイントの計算 |
---|
509 | $totalpoint += SC_Utils_Ex::sfPrePoint($arrValues['price'][$i], $arrValues['point_rate'][$i]) * $arrValues['quantity'][$i]; |
---|
510 | } |
---|
511 | |
---|
512 | // 消費税 |
---|
513 | $arrValues['tax'] = $totaltax; |
---|
514 | // 小計 |
---|
515 | $arrValues['subtotal'] = $subtotal; |
---|
516 | // 合計 |
---|
517 | $arrValues['total'] = $subtotal - $arrValues['discount'] + $arrValues['deliv_fee'] + $arrValues['charge']; |
---|
518 | // お支払い合計 |
---|
519 | $arrValues['payment_total'] = $arrValues['total'] - ($arrValues['use_point'] * POINT_VALUE); |
---|
520 | |
---|
521 | // 加算ポイント |
---|
522 | $arrValues['add_point'] = SC_Helper_DB_Ex::sfGetAddPoint($totalpoint, $arrValues['use_point']); |
---|
523 | |
---|
524 | // 最終保持ポイント |
---|
525 | $arrValues['total_point'] = $objFormParam->getValue('point') - $arrValues['use_point'] + $arrValues['add_point']; |
---|
526 | |
---|
527 | if ($arrValues['total'] < 0) { |
---|
528 | $arrErr['total'] = '合計額がマイナス表示にならないように調整して下さい。<br />'; |
---|
529 | } |
---|
530 | |
---|
531 | if ($arrValues['payment_total'] < 0) { |
---|
532 | $arrErr['payment_total'] = 'お支払い合計額がマイナス表示にならないように調整して下さい。<br />'; |
---|
533 | } |
---|
534 | |
---|
535 | if ($arrValues['total_point'] < 0) { |
---|
536 | $arrErr['use_point'] = '最終保持ポイントがマイナス表示にならないように調整して下さい。<br />'; |
---|
537 | } |
---|
538 | |
---|
539 | $objFormParam->setParam($arrValues); |
---|
540 | return $arrErr; |
---|
541 | } |
---|
542 | |
---|
543 | /** |
---|
544 | * DB更新処理 |
---|
545 | * |
---|
546 | * @param integer $order_id 受注ID |
---|
547 | * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス |
---|
548 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
549 | * @return integer $order_id 受注ID |
---|
550 | */ |
---|
551 | function doRegister($order_id, &$objPurchase, &$objFormParam) { |
---|
552 | |
---|
553 | $objQuery =& SC_Query::getSingletonInstance(); |
---|
554 | $arrValues = $objFormParam->getDbArray(); |
---|
555 | |
---|
556 | $where = "order_id = ?"; |
---|
557 | |
---|
558 | $objQuery->begin(); |
---|
559 | |
---|
560 | // 受注テーブルの更新 |
---|
561 | $order_id = $objPurchase->registerOrder($order_id, $arrValues); |
---|
562 | |
---|
563 | $arrDetail = $objFormParam->getSwapArray(array("product_id", |
---|
564 | "product_class_id", |
---|
565 | "product_code", |
---|
566 | "product_name", |
---|
567 | "price", "quantity", |
---|
568 | "point_rate", |
---|
569 | "classcategory_name1", |
---|
570 | "classcategory_name2")); |
---|
571 | |
---|
572 | // 変更しようとしている商品情報とDBに登録してある商品情報を比較することで、更新すべき数量を計算 |
---|
573 | $max = count($arrDetail); |
---|
574 | $k = 0; |
---|
575 | $arrStockData = array(); |
---|
576 | for($i = 0; $i < $max; $i++) { |
---|
577 | if (!empty($arrDetail[$i]['product_id'])) { |
---|
578 | $arrPreDetail = $objQuery->select('*', "dtb_order_detail", "order_id = ? AND product_class_id = ?", array($order_id, $arrDetail[$i]['product_class_id'])); |
---|
579 | if (!empty($arrPreDetail) && $arrPreDetail[0]['quantity'] != $arrDetail[$i]['quantity']) { |
---|
580 | // 数量が変更された商品 |
---|
581 | $arrStockData[$k]['product_class_id'] = $arrDetail[$i]['product_class_id']; |
---|
582 | $arrStockData[$k]['quantity'] = $arrPreDetail[0]['quantity'] - $arrDetail[$i]['quantity']; |
---|
583 | ++$k; |
---|
584 | } elseif (empty($arrPreDetail)) { |
---|
585 | // 新しく追加された商品 もしくは 違う商品に変更された商品 |
---|
586 | $arrStockData[$k]['product_class_id'] = $arrDetail[$i]['product_class_id']; |
---|
587 | $arrStockData[$k]['quantity'] = -$arrDetail[$i]['quantity']; |
---|
588 | ++$k; |
---|
589 | } |
---|
590 | $objQuery->delete("dtb_order_detail", "order_id = ? AND product_class_id = ?", array($order_id, $arrDetail[$i]['product_class_id'])); |
---|
591 | } |
---|
592 | } |
---|
593 | |
---|
594 | // 上記の新しい商品のループでDELETEされなかった商品は、注文より削除された商品 |
---|
595 | $arrPreDetail = $objQuery->select('*', "dtb_order_detail", "order_id = ?", array($order_id)); |
---|
596 | foreach ($arrPreDetail AS $key=>$val) { |
---|
597 | $arrStockData[$k]['product_class_id'] = $val['product_class_id']; |
---|
598 | $arrStockData[$k]['quantity'] = $val['quantity']; |
---|
599 | ++$k; |
---|
600 | } |
---|
601 | |
---|
602 | // 受注詳細データの更新 |
---|
603 | $objPurchase->registerOrderDetail($order_id, $arrDetail); |
---|
604 | |
---|
605 | // 在庫数調整 |
---|
606 | if (ORDER_DELIV != $arrValues['status'] |
---|
607 | && ORDER_CANCEL != $arrValues['status']) { |
---|
608 | foreach ($arrStockData AS $stock) { |
---|
609 | $objQuery->update('dtb_products_class', array(), |
---|
610 | 'product_class_id = ?', |
---|
611 | array($stock['product_class_id']), |
---|
612 | array('stock' => 'stock + ?'), |
---|
613 | array($stock['quantity'])); |
---|
614 | } |
---|
615 | } |
---|
616 | |
---|
617 | $arrAllShipping = $objFormParam->getSwapArray(array('shipping_id', |
---|
618 | 'shipping_name01', |
---|
619 | 'shipping_name02', |
---|
620 | 'shipping_kana01', |
---|
621 | 'shipping_kana02', |
---|
622 | 'shipping_tel01', |
---|
623 | 'shipping_tel02', |
---|
624 | 'shipping_tel03', |
---|
625 | 'shipping_fax01', |
---|
626 | 'shipping_fax02', |
---|
627 | 'shipping_fax03', |
---|
628 | 'shipping_pref', |
---|
629 | 'shipping_zip01', |
---|
630 | 'shipping_zip02', |
---|
631 | 'shipping_addr01', |
---|
632 | 'shipping_addr02', |
---|
633 | 'shipping_date_year', |
---|
634 | 'shipping_date_month', |
---|
635 | 'shipping_date_day', |
---|
636 | 'time_id')); |
---|
637 | |
---|
638 | $arrAllShipmentItem = |
---|
639 | $objFormParam->getSwapArray(array('shipment_product_class_id', |
---|
640 | 'shipment_product_code', |
---|
641 | 'shipment_product_name', |
---|
642 | 'shipment_classcategory_name1', |
---|
643 | 'shipment_classcategory_name2', |
---|
644 | 'shipment_price', |
---|
645 | 'shipment_quantity')); |
---|
646 | $arrShippingValues = array(); |
---|
647 | foreach ($arrAllShipping as $shipping_index => $arrShipping) { |
---|
648 | $shipping_id = $arrShipping['shipping_id']; |
---|
649 | $arrShippingValues[$shipping_index] = $arrShipping; |
---|
650 | |
---|
651 | $arrShippingValues[$shipping_index]['shipping_date'] |
---|
652 | = SC_Utils_Ex::sfGetTimestamp($arrShipping['shipping_date_year'], |
---|
653 | $arrShipping['shipping_date_month'], |
---|
654 | $arrShipping['shipping_date_day']); |
---|
655 | |
---|
656 | // 配送業者IDを取得 |
---|
657 | $arrShippingValues[$shipping_index]['deliv_id'] = $objFormParam->getValue('deliv_id'); |
---|
658 | |
---|
659 | // 複数配送の場合は配送商品を登録 |
---|
660 | if (!SC_Utils_Ex::isBlank($arrAllShipmentItem)) { |
---|
661 | $arrShipmentValues = array(); |
---|
662 | |
---|
663 | foreach ($arrAllShipmentItem[$shipping_index] as $key => $arrItem) { |
---|
664 | $i = 0; |
---|
665 | foreach ($arrItem as $item) { |
---|
666 | $arrShipmentValues[$shipping_index][$i][str_replace('shipment_', '', $key)] = $item; |
---|
667 | $i++; |
---|
668 | } |
---|
669 | } |
---|
670 | $objPurchase->registerShipmentItem($order_id, $shipping_id, |
---|
671 | $arrShipmentValues[$shipping_index]); |
---|
672 | } |
---|
673 | } |
---|
674 | $objPurchase->registerShipping($order_id, $arrShippingValues, false); |
---|
675 | $objQuery->commit(); |
---|
676 | return $order_id; |
---|
677 | } |
---|
678 | |
---|
679 | /** |
---|
680 | * 受注商品の追加/更新を行う. |
---|
681 | * |
---|
682 | * 小画面で選択した受注商品をフォームに反映させる. |
---|
683 | * |
---|
684 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
685 | * @return void |
---|
686 | */ |
---|
687 | function doRegisterProduct(&$objFormParam) { |
---|
688 | $product_class_id = $objFormParam->getValue('add_product_class_id'); |
---|
689 | if (SC_Utils_Ex::isBlank($product_class_id)) { |
---|
690 | $product_class_id = $objFormParam->getValue('edit_product_class_id'); |
---|
691 | $changed_no = $objFormParam->getValue('no'); |
---|
692 | } |
---|
693 | |
---|
694 | // 選択済みの商品であれば数量を1増やす |
---|
695 | $exists = false; |
---|
696 | $arrExistsProductClassIds = $objFormParam->getValue('product_class_id'); |
---|
697 | foreach (array_keys($arrExistsProductClassIds) as $key) { |
---|
698 | $exists_product_class_id = $arrExistsProductClassIds[$key]; |
---|
699 | if ($exists_product_class_id == $product_class_id) { |
---|
700 | $exists = true; |
---|
701 | $arrExistsQuantity = $objFormParam->getValue('quantity'); |
---|
702 | $arrExistsQuantity[$key]++; |
---|
703 | $objFormParam->setValue('quantity', $arrExistsQuantity); |
---|
704 | } |
---|
705 | } |
---|
706 | |
---|
707 | // 新しく商品を追加した場合はフォームに登録 |
---|
708 | // 商品を変更した場合は、該当行を変更 |
---|
709 | if (!$exists) { |
---|
710 | $objProduct = new SC_Product_Ex(); |
---|
711 | $arrProduct = $objProduct->getDetailAndProductsClass($product_class_id); |
---|
712 | $arrProduct['quantity'] = 1; |
---|
713 | $arrProduct['price'] = $arrProduct['price02']; |
---|
714 | $arrProduct['product_name'] = $arrProduct['name']; |
---|
715 | |
---|
716 | $arrUpdateKeys = array('product_id', 'product_class_id', |
---|
717 | 'product_type_id', 'point_rate', |
---|
718 | 'product_code', 'product_name', |
---|
719 | 'classcategory_name1', 'classcategory_name2', |
---|
720 | 'quantity', 'price'); |
---|
721 | foreach ($arrUpdateKeys as $key) { |
---|
722 | $arrValues = $objFormParam->getValue($key); |
---|
723 | if (isset($changed_no)) { |
---|
724 | $arrValues[$changed_no] = $arrProduct[$key]; |
---|
725 | } else { |
---|
726 | $arrValues[] = $arrProduct[$key]; |
---|
727 | } |
---|
728 | $objFormParam->setValue($key, $arrValues); |
---|
729 | } |
---|
730 | } elseif (isset($changed_no)) { |
---|
731 | // 変更したが、選択済みの商品だった場合は、変更対象行を削除。 |
---|
732 | $this->doDeleteProduct($changed_no, $objFormParam); |
---|
733 | } |
---|
734 | } |
---|
735 | |
---|
736 | /** |
---|
737 | * 受注商品を削除する. |
---|
738 | * |
---|
739 | * @param integer $delete_no 削除する受注商品の項番 |
---|
740 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
741 | * @return void |
---|
742 | */ |
---|
743 | function doDeleteProduct($delete_no, &$objFormParam) { |
---|
744 | $arrDeleteKeys = array('product_id', 'product_class_id', |
---|
745 | 'product_type_id', 'point_rate', |
---|
746 | 'product_code', 'product_name', |
---|
747 | 'classcategory_name1', 'classcategory_name2', |
---|
748 | 'quantity', 'price'); |
---|
749 | foreach ($arrDeleteKeys as $key) { |
---|
750 | $arrNewValues = array(); |
---|
751 | $arrValues = $objFormParam->getValue($key); |
---|
752 | foreach ($arrValues as $index => $val) { |
---|
753 | if ($index != $delete_no) { |
---|
754 | $arrNewValues[] = $val; |
---|
755 | } |
---|
756 | } |
---|
757 | $objFormParam->setValue($key, $arrNewValues); |
---|
758 | } |
---|
759 | } |
---|
760 | |
---|
761 | /** |
---|
762 | * お届け先を追加する. |
---|
763 | * |
---|
764 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
765 | * @return void |
---|
766 | */ |
---|
767 | function addShipping(&$objFormParam) { |
---|
768 | $objFormParam->setValue('shipping_quantity', |
---|
769 | $objFormParam->getValue('shipping_quantity') + 1); |
---|
770 | $arrShippingIds = $objFormParam->getValue('shipping_id'); |
---|
771 | $arrShippingIds[] = max($arrShippingIds) + 1; |
---|
772 | $objFormParam->setValue('shipping_id', $arrShippingIds); |
---|
773 | } |
---|
774 | |
---|
775 | /** |
---|
776 | * 顧客情報をフォームに設定する. |
---|
777 | * |
---|
778 | * @param integer $customer_id 顧客ID |
---|
779 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
780 | * @return void |
---|
781 | */ |
---|
782 | function setCustomerTo($customer_id, &$objFormParam) { |
---|
783 | $arrCustomer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id); |
---|
784 | foreach ($arrCustomer as $key => $val) { |
---|
785 | $objFormParam->setValue('order_' . $key, $val); |
---|
786 | } |
---|
787 | $objFormParam->setValue('customer_id', $customer_id); |
---|
788 | $objFormParam->setValue('customer_point', $arrCustomer['point']); |
---|
789 | } |
---|
790 | |
---|
791 | /** |
---|
792 | * アンカーキーを取得する. |
---|
793 | * |
---|
794 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
795 | * @return アンカーキーの文字列 |
---|
796 | */ |
---|
797 | function getAnchorKey(&$objFormParam) { |
---|
798 | $ancor_key = $objFormParam->getValue('anchor_key'); |
---|
799 | if (!SC_Utils_Ex::isBlank($ancor_key)) { |
---|
800 | return "location.hash='#" . htmlentities(urlencode($ancor_key), ENT_QUOTES) . "'"; |
---|
801 | } |
---|
802 | return ''; |
---|
803 | } |
---|
804 | } |
---|
805 | ?> |
---|