1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Metaways Infosystems GmbH, 2013 |
6
|
|
|
* @copyright Aimeos (aimeos.org), 2014-2018 |
7
|
|
|
* @package MShop |
8
|
|
|
* @subpackage Customer |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
namespace Aimeos\MShop\Customer\Manager\Address; |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* TYPO3 implementation of the customer address class. |
17
|
|
|
* |
18
|
|
|
* @package MShop |
19
|
|
|
* @subpackage Customer |
20
|
|
|
*/ |
21
|
|
|
class Typo3 |
22
|
|
|
extends \Aimeos\MShop\Customer\Manager\Address\Standard |
23
|
|
|
{ |
24
|
|
|
private $searchConfig = array( |
25
|
|
|
'customer.address.id' => array( |
26
|
|
|
'label' => 'Customer address ID', |
27
|
|
|
'code' => 'customer.address.id', |
28
|
|
|
'internalcode' => 't3feuad."id"', |
29
|
|
|
'internaldeps' => array( 'LEFT JOIN "fe_users_address" AS t3feuad ON ( t3feu."uid" = t3feuad."parentid" )' ), |
30
|
|
|
'type' => 'integer', |
31
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
32
|
|
|
'public' => false, |
33
|
|
|
), |
34
|
|
|
// customer.siteid is only for informational purpuse, not for filtering |
35
|
|
|
'customer.address.parentid' => array( |
36
|
|
|
'label' => 'Customer address parent ID', |
37
|
|
|
'code' => 'customer.address.parentid', |
38
|
|
|
'internalcode' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."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' => 't3feuad."website"', |
166
|
|
|
'type' => 'string', |
167
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
168
|
|
|
), |
169
|
|
|
'customer.address.longitude' => array( |
170
|
|
|
'label' => 'Customer address longitude', |
171
|
|
|
'code' => 'customer.address.longitude', |
172
|
|
|
'internalcode' => 't3feuad."longitude"', |
173
|
|
|
'type' => 'float', |
174
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT, |
175
|
|
|
), |
176
|
|
|
'customer.address.latitude' => array( |
177
|
|
|
'label' => 'Customer address latitude', |
178
|
|
|
'code' => 'customer.address.latitude', |
179
|
|
|
'internalcode' => 't3feuad."latitude"', |
180
|
|
|
'type' => 'float', |
181
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_FLOAT, |
182
|
|
|
), |
183
|
|
|
'customer.address.position' => array( |
184
|
|
|
'code' => 'customer.address.position', |
185
|
|
|
'internalcode' => 't3feuad."pos"', |
186
|
|
|
'label' => 'Customer address position', |
187
|
|
|
'type' => 'integer', |
188
|
|
|
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
189
|
|
|
), |
190
|
|
|
'customer.address.ctime'=> array( |
191
|
|
|
'code'=>'customer.address.ctime', |
192
|
|
|
'internalcode'=>'t3feuad."ctime"', |
193
|
|
|
'label'=>'Customer address create date/time', |
194
|
|
|
'type'=> 'datetime', |
195
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
196
|
|
|
), |
197
|
|
|
'customer.address.mtime'=> array( |
198
|
|
|
'code'=>'customer.address.mtime', |
199
|
|
|
'internalcode'=>'t3feuad."mtime"', |
200
|
|
|
'label'=>'Customer address modification date/time', |
201
|
|
|
'type'=> 'datetime', |
202
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
203
|
|
|
), |
204
|
|
|
'customer.address.editor'=> array( |
205
|
|
|
'code'=>'customer.address.editor', |
206
|
|
|
'internalcode'=>'t3feuad."editor"', |
207
|
|
|
'label'=>'Customer address editor', |
208
|
|
|
'type'=> 'string', |
209
|
|
|
'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
210
|
|
|
), |
211
|
|
|
); |
212
|
|
|
|
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* Removes old entries from the storage. |
216
|
|
|
* |
217
|
|
|
* @param array $siteids List of IDs for sites whose entries should be deleted |
218
|
|
|
*/ |
219
|
|
|
public function clear( array $siteids ) |
220
|
|
|
{ |
221
|
|
|
$path = 'mshop/customer/manager/address/submanagers'; |
222
|
|
|
foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
223
|
|
|
$this->getObject()->getSubManager( $domain )->clear( $siteids ); |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
$this->cleanupBase( $siteids, 'mshop/customer/manager/address/typo3/delete' ); |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Returns the list attributes that can be used for searching. |
232
|
|
|
* |
233
|
|
|
* @param boolean $withsub Return also attributes of sub-managers if true |
234
|
|
|
* @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
235
|
|
|
*/ |
236
|
|
|
public function getSearchAttributes( $withsub = true ) |
237
|
|
|
{ |
238
|
|
|
$path = 'mshop/customer/manager/address/submanagers'; |
239
|
|
|
|
240
|
|
|
return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Returns a new manager for customer extensions |
246
|
|
|
* |
247
|
|
|
* @param string $manager Name of the sub manager type in lower case |
248
|
|
|
* @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
249
|
|
|
* @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
250
|
|
|
*/ |
251
|
|
|
public function getSubManager( $manager, $name = null ) |
252
|
|
|
{ |
253
|
|
|
return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Typo3' : $name ) ); |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Returns the config path for retrieving the configuration values. |
259
|
|
|
* |
260
|
|
|
* @return string Configuration path (mshop/customer/manager/address/typo3/item/) |
261
|
|
|
*/ |
262
|
|
|
protected function getConfigPath() |
263
|
|
|
{ |
264
|
|
|
return 'mshop/customer/manager/address/typo3/'; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Returns the search configuration for searching items. |
270
|
|
|
* |
271
|
|
|
* @return array Associative list of search keys and search definitions |
272
|
|
|
*/ |
273
|
|
|
protected function getSearchConfig() |
274
|
|
|
{ |
275
|
|
|
return $this->searchConfig; |
276
|
|
|
} |
277
|
|
|
} |
278
|
|
|
|