@@ -19,34 +19,34 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class Ezpublish extends Standard implements Iface |
| 21 | 21 | { |
| 22 | - private $password = null; |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Returns the password of the customer item |
|
| 27 | - * |
|
| 28 | - * @return string |
|
| 29 | - */ |
|
| 30 | - public function getPassword() |
|
| 31 | - { |
|
| 32 | - return $this->password; |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Sets the password of the customer item |
|
| 38 | - * |
|
| 39 | - * @param string $value password of the customer item |
|
| 40 | - * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls |
|
| 41 | - */ |
|
| 42 | - public function setPassword( $value ) |
|
| 43 | - { |
|
| 44 | - if( $value !== '' && $value != $this->getPassword() ) |
|
| 45 | - { |
|
| 46 | - $this->password = (string) $value; |
|
| 47 | - $this->setModified(); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - return $this; |
|
| 51 | - } |
|
| 22 | + private $password = null; |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Returns the password of the customer item |
|
| 27 | + * |
|
| 28 | + * @return string |
|
| 29 | + */ |
|
| 30 | + public function getPassword() |
|
| 31 | + { |
|
| 32 | + return $this->password; |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Sets the password of the customer item |
|
| 38 | + * |
|
| 39 | + * @param string $value password of the customer item |
|
| 40 | + * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls |
|
| 41 | + */ |
|
| 42 | + public function setPassword( $value ) |
|
| 43 | + { |
|
| 44 | + if( $value !== '' && $value != $this->getPassword() ) |
|
| 45 | + { |
|
| 46 | + $this->password = (string) $value; |
|
| 47 | + $this->setModified(); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + return $this; |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -39,9 +39,9 @@ |
||
| 39 | 39 | * @param string $value password of the customer item |
| 40 | 40 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls |
| 41 | 41 | */ |
| 42 | - public function setPassword( $value ) |
|
| 42 | + public function setPassword($value) |
|
| 43 | 43 | { |
| 44 | - if( $value !== '' && $value != $this->getPassword() ) |
|
| 44 | + if ($value !== '' && $value != $this->getPassword()) |
|
| 45 | 45 | { |
| 46 | 46 | $this->password = (string) $value; |
| 47 | 47 | $this->setModified(); |
@@ -18,198 +18,198 @@ |
||
| 18 | 18 | * @subpackage Customer |
| 19 | 19 | */ |
| 20 | 20 | class Ezpublish |
| 21 | - extends \Aimeos\MShop\Customer\Manager\Lists\Standard |
|
| 22 | - implements \Aimeos\MShop\Customer\Manager\Lists\Iface, \Aimeos\MShop\Common\Manager\Lists\Iface |
|
| 21 | + extends \Aimeos\MShop\Customer\Manager\Lists\Standard |
|
| 22 | + implements \Aimeos\MShop\Customer\Manager\Lists\Iface, \Aimeos\MShop\Common\Manager\Lists\Iface |
|
| 23 | 23 | { |
| 24 | - private $searchConfig = array( |
|
| 25 | - 'customer.lists.id'=> array( |
|
| 26 | - 'code'=>'customer.lists.id', |
|
| 27 | - 'internalcode'=>'ezuli."id"', |
|
| 28 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )' ), |
|
| 29 | - 'label'=>'Customer list ID', |
|
| 30 | - 'type'=> 'integer', |
|
| 31 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 32 | - 'public' => false, |
|
| 33 | - ), |
|
| 34 | - 'customer.lists.siteid'=> array( |
|
| 35 | - 'code'=>'customer.lists.siteid', |
|
| 36 | - 'internalcode'=>'ezuli."siteid"', |
|
| 37 | - 'label'=>'Customer list site ID', |
|
| 38 | - 'type'=> 'integer', |
|
| 39 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 40 | - 'public' => false, |
|
| 41 | - ), |
|
| 42 | - 'customer.lists.parentid'=> array( |
|
| 43 | - 'code'=>'customer.lists.parentid', |
|
| 44 | - 'internalcode'=>'ezuli."parentid"', |
|
| 45 | - 'label'=>'Customer list parent ID', |
|
| 46 | - 'type'=> 'integer', |
|
| 47 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 48 | - 'public' => false, |
|
| 49 | - ), |
|
| 50 | - 'customer.lists.domain'=> array( |
|
| 51 | - 'code'=>'customer.lists.domain', |
|
| 52 | - 'internalcode'=>'ezuli."domain"', |
|
| 53 | - 'label'=>'Customer list domain', |
|
| 54 | - 'type'=> 'string', |
|
| 55 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 56 | - ), |
|
| 57 | - 'customer.lists.typeid' => array( |
|
| 58 | - 'code'=>'customer.lists.typeid', |
|
| 59 | - 'internalcode'=>'ezuli."typeid"', |
|
| 60 | - 'label'=>'Customer list type ID', |
|
| 61 | - 'type'=> 'integer', |
|
| 62 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 63 | - 'public' => false, |
|
| 64 | - ), |
|
| 65 | - 'customer.lists.refid'=> array( |
|
| 66 | - 'code'=>'customer.lists.refid', |
|
| 67 | - 'internalcode'=>'ezuli."refid"', |
|
| 68 | - 'label'=>'Customer list reference ID', |
|
| 69 | - 'type'=> 'string', |
|
| 70 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 71 | - ), |
|
| 72 | - 'customer.lists.datestart' => array( |
|
| 73 | - 'code'=>'customer.lists.datestart', |
|
| 74 | - 'internalcode'=>'ezuli."start"', |
|
| 75 | - 'label'=>'Customer list start date/time', |
|
| 76 | - 'type'=> 'datetime', |
|
| 77 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 78 | - ), |
|
| 79 | - 'customer.lists.dateend' => array( |
|
| 80 | - 'code'=>'customer.lists.dateend', |
|
| 81 | - 'internalcode'=>'ezuli."end"', |
|
| 82 | - 'label'=>'Customer list end date/time', |
|
| 83 | - 'type'=> 'datetime', |
|
| 84 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 85 | - ), |
|
| 86 | - 'customer.lists.config' => array( |
|
| 87 | - 'code'=>'customer.lists.config', |
|
| 88 | - 'internalcode'=>'ezuli."config"', |
|
| 89 | - 'label'=>'Customer list position', |
|
| 90 | - 'type'=> 'string', |
|
| 91 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 92 | - ), |
|
| 93 | - 'customer.lists.position' => array( |
|
| 94 | - 'code'=>'customer.lists.position', |
|
| 95 | - 'internalcode'=>'ezuli."pos"', |
|
| 96 | - 'label'=>'Customer list position', |
|
| 97 | - 'type'=> 'integer', |
|
| 98 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 99 | - ), |
|
| 100 | - 'customer.lists.status' => array( |
|
| 101 | - 'code'=>'customer.lists.status', |
|
| 102 | - 'internalcode'=>'ezuli."status"', |
|
| 103 | - 'label'=>'Customer list status', |
|
| 104 | - 'type'=> 'integer', |
|
| 105 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 106 | - ), |
|
| 107 | - 'customer.lists.ctime'=> array( |
|
| 108 | - 'code'=>'customer.lists.ctime', |
|
| 109 | - 'internalcode'=>'ezuli."ctime"', |
|
| 110 | - 'label'=>'Customer list create date/time', |
|
| 111 | - 'type'=> 'datetime', |
|
| 112 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 113 | - ), |
|
| 114 | - 'customer.lists.mtime'=> array( |
|
| 115 | - 'code'=>'customer.lists.mtime', |
|
| 116 | - 'internalcode'=>'ezuli."mtime"', |
|
| 117 | - 'label'=>'Customer list modification date/time', |
|
| 118 | - 'type'=> 'datetime', |
|
| 119 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 120 | - ), |
|
| 121 | - 'customer.lists.editor'=> array( |
|
| 122 | - 'code'=>'customer.lists.editor', |
|
| 123 | - 'internalcode'=>'ezuli."editor"', |
|
| 124 | - 'label'=>'Customer list editor', |
|
| 125 | - 'type'=> 'string', |
|
| 126 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 127 | - ), |
|
| 128 | - ); |
|
| 129 | - |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * Removes old entries from the storage. |
|
| 133 | - * |
|
| 134 | - * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 135 | - */ |
|
| 136 | - public function cleanup( array $siteids ) |
|
| 137 | - { |
|
| 138 | - $path = 'mshop/customer/manager/lists/submanagers'; |
|
| 139 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'type' ) ) as $domain ) { |
|
| 140 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - $this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' ); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * Returns the list attributes that can be used for searching. |
|
| 149 | - * |
|
| 150 | - * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 151 | - * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 152 | - */ |
|
| 153 | - public function getSearchAttributes( $withsub = true ) |
|
| 154 | - { |
|
| 155 | - $path = 'mshop/customer/manager/lists/submanagers'; |
|
| 156 | - |
|
| 157 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array( 'type' ), $withsub ); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Returns a new manager for customer extensions |
|
| 163 | - * |
|
| 164 | - * @param string $manager Name of the sub manager type in lower case |
|
| 165 | - * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 166 | - * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 167 | - */ |
|
| 168 | - public function getSubManager( $manager, $name = null ) |
|
| 169 | - { |
|
| 170 | - return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Updates or adds a common list item object. |
|
| 176 | - * |
|
| 177 | - * @param \Aimeos\MShop\Common\Item\Lists\Iface $item List item object which should be saved |
|
| 178 | - * @param boolean $fetch True if the new ID should be returned in the item |
|
| 179 | - */ |
|
| 180 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 181 | - { |
|
| 182 | - $iface = '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface'; |
|
| 183 | - if( !( $item instanceof $iface ) ) { |
|
| 184 | - throw new \Aimeos\MShop\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - if( $item->getDomain() === 'customer/group' ) { |
|
| 188 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Adding groups to customers is not supported, please use the eZ Publish backend' ) ); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - parent::saveItem( $item, $fetch ); |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * Returns the config path for retrieving the configuration values. |
|
| 197 | - * |
|
| 198 | - * @return string Configuration path (mshop/customer/manager/lists/ezpublish/) |
|
| 199 | - */ |
|
| 200 | - protected function getConfigPath() |
|
| 201 | - { |
|
| 202 | - return 'mshop/customer/manager/lists/ezpublish/'; |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * Returns the search configuration for searching items. |
|
| 208 | - * |
|
| 209 | - * @return array Associative list of search keys and search definitions |
|
| 210 | - */ |
|
| 211 | - protected function getSearchConfig() |
|
| 212 | - { |
|
| 213 | - return $this->searchConfig; |
|
| 214 | - } |
|
| 24 | + private $searchConfig = array( |
|
| 25 | + 'customer.lists.id'=> array( |
|
| 26 | + 'code'=>'customer.lists.id', |
|
| 27 | + 'internalcode'=>'ezuli."id"', |
|
| 28 | + 'internaldeps' => array( 'LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )' ), |
|
| 29 | + 'label'=>'Customer list ID', |
|
| 30 | + 'type'=> 'integer', |
|
| 31 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 32 | + 'public' => false, |
|
| 33 | + ), |
|
| 34 | + 'customer.lists.siteid'=> array( |
|
| 35 | + 'code'=>'customer.lists.siteid', |
|
| 36 | + 'internalcode'=>'ezuli."siteid"', |
|
| 37 | + 'label'=>'Customer list site ID', |
|
| 38 | + 'type'=> 'integer', |
|
| 39 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 40 | + 'public' => false, |
|
| 41 | + ), |
|
| 42 | + 'customer.lists.parentid'=> array( |
|
| 43 | + 'code'=>'customer.lists.parentid', |
|
| 44 | + 'internalcode'=>'ezuli."parentid"', |
|
| 45 | + 'label'=>'Customer list parent ID', |
|
| 46 | + 'type'=> 'integer', |
|
| 47 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 48 | + 'public' => false, |
|
| 49 | + ), |
|
| 50 | + 'customer.lists.domain'=> array( |
|
| 51 | + 'code'=>'customer.lists.domain', |
|
| 52 | + 'internalcode'=>'ezuli."domain"', |
|
| 53 | + 'label'=>'Customer list domain', |
|
| 54 | + 'type'=> 'string', |
|
| 55 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 56 | + ), |
|
| 57 | + 'customer.lists.typeid' => array( |
|
| 58 | + 'code'=>'customer.lists.typeid', |
|
| 59 | + 'internalcode'=>'ezuli."typeid"', |
|
| 60 | + 'label'=>'Customer list type ID', |
|
| 61 | + 'type'=> 'integer', |
|
| 62 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 63 | + 'public' => false, |
|
| 64 | + ), |
|
| 65 | + 'customer.lists.refid'=> array( |
|
| 66 | + 'code'=>'customer.lists.refid', |
|
| 67 | + 'internalcode'=>'ezuli."refid"', |
|
| 68 | + 'label'=>'Customer list reference ID', |
|
| 69 | + 'type'=> 'string', |
|
| 70 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 71 | + ), |
|
| 72 | + 'customer.lists.datestart' => array( |
|
| 73 | + 'code'=>'customer.lists.datestart', |
|
| 74 | + 'internalcode'=>'ezuli."start"', |
|
| 75 | + 'label'=>'Customer list start date/time', |
|
| 76 | + 'type'=> 'datetime', |
|
| 77 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 78 | + ), |
|
| 79 | + 'customer.lists.dateend' => array( |
|
| 80 | + 'code'=>'customer.lists.dateend', |
|
| 81 | + 'internalcode'=>'ezuli."end"', |
|
| 82 | + 'label'=>'Customer list end date/time', |
|
| 83 | + 'type'=> 'datetime', |
|
| 84 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 85 | + ), |
|
| 86 | + 'customer.lists.config' => array( |
|
| 87 | + 'code'=>'customer.lists.config', |
|
| 88 | + 'internalcode'=>'ezuli."config"', |
|
| 89 | + 'label'=>'Customer list position', |
|
| 90 | + 'type'=> 'string', |
|
| 91 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 92 | + ), |
|
| 93 | + 'customer.lists.position' => array( |
|
| 94 | + 'code'=>'customer.lists.position', |
|
| 95 | + 'internalcode'=>'ezuli."pos"', |
|
| 96 | + 'label'=>'Customer list position', |
|
| 97 | + 'type'=> 'integer', |
|
| 98 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 99 | + ), |
|
| 100 | + 'customer.lists.status' => array( |
|
| 101 | + 'code'=>'customer.lists.status', |
|
| 102 | + 'internalcode'=>'ezuli."status"', |
|
| 103 | + 'label'=>'Customer list status', |
|
| 104 | + 'type'=> 'integer', |
|
| 105 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 106 | + ), |
|
| 107 | + 'customer.lists.ctime'=> array( |
|
| 108 | + 'code'=>'customer.lists.ctime', |
|
| 109 | + 'internalcode'=>'ezuli."ctime"', |
|
| 110 | + 'label'=>'Customer list create date/time', |
|
| 111 | + 'type'=> 'datetime', |
|
| 112 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 113 | + ), |
|
| 114 | + 'customer.lists.mtime'=> array( |
|
| 115 | + 'code'=>'customer.lists.mtime', |
|
| 116 | + 'internalcode'=>'ezuli."mtime"', |
|
| 117 | + 'label'=>'Customer list modification date/time', |
|
| 118 | + 'type'=> 'datetime', |
|
| 119 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 120 | + ), |
|
| 121 | + 'customer.lists.editor'=> array( |
|
| 122 | + 'code'=>'customer.lists.editor', |
|
| 123 | + 'internalcode'=>'ezuli."editor"', |
|
| 124 | + 'label'=>'Customer list editor', |
|
| 125 | + 'type'=> 'string', |
|
| 126 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 127 | + ), |
|
| 128 | + ); |
|
| 129 | + |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * Removes old entries from the storage. |
|
| 133 | + * |
|
| 134 | + * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 135 | + */ |
|
| 136 | + public function cleanup( array $siteids ) |
|
| 137 | + { |
|
| 138 | + $path = 'mshop/customer/manager/lists/submanagers'; |
|
| 139 | + foreach( $this->getContext()->getConfig()->get( $path, array( 'type' ) ) as $domain ) { |
|
| 140 | + $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + $this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' ); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * Returns the list attributes that can be used for searching. |
|
| 149 | + * |
|
| 150 | + * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 151 | + * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 152 | + */ |
|
| 153 | + public function getSearchAttributes( $withsub = true ) |
|
| 154 | + { |
|
| 155 | + $path = 'mshop/customer/manager/lists/submanagers'; |
|
| 156 | + |
|
| 157 | + return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array( 'type' ), $withsub ); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Returns a new manager for customer extensions |
|
| 163 | + * |
|
| 164 | + * @param string $manager Name of the sub manager type in lower case |
|
| 165 | + * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 166 | + * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 167 | + */ |
|
| 168 | + public function getSubManager( $manager, $name = null ) |
|
| 169 | + { |
|
| 170 | + return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Updates or adds a common list item object. |
|
| 176 | + * |
|
| 177 | + * @param \Aimeos\MShop\Common\Item\Lists\Iface $item List item object which should be saved |
|
| 178 | + * @param boolean $fetch True if the new ID should be returned in the item |
|
| 179 | + */ |
|
| 180 | + public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 181 | + { |
|
| 182 | + $iface = '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface'; |
|
| 183 | + if( !( $item instanceof $iface ) ) { |
|
| 184 | + throw new \Aimeos\MShop\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + if( $item->getDomain() === 'customer/group' ) { |
|
| 188 | + throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Adding groups to customers is not supported, please use the eZ Publish backend' ) ); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + parent::saveItem( $item, $fetch ); |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * Returns the config path for retrieving the configuration values. |
|
| 197 | + * |
|
| 198 | + * @return string Configuration path (mshop/customer/manager/lists/ezpublish/) |
|
| 199 | + */ |
|
| 200 | + protected function getConfigPath() |
|
| 201 | + { |
|
| 202 | + return 'mshop/customer/manager/lists/ezpublish/'; |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * Returns the search configuration for searching items. |
|
| 208 | + * |
|
| 209 | + * @return array Associative list of search keys and search definitions |
|
| 210 | + */ |
|
| 211 | + protected function getSearchConfig() |
|
| 212 | + { |
|
| 213 | + return $this->searchConfig; |
|
| 214 | + } |
|
| 215 | 215 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'customer.lists.id'=> array( |
| 26 | 26 | 'code'=>'customer.lists.id', |
| 27 | 27 | 'internalcode'=>'ezuli."id"', |
| 28 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )' ), |
|
| 28 | + 'internaldeps' => array('LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )'), |
|
| 29 | 29 | 'label'=>'Customer list ID', |
| 30 | 30 | 'type'=> 'integer', |
| 31 | 31 | 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 135 | 135 | */ |
| 136 | - public function cleanup( array $siteids ) |
|
| 136 | + public function cleanup(array $siteids) |
|
| 137 | 137 | { |
| 138 | 138 | $path = 'mshop/customer/manager/lists/submanagers'; |
| 139 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'type' ) ) as $domain ) { |
|
| 140 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 139 | + foreach ($this->getContext()->getConfig()->get($path, array('type')) as $domain) { |
|
| 140 | + $this->getSubManager($domain)->cleanup($siteids); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' ); |
|
| 143 | + $this->cleanupBase($siteids, $this->getConfigPath().'delete'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 151 | 151 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 152 | 152 | */ |
| 153 | - public function getSearchAttributes( $withsub = true ) |
|
| 153 | + public function getSearchAttributes($withsub = true) |
|
| 154 | 154 | { |
| 155 | 155 | $path = 'mshop/customer/manager/lists/submanagers'; |
| 156 | 156 | |
| 157 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array( 'type' ), $withsub ); |
|
| 157 | + return $this->getSearchAttributesBase($this->getSearchConfig(), $path, array('type'), $withsub); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 166 | 166 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 167 | 167 | */ |
| 168 | - public function getSubManager( $manager, $name = null ) |
|
| 168 | + public function getSubManager($manager, $name = null) |
|
| 169 | 169 | { |
| 170 | - return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 170 | + return $this->getSubManagerBase('customer', 'lists/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -177,18 +177,18 @@ discard block |
||
| 177 | 177 | * @param \Aimeos\MShop\Common\Item\Lists\Iface $item List item object which should be saved |
| 178 | 178 | * @param boolean $fetch True if the new ID should be returned in the item |
| 179 | 179 | */ |
| 180 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 180 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 181 | 181 | { |
| 182 | 182 | $iface = '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface'; |
| 183 | - if( !( $item instanceof $iface ) ) { |
|
| 184 | - throw new \Aimeos\MShop\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 183 | + if (!($item instanceof $iface)) { |
|
| 184 | + throw new \Aimeos\MShop\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if( $item->getDomain() === 'customer/group' ) { |
|
| 188 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Adding groups to customers is not supported, please use the eZ Publish backend' ) ); |
|
| 187 | + if ($item->getDomain() === 'customer/group') { |
|
| 188 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Adding groups to customers is not supported, please use the eZ Publish backend')); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - parent::saveItem( $item, $fetch ); |
|
| 191 | + parent::saveItem($item, $fetch); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -18,140 +18,140 @@ |
||
| 18 | 18 | * @subpackage Customer |
| 19 | 19 | */ |
| 20 | 20 | class Ezpublish |
| 21 | - extends \Aimeos\MShop\Customer\Manager\Lists\Type\Standard |
|
| 22 | - implements \Aimeos\MShop\Customer\Manager\Lists\Type\Iface |
|
| 21 | + extends \Aimeos\MShop\Customer\Manager\Lists\Type\Standard |
|
| 22 | + implements \Aimeos\MShop\Customer\Manager\Lists\Type\Iface |
|
| 23 | 23 | { |
| 24 | - private $searchConfig = array( |
|
| 25 | - 'customer.lists.type.id' => array( |
|
| 26 | - 'code'=>'customer.lists.type.id', |
|
| 27 | - 'internalcode'=>'ezulity."id"', |
|
| 28 | - 'internaldeps'=>array( 'LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )' ), |
|
| 29 | - 'label'=>'Customer list type ID', |
|
| 30 | - 'type'=> 'integer', |
|
| 31 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 32 | - 'public' => false, |
|
| 33 | - ), |
|
| 34 | - 'customer.lists.type.siteid' => array( |
|
| 35 | - 'code'=>'customer.lists.type.siteid', |
|
| 36 | - 'internalcode'=>'ezulity."siteid"', |
|
| 37 | - 'label'=>'Customer list type site ID', |
|
| 38 | - 'type'=> 'integer', |
|
| 39 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 40 | - 'public' => false, |
|
| 41 | - ), |
|
| 42 | - 'customer.lists.type.code' => array( |
|
| 43 | - 'code'=>'customer.lists.type.code', |
|
| 44 | - 'internalcode'=>'ezulity."code"', |
|
| 45 | - 'label'=>'Customer list type code', |
|
| 46 | - 'type'=> 'string', |
|
| 47 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 48 | - ), |
|
| 49 | - 'customer.lists.type.domain' => array( |
|
| 50 | - 'code'=>'customer.lists.type.domain', |
|
| 51 | - 'internalcode'=>'ezulity."domain"', |
|
| 52 | - 'label'=>'Customer list type domain', |
|
| 53 | - 'type'=> 'string', |
|
| 54 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 55 | - ), |
|
| 56 | - 'customer.lists.type.label' => array( |
|
| 57 | - 'code'=>'customer.lists.type.label', |
|
| 58 | - 'internalcode'=>'ezulity."label"', |
|
| 59 | - 'label'=>'Customer list type label', |
|
| 60 | - 'type'=> 'string', |
|
| 61 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 62 | - ), |
|
| 63 | - 'customer.lists.type.status' => array( |
|
| 64 | - 'code'=>'customer.lists.type.status', |
|
| 65 | - 'internalcode'=>'ezulity."status"', |
|
| 66 | - 'label'=>'Customer list type status', |
|
| 67 | - 'type'=> 'integer', |
|
| 68 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 69 | - ), |
|
| 70 | - 'customer.lists.type.ctime'=> array( |
|
| 71 | - 'code'=>'customer.lists.type.ctime', |
|
| 72 | - 'internalcode'=>'ezulity."ctime"', |
|
| 73 | - 'label'=>'Customer list type create date/time', |
|
| 74 | - 'type'=> 'datetime', |
|
| 75 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 76 | - ), |
|
| 77 | - 'customer.lists.type.mtime'=> array( |
|
| 78 | - 'code'=>'customer.lists.type.mtime', |
|
| 79 | - 'internalcode'=>'ezulity."mtime"', |
|
| 80 | - 'label'=>'Customer list type modification date/time', |
|
| 81 | - 'type'=> 'datetime', |
|
| 82 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 83 | - ), |
|
| 84 | - 'customer.lists.type.editor'=> array( |
|
| 85 | - 'code'=>'customer.lists.type.editor', |
|
| 86 | - 'internalcode'=>'ezulity."editor"', |
|
| 87 | - 'label'=>'Customer list type editor', |
|
| 88 | - 'type'=> 'string', |
|
| 89 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 90 | - ), |
|
| 91 | - ); |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Removes old entries from the storage. |
|
| 96 | - * |
|
| 97 | - * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 98 | - */ |
|
| 99 | - public function cleanup( array $siteids ) |
|
| 100 | - { |
|
| 101 | - $path = 'mshop/customer/manager/lists/type/submanagers'; |
|
| 102 | - foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
| 103 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - $this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' ); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Returns the list attributes that can be used for searching. |
|
| 112 | - * |
|
| 113 | - * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 114 | - * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 115 | - */ |
|
| 116 | - public function getSearchAttributes( $withsub = true ) |
|
| 117 | - { |
|
| 118 | - $path = 'mshop/customer/manager/lists/type/submanagers'; |
|
| 119 | - |
|
| 120 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array(), $withsub ); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * Returns a new manager for customer extensions |
|
| 126 | - * |
|
| 127 | - * @param string $manager Name of the sub manager type in lower case |
|
| 128 | - * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 129 | - * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 130 | - */ |
|
| 131 | - public function getSubManager( $manager, $name = null ) |
|
| 132 | - { |
|
| 133 | - return $this->getSubManagerBase( 'customer', 'lists/type/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * Returns the config path for retrieving the configuration values. |
|
| 139 | - * |
|
| 140 | - * @return string Configuration path (mshop/customer/manager/lists/type/ezpublish/) |
|
| 141 | - */ |
|
| 142 | - protected function getConfigPath() |
|
| 143 | - { |
|
| 144 | - return 'mshop/customer/manager/lists/type/ezpublish/'; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * Returns the search configuration for searching items. |
|
| 150 | - * |
|
| 151 | - * @return array Associative list of search keys and search definitions |
|
| 152 | - */ |
|
| 153 | - protected function getSearchConfig() |
|
| 154 | - { |
|
| 155 | - return $this->searchConfig; |
|
| 156 | - } |
|
| 24 | + private $searchConfig = array( |
|
| 25 | + 'customer.lists.type.id' => array( |
|
| 26 | + 'code'=>'customer.lists.type.id', |
|
| 27 | + 'internalcode'=>'ezulity."id"', |
|
| 28 | + 'internaldeps'=>array( 'LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )' ), |
|
| 29 | + 'label'=>'Customer list type ID', |
|
| 30 | + 'type'=> 'integer', |
|
| 31 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 32 | + 'public' => false, |
|
| 33 | + ), |
|
| 34 | + 'customer.lists.type.siteid' => array( |
|
| 35 | + 'code'=>'customer.lists.type.siteid', |
|
| 36 | + 'internalcode'=>'ezulity."siteid"', |
|
| 37 | + 'label'=>'Customer list type site ID', |
|
| 38 | + 'type'=> 'integer', |
|
| 39 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 40 | + 'public' => false, |
|
| 41 | + ), |
|
| 42 | + 'customer.lists.type.code' => array( |
|
| 43 | + 'code'=>'customer.lists.type.code', |
|
| 44 | + 'internalcode'=>'ezulity."code"', |
|
| 45 | + 'label'=>'Customer list type code', |
|
| 46 | + 'type'=> 'string', |
|
| 47 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 48 | + ), |
|
| 49 | + 'customer.lists.type.domain' => array( |
|
| 50 | + 'code'=>'customer.lists.type.domain', |
|
| 51 | + 'internalcode'=>'ezulity."domain"', |
|
| 52 | + 'label'=>'Customer list type domain', |
|
| 53 | + 'type'=> 'string', |
|
| 54 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 55 | + ), |
|
| 56 | + 'customer.lists.type.label' => array( |
|
| 57 | + 'code'=>'customer.lists.type.label', |
|
| 58 | + 'internalcode'=>'ezulity."label"', |
|
| 59 | + 'label'=>'Customer list type label', |
|
| 60 | + 'type'=> 'string', |
|
| 61 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 62 | + ), |
|
| 63 | + 'customer.lists.type.status' => array( |
|
| 64 | + 'code'=>'customer.lists.type.status', |
|
| 65 | + 'internalcode'=>'ezulity."status"', |
|
| 66 | + 'label'=>'Customer list type status', |
|
| 67 | + 'type'=> 'integer', |
|
| 68 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 69 | + ), |
|
| 70 | + 'customer.lists.type.ctime'=> array( |
|
| 71 | + 'code'=>'customer.lists.type.ctime', |
|
| 72 | + 'internalcode'=>'ezulity."ctime"', |
|
| 73 | + 'label'=>'Customer list type create date/time', |
|
| 74 | + 'type'=> 'datetime', |
|
| 75 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 76 | + ), |
|
| 77 | + 'customer.lists.type.mtime'=> array( |
|
| 78 | + 'code'=>'customer.lists.type.mtime', |
|
| 79 | + 'internalcode'=>'ezulity."mtime"', |
|
| 80 | + 'label'=>'Customer list type modification date/time', |
|
| 81 | + 'type'=> 'datetime', |
|
| 82 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 83 | + ), |
|
| 84 | + 'customer.lists.type.editor'=> array( |
|
| 85 | + 'code'=>'customer.lists.type.editor', |
|
| 86 | + 'internalcode'=>'ezulity."editor"', |
|
| 87 | + 'label'=>'Customer list type editor', |
|
| 88 | + 'type'=> 'string', |
|
| 89 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 90 | + ), |
|
| 91 | + ); |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Removes old entries from the storage. |
|
| 96 | + * |
|
| 97 | + * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 98 | + */ |
|
| 99 | + public function cleanup( array $siteids ) |
|
| 100 | + { |
|
| 101 | + $path = 'mshop/customer/manager/lists/type/submanagers'; |
|
| 102 | + foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
| 103 | + $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + $this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' ); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Returns the list attributes that can be used for searching. |
|
| 112 | + * |
|
| 113 | + * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 114 | + * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 115 | + */ |
|
| 116 | + public function getSearchAttributes( $withsub = true ) |
|
| 117 | + { |
|
| 118 | + $path = 'mshop/customer/manager/lists/type/submanagers'; |
|
| 119 | + |
|
| 120 | + return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array(), $withsub ); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * Returns a new manager for customer extensions |
|
| 126 | + * |
|
| 127 | + * @param string $manager Name of the sub manager type in lower case |
|
| 128 | + * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 129 | + * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 130 | + */ |
|
| 131 | + public function getSubManager( $manager, $name = null ) |
|
| 132 | + { |
|
| 133 | + return $this->getSubManagerBase( 'customer', 'lists/type/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * Returns the config path for retrieving the configuration values. |
|
| 139 | + * |
|
| 140 | + * @return string Configuration path (mshop/customer/manager/lists/type/ezpublish/) |
|
| 141 | + */ |
|
| 142 | + protected function getConfigPath() |
|
| 143 | + { |
|
| 144 | + return 'mshop/customer/manager/lists/type/ezpublish/'; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * Returns the search configuration for searching items. |
|
| 150 | + * |
|
| 151 | + * @return array Associative list of search keys and search definitions |
|
| 152 | + */ |
|
| 153 | + protected function getSearchConfig() |
|
| 154 | + { |
|
| 155 | + return $this->searchConfig; |
|
| 156 | + } |
|
| 157 | 157 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | 'customer.lists.type.id' => array( |
| 26 | 26 | 'code'=>'customer.lists.type.id', |
| 27 | 27 | 'internalcode'=>'ezulity."id"', |
| 28 | - 'internaldeps'=>array( 'LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )' ), |
|
| 28 | + 'internaldeps'=>array('LEFT JOIN "ezuser_list_type" AS ezulity ON ( ezuli."typeid" = ezulity."id" )'), |
|
| 29 | 29 | 'label'=>'Customer list type ID', |
| 30 | 30 | 'type'=> 'integer', |
| 31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 98 | 98 | */ |
| 99 | - public function cleanup( array $siteids ) |
|
| 99 | + public function cleanup(array $siteids) |
|
| 100 | 100 | { |
| 101 | 101 | $path = 'mshop/customer/manager/lists/type/submanagers'; |
| 102 | - foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
| 103 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 102 | + foreach ($this->getContext()->getConfig()->get($path, array()) as $domain) { |
|
| 103 | + $this->getSubManager($domain)->cleanup($siteids); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' ); |
|
| 106 | + $this->cleanupBase($siteids, $this->getConfigPath().'delete'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 114 | 114 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 115 | 115 | */ |
| 116 | - public function getSearchAttributes( $withsub = true ) |
|
| 116 | + public function getSearchAttributes($withsub = true) |
|
| 117 | 117 | { |
| 118 | 118 | $path = 'mshop/customer/manager/lists/type/submanagers'; |
| 119 | 119 | |
| 120 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array(), $withsub ); |
|
| 120 | + return $this->getSearchAttributesBase($this->getSearchConfig(), $path, array(), $withsub); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 129 | 129 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 130 | 130 | */ |
| 131 | - public function getSubManager( $manager, $name = null ) |
|
| 131 | + public function getSubManager($manager, $name = null) |
|
| 132 | 132 | { |
| 133 | - return $this->getSubManagerBase( 'customer', 'lists/type/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 133 | + return $this->getSubManagerBase('customer', 'lists/type/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -18,262 +18,262 @@ |
||
| 18 | 18 | * @subpackage Customer |
| 19 | 19 | */ |
| 20 | 20 | class Ezpublish |
| 21 | - extends \Aimeos\MShop\Customer\Manager\Address\Standard |
|
| 22 | - implements \Aimeos\MShop\Customer\Manager\Address\Iface |
|
| 21 | + extends \Aimeos\MShop\Customer\Manager\Address\Standard |
|
| 22 | + implements \Aimeos\MShop\Customer\Manager\Address\Iface |
|
| 23 | 23 | { |
| 24 | - private $searchConfig = array( |
|
| 25 | - 'customer.address.id' => array( |
|
| 26 | - 'label' => 'Customer address ID', |
|
| 27 | - 'code' => 'customer.address.id', |
|
| 28 | - 'internalcode' => 'ezuad."id"', |
|
| 29 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ), |
|
| 30 | - 'type' => 'integer', |
|
| 31 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 32 | - 'public' => false, |
|
| 33 | - ), |
|
| 34 | - // site ID is not available |
|
| 35 | - 'customer.address.refid' => array( |
|
| 36 | - 'label' => 'Customer address parent ID', |
|
| 37 | - 'code' => 'customer.address.parentid', |
|
| 38 | - 'internalcode' => 'ezuad."parentid"', |
|
| 39 | - 'type' => 'integer', |
|
| 40 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 41 | - 'public' => false, |
|
| 42 | - ), |
|
| 43 | - 'customer.address.company'=> array( |
|
| 44 | - 'label' => 'Customer address company', |
|
| 45 | - 'code' => 'customer.address.company', |
|
| 46 | - 'internalcode' => 'ezuad."company"', |
|
| 47 | - 'type' => 'string', |
|
| 48 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 49 | - ), |
|
| 50 | - 'customer.address.vatid'=> array( |
|
| 51 | - 'label' => 'Customer address VAT ID', |
|
| 52 | - 'code' => 'customer.address.vatid', |
|
| 53 | - 'internalcode' => 'ezuad."vatid"', |
|
| 54 | - 'type' => 'string', |
|
| 55 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 56 | - ), |
|
| 57 | - 'customer.address.salutation' => array( |
|
| 58 | - 'label' => 'Customer address salutation', |
|
| 59 | - 'code' => 'customer.address.salutation', |
|
| 60 | - 'internalcode' => 'ezuad."salutation"', |
|
| 61 | - 'type' => 'integer', |
|
| 62 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 63 | - ), |
|
| 64 | - 'customer.address.title' => array( |
|
| 65 | - 'label' => 'Customer address title', |
|
| 66 | - 'code' => 'customer.address.title', |
|
| 67 | - 'internalcode' => 'ezuad."title"', |
|
| 68 | - 'type' => 'string', |
|
| 69 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 70 | - ), |
|
| 71 | - 'customer.address.firstname' => array( |
|
| 72 | - 'label' => 'Customer address firstname', |
|
| 73 | - 'code' => 'customer.address.firstname', |
|
| 74 | - 'internalcode' => 'ezuad."firstname"', |
|
| 75 | - 'type' => 'string', |
|
| 76 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 77 | - ), |
|
| 78 | - 'customer.address.lastname' => array( |
|
| 79 | - 'label' => 'Customer address lastname', |
|
| 80 | - 'code' => 'customer.address.lastname', |
|
| 81 | - 'internalcode' => 'ezuad."lastname"', |
|
| 82 | - 'type' => 'string', |
|
| 83 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 84 | - ), |
|
| 85 | - 'customer.address.address1' => array( |
|
| 86 | - 'label' => 'Customer address address part one', |
|
| 87 | - 'code' => 'customer.address.address1', |
|
| 88 | - 'internalcode' => 'ezuad."address1"', |
|
| 89 | - 'type' => 'string', |
|
| 90 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 91 | - ), |
|
| 92 | - 'customer.address.address2' => array( |
|
| 93 | - 'label' => 'Customer address address part two', |
|
| 94 | - 'code' => 'customer.address.address2', |
|
| 95 | - 'internalcode' => 'ezuad."address2"', |
|
| 96 | - 'type' => 'string', |
|
| 97 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 98 | - ), |
|
| 99 | - 'customer.address.address3' => array( |
|
| 100 | - 'label' => 'Customer address address part three', |
|
| 101 | - 'code' => 'customer.address.address3', |
|
| 102 | - 'internalcode' => 'ezuad."address3"', |
|
| 103 | - 'type' => 'string', |
|
| 104 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 105 | - ), |
|
| 106 | - 'customer.address.postal' => array( |
|
| 107 | - 'label' => 'Customer address postal', |
|
| 108 | - 'code' => 'customer.address.postal', |
|
| 109 | - 'internalcode' => 'ezuad."postal"', |
|
| 110 | - 'type' => 'string', |
|
| 111 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 112 | - ), |
|
| 113 | - 'customer.address.city' => array( |
|
| 114 | - 'label' => 'Customer address city', |
|
| 115 | - 'code' => 'customer.address.city', |
|
| 116 | - 'internalcode' => 'ezuad."city"', |
|
| 117 | - 'type' => 'string', |
|
| 118 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 119 | - ), |
|
| 120 | - 'customer.address.state' => array( |
|
| 121 | - 'label' => 'Customer address state', |
|
| 122 | - 'code' => 'customer.address.state', |
|
| 123 | - 'internalcode' => 'ezuad."state"', |
|
| 124 | - 'type' => 'string', |
|
| 125 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 126 | - ), |
|
| 127 | - 'customer.address.languageid' => array( |
|
| 128 | - 'label' => 'Customer address language', |
|
| 129 | - 'code' => 'customer.address.languageid', |
|
| 130 | - 'internalcode' => 'ezuad."langid"', |
|
| 131 | - 'type' => 'string', |
|
| 132 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 133 | - ), |
|
| 134 | - 'customer.address.countryid' => array( |
|
| 135 | - 'label' => 'Customer address country', |
|
| 136 | - 'code' => 'customer.address.countryid', |
|
| 137 | - 'internalcode' => 'ezuad."countryid"', |
|
| 138 | - 'type' => 'string', |
|
| 139 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 140 | - ), |
|
| 141 | - 'customer.address.telephone' => array( |
|
| 142 | - 'label' => 'Customer address telephone', |
|
| 143 | - 'code' => 'customer.address.telephone', |
|
| 144 | - 'internalcode' => 'ezuad."telephone"', |
|
| 145 | - 'type' => 'string', |
|
| 146 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 147 | - ), |
|
| 148 | - 'customer.address.email' => array( |
|
| 149 | - 'label' => 'Customer address email', |
|
| 150 | - 'code' => 'customer.address.email', |
|
| 151 | - 'internalcode' => 'ezuad."email"', |
|
| 152 | - 'type' => 'string', |
|
| 153 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 154 | - ), |
|
| 155 | - 'customer.address.telefax' => array( |
|
| 156 | - 'label' => 'Customer address telefax', |
|
| 157 | - 'code' => 'customer.address.telefax', |
|
| 158 | - 'internalcode' => 'ezuad."telefax"', |
|
| 159 | - 'type' => 'string', |
|
| 160 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 161 | - ), |
|
| 162 | - 'customer.address.website' => array( |
|
| 163 | - 'label' => 'Customer address website', |
|
| 164 | - 'code' => 'customer.address.website', |
|
| 165 | - 'internalcode' => 'ezuad."website"', |
|
| 166 | - 'type' => 'string', |
|
| 167 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 168 | - ), |
|
| 169 | - 'customer.address.flag' => array( |
|
| 170 | - 'label' => 'Customer address flag', |
|
| 171 | - 'code' => 'customer.address.flag', |
|
| 172 | - 'internalcode' => 'ezuad."flag"', |
|
| 173 | - 'type' => 'integer', |
|
| 174 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 175 | - ), |
|
| 176 | - 'customer.address.position' => array( |
|
| 177 | - 'label' => 'Customer address position', |
|
| 178 | - 'code' => 'customer.address.position', |
|
| 179 | - 'internalcode' => 'ezuad."pos"', |
|
| 180 | - 'type' => 'integer', |
|
| 181 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 182 | - ), |
|
| 183 | - 'customer.address.ctime'=> array( |
|
| 184 | - 'label'=>'Customer address create date/time', |
|
| 185 | - 'code'=>'customer.address.ctime', |
|
| 186 | - 'internalcode'=>'ezuad."ctime"', |
|
| 187 | - 'type'=> 'datetime', |
|
| 188 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 189 | - ), |
|
| 190 | - 'customer.address.mtime'=> array( |
|
| 191 | - 'label'=>'Customer address modification date/time', |
|
| 192 | - 'code'=>'customer.address.mtime', |
|
| 193 | - 'internalcode'=>'ezuad."mtime"', |
|
| 194 | - 'type'=> 'datetime', |
|
| 195 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 196 | - ), |
|
| 197 | - 'customer.address.editor'=> array( |
|
| 198 | - 'label'=>'Customer address editor', |
|
| 199 | - 'code'=>'customer.address.editor', |
|
| 200 | - 'internalcode'=>'ezuad."editor"', |
|
| 201 | - 'type'=> 'string', |
|
| 202 | - 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 203 | - ), |
|
| 204 | - ); |
|
| 24 | + private $searchConfig = array( |
|
| 25 | + 'customer.address.id' => array( |
|
| 26 | + 'label' => 'Customer address ID', |
|
| 27 | + 'code' => 'customer.address.id', |
|
| 28 | + 'internalcode' => 'ezuad."id"', |
|
| 29 | + 'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ), |
|
| 30 | + 'type' => 'integer', |
|
| 31 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 32 | + 'public' => false, |
|
| 33 | + ), |
|
| 34 | + // site ID is not available |
|
| 35 | + 'customer.address.refid' => array( |
|
| 36 | + 'label' => 'Customer address parent ID', |
|
| 37 | + 'code' => 'customer.address.parentid', |
|
| 38 | + 'internalcode' => 'ezuad."parentid"', |
|
| 39 | + 'type' => 'integer', |
|
| 40 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 41 | + 'public' => false, |
|
| 42 | + ), |
|
| 43 | + 'customer.address.company'=> array( |
|
| 44 | + 'label' => 'Customer address company', |
|
| 45 | + 'code' => 'customer.address.company', |
|
| 46 | + 'internalcode' => 'ezuad."company"', |
|
| 47 | + 'type' => 'string', |
|
| 48 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 49 | + ), |
|
| 50 | + 'customer.address.vatid'=> array( |
|
| 51 | + 'label' => 'Customer address VAT ID', |
|
| 52 | + 'code' => 'customer.address.vatid', |
|
| 53 | + 'internalcode' => 'ezuad."vatid"', |
|
| 54 | + 'type' => 'string', |
|
| 55 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 56 | + ), |
|
| 57 | + 'customer.address.salutation' => array( |
|
| 58 | + 'label' => 'Customer address salutation', |
|
| 59 | + 'code' => 'customer.address.salutation', |
|
| 60 | + 'internalcode' => 'ezuad."salutation"', |
|
| 61 | + 'type' => 'integer', |
|
| 62 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 63 | + ), |
|
| 64 | + 'customer.address.title' => array( |
|
| 65 | + 'label' => 'Customer address title', |
|
| 66 | + 'code' => 'customer.address.title', |
|
| 67 | + 'internalcode' => 'ezuad."title"', |
|
| 68 | + 'type' => 'string', |
|
| 69 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 70 | + ), |
|
| 71 | + 'customer.address.firstname' => array( |
|
| 72 | + 'label' => 'Customer address firstname', |
|
| 73 | + 'code' => 'customer.address.firstname', |
|
| 74 | + 'internalcode' => 'ezuad."firstname"', |
|
| 75 | + 'type' => 'string', |
|
| 76 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 77 | + ), |
|
| 78 | + 'customer.address.lastname' => array( |
|
| 79 | + 'label' => 'Customer address lastname', |
|
| 80 | + 'code' => 'customer.address.lastname', |
|
| 81 | + 'internalcode' => 'ezuad."lastname"', |
|
| 82 | + 'type' => 'string', |
|
| 83 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 84 | + ), |
|
| 85 | + 'customer.address.address1' => array( |
|
| 86 | + 'label' => 'Customer address address part one', |
|
| 87 | + 'code' => 'customer.address.address1', |
|
| 88 | + 'internalcode' => 'ezuad."address1"', |
|
| 89 | + 'type' => 'string', |
|
| 90 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 91 | + ), |
|
| 92 | + 'customer.address.address2' => array( |
|
| 93 | + 'label' => 'Customer address address part two', |
|
| 94 | + 'code' => 'customer.address.address2', |
|
| 95 | + 'internalcode' => 'ezuad."address2"', |
|
| 96 | + 'type' => 'string', |
|
| 97 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 98 | + ), |
|
| 99 | + 'customer.address.address3' => array( |
|
| 100 | + 'label' => 'Customer address address part three', |
|
| 101 | + 'code' => 'customer.address.address3', |
|
| 102 | + 'internalcode' => 'ezuad."address3"', |
|
| 103 | + 'type' => 'string', |
|
| 104 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 105 | + ), |
|
| 106 | + 'customer.address.postal' => array( |
|
| 107 | + 'label' => 'Customer address postal', |
|
| 108 | + 'code' => 'customer.address.postal', |
|
| 109 | + 'internalcode' => 'ezuad."postal"', |
|
| 110 | + 'type' => 'string', |
|
| 111 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 112 | + ), |
|
| 113 | + 'customer.address.city' => array( |
|
| 114 | + 'label' => 'Customer address city', |
|
| 115 | + 'code' => 'customer.address.city', |
|
| 116 | + 'internalcode' => 'ezuad."city"', |
|
| 117 | + 'type' => 'string', |
|
| 118 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 119 | + ), |
|
| 120 | + 'customer.address.state' => array( |
|
| 121 | + 'label' => 'Customer address state', |
|
| 122 | + 'code' => 'customer.address.state', |
|
| 123 | + 'internalcode' => 'ezuad."state"', |
|
| 124 | + 'type' => 'string', |
|
| 125 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 126 | + ), |
|
| 127 | + 'customer.address.languageid' => array( |
|
| 128 | + 'label' => 'Customer address language', |
|
| 129 | + 'code' => 'customer.address.languageid', |
|
| 130 | + 'internalcode' => 'ezuad."langid"', |
|
| 131 | + 'type' => 'string', |
|
| 132 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 133 | + ), |
|
| 134 | + 'customer.address.countryid' => array( |
|
| 135 | + 'label' => 'Customer address country', |
|
| 136 | + 'code' => 'customer.address.countryid', |
|
| 137 | + 'internalcode' => 'ezuad."countryid"', |
|
| 138 | + 'type' => 'string', |
|
| 139 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 140 | + ), |
|
| 141 | + 'customer.address.telephone' => array( |
|
| 142 | + 'label' => 'Customer address telephone', |
|
| 143 | + 'code' => 'customer.address.telephone', |
|
| 144 | + 'internalcode' => 'ezuad."telephone"', |
|
| 145 | + 'type' => 'string', |
|
| 146 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 147 | + ), |
|
| 148 | + 'customer.address.email' => array( |
|
| 149 | + 'label' => 'Customer address email', |
|
| 150 | + 'code' => 'customer.address.email', |
|
| 151 | + 'internalcode' => 'ezuad."email"', |
|
| 152 | + 'type' => 'string', |
|
| 153 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 154 | + ), |
|
| 155 | + 'customer.address.telefax' => array( |
|
| 156 | + 'label' => 'Customer address telefax', |
|
| 157 | + 'code' => 'customer.address.telefax', |
|
| 158 | + 'internalcode' => 'ezuad."telefax"', |
|
| 159 | + 'type' => 'string', |
|
| 160 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 161 | + ), |
|
| 162 | + 'customer.address.website' => array( |
|
| 163 | + 'label' => 'Customer address website', |
|
| 164 | + 'code' => 'customer.address.website', |
|
| 165 | + 'internalcode' => 'ezuad."website"', |
|
| 166 | + 'type' => 'string', |
|
| 167 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 168 | + ), |
|
| 169 | + 'customer.address.flag' => array( |
|
| 170 | + 'label' => 'Customer address flag', |
|
| 171 | + 'code' => 'customer.address.flag', |
|
| 172 | + 'internalcode' => 'ezuad."flag"', |
|
| 173 | + 'type' => 'integer', |
|
| 174 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 175 | + ), |
|
| 176 | + 'customer.address.position' => array( |
|
| 177 | + 'label' => 'Customer address position', |
|
| 178 | + 'code' => 'customer.address.position', |
|
| 179 | + 'internalcode' => 'ezuad."pos"', |
|
| 180 | + 'type' => 'integer', |
|
| 181 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 182 | + ), |
|
| 183 | + 'customer.address.ctime'=> array( |
|
| 184 | + 'label'=>'Customer address create date/time', |
|
| 185 | + 'code'=>'customer.address.ctime', |
|
| 186 | + 'internalcode'=>'ezuad."ctime"', |
|
| 187 | + 'type'=> 'datetime', |
|
| 188 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 189 | + ), |
|
| 190 | + 'customer.address.mtime'=> array( |
|
| 191 | + 'label'=>'Customer address modification date/time', |
|
| 192 | + 'code'=>'customer.address.mtime', |
|
| 193 | + 'internalcode'=>'ezuad."mtime"', |
|
| 194 | + 'type'=> 'datetime', |
|
| 195 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 196 | + ), |
|
| 197 | + 'customer.address.editor'=> array( |
|
| 198 | + 'label'=>'Customer address editor', |
|
| 199 | + 'code'=>'customer.address.editor', |
|
| 200 | + 'internalcode'=>'ezuad."editor"', |
|
| 201 | + 'type'=> 'string', |
|
| 202 | + 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 203 | + ), |
|
| 204 | + ); |
|
| 205 | 205 | |
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * Removes old entries from the storage. |
|
| 209 | - * |
|
| 210 | - * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 211 | - */ |
|
| 212 | - public function cleanup( array $siteids ) |
|
| 213 | - { |
|
| 214 | - $path = 'mshop/customer/manager/address/submanagers'; |
|
| 215 | - foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
| 216 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 217 | - } |
|
| 218 | - } |
|
| 207 | + /** |
|
| 208 | + * Removes old entries from the storage. |
|
| 209 | + * |
|
| 210 | + * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 211 | + */ |
|
| 212 | + public function cleanup( array $siteids ) |
|
| 213 | + { |
|
| 214 | + $path = 'mshop/customer/manager/address/submanagers'; |
|
| 215 | + foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
| 216 | + $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * Removes multiple items specified by ids in the array. |
|
| 223 | - * |
|
| 224 | - * @param array $ids List of IDs |
|
| 225 | - */ |
|
| 226 | - public function deleteItems( array $ids ) |
|
| 227 | - { |
|
| 228 | - $this->deleteItemsBase( $ids, $this->getConfigPath() . 'delete', false ); |
|
| 229 | - } |
|
| 221 | + /** |
|
| 222 | + * Removes multiple items specified by ids in the array. |
|
| 223 | + * |
|
| 224 | + * @param array $ids List of IDs |
|
| 225 | + */ |
|
| 226 | + public function deleteItems( array $ids ) |
|
| 227 | + { |
|
| 228 | + $this->deleteItemsBase( $ids, $this->getConfigPath() . 'delete', false ); |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | 231 | |
| 232 | - /** |
|
| 233 | - * Returns the list attributes that can be used for searching. |
|
| 234 | - * |
|
| 235 | - * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 236 | - * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 237 | - */ |
|
| 238 | - public function getSearchAttributes( $withsub = true ) |
|
| 239 | - { |
|
| 240 | - $path = 'mshop/customer/manager/address/submanagers'; |
|
| 232 | + /** |
|
| 233 | + * Returns the list attributes that can be used for searching. |
|
| 234 | + * |
|
| 235 | + * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 236 | + * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 237 | + */ |
|
| 238 | + public function getSearchAttributes( $withsub = true ) |
|
| 239 | + { |
|
| 240 | + $path = 'mshop/customer/manager/address/submanagers'; |
|
| 241 | 241 | |
| 242 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array(), $withsub ); |
|
| 243 | - } |
|
| 242 | + return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array(), $withsub ); |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | 245 | |
| 246 | - /** |
|
| 247 | - * Returns a new manager for customer extensions |
|
| 248 | - * |
|
| 249 | - * @param string $manager Name of the sub manager type in lower case |
|
| 250 | - * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 251 | - * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 252 | - */ |
|
| 253 | - public function getSubManager( $manager, $name = null ) |
|
| 254 | - { |
|
| 255 | - return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 256 | - } |
|
| 246 | + /** |
|
| 247 | + * Returns a new manager for customer extensions |
|
| 248 | + * |
|
| 249 | + * @param string $manager Name of the sub manager type in lower case |
|
| 250 | + * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 251 | + * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 252 | + */ |
|
| 253 | + public function getSubManager( $manager, $name = null ) |
|
| 254 | + { |
|
| 255 | + return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * Returns the config path for retrieving the configuration values. |
|
| 261 | - * |
|
| 262 | - * @return string Configuration path (mshop/customer/manager/address/ezpublish/) |
|
| 263 | - */ |
|
| 264 | - protected function getConfigPath() |
|
| 265 | - { |
|
| 266 | - return 'mshop/customer/manager/address/ezpublish/'; |
|
| 267 | - } |
|
| 259 | + /** |
|
| 260 | + * Returns the config path for retrieving the configuration values. |
|
| 261 | + * |
|
| 262 | + * @return string Configuration path (mshop/customer/manager/address/ezpublish/) |
|
| 263 | + */ |
|
| 264 | + protected function getConfigPath() |
|
| 265 | + { |
|
| 266 | + return 'mshop/customer/manager/address/ezpublish/'; |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * Returns the search configuration for searching items. |
|
| 272 | - * |
|
| 273 | - * @return array Associative list of search keys and search definitions |
|
| 274 | - */ |
|
| 275 | - protected function getSearchConfig() |
|
| 276 | - { |
|
| 277 | - return $this->searchConfig; |
|
| 278 | - } |
|
| 270 | + /** |
|
| 271 | + * Returns the search configuration for searching items. |
|
| 272 | + * |
|
| 273 | + * @return array Associative list of search keys and search definitions |
|
| 274 | + */ |
|
| 275 | + protected function getSearchConfig() |
|
| 276 | + { |
|
| 277 | + return $this->searchConfig; |
|
| 278 | + } |
|
| 279 | 279 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'label' => 'Customer address ID', |
| 27 | 27 | 'code' => 'customer.address.id', |
| 28 | 28 | 'internalcode' => 'ezuad."id"', |
| 29 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )' ), |
|
| 29 | + 'internaldeps' => array('LEFT JOIN "ezuser_address" AS ezuad ON ( ezu."contentobject_id" = ezuad."parentid" )'), |
|
| 30 | 30 | 'type' => 'integer', |
| 31 | 31 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
| 32 | 32 | 'public' => false, |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | * |
| 210 | 210 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 211 | 211 | */ |
| 212 | - public function cleanup( array $siteids ) |
|
| 212 | + public function cleanup(array $siteids) |
|
| 213 | 213 | { |
| 214 | 214 | $path = 'mshop/customer/manager/address/submanagers'; |
| 215 | - foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
|
| 216 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 215 | + foreach ($this->getContext()->getConfig()->get($path, array()) as $domain) { |
|
| 216 | + $this->getSubManager($domain)->cleanup($siteids); |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | * |
| 224 | 224 | * @param array $ids List of IDs |
| 225 | 225 | */ |
| 226 | - public function deleteItems( array $ids ) |
|
| 226 | + public function deleteItems(array $ids) |
|
| 227 | 227 | { |
| 228 | - $this->deleteItemsBase( $ids, $this->getConfigPath() . 'delete', false ); |
|
| 228 | + $this->deleteItemsBase($ids, $this->getConfigPath().'delete', false); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 236 | 236 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 237 | 237 | */ |
| 238 | - public function getSearchAttributes( $withsub = true ) |
|
| 238 | + public function getSearchAttributes($withsub = true) |
|
| 239 | 239 | { |
| 240 | 240 | $path = 'mshop/customer/manager/address/submanagers'; |
| 241 | 241 | |
| 242 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, array(), $withsub ); |
|
| 242 | + return $this->getSearchAttributesBase($this->getSearchConfig(), $path, array(), $withsub); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 251 | 251 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 252 | 252 | */ |
| 253 | - public function getSubManager( $manager, $name = null ) |
|
| 253 | + public function getSubManager($manager, $name = null) |
|
| 254 | 254 | { |
| 255 | - return $this->getSubManagerBase( 'customer', 'address/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 255 | + return $this->getSubManagerBase('customer', 'address/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -18,461 +18,461 @@ |
||
| 18 | 18 | * @subpackage Customer |
| 19 | 19 | */ |
| 20 | 20 | class Ezpublish |
| 21 | - extends \Aimeos\MShop\Customer\Manager\Standard |
|
| 21 | + extends \Aimeos\MShop\Customer\Manager\Standard |
|
| 22 | 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 | - ); |
|
| 222 | - |
|
| 223 | - private $addressManager; |
|
| 224 | - |
|
| 225 | - |
|
| 226 | - /** |
|
| 227 | - * Removes old entries from the storage. |
|
| 228 | - * |
|
| 229 | - * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 230 | - */ |
|
| 231 | - public function cleanup( array $siteids ) |
|
| 232 | - { |
|
| 233 | - $path = 'mshop/customer/manager/submanagers'; |
|
| 234 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
| 235 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 236 | - } |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Instantiates a new customer item object. |
|
| 242 | - * |
|
| 243 | - * @return \Aimeos\MShop\Customer\Item\Iface New customer item object |
|
| 244 | - */ |
|
| 245 | - public function createItem() |
|
| 246 | - { |
|
| 247 | - return $this->createItemBase(); |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * Removes multiple items specified by ids in the array. |
|
| 253 | - * |
|
| 254 | - * @param array $ids List of IDs |
|
| 255 | - */ |
|
| 256 | - public function deleteItems( array $ids ) |
|
| 257 | - { |
|
| 258 | - $service = $this->getContext()->getEzUserService(); |
|
| 259 | - |
|
| 260 | - foreach( $ids as $id ) { |
|
| 261 | - $service->deleteUser( $service->loadUser( $id ) ); |
|
| 262 | - } |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * Returns the list attributes that can be used for searching. |
|
| 268 | - * |
|
| 269 | - * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 270 | - * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 271 | - */ |
|
| 272 | - public function getSearchAttributes( $withsub = true ) |
|
| 273 | - { |
|
| 274 | - $path = 'mshop/customer/manager/submanagers'; |
|
| 275 | - |
|
| 276 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * Returns a new manager for customer extensions |
|
| 282 | - * |
|
| 283 | - * @param string $manager Name of the sub manager type in lower case |
|
| 284 | - * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 285 | - * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 286 | - */ |
|
| 287 | - public function getSubManager( $manager, $name = null ) |
|
| 288 | - { |
|
| 289 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * Saves a customer item object. |
|
| 295 | - * |
|
| 296 | - * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
|
| 297 | - * @param boolean $fetch True if the new ID should be returned in the item |
|
| 298 | - */ |
|
| 299 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 300 | - { |
|
| 301 | - $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
|
| 302 | - if( !( $item instanceof $iface ) ) { |
|
| 303 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - if( !$item->isModified() ) { return; } |
|
| 307 | - |
|
| 308 | - $context = $this->getContext(); |
|
| 309 | - |
|
| 310 | - $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
|
| 311 | - if( !is_a( $context, $class ) ) { |
|
| 312 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - $service = $context->getEzUserService(); |
|
| 316 | - $email = $item->getPaymentAddress()->getEmail(); |
|
| 317 | - |
|
| 318 | - if( $item->getId() !== null ) |
|
| 319 | - { |
|
| 320 | - $struct = $service->newUserUpdateStruct(); |
|
| 321 | - $struct->password = $item->getPassword(); |
|
| 322 | - $struct->enabled = $item->getStatus(); |
|
| 323 | - $struct->email = $email; |
|
| 324 | - |
|
| 325 | - $user = $service->loadUser( $item->getId() ); |
|
| 326 | - $service->updateUser( $user, $struct ); |
|
| 327 | - } |
|
| 328 | - else |
|
| 329 | - { |
|
| 330 | - $struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' ); |
|
| 331 | - $struct->enabled = $item->getStatus(); |
|
| 332 | - |
|
| 333 | - $user = $service->createUser( $struct, array() ); |
|
| 334 | - $item->setId( $user->getUserId() ); |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - $dbm = $context->getDatabaseManager(); |
|
| 338 | - $dbname = $this->getResourceName(); |
|
| 339 | - $conn = $dbm->acquire( $dbname ); |
|
| 340 | - |
|
| 341 | - try |
|
| 342 | - { |
|
| 343 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 344 | - $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
| 345 | - $billingAddress = $item->getPaymentAddress(); |
|
| 346 | - |
|
| 347 | - $path = 'mshop/customer/manager/ezpublish/update'; |
|
| 348 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 349 | - |
|
| 350 | - $stmt->bind( 1, $billingAddress->getCompany() ); |
|
| 351 | - $stmt->bind( 2, $billingAddress->getVatID() ); |
|
| 352 | - $stmt->bind( 3, $billingAddress->getSalutation() ); |
|
| 353 | - $stmt->bind( 4, $billingAddress->getTitle() ); |
|
| 354 | - $stmt->bind( 5, $billingAddress->getFirstname() ); |
|
| 355 | - $stmt->bind( 6, $billingAddress->getLastname() ); |
|
| 356 | - $stmt->bind( 7, $billingAddress->getAddress1() ); |
|
| 357 | - $stmt->bind( 8, $billingAddress->getAddress2() ); |
|
| 358 | - $stmt->bind( 9, $billingAddress->getAddress3() ); |
|
| 359 | - $stmt->bind( 10, $billingAddress->getPostal() ); |
|
| 360 | - $stmt->bind( 11, $billingAddress->getCity() ); |
|
| 361 | - $stmt->bind( 12, $billingAddress->getState() ); |
|
| 362 | - $stmt->bind( 13, $billingAddress->getCountryId() ); |
|
| 363 | - $stmt->bind( 14, $billingAddress->getLanguageId() ); |
|
| 364 | - $stmt->bind( 15, $billingAddress->getTelephone() ); |
|
| 365 | - $stmt->bind( 16, $billingAddress->getTelefax() ); |
|
| 366 | - $stmt->bind( 17, $billingAddress->getWebsite() ); |
|
| 367 | - $stmt->bind( 18, $item->getBirthday() ); |
|
| 368 | - $stmt->bind( 19, $item->getDateVerified() ); |
|
| 369 | - $stmt->bind( 20, $date ); // Modification time |
|
| 370 | - $stmt->bind( 21, $context->getEditor() ); |
|
| 371 | - $stmt->bind( 22, $ctime ); // Creation time |
|
| 372 | - $stmt->bind( 23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 373 | - |
|
| 374 | - $stmt->execute()->finish(); |
|
| 375 | - |
|
| 376 | - $dbm->release( $conn, $dbname ); |
|
| 377 | - } |
|
| 378 | - catch( \Exception $e ) |
|
| 379 | - { |
|
| 380 | - $dbm->release( $conn, $dbname ); |
|
| 381 | - throw $e; |
|
| 382 | - } |
|
| 383 | - } |
|
| 384 | - |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * Returns the item objects matched by the given search criteria. |
|
| 388 | - * |
|
| 389 | - * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
|
| 390 | - * @param integer &$total Number of items that are available in total |
|
| 391 | - * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
|
| 392 | - * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
|
| 393 | - */ |
|
| 394 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
| 395 | - { |
|
| 396 | - $dbm = $this->getContext()->getDatabaseManager(); |
|
| 397 | - $dbname = $this->getResourceName(); |
|
| 398 | - $conn = $dbm->acquire( $dbname ); |
|
| 399 | - $map = array(); |
|
| 400 | - |
|
| 401 | - try |
|
| 402 | - { |
|
| 403 | - $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
|
| 404 | - $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
|
| 405 | - $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
|
| 406 | - $required = array( 'customer' ); |
|
| 407 | - |
|
| 408 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 409 | - |
|
| 410 | - while( ( $row = $results->fetch() ) !== false ) |
|
| 411 | - { |
|
| 412 | - $map[ $row['customer.id'] ] = $row; |
|
| 413 | - $map[ $row['customer.id'] ]['groups'] = array(); |
|
| 414 | - } |
|
| 415 | - |
|
| 416 | - |
|
| 417 | - $path = 'mshop/customer/manager/ezpublish/groups'; |
|
| 418 | - $stmt = $conn->create( $this->getGroupSql( array_keys( $map ), $path ) ); |
|
| 419 | - $results = $stmt->execute(); |
|
| 420 | - |
|
| 421 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 422 | - $map[ $row['contentobject_id'] ]['groups'][] = $row['role_id']; |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - $dbm->release( $conn, $dbname ); |
|
| 426 | - } |
|
| 427 | - catch( \Exception $e ) |
|
| 428 | - { |
|
| 429 | - $dbm->release( $conn, $dbname ); |
|
| 430 | - throw $e; |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - |
|
| 437 | - /** |
|
| 438 | - * Creates a new customer item. |
|
| 439 | - * |
|
| 440 | - * @param array $values List of attributes for customer item |
|
| 441 | - * @param array $listItems List items associated to the customer item |
|
| 442 | - * @param array $refItems Items referenced by the customer item via the list items |
|
| 443 | - * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
|
| 444 | - */ |
|
| 445 | - protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
| 446 | - { |
|
| 447 | - if( !isset( $this->addressManager ) ) { |
|
| 448 | - $this->addressManager = $this->getSubManager( 'address' ); |
|
| 449 | - } |
|
| 450 | - |
|
| 451 | - $address = $this->addressManager->createItem(); |
|
| 452 | - |
|
| 453 | - return new \Aimeos\MShop\Customer\Item\Ezpublish( $address, $values, $listItems, $refItems ); |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - |
|
| 457 | - /** |
|
| 458 | - * Returns the SQL statement for retrieving the customer group IDs |
|
| 459 | - * |
|
| 460 | - * @param array $ids List of customer IDs |
|
| 461 | - * @param string $cfgpath Configuration path to the SQL statement |
|
| 462 | - * @return string SQL statement ready for execution |
|
| 463 | - */ |
|
| 464 | - protected function getGroupSql( array $ids, $cfgpath ) |
|
| 465 | - { |
|
| 466 | - if( empty( $ids ) ) { return '1=1'; } |
|
| 467 | - |
|
| 468 | - $search = $this->createSearch(); |
|
| 469 | - $search->setConditions( $search->compare( '==', 'id', $ids ) ); |
|
| 470 | - |
|
| 471 | - $types = array( 'id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 472 | - $translations = array( 'id' => '"contentobject_id"' ); |
|
| 473 | - |
|
| 474 | - $cond = $search->getConditionString( $types, $translations ); |
|
| 475 | - |
|
| 476 | - return str_replace( ':cond', $cond, $this->getSqlConfig( $cfgpath ) ); |
|
| 477 | - } |
|
| 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 | + ); |
|
| 222 | + |
|
| 223 | + private $addressManager; |
|
| 224 | + |
|
| 225 | + |
|
| 226 | + /** |
|
| 227 | + * Removes old entries from the storage. |
|
| 228 | + * |
|
| 229 | + * @param array $siteids List of IDs for sites whose entries should be deleted |
|
| 230 | + */ |
|
| 231 | + public function cleanup( array $siteids ) |
|
| 232 | + { |
|
| 233 | + $path = 'mshop/customer/manager/submanagers'; |
|
| 234 | + foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
| 235 | + $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Instantiates a new customer item object. |
|
| 242 | + * |
|
| 243 | + * @return \Aimeos\MShop\Customer\Item\Iface New customer item object |
|
| 244 | + */ |
|
| 245 | + public function createItem() |
|
| 246 | + { |
|
| 247 | + return $this->createItemBase(); |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * Removes multiple items specified by ids in the array. |
|
| 253 | + * |
|
| 254 | + * @param array $ids List of IDs |
|
| 255 | + */ |
|
| 256 | + public function deleteItems( array $ids ) |
|
| 257 | + { |
|
| 258 | + $service = $this->getContext()->getEzUserService(); |
|
| 259 | + |
|
| 260 | + foreach( $ids as $id ) { |
|
| 261 | + $service->deleteUser( $service->loadUser( $id ) ); |
|
| 262 | + } |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * Returns the list attributes that can be used for searching. |
|
| 268 | + * |
|
| 269 | + * @param boolean $withsub Return also attributes of sub-managers if true |
|
| 270 | + * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 271 | + */ |
|
| 272 | + public function getSearchAttributes( $withsub = true ) |
|
| 273 | + { |
|
| 274 | + $path = 'mshop/customer/manager/submanagers'; |
|
| 275 | + |
|
| 276 | + return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * Returns a new manager for customer extensions |
|
| 282 | + * |
|
| 283 | + * @param string $manager Name of the sub manager type in lower case |
|
| 284 | + * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 285 | + * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
|
| 286 | + */ |
|
| 287 | + public function getSubManager( $manager, $name = null ) |
|
| 288 | + { |
|
| 289 | + return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * Saves a customer item object. |
|
| 295 | + * |
|
| 296 | + * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
|
| 297 | + * @param boolean $fetch True if the new ID should be returned in the item |
|
| 298 | + */ |
|
| 299 | + public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 300 | + { |
|
| 301 | + $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
|
| 302 | + if( !( $item instanceof $iface ) ) { |
|
| 303 | + throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + if( !$item->isModified() ) { return; } |
|
| 307 | + |
|
| 308 | + $context = $this->getContext(); |
|
| 309 | + |
|
| 310 | + $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
|
| 311 | + if( !is_a( $context, $class ) ) { |
|
| 312 | + throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + $service = $context->getEzUserService(); |
|
| 316 | + $email = $item->getPaymentAddress()->getEmail(); |
|
| 317 | + |
|
| 318 | + if( $item->getId() !== null ) |
|
| 319 | + { |
|
| 320 | + $struct = $service->newUserUpdateStruct(); |
|
| 321 | + $struct->password = $item->getPassword(); |
|
| 322 | + $struct->enabled = $item->getStatus(); |
|
| 323 | + $struct->email = $email; |
|
| 324 | + |
|
| 325 | + $user = $service->loadUser( $item->getId() ); |
|
| 326 | + $service->updateUser( $user, $struct ); |
|
| 327 | + } |
|
| 328 | + else |
|
| 329 | + { |
|
| 330 | + $struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' ); |
|
| 331 | + $struct->enabled = $item->getStatus(); |
|
| 332 | + |
|
| 333 | + $user = $service->createUser( $struct, array() ); |
|
| 334 | + $item->setId( $user->getUserId() ); |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + $dbm = $context->getDatabaseManager(); |
|
| 338 | + $dbname = $this->getResourceName(); |
|
| 339 | + $conn = $dbm->acquire( $dbname ); |
|
| 340 | + |
|
| 341 | + try |
|
| 342 | + { |
|
| 343 | + $date = date( 'Y-m-d H:i:s' ); |
|
| 344 | + $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
| 345 | + $billingAddress = $item->getPaymentAddress(); |
|
| 346 | + |
|
| 347 | + $path = 'mshop/customer/manager/ezpublish/update'; |
|
| 348 | + $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 349 | + |
|
| 350 | + $stmt->bind( 1, $billingAddress->getCompany() ); |
|
| 351 | + $stmt->bind( 2, $billingAddress->getVatID() ); |
|
| 352 | + $stmt->bind( 3, $billingAddress->getSalutation() ); |
|
| 353 | + $stmt->bind( 4, $billingAddress->getTitle() ); |
|
| 354 | + $stmt->bind( 5, $billingAddress->getFirstname() ); |
|
| 355 | + $stmt->bind( 6, $billingAddress->getLastname() ); |
|
| 356 | + $stmt->bind( 7, $billingAddress->getAddress1() ); |
|
| 357 | + $stmt->bind( 8, $billingAddress->getAddress2() ); |
|
| 358 | + $stmt->bind( 9, $billingAddress->getAddress3() ); |
|
| 359 | + $stmt->bind( 10, $billingAddress->getPostal() ); |
|
| 360 | + $stmt->bind( 11, $billingAddress->getCity() ); |
|
| 361 | + $stmt->bind( 12, $billingAddress->getState() ); |
|
| 362 | + $stmt->bind( 13, $billingAddress->getCountryId() ); |
|
| 363 | + $stmt->bind( 14, $billingAddress->getLanguageId() ); |
|
| 364 | + $stmt->bind( 15, $billingAddress->getTelephone() ); |
|
| 365 | + $stmt->bind( 16, $billingAddress->getTelefax() ); |
|
| 366 | + $stmt->bind( 17, $billingAddress->getWebsite() ); |
|
| 367 | + $stmt->bind( 18, $item->getBirthday() ); |
|
| 368 | + $stmt->bind( 19, $item->getDateVerified() ); |
|
| 369 | + $stmt->bind( 20, $date ); // Modification time |
|
| 370 | + $stmt->bind( 21, $context->getEditor() ); |
|
| 371 | + $stmt->bind( 22, $ctime ); // Creation time |
|
| 372 | + $stmt->bind( 23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 373 | + |
|
| 374 | + $stmt->execute()->finish(); |
|
| 375 | + |
|
| 376 | + $dbm->release( $conn, $dbname ); |
|
| 377 | + } |
|
| 378 | + catch( \Exception $e ) |
|
| 379 | + { |
|
| 380 | + $dbm->release( $conn, $dbname ); |
|
| 381 | + throw $e; |
|
| 382 | + } |
|
| 383 | + } |
|
| 384 | + |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * Returns the item objects matched by the given search criteria. |
|
| 388 | + * |
|
| 389 | + * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
|
| 390 | + * @param integer &$total Number of items that are available in total |
|
| 391 | + * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
|
| 392 | + * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
|
| 393 | + */ |
|
| 394 | + public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
| 395 | + { |
|
| 396 | + $dbm = $this->getContext()->getDatabaseManager(); |
|
| 397 | + $dbname = $this->getResourceName(); |
|
| 398 | + $conn = $dbm->acquire( $dbname ); |
|
| 399 | + $map = array(); |
|
| 400 | + |
|
| 401 | + try |
|
| 402 | + { |
|
| 403 | + $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
|
| 404 | + $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
|
| 405 | + $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
|
| 406 | + $required = array( 'customer' ); |
|
| 407 | + |
|
| 408 | + $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 409 | + |
|
| 410 | + while( ( $row = $results->fetch() ) !== false ) |
|
| 411 | + { |
|
| 412 | + $map[ $row['customer.id'] ] = $row; |
|
| 413 | + $map[ $row['customer.id'] ]['groups'] = array(); |
|
| 414 | + } |
|
| 415 | + |
|
| 416 | + |
|
| 417 | + $path = 'mshop/customer/manager/ezpublish/groups'; |
|
| 418 | + $stmt = $conn->create( $this->getGroupSql( array_keys( $map ), $path ) ); |
|
| 419 | + $results = $stmt->execute(); |
|
| 420 | + |
|
| 421 | + while( ( $row = $results->fetch() ) !== false ) { |
|
| 422 | + $map[ $row['contentobject_id'] ]['groups'][] = $row['role_id']; |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + $dbm->release( $conn, $dbname ); |
|
| 426 | + } |
|
| 427 | + catch( \Exception $e ) |
|
| 428 | + { |
|
| 429 | + $dbm->release( $conn, $dbname ); |
|
| 430 | + throw $e; |
|
| 431 | + } |
|
| 432 | + |
|
| 433 | + return $this->buildItems( $map, $ref, 'customer' ); |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + |
|
| 437 | + /** |
|
| 438 | + * Creates a new customer item. |
|
| 439 | + * |
|
| 440 | + * @param array $values List of attributes for customer item |
|
| 441 | + * @param array $listItems List items associated to the customer item |
|
| 442 | + * @param array $refItems Items referenced by the customer item via the list items |
|
| 443 | + * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
|
| 444 | + */ |
|
| 445 | + protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
| 446 | + { |
|
| 447 | + if( !isset( $this->addressManager ) ) { |
|
| 448 | + $this->addressManager = $this->getSubManager( 'address' ); |
|
| 449 | + } |
|
| 450 | + |
|
| 451 | + $address = $this->addressManager->createItem(); |
|
| 452 | + |
|
| 453 | + return new \Aimeos\MShop\Customer\Item\Ezpublish( $address, $values, $listItems, $refItems ); |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + |
|
| 457 | + /** |
|
| 458 | + * Returns the SQL statement for retrieving the customer group IDs |
|
| 459 | + * |
|
| 460 | + * @param array $ids List of customer IDs |
|
| 461 | + * @param string $cfgpath Configuration path to the SQL statement |
|
| 462 | + * @return string SQL statement ready for execution |
|
| 463 | + */ |
|
| 464 | + protected function getGroupSql( array $ids, $cfgpath ) |
|
| 465 | + { |
|
| 466 | + if( empty( $ids ) ) { return '1=1'; } |
|
| 467 | + |
|
| 468 | + $search = $this->createSearch(); |
|
| 469 | + $search->setConditions( $search->compare( '==', 'id', $ids ) ); |
|
| 470 | + |
|
| 471 | + $types = array( 'id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 472 | + $translations = array( 'id' => '"contentobject_id"' ); |
|
| 473 | + |
|
| 474 | + $cond = $search->getConditionString( $types, $translations ); |
|
| 475 | + |
|
| 476 | + return str_replace( ':cond', $cond, $this->getSqlConfig( $cfgpath ) ); |
|
| 477 | + } |
|
| 478 | 478 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * @param array $siteids List of IDs for sites whose entries should be deleted |
| 230 | 230 | */ |
| 231 | - public function cleanup( array $siteids ) |
|
| 231 | + public function cleanup(array $siteids) |
|
| 232 | 232 | { |
| 233 | 233 | $path = 'mshop/customer/manager/submanagers'; |
| 234 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) { |
|
| 235 | - $this->getSubManager( $domain )->cleanup( $siteids ); |
|
| 234 | + foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) { |
|
| 235 | + $this->getSubManager($domain)->cleanup($siteids); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -253,12 +253,12 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @param array $ids List of IDs |
| 255 | 255 | */ |
| 256 | - public function deleteItems( array $ids ) |
|
| 256 | + public function deleteItems(array $ids) |
|
| 257 | 257 | { |
| 258 | 258 | $service = $this->getContext()->getEzUserService(); |
| 259 | 259 | |
| 260 | - foreach( $ids as $id ) { |
|
| 261 | - $service->deleteUser( $service->loadUser( $id ) ); |
|
| 260 | + foreach ($ids as $id) { |
|
| 261 | + $service->deleteUser($service->loadUser($id)); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
@@ -269,11 +269,11 @@ discard block |
||
| 269 | 269 | * @param boolean $withsub Return also attributes of sub-managers if true |
| 270 | 270 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 271 | 271 | */ |
| 272 | - public function getSearchAttributes( $withsub = true ) |
|
| 272 | + public function getSearchAttributes($withsub = true) |
|
| 273 | 273 | { |
| 274 | 274 | $path = 'mshop/customer/manager/submanagers'; |
| 275 | 275 | |
| 276 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub ); |
|
| 276 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | |
@@ -284,9 +284,9 @@ discard block |
||
| 284 | 284 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 285 | 285 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
| 286 | 286 | */ |
| 287 | - public function getSubManager( $manager, $name = null ) |
|
| 287 | + public function getSubManager($manager, $name = null) |
|
| 288 | 288 | { |
| 289 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 289 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Ezpublish' : $name)); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
@@ -296,88 +296,88 @@ discard block |
||
| 296 | 296 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object |
| 297 | 297 | * @param boolean $fetch True if the new ID should be returned in the item |
| 298 | 298 | */ |
| 299 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 299 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 300 | 300 | { |
| 301 | 301 | $iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface'; |
| 302 | - if( !( $item instanceof $iface ) ) { |
|
| 303 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) ); |
|
| 302 | + if (!($item instanceof $iface)) { |
|
| 303 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface)); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if( !$item->isModified() ) { return; } |
|
| 306 | + if (!$item->isModified()) { return; } |
|
| 307 | 307 | |
| 308 | 308 | $context = $this->getContext(); |
| 309 | 309 | |
| 310 | 310 | $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
| 311 | - if( !is_a( $context, $class ) ) { |
|
| 312 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
| 311 | + if (!is_a($context, $class)) { |
|
| 312 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $class)); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $service = $context->getEzUserService(); |
| 316 | 316 | $email = $item->getPaymentAddress()->getEmail(); |
| 317 | 317 | |
| 318 | - if( $item->getId() !== null ) |
|
| 318 | + if ($item->getId() !== null) |
|
| 319 | 319 | { |
| 320 | 320 | $struct = $service->newUserUpdateStruct(); |
| 321 | 321 | $struct->password = $item->getPassword(); |
| 322 | 322 | $struct->enabled = $item->getStatus(); |
| 323 | 323 | $struct->email = $email; |
| 324 | 324 | |
| 325 | - $user = $service->loadUser( $item->getId() ); |
|
| 326 | - $service->updateUser( $user, $struct ); |
|
| 325 | + $user = $service->loadUser($item->getId()); |
|
| 326 | + $service->updateUser($user, $struct); |
|
| 327 | 327 | } |
| 328 | 328 | else |
| 329 | 329 | { |
| 330 | - $struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' ); |
|
| 330 | + $struct = $service->newUserCreateStruct($item->getCode(), $email, $item->getPassword(), 'eng-GB'); |
|
| 331 | 331 | $struct->enabled = $item->getStatus(); |
| 332 | 332 | |
| 333 | - $user = $service->createUser( $struct, array() ); |
|
| 334 | - $item->setId( $user->getUserId() ); |
|
| 333 | + $user = $service->createUser($struct, array()); |
|
| 334 | + $item->setId($user->getUserId()); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | $dbm = $context->getDatabaseManager(); |
| 338 | 338 | $dbname = $this->getResourceName(); |
| 339 | - $conn = $dbm->acquire( $dbname ); |
|
| 339 | + $conn = $dbm->acquire($dbname); |
|
| 340 | 340 | |
| 341 | 341 | try |
| 342 | 342 | { |
| 343 | - $date = date( 'Y-m-d H:i:s' ); |
|
| 344 | - $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
| 343 | + $date = date('Y-m-d H:i:s'); |
|
| 344 | + $ctime = ($item->getTimeCreated() ? $item->getTimeCreated() : $date); |
|
| 345 | 345 | $billingAddress = $item->getPaymentAddress(); |
| 346 | 346 | |
| 347 | 347 | $path = 'mshop/customer/manager/ezpublish/update'; |
| 348 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
| 349 | - |
|
| 350 | - $stmt->bind( 1, $billingAddress->getCompany() ); |
|
| 351 | - $stmt->bind( 2, $billingAddress->getVatID() ); |
|
| 352 | - $stmt->bind( 3, $billingAddress->getSalutation() ); |
|
| 353 | - $stmt->bind( 4, $billingAddress->getTitle() ); |
|
| 354 | - $stmt->bind( 5, $billingAddress->getFirstname() ); |
|
| 355 | - $stmt->bind( 6, $billingAddress->getLastname() ); |
|
| 356 | - $stmt->bind( 7, $billingAddress->getAddress1() ); |
|
| 357 | - $stmt->bind( 8, $billingAddress->getAddress2() ); |
|
| 358 | - $stmt->bind( 9, $billingAddress->getAddress3() ); |
|
| 359 | - $stmt->bind( 10, $billingAddress->getPostal() ); |
|
| 360 | - $stmt->bind( 11, $billingAddress->getCity() ); |
|
| 361 | - $stmt->bind( 12, $billingAddress->getState() ); |
|
| 362 | - $stmt->bind( 13, $billingAddress->getCountryId() ); |
|
| 363 | - $stmt->bind( 14, $billingAddress->getLanguageId() ); |
|
| 364 | - $stmt->bind( 15, $billingAddress->getTelephone() ); |
|
| 365 | - $stmt->bind( 16, $billingAddress->getTelefax() ); |
|
| 366 | - $stmt->bind( 17, $billingAddress->getWebsite() ); |
|
| 367 | - $stmt->bind( 18, $item->getBirthday() ); |
|
| 368 | - $stmt->bind( 19, $item->getDateVerified() ); |
|
| 369 | - $stmt->bind( 20, $date ); // Modification time |
|
| 370 | - $stmt->bind( 21, $context->getEditor() ); |
|
| 371 | - $stmt->bind( 22, $ctime ); // Creation time |
|
| 372 | - $stmt->bind( 23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 348 | + $stmt = $this->getCachedStatement($conn, $path); |
|
| 349 | + |
|
| 350 | + $stmt->bind(1, $billingAddress->getCompany()); |
|
| 351 | + $stmt->bind(2, $billingAddress->getVatID()); |
|
| 352 | + $stmt->bind(3, $billingAddress->getSalutation()); |
|
| 353 | + $stmt->bind(4, $billingAddress->getTitle()); |
|
| 354 | + $stmt->bind(5, $billingAddress->getFirstname()); |
|
| 355 | + $stmt->bind(6, $billingAddress->getLastname()); |
|
| 356 | + $stmt->bind(7, $billingAddress->getAddress1()); |
|
| 357 | + $stmt->bind(8, $billingAddress->getAddress2()); |
|
| 358 | + $stmt->bind(9, $billingAddress->getAddress3()); |
|
| 359 | + $stmt->bind(10, $billingAddress->getPostal()); |
|
| 360 | + $stmt->bind(11, $billingAddress->getCity()); |
|
| 361 | + $stmt->bind(12, $billingAddress->getState()); |
|
| 362 | + $stmt->bind(13, $billingAddress->getCountryId()); |
|
| 363 | + $stmt->bind(14, $billingAddress->getLanguageId()); |
|
| 364 | + $stmt->bind(15, $billingAddress->getTelephone()); |
|
| 365 | + $stmt->bind(16, $billingAddress->getTelefax()); |
|
| 366 | + $stmt->bind(17, $billingAddress->getWebsite()); |
|
| 367 | + $stmt->bind(18, $item->getBirthday()); |
|
| 368 | + $stmt->bind(19, $item->getDateVerified()); |
|
| 369 | + $stmt->bind(20, $date); // Modification time |
|
| 370 | + $stmt->bind(21, $context->getEditor()); |
|
| 371 | + $stmt->bind(22, $ctime); // Creation time |
|
| 372 | + $stmt->bind(23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 373 | 373 | |
| 374 | 374 | $stmt->execute()->finish(); |
| 375 | 375 | |
| 376 | - $dbm->release( $conn, $dbname ); |
|
| 376 | + $dbm->release($conn, $dbname); |
|
| 377 | 377 | } |
| 378 | - catch( \Exception $e ) |
|
| 378 | + catch (\Exception $e) |
|
| 379 | 379 | { |
| 380 | - $dbm->release( $conn, $dbname ); |
|
| 380 | + $dbm->release($conn, $dbname); |
|
| 381 | 381 | throw $e; |
| 382 | 382 | } |
| 383 | 383 | } |
@@ -391,11 +391,11 @@ discard block |
||
| 391 | 391 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
| 392 | 392 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
| 393 | 393 | */ |
| 394 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
| 394 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null) |
|
| 395 | 395 | { |
| 396 | 396 | $dbm = $this->getContext()->getDatabaseManager(); |
| 397 | 397 | $dbname = $this->getResourceName(); |
| 398 | - $conn = $dbm->acquire( $dbname ); |
|
| 398 | + $conn = $dbm->acquire($dbname); |
|
| 399 | 399 | $map = array(); |
| 400 | 400 | |
| 401 | 401 | try |
@@ -403,34 +403,34 @@ discard block |
||
| 403 | 403 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 404 | 404 | $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
| 405 | 405 | $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
| 406 | - $required = array( 'customer' ); |
|
| 406 | + $required = array('customer'); |
|
| 407 | 407 | |
| 408 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 408 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 409 | 409 | |
| 410 | - while( ( $row = $results->fetch() ) !== false ) |
|
| 410 | + while (($row = $results->fetch()) !== false) |
|
| 411 | 411 | { |
| 412 | - $map[ $row['customer.id'] ] = $row; |
|
| 413 | - $map[ $row['customer.id'] ]['groups'] = array(); |
|
| 412 | + $map[$row['customer.id']] = $row; |
|
| 413 | + $map[$row['customer.id']]['groups'] = array(); |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | $path = 'mshop/customer/manager/ezpublish/groups'; |
| 418 | - $stmt = $conn->create( $this->getGroupSql( array_keys( $map ), $path ) ); |
|
| 418 | + $stmt = $conn->create($this->getGroupSql(array_keys($map), $path)); |
|
| 419 | 419 | $results = $stmt->execute(); |
| 420 | 420 | |
| 421 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 422 | - $map[ $row['contentobject_id'] ]['groups'][] = $row['role_id']; |
|
| 421 | + while (($row = $results->fetch()) !== false) { |
|
| 422 | + $map[$row['contentobject_id']]['groups'][] = $row['role_id']; |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - $dbm->release( $conn, $dbname ); |
|
| 425 | + $dbm->release($conn, $dbname); |
|
| 426 | 426 | } |
| 427 | - catch( \Exception $e ) |
|
| 427 | + catch (\Exception $e) |
|
| 428 | 428 | { |
| 429 | - $dbm->release( $conn, $dbname ); |
|
| 429 | + $dbm->release($conn, $dbname); |
|
| 430 | 430 | throw $e; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
| 433 | + return $this->buildItems($map, $ref, 'customer'); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | |
@@ -442,15 +442,15 @@ discard block |
||
| 442 | 442 | * @param array $refItems Items referenced by the customer item via the list items |
| 443 | 443 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
| 444 | 444 | */ |
| 445 | - protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
|
| 445 | + protected function createItemBase(array $values = array(), array $listItems = array(), array $refItems = array()) |
|
| 446 | 446 | { |
| 447 | - if( !isset( $this->addressManager ) ) { |
|
| 448 | - $this->addressManager = $this->getSubManager( 'address' ); |
|
| 447 | + if (!isset($this->addressManager)) { |
|
| 448 | + $this->addressManager = $this->getSubManager('address'); |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | $address = $this->addressManager->createItem(); |
| 452 | 452 | |
| 453 | - return new \Aimeos\MShop\Customer\Item\Ezpublish( $address, $values, $listItems, $refItems ); |
|
| 453 | + return new \Aimeos\MShop\Customer\Item\Ezpublish($address, $values, $listItems, $refItems); |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | |
@@ -461,18 +461,18 @@ discard block |
||
| 461 | 461 | * @param string $cfgpath Configuration path to the SQL statement |
| 462 | 462 | * @return string SQL statement ready for execution |
| 463 | 463 | */ |
| 464 | - protected function getGroupSql( array $ids, $cfgpath ) |
|
| 464 | + protected function getGroupSql(array $ids, $cfgpath) |
|
| 465 | 465 | { |
| 466 | - if( empty( $ids ) ) { return '1=1'; } |
|
| 466 | + if (empty($ids)) { return '1=1'; } |
|
| 467 | 467 | |
| 468 | 468 | $search = $this->createSearch(); |
| 469 | - $search->setConditions( $search->compare( '==', 'id', $ids ) ); |
|
| 469 | + $search->setConditions($search->compare('==', 'id', $ids)); |
|
| 470 | 470 | |
| 471 | - $types = array( 'id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
| 472 | - $translations = array( 'id' => '"contentobject_id"' ); |
|
| 471 | + $types = array('id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
| 472 | + $translations = array('id' => '"contentobject_id"'); |
|
| 473 | 473 | |
| 474 | - $cond = $search->getConditionString( $types, $translations ); |
|
| 474 | + $cond = $search->getConditionString($types, $translations); |
|
| 475 | 475 | |
| 476 | - return str_replace( ':cond', $cond, $this->getSqlConfig( $cfgpath ) ); |
|
| 476 | + return str_replace(':cond', $cond, $this->getSqlConfig($cfgpath)); |
|
| 477 | 477 | } |
| 478 | 478 | } |
@@ -324,8 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | $user = $service->loadUser( $item->getId() ); |
| 326 | 326 | $service->updateUser( $user, $struct ); |
| 327 | - } |
|
| 328 | - else |
|
| 327 | + } else |
|
| 329 | 328 | { |
| 330 | 329 | $struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' ); |
| 331 | 330 | $struct->enabled = $item->getStatus(); |
@@ -374,8 +373,7 @@ discard block |
||
| 374 | 373 | $stmt->execute()->finish(); |
| 375 | 374 | |
| 376 | 375 | $dbm->release( $conn, $dbname ); |
| 377 | - } |
|
| 378 | - catch( \Exception $e ) |
|
| 376 | + } catch( \Exception $e ) |
|
| 379 | 377 | { |
| 380 | 378 | $dbm->release( $conn, $dbname ); |
| 381 | 379 | throw $e; |
@@ -423,8 +421,7 @@ discard block |
||
| 423 | 421 | } |
| 424 | 422 | |
| 425 | 423 | $dbm->release( $conn, $dbname ); |
| 426 | - } |
|
| 427 | - catch( \Exception $e ) |
|
| 424 | + } catch( \Exception $e ) |
|
| 428 | 425 | { |
| 429 | 426 | $dbm->release( $conn, $dbname ); |
| 430 | 427 | throw $e; |
@@ -18,154 +18,154 @@ |
||
| 18 | 18 | * @subpackage Customer |
| 19 | 19 | */ |
| 20 | 20 | class Ezpublish |
| 21 | - extends \Aimeos\MShop\Customer\Manager\Group\Standard |
|
| 22 | - implements \Aimeos\MShop\Customer\Manager\Group\Iface |
|
| 21 | + extends \Aimeos\MShop\Customer\Manager\Group\Standard |
|
| 22 | + implements \Aimeos\MShop\Customer\Manager\Group\Iface |
|
| 23 | 23 | { |
| 24 | - private $searchConfig = array( |
|
| 25 | - 'customer.group.id' => array( |
|
| 26 | - 'code' => 'customer.group.id', |
|
| 27 | - 'internalcode' => 'ezro."id"', |
|
| 28 | - 'label' => 'Customer group ID', |
|
| 29 | - 'type' => 'integer', |
|
| 30 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 31 | - ), |
|
| 32 | - 'customer.group.code' => array( |
|
| 33 | - 'code' => 'customer.group.code', |
|
| 34 | - 'internalcode' => 'ezro."id"', |
|
| 35 | - 'label' => 'Customer group code', |
|
| 36 | - 'type' => 'string', |
|
| 37 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 38 | - ), |
|
| 39 | - 'customer.group.label' => array( |
|
| 40 | - 'code' => 'customer.group.label', |
|
| 41 | - 'internalcode' => 'ezro."name"', |
|
| 42 | - 'label' => 'Customer group label', |
|
| 43 | - 'type' => 'string', |
|
| 44 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 45 | - ), |
|
| 46 | - 'customer.group.ctime'=> array( |
|
| 47 | - 'code' => 'customer.group.ctime', |
|
| 48 | - 'internalcode' => '\'0\'', |
|
| 49 | - 'label' => 'Customer group creation time', |
|
| 50 | - 'type' => 'datetime', |
|
| 51 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 52 | - ), |
|
| 53 | - 'customer.group.mtime'=> array( |
|
| 54 | - 'code' => 'customer.group.mtime', |
|
| 55 | - 'internalcode' => '\'0\'', |
|
| 56 | - 'label' => 'Customer group modification time', |
|
| 57 | - 'type' => 'datetime', |
|
| 58 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 59 | - ), |
|
| 60 | - 'customer.group.editor'=> array( |
|
| 61 | - 'code' => 'customer.group.editor', |
|
| 62 | - 'internalcode' => '\'0\'', |
|
| 63 | - 'label' => 'Customer group editor', |
|
| 64 | - 'type' => 'string', |
|
| 65 | - 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 66 | - ), |
|
| 67 | - ); |
|
| 68 | - |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Removes old entries from the database |
|
| 72 | - * |
|
| 73 | - * @param integer[] $siteids List of IDs for sites whose entries should be deleted |
|
| 74 | - */ |
|
| 75 | - public function cleanup( array $siteids ) |
|
| 76 | - { |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Removes multiple items specified by their IDs |
|
| 82 | - * |
|
| 83 | - * @param array $ids List of IDs |
|
| 84 | - */ |
|
| 85 | - public function deleteItems( array $ids ) |
|
| 86 | - { |
|
| 87 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Deleting groups is not supported, please use the eZ Publish backend' ) ); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Returns the attributes that can be used for searching |
|
| 93 | - * |
|
| 94 | - * @param boolean $withsub Return attributes of sub-managers too if true |
|
| 95 | - * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 96 | - */ |
|
| 97 | - public function getSearchAttributes( $withsub = true ) |
|
| 98 | - { |
|
| 99 | - $path = 'mshop/customer/manager/group/submanagers'; |
|
| 100 | - |
|
| 101 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array(), $withsub ); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * Returns a new manager for customer group extensions |
|
| 107 | - * |
|
| 108 | - * @param string $manager Name of the sub manager type in lower case |
|
| 109 | - * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 110 | - * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions |
|
| 111 | - */ |
|
| 112 | - public function getSubManager( $manager, $name = null ) |
|
| 113 | - { |
|
| 114 | - return $this->getSubManagerBase( 'customer/group', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Inserts a new or updates an existing customer group item |
|
| 120 | - * |
|
| 121 | - * @param \Aimeos\MShop\Customer\Item\Group\Iface $item Customer group item |
|
| 122 | - * @param boolean $fetch True if the new ID should be returned in the item |
|
| 123 | - */ |
|
| 124 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 125 | - { |
|
| 126 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Saving groups is not supported, please use the eZ Publish backend' ) ); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Returns the item objects matched by the given search criteria. |
|
| 132 | - * |
|
| 133 | - * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
|
| 134 | - * @param array $ref List of domain items that should be fetched too |
|
| 135 | - * @param integer &$total Number of items that are available in total |
|
| 136 | - * @return array List of items implementing \Aimeos\MShop\Customer\Item\Group\Iface |
|
| 137 | - * @throws \Aimeos\MShop\Exception If retrieving items failed |
|
| 138 | - */ |
|
| 139 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
| 140 | - { |
|
| 141 | - $map = array(); |
|
| 142 | - $context = $this->getContext(); |
|
| 143 | - |
|
| 144 | - $dbm = $context->getDatabaseManager(); |
|
| 145 | - $dbname = $this->getResourceName(); |
|
| 146 | - $conn = $dbm->acquire( $dbname ); |
|
| 147 | - |
|
| 148 | - try |
|
| 149 | - { |
|
| 150 | - $required = array( 'customer.group' ); |
|
| 151 | - $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
|
| 152 | - $cfgPathSearch = 'mshop/customer/manager/group/ezpublish/search'; |
|
| 153 | - $cfgPathCount = 'mshop/customer/manager/group/ezpublish/count'; |
|
| 154 | - |
|
| 155 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 156 | - |
|
| 157 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 158 | - $map[$row['customer.group.id']] = $this->createItemBase( $row ); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - $dbm->release( $conn, $dbname ); |
|
| 162 | - } |
|
| 163 | - catch( \Exception $e ) |
|
| 164 | - { |
|
| 165 | - $dbm->release( $conn, $dbname ); |
|
| 166 | - throw $e; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - return $map; |
|
| 170 | - } |
|
| 24 | + private $searchConfig = array( |
|
| 25 | + 'customer.group.id' => array( |
|
| 26 | + 'code' => 'customer.group.id', |
|
| 27 | + 'internalcode' => 'ezro."id"', |
|
| 28 | + 'label' => 'Customer group ID', |
|
| 29 | + 'type' => 'integer', |
|
| 30 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 31 | + ), |
|
| 32 | + 'customer.group.code' => array( |
|
| 33 | + 'code' => 'customer.group.code', |
|
| 34 | + 'internalcode' => 'ezro."id"', |
|
| 35 | + 'label' => 'Customer group code', |
|
| 36 | + 'type' => 'string', |
|
| 37 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
|
| 38 | + ), |
|
| 39 | + 'customer.group.label' => array( |
|
| 40 | + 'code' => 'customer.group.label', |
|
| 41 | + 'internalcode' => 'ezro."name"', |
|
| 42 | + 'label' => 'Customer group label', |
|
| 43 | + 'type' => 'string', |
|
| 44 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 45 | + ), |
|
| 46 | + 'customer.group.ctime'=> array( |
|
| 47 | + 'code' => 'customer.group.ctime', |
|
| 48 | + 'internalcode' => '\'0\'', |
|
| 49 | + 'label' => 'Customer group creation time', |
|
| 50 | + 'type' => 'datetime', |
|
| 51 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 52 | + ), |
|
| 53 | + 'customer.group.mtime'=> array( |
|
| 54 | + 'code' => 'customer.group.mtime', |
|
| 55 | + 'internalcode' => '\'0\'', |
|
| 56 | + 'label' => 'Customer group modification time', |
|
| 57 | + 'type' => 'datetime', |
|
| 58 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 59 | + ), |
|
| 60 | + 'customer.group.editor'=> array( |
|
| 61 | + 'code' => 'customer.group.editor', |
|
| 62 | + 'internalcode' => '\'0\'', |
|
| 63 | + 'label' => 'Customer group editor', |
|
| 64 | + 'type' => 'string', |
|
| 65 | + 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
|
| 66 | + ), |
|
| 67 | + ); |
|
| 68 | + |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Removes old entries from the database |
|
| 72 | + * |
|
| 73 | + * @param integer[] $siteids List of IDs for sites whose entries should be deleted |
|
| 74 | + */ |
|
| 75 | + public function cleanup( array $siteids ) |
|
| 76 | + { |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Removes multiple items specified by their IDs |
|
| 82 | + * |
|
| 83 | + * @param array $ids List of IDs |
|
| 84 | + */ |
|
| 85 | + public function deleteItems( array $ids ) |
|
| 86 | + { |
|
| 87 | + throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Deleting groups is not supported, please use the eZ Publish backend' ) ); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Returns the attributes that can be used for searching |
|
| 93 | + * |
|
| 94 | + * @param boolean $withsub Return attributes of sub-managers too if true |
|
| 95 | + * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
|
| 96 | + */ |
|
| 97 | + public function getSearchAttributes( $withsub = true ) |
|
| 98 | + { |
|
| 99 | + $path = 'mshop/customer/manager/group/submanagers'; |
|
| 100 | + |
|
| 101 | + return $this->getSearchAttributesBase( $this->searchConfig, $path, array(), $withsub ); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * Returns a new manager for customer group extensions |
|
| 107 | + * |
|
| 108 | + * @param string $manager Name of the sub manager type in lower case |
|
| 109 | + * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
|
| 110 | + * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions |
|
| 111 | + */ |
|
| 112 | + public function getSubManager( $manager, $name = null ) |
|
| 113 | + { |
|
| 114 | + return $this->getSubManagerBase( 'customer/group', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Inserts a new or updates an existing customer group item |
|
| 120 | + * |
|
| 121 | + * @param \Aimeos\MShop\Customer\Item\Group\Iface $item Customer group item |
|
| 122 | + * @param boolean $fetch True if the new ID should be returned in the item |
|
| 123 | + */ |
|
| 124 | + public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 125 | + { |
|
| 126 | + throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Saving groups is not supported, please use the eZ Publish backend' ) ); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Returns the item objects matched by the given search criteria. |
|
| 132 | + * |
|
| 133 | + * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
|
| 134 | + * @param array $ref List of domain items that should be fetched too |
|
| 135 | + * @param integer &$total Number of items that are available in total |
|
| 136 | + * @return array List of items implementing \Aimeos\MShop\Customer\Item\Group\Iface |
|
| 137 | + * @throws \Aimeos\MShop\Exception If retrieving items failed |
|
| 138 | + */ |
|
| 139 | + public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
| 140 | + { |
|
| 141 | + $map = array(); |
|
| 142 | + $context = $this->getContext(); |
|
| 143 | + |
|
| 144 | + $dbm = $context->getDatabaseManager(); |
|
| 145 | + $dbname = $this->getResourceName(); |
|
| 146 | + $conn = $dbm->acquire( $dbname ); |
|
| 147 | + |
|
| 148 | + try |
|
| 149 | + { |
|
| 150 | + $required = array( 'customer.group' ); |
|
| 151 | + $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
|
| 152 | + $cfgPathSearch = 'mshop/customer/manager/group/ezpublish/search'; |
|
| 153 | + $cfgPathCount = 'mshop/customer/manager/group/ezpublish/count'; |
|
| 154 | + |
|
| 155 | + $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 156 | + |
|
| 157 | + while( ( $row = $results->fetch() ) !== false ) { |
|
| 158 | + $map[$row['customer.group.id']] = $this->createItemBase( $row ); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + $dbm->release( $conn, $dbname ); |
|
| 162 | + } |
|
| 163 | + catch( \Exception $e ) |
|
| 164 | + { |
|
| 165 | + $dbm->release( $conn, $dbname ); |
|
| 166 | + throw $e; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + return $map; |
|
| 170 | + } |
|
| 171 | 171 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param integer[] $siteids List of IDs for sites whose entries should be deleted |
| 74 | 74 | */ |
| 75 | - public function cleanup( array $siteids ) |
|
| 75 | + public function cleanup(array $siteids) |
|
| 76 | 76 | { |
| 77 | 77 | } |
| 78 | 78 | |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @param array $ids List of IDs |
| 84 | 84 | */ |
| 85 | - public function deleteItems( array $ids ) |
|
| 85 | + public function deleteItems(array $ids) |
|
| 86 | 86 | { |
| 87 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Deleting groups is not supported, please use the eZ Publish backend' ) ); |
|
| 87 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Deleting groups is not supported, please use the eZ Publish backend')); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -94,11 +94,11 @@ discard block |
||
| 94 | 94 | * @param boolean $withsub Return attributes of sub-managers too if true |
| 95 | 95 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 96 | 96 | */ |
| 97 | - public function getSearchAttributes( $withsub = true ) |
|
| 97 | + public function getSearchAttributes($withsub = true) |
|
| 98 | 98 | { |
| 99 | 99 | $path = 'mshop/customer/manager/group/submanagers'; |
| 100 | 100 | |
| 101 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, array(), $withsub ); |
|
| 101 | + return $this->getSearchAttributesBase($this->searchConfig, $path, array(), $withsub); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
| 110 | 110 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions |
| 111 | 111 | */ |
| 112 | - public function getSubManager( $manager, $name = null ) |
|
| 112 | + public function getSubManager($manager, $name = null) |
|
| 113 | 113 | { |
| 114 | - return $this->getSubManagerBase( 'customer/group', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
| 114 | + return $this->getSubManagerBase('customer/group', $manager, ($name === null ? 'Ezpublish' : $name)); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * @param \Aimeos\MShop\Customer\Item\Group\Iface $item Customer group item |
| 122 | 122 | * @param boolean $fetch True if the new ID should be returned in the item |
| 123 | 123 | */ |
| 124 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
| 124 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
| 125 | 125 | { |
| 126 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Saving groups is not supported, please use the eZ Publish backend' ) ); |
|
| 126 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Saving groups is not supported, please use the eZ Publish backend')); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -136,33 +136,33 @@ discard block |
||
| 136 | 136 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Group\Iface |
| 137 | 137 | * @throws \Aimeos\MShop\Exception If retrieving items failed |
| 138 | 138 | */ |
| 139 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
|
| 139 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null) |
|
| 140 | 140 | { |
| 141 | 141 | $map = array(); |
| 142 | 142 | $context = $this->getContext(); |
| 143 | 143 | |
| 144 | 144 | $dbm = $context->getDatabaseManager(); |
| 145 | 145 | $dbname = $this->getResourceName(); |
| 146 | - $conn = $dbm->acquire( $dbname ); |
|
| 146 | + $conn = $dbm->acquire($dbname); |
|
| 147 | 147 | |
| 148 | 148 | try |
| 149 | 149 | { |
| 150 | - $required = array( 'customer.group' ); |
|
| 150 | + $required = array('customer.group'); |
|
| 151 | 151 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
| 152 | 152 | $cfgPathSearch = 'mshop/customer/manager/group/ezpublish/search'; |
| 153 | 153 | $cfgPathCount = 'mshop/customer/manager/group/ezpublish/count'; |
| 154 | 154 | |
| 155 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
| 155 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
| 156 | 156 | |
| 157 | - while( ( $row = $results->fetch() ) !== false ) { |
|
| 158 | - $map[$row['customer.group.id']] = $this->createItemBase( $row ); |
|
| 157 | + while (($row = $results->fetch()) !== false) { |
|
| 158 | + $map[$row['customer.group.id']] = $this->createItemBase($row); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $dbm->release( $conn, $dbname ); |
|
| 161 | + $dbm->release($conn, $dbname); |
|
| 162 | 162 | } |
| 163 | - catch( \Exception $e ) |
|
| 163 | + catch (\Exception $e) |
|
| 164 | 164 | { |
| 165 | - $dbm->release( $conn, $dbname ); |
|
| 165 | + $dbm->release($conn, $dbname); |
|
| 166 | 166 | throw $e; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -159,8 +159,7 @@ |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $dbm->release( $conn, $dbname ); |
| 162 | - } |
|
| 163 | - catch( \Exception $e ) |
|
| 162 | + } catch( \Exception $e ) |
|
| 164 | 163 | { |
| 165 | 164 | $dbm->release( $conn, $dbname ); |
| 166 | 165 | throw $e; |
@@ -19,33 +19,33 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class Ezpublish extends \Aimeos\MShop\Context\Item\Standard |
| 21 | 21 | { |
| 22 | - private $ezUserService; |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Sets the eZ user service object |
|
| 27 | - * |
|
| 28 | - * @param \eZ\Publish\API\Repository\UserService $service eZ user service object |
|
| 29 | - * @return \Aimeos\MShop\Context\Item\Iface Context item for chaining method calls |
|
| 30 | - */ |
|
| 31 | - public function setEzUserService( \eZ\Publish\API\Repository\UserService $service ) |
|
| 32 | - { |
|
| 33 | - $this->ezUserService = $service; |
|
| 34 | - return $this; |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Returns the eZ user service object |
|
| 40 | - * |
|
| 41 | - * @return \eZ\Publish\API\Repository\UserService eZ user service object |
|
| 42 | - */ |
|
| 43 | - public function getEzUserService() |
|
| 44 | - { |
|
| 45 | - if( !isset( $this->ezUserService ) ) { |
|
| 46 | - throw new \Aimeos\MShop\Exception( sprintf( 'eZ user service not available' ) ); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - return $this->ezUserService; |
|
| 50 | - } |
|
| 22 | + private $ezUserService; |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Sets the eZ user service object |
|
| 27 | + * |
|
| 28 | + * @param \eZ\Publish\API\Repository\UserService $service eZ user service object |
|
| 29 | + * @return \Aimeos\MShop\Context\Item\Iface Context item for chaining method calls |
|
| 30 | + */ |
|
| 31 | + public function setEzUserService( \eZ\Publish\API\Repository\UserService $service ) |
|
| 32 | + { |
|
| 33 | + $this->ezUserService = $service; |
|
| 34 | + return $this; |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Returns the eZ user service object |
|
| 40 | + * |
|
| 41 | + * @return \eZ\Publish\API\Repository\UserService eZ user service object |
|
| 42 | + */ |
|
| 43 | + public function getEzUserService() |
|
| 44 | + { |
|
| 45 | + if( !isset( $this->ezUserService ) ) { |
|
| 46 | + throw new \Aimeos\MShop\Exception( sprintf( 'eZ user service not available' ) ); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + return $this->ezUserService; |
|
| 50 | + } |
|
| 51 | 51 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param \eZ\Publish\API\Repository\UserService $service eZ user service object |
| 29 | 29 | * @return \Aimeos\MShop\Context\Item\Iface Context item for chaining method calls |
| 30 | 30 | */ |
| 31 | - public function setEzUserService( \eZ\Publish\API\Repository\UserService $service ) |
|
| 31 | + public function setEzUserService(\eZ\Publish\API\Repository\UserService $service) |
|
| 32 | 32 | { |
| 33 | 33 | $this->ezUserService = $service; |
| 34 | 34 | return $this; |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function getEzUserService() |
| 44 | 44 | { |
| 45 | - if( !isset( $this->ezUserService ) ) { |
|
| 46 | - throw new \Aimeos\MShop\Exception( sprintf( 'eZ user service not available' ) ); |
|
| 45 | + if (!isset($this->ezUserService)) { |
|
| 46 | + throw new \Aimeos\MShop\Exception(sprintf('eZ user service not available')); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $this->ezUserService; |