| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @copyright Aimeos (aimeos.org), 2016-2018 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @package MShop | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @subpackage Customer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | namespace Aimeos\MShop\Customer\Manager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * Customer class implementation for ezPublish | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @package MShop | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @subpackage Customer | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 19 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  | class Ezpublish | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  | 	extends \Aimeos\MShop\Customer\Manager\Standard | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  | 	private $searchConfig = array( | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  | 		'customer.id' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  | 			'label' => 'Customer ID', | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  | 			'code' => 'customer.id', | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  | 			'internalcode' => 'ezu."contentobject_id"', | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  | 			'type' => 'integer', | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  | 			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  | 		), | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  | 		// customer.siteid is not available | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  | 		'customer.label' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  | 			'label' => 'Customer label', | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  | 			'code' => 'customer.label', | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  | 			'internalcode' => 'ezu."login"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."login_normalized"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."salutation"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."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' => 'ezu."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' => 'ezu."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' => 'ezu."firstname"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."lastname"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."address1"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."address2"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."address3"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."postal"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."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' => 'ezu."state"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."langid"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."countryid"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."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' => 'ezu."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' => 'ezu."telefax"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."website"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."birthday"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."password_hash"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezs."is_enabled"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."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' => 'ezu."ctime"', | 
            
                                                                        
                            
            
                                    
            
            
                | 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' => 'ezu."mtime"', | 
            
                                                                        
                            
            
                                    
            
            
                | 211 |  |  | 			'type' => 'datetime', | 
            
                                                                        
                            
            
                                    
            
            
                | 212 |  |  | 			'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, | 
            
                                                                        
                            
            
                                    
            
            
                | 213 |  |  | 		), | 
            
                                                                        
                            
            
                                    
            
            
                | 214 |  |  | 		'customer.editor'=> array( | 
            
                                                                        
                            
            
                                    
            
            
                | 215 |  |  | 			'label'=>'Customer editor', | 
            
                                                                        
                            
            
                                    
            
            
                | 216 |  |  | 			'code'=>'customer.editor', | 
            
                                                                        
                            
            
                                    
            
            
                | 217 |  |  | 			'internalcode' => 'ezu."editor"', | 
            
                                                                        
                            
            
                                    
            
            
                | 218 |  |  | 			'type'=> 'string', | 
            
                                                                        
                            
            
                                    
            
            
                | 219 |  |  | 			'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, | 
            
                                                                        
                            
            
                                    
            
            
                | 220 |  |  | 		), | 
            
                                                                        
                            
            
                                    
            
            
                | 221 |  |  | 		'customer:has' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 222 |  |  | 			'code' => 'customer:has()', | 
            
                                                                        
                            
            
                                    
            
            
                | 223 |  |  | 			'internalcode' => '( | 
            
                                                                        
                            
            
                                    
            
            
                | 224 |  |  | 				SELECT ezuli_has."id" FROM ezuser_list AS ezuli_has | 
            
                                                                        
                            
            
                                    
            
            
                | 225 |  |  | 				WHERE ezu."id" = ezuli_has."parentid" AND :site AND :key LIMIT 1 | 
            
                                                                        
                            
            
                                    
            
            
                | 226 |  |  | 			)', | 
            
                                                                        
                            
            
                                    
            
            
                | 227 |  |  | 			'label' => 'Customer has list item, parameter(<domain>[,<list type>[,<reference ID>)]]', | 
            
                                                                        
                            
            
                                    
            
            
                | 228 |  |  | 			'type' => 'null', | 
            
                                                                        
                            
            
                                    
            
            
                | 229 |  |  | 			'internaltype' => 'null', | 
            
                                                                        
                            
            
                                    
            
            
                | 230 |  |  | 			'public' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 231 |  |  | 		), | 
            
                                                                        
                            
            
                                    
            
            
                | 232 |  |  | 		'customer:prop' => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 233 |  |  | 			'code' => 'customer:prop()', | 
            
                                                                        
                            
            
                                    
            
            
                | 234 |  |  | 			'internalcode' => '( | 
            
                                                                        
                            
            
                                    
            
            
                | 235 |  |  | 				SELECT ezupr_prop."id" FROM ezuser_property AS ezupr_prop | 
            
                                                                        
                            
            
                                    
            
            
                | 236 |  |  | 				WHERE ezu."id" = ezupr_prop."parentid" AND :site AND :key LIMIT 1 | 
            
                                                                        
                            
            
                                    
            
            
                | 237 |  |  | 			)', | 
            
                                                                        
                            
            
                                    
            
            
                | 238 |  |  | 			'label' => 'Customer has property item, parameter(<property type>[,<language code>[,<property value>]])', | 
            
                                                                        
                            
            
                                    
            
            
                | 239 |  |  | 			'type' => 'null', | 
            
                                                                        
                            
            
                                    
            
            
                | 240 |  |  | 			'internaltype' => 'null', | 
            
                                                                        
                            
            
                                    
            
            
                | 241 |  |  | 			'public' => false, | 
            
                                                                        
                            
            
                                    
            
            
                | 242 |  |  | 		), | 
            
                                                                        
                            
            
                                    
            
            
                | 243 |  |  | 	); | 
            
                                                                        
                            
            
                                    
            
            
                | 244 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 246 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 247 |  |  | 	 * Initializes the object. | 
            
                                                                        
                            
            
                                    
            
            
                | 248 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 249 |  |  | 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object | 
            
                                                                        
                            
            
                                    
            
            
                | 250 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  | 	public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  | 		parent::__construct( $context ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 		$locale = $context->getLocale(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  | 		$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  | 		$level = $context->getConfig()->get( 'mshop/customer/manager/sitemode', $level ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  | 		$siteIds = [$locale->getSiteId()]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  | 		if( $level & \Aimeos\MShop\Locale\Manager\Base::SITE_PATH ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  | 			$siteIds = array_merge( $siteIds, $locale->getSitePath() ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  | 		if( $level & \Aimeos\MShop\Locale\Manager\Base::SITE_SUBTREE ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  | 			$siteIds = array_merge( $siteIds, $locale->getSiteSubTree() ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  | 		$this->searchConfig['customer:has']['function'] = function( &$source, array $params ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | 			foreach( $params as $key => $param ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  | 				$params[$key] = trim( $param, '\'' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | 			$source = str_replace( ':site', $self->toExpression( 'ezuli_has."siteid"', $siteIds ), $source ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  | 			$str = $self->toExpression( 'ezuli_has."key"', join( '|', $params ), isset( $params[2] ) ? '==' : '=~' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  | 			$source = str_replace( ':key', $str, $source ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  | 			return $params; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  | 		}; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  | 		$this->searchConfig['customer:prop']['function'] = function( &$source, array $params ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  | 			foreach( $params as $key => $param ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  | 				$params[$key] = trim( $param, '\'' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  | 			$params[2] = ( isset( $params[2] ) ? md5( $params[2] ) : null ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  | 			$source = str_replace( ':site', $self->toExpression( 'ezupr_prop."siteid"', $siteIds ), $source ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  | 			$str = $self->toExpression( 'ezupr_prop."key"', join( '|', $params ), isset( $params[2] ) ? '==' : '=~' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  | 			$source = str_replace( ':key', $str, $source ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 295 |  |  | 			return $params; | 
            
                                                                        
                            
            
                                    
            
            
                | 296 |  |  | 		}; | 
            
                                                                        
                            
            
                                    
            
            
                | 297 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 298 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 299 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 300 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 301 |  |  | 	 * Removes old entries from the storage. | 
            
                                                                        
                            
            
                                    
            
            
                | 302 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 303 |  |  | 	 * @param array $siteids List of IDs for sites whose entries should be deleted | 
            
                                                                        
                            
            
                                    
            
            
                | 304 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 305 |  |  | 	public function clear( array $siteids ) | 
            
                                                                        
                            
            
                                    
            
            
                | 306 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 307 |  |  | 		$path = 'mshop/customer/manager/submanagers'; | 
            
                                                                        
                            
            
                                    
            
            
                | 308 |  |  | 		foreach( $this->getContext()->getConfig()->get( $path, ['address', 'group', 'lists', 'property'] ) as $domain ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 309 |  |  | 			$this->getObject()->getSubManager( $domain )->clear( $siteids ); | 
            
                                                                        
                            
            
                                    
            
            
                | 310 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 311 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 312 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 313 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 314 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 315 |  |  | 	 * Removes multiple items specified by ids in the array. | 
            
                                                                        
                            
            
                                    
            
            
                | 316 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 317 |  |  | 	 * @param array $ids List of IDs | 
            
                                                                        
                            
            
                                    
            
            
                | 318 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 319 |  |  | 	public function deleteItems( array $ids ) | 
            
                                                                        
                            
            
                                    
            
            
                | 320 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 321 |  |  | 		$service = $this->getContext()->getEzUserService(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 322 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 323 |  |  | 		foreach( $ids as $id ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 324 |  |  | 			$service->deleteUser( $service->loadUser( $id ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 325 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 326 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 328 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 329 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 330 |  |  | 	 * Returns the list attributes that can be used for searching. | 
            
                                                                        
                            
            
                                    
            
            
                | 331 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 332 |  |  | 	 * @param boolean $withsub Return also attributes of sub-managers if true | 
            
                                                                        
                            
            
                                    
            
            
                | 333 |  |  | 	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface | 
            
                                                                        
                            
            
                                    
            
            
                | 334 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  | 	public function getSearchAttributes( $withsub = true ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  | 		$path = 'mshop/customer/manager/submanagers'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 339 |  |  | 		return $this->getSearchAttributesBase( $this->searchConfig, $path, ['address', 'group', 'lists', 'property'], $withsub ); | 
            
                                                                        
                            
            
                                    
            
            
                | 340 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 341 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 342 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 343 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 344 |  |  | 	 * Returns a new manager for customer extensions | 
            
                                                                        
                            
            
                                    
            
            
                | 345 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 346 |  |  | 	 * @param string $manager Name of the sub manager type in lower case | 
            
                                                                        
                            
            
                                    
            
            
                | 347 |  |  | 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null | 
            
                                                                        
                            
            
                                    
            
            
                | 348 |  |  | 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. | 
            
                                                                        
                            
            
                                    
            
            
                | 349 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  | 	public function getSubManager( $manager, $name = null ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  | 	{ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 352 |  |  | 		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 353 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 354 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 355 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 356 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 357 |  |  | 	 * Saves a customer item object. | 
            
                                                                        
                            
            
                                    
            
            
                | 358 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 359 |  |  | 	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object | 
            
                                                                        
                            
            
                                    
            
            
                | 360 |  |  | 	 * @param boolean $fetch True if the new ID should be returned in the item | 
            
                                                                        
                            
            
                                    
            
            
                | 361 |  |  | 	 * @return \Aimeos\MShop\Customer\Item\Iface $item Updated item including the generated ID | 
            
                                                                        
                            
            
                                    
            
            
                | 362 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 363 |  |  | 	public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item, $fetch = true ) | 
            
                                                                        
                            
            
                                    
            
            
                | 364 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 365 |  |  | 		if( !$item->isModified() ) | 
            
                                                                        
                            
            
                                    
            
            
                | 366 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 367 |  |  | 			$item = $this->savePropertyItems( $item, 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 368 |  |  | 			$item = $this->saveAddressItems( $item, 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 369 |  |  | 			return $this->saveListItems( $item, 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 370 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 371 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 372 |  |  | 		$context = $this->getContext(); | 
            
                                                                        
                            
            
                                    
            
            
                | 373 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 374 |  |  | 		$class = '\Aimeos\MShop\Context\Item\Ezpublish'; | 
            
                                                                        
                            
            
                                    
            
            
                | 375 |  |  | 		if( !is_a( $context, $class ) ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 376 |  |  | 			throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 377 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 378 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 379 |  |  | 		$service = $context->getEzUserService(); | 
            
                                                                        
                            
            
                                    
            
            
                | 380 |  |  | 		$email = $item->getPaymentAddress()->getEmail(); | 
            
                                                                        
                            
            
                                    
            
            
                | 381 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 382 |  |  | 		if( $item->getId() !== null ) | 
            
                                                                        
                            
            
                                    
            
            
                | 383 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 384 |  |  | 			$struct = $service->newUserUpdateStruct(); | 
            
                                                                        
                            
            
                                    
            
            
                | 385 |  |  | 			$struct->password = $item->getPassword(); | 
            
                                                                        
                            
            
                                    
            
            
                | 386 |  |  | 			$struct->enabled = $item->getStatus(); | 
            
                                                                        
                            
            
                                    
            
            
                | 387 |  |  | 			$struct->email = $email; | 
            
                                                                        
                            
            
                                    
            
            
                | 388 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 389 |  |  | 			$user = $service->loadUser( $item->getId() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 390 |  |  | 			$service->updateUser( $user, $struct ); | 
            
                                                                        
                            
            
                                    
            
            
                | 391 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 392 |  |  | 		else | 
            
                                                                        
                            
            
                                    
            
            
                | 393 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 394 |  |  | 			$struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 395 |  |  | 			$struct->enabled = $item->getStatus(); | 
            
                                                                        
                            
            
                                    
            
            
                | 396 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 397 |  |  | 			$user = $service->createUser( $struct, [] ); | 
            
                                                                        
                            
            
                                    
            
            
                | 398 |  |  | 			$item->setId( $user->getUserId() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 399 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 400 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 401 |  |  | 		$dbm = $context->getDatabaseManager(); | 
            
                                                                        
                            
            
                                    
            
            
                | 402 |  |  | 		$dbname = $this->getResourceName(); | 
            
                                                                        
                            
            
                                    
            
            
                | 403 |  |  | 		$conn = $dbm->acquire( $dbname ); | 
            
                                                                        
                            
            
                                    
            
            
                | 404 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 405 |  |  | 		try | 
            
                                                                        
                            
            
                                    
            
            
                | 406 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 407 |  |  | 			$date = date( 'Y-m-d H:i:s' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 408 |  |  | 			$columns = $this->getObject()->getSaveAttributes(); | 
            
                                                                        
                            
            
                                    
            
            
                | 409 |  |  | 			$ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); | 
            
                                                                        
                            
            
                                    
            
            
                | 410 |  |  | 			$billingAddress = $item->getPaymentAddress(); | 
            
                                                                        
                            
            
                                    
            
            
                | 411 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 412 |  |  | 			$path = 'mshop/customer/manager/ezpublish/update'; | 
            
                                                                        
                            
            
                                    
            
            
                | 413 |  |  | 			$sql = $this->addSqlColumns( array_keys( $columns ), $this->getSqlConfig( $path ), false ); | 
            
                                                                        
                            
            
                                    
            
            
                | 414 |  |  | 			$stmt = $this->getCachedStatement( $conn, $path, $sql ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 415 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 416 |  |  | 			$idx = 1; | 
            
                                                                        
                            
            
                                    
            
            
                | 417 |  |  | 			$stmt = $this->getCachedStatement( $conn, $path, $sql ); | 
            
                                                                        
                            
            
                                    
            
            
                | 418 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 419 |  |  | 			foreach( $columns as $name => $entry ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 420 |  |  | 				$stmt->bind( $idx++, $item->get( $name ), $entry->getInternalType() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 421 |  |  | 			} | 
            
                                                                        
                            
            
                                    
            
            
                | 422 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 423 |  |  | 			$stmt->bind( $idx++, $billingAddress->getCompany() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 424 |  |  | 			$stmt->bind( $idx++, $billingAddress->getVatID() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 425 |  |  | 			$stmt->bind( $idx++, $billingAddress->getSalutation() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 426 |  |  | 			$stmt->bind( $idx++, $billingAddress->getTitle() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 427 |  |  | 			$stmt->bind( $idx++, $billingAddress->getFirstname() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 428 |  |  | 			$stmt->bind( $idx++, $billingAddress->getLastname() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 429 |  |  | 			$stmt->bind( $idx++, $billingAddress->getAddress1() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 430 |  |  | 			$stmt->bind( $idx++, $billingAddress->getAddress2() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 431 |  |  | 			$stmt->bind( $idx++, $billingAddress->getAddress3() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 432 |  |  | 			$stmt->bind( $idx++, $billingAddress->getPostal() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 433 |  |  | 			$stmt->bind( $idx++, $billingAddress->getCity() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 434 |  |  | 			$stmt->bind( $idx++, $billingAddress->getState() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 435 |  |  | 			$stmt->bind( $idx++, $billingAddress->getCountryId() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 436 |  |  | 			$stmt->bind( $idx++, $billingAddress->getLanguageId() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 437 |  |  | 			$stmt->bind( $idx++, $billingAddress->getTelephone() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 438 |  |  | 			$stmt->bind( $idx++, $billingAddress->getTelefax() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 439 |  |  | 			$stmt->bind( $idx++, $billingAddress->getWebsite() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 440 |  |  | 			$stmt->bind( $idx++, $item->getBirthday() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 441 |  |  | 			$stmt->bind( $idx++, $item->getDateVerified() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 442 |  |  | 			$stmt->bind( $idx++, $date ); // Modification time | 
            
                                                                        
                            
            
                                    
            
            
                | 443 |  |  | 			$stmt->bind( $idx++, $context->getEditor() ); | 
            
                                                                        
                            
            
                                    
            
            
                | 444 |  |  | 			$stmt->bind( $idx++, $ctime ); // Creation time | 
            
                                                                        
                            
            
                                    
            
            
                | 445 |  |  | 			$stmt->bind( $idx++, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); | 
            
                                                                        
                            
            
                                    
            
            
                | 446 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 447 |  |  | 			$stmt->execute()->finish(); | 
            
                                                                        
                            
            
                                    
            
            
                | 448 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 449 |  |  | 			$dbm->release( $conn, $dbname ); | 
            
                                                                        
                            
            
                                    
            
            
                | 450 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 451 |  |  | 		catch( \Exception $e ) | 
            
                                                                        
                            
            
                                    
            
            
                | 452 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 453 |  |  | 			$dbm->release( $conn, $dbname ); | 
            
                                                                        
                            
            
                                    
            
            
                | 454 |  |  | 			throw $e; | 
            
                                                                        
                            
            
                                    
            
            
                | 455 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 456 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 457 |  |  | 		$item = $this->savePropertyItems( $item, 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 458 |  |  | 		$item = $this->saveAddressItems( $item, 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 459 |  |  | 		return $this->saveListItems( $item, 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 460 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 461 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 462 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 463 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 464 |  |  | 	 * Returns the item objects matched by the given search criteria. | 
            
                                                                        
                            
            
                                    
            
            
                | 465 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 466 |  |  | 	 * @param \Aimeos\MW\Criteria\Iface $search Search criteria object | 
            
                                                                        
                            
            
                                    
            
            
                | 467 |  |  | 	 * @param integer &$total Number of items that are available in total | 
            
                                                                        
                            
            
                                    
            
            
                | 468 |  |  | 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface | 
            
                                                                        
                            
            
                                    
            
            
                | 469 |  |  | 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed | 
            
                                                                        
                            
            
                                    
            
            
                | 470 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 471 |  |  | 	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) | 
            
                                                                        
                            
            
                                    
            
            
                | 472 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 473 |  |  | 		$dbm = $this->getContext()->getDatabaseManager(); | 
            
                                                                        
                            
            
                                    
            
            
                | 474 |  |  | 		$dbname = $this->getResourceName(); | 
            
                                                                        
                            
            
                                    
            
            
                | 475 |  |  | 		$conn = $dbm->acquire( $dbname ); | 
            
                                                                        
                            
            
                                    
            
            
                | 476 |  |  | 		$map = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 477 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 478 |  |  | 		try | 
            
                                                                        
                            
            
                                    
            
            
                | 479 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 480 |  |  | 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; | 
            
                                                                        
                            
            
                                    
            
            
                | 481 |  |  | 			$cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; | 
            
                                                                        
                            
            
                                    
            
            
                | 482 |  |  | 			$cfgPathCount = 'mshop/customer/manager/ezpublish/count'; | 
            
                                                                        
                            
            
                                    
            
            
                | 483 |  |  | 			$required = array( 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 484 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 485 |  |  | 			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); | 
            
                                                                        
                            
            
                                    
            
            
                | 486 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 487 |  |  | 			while( ( $row = $results->fetch() ) !== false ) | 
            
                                                                        
                            
            
                                    
            
            
                | 488 |  |  | 			{ | 
            
                                                                        
                            
            
                                    
            
            
                | 489 |  |  | 				$map[ $row['customer.id'] ] = $row; | 
            
                                                                        
                            
            
                                    
            
            
                | 490 |  |  | 				$map[ $row['customer.id'] ]['customer.groups'] = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 491 |  |  | 			} | 
            
                                                                        
                            
            
                                    
            
            
                | 492 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 493 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 494 |  |  | 			$path = 'mshop/customer/manager/ezpublish/groups'; | 
            
                                                                        
                            
            
                                    
            
            
                | 495 |  |  | 			$stmt = $conn->create( $this->getGroupSql( array_keys( $map ), $path ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 496 |  |  | 			$results = $stmt->execute(); | 
            
                                                                        
                            
            
                                    
            
            
                | 497 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 498 |  |  | 			while( ( $row = $results->fetch() ) !== false ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 499 |  |  | 				$map[(string) $row['contentobject_id']]['customer.groups'][] = $row['role_id']; | 
            
                                                                        
                            
            
                                    
            
            
                | 500 |  |  | 			} | 
            
                                                                        
                            
            
                                    
            
            
                | 501 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 502 |  |  | 			$dbm->release( $conn, $dbname ); | 
            
                                                                        
                            
            
                                    
            
            
                | 503 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 504 |  |  | 		catch( \Exception $e ) | 
            
                                                                        
                            
            
                                    
            
            
                | 505 |  |  | 		{ | 
            
                                                                        
                            
            
                                    
            
            
                | 506 |  |  | 			$dbm->release( $conn, $dbname  ); | 
            
                                                                        
                            
            
                                    
            
            
                | 507 |  |  | 			throw $e; | 
            
                                                                        
                            
            
                                    
            
            
                | 508 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 509 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 510 |  |  | 		return $this->buildItems( $map, $ref, 'customer' ); | 
            
                                                                        
                            
            
                                    
            
            
                | 511 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 512 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 513 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 514 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 515 |  |  | 	 * Creates a new customer item. | 
            
                                                                        
                            
            
                                    
            
            
                | 516 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 517 |  |  | 	 * @param array $values List of attributes for customer item | 
            
                                                                        
                            
            
                                    
            
            
                | 518 |  |  | 	 * @param \Aimeos\MShop\Common\Lists\Item\Iface[] $listItems List of list items | 
            
                                                                        
                            
            
                                    
            
            
                | 519 |  |  | 	 * @param \Aimeos\MShop\Common\Item\Iface[] $refItems List of referenced items | 
            
                                                                        
                            
            
                                    
            
            
                | 520 |  |  | 	 * @param \Aimeos\MShop\Common\Item\Address\Iface[] $addrItems List of referenced address items | 
            
                                                                        
                            
            
                                    
            
            
                | 521 |  |  | 	 * @param \Aimeos\MShop\Common\Item\Property\Iface[] $propItems List of property items | 
            
                                                                        
                            
            
                                    
            
            
                | 522 |  |  | 	 * @return \Aimeos\MShop\Customer\Item\Iface New customer item | 
            
                                                                        
                            
            
                                    
            
            
                | 523 |  |  | 	 */ | 
            
                                                                        
                            
            
                                    
            
            
                | 524 |  |  | 	protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [], | 
            
                                                                        
                            
            
                                    
            
            
                | 525 |  |  | 		array $addrItems = [], array $propItems = [] ) | 
            
                                                                        
                            
            
                                    
            
            
                | 526 |  |  | 	{ | 
            
                                                                        
                            
            
                                    
            
            
                | 527 |  |  | 		$address = new \Aimeos\MShop\Common\Item\Address\Simple( 'customer.', $values ); | 
            
                                                                        
                            
            
                                    
            
            
                | 528 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 529 |  |  | 		return new \Aimeos\MShop\Customer\Item\Ezpublish( | 
            
                                                                        
                            
            
                                    
            
            
                | 530 |  |  | 			$address, $values, $listItems, $refItems, $addrItems, $propItems | 
            
                                                                        
                            
            
                                    
            
            
                | 531 |  |  | 		); | 
            
                                                                        
                            
            
                                    
            
            
                | 532 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 533 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 534 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 535 |  |  | 	/** | 
            
                                                                        
                            
            
                                    
            
            
                | 536 |  |  | 	 * Returns the SQL statement for retrieving the customer group IDs | 
            
                                                                        
                            
            
                                    
            
            
                | 537 |  |  | 	 * | 
            
                                                                        
                            
            
                                    
            
            
                | 538 |  |  | 	 * @param array $ids List of customer IDs | 
            
                                                                        
                            
            
                                    
            
            
                | 539 |  |  | 	 * @param string $cfgpath Configuration path to the SQL statement | 
            
                                                                        
                            
            
                                    
            
            
                | 540 |  |  | 	 * @return string SQL statement ready for execution | 
            
                                                                        
                            
            
                                    
            
            
                | 541 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  | 	protected function getGroupSql( array $ids, $cfgpath ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  | 		if( empty( $ids ) ) { return '1=1'; } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  | 		$search = $this->getObject()->createSearch(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  | 		$search->setConditions( $search->compare( '==', 'id', $ids ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  | 		$types = array( 'id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  | 		$translations = array( 'id' => '"contentobject_id"' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  | 		$cond = $search->getConditionSource( $types, $translations ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 553 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 554 |  |  | 		return str_replace( ':cond', $cond, $this->getSqlConfig( $cfgpath ) ); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 555 |  |  | 	} | 
            
                                                                        
                                                                
            
                                    
            
            
                | 556 |  |  | } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 557 |  |  |  |