1 | <?php |
||
21 | class Typo3 |
||
22 | extends \Aimeos\MShop\Customer\Manager\Standard |
||
23 | { |
||
24 | private $searchConfig = array( |
||
|
|||
25 | 'customer.id' => array( |
||
26 | 'label' => 'Customer ID', |
||
27 | 'code' => 'customer.id', |
||
28 | 'internalcode' => 't3feu."uid"', |
||
29 | 'type' => 'integer', |
||
30 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT |
||
31 | ), |
||
32 | 'customer.label' => array( |
||
33 | 'label' => 'Customer name', |
||
34 | 'code' => 'customer.label', |
||
35 | 'internalcode' => 't3feu."name"', |
||
36 | 'type' => 'string', |
||
37 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR |
||
38 | ), |
||
39 | 'customer.code' => array( |
||
40 | 'label' => 'Customer username', |
||
41 | 'code' => 'customer.code', |
||
42 | 'internalcode' => 't3feu."username"', |
||
43 | 'type' => 'string', |
||
44 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR |
||
45 | ), |
||
46 | 'customer.salutation' => array( |
||
47 | 'label' => 'Customer salutation', |
||
48 | 'code' => 'customer.salutation', |
||
49 | 'internalcode' => 't3feu."gender"', |
||
50 | 'type' => 'string', |
||
51 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
52 | ), |
||
53 | 'customer.company'=> array( |
||
54 | 'label' => 'Customer company', |
||
55 | 'code' => 'customer.company', |
||
56 | 'internalcode' => 't3feu."company"', |
||
57 | 'type' => 'string', |
||
58 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
59 | ), |
||
60 | 'customer.vatid'=> array( |
||
61 | 'label' => 'Customer VAT ID', |
||
62 | 'code' => 'customer.vatid', |
||
63 | 'internalcode' => 't3feu."vatid"', |
||
64 | 'type' => 'string', |
||
65 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
66 | ), |
||
67 | 'customer.title' => array( |
||
68 | 'label' => 'Customer title', |
||
69 | 'code' => 'customer.title', |
||
70 | 'internalcode' => 't3feu."title"', |
||
71 | 'type' => 'string', |
||
72 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
73 | ), |
||
74 | 'customer.firstname' => array( |
||
75 | 'label' => 'Customer firstname', |
||
76 | 'code' => 'customer.firstname', |
||
77 | 'internalcode' => 't3feu."first_name"', |
||
78 | 'type' => 'string', |
||
79 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
80 | ), |
||
81 | 'customer.lastname' => array( |
||
82 | 'label' => 'Customer lastname', |
||
83 | 'code' => 'customer.lastname', |
||
84 | 'internalcode' => 't3feu."last_name"', |
||
85 | 'type' => 'string', |
||
86 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
87 | ), |
||
88 | 'customer.address1' => array( |
||
89 | 'label' => 'Customer address part one', |
||
90 | 'code' => 'customer.address1', |
||
91 | 'internalcode' => 't3feu."address"', |
||
92 | 'type' => 'string', |
||
93 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
94 | ), |
||
95 | 'customer.address2' => array( |
||
96 | 'label' => 'Customer address part two', |
||
97 | 'code' => 'customer.address2', |
||
98 | 'internalcode' => 't3feu."address"', |
||
99 | 'type' => 'string', |
||
100 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
101 | ), |
||
102 | 'customer.address3' => array( |
||
103 | 'label' => 'Customer address part three', |
||
104 | 'code' => 'customer.address3', |
||
105 | 'internalcode' => 't3feu."address"', |
||
106 | 'type' => 'string', |
||
107 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
108 | ), |
||
109 | 'customer.postal' => array( |
||
110 | 'label' => 'Customer postal', |
||
111 | 'code' => 'customer.postal', |
||
112 | 'internalcode' => 't3feu."zip"', |
||
113 | 'type' => 'string', |
||
114 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
115 | ), |
||
116 | 'customer.city' => array( |
||
117 | 'label' => 'Customer city', |
||
118 | 'code' => 'customer.city', |
||
119 | 'internalcode' => 't3feu."city"', |
||
120 | 'type' => 'string', |
||
121 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
122 | ), |
||
123 | 'customer.state' => array( |
||
124 | 'label' => 'Customer state', |
||
125 | 'code' => 'customer.state', |
||
126 | 'internalcode' => 't3feu."zone"', |
||
127 | 'type' => 'string', |
||
128 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
129 | ), |
||
130 | 'customer.languageid' => array( |
||
131 | 'label' => 'Customer language', |
||
132 | 'code' => 'customer.languageid', |
||
133 | 'internalcode' => 't3feu."language"', |
||
134 | 'type' => 'string', |
||
135 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
136 | ), |
||
137 | 'customer.countryid' => array( |
||
138 | 'label' => 'Customer country', |
||
139 | 'code' => 'customer.countryid', |
||
140 | 'internalcode' => 'tsc."cn_iso_2"', |
||
141 | 'type' => 'string', |
||
142 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
143 | ), |
||
144 | 'customer.telephone' => array( |
||
145 | 'label' => 'Customer telephone', |
||
146 | 'code' => 'customer.telephone', |
||
147 | 'internalcode' => 't3feu."telephone"', |
||
148 | 'type' => 'string', |
||
149 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
150 | ), |
||
151 | 'customer.email' => array( |
||
152 | 'label' => 'Customer email', |
||
153 | 'code' => 'customer.email', |
||
154 | 'internalcode' => 't3feu."email"', |
||
155 | 'type' => 'string', |
||
156 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
157 | ), |
||
158 | 'customer.telefax' => array( |
||
159 | 'label' => 'Customer telefax', |
||
160 | 'code' => 'customer.telefax', |
||
161 | 'internalcode' => 't3feu."fax"', |
||
162 | 'type' => 'string', |
||
163 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
164 | ), |
||
165 | 'customer.website' => array( |
||
166 | 'label' => 'Customer website', |
||
167 | 'code' => 'customer.website', |
||
168 | 'internalcode' => 't3feu."www"', |
||
169 | 'type' => 'string', |
||
170 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
171 | ), |
||
172 | 'customer.birthday' => array( |
||
173 | 'label' => 'Customer birthday', |
||
174 | 'code' => 'customer.birthday', |
||
175 | 'internalcode' => 't3feu."date_of_birth"', |
||
176 | 'type' => 'string', |
||
177 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
178 | ), |
||
179 | 'customer.password'=> array( |
||
180 | 'label' => 'Customer password', |
||
181 | 'code' => 'customer.password', |
||
182 | 'internalcode' => 't3feu."password"', |
||
183 | 'type' => 'string', |
||
184 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
185 | ), |
||
186 | 'customer.status'=> array( |
||
187 | 'label' => 'Customer status', |
||
188 | 'code' => 'customer.status', |
||
189 | 'internalcode' => 't3feu."disable"', |
||
190 | 'type' => 'integer', |
||
191 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT |
||
192 | ), |
||
193 | 'customer.dateverified'=> array( |
||
194 | 'label' => 'Customer verification date', |
||
195 | 'code' => 'customer.dateverified', |
||
196 | 'internalcode' => 't3feu."vdate"', |
||
197 | 'type' => 'date', |
||
198 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
199 | ), |
||
200 | 'customer.ctime'=> array( |
||
201 | 'label' => 'Customer creation time', |
||
202 | 'code' => 'customer.ctime', |
||
203 | 'internalcode' => 't3feu."crdate"', |
||
204 | 'type' => 'datetime', |
||
205 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
206 | ), |
||
207 | 'customer.mtime'=> array( |
||
208 | 'label' => 'Customer modification time', |
||
209 | 'code' => 'customer.mtime', |
||
210 | 'internalcode' => 't3feu."tstamp"', |
||
211 | 'type' => 'datetime', |
||
212 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
213 | ), |
||
214 | // not available |
||
215 | 'customer.editor'=> array( |
||
216 | 'label'=>'Customer editor', |
||
217 | 'code'=>'customer.editor', |
||
218 | 'internalcode'=>'1', |
||
219 | 'type'=> 'string', |
||
220 | 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
221 | ), |
||
222 | ); |
||
223 | |||
224 | private $plugins = array(); |
||
225 | private $reverse = array(); |
||
226 | private $helper; |
||
227 | private $pid; |
||
228 | |||
229 | |||
230 | |||
231 | /** |
||
232 | * Initializes a new customer manager object using the given context object. |
||
233 | * |
||
234 | * @param \Aimeos\MShop\Context\Iface $context Context object with required objects |
||
235 | */ |
||
236 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
||
255 | |||
256 | |||
257 | /** |
||
258 | * Returns the list attributes that can be used for searching. |
||
259 | * |
||
260 | * @param boolean $withsub Return also attributes of sub-managers if true |
||
261 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
||
262 | */ |
||
263 | public function getSearchAttributes( $withsub = true ) |
||
264 | { |
||
265 | $path = 'mshop/customer/manager/submanagers'; |
||
266 | |||
267 | return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
||
268 | } |
||
269 | |||
270 | |||
271 | /** |
||
272 | * Removes old entries from the storage. |
||
273 | * |
||
274 | * @param array $siteids List of IDs for sites whose entries should be deleted |
||
275 | */ |
||
276 | public function cleanup( array $siteids ) |
||
277 | { |
||
278 | $path = 'mshop/customer/manager/submanagers'; |
||
279 | foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
||
280 | $this->getSubManager( $domain )->cleanup( $siteids ); |
||
281 | } |
||
282 | } |
||
283 | |||
284 | |||
285 | /** |
||
286 | * Instantiates a new customer item object. |
||
287 | * |
||
288 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item object |
||
289 | */ |
||
290 | public function createItem() |
||
291 | { |
||
292 | return $this->createItemBase(); |
||
293 | } |
||
294 | |||
295 | |||
296 | /** |
||
297 | * Deletes a customer item object from the permanent storage. |
||
298 | * |
||
299 | * @param array $ids List of customer IDs |
||
300 | */ |
||
301 | public function deleteItems( array $ids ) |
||
306 | |||
307 | |||
308 | /** |
||
309 | * Saves a customer item object. |
||
310 | * |
||
311 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
||
312 | * @param boolean $fetch True if the new ID should be returned in the item |
||
313 | */ |
||
314 | public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
||
488 | |||
489 | |||
490 | /** |
||
491 | * Returns the item objects matched by the given search criteria. |
||
492 | * |
||
493 | * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
||
494 | * @param integer &$total Number of items that are available in total |
||
495 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
||
496 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
||
497 | */ |
||
498 | public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
||
527 | |||
528 | |||
529 | /** |
||
530 | * Returns a new manager for customer extensions |
||
531 | * |
||
532 | * @param string $manager Name of the sub manager type in lower case |
||
533 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
||
534 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
||
535 | */ |
||
536 | public function getSubManager( $manager, $name = null ) |
||
537 | { |
||
538 | return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Typo3' : $name ) ); |
||
539 | } |
||
540 | |||
541 | |||
542 | /** |
||
543 | * Creates a new customer item. |
||
544 | * |
||
545 | * @param array $values List of attributes for customer item |
||
546 | * @param array $listItems List items associated to the customer item |
||
547 | * @param array $refItems Items referenced by the customer item via the list items |
||
548 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
||
549 | */ |
||
550 | protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
||
582 | |||
583 | |||
584 | /** |
||
585 | * Returns the address sub-manager. |
||
586 | * |
||
587 | * @return \Aimeos\MShop\Common\Manager\Iface Customer address manager |
||
588 | */ |
||
589 | protected function getAddressManager() |
||
590 | { |
||
591 | if( !isset( $this->addressManager ) ) { |
||
592 | $this->addressManager = $this->getSubManager( 'address' ); |
||
593 | } |
||
594 | |||
595 | return $this->addressManager; |
||
596 | } |
||
597 | |||
598 | |||
599 | /** |
||
600 | * Returns a password helper object based on the configuration. |
||
601 | * |
||
602 | * @return \Aimeos\MShop\Common\Item\Helper\Password\Iface Password helper object |
||
603 | * @throws \Aimeos\MShop\Exception If the name is invalid or the class isn't found |
||
604 | */ |
||
605 | protected function getPasswordHelper() |
||
631 | } |