|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2016-2017 |
|
6
|
|
|
* @package MShop |
|
7
|
|
|
* @subpackage Customer |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
namespace Aimeos\MShop\Customer\Manager\Address; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* ezPublish implementation of the customer address class. |
|
16
|
|
|
* |
|
17
|
|
|
* @package MShop |
|
18
|
|
|
* @subpackage Customer |
|
19
|
|
|
*/ |
|
20
|
|
|
class Ezpublish |
|
21
|
|
|
extends \Aimeos\MShop\Customer\Manager\Address\Standard |
|
22
|
|
|
implements \Aimeos\MShop\Customer\Manager\Address\Iface |
|
23
|
|
|
{ |
|
24
|
|
|
private $searchConfig = array( |
|
|
|
|
|
|
25
|
|
|
'customer.address.id' => array( |
|
26
|
|
|
'label' => 'Customer address ID', |
|
27
|
|
|
'code' => 'customer.address.id', |
|
28
|
|
|
'internalcode' => 'ezuad."id"', |
|
29
|
|
|
'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ), |
|
30
|
|
|
'type' => 'integer', |
|
31
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
32
|
|
|
'public' => false, |
|
33
|
|
|
), |
|
34
|
|
|
// site ID is not available |
|
35
|
|
|
'customer.address.refid' => array( |
|
36
|
|
|
'label' => 'Customer address parent ID', |
|
37
|
|
|
'code' => 'customer.address.parentid', |
|
38
|
|
|
'internalcode' => 'ezuad."parentid"', |
|
39
|
|
|
'type' => 'integer', |
|
40
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
41
|
|
|
'public' => false, |
|
42
|
|
|
), |
|
43
|
|
|
'customer.address.company'=> array( |
|
44
|
|
|
'label' => 'Customer address company', |
|
45
|
|
|
'code' => 'customer.address.company', |
|
46
|
|
|
'internalcode' => 'ezuad."company"', |
|
47
|
|
|
'type' => 'string', |
|
48
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
49
|
|
|
), |
|
50
|
|
|
'customer.address.vatid'=> array( |
|
51
|
|
|
'label' => 'Customer address VAT ID', |
|
52
|
|
|
'code' => 'customer.address.vatid', |
|
53
|
|
|
'internalcode' => 'ezuad."vatid"', |
|
54
|
|
|
'type' => 'string', |
|
55
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
56
|
|
|
), |
|
57
|
|
|
'customer.address.salutation' => array( |
|
58
|
|
|
'label' => 'Customer address salutation', |
|
59
|
|
|
'code' => 'customer.address.salutation', |
|
60
|
|
|
'internalcode' => 'ezuad."salutation"', |
|
61
|
|
|
'type' => 'integer', |
|
62
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
63
|
|
|
), |
|
64
|
|
|
'customer.address.title' => array( |
|
65
|
|
|
'label' => 'Customer address title', |
|
66
|
|
|
'code' => 'customer.address.title', |
|
67
|
|
|
'internalcode' => 'ezuad."title"', |
|
68
|
|
|
'type' => 'string', |
|
69
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
70
|
|
|
), |
|
71
|
|
|
'customer.address.firstname' => array( |
|
72
|
|
|
'label' => 'Customer address firstname', |
|
73
|
|
|
'code' => 'customer.address.firstname', |
|
74
|
|
|
'internalcode' => 'ezuad."firstname"', |
|
75
|
|
|
'type' => 'string', |
|
76
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
77
|
|
|
), |
|
78
|
|
|
'customer.address.lastname' => array( |
|
79
|
|
|
'label' => 'Customer address lastname', |
|
80
|
|
|
'code' => 'customer.address.lastname', |
|
81
|
|
|
'internalcode' => 'ezuad."lastname"', |
|
82
|
|
|
'type' => 'string', |
|
83
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
84
|
|
|
), |
|
85
|
|
|
'customer.address.address1' => array( |
|
86
|
|
|
'label' => 'Customer address address part one', |
|
87
|
|
|
'code' => 'customer.address.address1', |
|
88
|
|
|
'internalcode' => 'ezuad."address1"', |
|
89
|
|
|
'type' => 'string', |
|
90
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
91
|
|
|
), |
|
92
|
|
|
'customer.address.address2' => array( |
|
93
|
|
|
'label' => 'Customer address address part two', |
|
94
|
|
|
'code' => 'customer.address.address2', |
|
95
|
|
|
'internalcode' => 'ezuad."address2"', |
|
96
|
|
|
'type' => 'string', |
|
97
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
98
|
|
|
), |
|
99
|
|
|
'customer.address.address3' => array( |
|
100
|
|
|
'label' => 'Customer address address part three', |
|
101
|
|
|
'code' => 'customer.address.address3', |
|
102
|
|
|
'internalcode' => 'ezuad."address3"', |
|
103
|
|
|
'type' => 'string', |
|
104
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
105
|
|
|
), |
|
106
|
|
|
'customer.address.postal' => array( |
|
107
|
|
|
'label' => 'Customer address postal', |
|
108
|
|
|
'code' => 'customer.address.postal', |
|
109
|
|
|
'internalcode' => 'ezuad."postal"', |
|
110
|
|
|
'type' => 'string', |
|
111
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
112
|
|
|
), |
|
113
|
|
|
'customer.address.city' => array( |
|
114
|
|
|
'label' => 'Customer address city', |
|
115
|
|
|
'code' => 'customer.address.city', |
|
116
|
|
|
'internalcode' => 'ezuad."city"', |
|
117
|
|
|
'type' => 'string', |
|
118
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
119
|
|
|
), |
|
120
|
|
|
'customer.address.state' => array( |
|
121
|
|
|
'label' => 'Customer address state', |
|
122
|
|
|
'code' => 'customer.address.state', |
|
123
|
|
|
'internalcode' => 'ezuad."state"', |
|
124
|
|
|
'type' => 'string', |
|
125
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
126
|
|
|
), |
|
127
|
|
|
'customer.address.languageid' => array( |
|
128
|
|
|
'label' => 'Customer address language', |
|
129
|
|
|
'code' => 'customer.address.languageid', |
|
130
|
|
|
'internalcode' => 'ezuad."langid"', |
|
131
|
|
|
'type' => 'string', |
|
132
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
133
|
|
|
), |
|
134
|
|
|
'customer.address.countryid' => array( |
|
135
|
|
|
'label' => 'Customer address country', |
|
136
|
|
|
'code' => 'customer.address.countryid', |
|
137
|
|
|
'internalcode' => 'ezuad."countryid"', |
|
138
|
|
|
'type' => 'string', |
|
139
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
140
|
|
|
), |
|
141
|
|
|
'customer.address.telephone' => array( |
|
142
|
|
|
'label' => 'Customer address telephone', |
|
143
|
|
|
'code' => 'customer.address.telephone', |
|
144
|
|
|
'internalcode' => 'ezuad."telephone"', |
|
145
|
|
|
'type' => 'string', |
|
146
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
147
|
|
|
), |
|
148
|
|
|
'customer.address.email' => array( |
|
149
|
|
|
'label' => 'Customer address email', |
|
150
|
|
|
'code' => 'customer.address.email', |
|
151
|
|
|
'internalcode' => 'ezuad."email"', |
|
152
|
|
|
'type' => 'string', |
|
153
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
154
|
|
|
), |
|
155
|
|
|
'customer.address.telefax' => array( |
|
156
|
|
|
'label' => 'Customer address telefax', |
|
157
|
|
|
'code' => 'customer.address.telefax', |
|
158
|
|
|
'internalcode' => 'ezuad."telefax"', |
|
159
|
|
|
'type' => 'string', |
|
160
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
161
|
|
|
), |
|
162
|
|
|
'customer.address.website' => array( |
|
163
|
|
|
'label' => 'Customer address website', |
|
164
|
|
|
'code' => 'customer.address.website', |
|
165
|
|
|
'internalcode' => 'ezuad."website"', |
|
166
|
|
|
'type' => 'string', |
|
167
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
168
|
|
|
), |
|
169
|
|
|
'customer.address.flag' => array( |
|
170
|
|
|
'label' => 'Customer address flag', |
|
171
|
|
|
'code' => 'customer.address.flag', |
|
172
|
|
|
'internalcode' => 'ezuad."flag"', |
|
173
|
|
|
'type' => 'integer', |
|
174
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
175
|
|
|
), |
|
176
|
|
|
'customer.address.position' => array( |
|
177
|
|
|
'label' => 'Customer address position', |
|
178
|
|
|
'code' => 'customer.address.position', |
|
179
|
|
|
'internalcode' => 'ezuad."pos"', |
|
180
|
|
|
'type' => 'integer', |
|
181
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
182
|
|
|
), |
|
183
|
|
|
'customer.address.ctime'=> array( |
|
184
|
|
|
'label'=>'Customer address create date/time', |
|
185
|
|
|
'code'=>'customer.address.ctime', |
|
186
|
|
|
'internalcode'=>'ezuad."ctime"', |
|
187
|
|
|
'type'=> 'datetime', |
|
188
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
189
|
|
|
), |
|
190
|
|
|
'customer.address.mtime'=> array( |
|
191
|
|
|
'label'=>'Customer address modification date/time', |
|
192
|
|
|
'code'=>'customer.address.mtime', |
|
193
|
|
|
'internalcode'=>'ezuad."mtime"', |
|
194
|
|
|
'type'=> 'datetime', |
|
195
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
196
|
|
|
), |
|
197
|
|
|
'customer.address.editor'=> array( |
|
198
|
|
|
'label'=>'Customer address editor', |
|
199
|
|
|
'code'=>'customer.address.editor', |
|
200
|
|
|
'internalcode'=>'ezuad."editor"', |
|
201
|
|
|
'type'=> 'string', |
|
202
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
203
|
|
|
), |
|
204
|
|
|
); |
|
205
|
|
|
|
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* Removes old entries from the storage. |
|
209
|
|
|
* |
|
210
|
|
|
* @param array $siteids List of IDs for sites whose entries should be deleted |
|
211
|
|
|
*/ |
|
212
|
|
|
public function cleanup( array $siteids ) |
|
213
|
|
|
{ |
|
214
|
|
|
$path = 'mshop/customer/manager/address/submanagers'; |
|
215
|
|
|
foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
216
|
|
|
$this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
217
|
|
|
} |
|
218
|
|
|
|
|
219
|
|
|
$this->cleanupBase( $siteids, 'mshop/customer/manager/lists/ezpublish/delete' ); |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* Returns the attributes that can be used for searching. |
|
225
|
|
|
* |
|
226
|
|
|
* @param boolean $withsub Return also attributes of sub-managers if true |
|
227
|
|
|
* @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
228
|
|
|
*/ |
|
229
|
|
|
public function getSearchAttributes( $withsub = true ) |
|
230
|
|
|
{ |
|
231
|
|
|
$path = 'mshop/customer/manager/address/submanagers'; |
|
232
|
|
|
|
|
233
|
|
|
return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, [], $withsub ); |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* Returns a new manager for customer extensions |
|
239
|
|
|
* |
|
240
|
|
|
* @param string $manager Name of the sub manager type in lower case |
|
241
|
|
|
* @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
242
|
|
|
* @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
243
|
|
|
*/ |
|
244
|
|
|
public function getSubManager( $manager, $name = null ) |
|
245
|
|
|
{ |
|
246
|
|
|
return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
247
|
|
|
} |
|
248
|
|
|
|
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* Returns the config path for retrieving the configuration values. |
|
252
|
|
|
* |
|
253
|
|
|
* @return string Configuration path (mshop/customer/manager/address/ezpublish/) |
|
254
|
|
|
*/ |
|
255
|
|
|
protected function getConfigPath() |
|
256
|
|
|
{ |
|
257
|
|
|
return 'mshop/customer/manager/address/ezpublish/'; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
|
|
261
|
|
|
/** |
|
262
|
|
|
* Returns the search configuration for searching items. |
|
263
|
|
|
* |
|
264
|
|
|
* @return array Associative list of search keys and search definitions |
|
265
|
|
|
*/ |
|
266
|
|
|
protected function getSearchConfig() |
|
267
|
|
|
{ |
|
268
|
|
|
return $this->searchConfig; |
|
269
|
|
|
} |
|
270
|
|
|
} |
|
271
|
|
|
|