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; |
26
|
|
|
|
27
|
|
|
use Symfony\Component\Form\AbstractType; |
28
|
|
|
use Symfony\Component\Form\Extension\Core\Type; |
29
|
|
|
use Symfony\Component\Form\FormBuilderInterface; |
30
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
31
|
|
|
|
32
|
|
|
// deprecated 3.1で削除予定 |
33
|
|
|
class CustomerType extends AbstractType |
34
|
|
|
{ |
35
|
|
|
public $app; |
36
|
|
|
|
37
|
663 |
|
public function __construct(\Silex\Application $app) |
38
|
|
|
{ |
39
|
663 |
|
$this->app = $app; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* {@inheritdoc} |
44
|
|
|
*/ |
45
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options) |
46
|
|
|
{ |
47
|
|
|
$app = $this->app; |
48
|
|
|
|
49
|
|
|
$builder |
50
|
|
|
->add('name', 'name', array( |
51
|
|
|
'options' => array( |
52
|
|
|
'attr' => array( |
53
|
|
|
'maxlength' => $app['config']['stext_len'], |
54
|
|
|
), |
55
|
|
|
'constraints' => array( |
56
|
|
|
new Assert\NotBlank(), |
57
|
|
|
new Assert\Length(array('max' => $app['config']['stext_len'])), |
58
|
|
|
), |
59
|
|
|
), |
60
|
|
|
)) |
61
|
|
|
->add('kana', 'name', array( |
62
|
|
|
'options' => array( |
63
|
|
|
'attr' => array( |
64
|
|
|
'maxlength' => $app['config']['stext_len'], |
65
|
|
|
), |
66
|
|
|
'constraints' => array( |
67
|
|
|
new Assert\NotBlank(), |
68
|
|
|
new Assert\Length(array('max' => $app['config']['stext_len'])), |
69
|
|
|
new Assert\Regex(array( |
70
|
|
|
'pattern' => "/^[ァ-ヶヲ-゚ー]+$/u", |
71
|
|
|
)), |
72
|
|
|
), |
73
|
|
|
), |
74
|
|
|
)) |
75
|
|
|
->add('company_name', 'text', array( |
76
|
|
|
'required' => false, |
77
|
|
|
'constraints' => array( |
|
|
|
|
78
|
|
|
new Assert\Length(array( |
79
|
|
|
'max' => $app['config']['stext_len'], |
80
|
|
|
)) |
81
|
|
|
), |
82
|
|
|
)) |
83
|
|
|
->add('zip', 'zip', array( |
84
|
|
|
'required' => false, |
85
|
|
|
)) |
86
|
|
|
->add('address', 'address', array( |
87
|
|
|
'help' => 'form.contact.address.help', |
88
|
|
|
'required' => false, |
89
|
|
|
)) |
90
|
|
|
->add('tel', 'tel', array( |
91
|
|
|
'required' => false, |
92
|
|
|
)) |
93
|
|
|
->add('fax', 'tel', array( |
94
|
|
|
'required' => false, |
95
|
|
|
)) |
96
|
|
|
->add('email', 'email', array( |
|
|
|
|
97
|
|
|
'constraints' => array( |
98
|
|
|
new Assert\NotBlank(), |
99
|
|
|
new Assert\Email(array('strict' => true)), |
100
|
|
|
) |
101
|
|
|
)) |
102
|
|
|
->add('sex', 'sex', array( |
103
|
|
|
'required' => false, |
104
|
|
|
)) |
105
|
|
|
->add('job', 'job', array( |
106
|
|
|
'required' => false, |
107
|
|
|
)) |
108
|
|
|
->add('birth', 'birthday', array( |
109
|
|
|
'required' => false, |
110
|
|
|
'input' => 'datetime', |
111
|
|
|
'years' => range(date('Y'), date('Y') - $this->config['birth_max']), |
112
|
|
|
'widget' => 'choice', |
113
|
|
|
'format' => 'yyyy-MM-dd', |
114
|
|
|
'empty_value' => array('year' => '----', 'month' => '--', 'day' => '--'), |
115
|
|
|
'constraints' => array( |
116
|
|
|
new Assert\LessThanOrEqual(array( |
117
|
|
|
'value' => date('Y-m-d'), |
118
|
|
|
'message' => 'form.type.select.selectisfuturedate', |
119
|
|
|
)), |
120
|
|
|
), |
121
|
|
|
)) |
122
|
|
|
->add('password', 'repeated') |
123
|
|
|
->add('status', 'customer_status', array( |
124
|
|
|
'required' => false, |
125
|
|
|
)) |
126
|
|
|
->add('note', 'textarea', array( |
127
|
|
|
'required' => false, |
128
|
|
|
)) |
129
|
|
|
->add('save', 'submit', array('label' => 'この内容で登録する')); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* {@inheritdoc} |
134
|
|
|
*/ |
135
|
663 |
|
public function getName() |
136
|
|
|
{ |
137
|
663 |
|
return 'customer'; |
138
|
|
|
} |
139
|
|
|
} |
140
|
|
|
|