1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of EC-CUBE |
4
|
|
|
* |
5
|
|
|
* Copyright(c) 2000-2015 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
|
|
|
|
25
|
|
|
namespace Eccube\Form\Type\Admin; |
26
|
|
|
|
27
|
|
|
use Symfony\Component\Form\AbstractType; |
28
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
29
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
30
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
31
|
|
|
|
32
|
|
|
class ShopMasterType extends AbstractType |
|
|
|
|
33
|
|
|
{ |
34
|
663 |
|
public function __construct($config) |
|
|
|
|
35
|
|
|
{ |
36
|
663 |
|
$this->config = $config; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* {@inheritdoc} |
41
|
|
|
*/ |
42
|
4 |
|
public function buildForm(FormBuilderInterface $builder, array $options) |
43
|
|
|
{ |
44
|
4 |
|
$config = $this->config; |
45
|
|
|
|
46
|
|
|
$builder |
47
|
4 |
|
->add('company_name', 'text', array( |
|
|
|
|
48
|
4 |
|
'label' => '会社名', |
49
|
|
|
'required' => false, |
50
|
|
|
'constraints' => array( |
51
|
4 |
|
new Assert\Length(array( |
52
|
4 |
|
'max' => $config['stext_len'], |
53
|
|
|
)), |
54
|
|
|
) |
55
|
|
|
)) |
56
|
4 |
|
->add('shop_name', 'text', array( |
|
|
|
|
57
|
4 |
|
'label' => '店名', |
58
|
|
|
'required' => true, |
59
|
|
|
'constraints' => array( |
60
|
4 |
|
new Assert\NotBlank(), |
61
|
4 |
|
new Assert\Length(array( |
62
|
4 |
|
'max' => $config['stext_len'], |
63
|
|
|
)), |
64
|
|
|
) |
65
|
|
|
)) |
66
|
4 |
|
->add('shop_name_eng', 'text', array( |
|
|
|
|
67
|
4 |
|
'label' => '店名(英語表記)', |
68
|
|
|
'required' => false, |
69
|
|
|
'constraints' => array( |
70
|
4 |
|
new Assert\Length(array( |
71
|
4 |
|
'max' => $config['mtext_len'], |
72
|
|
|
)), |
73
|
4 |
|
new Assert\Regex(array( |
|
|
|
|
74
|
|
|
'pattern' => '/^[[:graph:][:space:]]+$/i' |
75
|
4 |
|
)), |
76
|
|
|
) |
77
|
|
|
)) |
78
|
4 |
|
->add('zip', 'zip', array( |
79
|
4 |
|
'required' => false, |
80
|
|
|
)) |
81
|
4 |
|
->add('address', 'address', array( |
82
|
4 |
|
'required' => false, |
83
|
|
|
)) |
84
|
4 |
|
->add('tel', 'tel', array( |
85
|
4 |
|
'required' => false, |
86
|
|
|
)) |
87
|
4 |
|
->add('fax', 'tel', array( |
88
|
4 |
|
'required' => false, |
89
|
|
|
)) |
90
|
4 |
|
->add('business_hour', 'text', array( |
|
|
|
|
91
|
4 |
|
'label' => '店舗営業時間', |
92
|
|
|
'required' => false, |
93
|
|
|
'constraints' => array( |
|
|
|
|
94
|
4 |
|
new Assert\Length(array( |
95
|
4 |
|
'max' => $config['stext_len'], |
96
|
|
|
)) |
97
|
|
|
) |
98
|
|
|
)) |
99
|
4 |
|
->add('email01', 'email', array( |
100
|
4 |
|
'label' => '送信元メールアドレス(From)', |
101
|
|
|
'required' => false, |
102
|
|
|
'constraints' => array( |
103
|
4 |
|
new Assert\NotBlank(), |
104
|
4 |
|
new Assert\Email(array('strict' => true)), |
105
|
|
|
), |
106
|
|
|
)) |
107
|
4 |
|
->add('email02', 'email', array( |
108
|
4 |
|
'label' => '問い合わせ受付メールアドレス(From, ReplyTo)', |
109
|
|
|
'required' => false, |
110
|
|
|
'constraints' => array( |
111
|
4 |
|
new Assert\NotBlank(), |
112
|
4 |
|
new Assert\Email(array('strict' => true)), |
113
|
|
|
), |
114
|
|
|
)) |
115
|
4 |
|
->add('email03', 'email', array( |
116
|
4 |
|
'label' => '返信受付メールアドレス(ReplyTo)', |
117
|
|
|
'required' => false, |
118
|
|
|
'constraints' => array( |
119
|
4 |
|
new Assert\NotBlank(), |
120
|
4 |
|
new Assert\Email(array('strict' => true)), |
121
|
|
|
), |
122
|
|
|
)) |
123
|
4 |
|
->add('email04', 'email', array( |
124
|
4 |
|
'label' => '送信エラー受付メールアドレス(ReturnPath)', |
125
|
|
|
'required' => false, |
126
|
|
|
'constraints' => array( |
127
|
4 |
|
new Assert\NotBlank(), |
128
|
4 |
|
new Assert\Email(array('strict' => true)), |
129
|
|
|
), |
130
|
|
|
)) |
131
|
4 |
|
->add('good_traded', 'textarea', array( |
132
|
4 |
|
'label' => '取り扱い商品', |
133
|
|
|
'required' => false, |
134
|
|
|
'constraints' => array( |
135
|
4 |
|
new Assert\Length(array( |
136
|
4 |
|
'max' => $config['lltext_len'], |
137
|
|
|
)), |
138
|
|
|
), |
139
|
|
|
)) |
140
|
4 |
|
->add('message', 'textarea', array( |
141
|
4 |
|
'label' => 'メッセージ', |
142
|
|
|
'required' => false, |
143
|
|
|
'constraints' => array( |
144
|
4 |
|
new Assert\Length(array( |
145
|
4 |
|
'max' => $config['lltext_len'], |
146
|
|
|
)), |
147
|
|
|
), |
148
|
|
|
)) |
149
|
|
|
|
150
|
|
|
// 送料設定 |
151
|
4 |
|
->add('delivery_free_amount', 'money', array( |
152
|
4 |
|
'label' => '送料無料条件(金額)', |
153
|
|
|
'required' => false, |
154
|
4 |
|
'currency' => 'JPY', |
155
|
4 |
|
'precision' => 0, |
156
|
4 |
|
'scale' => 0, |
157
|
|
|
'grouping' => true, |
158
|
|
|
'constraints' => array( |
159
|
4 |
|
new Assert\Length(array( |
160
|
4 |
|
'max' => $config['price_len'], |
161
|
|
|
)), |
162
|
4 |
|
new Assert\Regex(array( |
|
|
|
|
163
|
4 |
|
'pattern' => "/^\d+$/u", |
164
|
|
|
'message' => 'form.type.numeric.invalid' |
165
|
|
|
)), |
166
|
|
|
), |
167
|
|
|
)) |
168
|
4 |
|
->add('delivery_free_quantity', 'integer', array( |
169
|
4 |
|
'label' => '送料無料条件(数量)', |
170
|
|
|
'required' => false, |
171
|
|
|
'constraints' => array( |
172
|
4 |
|
new Assert\Regex(array( |
|
|
|
|
173
|
4 |
|
'pattern' => "/^\d+$/u", |
174
|
|
|
'message' => 'form.type.numeric.invalid' |
175
|
|
|
)), |
176
|
|
|
), |
177
|
|
|
)) |
178
|
4 |
|
->add('option_product_delivery_fee', 'choice', array( |
179
|
4 |
|
'label' => '商品ごとの送料設定を有効にする', |
180
|
|
|
'choices' => array( |
181
|
|
|
'0' => '無効', |
182
|
|
|
'1' => '有効', |
183
|
|
|
), |
184
|
|
|
'expanded' => true, |
185
|
|
|
'multiple' => false, |
186
|
|
|
)) |
187
|
4 |
|
->add('option_multiple_shipping', 'choice', array( |
188
|
4 |
|
'label' => '複数配送を有効にする', |
189
|
|
|
'choices' => array( |
190
|
|
|
'0' => '無効', |
191
|
|
|
'1' => '有効', |
192
|
|
|
), |
193
|
|
|
'expanded' => true, |
194
|
|
|
'multiple' => false, |
195
|
|
|
)) |
196
|
|
|
|
197
|
|
|
// 会員設定 |
198
|
4 |
|
->add('option_customer_activate', 'choice', array( |
199
|
4 |
|
'label' => '仮会員を有効にする', |
200
|
|
|
'choices' => array( |
201
|
|
|
'0' => '無効', |
202
|
|
|
'1' => '有効', |
203
|
|
|
), |
204
|
|
|
'expanded' => true, |
205
|
|
|
'multiple' => false, |
206
|
|
|
)) |
207
|
4 |
|
->add('option_mypage_order_status_display', 'choice', array( |
208
|
4 |
|
'label' => 'マイページに注文状況を表示する', |
209
|
|
|
'choices' => array( |
210
|
|
|
'0' => '無効', |
211
|
|
|
'1' => '有効', |
212
|
|
|
), |
213
|
|
|
'expanded' => true, |
214
|
|
|
'multiple' => false, |
215
|
|
|
)) |
216
|
4 |
|
->add('option_remember_me', 'choice', array( |
217
|
4 |
|
'label' => '自動ログイン機能を有効にする', |
218
|
|
|
'choices' => array( |
219
|
|
|
'0' => '無効', |
220
|
|
|
'1' => '有効', |
221
|
|
|
), |
222
|
|
|
'expanded' => true, |
223
|
|
|
'multiple' => false, |
224
|
|
|
)) |
225
|
4 |
|
->add('option_favorite_product', 'choice', array( |
226
|
4 |
|
'label' => 'お気に入り商品機能を利用する', |
227
|
|
|
'choices' => array( |
228
|
|
|
'0' => '無効', |
229
|
|
|
'1' => '有効', |
230
|
|
|
), |
231
|
|
|
'expanded' => true, |
232
|
|
|
'multiple' => false, |
233
|
|
|
)) |
234
|
|
|
|
235
|
|
|
// 商品設定 |
236
|
4 |
|
->add('nostock_hidden', 'choice', array( |
237
|
4 |
|
'label' => '在庫切れ商品を非表示にする', |
238
|
|
|
'choices' => array( |
239
|
|
|
'0' => '無効', |
240
|
|
|
'1' => '有効', |
241
|
|
|
), |
242
|
|
|
'expanded' => true, |
243
|
|
|
'multiple' => false, |
244
|
|
|
)) |
245
|
|
|
|
246
|
|
|
// 地図設定 |
247
|
4 |
|
->add('latitude', 'number', array( |
|
|
|
|
248
|
4 |
|
'label' => '緯度', |
249
|
|
|
'required' => false, |
250
|
4 |
|
'precision' => 6, |
251
|
|
|
'constraints' => array( |
|
|
|
|
252
|
4 |
|
new Assert\Regex(array( |
|
|
|
|
253
|
4 |
|
'pattern' => '/^-?([0-8]?[0-9]\.?[0-9]{0,6}|90\.?0{0,6})$/', |
254
|
|
|
'message' => 'admin.shop.latitude.invalid')) |
|
|
|
|
255
|
|
|
) |
256
|
|
|
)) |
257
|
4 |
|
->add('longitude', 'number', array( |
258
|
4 |
|
'label' => '経度', |
259
|
|
|
'required' => false, |
260
|
4 |
|
'precision' => 6, |
261
|
|
|
'constraints' => array( |
|
|
|
|
262
|
4 |
|
new Assert\Regex(array( |
|
|
|
|
263
|
4 |
|
'pattern' => '/^-?((1?[0-7]?|[0-9]?)[0-9]\.?[0-9]{0,6}|180\.?0{0,6})$/', |
264
|
|
|
'message' => 'admin.shop.longitude.invalid')) |
|
|
|
|
265
|
|
|
), |
266
|
|
|
)) |
267
|
|
|
; |
268
|
|
|
|
269
|
4 |
|
$builder->add( |
270
|
|
|
$builder |
271
|
4 |
|
->create('company_kana', 'text', array( |
272
|
4 |
|
'label' => '会社名(フリガナ)', |
273
|
|
|
'required' => false, |
274
|
|
|
'constraints' => array( |
275
|
4 |
|
new Assert\Regex(array( |
276
|
4 |
|
'pattern' => "/^[ァ-ヶヲ-゚ー]+$/u", |
277
|
|
|
)), |
278
|
4 |
|
new Assert\Length(array( |
279
|
4 |
|
'max' => $config['stext_len'], |
280
|
|
|
)), |
281
|
|
|
), |
282
|
|
|
)) |
283
|
4 |
|
->addEventSubscriber(new \Eccube\EventListener\ConvertKanaListener('CV')) |
284
|
|
|
); |
285
|
|
|
|
286
|
4 |
|
$builder->add( |
287
|
|
|
$builder |
288
|
4 |
|
->create('shop_kana', 'text', array( |
|
|
|
|
289
|
4 |
|
'label' => '店名(フリガナ)', |
290
|
|
|
'required' => false, |
291
|
|
|
'constraints' => array( |
292
|
4 |
|
new Assert\Length(array( |
293
|
4 |
|
'max' => $config['stext_len'], |
294
|
|
|
)), |
295
|
4 |
|
new Assert\Regex(array( |
296
|
4 |
|
'pattern' => "/^[ァ-ヶヲ-゚ー]+$/u", |
297
|
|
|
)), |
298
|
|
|
) |
299
|
|
|
)) |
300
|
4 |
|
->addEventSubscriber(new \Eccube\EventListener\ConvertKanaListener('CV')) |
301
|
|
|
); |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
/** |
305
|
|
|
* {@inheritdoc} |
306
|
|
|
*/ |
307
|
4 |
|
public function setDefaultOptions(OptionsResolverInterface $resolver) |
308
|
|
|
{ |
309
|
4 |
|
$resolver->setDefaults(array( |
310
|
4 |
|
'data_class' => 'Eccube\Entity\BaseInfo', |
311
|
|
|
)); |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* {@inheritdoc} |
316
|
|
|
*/ |
317
|
663 |
|
public function getName() |
318
|
|
|
{ |
319
|
663 |
|
return 'shop_master'; |
320
|
|
|
} |
321
|
|
|
} |
322
|
|
|
|